<%@ Page language="c#" Inherits="Discuz.ForumPage.Admin.forum_identifymanage" Codebehind="forum_identifymanage.aspx.cs" %>
<%@ Register TagPrefix="cc1" Namespace="Discuz.Control" Assembly="Discuz.Control" %>
<%@ Import NameSpace="Discuz.Common"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>论坛图标文件列表</title>		
	    <LINK href="../styles/datagrid.css" type="text/css" rel="stylesheet">
		<script language="javascript" src="../js/common.js"></script>
		<script language="javascript" src="../../editor/menu.js"></script>
		<script language="javascript" src="../../editor/common.js"></script>
		<link href="../styles/dntmanager.css" type="text/css" rel="stylesheet">  
		<script type="text/javascript">
		function validate()
		{
			var str = ",<%=ViewState["code"]%>";
			var count = 2;
			while(true)
			{
				if(	document.getElementById("id" + count) != null)
				{
					for(var i = count - 1; i >= 1; i--)
					{
						if(!document.getElementById("id" + i).checked) continue;
						if(!document.getElementById("id" + count).checked) continue;
						if(document.getElementById("name" + i).value == document.getElementById("name" + count).value)
						{
							Message("第" + i + "行的代码名称与第" + count + "行相同");
							return false;
						}
					}
					count++;
				}
				else
					break;
			}
			for(var i = 1;;i++)
			{
				if(document.getElementById("id" + i) == null)
				{
					Message("没有要提交的数据!");
					return false;
				}
				if(document.getElementById("id" + i).checked) break;
			}
			for(var i = 1;; i++)
			{
				if(document.getElementById("id" + i) == null)
					return true;
				else
				{
					if(document.getElementById("name" + i).value == "")
					{
						Message("第" + i + "行的代码名称为空！");
						document.getElementById("name" + i).focus();
						return;
					}
					if(document.getElementById("id" + i).checked)
					{
						if(str.indexOf("," + document.getElementById("name" + i).value + ",") >= 0)
						{
							Message("第" + i + "行的代码名称与原有的代码名称相同");
							return false;
						}
					}
				}
			}
		}
		
		function Message(m)
		{
			document.getElementById("success").style.display = 'none';
			document.getElementById("SubmitButton").disabled = false;
			alert(m);
		}
		
		function CheckSelect(form)
		{
			for (var i=0;i<form.elements.length;i++)
			{
				var e = form.elements[i];
				if (e.name != 'chkall' && e.name =='id')
				e.checked = form.chkall.checked;
			}
		}
		
		function checkFileList(form)
		{
			var i = 1;
			while(true)
			{
				if(form.elements["id" + i] == null)
					break;
				form.elements["id" + i].checked = form.cfile.checked;
				i++;
			}
		}
	</script>
</head>

	<body>
	<div id="append_parent"></div>
		<form id="Form1" method="post" runat="server">
		<table cellspacing="1" cellpadding="4" width="100%" align="center" class="table1" style="margin: 0px;">
				<TBODY>
					<tr>
						<td class="category"><input title="选中/取消选中 本页所有Case" onclick="CheckSelect(this.form)" type="checkbox" name="chkall" id="chkall">全选/取消全选 &nbsp; 
							<cc1:Button id="DelRec" runat="server" Text=" 删 除 " ButtonImgUrl="../images/del.gif"></cc1:Button>  &nbsp; 
								<button type="button" class="Managerbutton" onclick="javascript:window.location.href='forum_addidentify.aspx';"><img src="../images/add.gif" /> 添加鉴定</button></span>
				                <cc1:Button id="EditIdentify" runat="server" Text=" 编辑提交 "></cc1:Button>
							</TD></TR></TBODY></TABLE>
		<cc1:datagrid id="identifygrid" runat="server" OnPageIndexChanged="DataGrid_PageIndexChanged" IsFixConlumnControls="true" pagesize="10">
				<Columns>
				    <asp:TemplateColumn HeaderText="" Visible="true"><headerstyle width="10%"/><ItemStyle width="50px"/>
						<ItemTemplate>
							<INPUT id="id" onclick="javascript:SH_SelectOne(this)" type="checkbox" value="<%# DataBinder.Eval(Container, "DataItem.identifyid").ToString()%>"	name="id">
							<%# identifygrid.LoadSelectedCheckBox(DataBinder.Eval(Container, "DataItem.identifyid").ToString())%>
						</ItemTemplate>
					</asp:TemplateColumn>
					<asp:BoundColumn DataField="name" HeaderText="名称" ><HeaderStyle width="80%" HorizontalAlign="left" /><ItemStyle HorizontalAlign="left" /></asp:BoundColumn>
					<asp:TemplateColumn HeaderText="图片">
						<ItemTemplate>
                            <div id="layer<%# DataBinder.Eval(Container, "DataItem.identifyid").ToString()%>_a" onmouseover="showMenu(this.id,false)">
						        <%# PicStr(DataBinder.Eval(Container, "DataItem.filename").ToString(),20) %>
						    </div>
							<div id="layer<%# DataBinder.Eval(Container, "DataItem.identifyid").ToString()%>_a_menu" style="display:none">
							    <%# PicStr(DataBinder.Eval(Container, "DataItem.filename").ToString())%>
							</div>
							<asp:Label id=Label4 runat="server" Text=''>
							</asp:Label>
						</ItemTemplate>
					</asp:TemplateColumn>
			
				</Columns>
			</cc1:datagrid>
	<div class="ManagerForm">
    <fieldset>
	<legend style="background:url(../images/icons/icon49.jpg) no-repeat 6px 50%;">增加现有鉴定</legend>
		<table class="datalist" cellspacing="0" cellpadding="3" rules="rows" border="0" width="100%">
			<tr class="category">
			  <td width="8%"><input type="checkbox" name="cfile" onclick="checkFileList(this.form)"></td>
			  <td width="85%">名称</td>
			  <td width="7%">图片</td>
			</tr>
			<asp:Literal ID="fileinfoList" Runat="server" />
			<tr><td align="center" colspan="3"><br /><cc1:Button id="SubmitButton" runat="server" Text=" 提 交 " ValidateForm="true"></cc1:Button></td></tr>
		  </table>
    </fieldset>
    </div>
		</form>
			<%=footer%>
	</body>
</HTML>
