<%@ Page CodeFileBaseClass="IlgharCMS.Lib.AdminPageBase" %>
<%@ Register TagPrefix="IlgharUC" TagName="Ime" Src="../../ime.dwt.ascx"%>
<%@ Register TagPrefix="IlgharUC" TagName="LanguageMenu" Src="../../language_menu.dwt.ascx"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- TemplateInfo codeOutsideHTMLIsLocked="true" -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>类别列表</title>
<ilghar:Comment><link rel="stylesheet" type="text/css" href="../../S01/CHS/css/common.css" /></ilghar:Comment>
<link rel="stylesheet" href="<%=CssPath%>common.css" />
<script type="text/javascript" src="<%=CommonPath%>ajax.js"></script>
<script type="text/javascript" src="<%=JsPath%>common.js"></script>
<script type="text/javascript" src="<%=JsPath%>move.js"></script>
<script type="text/javascript" src="<%=JsPath%>tree_handler.js"></script>
<ilgharUC:Ime Ime="true" Eot="true" runat="server" />
<script type="text/javascript">
var _action = null;
var _objectID,_objectID2;
function XmlHttpCallBack(xmlHttp)
{
	if (xmlHttp.status == 200)
	{
		if (_action == "Modify")
		{
			alert("修改成功！");
		}
		else if (_action == "Delete")
		{
			ClientDelete(_objectID);
			alert("删除成功！");
		}
		else if (_action == "Move")
		{
			if (ClientMove(_objectID, _objectID2, "<%=ImagePath%>"))
				alert("移动成功！");
		}
	}
	else
	{
		if (_action == "Modify")
			alert("修改失败！请查看日志！");
		else if (_action == "Delete")
			alert("删除失败！请查看日志！");
		else
			alert("失败！请查看日志！");
	}
	
	_action = null;
	_objectID = null;
	_objectID2 = null;
}

function OnSubmit(id,form)
{
	if (form.Name.value == "")
	{
		alert("名称不能空！");
		form.Name.select();
		return false;
	}
	
	_action = "Modify";
	_ajax.Post("<%=WebPath%>ilghar.aspx?Lang=<%=ContentLang%>&Object=ProductCategory&Operation=Modify&ID=" + id, "Name=" + encodeURIComponent(form.Name.value), XmlHttpCallBack);
	return false;
}

function OnDelete(id)
{
	if (!confirm("要删除此项吗？"))
		return;
	
	_objectID = id;
	_action = "Delete";
	_ajax.Post("<%=WebPath%>ilghar.aspx?Lang=<%=ContentLang%>&Object=ProductCategory&Operation=Delete&ID=" + id, null, XmlHttpCallBack);
}

function Move(fromID, toID)
{
	if (fromID == toID)
		return;
	
	_objectID = fromID;
	_objectID2 = toID;
	_action = "Move";
	_ajax.Post("<%=WebPath%>ilghar.aspx?Lang=<%=ContentLang%>&Object=ProductCategory&Operation=" + g_action + "&From=" + fromID + "&To=" + toID, null, XmlHttpCallBack);
}

function Kind_OnClick()
{
	var kind;
	var inputs = document.getElementsByTagName("INPUT");
	for (var i = 0; i < inputs.length; i++)
	{
		if (inputs[i].name == "Kind" && inputs[i].checked)
		{
			kind = inputs[i].value;
			break;
		}
	}
	window.location.href = HandleFake404("list.aspx?Kind=" + kind);
}
</script>
</head>
<body onload="InitMove(null,'Move',null, Move)">
<div class="WhiteHeader">
	<div class="Left"><img src="<%=ImagePath%>close_frame.gif" onclick="OpenCloseLeftFrame()" /></div>
	<div class="Title">类别列表</div>
	<div class="Right">
		<ilgharUC:LanguageMenu runat="server" />
		<img height="15" src="<%=ImagePath%>dropdown.gif" onmouseover="this.src='<%=ImagePath%>dropdown_over.gif';ShowLanguageMenu(this);" onmouseout="this.src='<%=ImagePath%>dropdown.gif'" />
		语言：<%=CurrentLanguage%>
	</div>
</div>
<div class="Block">
	<ul class="TabMenu">
		<li class="Left Selected"></li>
		<li class="Middle Selected">类别列表</li>
		<li class="Right Selected"></li>
		<li class="Left"></li>
		<li class="Middle"><a href="add.aspx?Lang=<%=ContentLang%>&amp;Kind=<%=Request.QueryString["Kind"]%>">添加类别</a></li>
		<li class="Right"></li>
	</ul>
	<ul class="Title">
		<li class="Left"></li>
		<li class="Middle"></li>
		<li class="Right"></li>
	</ul>
	<div class="ToolBar">
		<%If Request.QueryString["Kind"] == "AutoSite"%>
			<input type="radio" name="Kind" id="AutoSite" value="AutoSite" checked="checked" onclick="Kind_OnClick()" /><label for="AutoSite">智能建站</label>
		<%Else%>
			<input type="radio" name="Kind" id="AutoSite" value="AutoSite" onclick="Kind_OnClick()" /><label for="AutoSite">智能建站</label>
		<%EndIf%>
		<%If Request.QueryString["Kind"] == "Host"%>
			<input type="radio" name="Kind" id="Host" value="Host" checked="checked" onclick="Kind_OnClick()" /><label for="Host">虚拟主机</label>
		<%Else%>
			<input type="radio" name="Kind" id="Host" value="Host" onclick="Kind_OnClick()" /><label for="Host">虚拟主机</label>
		<%EndIf%>
		<%If Request.QueryString["Kind"] == "WebSite"%>
			<input type="radio" name="Kind" id="WebSite" value="WebSite" checked="checked" onclick="Kind_OnClick()" /><label for="WebSite">网站</label>
		<%Else%>
			<input type="radio" name="Kind" id="WebSite" value="WebSite" onclick="Kind_OnClick()" /><label for="WebSite">网站</label>
		<%EndIf%>
		<%If Request.QueryString["Kind"] == "Set"%>
			<input type="radio" name="Kind" id="Set" value="Set" checked="checked" onclick="Kind_OnClick()" /><label for="Set">套餐</label>
		<%Else%>
			<input type="radio" name="Kind" id="Set" value="Set" onclick="Kind_OnClick()" /><label for="Set">套餐</label>
		<%EndIf%>
		<%If String.IsNullOrEmpty(Request.QueryString["Kind"])%>
			<input type="radio" name="Kind" id="Other" value="" checked="checked" onclick="Kind_OnClick()" /><label for="Other">其他</label>
		<%Else%>
			<input type="radio" name="Kind" id="Other" value="" onclick="Kind_OnClick()" /><label for="Other">其他</label>
		<%EndIf%>
	</div>
	<table border="0" cellpadding="4" cellspacing="1" class="TreeTable">
		<thead>
			<tr>
				<th width="30">移动</th>
				<th>名称及层次</th>
				<th width="40">修改</th>
				<th width="40">编辑</th>
				<th width="40">删除</th>
			</tr>
		</thead>
		<tbody>
			<ilghar:Tree Object="ProductCategory" Condition="Kind=Request.QueryString['Kind']" Validate="True">
				<ilghar:Control>
					<ilghar:Space><span style="margin-left:20px"></span></ilghar:Space>
					<ilghar:Line><img src="<%=ImagePath%>tree/line.gif" /></ilghar:Line>
					<ilghar:TopOpen><img id="SH<%=InnerID%>" onclick="ShowAndHide('<%=InnerID%>')" src="<%=ImagePath%>tree/top_open.gif" class="ShowHide" /></ilghar:TopOpen>
					<ilghar:Top><img src="<%=ImagePath%>tree/top.gif" /></ilghar:Top>
					<ilghar:MiddleOpen><img id="SH<%=InnerID%>" onclick="ShowAndHide('<%=InnerID%>')" src="<%=ImagePath%>tree/middle_open.gif" class="ShowHide" /></ilghar:MiddleOpen>
					<ilghar:Middle><img src="<%=ImagePath%>tree/middle.gif" /></ilghar:Middle>
					<ilghar:BottomOpen><img id="SH<%=InnerID%>" onclick="ShowAndHide('<%=InnerID%>')" src="<%=ImagePath%>tree/bottom_open.gif" class="ShowHide" /></ilghar:BottomOpen>
					<ilghar:Bottom><img src="<%=ImagePath%>tree/bottom.gif" /></ilghar:Bottom>
				</ilghar:Control>
				<ilghar:Record>
					<tr id="Row<%=InnerID%>" ItemID="<%=InnerID%>" ParentID="<%=ParentInnerID%>">
						<form method="post" onsubmit="return OnSubmit('<%=InnerID%>',this)">
						<td><img onmouseover="this.className+=' Move_MouseOver';" onmouseout="this.className='Move';" name="<%=Name%>" sort="<%=InnerID%>" class="Move" src="<%=ImagePath%>move.gif" /></td>
						<th><span id="Control<%=InnerID%>"><%=Control%></span><input type="text" name="Name" value="<%=Name%>" class="<%=ContentLang%>Font"></th>
						<td><input type="image" src="<%=ImagePath%>modify.gif" /></td>
						<td><a href="edit.aspx?Lang=<%=ContentLang%>&amp;Kind=<%=Request.QueryString["Kind"]%>&amp;ID=<%=InnerID%>"><img src="<%=ImagePath%>edit.gif" /></a></td>
						<td><a href="javascript:OnDelete('<%=InnerID%>')"><img src="<%=ImagePath%>delete.gif" /></a></td>
						</form>
					</tr>
					<%=ChildRecords%>
				</ilghar:Record>
			</ilghar:Tree>
		</tbody>
	</table>
	<div class="Footer"></div>
</div>
<script type="text/javascript">
HandleFake404();
</script>
</body>
</html>