formguide_field_add.tpl.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. defined('IN_ADMIN') or exit('No permission resources.');
  3. $show_validator = $show_dialog = 1;
  4. include $this->admin_tpl('header','admin');?>
  5. <script type="text/javascript">
  6. <!--
  7. $(function(){
  8. $.formValidator.initConfig({autotip:true,formid:"myform"});
  9. $("#field").formValidator({onshow:"<?php echo L('input').L('fieldname')?>",onfocus:"<?php echo L('fieldname').L('between_1_to_20')?>"}).regexValidator({regexp:"^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,19}$",onerror:"<?php echo L('fieldname_was_wrong');?>"}).inputValidator({min:1,max:20,onerror:"<?php echo L('fieldname').L('between_1_to_20')?>"}).ajaxValidator({
  10. type : "get",
  11. url : "",
  12. data : "m=formguide&c=formguide_field&a=public_checkfield&modelid=<?php echo $formid?>",
  13. datatype : "html",
  14. cached:false,
  15. getdata:{issystem:'issystem'},
  16. async:'false',
  17. success : function(data){
  18. if( data == "1" ){
  19. return true;
  20. } else {
  21. return false;
  22. }
  23. },
  24. buttons: $("#dosubmit"),
  25. onerror : "<?php echo L('fieldname').L('already_exist')?>",
  26. onwait : "<?php echo L('connecting_please_wait')?>"
  27. });
  28. $("#formtype").formValidator({onshow:"<?php echo L('select_fieldtype');?>",onfocus:"<?php echo L('select_fieldtype');?>",oncorrect:"<?php echo L('input_right');?>",defaultvalue:""}).inputValidator({min:1,onerror: "<?php echo L('select_fieldtype');?>"});
  29. $("#name").formValidator({onshow:"<?php echo L('input_nickname');?>",onfocus:"<?php echo L('nickname_empty');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_nickname');?>"});
  30. })
  31. //-->
  32. </script>
  33. <div class="pad_10">
  34. <div class="subnav">
  35. <h2 class="title-1 line-x f14 fb blue lh28"><?php echo L('formguide');?>--<?php echo $m_r['name'].L('field_manage'); ?></h2>
  36. <div class="content-menu ib-a blue line-x"><a class="add fb" href="?m=formguide&c=formguide_field&a=add&modelid=<?php echo $formid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('add_field');?></em></a>
  37.  <?php if (isset($formid) && !empty($formid)) {?><a href="?m=formguide&c=formguide_field&a=init&modelid=<?php echo $formid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('manage_field');?></em></a><?php } else {?><a href="?m=formguide&c=formguide_field&a=init&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('public_field_manage')?></em></a><?php }?></div>
  38. <div class="bk10"></div>
  39. </div>
  40. <form name="myform" id="myform" action="?m=formguide&c=formguide_field&a=add" method="post">
  41. <div class="common-form">
  42. <table width="100%" class="table_form contentWrap">
  43. <tr>
  44. <th><strong><?php echo L('field_type');?></strong><br /></th>
  45. <td>
  46. <?php echo form::select($all_field,'','name="info[formtype]" id="formtype" onchange="javascript:field_setting(this.value);"',L('select_fieldtype'));?>
  47. </td>
  48. </tr>
  49. <tr>
  50. <th width="25%"><font color="red">*</font> <strong><?php echo L('fieldname');?></strong><br />
  51. <?php echo L('fieldname_tips');?>
  52. </th>
  53. <td><input type="text" name="info[field]" id="field" size="20" class="input-text"></td>
  54. </tr>
  55. <tr>
  56. <th><font color="red">*</font> <strong><?php echo L('field_nickname');?></strong><br /><?php echo L('nickname_tips');?></th>
  57. <td><input type="text" name="info[name]" id="name" size="30" class="input-text"></td>
  58. </tr>
  59. <tr>
  60. <th><strong><?php echo L('field_tip');?></strong><br /><?php echo L('field_tips');?></th>
  61. <td><textarea name="info[tips]" rows="2" cols="20" id="tips" style="height:40px; width:80%"></textarea></td>
  62. </tr>
  63. <tr>
  64. <th><strong><?php echo L('relation_parm');?></strong><br /><?php echo L('relation_parm_tips');?></th>
  65. <td><div id="setting"></div></td>
  66. </tr>
  67. <tr id="formattribute">
  68. <th><strong><?php echo L('form_attr');?></strong><br /><?php echo L('form_attr_tips');?></th>
  69. <td><input type="text" name="info[formattribute]" value="" size="50" class="input-text"></td>
  70. </tr>
  71. <tr id="css">
  72. <th><strong><?php echo L('form_css_name');?></strong><br /><?php echo L('form_css_name_tips');?></th>
  73. <td><input type="text" name="info[css]" value="" size="10" class="input-text"></td>
  74. </tr>
  75. <tr>
  76. <th><strong><?php echo L('string_size');?></strong><br /><?php echo L('string_size_tips');?></th>
  77. <td><?php echo L('minlength');?>:<input type="text" name="info[minlength]" id="field_minlength" value="0" size="5" class="input-text"> <?php echo L('maxlength');?>:<input type="text" name="info[maxlength]" id="field_maxlength" value="" size="5" class="input-text"></td>
  78. </tr>
  79. <tr>
  80. <th><strong><?php echo L('data_preg');?></strong><br /><?php echo L('data_preg_tips');?></th>
  81. <td><input type="text" name="info[pattern]" id="pattern" value="" size="40" class="input-text">
  82. <select name="pattern_select" onchange="javascript:$('#pattern').val(this.value)">
  83. <option value=""><?php echo L('often_preg');?></option>
  84. <option value="/^[0-9.-]+$/"><?php echo L('figure');?></option>
  85. <option value="/^[0-9-]+$/"><?php echo L('integer');?></option>
  86. <option value="/^[a-z]+$/i"><?php echo L('letter');?></option>
  87. <option value="/^[0-9a-z]+$/i"><?php echo L('integer_letter');?></option>
  88. <option value="/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/">E-mail</option>
  89. <option value="/^[0-9]{5,20}$/">QQ</option>
  90. <option value="/^http:\/\//"><?php echo L('hyperlink');?></option>
  91. <option value="/^(1)[0-9]{10}$/"><?php echo L('mobile_number');?></option>
  92. <option value="/^[0-9-]{6,13}$/"><?php echo L('tel_number');?></option>
  93. <option value="/^[0-9]{6}$/"><?php echo L('zip');?></option>
  94. </select>
  95. </td>
  96. </tr>
  97. <tr>
  98. <th><strong><?php echo L('data_passed_msg');?></strong></th>
  99. <td><input type="text" name="info[errortips]" value="" size="50" class="input-text"></td>
  100. </tr>
  101. <tr>
  102. <th><strong><?php echo L('disabled_groups_field');?></strong></th>
  103. <td><?php echo form::checkbox($grouplist,'','name="unsetgroupids[]" id="unsetgroupids"',0,'100');?></td>
  104. </tr>
  105. </table>
  106. </div>
  107. <div class="bk15"></div>
  108. <input name="info[modelid]" type="hidden" value="<?php echo $formid?>">
  109. <div class="btn"><input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button"></div>
  110. </form>
  111. <script type="text/javascript">
  112. <!--
  113. function field_setting(fieldtype) {
  114. $('#formattribute').css('display','none');
  115. $('#css').css('display','none');
  116. $.getJSON("?m=formguide&c=formguide_field&a=public_field_setting&fieldtype="+fieldtype, function(data){
  117. if(data.field_allow_search=='1') {
  118. $('#field_allow_search0').attr("disabled",false);
  119. $('#field_allow_search1').attr("disabled",false);
  120. } else {
  121. $('#field_allow_search0').attr("checked",true);
  122. $('#field_allow_search0').attr("disabled",true);
  123. $('#field_allow_search1').attr("disabled",true);
  124. }
  125. if(data.field_allow_isunique=='1') {
  126. $('#field_allow_isunique0').attr("disabled",false);
  127. $('#field_allow_isunique1').attr("disabled",false);
  128. } else {
  129. $('#field_allow_isunique0').attr("checked",true);
  130. $('#field_allow_isunique0').attr("disabled",true);
  131. $('#field_allow_isunique1').attr("disabled",true);
  132. }
  133. $('#field_minlength').val(data.field_minlength);
  134. $('#field_maxlength').val(data.field_maxlength);
  135. $('#setting').html(data.setting);
  136. });
  137. }
  138. //-->
  139. </script>
  140. </body>
  141. </html>