dbsource_add.tpl.php 4.6 KB

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