<?php
require("../../class/connect.php");
include("../../class/db_sql.php");
include("../../class/config.php");
include("../../class/functions.php");
$link=db_connect();
$empire=new mysqlquery();
//验证用户
$logininid=getcvar('loginuserid');
$loginin=getcvar('loginusername');
$loginrnd=getcvar('loginrnd');
$loginlevel=getcvar('loginlevel');
$editor=1;
is_login($logininid,$loginin,$loginrnd);
//验证权限
CheckLevel($logininid,$loginin,$classid,"adminstyle");
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
	include("../../class/com_functions.php");
}
//增加后台样式
if($enews=="AddAdminStyle")
{
	AddAdminstyle($_POST,$logininid,$loginin);
}
//修改后台样式
elseif($enews=="EditAdminStyle")
{
	EditAdminStyle($_POST,$logininid,$loginin);
}
//默认后台样式
elseif($enews=="DefAdminStyle")
{
	DefAdminStyle($_GET['styleid'],$logininid,$loginin);
}
//删除后台样式
elseif($enews=="DelAdminStyle")
{
	DelAdminStyle($_GET['styleid'],$logininid,$loginin);
}
else
{}
$sql=$empire->query("select styleid,stylename,path,isdefault from {$dbtbpre}enewsadminstyle order by styleid");
//风格
$loginadminstyleid=(int)getcvar('loginadminstyleid');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
    <td><p>位置：<a href="AdminStyle.php">管理后台样式</a></p>
      </td>
  </tr>
</table>
<form name="form1" method="post" action="AdminStyle.php">
  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
    <tr class="header">
      <td height="25">增加后台样式: 
        <input name=enews type=hidden id="enews" value=AddAdminStyle>
        </td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF"> 样式名称: 
        <input name="stylename" type="text" id="stylename">
        样式目录:adminstyle/ 
        <input name="path" type="text" id="path" size="6">
        (请填写数字) 
        <input type="submit" name="Submit" value="增加">
        <input type="reset" name="Submit2" value="重置"></td>
    </tr>
  </table>
</form>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  <tr class="header"> 
    <td width="7%"><div align="center">ID</div></td>
    <td width="29%" height="25"><div align="center">样式名称</div></td>
    <td width="30%"><div align="center">样式目录</div></td>
    <td width="34%" height="25"><div align="center">操作</div></td>
  </tr>
  <?
  while($r=$empire->fetch($sql))
  {
  	$bgcolor="#FFFFFF";
  	if($r[isdefault])
	{
		$bgcolor="#DBEAF5";
	}
  ?>
  <form name=form2 method=post action=AdminStyle.php>
    <input type=hidden name=enews value=EditAdminStyle>
    <input type=hidden name=styleid value=<?=$r[styleid]?>>
    <tr bgcolor="<?=$bgcolor?>"> 
      <td><div align="center">
          <?=$r[styleid]?>
        </div></td>
      <td height="25"> <div align="center"> 
          <input name="stylename" type="text" id="stylename" value="<?=$r[stylename]?>">
        </div></td>
      <td><div align="center">adminstyle/ 
          <input name="path" type="text" id="path" value="<?=$r[path]?>" size="6">
        </div></td>
      <td height="25"><div align="center">
          <input type="button" name="Submit4" value="设为默认" onclick="self.location.href='AdminStyle.php?enews=DefAdminStyle&styleid=<?=$r[styleid]?>';"> 
		  &nbsp;
          <input type="submit" name="Submit3" value="修改">
          &nbsp; 
          <input type="button" name="Submit4" value="删除" onclick="self.location.href='AdminStyle.php?enews=DelAdminStyle&styleid=<?=$r[styleid]?>';">
        </div></td>
    </tr>
  </form>
  <?
  }
  db_close();
  $empire=null;
  ?>
</table>
</body>
</html>
