|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="<?php echo $cfg_soft_lang; ?>">
- <title>系统配置变量</title>
- <script src="../static/web/js/webajax.js"></script>
- <script src="../static/web/js/jquery.min.js"></script>
- <script>
- var searchconfig = false;
- function Nav() {
- if (window.navigator.userAgent.indexOf("MSIE") >= 1) return 'IE';
- else if (window.navigator.userAgent.indexOf("Firefox") >= 1) return 'FF';
- else return "OT";
- }
- function $Obj(objname) {
- return document.getElementById(objname);
- }
- function ShowConfig(em, allgr) {
- if (searchconfig) location.reload();
- for (var i = 1; i <= allgr; i++) {
- if (i == em) $Obj('td' + i).style.display = (Nav() == 'IE' ? 'block' : 'table');
- else $Obj('td' + i).style.display = 'none';
- }
- $Obj('addvar').style.display = 'none';
- }
- function ShowHide(objname) {
- var obj = $Obj(objname);
- if (obj.style.display != "none") obj.style.display = "none";
- else obj.style.display = (Nav() == 'IE' ? 'block' : 'table-row');
- }
- function backSearch() {
- location.reload();
- }
- function getSearch() {
- var searchKeywords = $Obj('keywds').value;
- searchKeywords = searchKeywords.replace(/^cfg_/, "");
- fetch('sys_info.php?dopost=search&keywords=' + searchKeywords).then(resp=>{
- if (resp.ok) {
- return resp.text()
- }
- throw new Error('系统错误,无法获取数据');
- }).then((d)=>{
- $Obj('_search').innerHTML = d;
- }).catch((error) => {
- $Obj('_search').innerHTML = errMsg;
- });
- $Obj('_searchback').innerHTML = '<button class="btn btn-success btn-sm" name="searchbackBtn" type="button" id="searchbackBtn" onclick="backSearch()">返回</button>'
- $Obj('_mainsearch').innerHTML = '';
- searchconfig = true;
- }
- function resetCookieEncode() {
- jQuery.get("sys_info.php?dopost=make_encode", function (data) {
- jQuery("#edit___cfg_cookie_encode").val(data);
- });
- }
- </script>
- <link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
- <link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
- <link rel="stylesheet" href="../static/web/css/admin.css">
- <style>
- .table{margin-bottom:0}
- </style>
- </head>
- <body background="../static/web/img/allbg.gif" leftmargin="8" topmargin="8">
- <div style="min-width:780px">
- <table width="98%" border="0" cellpadding="2" cellspacing="1" align="center" class="table maintable table-bordered mt-3">
- <tr>
- <td height="30" background="../static/web/img/tbg.gif" style="padding-left:10px">系统配置变量</td>
- </tr>
- <tr>
- <td height="30" bgcolor="#ffffff" align="left">
- <?php
- $ds = file(DEDEADMIN.'/inc/configgroup.txt');
- $totalGroup = count($ds);
- $i = 0;
- foreach($ds as $dl)
- {
- $dl = trim($dl);
- if(empty($dl)) continue;
- $dls = explode(',',$dl);
- $i++;
- if($i>1) echo "<a href='javascript:ShowConfig($i,$totalGroup)' class='btn btn-success btn-sm'>{$dls[1]}</a>";
- else {
- echo "<a href='javascript:ShowConfig($i,$totalGroup)' class='btn btn-success btn-sm'>{$dls[1]}</a>";
- }
- }
- ?>
- <a href="javascript:;" onClick="ShowHide('addvar')" class="btn btn-success btn-sm">添加新变量</a>
- </td>
- </tr>
- <tr id="addvar" style="display:none">
- <td height="26" bgcolor="#ffffff" align="center">
- <form name="fadd" action="sys_info.php" method="post">
- <input type='hidden' name='dopost' value='add'>
- <input type="hidden" name="_csrf_token" value="<?php echo $GLOBALS['csrf_token']; ?>">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="12%" height="26">变量名称</td>
- <td width="38%" align="left"><input name="nvarname" type="text" id="nvarname" class="npvar" style="width:80%"></td>
- <td width="12%" align="center">变量值</td>
- <td width="38%" align="left"><input name="nvarvalue" type="text" id="nvarvalue" class="npvar" style="width:80%"></td>
- </tr>
- <tr>
- <td width="10%" height="26">变量类型</td>
- <td colspan='3' align="left"><input name="vartype" type="radio" value="string" class='np' checked='checked'>
- 文本
- <input name="vartype" type="radio" value="number" class='np'>
- 数字
- <input type="radio" name="vartype" value="bool" class='np'>
- 布尔(Y/N)
- <input type="radio" name="vartype" value="bstring" class='np'>
- 多行文本
- </td>
- </tr>
- <tr>
- <td height="26">变量说明</td>
- <td align="left"><input type="text" name="varmsg" id="varmsg" class="npvar" style="width:80%"></td>
- <td align="center">所属组</td>
- <td align="left">
- <?php
- echo "<select name='vargroup' class='npvar'>";
- foreach($ds as $dl){
- $dl = trim($dl);
- if(empty($dl)) continue;
- $dls = explode(',',$dl);
- echo "<option value='{$dls[0]}'>{$dls[1]}</option>";
- }
- echo "</select>";
- ?>
- <button type="submit" class="btn btn-success btn-sm">保存变量</button>
- </td>
- </tr>
- </table>
- </form>
- </td>
- </tr>
- </table>
- <table width="98%" border="0" cellpadding="0" cellspacing="0" style="margin-top:10px" align="center" class="table maintable table-bordered mt-3">
- <tr>
- <td height="26" align="right" background="../static/web/img/tbg.gif" style="border:1px solid #dee2e6;border-bottom:none">
- <span style="line-height:26px">配置搜索:</span>
- <input type="text" name="keywds" id="keywds">
- <button type="button" onclick="getSearch()" class="btn btn-success btn-sm">搜索</button>
- <span id="_searchback"></span>
- </td>
- </tr>
- <tr>
- <td bgcolor="#FFFFFF" width="100%">
- <form action="sys_info.php" method="post" name="form1">
- <input type="hidden" name="_csrf_token" value="<?php echo $GLOBALS['csrf_token']; ?>">
- <input type="hidden" name="dopost" value="save">
- <div id="_search"></div>
- <div id="_mainsearch">
- <?php
- $n = 0;
- if(!isset($gp)) $gp = 1;
- foreach($ds as $dl)
- {
- $dl = trim($dl);
- if(empty($dl)) continue;
- $dls = explode(',',$dl);
- $n++;
- ?>
- <table width="100%" style="<?php if($n!=$gp) echo 'display:none'; ?>" id="td<?php echo $n?>" border="0" cellspacing="1" cellpadding="1">
- <tr align="center" bgcolor="#FBFCE2">
- <td width="300">变量说明</td>
- <td>变量值</td>
- <td width="220">变量名</td>
- </tr>
- <?php
- $dsql->SetQuery("Select * From `#@__sysconfig` where groupid='{$dls[0]}' order by aid asc");
- $dsql->Execute();
- $i = 1;
- while($row = $dsql->GetArray())
- {
- if($i%2==0)
- {
- $bgcolor = "#f8f8f8";
- } else {
- $bgcolor = "#ffffff";
- }
- $i++;
- ?>
- <tr align="center" bgcolor="<?php echo $bgcolor?>">
- <td width="300"><?php echo $row['info']; ?></td>
- <td align="left">
- <?php
- if($row['type']=='bool')
- {
- $c1='';
- $c2 = '';
- $row['value']=='Y' ? $c1=" checked" : $c2=" checked";
- echo "<label><input type='radio' name='edit___{$row['varname']}' class='np' value='Y'$c1> 是 </label> ";
- echo "<label><input type='radio' name='edit___{$row['varname']}' class='np' value='N'$c2> 否 </label> ";
- } else if($row['type']=='bstring') {
- echo "<textarea name='edit___{$row['varname']}' row='4' id='edit___{$row['varname']}' class='textarea_info' style='width:100%;height:40px'>".dede_htmlspecialchars($row['value'])."</textarea>";
- } else if($row['type']=='number') {
- echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value='{$row['value']}' style='width:30%'>";
- } else {
- $addstr='';
- if ($row['varname']=='cfg_cookie_encode') {
- $addstr=' <a href="javascript:resetCookieEncode();" class="btn btn-success btn-sm">重新生成</a>';
- }
- echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value=\"".dede_htmlspecialchars($row['value'])."\" style='width:80%'>{$addstr}";
- }
- ?>
- </td>
- <td><?php echo $row['varname']?></td>
- </tr>
- <?php
- }
- ?>
- </table>
- <?php
- }
- ?>
- </div>
- <table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#f8f8f8" style="border:1px solid #dee2e6;border-top:none" class="table table-borderless">
- <tr align="center" height="36">
- <td>
- <button type="submit" class="btn btn-success">确定</button>
- <button type="button" onClick="document.form1.reset()" class="btn btn-success">重置</button>
- </td>
- </tr>
- </table>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </body>
- </html>
|