国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
8.9KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
  6. <title>添加文档模型字段</title>
  7. <link rel="stylesheet" href="/static/web/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="/static/web/js/admin.main.js"></script>
  13. </head>
  14. <body>
  15. <div class="container-fluid">
  16. <ol class="breadcrumb">
  17. <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li>
  18. <li class="breadcrumb-item"><a href="mychannel_main.php">文档模型管理</a></li>
  19. <li class="breadcrumb-item active">添加文档模型字段</li>
  20. </ol>
  21. <div class="card shadow-sm">
  22. <div class="card-header">添加文档模型字段</div>
  23. <div class="card-body">
  24. <div class="alert alert-warning">不支持字段输入单引号和双引号</div>
  25. <form name="form1" action="mychannel_field_add.php" method="post" onSubmit="return GetFields();">
  26. <input type="hidden" name="action" value="save">
  27. <input type="hidden" name="id" value="<?php echo $id?>">
  28. <input type="hidden" name="fieldstring">
  29. <div class="table-responsive">
  30. <table class="table table-borderless">
  31. <tbody>
  32. <tr>
  33. <td width="260">字段名称</td>
  34. <td><input type="text" name="itemname" id="itemname" class="admin-input-sm" required>(前后台显示字段的名称)</td>
  35. </tr>
  36. <tr>
  37. <td>字段标识</td>
  38. <td><input type="text" name="fieldname" id="fieldname" class="admin-input-sm" required>(只能用英文字母或数字,如果数据类型是联动类型,请填写联动类型组名称)</td>
  39. </tr>
  40. <tr>
  41. <td>字段类型</td>
  42. <td>
  43. <label><input type="radio" name="autofield" value="1" checked> 自动字段</label>
  44. <label><input type="radio" name="autofield" value="0"> 固化字段</label>
  45. </td>
  46. </tr>
  47. <tr>
  48. <td>前台参数</td>
  49. <td>
  50. <label><input type="checkbox" name="notsend" id="notsend" value="1"> 投稿和采集禁用字段</label>
  51. <label><input type="checkbox" name="islist" id="islist" value="1"> 添加到列表附加字段</label>
  52. <span>(标签{dede:list channelid='模型id' addfields='字段1,字段2'}[field:name/]{/dede:list}调用)</span>
  53. </td>
  54. </tr>
  55. <tr>
  56. <td>是否使用分页符</td>
  57. <td>
  58. <input type="hidden" name="isnull" value="1">
  59. <label><input type="radio" name="spage" value="split"> 是</label>
  60. <label><input type="radio" name="spage" value="no" checked> 否</label>
  61. <span>(如果文档使用分页符,文档用#p#副标题#e#作为分页符实现文档分页,但仅允许一个字段)</span>
  62. </td>
  63. </tr>
  64. <tr>
  65. <td>数据类型</td>
  66. <td id="dataType">
  67. <div class="nw"><label><input type="radio" name="dtype" id="dtype1" value="text" checked> 单行文本(varchar)</label></div>
  68. <div class="nw"><label><input type="radio" name="dtype" id="dtype2" value="textchar"> 单行文本(char)</label></div>
  69. <div class="nw"><label><input type="radio" name="dtype" id="dtype3" value="multitext"> 多行文本</label></div>
  70. <div class="nw"><label><input type="radio" name="dtype" id="dtype4" value="htmltext"> 网页文本</label></div>
  71. <br class="cls">
  72. <div class="nw"><label><input type="radio" name="dtype" id="dtype5" value="textdata"> 文本保存网页数据</label></div>
  73. <div class="nw"><label><input type="radio" name="dtype" id="dtype6" value="int"> 整数类型</label></div>
  74. <div class="nw"><label><input type="radio" name="dtype" id="dtype7" value="float"> 小数类型</label></div>
  75. <div class="nw"><label><input type="radio" name="dtype" id="dtype8" value="datetime"> 时间类型</label></div>
  76. <br class="cls">
  77. <div class="nw"><label><input type="radio" name="dtype" id="dtype9" value="img"> 图片类型</label></div>
  78. <div class="nw"><label><input type="radio" name="dtype" id="dtype10" value="media"> 多媒体文件</label></div>
  79. <div class="nw"><label><input type="radio" name="dtype" id="dtype11" value="addon"> 附件类型</label></div>
  80. <div class="nw"><label><input type="radio" name="dtype" id="dtype12" value="relation"> 关联文档</label></div>
  81. <br class="cls">
  82. <div class="nw"><label><input type="radio" name="dtype" id="dtype13" value="select"> option下拉框</label></div>
  83. <div class="nw"><label><input type="radio" name="dtype" id="dtype14" value="radio"> radio选项卡</label></div>
  84. <div class="nw"><label><input type="radio" name="dtype" id="dtype15" value="checkbox"> checkbox多选框</label></div>
  85. <div class="nw"><label><input type="radio" name="dtype" id="dtype16" value="stepselect"> 联动类型</label></div>
  86. </td>
  87. </tr>
  88. <tr id="_relation" style="display:none">
  89. <td>文档模型</td>
  90. <td>
  91. <select name="channeltype" id="channeltype" class="admin-input-sm">
  92. <?php
  93. $channelid = 1;
  94. foreach($channelArray as $k=>$arr)
  95. {
  96. if ($k==$channelid) {
  97. $nid = $arr['nid'];
  98. echo "<option value='{$k}' selected>{$arr['typename']} {$arr['nid']}</option>";
  99. } else {
  100. echo "<option value='{$k}'>{$arr['typename']} {$arr['nid']}</option>";
  101. }
  102. }
  103. ?>
  104. </select>
  105. <label><input type="checkbox" name="relation_automake" id="relation_automake" value="1"> 发布时自动更新关联文档</label>
  106. </td>
  107. </tr>
  108. <tr>
  109. <td>默认值</td>
  110. <td>
  111. <p>(自定义字段数据类型为select、radio、checkbox时,下面填写数据,英文逗号隔开,如:DedeBIZ,得德)</p>
  112. <textarea name="vdefault" id="vdefault" class="admin-textarea-xl"></textarea>
  113. </td>
  114. </tr>
  115. <tr>
  116. <td>自定义网页表单</td>
  117. <td>
  118. <p>(自定义网页表单用~name~表示提示文字,~form~表示表单元素)</p>
  119. <textarea name="vinnertext" id="vinnertext" class="admin-textarea-xl"></textarea>
  120. </td>
  121. </tr>
  122. <tr>
  123. <td>最大长度</td>
  124. <td><input type="text" name="maxlength" id="maxlength" class="admin-input-sm" value="255">(文本数据必须填写,大于255为text类型)</td>
  125. </tr>
  126. <tr>
  127. <td colspan="2" align="center">
  128. <button type="submit" class="btn btn-success btn-sm">保存</button>
  129. <button type="reset" class="btn btn-outline-success btn-sm">重置</button>
  130. </td>
  131. </tr>
  132. </tbody>
  133. </table>
  134. </div>
  135. </form>
  136. </div>
  137. </div>
  138. </div>
  139. <script>
  140. var notAllow = "<?php echo $f;?>";
  141. function GetFields() {
  142. var theform = document.form1;
  143. var fieldname = theform.fieldname.value;
  144. var itemname = theform.itemname.value;
  145. var dtype = 'text';
  146. var enums = document.getElementsByName('dtype');
  147. for (i=0;i<enums.length;i++)
  148. {
  149. if (enums[i].checked) dtype = enums[i].value;
  150. }
  151. var isnull = theform.isnull.value;
  152. var vdefault = theform.vdefault.value;
  153. var maxlength = theform.maxlength.value;
  154. var vinnertext = theform.vinnertext.value;
  155. var spage = (theform.spage[0].checked ? theform.spage[0].value : theform.spage[1].value);
  156. var sisnull = (isnull==0 ? "false" : "true");
  157. var autofield = (theform.autofield[0].checked ? theform.autofield[0].value : theform.autofield[1].value);
  158. var islist = (theform.islist.checked ? 1 : 0);
  159. var notsend = (theform.notsend.checked ? 1 : 0);
  160. var automake = theform.relation_automake.checked ? 1 : 0;
  161. if (spage=="no") spage = '';
  162. relstr = '';
  163. if (dtype==="relation") {
  164. relstr = " automake=\"" + automake + "\" channel=\"" + $("#channeltype").val() + "\"";
  165. }
  166. revalue = "<field:" + fieldname + " itemname=\"" + itemname + "\" autofield=\"" + autofield + "\" notsend=\"" + notsend + "\" type=\"" + dtype + "\"";
  167. revalue += relstr + " isnull=\"" + sisnull + "\" islist=\"" + islist + "\" default=\"" + vdefault + "\" ";
  168. revalue += " maxlength=\"" + maxlength + "\" page=\"" + spage + "\">" + vinnertext + "</field:" + fieldname + ">";
  169. document.form1.fieldstring.value = revalue;
  170. return true;
  171. }
  172. $(document).ready(function() {
  173. $("#dataType input").click(function(ele) {
  174. if ($(ele.currentTarget).val() === "relation") {
  175. $("#_relation").show();
  176. } else {
  177. $("#_relation").hide();
  178. }
  179. })
  180. });
  181. </script>
  182. </body>
  183. </html>