<%@ 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>
<ilgharUC:Ime Ime="true" Eot="true" runat="server" />
<style type="text/css">
.Block TBODY TD{text-align:center}
</style>
<script type="text/javascript">
var _action = null;
var _objectID = null;
function XmlHttpCallBack(xmlHttp)
{
	if (xmlHttp.status == 200)
	{
		if (_action == "Modify")
		{
			alert("修改成功！");
		}
		else if (_action == "Delete")
		{
			var row = document.getElementById("Row" + _objectID);
			var table = row.parentNode.parentNode;
			table.deleteRow(row.rowIndex);
		
			alert("删除成功！");
		}
	}
	else
	{
		if (_action == "Modify")
			alert("修改失败！请查看日志！");
		else if (_action == "Delete")
			alert("删除失败！请查看日志！");
		else
			alert("失败！请查看日志！");
	}
	
	_action = null;
	_objectID = 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=Unit&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=Unit&Operation=Delete&ID=" + id + "&Transfer=" + encodeURIComponent(BuildAjaxPath()), null, XmlHttpCallBack);
}
</script>
</head>
<body>
<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%>">添加计量单位</a></li>
		<li class="Right"></li>
	</ul>
	<ul class="Title">
		<li class="Left"></li>
		<li class="Middle"></li>
		<li class="Right"></li>
	</ul>
	<table border="0" cellpadding="4" cellspacing="1">
		<thead>
			<tr>
				<th>名称</th>
				<th width="40">修改</th>
				<th width="40">编辑</th>
				<th width="40">删除</th>
			</tr>
		</thead>
		<tbody>
			<ilghar:List ID="List" Object="Unit" Validate="True">
				<ilghar:Record>
					<tr id="Row<%=InnerID%>">
						<form method="post" onsubmit="return OnSubmit('<%=InnerID%>',this)">
							<td><input type="text" name="Name" value="<%=Name%>" class="Text <%=ContentLang%>Font" /></td>
							<td width="40"><input type="image" src="<%=ImagePath%>modify.gif" /></td>
							<td width="40"><a href="edit.aspx?Lang=<%=ContentLang%>&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>
				</ilghar:Record>
			</ilghar:List>
		</tbody>
	</table>
	<div class="Footer"></div>
</div>
<script type="text/javascript">
HandleFake404();
</script>
</body>
</html>