<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>系统配置参数</title>
<script language="javascript" src="../include/js/dedeajax2.js"></script>

<script language="javascript">
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;
	var myajax = new DedeAjax($Obj('_search'));
	myajax.SendGet('sys_info.php?dopost=search&keywords='+searchKeywords)
	$Obj('_searchback').innerHTML = '<input name="searchbackBtn" type="button" value="返回" id="searchbackBtn" onclick="backSearch()"/>'
	$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><script language="JavaScript">
function getObj(id){
	return document.getElementById(id);
}
function showcode(idName){
	obj  = getObj("advert");
	obj2 = getObj(idName);
	obj.innerHTML = obj2.innerHTML;
}
showcode('code');
</script>

<link href="css/base.css" rel="stylesheet" type="text/css">
<style>
td{ text-indent:10px;}
</style>
</head>
<body background='images/allbg.gif' leftmargin='8' topmargin='8' style="overflow-x:hidden" class="sys">
<div style="padding:10px 0 10px 10px; background:#fff; box-shadow: 0 0 4px rgba(0,0,0,0.2); width:100%;">
 <table width="100%" border="0" cellpadding="2" cellspacing="1"align="center">
  <tr>
   <td height="28" style="text-indent:5px;">
   <?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++;

}
?>
   
   <span style="float:right;"><a style="color:#6DC410" href="#" onClick="ShowHide('addvar')">添加新变量</a> <em style="color:#ccc">|</em> <a style="padding-right:30px; color:#6DC410" href="sys_admin_user_edit.php?id=1&dopost=edit" target="main">更改密码</a></span>
   <span style="font-size:16px; color:#6DC410; font-weight:bold;">网站系统设置</span></td>
  </tr>
  
  <tr id="addvar" style="display:none">
   <td height="24" bgcolor="#ffffff" align="center"><form name="fadd" action="sys_info.php" method="post">
     <input type='hidden' name='dopost' value='add'>
     <table width="98%" 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' />
        多行文本 
           <input type="radio" name="vartype" value="picurl" 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">
       <select name='vargroup' class='npvar'>
       <option value="1">站点设置</option>
       </select>
			
        <input type="submit" name="Submit" value="保存变量" class="np coolbg" style="color:#fff;" /></td>
      </tr>
     </table>
    </form></td>
  </tr>
 </table>
 <table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-top:10px" align="center">
 
  <tr>
   <td bgcolor="#FFFFFF" width="100%"><form action="sys_info.php" method="post" name="form1" onSubmit="return checkSubmit()" id='form1'>
     <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="98%" style='<?php if($n!=$gp) echo "display:none"; ?>' id="td<?php echo $n?>" border="0" cellspacing="0" cellpadding="0" >
     
      <?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 = "#ffffff";
	}
	else
	{
		$bgcolor = "#ffffff";
	}
	$i++;
?>
      <tr align="left" height="45" bgcolor="<?php echo $bgcolor?>">
       <td width="200" style="color:#666;"><?php echo $row['info']; ?>： </td>
       <td align="left" style="padding:3px;"><?php
if($row['type']=='bool')
{
	$c1='';
	$c2 = '';
	$row['value']=='Y' ? $c1=" checked" : $c2=" checked";
	echo "<input type='radio' class='np' name='edit___{$row['varname']}' value='Y'$c1>是 ";
	echo "<input type='radio' class='np' name='edit___{$row['varname']}' value='N'$c2>否 ";
}else if($row['type']=='bstring')
{
	echo "<textarea name='edit___{$row['varname']}' row='4' id='edit___{$row['varname']}' class='textarea_info' style='width:100%;height:50px'>".htmlspecialchars($row['value'])."</textarea>";
}else if($row['type']=='number')
{
}else if($row['type']=='picurl')
{
	echo "<input type='text'  name='edit___{$row['varname']}' id='edit___{$row['varname']}' value='".htmlspecialchars($row['value'])."' class='iptxt'/><input type='button' name='set3' value='浏览...' style='width:70px' onClick=\"SelectImage('form1.edit___{$row['varname']}','small');\">";
}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();" style="color:blue">[重新生成]</a>';
	}
	echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value=\"".htmlspecialchars($row['value'])."\" style='width:100%'>{$addstr}";
}
?></td>
       <td style="color:#999999;"><span style="visibility:hidden"><?php echo $row['varname']?></span></td>
      </tr>
      <?php
}

?>
     </table>
     <?php
}
?>
</div>
     <table width="98%" border="0" cellspacing="1" cellpadding="1"  >
      <tr>
       <td height="50" colspan="3"><table width="100%" border="0" cellspacing="1" cellpadding="1">
         <tr>
          <td width="200">&nbsp;</td>
          <td><input name="" type="submit" style="border: none;
background: #6BC30D;
padding: 5px 20px;
cursor: pointer;
color:#fff;
border-radius: 3px;"></td>
          <td>&nbsp;</td>
         </tr>
        </table></td>
      </tr>
      
    
     </table>
    </form></td>
  </tr>
 </table>
</div>
</body>
</html>