formguide_edit.tpl.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. defined('IN_ADMIN') or exit('No permission resources.');
  3. include $this->admin_tpl('header', 'admin');
  4. ?>
  5. <div class="pad-10">
  6. <form method="post" action="?m=formguide&c=formguide&a=edit&formid=<?php echo $_GET['formid']?>" name="myform" id="myform">
  7. <table class="table_form" width="100%" cellspacing="0">
  8. <tbody>
  9. <tr>
  10. <th width="150"><strong><?php echo L('name')?>:</strong></th>
  11. <td><input name="info[name]" id="name" class="input-text" type="text" value="<?php echo new_html_special_chars($data['name'])?>" size="30" ></td>
  12. </tr>
  13. <tr>
  14. <th><strong><?php echo L('tablename')?>:</strong></th>
  15. <td><input name="info[tablename]" id="tablename" class="input-text" type="text" value="<?php echo $data['tablename']?>" readonly size="25" ></td>
  16. </tr>
  17. <tr>
  18. <th><strong><?php echo L('introduction')?>:</strong></th>
  19. <td><textarea name="info[description]" id="description" rows="6" cols="50"><?php echo $data['description']?></textarea></td>
  20. </tr>
  21. <tr>
  22. <th><strong><?php echo L('time_limit')?>:</strong></th>
  23. <td><input type="radio" name="setting[enabletime]" value="1" <?php if ($data['setting']['enabletime']) {?>checked<?php }?>> <?php echo L('enable')?> <input type="radio" name="setting[enabletime]" value="0" <?php if ($data['setting']['enabletime']==0) {?>checked<?php }?>> <?php echo L('unenable')?></td>
  24. </tr>
  25. <tr id="time_start" style="<?php if ($data['setting']['enabletime']==0) {?>display:none;<?php }?>">
  26. <th><strong><?php echo L('start_time')?>:</strong></th>
  27. <td><?php echo form::date('setting[starttime]', $data['setting']['starttime']?date('Y-m-d', $data['setting']['starttime']):0)?></td>
  28. </tr>
  29. <tr id="time_end" style="<?php if ($data['setting']['enabletime']==0) {?>display:none;<?php }?>">
  30. <th><strong><?php echo L('end_time')?>:</strong></th>
  31. <td><?php echo form::date('setting[endtime]', $data['setting']['endtime']?date('Y-m-d', $data['setting']['endtime']):0)?></td>
  32. </tr>
  33. <tr>
  34. <th><strong><?php echo L('allowed_send_mail')?>:</strong></th>
  35. <td><input name="setting[sendmail]" type="radio" value="1" <?php if ($data['setting']['sendmail']) {?>checked<?php }?>>&nbsp;<?php echo L('yes')?>&nbsp;&nbsp;<input name="setting[sendmail]" type="radio" value="0" <?php if ($data['setting']['sendmail']==0) {?>checked<?php }?>>&nbsp;<?php echo L('no')?></td>
  36. </tr>
  37. <tr id="mailaddress" style="<?php if ($data['setting']['sendmail']==0) {?>display:none;<?php }?>">
  38. <th><strong><?php echo L('e-mail_address')?>:</strong></th>
  39. <td><input type="text" name="setting[mails]" id="mails" class="input-text" value="<?php echo $data['setting']['mails']?>" size="50"> <?php echo L('multiple_with_commas')?></td>
  40. </tr>
  41. <tr>
  42. <th><strong><?php echo L('allows_more_ip')?>:</strong></th>
  43. <td><input type='radio' name='setting[allowmultisubmit]' value='1' <?php if($data['setting']['allowmultisubmit'] == 1) {?>checked<?php }?>> <?php echo L('yes')?>&nbsp;&nbsp;&nbsp;&nbsp;
  44. <input type='radio' name='setting[allowmultisubmit]' value='0' <?php if($data['setting']['allowmultisubmit'] == 0) {?>checked<?php }?>> <?php echo L('no')?></td>
  45. </tr>
  46. <tr>
  47. <th><strong><?php echo L('allowunreg')?>:</strong></th>
  48. <td><input type='radio' name='setting[allowunreg]' value='1' <?php if($data['setting']['allowunreg'] == 1) {?>checked<?php }?>> <?php echo L('yes')?>&nbsp;&nbsp;&nbsp;&nbsp;
  49. <input type='radio' name='setting[allowunreg]' value='0' <?php if($data['setting']['allowunreg'] == 0) {?>checked<?php }?>> <?php echo L('no')?></td>
  50. </tr>
  51. <tr>
  52. <th><strong><?php echo L('optional_style')?>:</strong></th>
  53. <td>
  54. <?php echo form::select($template_list, $data['default_style'], 'name="info[default_style]" id="style" onchange="load_file_list(this.value)"', L('please_select'))?>
  55. </td>
  56. </tr>
  57. <tr>
  58. <th><strong><?php echo L('template_selection')?>:</strong></th>
  59. <td id="show_template"><script type="text/javascript">$.getJSON('?m=admin&c=category&a=public_tpl_file_list&style=<?php echo $data['default_style']?>&id=<?php echo $data['show_template']?>&module=formguide&templates=show&name=info&pc_hash='+pc_hash, function(data){$('#show_template').html(data.show_template);});</script></td>
  60. </tr>
  61. <tr>
  62. <th><strong>js调用使用的模板:</strong></th>
  63. <td id="show_js_template"><script type="text/javascript">$.getJSON('?m=admin&c=category&a=public_tpl_file_list&style=<?php echo $data['default_style']?>&id=<?php echo $data['js_template']?>&module=formguide&templates=show_js&name=info&pc_hash='+pc_hash, function(data){$('#show_js_template').html(data.show_js_template);});</script></td>
  64. </tr>
  65. </tbody>
  66. </table>
  67. <input type="submit" name="dosubmit" id="dosubmit" value=" <?php echo L('ok')?> " class="dialog">&nbsp;<input type="reset" class="dialog" value=" <?php echo L('clear')?> ">
  68. </form>
  69. </div>
  70. </body>
  71. </html>
  72. <script type="text/javascript">
  73. function load_file_list(id) {
  74. if (id=='') return false;
  75. $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&module=formguide&templates=show|show_js&name=info&pc_hash='+pc_hash, function(data){$('#show_template').html(data.show_template);$('#show_js_template').html(data.show_js_template);});
  76. }
  77. $(document).ready(function(){
  78. $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'220',height:'70'}, function(){this.close();$(obj).focus();})}});
  79. $('#name').formValidator({onshow:"<?php echo L('input_form_title')?>",onfocus:"<?php echo L('title_min_3_chars')?>",oncorrect:"<?php echo L('right')?>"}).inputValidator({min:1,onerror:"<?php echo L('title_cannot_empty')?>"}).defaultPassed();
  80. $('#tablename').formValidator({onshow:"<?php echo L('please_input_tallename')?>", onfocus:"<?php echo L('standard')?>", oncorrect:"<?php echo L('right')?>"}).regexValidator({regexp:"^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,19}$",onerror:"<?php echo L('tablename_was_wrong');?>"}).inputValidator({min:1,onerror:"<?php echo L('tablename_no_empty')?>"}).ajaxValidator({
  81. type : "get",
  82. url : "",
  83. data : "m=formguide&c=formguide&a=public_checktable&formid=<?php echo $_GET['formid']?>",
  84. datatype : "html",
  85. cached:false,
  86. getdata:{issystem:'issystem'},
  87. async:'false',
  88. success : function(data){
  89. if( data == "1" ){
  90. return true;
  91. } else {
  92. return false;
  93. }
  94. },
  95. buttons: $("#dosubmit"),
  96. onerror : "<?php echo L('tablename_existed')?>",
  97. onwait : "<?php echo L('connecting_please_wait')?>"
  98. }).defaultPassed();
  99. $('#starttime').formValidator({onshow:"<?php echo L('select_stardate')?>",onfocus:"<?php echo L('select_stardate')?>",oncorrect:"<?php echo L('right_all')?>"}).defaultPassed();
  100. $('#endtime').formValidator({onshow:"<?php echo L('select_downdate')?>",onfocus:"<?php echo L('select_downdate')?>",oncorrect:"<?php echo L('right_all')?>"}).defaultPassed();
  101. $('#style').formValidator({onshow:"<?php echo L('select_style')?>",onfocus:"<?php echo L('select_style')?>",oncorrect:"<?php echo L('right')?>"}).inputValidator({min:1,onerror:"<?php echo L('select_style')?>"}).defaultPassed();
  102. });
  103. $("input:radio[name='setting[enabletime]']").click(function (){
  104. if($("input:radio[name='setting[enabletime]'][checked]").val()==0) {
  105. $("#time_start").hide();
  106. $("#time_end").hide();
  107. } else if($("input:radio[name='setting[enabletime]'][checked]").val()==1) {
  108. $("#time_start").show();
  109. $("#time_end").show();
  110. }
  111. });
  112. $("input:radio[name='setting[sendmail]']").click(function (){
  113. if($("input:radio[name='setting[sendmail]'][checked]").val()==0) {
  114. $("#mailaddress").hide();
  115. } else if($("input:radio[name='setting[sendmail]'][checked]").val()==1) {
  116. $("#mailaddress").show();
  117. }
  118. });
  119. </script>