Field_edit.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <script>
  2. $('#nav ul a ').removeClass('on');
  3. $('#nav ul').append('<a href="{:U("Field/index",array(moduleid=>$_GET[moduleid]))}" class="edit">{:L(field_manage)}</a> | <a href="{:U("Field/add",array(moduleid=>$_GET[moduleid]))}" class="add">{:L(field_add)}</a> |');
  4. <if condition="$action_name=='add'"> $('#nav ul a.add ').addClass('on');</if>
  5. <if condition="$action_name=='edit'"> $('#nav ul a.edit ').addClass('on');</if>
  6. $.ajaxSetup ({ cache: false });
  7. function field_setting(type)
  8. {
  9. if(type=='verify'){
  10. $('#field_tr').hide();
  11. $('#field').val('verifyCode');
  12. $('#name').val('验证码');
  13. $('#pattern').val('en_num');
  14. $('#minlength').val('4');
  15. $('#maxlength').val('4');
  16. $('#required').attr("checked",true);
  17. $('#ispost_1').attr("checked",true);
  18. }else{
  19. $('#field_tr').show();
  20. }
  21. var data = {$vo["setup"]|json_encode};
  22. var url = "{:U('Field/add')}&isajax=1&moduleid={$moduleid}&type="+type;
  23. $.ajax({
  24. type: "POST",
  25. url: url,
  26. data: data,
  27. beforeSend:function(){
  28. $('#field_setup').html('<img src="./Public/Images/msg_loading.gif">');
  29. },
  30. success: function(msg){
  31. $('#field_setup').html(msg);
  32. },
  33. complete:function(){
  34. },
  35. error:function(){
  36. }
  37. });
  38. }
  39. </script>
  40. <form name="myform" id="myform" action="<if condition="$action_name=='add'">{:U($module_name.'/insert')}<else />{:U($module_name.'/update')}</if>" method="post">
  41. <input type="hidden" id="moduleid" name="moduleid" value="{$moduleid}"/>
  42. <table cellpadding=0 cellspacing=0 class="table_form" width="100%">
  43. <tr>
  44. <td width="140"><font color="red">*</font>{:L(field_type)}</td>
  45. <td>
  46. <select id="type" name="type" class="required" id="type" minlength="1" onchange="javascript:field_setting(this.value);" <if condition="$action_name=='edit'">disabled</if>>
  47. <option value='' >请选择字段类型</option>
  48. <option value="catid">栏目</option>
  49. <option value="title">标题</option>
  50. <option value="typeid">类别</option>
  51. <option value="text" >单行文本</option>
  52. <option value="textarea" >多行文本</option>
  53. <option value="editor" >编辑器</option>
  54. <option value="select" >下拉列表</option>
  55. <option value="radio" >单选按钮</option>
  56. <option value="checkbox" >复选框</option>
  57. <option value="image" >单张图片</option>
  58. <option value="images" >多张图片</option>
  59. <option value="file" >单文件上传</option>
  60. <option value="files" >多文件上传</option>
  61. <option value="number" >数字</option>
  62. <option value="datetime" >日期和时间</option>
  63. <option value="posid" >推荐位</option>
  64. <option value="groupid" >会员组</option>
  65. <option value="linkage" >联动菜单</option>
  66. <option value="template" >模板选择</option>
  67. <option value="verify" >验证码</option>
  68. </select>
  69. </td>
  70. </tr>
  71. <tr id="field_tr">
  72. <td width="140"><font color="red">*</font>{:L(field_field)}</td>
  73. <td><input type="text" id="field" name="field" value="{$vo.field}" class="input-text"
  74. <if condition="$action_name=='add'"> validate="required:true, english:true,remote: '{:U($module_name.'/insert?isajax=1&moduleid='.$_GET['moduleid'])}' ,minlength:2, maxlength:20" </if> /> </td>
  75. </tr>
  76. <tr>
  77. <td width="140"><font color="red">*</font>{:L(field_name)} </td>
  78. <td><input type="text" id="name" name="name" value="{$vo.name}" class="input-text required" minlength="2" maxlength="30" /> </td>
  79. </tr>
  80. <tr>
  81. <td width="140">{:L(field_setup)}</td>
  82. <td id="field_setup">
  83. </td>
  84. </tr>
  85. <tr>
  86. <td width="140">{:L(field_class)}</td>
  87. <td><input type="text" id="class" name="class" value="{$vo.class}" size="10" class="input-text" /></td>
  88. </tr>
  89. <tr>
  90. <td width="140">{:L(field_required)}</td>
  91. <td><input type="radio" id="required" name="required" value="1"<if condition="$vo[required]==1"> checked</if>>是 <input type="radio" name="required" value="0" <if condition="$vo[required]==0"> checked</if>> 否
  92. </td>
  93. </tr>
  94. <tr>
  95. <td width="140">{:L(field_pattern)}
  96. </td>
  97. <td>{:Form::select(array('field'=>'pattern','options'=>$field_pattern),$vo[pattern])}
  98. </td>
  99. </tr>
  100. <tr>
  101. <td width="140">{:L(field_lange)}</td>
  102. <td>
  103. 最小 <input type="text" id="minlength" name="minlength" value="{$vo.minlength}" size="2" class="input-text" /> 最大 <input type="text" id="maxlength" name="maxlength" value="{$vo.maxlength}" class="input-text" size="2" />个字符
  104. </td>
  105. </tr>
  106. <tr>
  107. <td width="140">{:L(field_errormsg)}</td>
  108. <td>
  109. <input type="text" id="errormsg" name="errormsg" value="{$vo.errormsg}" class="input-text" size="50" />
  110. </td>
  111. </tr>
  112. <tr>
  113. <td width="140">{:L(field_post)}</td>
  114. <td>
  115. {:Form::radio(array('field'=>'ispost','options'=>$options),$vo[ispost])}
  116. </td>
  117. </tr>
  118. <tr>
  119. <td width="140">{:L(field_unpost_group)}</td>
  120. <td>
  121. {:Form::checkbox(array('field'=>'unpostgroup','options'=>$usergroup,'setup'=>array('labelwidth'=>'90')),$vo[unpostgroup])}
  122. </td>
  123. </tr>
  124. </table>
  125. <div class="btn">
  126. <if condition="$vo['id']!=''">
  127. <input type="hidden" name="type" value="{$vo.type}" />
  128. <input type="hidden" name="oldfield" value="{$vo.field}" />
  129. <input TYPE="hidden" name="id" value="{$vo.id}">
  130. </if>
  131. <INPUT TYPE="submit" value="{:L('dosubmit')}" class="button buttonBtn" >
  132. <input TYPE="reset" value="{:L('cancel')}" class="button">
  133. </div>
  134. </form>
  135. </div>
  136. <script>
  137. $('#type').val('{$vo[type]}');
  138. field_setting('{$vo[type]}');
  139. </script>
  140. </body></html>