<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
'==============================================================================
'软件名称：风讯网站信息管理系统
'当前版本：Foosun Content Manager System 2.0 
'最新更新：2004.12
'==============================================================================
'商业注册联系：028-85098980-601,602 技术支持：028-85098980-606、607,客户支持：608
'产品咨询QQ：159410,655071,66252421
'技术支持:所有程序使用问题，请提问到bbs.foosun.net我们将及时回答您
'程序开发：风讯开发组 & 风讯插件开发组
'论坛支持：风讯在线论坛(http://bbs.foosun.net)
'官方网站：www.Foosun.net  演示站点：test.cooin.com    
'网站建设专区：www.cooin.com
'==============================================================================
'免费版本请在新闻首页保留版权信息，并做上本站LOGO友情连接
'==============================================================================
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P019") then Call ReturnError2()
Dim ClassSql,RsClassObj
ClassSql = "Select * from NewsClass where parentID='0' and DelFlag=0"
Set RsClassObj = Conn.Execute(ClassSql)

Function GetChildClassList(ClassID,Str)
	Dim Sql,RsTempObj,TempImageStr,ImageStr
	TempImageStr = "<img src=""../Images/folder-.gif"" width=""18"" height=""18""><img src=""../Images/folder.gif"" width=""18"" height=""18"">"
	Sql = "Select * from NewsClass where ParentID='" & ClassID & "' and DelFlag=0"
	ImageStr = Str & "<img src=""../Images/folderHR.gif"" width=""18"" height=""18"">"
	Set RsTempObj = Conn.Execute(Sql)
	do while Not RsTempObj.Eof
		if JudgePopedomTF(Session("Name"),"" & RsTempObj("ClassID") & "") = True then
			GetChildClassList = GetChildClassList & "<tr><td><table border=""0"" cellspacing=""0"" cellpadding=""0""><tr onDblClick=""DblClickClass(this);"" ChildClassShowTF=""true"" ParentID=""" & RsTempObj("ParentID") & """ ClassID=""" & RsTempObj("ClassID") & """ align=""left"" onClick=""ClickClass(this)"" class=""TempletItem""><td>" & ImageStr & TempImageStr & "</td><td>" & RsTempObj("ClassCName") & "</td></tr></table></td></tr>"
		end if
		GetChildClassList = GetChildClassList & GetChildClassList(RsTempObj("ClassID"),ImageStr)
		RsTempObj.MoveNext
	loop
	Set RsTempObj = Nothing
End Function
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>栏目列表</title>
</head>
<link href="../../CSS/css.css" rel="stylesheet">
<script src="../JS/PublicJS.js" language="JavaScript"></script>
<body topmargin="0" leftmargin="0" ondragstart="return false;" onselectstart="return false;" oncontextmenu="ClickClass(event.srcElement.parentElement);showMenu(MouseRightMenu);return false;">
<table border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td> 
      <table border="0" cellspacing="0" cellpadding="0">
        <tr onDblClick="DblClickClass(this);" ChildClassShowTF="true" id="SysRootClass" ParentID="0" ClassID="0" align="left" onClick="ClickClass(this)" class="TempletItem">
          <td><img src="../Images/Folderk.gif" width="18" height="18"></td>
          <td class="TempletSelectItem">系统根栏目</td>
        </tr>
      </table></td>
  </tr>
  <%
do while Not RsClassObj.Eof
%>
  <tr> 
    <td><table border="0" cellspacing="0" cellpadding="0">
        <tr onDblClick="DblClickClass(this);" ChildClassShowTF="true" ParentID="<% = RsClassObj("ParentID") %>" ClassID="<% = RsClassObj("ClassID") %>" align="left" onClick="ClickClass(this)" class="TempletItem">
          <td><img src="../Images/folder-.gif" width="18" height="18"><img src="../Images/Folder.gif"></td>
          <td><% = RsClassObj("ClassCName") %></td>
        </tr>
      </table></td>
  </tr>
  <%
	Response.Write(GetChildClassList(RsClassObj("ClassID"),""))
	RsClassObj.MoveNext
loop
%>
</table>
<!-- 鼠标右键菜单 -->
<div id=MouseRightMenu onclick="ClickMenu(this);" onmouseover="MouseOverRightMenu();" onmouseout="MouseOverRightMenu();" class="menu"> 
  <div class="MouseRightItem" id="Add" ExeFunction="OpenWindow('Frame.asp?FileName=ClassAdd.asp&Titles=添加栏目&ParentID='+ClassID,350,260,window);">新建</div>
  <div class="MouseRightItem" id="Edit" ExeFunction="OpenWindow('Frame.asp?FileName=ClassEdit.asp&Titles=修改栏目&ClassID='+ClassID,350,260,window);">修改</div>
  <div class="MouseRightItem" id="Del" ExeFunction="OpenWindow('Frame.asp?FileName=DelNewsClass.asp&Titles=删除栏目&ClassID='+ClassID,300,101,window);">删除</div>
  <hr id="HR1">
  <div class="MouseRightItem" id="Cut" ExeFunction="CutClass();">剪切</div>
  <div class="MouseRightItem" id="Paste" ExeFunction="PasteClass();">粘帖</div>
  <hr id="HR2">
  <div class="MouseRightItem" id="Refresh" ExeFunction="window.location.reload();">刷新</div>
   <hr id="HR3">
  <div class="MouseRightItem" id="Pros" ExeFunction="javascript:window.prompt('本页面路径属性' , '<%=Request.ServerVariables("SCRIPT_NAME")%>');">路径属性</div>
</div>
</body>
</html>
<%
Set RsClassObj = Nothing
Set Conn = Nothing
%>
<script language="JavaScript">
var ParentID='0';
var ClassID='0';
var DisableOrActiveMenuArray=new Array();
DisableOrActiveMenuArray[0]=Edit;
DisableOrActiveMenuArray[1]=Del;
DisableOrActiveMenuArray[2]=Cut;
parent.MoveOrCopySourceClass='';
parent.MoveOrCopySourceNews='';
parent.MoveOrCopyObjectClass='';
parent.MoveTF=true;
parent.OperationType='News';
Paste.className='MenuItemDisable';
DisableMenu(DisableOrActiveMenuArray);
function ClickClass(Obj)
{
	if ((Obj.ParentID==null)||(Obj.ClassID==null)) return;
	for (var i=0;i<document.all.length;i++) if (document.all(i).className=='TempletSelectItem') document.all(i).className='TempletItem';
	Obj.children(1).className='TempletSelectItem';
	ParentID=Obj.ParentID;
	ClassID=Obj.ClassID;
	Paste.className='MouseRightItem';
	ActiveMenu(DisableOrActiveMenuArray);
	if (ClassID=='0')
	{
		Cut.className='MenuItemDisable';
		Del.className='MenuItemDisable';
		Edit.className='MenuItemDisable';
		if (parent.MoveOrCopySourceNews!='') Paste.className='MenuItemDisable';
		else
		{
			if (parent.MoveOrCopySourceClass!='') Paste.className='MouseRightItem';
			else  Paste.className='MenuItemDisable';
		}
	}
	else
	{
		Cut.className='MouseRightItem';
		Del.className='MouseRightItem';
		Edit.className='MouseRightItem';
		if ((parent.MoveOrCopySourceClass!='')||(parent.MoveOrCopySourceNews!=''))	Paste.className='MouseRightItem';
		else Paste.className='MenuItemDisable';
	}
	parent.MoveOrCopyObjectClass=Obj.ClassID;
	parent.frames['OpreateWindow'].location='NewsList.asp?ClassID='+ClassID;
}

function DblClickClass(Obj)
{
	if (Obj.ChildClassShowTF=='true')
	{
		HideChildClass(ClassID);
		Obj.ChildClassShowTF='false';
		//if (Obj.id.toLowerCase()=='SysRootClass') Obj.children(0).children(0).src='../Images/Folder.gif';
		//else  Obj.children(0).children(1).src='../Images/Folder.gif';
	}
	else
	{
		ShowChildClass(ClassID);
		Obj.ChildClassShowTF='true';
		//if (Obj.id.toLowerCase()=='SysRootClass') Obj.children(0).children(0).src='../Images/FolderK.gif';
		//else  Obj.children(0).children(1).src='../Images/FolderK.gif';
	}
}

function HideChildClass(ID)
{
	var CurrObj=null;
	for (var i=0;i<document.all.length;i++)
	{
		CurrObj=document.all(i);
		if ((CurrObj.ParentID==ID)&&(CurrObj.id!='SysRootClass'))
		{
			if (CurrObj.parentElement.parentElement.parentElement.parentElement.tagName.toLowerCase()=='tr')
			{
				CurrObj.parentElement.parentElement.parentElement.parentElement.style.display='none';
				HideChildClass(CurrObj.ClassID);
			}
		}
	}
}

function ShowChildClass(ID)
{
	var CurrObj=null;
	for (var i=0;i<document.all.length;i++)
	{
		CurrObj=document.all(i);
		if ((CurrObj.ParentID==ID)&&(CurrObj.id!='SysRootClass'))
		{
			if (CurrObj.parentElement.parentElement.parentElement.parentElement.tagName.toLowerCase()=='tr')
			{
				CurrObj.parentElement.parentElement.parentElement.parentElement.style.display='';
				ShowChildClass(CurrObj.ClassID);
			}
		}
	}
}

function CutClass()
{
	parent.MoveTF=true;
	parent.MoveOrCopySourceClass=ClassID;
	parent.MoveOrCopySourceNews='';
	parent.OperationType='Class';
}

function CopyClass()
{
	parent.MoveTF=false;
	parent.MoveOrCopySourceClass=ClassID;
	parent.MoveOrCopySourceNews='';
	parent.OperationType='Class';
}

function PasteClass()
{
	var MoveOrCopyClassPara='OperationType:'+parent.OperationType+';MoveTF:'+parent.MoveTF+';SourceClass:'+parent.MoveOrCopySourceClass+';SourceNews:'+parent.MoveOrCopySourceNews+';ObjectClass:'+parent.MoveOrCopyObjectClass+';';
	OpenWindow('Frame.asp?FileName=MoveOrCopyNewsClass.asp&Titles=新闻栏目移动复制&MoveOrCopyClassPara='+MoveOrCopyClassPara,300,150,window);
}

function CheckParentClassTF(SourceID,ObjectID)
{
	alert(SourceID+','+ObjectID);
	var CurrObj=null,TempID='';
	if (ObjectID=='0') return true;
	for (var i=0;i<document.all.length;i++)
	{
		CurrObj=document.all(i);
		if (CurrObj.ParentID==SourceID) {TempID=CurrObj.ParentID;alert(CurrObj.ParentID);return false;}
	}
	if (TempID=='') return true;
	if (TempID!='0') return CheckParentClassTF(SourceID,TempID);
	else return true;
}

function MoveClass()
{
	alert(event.srcElement.ClassID);
	alert(event.toElement.classID)
}
</script>