AddM.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../../class/connect.php");
  4. require("../../class/db_sql.php");
  5. require("../../class/functions.php");
  6. $link=db_connect();
  7. $empire=new mysqlquery();
  8. $editor=1;
  9. //验证用户
  10. $lur=is_login();
  11. $logininid=$lur['userid'];
  12. $loginin=$lur['username'];
  13. $loginrnd=$lur['rnd'];
  14. $loginlevel=$lur['groupid'];
  15. $loginadminstyleid=$lur['adminstyleid'];
  16. //ehash
  17. $ecms_hashur=hReturnEcmsHashStrAll();
  18. //验证权限
  19. CheckLevel($logininid,$loginin,$classid,"m");
  20. $tid=(int)$_GET['tid'];
  21. $tbname=RepPostVar($_GET['tbname']);
  22. if(!$tid||!$tbname)
  23. {
  24. printerror("ErrorUrl","history.go(-1)");
  25. }
  26. $enews=RepPostStr($_GET['enews'],1);
  27. $docopy=(int)$_GET['docopy'];
  28. $mtype=" checked";
  29. $r['mustqenterf']=",title,";
  30. $r[myorder]=0;
  31. $record="<!--record-->";
  32. $field="<!--field--->";
  33. $postword='增加';
  34. $url="数据表:[".$dbtbpre."ecms_".$tbname."]&nbsp;>&nbsp;<a href=ListM.php?tid=$tid&tbname=$tbname".$ecms_hashur['ehref'].">系统模型管理</a>&nbsp;>&nbsp;增加系统模型";
  35. if($enews=="AddM"&&$docopy)
  36. {
  37. $postword='复制';
  38. $mid=(int)$_GET['mid'];
  39. $mtype="";
  40. $r=$empire->fetch1("select * from {$dbtbpre}enewsmod where mid='$mid' and tid='$tid'");
  41. $url="数据表:[".$dbtbpre."ecms_".$tbname."]&nbsp;>&nbsp;<a href=ListM.php?tid=$tid&tbname=$tbname".$ecms_hashur['ehref'].">系统模型管理</a>&nbsp;>&nbsp;复制系统模型: ".$r['mname'];
  42. }
  43. //修改系统模型
  44. if($enews=="EditM")
  45. {
  46. $postword='修改';
  47. $mid=(int)$_GET['mid'];
  48. $mtype="";
  49. $url="数据表:[".$dbtbpre."ecms_".$tbname."]&nbsp;>&nbsp;<a href=ListM.php?tid=$tid&tbname=$tbname".$ecms_hashur['ehref'].">系统模型管理</a>&nbsp;>&nbsp;修改系统模型";
  50. $r=$empire->fetch1("select * from {$dbtbpre}enewsmod where mid='$mid' and tid='$tid'");
  51. }
  52. //取得字段
  53. $no=0;
  54. $fsql=$empire->query("select f,fname,iscj,dotemp,tbdataf from {$dbtbpre}enewsf where isshow=1 and tid='$tid' order by myorder,fid");
  55. while($fr=$empire->fetch($fsql))
  56. {
  57. $no++;
  58. $bgcolor="ffffff";
  59. if($no%2==0)
  60. {
  61. $bgcolor="#F8F8F8";
  62. }
  63. $like=$field.$fr[f].$record;
  64. $slike=",".$fr[f].",";
  65. //录入项
  66. if(strstr($r[enter],$like))
  67. {
  68. $enterchecked=" checked";
  69. //取得字段标识
  70. $dor=explode($like,$r[enter]);
  71. if(strstr($dor[0],$record))
  72. {
  73. $dor1=explode($record,$dor[0]);
  74. $last=count($dor1)-1;
  75. $fr[fname]=$dor1[$last];
  76. }
  77. else
  78. {
  79. $fr[fname]=$dor[0];
  80. }
  81. }
  82. else
  83. {
  84. $enterchecked="";
  85. }
  86. //标题
  87. if($enews=="AddM"&&($fr[f]=="title"||$fr[f]=="special.field"))
  88. {
  89. $enterchecked=" checked";
  90. }
  91. $entercheckbox="<input name=center[] type=checkbox class='docheckbox' value='".$fr[f]."'".$enterchecked.">";
  92. //投稿项
  93. if(strstr($r[qenter],$like))
  94. {
  95. $qenterchecked=" checked";
  96. }
  97. else
  98. {
  99. $qenterchecked="";
  100. }
  101. $qentercheckbox="<input name=cqenter[] type=checkbox class='docheckbox' value='".$fr[f]."'".$qenterchecked.">";
  102. $listtempfcheckbox="";
  103. $pagetempfcheckbox="";
  104. if($fr['dotemp'])
  105. {
  106. //列表模板项
  107. if(empty($fr['tbdataf']))//主表
  108. {
  109. if(strstr($r[listtempvar],$like))
  110. {
  111. $listtempfchecked=" checked";
  112. }
  113. else
  114. {
  115. $listtempfchecked="";
  116. }
  117. $listtempfcheckbox="<input name=ltempf[] type=checkbox class='docheckbox' value='".$fr[f]."'".$listtempfchecked.">";
  118. }
  119. //内容模板项
  120. if(strstr($r[tempvar],$like))
  121. {
  122. $pagetempfchecked=" checked";
  123. }
  124. else
  125. {
  126. $pagetempfchecked="";
  127. }
  128. $pagetempfcheckbox="<input name=ptempf[] type=checkbox class='docheckbox' value='".$fr[f]."'".$pagetempfchecked.">";
  129. }
  130. //采集项
  131. $cjcheckbox="";
  132. if($fr[iscj])
  133. {
  134. if(strstr($r[cj],$like))
  135. {$cjchecked=" checked";}
  136. else
  137. {$cjchecked="";}
  138. //标题
  139. if($enews=="AddM"&&$fr[f]=="title")
  140. {
  141. $cjchecked=" checked";
  142. }
  143. $cjcheckbox="<input name=cchange[] type=checkbox class='docheckbox' value='".$fr[f]."'".$cjchecked.">";
  144. }
  145. //搜索项
  146. $searchcheckbox="";
  147. if($fr[f]!="special.field"&&empty($fr['tbdataf'])&&empty($fr['tbdataf']))
  148. {
  149. if(strstr($r[searchvar],$slike))
  150. {$searchchecked=" checked";}
  151. else
  152. {$searchchecked="";}
  153. $searchcheckbox="<input name=schange[] type=checkbox class='docheckbox' value='".$fr[f]."'".$searchchecked.">";
  154. }
  155. //必填项
  156. $mustfcheckbox="";
  157. if($fr[f]!="special.field")
  158. {
  159. $mustfchecked="";
  160. if(strstr($r[mustqenterf],$slike))
  161. {$mustfchecked=" checked";}
  162. if($enews=="AddM"&&$fr[f]=="title")
  163. {
  164. $mustfchecked=" checked";
  165. }
  166. $mustfcheckbox="<input name=menter[] type=checkbox class='docheckbox' value='".$fr[f]."'".$mustfchecked.">";
  167. }
  168. //结合项
  169. $listandfcheckbox="";
  170. if($fr[f]!="special.field"&&empty($fr['tbdataf']))
  171. {
  172. $listandfchecked="";
  173. if(strstr($r[listandf],$slike))
  174. {$listandfchecked=" checked";}
  175. $listandfcheckbox="<input name=listand[] type=checkbox class='docheckbox' value='".$fr[f]."'".$listandfchecked.">";
  176. }
  177. //排序项
  178. $orderfcheckbox="";
  179. if($fr[f]!="special.field"&&empty($fr['tbdataf']))
  180. {
  181. $orderfchecked="";
  182. if(strstr($r[orderf],$slike))
  183. {$orderfchecked=" checked";}
  184. $orderfcheckbox="<input name=listorder[] type=checkbox class='docheckbox' value='".$fr[f]."'".$orderfchecked.">";
  185. }
  186. //可增加
  187. $canaddfcheckbox="";
  188. if($fr[f]!="special.field")
  189. {
  190. $canaddfchecked="";
  191. if(strstr($r[canaddf],$slike))
  192. {$canaddfchecked=" checked";}
  193. if($enews=="AddM"&&!$docopy)
  194. {
  195. $canaddfchecked=" checked";
  196. }
  197. $canaddfcheckbox="<input name=canadd[] type=checkbox class='docheckbox' value='".$fr[f]."'".$canaddfchecked.">";
  198. }
  199. //可修改
  200. $caneditfcheckbox="";
  201. if($fr[f]!="special.field")
  202. {
  203. $caneditfchecked="";
  204. if(strstr($r[caneditf],$slike))
  205. {$caneditfchecked=" checked";}
  206. if($enews=="AddM"&&!$docopy)
  207. {
  208. $caneditfchecked=" checked";
  209. }
  210. $caneditfcheckbox="<input name=canedit[] type=checkbox class='docheckbox' value='".$fr[f]."'".$caneditfchecked.">";
  211. }
  212. $data.="<tr bgcolor='".$bgcolor."'>
  213. <td height=32> <div align=center>
  214. <input name=cname[".$fr[f]."] type=text value='".$fr[fname]."'>
  215. </div></td>
  216. <td> <div align=center>
  217. <input name=cfield type=text value='".$fr[f]."' readonly>
  218. </div></td>
  219. <td><div align=center>
  220. ".$entercheckbox."
  221. </div></td>
  222. <td><div align=center>
  223. ".$qentercheckbox."
  224. </div></td>
  225. <td><div align=center>
  226. ".$mustfcheckbox."
  227. </div></td>
  228. <td><div align=center>
  229. ".$canaddfcheckbox."
  230. </div></td>
  231. <td><div align=center>
  232. ".$caneditfcheckbox."
  233. </div></td>
  234. <td> <div align=center>
  235. ".$cjcheckbox."
  236. </div></td>
  237. <td><div align=center>
  238. ".$listtempfcheckbox."
  239. </div></td>
  240. <td><div align=center>
  241. ".$pagetempfcheckbox."
  242. </div></td>
  243. <td><div align=center>
  244. ".$searchcheckbox."
  245. </div></td>
  246. <td><div align=center>
  247. ".$orderfcheckbox."
  248. </div></td>
  249. <td><div align=center>
  250. ".$listandfcheckbox."
  251. </div></td>
  252. </tr>";
  253. }
  254. //预设投票
  255. $infovotesql=$empire->query("select voteid,ysvotename from {$dbtbpre}enewsvotemod order by voteid");
  256. while($infovoter=$empire->fetch($infovotesql))
  257. {
  258. $select="";
  259. if($r[definfovoteid]==$infovoter[voteid])
  260. {
  261. $select=" selected";
  262. }
  263. $definfovote.="<option value='".$infovoter[voteid]."'".$select.">".$infovoter[ysvotename]."</option>";
  264. }
  265. //打印模板
  266. $printtemp_options='';
  267. $ptsql=$empire->query("select tempid,tempname from ".GetTemptb("enewsprinttemp")." order by tempid");
  268. while($ptr=$empire->fetch($ptsql))
  269. {
  270. $select="";
  271. if($ptr[tempid]==$r[printtempid])
  272. {
  273. $select=" selected";
  274. }
  275. $printtemp_options.="<option value=".$ptr[tempid].$select.">".$ptr[tempname]."</option>";
  276. }
  277. db_close();
  278. $empire=null;
  279. ?>
  280. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  281. <html>
  282. <head>
  283. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  284. <title>增加系统模型</title>
  285. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  286. <script>
  287. function DoCheckAll(form,chf)
  288. {
  289. for (var i=0;i<form.elements.length;i++)
  290. {
  291. var e = form.elements[i];
  292. if(e.name==chf)
  293. {
  294. e.checked=true;
  295. }
  296. }
  297. }
  298. </script>
  299. </head>
  300. <body>
  301. <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
  302. <tr>
  303. <td>位置:<?=$url?></td>
  304. </tr>
  305. </table>
  306. <form name="form1" method="post" action="../ecmsmod.php">
  307. <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  308. <tr>
  309. <td height="25" colspan="2" class="header">增加系统模型
  310. <input name="add[mid]" type="hidden" id="add[mid]" value="<?=$mid?>">
  311. <input name="enews" type="hidden" id="enews" value="<?=$enews?>"> <input name="add[tbname]" type="hidden" id="add[tbname]" value="<?=$tbname?>">
  312. <input name="add[tid]" type="hidden" id="add[tid]" value="<?=$tid?>">
  313. <?=$ecms_hashur['form']?> </td>
  314. </tr>
  315. <tr bgcolor="#FFFFFF">
  316. <td width="23%" height="25">模型名称</td>
  317. <td width="77%" height="25"><input name="add[mname]" type="text" id="add[mname]" value="<?=$r[mname]?>" size="43">
  318. <font color="#666666">(比如:&quot;新闻系统模型&quot;)</font></td>
  319. </tr>
  320. <tr bgcolor="#FFFFFF">
  321. <td height="25">模型别名</td>
  322. <td height="25"><input name="add[qmname]" type="text" id="add[qmname]" value="<?=$r[qmname]?>" size="43">
  323. <font color="#666666">(比如:&quot;新闻&quot;,用于前台显示)</font></td>
  324. </tr>
  325. <tr bgcolor="#FFFFFF">
  326. <td height="25">是否启用</td>
  327. <td height="25"><input type="radio" name="add[usemod]" value="0"<?=$r[usemod]==0?' checked':''?>>
  328. 开启
  329. <input type="radio" name="add[usemod]" value="1"<?=$r[usemod]==1?' checked':''?>>
  330. 不使用</td>
  331. </tr>
  332. <tr bgcolor="#FFFFFF">
  333. <td height="25">显示到前台导航</td>
  334. <td height="25"><input type="radio" name="add[showmod]" value="0"<?=$r[showmod]==0?' checked':''?>>
  335. 显示
  336. <input type="radio" name="add[showmod]" value="1"<?=$r[showmod]==1?' checked':''?>>
  337. 不显示</td>
  338. </tr>
  339. <tr bgcolor="#FFFFFF">
  340. <td height="25">显示顺序</td>
  341. <td height="25"><input name="add[myorder]" type="text" id="add[myorder]" value="<?=$r[myorder]?>" size="43">
  342. <font color="#666666">(值越小显示越前面)</font></td>
  343. </tr>
  344. <tr bgcolor="#FFFFFF">
  345. <td height="25" colspan="2" valign="top">选择本模型的字段项</td>
  346. </tr>
  347. <tr bgcolor="#FFFFFF">
  348. <td height="25" colspan="2" valign="top"> <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#DBEAF5">
  349. <tr>
  350. <td width="15%" height="25"> <div align="center">字段标识</div></td>
  351. <td width="17%" height="25"> <div align="center">字段名</div></td>
  352. <td width="6%"> <div align="center"><a href="#empirecms" title="全选" onclick="DoCheckAll(document.form1,'center[]');">录入项</a></div></td>
  353. <td width="6%"> <div align="center"><a href="#empirecms" title="全选" onclick="DoCheckAll(document.form1,'cqenter[]');">投稿项</a></div></td>
  354. <td width="6%"> <div align="center"><a href="#empirecms" title="全选" onclick="DoCheckAll(document.form1,'menter[]');">必填项</a></div></td>
  355. <td width="6%"><div align="center"><a href="#empirecms" title="全选" onclick="DoCheckAll(document.form1,'canadd[]');">可增加</a></div></td>
  356. <td width="6%"><div align="center"><a href="#empirecms" title="全选" onclick="DoCheckAll(document.form1,'canedit[]');">可修改</a></div></td>
  357. <td width="6%"> <div align="center"><a href="#empirecms" title="全选" onclick="DoCheckAll(document.form1,'cchange[]');">采集项</a></div></td>
  358. <td width="7%"> <div align="center"><a href="#empirecms" title="全选" onclick="DoCheckAll(document.form1,'ltempf[]');">列表模板</a></div></td>
  359. <td width="7%"> <div align="center"><a href="#empirecms" title="全选" onclick="DoCheckAll(document.form1,'ptempf[]');">内容模板</a></div></td>
  360. <td width="6%"> <div align="center"><a href="#empirecms" title="全选" onclick="DoCheckAll(document.form1,'schange[]');">搜索项</a></div></td>
  361. <td width="6%"> <div align="center"><a href="#empirecms" title="全选" onclick="DoCheckAll(document.form1,'listorder[]');">排序项</a></div></td>
  362. <td width="6%"> <div align="center"><a href="#empirecms" title="全选" onclick="DoCheckAll(document.form1,'listand[]');">结合项</a></div></td>
  363. </tr>
  364. <?=$data?>
  365. </table></td>
  366. </tr>
  367. <tr bgcolor="#FFFFFF">
  368. <td height="25" colspan="2" valign="top"><p>栏目列表页结合项设置:
  369. <input type="radio" name="add[setandf]" value="0"<?=$r[setandf]==0?' checked':''?>>
  370. 完全匹配
  371. <input type="radio" name="add[setandf]" value="1"<?=$r[setandf]==1?' checked':''?>>
  372. 模糊匹配</p></td>
  373. </tr>
  374. <tr bgcolor="#FFFFFF">
  375. <td height="25" valign="top">录入表单模板<br>
  376. (<font color="#FF0000">
  377. <input name="add[mtype]" type="checkbox" id="add[mtype]" value="1"<?=$mtype?>>
  378. 自动生成表单模板</font>)</td>
  379. <td height="25"><textarea name="add[mtemp]" cols="75" rows="20" id="add[mtemp]" style="WIDTH: 100%"><?=ehtmlspecialchars(stripSlashes($r[mtemp]))?></textarea></td>
  380. </tr>
  381. <tr bgcolor="#FFFFFF">
  382. <td height="25" valign="top">前台投稿表单模板<br>
  383. (<font color="#FF0000">
  384. <input name="add[qmtype]" type="checkbox" id="add[qmtype]" value="1"<?=$mtype?>>
  385. 自动生成表单模板</font>) </td>
  386. <td height="25"><textarea name="add[qmtemp]" cols="75" rows="20" id="textarea2" style="WIDTH: 100%"><?=ehtmlspecialchars(stripSlashes($r[qmtemp]))?></textarea></td>
  387. </tr>
  388. <tr bgcolor="#FFFFFF">
  389. <td rowspan="2" valign="top">信息列表名称</td>
  390. <td height="25"><input name="add[listfile]" type="text" id="add[listfile]" value="<?=$r[listfile]?>" size="43"> </td>
  391. </tr>
  392. <tr bgcolor="#FFFFFF">
  393. <td height="25"><font color="#666666">(不设置为使用默认列表,增加列表可在e/data/html/list里增加文件,<a href="../../data/html/list/ReadMe.txt" target="_blank">点击这里</a>查看说明)</font></td>
  394. </tr>
  395. <tr bgcolor="#FFFFFF">
  396. <td height="25">后台增加信息后处理函数</td>
  397. <td height="25"><input name="add[maddfun]" type="text" id="add[maddfun]" value="<?=$r[maddfun]?>">
  398. <font color="#666666">(一般不设置,格式“函数名##参数”参数可不设置)</font></td>
  399. </tr>
  400. <tr bgcolor="#FFFFFF">
  401. <td height="25">后台修改信息后处理函数</td>
  402. <td height="25"><input name="add[meditfun]" type="text" id="add[meditfun]" value="<?=$r[meditfun]?>">
  403. <font color="#666666">(一般不设置,格式“函数名##参数”参数可不设置)</font></td>
  404. </tr>
  405. <tr bgcolor="#FFFFFF">
  406. <td height="25">前台增加信息后处理函数</td>
  407. <td height="25"><input name="add[qmaddfun]" type="text" id="add[qmaddfun]" value="<?=$r[qmaddfun]?>">
  408. <font color="#666666">(一般不设置,格式“函数名##参数”参数可不设置)</font></td>
  409. </tr>
  410. <tr bgcolor="#FFFFFF">
  411. <td height="25">前台修改信息后处理函数</td>
  412. <td height="25"><input name="add[qmeditfun]" type="text" id="add[qmeditfun]" value="<?=$r[qmeditfun]?>">
  413. <font color="#666666">(一般不设置,格式“函数名##参数”参数可不设置)</font></td>
  414. </tr>
  415. <tr bgcolor="#FFFFFF">
  416. <td height="25">信息预设投票</td>
  417. <td height="25"><select name="add[definfovoteid]" id="add[definfovoteid]">
  418. <option value="0">不设置</option>
  419. <?=$definfovote?>
  420. </select> <input type="button" name="Submit622" value="管理预设投票" onclick="window.open('../other/ListVoteMod.php<?=$ecms_hashur['whehref']?>');">
  421. <font color="#666666">(增加信息时默认的投票项)</font></td>
  422. </tr>
  423. <tr bgcolor="#FFFFFF">
  424. <td height="25">打印模板</td>
  425. <td height="25"><select name="add[printtempid]" id="add[printtempid]">
  426. <option value="0">使用默认</option>
  427. <?=$printtemp_options?>
  428. </select>
  429. <input type="button" name="Submit6222" value="管理打印模板" onclick="window.open('../template/ListPrinttemp.php<?=$ecms_hashur['whehref']?>');"></td>
  430. </tr>
  431. <tr bgcolor="#FFFFFF">
  432. <td height="25" valign="top">注释</td>
  433. <td height="25"><textarea name="add[mzs]" cols="75" rows="10" id="textarea" style="WIDTH: 100%"><?=stripSlashes($r[mzs])?></textarea></td>
  434. </tr>
  435. <tr bgcolor="#FFFFFF">
  436. <td height="25">&nbsp;</td>
  437. <td height="25"><input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置"></td>
  438. </tr>
  439. </table>
  440. </form>
  441. </body>
  442. </html>