<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="space_spacethemegrid.aspx.cs" Inherits="Discuz.ForumPage.Admin.spacethemegrid" %>
<%@ 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">
		<LINK href="../styles/dntmanager.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>
		<script type="text/javascript">
		function validate()
		{
			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("themename" + i).value == document.getElementById("themename" + 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 && document.getElementById("themename" + i).value == "")
				{
					Message("第" + i + "行的主题名称不能为空！");
					return false;
				}
				if(document.getElementById("id" + i).checked) break;
			}
			return true;
		}
		
		function Message(m)
		{
			document.getElementById("success").style.display = 'none';
			document.getElementById("SubmitButton").disabled = false;
			alert(m);
		}
		
		function isNaNEx(str)
		{
			return !(/^\d+$/.test(str));
		}
		
		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>
	<div id="view" style="border-color:#000000;z-index:100"></div>
		<form id="Form1" method="post" runat="server"><br>
		<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="Button1" runat="server" Text=" 删 除 " ButtonImgUrl="../images/del.gif"></cc1:Button>  &nbsp; 				
							</TD></TR></TBODY></TABLE>
		<cc1:datagrid id="themesgrid" runat="server" OnPageIndexChanged="DataGrid_PageIndexChanged" OnSortCommand="Sort_Grid" 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.themeid").ToString()%>"	name="id">
							<%# themesgrid.LoadSelectedCheckBox(DataBinder.Eval(Container, "DataItem.themeid").ToString())%>
						</ItemTemplate>
					</asp:TemplateColumn>
					<asp:BoundColumn DataField="themeID" HeaderText="图标id" Visible="false" ></asp:BoundColumn>
					<asp:BoundColumn DataField="type" SortExpression="type" HeaderText="" Visible="false"></asp:BoundColumn>
					<asp:BoundColumn DataField="name" SortExpression="name" HeaderText="主题名称" ><headerstyle width="20%"/><ItemStyle width="100px"/></asp:BoundColumn>
					<asp:BoundColumn DataField="directory" HeaderText="文件夹" readonly="true"><headerstyle width="20%"/><ItemStyle width="100px"/></asp:BoundColumn>
					<asp:BoundColumn DataField="author" SortExpression="author" HeaderText="作者"><headerstyle width="20%"/><ItemStyle width="100px"/></asp:BoundColumn>
					<asp:BoundColumn DataField="createdate" SortExpression="createdate" HeaderText="创建日期" readonly="true"><headerstyle width="40%"/><ItemStyle width="100px"/></asp:BoundColumn>
					<asp:BoundColumn DataField="copyright" SortExpression="copyright" HeaderText="版权"><headerstyle width="40%"/><ItemStyle width="200px"/></asp:BoundColumn>
					<asp:TemplateColumn HeaderText="预览图">
						<ItemTemplate>
							<span id="layer<%# DataBinder.Eval(Container, "DataItem.themeid").ToString()%>" onmouseover="showMenu(this.id, 0, 0, 1, 0);">预览</span>
							<div id="layer<%# DataBinder.Eval(Container, "DataItem.themeid").ToString()%>_menu" style="display:none">
							<img src="../../space/skins/themes/<%# DataBinder.Eval(Container, "DataItem.directory").ToString()%>/about.png" onerror="this.src='../../images/common/none.gif'" />
							</div>
						</ItemTemplate>
					</asp:TemplateColumn>			
				</Columns>
			</cc1:datagrid>
			
			
		&nbsp;&nbsp;<cc1:Button id="EditTheme" runat="server" Text=" 编辑提交 "></cc1:Button>  &nbsp;
		
		<br />
	<br />
	
	<table class="ntcplist" >
      <tr class="head">
        <td>&nbsp;&nbsp;增加现有主题</td>
      </tr>
      <tr>
        <td>
            <table class="datalist" cellspacing="0" rules="all" border="1" id="Table1" style="border-collapse:collapse;">
				<tr class="datagridHeader">
				  <td nowrap="nowrap"><input type="checkbox" name="cfile" onclick="checkFileList(this.form)"></td>
				  <td nowrap="nowrap">主题名称</td>
				  <td nowrap="nowrap">文件夹名称</td>
				  <td nowrap="nowrap">作者</td>
				  <td nowrap="nowrap">创建日期</td>
				  <td nowrap="nowrap">版权信息</td>
				  <td nowrap="nowrap">预览图</td>
				</tr>
				<asp:Literal ID="themeInfoList" Runat="server" />
			  </table>
		  </td>
      </tr>
    </TABLE>
    <br />
	&nbsp;&nbsp;<cc1:Button id="SubmitButton" runat="server" Text=" 提 交 " ValidateForm="true"></cc1:Button>		
	
		</form>
			
			<%=footer%>
	</body>
</HTML>
