国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

195 lines
8.8KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  6. <title>修改文档模型字段</title>
  7. <link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
  8. <link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
  9. <link rel="stylesheet" href="../static/web/css/admin.css">
  10. <script src="../static/web/js/jquery.min.js"></script>
  11. <script src="../static/web/js/bootstrap.min.js"></script>
  12. <script src="js/main.js"></script>
  13. <style>.nw{float:left;width:160px}.cls{clear:both}</style>
  14. </head>
  15. <body>
  16. <form name="form1" action="mychannel_field_edit.php" method="post" onSubmit="return GetFields();">
  17. <input type="hidden" name="action" value="save">
  18. <input type="hidden" name="id" value="<?php echo $id?>">
  19. <input type="hidden" name="fname" value="<?php echo $fname?>">
  20. <input type="hidden" name="issystem" value="<?php echo $issystem?>">
  21. <input type="hidden" name="fieldstring" value="">
  22. <table wcellpadding="1" align="center" class="table maintable my-3">
  23. <tr>
  24. <td bgcolor="#f5f5f5" colspan="2">文档模型管理</a> - 修改文档模型字段</td>
  25. </tr>
  26. <?php if ($row['issystem'] == 1) {?>
  27. <tr>
  28. <td colspan="2">
  29. <div class="alert alert-danger mb-0">修改系统模型有风险,请不要随便修改系统模型的字段相关属性</div>
  30. </td>
  31. </tr>
  32. <?php }?>
  33. <tr>
  34. <td>提示文字:</td>
  35. <td>
  36. <input type="text" name="itemname" id="itemname" class="admin-input-sm" value="<?php echo $ctag->GetAtt('itemname')?>">
  37. <span>(发布文档时显示的项名字)</span>
  38. </td>
  39. </tr>
  40. <tr>
  41. <td width="260">字段名称:</td>
  42. <td><?php echo $fname?>(只能用英文字母或数字,如果数据类型是联动类型,请填写联动类型的组名称)</td>
  43. </tr>
  44. <tr>
  45. <td>字段类型:</td>
  46. <td>
  47. <label><input type="radio" name="autofield" value="1" checked="checked" <?php echo ($ctag->GetAtt('autofield')==1 ? " checked":"");?>> 自动字段</label>
  48. <label><input type="radio" name="autofield" value="0" <?php echo ( ($ctag->GetAtt('autofield')==''||$ctag->GetAtt('autofield')=='0') ? " checked":"");?>> 固化字段</label>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td>前台参数:</td>
  53. <td>
  54. <label><input type="checkbox" name="notsend" id="notsend" value="1" <?php echo ($ctag->GetAtt('notsend')==1 ? " checked":"");?>> 投稿和采集禁用字段</label>
  55. <label><input type="checkbox" name="islist" id="islist" value="1" <?php echo ($ctag->GetAtt('islist')==1 ? " checked":"");?>> 添加到列表附加字段</label>
  56. <span>(列表模板“{dede:list channelid='模型id' addfields='字段1,字段2'}{/dede:list}”中,标签“[field:name/]”调用)</span>
  57. </td>
  58. </tr>
  59. <tr>
  60. <td>是否使用分页符:</td>
  61. <td>
  62. <input name="isnull" type="hidden" value="1">
  63. <label><input type="radio" name="spage" value="split" <?php if ($ctag->GetAtt('page')=='split') echo "checked='checked'";?>> 是</label>
  64. <label><input type="radio" name="spage" value="no" <?php if ($ctag->GetAtt('page')=='no'||$ctag->GetAtt('page')=='') echo "checked='checked'";?>> 否</label>
  65. <span>(如果文档使用分页符,文档用#p#副标题#e#作为分页符,实现文档分页,但仅允许一个字段)</span>
  66. </td>
  67. </tr>
  68. <tr>
  69. <td>数据类型:</td>
  70. <td>
  71. <select name="dtype" id="type" class="admin-input-sm">
  72. <?php
  73. $dtype = $ctag->GetAtt('type');
  74. if ($dtype!='' && isset($fieldtypes[$dtype])) {
  75. echo "<option value='{$dtype}'>{$fieldtypes[$dtype]}</option>";
  76. $canchange = true;
  77. } else {
  78. echo "<option value='{$dtype}'>系统专用类型</option>";
  79. $canchange = false;
  80. }
  81. if ($canchange) {
  82. ?>
  83. <option value="text">单行文本(varchar)</option>
  84. <option value="textchar">单行文本(char)</option>
  85. <option value="multitext">多行文本</option>
  86. <option value="htmltext">网页文本</option>
  87. <option value="textdata">文本保存网页数据</option>
  88. <option value="int">整数类型</option>
  89. <option value="float">小数类型</option>
  90. <option value="datetime">时间类型</option>
  91. <option value="img">图片类型</option>
  92. <option value="media">多媒体文件</option>
  93. <option value="addon">附件类型</option>
  94. <option value="select">option下拉框</option>
  95. <option value="radio">radio选项卡</option>
  96. <option value="checkbox">checkbox多选框</option>
  97. <option value="stepselect">联动类型</option>
  98. <option value="relation">关联文档</option>
  99. <?php }?>
  100. </select>
  101. </td>
  102. </tr>
  103. <tr id="_relation" <?php echo $dtype=="relation"? '' : 'style="display:none"';?>>
  104. <td>文档模型:</td>
  105. <td>
  106. <select name="channeltype" id="channeltype" class="admin-input-sm">
  107. <?php
  108. $channelid = $ctag->GetAtt('channel') == "" ? 1 : $ctag->GetAtt('channel');
  109. foreach($channelArray as $k=>$arr)
  110. {
  111. if ($k==$channelid) {
  112. $nid = $arr['nid'];
  113. echo "<option value='{$k}' selected>{$arr['typename']}|{$arr['nid']}</option>";
  114. } else {
  115. echo "<option value='{$k}'>{$arr['typename']}|{$arr['nid']}</option>";
  116. }
  117. }
  118. ?>
  119. </select>
  120. <label class="l-height-28"><input type="checkbox" name="relation_automake" id="relation_automake" value="1" <?php echo $ctag->GetAtt('automake')==1? "checked" : "";?>> 发布时自动更新关联文档</label>
  121. </td>
  122. </tr>
  123. <tr>
  124. <td>默认值:</td>
  125. <td>
  126. <p>(如果定义数据类型为select、radio、checkbox时,此处填写被选择的项目,英文逗号分开,如“DedeBIZ,得德”。如果为联动选框,这里填写联动选框项目名称)</p>
  127. <textarea name="vdefault" id="vdefault" class="admin-textarea-xl"><?php echo $ctag->GetAtt('default');?></textarea>
  128. </td>
  129. </tr>
  130. <tr>
  131. <td>自定义网页表单:</td>
  132. <td>
  133. <p>(自定义网页表单用~name~表示提示文字,~form~表示表单元素)</p>
  134. <textarea name="vinnertext" id="vinnertext" class="admin-textarea-xl"><?php echo $ctag->GetInnerText();?></textarea>
  135. </td>
  136. </tr>
  137. <tr>
  138. <td>最大长度:</td>
  139. <td><input type="text" name="maxlength" id="maxlength" class="admin-input-xs" value="<?php echo $ctag->GetAtt('maxlength')?>">(文本数据必须填写,大于255为text类型)</td>
  140. </tr>
  141. <tr>
  142. <td bgcolor="#f5f5f5" colspan="2" align="center">
  143. <button type="submit" name="button1" id="button1" class="btn btn-success btn-sm">保存</button>
  144. <button type="reset" name="button3" id="button3" class="btn btn-outline-success btn-sm">重置</button>
  145. </td>
  146. </tr>
  147. </table>
  148. </form>
  149. <script>
  150. function GetFields() {
  151. var theform = document.form1;
  152. var itemname = theform.itemname.value;
  153. var fieldname = theform.fname.value;
  154. var dtype = theform.dtype.value;
  155. var isnull = theform.isnull.value;
  156. var vdefault = theform.vdefault.value;
  157. var maxlength = theform.maxlength.value;
  158. var vinnertext = theform.vinnertext.value;
  159. var spage = (theform.spage[0].checked ? theform.spage[0].value : theform.spage[1].value);
  160. var sisnull = (isnull == 0 ? "false" : "true");
  161. var autofield = (theform.autofield[0].checked ? theform.autofield[0].value : theform.autofield[1].value);
  162. var islist = (theform.islist.checked ? 1 : 0);
  163. var notsend = (theform.notsend.checked ? 1 : 0);
  164. if (itemname == "") {
  165. ShowMsg("表单提示名称不能为空");
  166. theform.itemname.focus();
  167. return false;
  168. }
  169. if ((dtype == "radio" || dtype == "select" || dtype == "checkbox") && vdefault == "") {
  170. ShowMsg("您选择的select或radio、checkbox类型,必须默认值设置选择的项目(用英文逗号分开)");
  171. return false;
  172. }
  173. if (spage == "no") spage = "";
  174. relstr = "";
  175. if (dtype==="relation") {
  176. relstr = " automake=\""+automake+"\" channel=\""+$("#channeltype").val()+"\"";
  177. }
  178. revalue = "<field:" + fieldname + " itemname=\"" + itemname + "\" autofield=\"" + autofield + "\" notsend=\"" + notsend + "\" type=\"" + dtype + "\"";
  179. revalue += relstr + " isnull=\"" + sisnull + "\" islist=\"" + islist + "\" default=\"" + vdefault + "\" ";
  180. revalue += " maxlength=\"" + maxlength + "\" page=\"" + spage + "\">" + vinnertext + "</field:" + fieldname + ">";
  181. document.form1.fieldstring.value = revalue;
  182. return true;
  183. }
  184. $(document).ready(function () {
  185. $("#type").change(function (ele) {
  186. if ($(ele.currentTarget).val() === "relation") {
  187. $("#_relation").show();
  188. } else {
  189. $("#_relation").hide();
  190. }
  191. })
  192. });
  193. </script>
  194. </body>
  195. </html>