data_edit.tpl.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. defined('IN_ADMIN') or exit('No permission resources.');
  3. include $this->admin_tpl('header', 'admin');
  4. ?>
  5. <script type="text/javascript">
  6. <!--
  7. $(function(){
  8. $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'})}});
  9. $("#name").formValidator({onshow:"<?php echo L('input').L('name')?>",onfocus:"<?php echo L('input').L('name')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('name')?>"}).ajaxValidator({type : "get",url : "",data :"m=dbsource&c=data&a=public_name&id=<?php echo $id?>",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('name').L('exists')?>",onwait : "<?php echo L('connecting')?>"}).defaultPassed();
  10. $("#cache").formValidator({onshow:"<?php echo L("enter_the_cache_input_will_not_be_cached")?>",onfocus:"<?php echo L("enter_the_cache_input_will_not_be_cached")?>",empty:true}).regexValidator({regexp:"num1",datatype:'enum',param:'i',onerror:"<?php echo L("cache_time_can_only_be_positive")?>"});
  11. $("#num").formValidator({onshow:"<?php echo L('input').L("num")?>",onfocus:"<?php echo L('input').L("num")?>",empty:true}).regexValidator({regexp:"num1",datatype:'enum',param:'i',onerror:"<?php echo L('that_shows_only_positive_numbers')?>"});
  12. })
  13. //-->
  14. </script>
  15. <div class="pad-10">
  16. <form action="?m=dbsource&c=data&a=edit&id=<?php echo $id?>" method="post" id="myform">
  17. <div>
  18. <fieldset>
  19. <legend><?php echo L('the_configuration_data_source')?></legend>
  20. <table width="100%" class="table_form">
  21. <tr>
  22. <th width="80"><?php echo L('stdcall')?>:</th>
  23. <td class="y-bg"><?php echo form::radio(array('0'=>L('model_configuration'), '1'=>L('custom_sql')), $type ? $type : 0, 'name="type" onclick="location.href=\''.get_url().'&type=\'+this.value"')?></td>
  24. </tr>
  25. <?php if ($type==0) :?>
  26. <tr>
  27. <th><?php echo L('select_model')?>:</th>
  28. <td class="y-bg"><?php echo form::select($modules, $module, 'name="module" id="module" onchange="location.href=\''.get_url().'&module=\'+this.value"')?><script type="text/javascript">$(function(){$("#module").formValidator({onshow:"<?php echo L('please_select_model')?>",onfocus:"<?php echo L('please_select_model')?>"}).inputValidator({min:1, onerror:'<?php echo L('please_select_model')?>'});});</script></td>
  29. </tr>
  30. <?php if ($module):?>
  31. <tr>
  32. <th><?php echo L('selectingoperation')?>:</th>
  33. <td class="y-bg"><?php echo form::radio($html['action'], $action, 'name="action" onclick="location.href=\''.get_url().'&action=\'+this.value"')?></td>
  34. </tr>
  35. <?php endif;?>
  36. <?php if(isset($html[$action]) && is_array($html[$action]) && $action)foreach($html[$action] as $k=>$v):?>
  37. <tr>
  38. <th><?php echo $v['name']?>:</th>
  39. <td class="y-bg"><?php echo creat_form($k, $v, $form_data[$k])?></td>
  40. </tr>
  41. <?php endforeach;?>
  42. <?php else :?>
  43. <tr>
  44. <th valign="top"><?php echo L('custom_sql')?>:</th>
  45. <td class="y-bg"><textarea name="data" id="data" style="width:386px;height:178px;"><?php if($edit_data['type']==1)echo $edit_data['data']?></textarea><script type="text/javascript">$(function(){$("#data").formValidator({onshow:"<?php echo L('please_enter_a_sql')?>",onfocus:"<?php echo L('please_enter_a_sql')?>"}).inputValidator({min:1, onerror:'<?php echo L('please_enter_a_sql')?>'});});</script></td>
  46. </tr>
  47. <?php endif;?>
  48. </table>
  49. </fieldset>
  50. <div class="bk15"></div>
  51. <fieldset>
  52. <legend><?php echo L('vlan')?></legend>
  53. <table width="100%" class="table_form">
  54. <tr>
  55. <th width="80"><?php echo L('name')?>:</th>
  56. <td class="y-bg"><input type="text" class="input-text" name="name" id="name" size="30" value="<?php echo new_html_special_chars($edit_data['name'])?>" /></td>
  57. </tr>
  58. <tr>
  59. <th><?php echo L('output_mode')?>:</th>
  60. <td class="y-bg"><?php echo form::radio(array('1'=>'json', '2'=>'xml', '3'=>'js'), $edit_data['dis_type'], 'name="dis_type" onclick="showcode(this.value)"')?></td>
  61. </tr>
  62. <tbody id="template_code" <?php if($edit_data['dis_type'] != 3) echo 'style="display:none"'?>>
  63. <tr>
  64. <th valign="top"><?php echo L('template')?>:</th>
  65. <td class="y-bg"><textarea name="template" id="template" style="width:386px;height:178px;"><?php if(!empty($edit_data['template'])) { echo $edit_data['template'];} else {echo '{loop $data $k $v}
  66. <!-- '.L('valgrind').' -->
  67. {/loop}';}?></textarea></td>
  68. </tr>
  69. </tbody>
  70. <tr>
  71. <th width="80"><?php echo L('buffer_time')?>:</th>
  72. <td class="y-bg"><input type="text" class="input-text" name="cache" id="cache" size="30" value="<?php echo $edit_data['cache']?>" /></td>
  73. </tr>
  74. <tr>
  75. <th width="80"><?php echo L('num')?>:</th>
  76. <td class="y-bg"><input type="text" class="input-text" name="num" id="num" size="30" value="<?php echo $edit_data['num']?>" /></td>
  77. </tr>
  78. </table>
  79. </fieldset>
  80. <div class="bk15"></div>
  81. <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="" />
  82. </div>
  83. </div>
  84. </form>
  85. <script type="text/javascript">
  86. <!--
  87. function showcode(obj) {
  88. if (obj==3){
  89. $('#template_code').show();
  90. } else {
  91. $('#template_code').hide();
  92. }
  93. }
  94. //-->
  95. </script>
  96. </body>
  97. </html>