<%@ Register TagPrefix="uc1" TagName="Pager" Src="../../modules/Pager.ascx" %>
<%@ Page language="c#" Codebehind="menu.aspx.cs" AutoEventWireup="True" Inherits="health.aspx.sys.menu" %>

<HTML>
  <HEAD>
		<title>MenuList</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<LINK href="../../css/style.css" type="text/css" rel="stylesheet">
		<script language="JavaScript" src="../js/common.js" type="text/javascript"></script>
		<style>.sys_button1 { BORDER-RIGHT: #9595a9 1px solid; BORDER-TOP: #9595a9 1px solid; FONT-SIZE: 9pt; BACKGROUND: url(../../Image/sys/button_gray.jpg) fixed repeat-x center center; BORDER-LEFT: #9595a9 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #9595a9 1px solid; FONT-FAMILY: "宋体"; HEIGHT: 22px; TEXT-ALIGN: center }
	</style>
</HEAD>
	<body onload="bodyLoad();" MS_POSITIONING="GridLayout">
		<br>
		<form id="Form1" method="post" runat="server">			
			<TABLE  id="Table4"  width="95%" cellSpacing="0" cellPadding="0" align="center" border="0" >
				<TR>
					<TD align="center" >
						<TABLE class="sys_grid" id="Table5" cellSpacing="0" cellPadding="0" width="100%" border="0">
							<TR>
					            <TD class="sys_head_cell" align="left" ><IMG src="../../Image/search.gif" align="absMiddle">
						            <asp:label id="lblGroupName" runat="server" Font-Bold="True"></asp:label>
					            </TD>
					            <td class="sys_head_cell"></td>
				            </TR>		
							<TR>
								<TD class="sys_grid_cell_label" align="left" style="width: 460px"><asp:label id="lblMenu" runat="server">请选择主菜单:</asp:label>&nbsp;<asp:dropdownlist id="ddlApp" runat="server" Width="176px" AutoPostBack="True" onselectedindexchanged="ddlApp_SelectedIndexChanged"></asp:dropdownlist><INPUT id="hdnDgChanged" style="WIDTH: 30px; HEIGHT: 21px" type="hidden" value="0"
										name="hdnDgChanged" runat="server"></TD>							
								<TD class="sys_grid_cell_label" align="right" height="25"><asp:button id="btnSave" runat="server" Text="保 存" CssClass="sys_button" onclick="btnSave_Click"></asp:button>&nbsp;</TD>
							</TR>
						</TABLE>
	 				    <asp:datagrid id="dgrdRight" runat="server" Width="100%" AllowPaging="True" AutoGenerateColumns="False"	AllowSorting="True" CssClass="sys_grid">
								<ItemStyle Height="25px"></ItemStyle>
								<HeaderStyle Height="25px" CssClass="sys_grid_head_cell"></HeaderStyle>
								<Columns>
									<asp:TemplateColumn HeaderText="菜单">
										<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
										<ItemStyle HorizontalAlign="Left"></ItemStyle>
										<HeaderTemplate>
											<INPUT onclick="chkSelectAllClick(this);" type="checkbox">菜单
										</HeaderTemplate>
										<ItemTemplate>
											<INPUT onclick="chkSelectClick(this);" type="checkbox">
											<%# DataBinder.Eval(Container.DataItem, "MENU_NAME") %>
											<INPUT id="hdnChanged" style="WIDTH: 26px; HEIGHT: 18px" type="hidden" size="1" value="0"
												name="hdnChanged" runat="server">&nbsp;
										</ItemTemplate>
									</asp:TemplateColumn>
									<asp:TemplateColumn HeaderText="编辑">
										<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
										<ItemStyle HorizontalAlign="Center"></ItemStyle>
										<ItemTemplate>
											<asp:CheckBox id=chkIsModify runat="server" Checked='<%# DataBinder.Eval(Container.DataItem, "IF_MODIFY").ToString() == "1" ? true : false %>'>
											</asp:CheckBox>
										</ItemTemplate>
									</asp:TemplateColumn>
									<asp:TemplateColumn HeaderText="浏览">
										<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
										<ItemStyle HorizontalAlign="Center"></ItemStyle>
										<ItemTemplate>
											<asp:CheckBox id=chkIsQuery runat="server" Checked='<%# DataBinder.Eval(Container.DataItem, "IF_QUERY").ToString() == "1" ? true : false %>'>
											</asp:CheckBox>
										</ItemTemplate>
									</asp:TemplateColumn>
								</Columns>
								<PagerStyle Visible="False"></PagerStyle>
							</asp:datagrid><uc1:pager id="Pager1" runat="server"></uc1:pager>
					</TD>
				</TR>
			</TABLE>
		</form>
		<SCRIPT language="javascript">	
		var find,cancel,save;
		function bodyLoad()
		{
			var i,j;
			var myTable = document.getElementById("dgrdRight");
			for(i=1;i<myTable.rows.length;i++)
			{
				for(j=1;j<myTable.rows[i].cells.length;j++)
					myTable.rows[i].cells[j].children[0].onclick=chkClick;
				myTable.rows[i].cells[2].children[0].onclick=chkQueryClick;
			}
		}
		
		function chkClick()
		{
			var obj=event.srcElement;
			var tr=obj.parentElement.parentElement;
			tr.cells[0].children[1].value="1";
			Form1.hdnDgChanged.value="1";
			if(obj.checked)
				tr.cells[2].children[0].checked=true;
			else
				tr.cells[0].children[0].checked=false;	
		}
		
		function chkQueryClick()
		{
			var obj=event.srcElement;
			var tr=obj.parentElement.parentElement;
			tr.cells[0].children[1].value="1";
			Form1.hdnDgChanged.value="1";
			var i;
			if(!obj.checked)
			{
				for(i=0;i<tr.cells.length;i++)
					tr.cells[i].children[0].checked=false;
			}
		}	
			
		function chkSelectAllClick(obj)
		{
			var myTable = document.getElementById("dgrdRight");
			var i;
			for(i=1;i<myTable.rows.length;i++)
			{
				myTable.rows[i].cells[0].children[0].checked=!obj.checked;
				myTable.rows[i].cells[0].children[0].click();
			}
			Form1.hdnDgChanged.value="1";
		}
				
		function chkSelectClick(obj)
		{
			var tr=obj.parentElement.parentElement;
			var i;
			for(i=1;i<tr.cells.length;i++)
				tr.cells[i].children[0].checked=obj.checked;
			tr.cells[0].children[1].value="1";	
			Form1.hdnDgChanged.value="1";			
			
		}
		</SCRIPT>
	</body>
</HTML>
