<% Option Explicit %>
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Const.asp" -->
<%
	Dim DBC,Conn
	On Error Resume Next
	Set DBC = New DataBaseClass
	Set Conn = DBC.OpenConnection()
	Set DBC = Nothing
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P0302") then Call ReturnError()
Dim LableSql,RsLableObj,RsLblTypeObj,TypeID,LableID
TypeID=request("TypeID")
if TypeID<0 or TypeID="" then TypeID=0
LableSql = "Select * from Lable where Type="&TypeID
Set RsLableObj = Server.CreateObject("ADODB.recordset")
RSLableObj.open LableSql,conn,1,1

LableSql="Select * from LableType where ParentID="&TypeID
Set RsLblTypeObj = Server.CreateObject("ADODB.recordset")
RsLblTypeObj.open LableSql,conn,1,1
dim UPTypeObj,SQLStr,TempID
set UPTypeObj=Server.CreateObject("ADODB.recordset")
SQLStr="select * from LableType where ID ="&TypeID
UPTypeObj.open SQLStr,conn,1,1


%>
<!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 language="JavaScript" src="../JS/PublicJS.js"></script>
<body topmargin="0" leftmargin="0" onselectstart="return false;" oncontextmenu="SelectLable();showMenu(MouseRightMenu);return false;">
<table width="99%" border="0" onClick="SelectLable();" align="center" cellpadding="0" cellspacing="0">
  <tr>
  <td height="93" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="53%" height="20" class="ButtonList"> <div align="left">　名称</div></td>
          <td width="17%" height="20" class="ButtonList"> <div align="center">类型</div></td>
          <td width="30%" height="20" class="ButtonList"> <div align="center">描述</div></td>
        </tr>
        <%
if TypeID>0 then
%>
        <tr style="background:white;cursor:default;"> 
          <td colspan="3"><div align="left" color="#FFFFFF">
              <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><img src="../Images/arrow.gif" width="18" height="18"></td>
                  <td><span UPID="<% = UPTypeObj("ParentID") %>" title="上级分类" onDblClick="ChangeUp(this)">上级分类</span></td>
                </tr>
              </table>
              </div></td>
        </tr>
        <%
end if
do while not RsLblTypeObj.eof
%>
        <tr style="background:white;cursor:default;"> 
          <td height="22" ><table border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td><img src="../Images/Lable_Folder.gif" width="18" height="18"></td>
                <td><span TypeID="<% = RsLblTypeObj("ID")%>" title="双击进入此分类" onDblClick="ChangeLable(this)">
                  <% = RsLblTypeObj("TypeName")%>
                  </span></td>
              </tr>
            </table></td>
          <td><div align="center">标签分类</div></td>
          <td><div align="left">
              <% = RsLblTypeObj("Description")%>
            </div></td>
        </tr>
        <%
RsLblTypeObj.MoveNext
Loop
do while not RsLableObj.eof
%>
        <tr style="background:white;cursor:default;"> 
          <td height="21"><table border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td><img src="../Images/Lable_Lable.gif" width="18" height="18"></td>
                <td><span LableID="<%= RsLableObj("ID")%>"><% = RsLableObj("LableName")%></span></td>
              </tr>
            </table></td>
          <td><div align="center">标签</div></td>
          <td height="21"><div align="left"> 
              <% = RsLableObj("Description") %>
            </div></td>
        </tr>
        <%
	RsLableObj.MoveNext
loop
RsLableObj.Close
%>
      </table>
</td>
</tr>
</table>
</body>
</html>

<!-- 鼠标右键菜单 -->
	<div id=MouseRightMenu onclick="ClickMenu(this);" onmouseover="MouseOverRightMenu();" onmouseout="MouseOverRightMenu();" class="menu"> 
	<div class="MouseRightItem" id="AddType" ExeFunction="OpenWindow('Lable.asp?FileName=LableTypeAddNew.asp&BigTypeID='+BigTypeID,320,220,window);">新建类型</div>
    <div class="MouseRightItem" id="AddLable" ExeFunction="OpenWindow('Lable.asp?FileName=LableAddNew.asp&BigTypeID='+BigTypeID,580,450,window);">新建标签</div>
	<hr id="HR2">
	<div class="MouseRightItem" id="Edit" ExeFunction="EditLable()">修改</div>
	<div class="MouseRightItem" id="Del" ExeFunction="Delete()">删除</div>
	<div class="MouseRightItem" id="Back" ExeFunction="BackUpLable();">备份</div>
	<hr id="HR1">
	<div class="MouseRightItem" id="Refresh" ExeFunction="window.location.reload();">刷新</div>
	   <hr id="HR6">
	  <div class="MouseRightItem" id="Pros" ExeFunction="javascript:window.prompt('本页面路径属性' , '<%=Request.ServerVariables("SCRIPT_NAME")%>');">路径属性</div>
	</div>
	</body>
	</html>

<%
Set RsLableObj = Nothing
Set Conn = Nothing
%>
<script language="JavaScript">
var BigTypeID='<% = TypeID %>';
var UPID='';
var SelectLableID='';
var SelectTypeID='';
Edit.className='MenuItemDisable';
Del.className='MenuItemDisable';
Back.className='MenuItemDisable';
function SelectLable()
{
	var TRObj=event.srcElement;
	var i=0,j=0;
	for (j=0;j<document.all.length;j++)
	{
		if (document.all(j).className=='TempletSelectItem')
		{
			document.all(j).className='TempletItem';
		}
	}
	if (TRObj.UPID!=null)
	{
		UPID=TRObj.UPID
		TRObj.className='TempletSelectItem'
	}
	if (TRObj.LableID!=null||TRObj.TypeID!=null)
	{
		if (TRObj.LableID!=null)
		{
			TRObj.className='TempletSelectItem';
			SelectLableID=TRObj.LableID;
			SelectTypeID='';
		}
		if (TRObj.TypeID!=null)
		{
			TRObj.className='TempletSelectItem';
			SelectTypeID=TRObj.TypeID;
			SelectLableID='';
		}
	}
	else
	{
		SelectTypeID=''
		SelectLableID='';
	}
	if ((SelectLableID!='')||(SelectTypeID!=''))
	{
		Edit.className='MouseRightItem';
		Del.className='MouseRightItem';
	}
	else
	{
		Edit.className='MenuItemDisable';
		Del.className='MenuItemDisable';
	}
	if (SelectLableID!='')
	{
		Back.className='MouseRightItem'
	}
	else
	{
		Back.className='MenuItemDisable';
	}
}
function ChangeLable()
{
	location.href='Templet_LableList.asp?TypeID='+SelectTypeID;
}
function ChangeUp()
{
	
	location.href='Templet_LableList.asp?TypeID='+UPID;
}
function EditLable()
{
	if (SelectLableID!='')
	{
		OpenWindow('Lable.asp?FileName=LableAddNew.asp&ID='+SelectLableID,620,500,window);
	}
	if (SelectTypeID!='')
	{
		OpenWindow('Lable.asp?FileName=LableTypeAddNew.asp&ID='+SelectTypeID,320,180,window);
	}

}
function Delete()
{
	if (SelectLableID!='')
	{
		OpenWindow('Lable.asp?FileName=LableDel.asp&TableName=Lable&ID='+SelectLableID,190,110,window)
	}
	if (SelectTypeID!='')
	{
		OpenWindow('Lable.asp?FileName=LableTypeDel.asp&ID='+SelectTypeID,190,110,window)
	}
}
function BackUpLable()
{
	if (SelectLableID!='')
	{
		OpenWindow('LableBack.asp?FileName=Templet_LableBack.asp&LableID='+SelectLableID,190,110,window);
	}
}
</script>