sitemodel_field_add.tpl.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <?php
  2. defined('IN_ADMIN') or exit('No permission resources.');
  3. include $this->admin_tpl('header','admin');?>
  4. <script type="text/javascript">
  5. <!--
  6. $(function(){
  7. $.formValidator.initConfig({autotip:true,formid:"myform"});
  8. $("#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({
  9. type : "get",
  10. url : "",
  11. data : "m=content&c=sitemodel_field&a=public_checkfield&modelid=<?php echo $modelid?>",
  12. datatype : "html",
  13. cached:false,
  14. getdata:{issystem:'issystem'},
  15. async:'false',
  16. success : function(data){
  17. if( data == "1" ){
  18. return true;
  19. } else {
  20. return false;
  21. }
  22. },
  23. buttons: $("#dosubmit"),
  24. onerror : "<?php echo L('fieldname').L('already_exist')?>",
  25. onwait : "<?php echo L('connecting_please_wait')?>"
  26. });
  27. $("#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');?>"});
  28. $("#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');?>"});
  29. })
  30. //-->
  31. </script>
  32. <div class="pad_10">
  33. <div class="subnav">
  34. <h2 class="title-1 line-x f14 fb blue lh28"><?php echo L('model_manage');?>--<?php echo $m_r['name'].L('field_manage');?></h2>
  35. <div class="content-menu ib-a blue line-x"><a class="add fb" href="?m=content&c=sitemodel_field&a=add&modelid=<?php echo $modelid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('add_field');?></em></a>
  36.  <a href="?m=content&c=sitemodel_field&a=init&modelid=<?php echo $modelid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('manage_field');?></em></a><span>|</span></div>
  37. <div class="bk10"></div>
  38. </div>
  39. <form name="myform" id="myform" action="?m=content&c=sitemodel_field&a=add" method="post">
  40. <div class="common-form">
  41. <table width="100%" class="table_form contentWrap">
  42. <tr>
  43. <th><strong><?php echo L('field_type');?></strong><br /></th>
  44. <td>
  45. <?php echo form::select($all_field,'','name="info[formtype]" id="formtype" onchange="javascript:field_setting(this.value);"',L('select_fieldtype'));?>
  46. </td>
  47. </tr>
  48. <tr>
  49. <th><strong><?php echo L('issystem_field');?></strong></th>
  50. <td>
  51. <input type="hidden" name="issystem" id="issystem" value="0">
  52. <input type="radio" name="info[issystem]" id="field_basic_table1" value="1" onclick="$('#issystem').val('1');"> <?php echo L('yes');?> <input type="radio" id="field_basic_table0" name="info[issystem]" value="0" onclick="$('#issystem').val('0');" checked> <?php echo L('no');?></td>
  53. </tr>
  54. <tr>
  55. <th width="25%"><font color="red">*</font> <strong><?php echo L('fieldname');?></strong><br />
  56. <?php echo L('fieldname_tips');?>
  57. </th>
  58. <td><input type="text" name="info[field]" id="field" size="20" class="input-text"></td>
  59. </tr>
  60. <tr>
  61. <th><font color="red">*</font> <strong><?php echo L('field_nickname');?></strong><br /><?php echo L('nickname_tips');?></th>
  62. <td><input type="text" name="info[name]" id="name" size="30" class="input-text"></td>
  63. </tr>
  64. <tr>
  65. <th><strong><?php echo L('field_tip');?></strong><br /><?php echo L('field_tips');?></th>
  66. <td><textarea name="info[tips]" rows="2" cols="20" id="tips" style="height:40px; width:80%"></textarea></td>
  67. </tr>
  68. <tr>
  69. <th><strong><?php echo L('relation_parm');?></strong><br /><?php echo L('relation_parm_tips');?></th>
  70. <td><div id="setting"></div></td>
  71. </tr>
  72. <tr id="formattribute">
  73. <th><strong><?php echo L('form_attr');?></strong><br /><?php echo L('form_attr_tips');?></th>
  74. <td><input type="text" name="info[formattribute]" value="" size="50" class="input-text"></td>
  75. </tr>
  76. <tr id="css">
  77. <th><strong><?php echo L('form_css_name');?></strong><br /><?php echo L('form_css_name_tips');?></th>
  78. <td><input type="text" name="info[css]" value="" size="10" class="input-text"></td>
  79. </tr>
  80. <tr>
  81. <th><strong><?php echo L('string_size');?></strong><br /><?php echo L('string_size_tips');?></th>
  82. <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>
  83. </tr>
  84. <tr>
  85. <th><strong><?php echo L('data_preg');?></strong><br /><?php echo L('data_preg_tips');?></th>
  86. <td><input type="text" name="info[pattern]" id="pattern" value="" size="40" class="input-text">
  87. <select name="pattern_select" onchange="javascript:$('#pattern').val(this.value)">
  88. <option value=""><?php echo L('often_preg');?></option>
  89. <option value="/^[0-9.-]+$/"><?php echo L('figure');?></option>
  90. <option value="/^[0-9-]+$/"><?php echo L('integer');?></option>
  91. <option value="/^[a-z]+$/i"><?php echo L('letter');?></option>
  92. <option value="/^[0-9a-z]+$/i"><?php echo L('integer_letter');?></option>
  93. <option value="/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/">E-mail</option>
  94. <option value="/^[0-9]{5,20}$/">QQ</option>
  95. <option value="/^http:\/\//"><?php echo L('hyperlink');?></option>
  96. <option value="/^(1)[0-9]{10}$/"><?php echo L('mobile_number');?></option>
  97. <option value="/^[0-9-]{6,13}$/"><?php echo L('tel_number');?></option>
  98. <option value="/^[0-9]{6}$/"><?php echo L('zip');?></option>
  99. </select>
  100. </td>
  101. </tr>
  102. <tr>
  103. <th><strong><?php echo L('data_passed_msg');?></strong></th>
  104. <td><input type="text" name="info[errortips]" value="" size="50" class="input-text"></td>
  105. </tr>
  106. <tr>
  107. <th><strong><?php echo L('unique');?></strong></th>
  108. <td><input type="radio" name="info[isunique]" value="1" id="field_allow_isunique1"> <?php echo L('yes');?> <input type="radio" name="info[isunique]" value="0" id="field_allow_isunique0" checked> <?php echo L('no');?></td>
  109. </tr>
  110. <tr>
  111. <th><strong><?php echo L('basic_field');?></strong><br /><?php echo L('basic_field_tips');?></th>
  112. <td><input type="radio" name="info[isbase]" value="1" checked> <?php echo L('yes');?> <input type="radio" name="info[isbase]" value="0"> <?php echo L('no');?> </td>
  113. </tr>
  114. <tr>
  115. <th><strong><?php echo L('as_search_field');?></strong></th>
  116. <td><input type="radio" name="info[issearch]" value="1" id="field_allow_search1"> <?php echo L('yes');?> <input type="radio" name="info[issearch]" value="0" id="field_allow_search0" checked> <?php echo L('no');?></td>
  117. </tr>
  118. <tr>
  119. <th><strong><?php echo L('allow_contributor');?></strong></th>
  120. <td><input type="radio" name="info[isadd]" value="1" checked /> <?php echo L('yes');?> <input type="radio" name="info[isadd]" value="0" /> <?php echo L('no');?></td>
  121. </tr>
  122. <tr>
  123. <th><strong><?php echo L('as_fulltext_field');?></strong></th>
  124. <td><input type="radio" name="info[isfulltext]" value="1" id="field_allow_fulltext1" checked/> <?php echo L('yes');?> <input type="radio" name="info[isfulltext]" value="0" id="field_allow_fulltext0" /> <?php echo L('no');?></td>
  125. </tr>
  126. <tr>
  127. <th><strong><?php echo L('as_omnipotent_field');?></strong><br><?php echo L('as_omnipotent_field_tips');?></th>
  128. <td><input type="radio" name="info[isomnipotent]" value="1" /> <?php echo L('yes');?> <input type="radio" name="info[isomnipotent]" value="0" checked/> <?php echo L('no');?></td>
  129. </tr>
  130. <tr>
  131. <th><strong><?php echo L('as_postion_info');?></strong></th>
  132. <td><input type="radio" name="info[isposition]" value="1" /> <?php echo L('yes');?> <input type="radio" name="info[isposition]" value="0" checked/> <?php echo L('no');?></td>
  133. </tr>
  134. <tr>
  135. <th><strong><?php echo L('disabled_groups_field');?></strong></th>
  136. <td><?php echo form::checkbox($grouplist,'','name="unsetgroupids[]" id="unsetgroupids"',0,'100');?></td>
  137. </tr>
  138. <tr>
  139. <th><strong><?php echo L('disabled_role_field');?></strong></th>
  140. <td><?php echo form::checkbox($roles,'','name="unsetroleids[]" id="unsetroleids"',0,'100');?> </td>
  141. </tr>
  142. </table>
  143. </div>
  144. <div class="bk15"></div>
  145. <input name="info[modelid]" type="hidden" value="<?php echo $modelid?>">
  146. <div class="btn"><input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button"></div>
  147. </form>
  148. <script type="text/javascript">
  149. <!--
  150. function field_setting(fieldtype) {
  151. $('#formattribute').css('display','none');
  152. $('#css').css('display','none');
  153. $.each( ['<?php echo implode("','",$att_css_js);?>'], function(i, n){
  154. if(fieldtype==n) {
  155. $('#formattribute').css('display','');
  156. $('#css').css('display','');
  157. }
  158. });
  159. $.getJSON("?m=content&c=sitemodel_field&a=public_field_setting&fieldtype="+fieldtype, function(data){
  160. if(data.field_basic_table=='1') {
  161. $('#field_basic_table0').attr("disabled",false);
  162. $('#field_basic_table1').attr("disabled",false);
  163. } else {
  164. $('#field_basic_table0').attr("checked",true);
  165. $('#field_basic_table0').attr("disabled",true);
  166. $('#field_basic_table1').attr("disabled",true);
  167. }
  168. if(data.field_allow_search=='1') {
  169. $('#field_allow_search0').attr("disabled",false);
  170. $('#field_allow_search1').attr("disabled",false);
  171. } else {
  172. $('#field_allow_search0').attr("checked",true);
  173. $('#field_allow_search0').attr("disabled",true);
  174. $('#field_allow_search1').attr("disabled",true);
  175. }
  176. if(data.field_allow_fulltext=='1') {
  177. $('#field_allow_fulltext0').attr("disabled",false);
  178. $('#field_allow_fulltext1').attr("disabled",false);
  179. } else {
  180. $('#field_allow_fulltext0').attr("checked",true);
  181. $('#field_allow_fulltext0').attr("disabled",true);
  182. $('#field_allow_fulltext1').attr("disabled",true);
  183. }
  184. if(data.field_allow_isunique=='1') {
  185. $('#field_allow_isunique0').attr("disabled",false);
  186. $('#field_allow_isunique1').attr("disabled",false);
  187. } else {
  188. $('#field_allow_isunique0').attr("checked",true);
  189. $('#field_allow_isunique0').attr("disabled",true);
  190. $('#field_allow_isunique1').attr("disabled",true);
  191. }
  192. $('#field_minlength').val(data.field_minlength);
  193. $('#field_maxlength').val(data.field_maxlength);
  194. $('#setting').html(data.setting);
  195. });
  196. }
  197. //-->
  198. </script>
  199. </body>
  200. </html>