dbsource_edit.tpl.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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'}, function(){this.close();$(obj).focus();})}});
  9. $("#host").formValidator({onshow:"<?php echo L('input').L('server_address')?>",onfocus:"<?php echo L('input').L('server_address')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('server_address')?>"});
  10. $("#port").formValidator({onshow:"<?php echo L('input').L('server_port')?>",onfocus:"<?php echo L('input').L('server_port')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('server_port')?>"}).regexValidator({regexp:"intege1",datatype:"enum",param:'i',onerror:"<?php echo L('server_ports_must_be_positive_integers')?>"});
  11. $("#dbtablepre").formValidator({onshow:"<?php echo L('input').L('dbtablepre')?>",onfocus:"<?php echo L('tip_pre')?>"});
  12. $("#username").formValidator({onshow:"<?php echo L('input').L('username')?>",onfocus:"<?php echo L('input').L('username')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('username')?>"});
  13. $("#password").formValidator({onshow:"<?php echo L('input').L('password')?>",onfocus:"<?php echo L('input').L('password')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('password')?>"});
  14. $("#dbname").formValidator({onshow:"<?php echo L('input').L('database')?>",onfocus:"<?php echo L('input').L('database')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('database')?>"});
  15. })
  16. //-->
  17. </script>
  18. <div class="pad-10">
  19. <form action="?m=dbsource&c=dbsource_admin&a=edit&id=<?php echo $id?>" method="post" id="myform">
  20. <div>
  21. <fieldset>
  22. <legend><?php echo L('configure_the_external_data_source')?></legend>
  23. <table width="100%" class="table_form">
  24. <tr>
  25. <th width="80"><?php echo L('dbsource_name')?>:</th>
  26. <td class="y-bg"><?php echo $data['name']?></td>
  27. </tr>
  28. <tr>
  29. <th><?php echo L('server_address')?>:</th>
  30. <td class="y-bg"><input type="text" class="input-text" name="host" id="host" size="30" value="<?php echo $data['host']?>" /></td>
  31. </tr>
  32. <tr>
  33. <th><?php echo L('server_port')?>:</th>
  34. <td class="y-bg"><input type="text" class="input-text" name="port" id="port" size="30" value="<?php echo $data['port']?>" /></td>
  35. </tr>
  36. <tr>
  37. <th><?php echo L('username')?>:</th>
  38. <td class="y-bg"><input type="text" class="input-text" name="username" id="username" size="30" value="<?php echo $data['username']?>" /></td>
  39. </tr>
  40. <tr>
  41. <th><?php echo L('password')?>:</th>
  42. <td class="y-bg"><input type="password" class="input-text" name="password" id="password" size="30" value="<?php echo $data['password']?>" /></td>
  43. </tr>
  44. <tr>
  45. <th><?php echo L('database')?>:</th>
  46. <td class="y-bg"><input type="text" class="input-text" name="dbname" id="dbname" size="30" value="<?php echo $data['dbname']?>" /></td>
  47. </tr>
  48. <tr>
  49. <th><?php echo L('dbtablepre');?>:</th>
  50. <td class="y-bg"><input type="text" class="input-text" name="dbtablepre" id="dbtablepre" value="<?php echo $data['dbtablepre']?>" size="30"/> </td>
  51. </tr>
  52. <tr>
  53. <th><?php echo L('charset')?>:</th>
  54. <td class="y-bg"><?php echo form::select(array('gbk'=>'GBK', 'utf8'=>'UTF-8', 'gb2312'=>'GB2312', 'latin1'=>'Latin1'), $data['charset'], 'name="charset" id="charset"')?></td>
  55. </tr>
  56. <tr>
  57. <th></th>
  58. <td class="y-bg"><input type="button" class="button" value="<?php echo L('test_connections')?>" onclick="test_connect()" /></td>
  59. </tr>
  60. </table>
  61. </fieldset>
  62. <div class="bk15"></div>
  63. <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="" />
  64. </div>
  65. </div>
  66. </form>
  67. <script type="text/javascript">
  68. <!--
  69. function test_connect() {
  70. $.get('?m=dbsource&c=dbsource_admin&a=public_test_mysql_connect', {host:$('#host').val(),username:$('#username').val(), password:$('#password').val(), port:$('#port').val()}, function(data){if(data==1){alert('<?php echo L('connect_success')?>')}else{alert('<?php echo L('connect_failed')?>')}});
  71. }
  72. //-->
  73. </script>
  74. </body>
  75. </html>