织梦模板大全为站长朋友们提供精品织梦模板下载和免费织梦建站教程学习。
用户名:
密码:
注册

DedeCMS帮助中心

dedecms后台添加新变量删除的功能
本站承接DedeCMS仿站服务,大家如有需要请联系QQ:121673232
本站所有商业模板均提供使用详细安装说明(含视频)
dede后台新建 sys_check.php

  1. <?php
  2. require_once(dirname(__FILE__).'/config.php');
  3. $row = $dsql->GetOne("SELECT * FROM `dede_sysconfig` WHERE aid='$id'");
  4. $info=$row["info"];
  5. if( $action == 'del' )
  6. {
  7.         $id = explode("`", $id);
  8.         foreach ($id as $var)
  9.         {
  10.             $query = "delete from `dede_sysconfig` WHERE `aid` = '$var'";
  11.             $dsql->ExecuteNoneQuery($query);
  12.         }
  13.         ShowMsg("已删除变量 $info ","sys_info.php");
  14.         exit();
  15. }
  16. ?>

dede/templets/sys_info.htm 替换为一下内容 ,53行至111行,    202行,   224行,      226行,      259行至265行 为新增内容
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
  5. <title>系统配置参数</title>
  6. <script language="javascript" src="../include/js/dedeajax2.js"></script>
  7. <script language="javascript">
  8. var searchconfig = false;
  9. function Nav()
  10. {
  11.     if(window.navigator.userAgent.indexOf("MSIE")>=1) return 'IE';
  12.     else if(window.navigator.userAgent.indexOf("Firefox")>=1) return 'FF';
  13.     else return "OT";
  14. }
  15. function $Obj(objname)
  16. {
  17.     return document.getElementById(objname);
  18. }
  19. function ShowConfig(em,allgr)
  20. {
  21.     if(searchconfig) location.reload();
  22.     for(var i=1;i<=allgr;i++)
  23.     {
  24.         if(i==em) $Obj('td'+i).style.display = (Nav()=='IE' ? 'block' : 'table');
  25.         else $Obj('td'+i).style.display = 'none';
  26.     }
  27.     $Obj('addvar').style.display = 'none';
  28. }
  29.  
  30.  
  31. function ShowHide(objname)
  32. {
  33.     var obj = $Obj(objname);
  34.     if(obj.style.display != "none") obj.style.display = "none";
  35.     else obj.style.display = (Nav()=='IE' ? 'block' : 'table-row');
  36. }
  37.  
  38.  
  39. function backSearch()
  40. {
  41.     location.reload();
  42. }
  43. function getSearch()
  44. {
  45.     var searchKeywords = $Obj('keywds').value;
  46.     var myajax = new DedeAjax($Obj('_search'));
  47.     myajax.SendGet('sys_info.php?dopost=search&keywords='+searchKeywords)
  48.     $Obj('_searchback').innerHTML = '<input name="searchbackBtn" type="button" value="返回" id="searchbackBtn" onclick="backSearch()"/>'
  49.     $Obj('_mainsearch').innerHTML = '';
  50.     searchconfig = true;
  51. }
  52. </script>
  53. <script type="text/javascript">
  54. function getOneItem()
  55. {
  56.     var allSel="";
  57.     if(document.form1.id.value) return document.form1.id.value;
  58.     for(i=0;i<document.form1.id.length;i++)
  59.     {
  60.         if(document.form1.id[i].checked)
  61.         {
  62.                 allSel = document.form1.id[i].value;
  63.                 break;
  64.         }
  65.     }
  66.     return allSel;
  67. }
  68. function getCheckboxItem()
  69. {
  70.     var allSel="";
  71.     if(document.form1.id.value) return document.form1.id.value;
  72.     for(i=0;i<document.form1.id.length;i++)
  73.     {
  74.         if(document.form1.id[i].checked)
  75.         {
  76.             if(allSel=="")
  77.                 allSel=document.form1.id[i].value;
  78.             else
  79.                 allSel=allSel+","+document.form1.id[i].value;
  80.         }
  81.     }
  82.     return allSel;
  83. }
  84. function selAll()
  85. {
  86.     for(i=0;i<document.form1.id.length;i++)
  87.     {
  88.         if(!document.form1.id[i].checked)
  89.         {
  90.             document.form1.id[i].checked=true;
  91.         }
  92.     }
  93. }
  94. function noSelAll()
  95. {
  96.     for(i=0;i<document.form1.id.length;i++)
  97.     {
  98.         if(document.form1.id[i].checked)
  99.         {
  100.             document.form1.id[i].checked=false;
  101.         }
  102.     }
  103. }
  104.  
  105.  
  106. function del()
  107. {
  108.     var qstr=getCheckboxItem();
  109.     if(qstr=="") alert("请选择ID!");
  110.     else if(window.confirm("您确定要删除所选证书吗?")) location.href="sys_check.php?action=del&id="+qstr;}
  111. </script>
  112. <link href="css/base.css" rel="stylesheet" type="text/css">
  113. </head>
  114. <body background='images/allbg.gif' leftmargin='8' topmargin='8'>
  115. <div style="min-width:780px">
  116. <table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D6D6D6" align="center">
  117.   <tr>
  118.    <td height="28" background="images/tbg.gif" style="padding-left:10px;"><b>DedeCMS系统配置参数:</b></td>
  119.   </tr>
  120.   <tr>
  121.    <td height="24" bgcolor="#ffffff" align="center"><?php
  122. $ds = file(DEDEADMIN.'/inc/configgroup.txt');
  123. $totalGroup = count($ds);
  124. $i = 0;
  125. foreach($ds as $dl)
  126. {
  127.     $dl = trim($dl);
  128.     if(empty($dl)) continue;
  129.     $dls = explode(',',$dl);
  130.     $i++;
  131.     if($i>1) echo " | <a href='javascript:ShowConfig($i,$totalGroup)'>{$dls[1]}</a> ";
  132.     else{
  133.         echo " <a href='javascript:ShowConfig($i,$totalGroup)'>{$dls[1]}</a> ";
  134.     }
  135. }
  136. ?>
  137.     | <a href="#" onClick="ShowHide('addvar')">添加新变量</a></td>
  138.   </tr>
  139.   <tr id="addvar" style="display:none">
  140.    <td height="24" bgcolor="#ffffff" align="center"><form name="fadd" action="sys_info.php" method="post">
  141.      <input type='hidden' name='dopost' value='add'>
  142.      <table width="98%" border="0" cellspacing="0" cellpadding="0">
  143.       <tr>
  144.        <td width="12%" height="26">变量名称:</td>
  145.        <td width="38%" align="left"><input name="nvarname" type="text" id="nvarname" class="npvar" style="width:80%" /></td>
  146.        <td width="12%" align="center">变量值:</td>
  147.        <td width="38%" align="left"><input name="nvarvalue" type="text" id="nvarvalue" class="npvar" style="width:80%" /></td>
  148.       </tr>
  149.       <tr>
  150.        <td width="10%" height="26">变量类型:</td>
  151.        <td colspan='3' align="left"><input name="vartype" type="radio"  value="string" class='np' checked='checked' />
  152.         文本
  153.         <input name="vartype" type="radio"  value="number" class='np' />
  154.         数字
  155.         <input type="radio" name="vartype" value="bool" class='np' />
  156.         布尔(Y/N)
  157.         <input type="radio" name="vartype" value="bstring" class='np' />
  158.         多行文本 </td>
  159.       </tr>
  160.       <tr>
  161.        <td height="26">参数说明:</td>
  162.        <td align="left"><input type="text" name="varmsg"  id="varmsg" class="npvar" style="width:80%" /></td>
  163.        <td align="center">所属组:</td>
  164.        <td align="left"><?php
  165.                 echo "<select name='vargroup' class='npvar'>\r\n";
  166.                 foreach($ds as $dl){
  167.                     $dl = trim($dl);
  168.                     if(empty($dl)) continue;
  169.                     $dls = explode(',',$dl);
  170.                     echo "<option value='{$dls[0]}'>{$dls[1]}</option>\r\n";
  171.                 }
  172.                 echo "</select>\r\n";
  173.               ?>
  174.         <input type="submit" name="Submit" value="保存变量" class="np coolbg" /></td>
  175.       </tr>
  176.      </table>
  177.     </form></td>
  178.   </tr>
  179. </table>
  180. <table width="98%" border="0" cellpadding="0" cellspacing="0" style="margin-top:10px" bgcolor="#D6D6D6" align="center">
  181.   <tr>
  182.    <td height="28" align="right" background="images/tbg.gif" style="border:1px solid #cfcfcf;border-bottom:none;">   配置搜索:
  183.     <input type="text" name="keywds" id="keywds" />
  184.     <input name="searchBtn" type="button" value="搜索" id="searchBtn" onclick="getSearch()"/>
  185.      <span id="_searchback"></span></td>
  186.   </tr>
  187.   <tr>
  188.    <td bgcolor="#FFFFFF" width="100%"><form action="sys_info.php" method="post" name="form1">
  189.      <input type="hidden" name="dopost" value="save">
  190. <div id="_search"></div>
  191. <div id="_mainsearch">
  192.      <?php
  193. $n = 0;
  194. if(!isset($gp)) $gp = 1;
  195. foreach($ds as $dl)
  196. {
  197.     $dl = trim($dl);
  198.     if(empty($dl)) continue;
  199.     $dls = explode(',',$dl);
  200.     $n++;
  201. ?>
  202.      <table width="100%" style='<?php if($n!=$gp) echo "display:none"; ?>' id="td<?php echo $n?>" border="0" cellspacing="1" cellpadding="1" bgcolor="#cfcfcf">
  203.       <tr align="center" bgcolor="#FBFCE2" height="25">
  204.       <td width="50">aid</td>
  205.        <td width="300">参数说明</td>
  206.        <td>参数值</td>
  207.        <td width="220">变量名</td>
  208.       </tr>
  209.       <?php
  210. $dsql->SetQuery("Select * From `dede_sysconfig` where groupid='{$dls[0]}' order by aid asc");
  211. $dsql->Execute();
  212. $i = 1;
  213. while($row = $dsql->GetArray())
  214. {
  215.     if($i%2==0)
  216.     {
  217.         $bgcolor = "#F9FCEF";
  218.     }
  219.     else
  220.     {
  221.         $bgcolor = "#ffffff";
  222.     }
  223.     $i++;
  224. ?>
  225.       <tr align="center" height="25" bgcolor="<?php echo $bgcolor?>">
  226.       <td width="50"><?php if($row['aid'] <= 761){echo "!";}else{echo "<input name='id' type='checkbox' id='id' value='".$row['aid']."' class='np'>";}?></td>
  227.        <td width="300"><?php echo $row['info']; ?>: </td>
  228.        <td align="left" style="padding:3px;"><?php
  229. if($row['type']=='bool')
  230. {
  231.     $c1='';
  232.     $c2 = '';
  233.     $row['value']=='Y' ? $c1=" checked" : $c2=" checked";
  234.     echo "<input type='radio' class='np' name='edit___{$row['varname']}' value='Y'$c1>是 ";
  235.     echo "<input type='radio' class='np' name='edit___{$row['varname']}' value='N'$c2>否 ";
  236. }else if($row['type']=='bstring')
  237. {
  238.     echo "<textarea name='edit___{$row['varname']}' row='4' id='edit___{$row['varname']}' class='textarea_info' style='width:98%;height:50px'>".htmlspecialchars($row['value'])."</textarea>";
  239. }else if($row['type']=='number')
  240. {
  241.     echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value='{$row['value']}' style='width:30%'>";
  242. }else
  243. {
  244.     echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value=\"".htmlspecialchars($row['value'])."\" style='width:80%'>";
  245. }
  246. ?></td>
  247.        <td><?php echo $row['varname']?></td>
  248.       </tr>
  249.       <?php
  250. }
  251.  
  252.  
  253. ?>
  254.      </table>
  255.      <?php
  256. }
  257. ?>
  258. </div>
  259.      <table width="100%" border="0" cellspacing="1" cellpadding="1"  style="border:1px solid #cfcfcf;border-top:none;">
  260.       <tr bgcolor="#F9FCEF">
  261.        <td height="50" colspan="3">
  262.        <table width="98%" border="0" cellspacing="1" cellpadding="1">
  263.          <tr>
  264.           <td width="11%"> <a href="javascript:selAll()" class="coolbg">全选</a>
  265.             <a href="javascript:noSelAll()" class="coolbg">取消</a>
  266.             <a href="#" onClick="del()" class="coolbg">删除</a></td>
  267.          </tr>
  268.         </table>
  269.        <table width="98%" border="0" cellspacing="1" cellpadding="1">
  270.          <tr>
  271.           <td width="11%"> </td>
  272.           <td width="11%"> </td>
  273.           <td width="11%"><input name="imageField" type="image" src="images/button_ok.gif" width="60" height="22" border="0" class="np"></td>
  274.           <td width="78%"><img src="images/button_reset.gif" width="60" height="22" style="cursor:pointer" onClick="document.form1.reset()"></td>
  275.          </tr>
  276.         </table></td>
  277.       </tr>
  278.      </table>
  279.     </form></td>
  280.   </tr>
  281. </table>
  282. </div>
  283. </body>
  284. </html>