<?php
define('EmpireCMSAdmin','1');
require("../class/connect.php");
require("../class/db_sql.php");
require("../class/functions.php");
$link=db_connect();
$empire=new mysqlquery();

//验证用户
$lur=is_login();
$logininid=(int)$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];

$r=ReturnLeftLevel($loginlevel);

$user_r=$empire->fetch1("select adminclass,groupid from {$dbtbpre}enewsuser where userid='$logininid'");
//用户组权限
$gr=$empire->fetch1("select doall from {$dbtbpre}enewsgroup where groupid='$user_r[groupid]'");




//显示无限级栏目列表
function ClassList($adminclass,$doall,$mid,$addminfocid,$oldmid,$oldaddminfocid,$userid){
	global $empire,$fun_r,$dbtbpre,$public_r;
		$bclassid=0;
		$exp='';
		$expjs='|-';
		$expmodjs='|-';
	$sql=$empire->query("select classid,classname,classpath,classurl,tbname,modid,myorder from {$dbtbpre}enewsclass where is_zt=1 order by myorder,classid");
	$returnr='';
	$num=$empire->num1($sql);
	if($num==0)
	{
		return '请先<a href="AddNewsClass.php?enews=AddClass" target="main"><u>添加文章栏目</u></a>';
	}
	$returnr.='';
	$i=1;
	while($r=$empire->fetch($sql))
	{
		$classurl=sys_ReturnBqClassUrl($r);
		//------ 管理信息页面 ------
		//链接地址
		$infoclassurl='';
		//终级栏目

			//最后一个子栏目
			$menutype="file3";
			$infoclassname="<a href='ListNews.php?classid=".$r[classid]."' target='main'>".$r[classname]."</a>";
			$onmouseup="";

		$returnr.='<tr><td id="pr'.$r[classid].'" class="'.$menutype.'" onclick="'.$onmouseup.'">'.$infoclassname.'</td></tr>';

		$i+=1;
	}
	return $returnr;
}

$cacher=ClassList($user_r['adminclass'],$gr['doall'],$mid,$addminfocid,$oldmid,$oldaddminfocid,$userid);




//数据表
$changetbs='';
$dh='';
$tbi=0;
$tbsql=$empire->query("select tbname,tname from {$dbtbpre}enewstable order by tid");
while($tbr=$empire->fetch($tbsql))
{
	$tbi++;
	$changetbs.=$dh.'new ContextItem("'.$tbr['tname'].'",function(){ parent.document.main.location="ListAllInfo.php?tbname='.$tbr['tbname'].'"; })';
	if($tbi%3==0)
	{
		$changetbs.=',new ContextSeperator()';
	}
	$dh=',';
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>菜单</title>
<link href="../data/menu/menu.css" rel="stylesheet" type="text/css">
<script src="../data/menu/menu.js" type="text/javascript"></script>
<SCRIPT lanuage="JScript">
function tourl(url){
	parent.main.location.href=url;
}
</SCRIPT>
</head>
<body onLoad="initialize()">

<table border='0' cellspacing='0' cellpadding='0' width=100%>
<?
if($r[doclass]||$r[dosetmclass]||$r[doclassf])
{
?>
  <tr> 
    <td id="prclassdata" class="menu1" onclick="chengstate('classdata')">
		<a onmouseout="this.style.fontWeight=''" onmouseover="this.style.fontWeight='bold'">书籍栏目</a>
	</td>
  </tr>
  <tr id="itemclassdata" style="display:none"> 
    <td class="list">
		<table border='0' cellspacing='0' cellpadding='0' width=100%>
		<?
		if($r[doclass])
		{
		?>
		<tr> 
          <td class="file">
			<a href="ListClass.php" target="main" onmouseout="this.style.fontWeight=''" onmouseover="this.style.fontWeight='bold'">书籍管理栏目</a>
          </td>
        </tr>
		<?
		}
		if($r[dosetmclass])
		{
		?>
		<tr> 
          <td class="file">
			<a href="SetMoreClass.php" target="main" onmouseout="this.style.fontWeight=''" onmouseover="this.style.fontWeight='bold'">批量设置书籍栏目</a>
          </td>
        </tr>
		<?
		}
		?>
      </table>
	</td>
  </tr>
<?
}
?>

<?
if($r[doclass]||$r[dosetmclass]||$r[doclassf])
{
?>
  <tr> 
    <td id="prclassdata2" class="menu1" onclick="chengstate('classdata2')">
		<a onmouseout="this.style.fontWeight=''" onmouseover="this.style.fontWeight='bold'">文章栏目</a>
	</td>
  </tr>
  <tr id="itemclassdata2" style="display:none"> 
    <td class="list">
		<table border='0' cellspacing='0' cellpadding='0' width=100%>
		<?
		if($r[doclass])
		{
		?>
		<tr> 
          <td class="file">
			<a href="ListClassNews.php" target="main" onmouseout="this.style.fontWeight=''" onmouseover="this.style.fontWeight='bold'">文章管理栏目</a>
          </td>
        </tr>
		<?
		}
		if($r[dosetmclass])
		{
		?>
		<tr> 
          <td class="file">
			<a href="SetMoreClassNews.php" target="main" onmouseout="this.style.fontWeight=''" onmouseover="this.style.fontWeight='bold'">批量设置文章栏目</a>
          </td>
        </tr>
		<?
		}
		?>
      </table>
	</td>
  </tr>
<?
}
?>



  <tr> 
    <td id="prclassdata3" class="menu1" onclick="chengstate('classdata3')">
		<a onmouseout="this.style.fontWeight=''" onmouseover="this.style.fontWeight='bold'">文章管理</a>
	</td>
  </tr>
  <tr id="itemclassdata3" style="display:none"> 
    <td class="list">
		<table border='0' cellspacing='0' cellpadding='0' width=100%>
		
<?=$cacher?>

      </table>
	</td>
  </tr>



</table>
</body>
</html>