<?php
define('EmpireCMSAdmin','1');
require("../class/connect.php");
require("../class/db_sql.php");
require("../class/functions.php");
require("../class/t_functions.php");
require("../class/dpfun.php");
require("../class/writer.php");
require LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
//验证用户
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];

//导航
$url='<a href="ListWriterClass.php">作者分类管理</a>';

$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews=="AddWriterClass")
{
	$classname=$_POST['classname'];
	$filename=$_POST['filename'];
	AddWriterClass($classname,$filename,$logininid,$loginin);
}
elseif($enews=="EditWriterClass")
{
	$classid=$_POST['classid'];
	$writer=$_POST['classname'];
	EditWriterClass($classid,$classname,$logininid,$loginin);
}
elseif($enews=="DelWriterClass")
{
	$classid=$_GET['classid'];
	DelWriterClass($classid,$logininid,$loginin);
}
else
{}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="adminstyle/<?=$loginadminstyleid?>/adminstyle.css" type="text/css">
<title>作者分类管理</title>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr> 
    <td width="52%">位置： 
      <?=$url?>
    </td>
    <td width="48%"><div align="right">[<a href="AddBook.php?enews=EditNews&id=<?=$bookid?>&classid=<?=$classid?>">全部生成</a>]&nbsp;[<a href="AddBook.php?enews=EditNews&id=<?=$bookid?>&classid=<?=$classid?>">编辑模板</a>]</div>
	</td>
  </tr>
</table>
<form name="form1" method="post" action="ListWriterClass.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=AddWriterClass>
        </td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF"> 分类名称: 
        <input name="classname" type="text" id="classname" value="" size="30">&nbsp;&nbsp;
        文件名: 
        <input name="filename" type="text" id="filename" value="" size="30"> 
        <input type="submit" name="Submit" value="增加"> 
		(文件名为数字或字母，如"wuxia","007","y01"等)
      </td>
    </tr>
  </table>
</form>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  	<tr class="header"> 
      <td width="10%" height="25"><div align="center">分类ID</div></td>
      <td width="35%" height="25"> <div align="center">分类名</div></td>
	  <td width="20%" height="25"> <div align="center">文件名</div></td>
	  <td width="10%" height="25"> <div align="center">预览</div></td>
      <td width="25%" height="25"> <div align="center">操作</div></td>
    </tr>

<?
$sql=$empire->query("select * from {$dbtbpre}enewswriterclass");
while($r=$empire->fetch($sql)){
?>
  <form name=form2 method=post action=ListWriterClass.php>
    <input type=hidden name=enews value=EditWriterClass>
    <input type=hidden name=classid value=<?=$r[classid]?>>
	<tr bgcolor='#ffffff'>
      <td height="25"><div align="center"><?=$r[classid]?></div></td>
	  <td height="25"> <div align="center"><input type="text" name="classname" value="<?=$r[classname]?>"></div></td>
	  <td height="25"> <div align="center">/writer/<?=$r[filename]?>.html</div></td>
	  <td height="25"> <div align="center"><a href="../../writer/<?=$r[filename]?>.html" target="_blank">预览</a></div></td>
      <td height="25"> <div align="center"><a href="ListWriter.php?enews=ReWriterClassOne&classid=<?=$r[classid]?>">刷新</a>
	    <input type="submit" name="Submit3" value="修改">   
		&nbsp; 
          <input type="button" name="Submit4" value="删除" onclick="if(confirm('确认要删除?')){self.location.href='ListWriterClass.php?enews=DelWriterClass&classid=<?=$r[classid]?>';}">
		</div></td>
	</tr>
  </form>
<?
}
?>
</table>

<?
db_close();
$empire=null;
?>