<%@ Page Inherits="Caicai.Framework.UI.Admin.Manage" Table="C_User"   %>
<!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>
<title><%= Caicai.Framework.Common.Language.Get("C_User") %></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="style.css" rel="stylesheet" rev="stylesheet" media="all" />
<script type="text/javascript" src="../files/common/jquery.js"></script>
<script type="text/javascript" src="../files/xheditor/xheditor-zh-cn.min.js"></script>
<script type="text/javascript" src="include/xheditor.js"></script>
<script type="text/javascript" src="include/common.js"></script>
<script type="text/javascript">
$(function()
{
	var id = $().urlget("id");
	var action = $().urlget("action");
	if($("#C_User").length != 0)
	{
		$("#C_User a[href='?action=delete&id=1']").hide();

		if(action=="update" && id=="1")
		{
			$("#DDL_UserGroup").attr("readonly","true").attr("disabled","disabled");
			$("#CB_Lock").attr("disabled","disabled");
		}

		//点击管理后，请选择所在用户组
		$("#ButtonManage").click(function()
		{
			if($("#CB_IsAdmin").attr("checked"))
			{
				if ($("#DDL_UserGroup").val()=="0")
				{
					alert("请选择所在用户组！");
					
					$("#ButtonManage1").val($(this).val());
					$("#ButtonManage1").get(0).disabled = false;
					return false;
				} 
			}
		})

		$("#TB_Name").myValidator();
		$("#TB_UserName").myValidator();
		$("#TB_UserName").myIsData({table:"c_user",field:"username",info:"用户名已经被其他人占用！"});
		$("#TB_Email").myValidator({ismust:false,type:"email"});

		//添加用户是否参与管理
		$("#manage_UserGroup").hide();
		$("#CB_IsAdmin").click(function()
		{
			$("#manage_UserGroup").toggle();
		})
		
		if($("#CB_IsAdmin").attr("checked") && (action == "update" || action == "copy"))
		{
			$("#manage_UserGroup").show();
		}
	}
})
</script>
</head>
<body id="C_User">
<form id="form1" runat="server">
<table class="table subsubmenu">
	<thead>
	<tr>
		<td>
			<a href="?action=manage">&gt;&gt;&nbsp;<%= Caicai.Framework.Common.Language.Get("C_User") %></a>
			<a href="?action=insert"><%= Caicai.Framework.Common.Language.Get("InsertData") %></a>
			<a href="?action=import"><%= Caicai.Framework.Common.Language.Get("ImportData") %></a>
			<a href="?action=export"><%= Caicai.Framework.Common.Language.Get("ExportData") %></a>
		</td>
		
		<td style="text-align:right"><input type="text" name="1" title="name" id="searchtext" ><input class="search" type="button" value="<%= Caicai.Framework.Common.Language.Get("Search") %>"></td>
	</tr>
  </thead>
</table>

<asp:Panel ID="PanelDefault" runat="server">
<table class="table" style="margin-top:8px;">
<thead>
	<tr>
		
		<th width="40"><%= Caicai.Framework.Common.Language.Get("ID") %></th>
		
		<td width="80"><%= Caicai.Framework.Common.Language.Get("C_User_Name") %></td>
		
		<td><%= Caicai.Framework.Common.Language.Get("C_User_UserName") %></td>
		
		<td width="50"><%= Caicai.Framework.Common.Language.Get("C_User_IsAdmin") %></td>
		
		<td width="120"><%= Caicai.Framework.Common.Language.Get("InputDate") %></td>
		<td width="200"><%= Caicai.Framework.Common.Language.Get("Manage") %></td>
	</tr>
</thead>

<asp:Repeater ID="RepeaterDefault" runat="server">
<ItemTemplate>
	<tr>
		
		<th><%#Eval("ID")%></th>
		
		<td class="repeater_Name">
			<img src="images/ico_user.gif" /><strong><a href="?action=show&id=<%#Eval("id")%>"><%#Eval("Name")%></a></strong>
		</td>
		
		<td class="repeater_UserName">
			<%#Eval("UserName")%>
		</td>
		
		<td class="repeater_IsAdmin">
			<%# GetCheckBoxName(Eval("IsAdmin").ToString(), "True", "False")%>
		</td>
		
		<td><%#Eval("InputDate")%></td>
		<td class="manage">
			<a href="?action=show&id=<%#Eval("ID")%>" class="show"><%= Caicai.Framework.Common.Language.Get("Show") %></a>
			<a href="?action=update&id=<%#Eval("ID")%>" class="update"><%= Caicai.Framework.Common.Language.Get("Update") %></a>
			<a href="?action=copy&id=<%#Eval("ID")%>" class="copy"><%= Caicai.Framework.Common.Language.Get("Copy") %></a>
			<a href="?action=delete&id=<%#Eval("ID")%>" class="delete" title="<%= Caicai.Framework.Common.Language.Get("DataDeleteTitle") %>"><%= Caicai.Framework.Common.Language.Get("Delete") %></a>
		</td>
	</tr>
	
</ItemTemplate>
</asp:Repeater>

</table>
<table class="table">
<tr>
	<td class="page"><Caicai:CPageSql ID="PageDefault" runat="server" PageSize="15" /></td>
</tr>
</table>
<br />
</asp:Panel>

<asp:Panel ID="PanelManage" runat="server">
<table class="table" style="margin-top:8px;">
<thead>
<tr>
	<td colspan="2"><%= Caicai.Framework.Common.Language.Get("ManageData") %>&nbsp;<a href="#" class="helpall">[?]</a></td>
</tr>
</thead>

<tr id="manage_Name">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Name") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_Name", "note") %></span>
	<Cai:CTextBox ID="TB_Name" runat="server" ControlType="Default"  />
	</td>
</tr>

<tr id="manage_UserName">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_UserName") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_UserName", "note") %></span>
	<Cai:CTextBox ID="TB_UserName" runat="server" ControlType="Default"  />
	</td>
</tr>

<tr id="manage_PassWord">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_PassWord") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_PassWord", "note") %></span>
	<Cai:CTextBox ID="TB_PassWord" runat="server" ControlType="Password"  />
	</td>
</tr>

<tr id="manage_Sex">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Sex") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_Sex", "note") %></span>
	<Cai:CRadioButtonList ID="RBL_Sex" runat="server" ControlType="FileName" Name="files/appsettings/sex.xml" Where="" Order="" TextName="" ValueName=""  />
	</td>
</tr>

<tr id="manage_BirthDate">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_BirthDate") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_BirthDate", "note") %></span>
	<Cai:CTextBox ID="TB_BirthDate" runat="server" ControlType="Default"  />
	</td>
</tr>

<tr id="manage_Email">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Email") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_Email", "note") %></span>
	<Cai:CTextBox ID="TB_Email" runat="server" ControlType="Default"  />
	</td>
</tr>

<tr id="manage_Origin">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Origin") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_Origin", "note") %></span>
	<Cai:CTextBox ID="TB_Origin" runat="server" ControlType="Default"  />
	</td>
</tr>

<tr id="manage_Tel">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Tel") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_Tel", "note") %></span>
	<Cai:CTextBox ID="TB_Tel" runat="server" ControlType="Default"  />
	</td>
</tr>

<tr id="manage_Lock">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Lock") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_Lock", "note") %></span>
	<Cai:CCheckBox ID="CB_Lock" runat="server"  />
	</td>
</tr>

<tr id="manage_IsAdmin">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_IsAdmin") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_IsAdmin", "note") %></span>
	<Cai:CCheckBox ID="CB_IsAdmin" runat="server"  />
	</td>
</tr>

<tr id="manage_UserGroup">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_UserGroup") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_UserGroup", "note") %></span>
	<Cai:CDropDownList ID="DDL_UserGroup" runat="server" ControlType="TableName" Name="C_UserGroup" Where="" Order="ordernum desc, id desc" TextName="" ValueName=""   />
	</td>
</tr>

<tr id="manage_UserClass">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_UserClass") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("C_User_UserClass", "note") %></span>
	<Cai:CDropDownList ID="DDL_UserClass" runat="server" ControlType="TableName" Name="C_UserClass" Where="" Order="ordernum desc, id desc" TextName="" ValueName=""   />
	</td>
</tr>

<tr id="manage_InputDate">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("InputDate") %>&nbsp;<a href="#" class="help">[?]</a></th>
	<td>
	<span class="note"><%= Caicai.Framework.Common.Language.Get("InputDate", "note") %></span>
	<Cai:CTextBox ID="TB_InputDate" runat="server" ControlType="DateTime" /><a href="#" class="datetime"><%= Caicai.Framework.Common.Language.Get("NowDateTime") %></a>
	</td>
</tr>
<tr>
	<th>&nbsp;</th>
	<td><asp:Button ID="ButtonManage" runat="server" CssClass="button" onclick="Manage_Click" /><input type="reset" class="button" value='<%= Caicai.Framework.Common.Language.Get("Reset") %>' /></td>
</tr>
</table>
</asp:Panel>

<asp:Panel runat="server" ID="PanelShow">
<table class="table" style="margin-top:8px;">
<asp:Repeater ID="RepeaterShow" runat="server">
<ItemTemplate>
	<thead>
	<tr>
		<td colspan="2"><%= Caicai.Framework.Common.Language.Get("ShowData") %></td>
	</tr>
	</thead>
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("ID") %></th>
		<td><%# Eval("ID")%></td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Name") %></th>
		<td>
			<img src="images/ico_user.gif" /><strong><a href="?action=show&id=<%#Eval("id")%>"><%#Eval("Name")%></a></strong>
		</td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_UserName") %></th>
		<td>
			<%#Eval("UserName")%>
		</td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_PassWord") %></th>
		<td>
			<%#Eval("PassWord")%>
		</td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Sex") %></th>
		<td>
			<%# GetFileName("files/appsettings/sex.xml", Eval("Sex").ToString())%>
		</td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_BirthDate") %></th>
		<td>
			<%#Eval("BirthDate")%>
		</td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Email") %></th>
		<td>
			<%#Eval("Email")%>
		</td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Origin") %></th>
		<td>
			<%#Eval("Origin")%>
		</td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Tel") %></th>
		<td>
			<%#Eval("Tel")%>
		</td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_Lock") %></th>
		<td>
			<%# GetCheckBoxName(Eval("Lock").ToString(), "True", "False")%>
		</td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_IsAdmin") %></th>
		<td>
			<%# GetCheckBoxName(Eval("IsAdmin").ToString(), "True", "False")%>
		</td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_UserGroup") %></th>
		<td>
			<%# GetTableName("C_UserGroup", "", Eval("UserGroup").ToString())%>
		</td>
	</tr>
	
	<tr>
		<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("C_User_UserClass") %></th>
		<td>
			<%# GetTableName("C_UserClass", "", Eval("UserClass").ToString())%>
		</td>
	</tr>
	
	<tr>
		<th><%= Caicai.Framework.Common.Language.Get("InputDate") %></th>
		<td><%# Eval("InputDate")%></td>
	</tr>
</ItemTemplate>
</asp:Repeater>
<tr>
	<td>&nbsp;</td>
	<td colspan="2" class="manage"><a href="javascript:history.back()"><% =Caicai.Framework.Common.Language.Get("ReturnBack") %></a></td>
</tr>
</table>
</div>
</asp:Panel>

<asp:Panel runat="server" ID="PanelImport">
<table class="table" style="margin-top:8px;">
<thead>
<tr>
	<td colspan="2"><%= Caicai.Framework.Common.Language.Get("ImportData") %></td>
</tr>
</thead>
<tr class="noeffect">
	<th style="width:120px;"><%= Caicai.Framework.Common.Language.Get("Import") %></th>
	<td>
	<div class="faq"><img src="images/import.png" /><%= Caicai.Framework.Common.Language.Get("ImportData", "note") %></div>
	&nbsp;<asp:Button ID="DownExcel" runat="server" CssClass="button" onclick="DownExcel_Click" />
	<div style="display:none;">
	<div id="ImportFields">[Name] as <%= Caicai.Framework.Common.Language.Get("C_User_Name") %> ,[UserName] as <%= Caicai.Framework.Common.Language.Get("C_User_UserName") %> ,[PassWord] as <%= Caicai.Framework.Common.Language.Get("C_User_PassWord") %> ,[Sex] as <%= Caicai.Framework.Common.Language.Get("C_User_Sex") %> ,[BirthDate] as <%= Caicai.Framework.Common.Language.Get("C_User_BirthDate") %> ,[Email] as <%= Caicai.Framework.Common.Language.Get("C_User_Email") %> ,[Origin] as <%= Caicai.Framework.Common.Language.Get("C_User_Origin") %> ,[Tel] as <%= Caicai.Framework.Common.Language.Get("C_User_Tel") %> ,[Lock] as <%= Caicai.Framework.Common.Language.Get("C_User_Lock") %> ,[IsAdmin] as <%= Caicai.Framework.Common.Language.Get("C_User_IsAdmin") %> ,[UserGroup] as <%= Caicai.Framework.Common.Language.Get("C_User_UserGroup") %> ,[UserClass] as <%= Caicai.Framework.Common.Language.Get("C_User_UserClass") %> ,</div>
	<textarea ID="TB_ImportFields" name="TB_ImportFields"></textarea></div></td>
</tr>
<tr>
	<th style="width:120px;"></th>
	<td><asp:FileUpload ID="FileUploadImport" runat="server" style="width:60%;" /></td>
</tr>
<tr>
	<th>&nbsp;</th>
	<td>&nbsp;<asp:Button ID="ButtonImport" runat="server" CssClass="button" onclick="Import_Click" /></td>
</tr>
</table>
</asp:Panel>
<asp:Panel runat="server" ID="PanelExport">
<table class="table" style="margin-top:8px;">
<thead>
<tr>
	<td colspan="2"><%= Caicai.Framework.Common.Language.Get("ExportData") %></td>
</tr>
</thead>
</table>
<table class="table">
<tr class="noeffect">
	<td>
		<div class="faq"><img src="images/export.png" /><%= Caicai.Framework.Common.Language.Get("ExportData", "note") %></div>
	</td>
</tr>
<tr>
	<td id="FieldsAll" align="right">
	<input id="ID" type="checkbox" name="CB_Fields" checked="checked" /><label for="ID"><%= Caicai.Framework.Common.Language.Get("ID") %></label>
	
	<input id="Name" type="checkbox" name="CB_Fields" checked="checked" /><label for="Name"><%= Caicai.Framework.Common.Language.Get("C_User_Name") %></label>
	
	<input id="UserName" type="checkbox" name="CB_Fields" checked="checked" /><label for="UserName"><%= Caicai.Framework.Common.Language.Get("C_User_UserName") %></label>
	
	<input id="PassWord" type="checkbox" name="CB_Fields" checked="checked" /><label for="PassWord"><%= Caicai.Framework.Common.Language.Get("C_User_PassWord") %></label>
	
	<input id="Sex" type="checkbox" name="CB_Fields" checked="checked" /><label for="Sex"><%= Caicai.Framework.Common.Language.Get("C_User_Sex") %></label>
	
	<input id="BirthDate" type="checkbox" name="CB_Fields" checked="checked" /><label for="BirthDate"><%= Caicai.Framework.Common.Language.Get("C_User_BirthDate") %></label>
	
	<input id="Email" type="checkbox" name="CB_Fields" checked="checked" /><label for="Email"><%= Caicai.Framework.Common.Language.Get("C_User_Email") %></label>
	
	<input id="Origin" type="checkbox" name="CB_Fields" checked="checked" /><label for="Origin"><%= Caicai.Framework.Common.Language.Get("C_User_Origin") %></label>
	
	<input id="Tel" type="checkbox" name="CB_Fields" checked="checked" /><label for="Tel"><%= Caicai.Framework.Common.Language.Get("C_User_Tel") %></label>
	
	<input id="Lock" type="checkbox" name="CB_Fields" checked="checked" /><label for="Lock"><%= Caicai.Framework.Common.Language.Get("C_User_Lock") %></label>
	
	<input id="IsAdmin" type="checkbox" name="CB_Fields" checked="checked" /><label for="IsAdmin"><%= Caicai.Framework.Common.Language.Get("C_User_IsAdmin") %></label>
	
	<input id="UserGroup" type="checkbox" name="CB_Fields" checked="checked" /><label for="UserGroup"><%= Caicai.Framework.Common.Language.Get("C_User_UserGroup") %></label>
	
	<input id="UserClass" type="checkbox" name="CB_Fields" checked="checked" /><label for="UserClass"><%= Caicai.Framework.Common.Language.Get("C_User_UserClass") %></label>
	
	<input id="InputDate" type="checkbox" name="CB_Fields" checked="checked" /><label for="InputDate"><%= Caicai.Framework.Common.Language.Get("InputDate") %></label>
	</td>
</tr>
<tr align="right">
	<td>
		<div style="display:none;"><asp:TextBox ID="TB_Field" runat="server" /><asp:TextBox ID="checked_Fields" runat="server" width="80%">ID,Name,UserName,PassWord,Sex,BirthDate,Email,Origin,Tel,Lock,IsAdmin,UserGroup,UserClass,InputDate</asp:TextBox><asp:TextBox ID="TB_Fields" runat="server" width="80%"></asp:TextBox></div>
		<asp:TextBox ID="TB_Keyword" runat="server" />
		<select name="DDL_Fields" id="DDL_Fields">
		
		<option value="Name"><%= Caicai.Framework.Common.Language.Get("C_User_Name") %></option>
		
		<option value="UserName"><%= Caicai.Framework.Common.Language.Get("C_User_UserName") %></option>
		
		<option value="PassWord"><%= Caicai.Framework.Common.Language.Get("C_User_PassWord") %></option>
		
		<option value="Sex"><%= Caicai.Framework.Common.Language.Get("C_User_Sex") %></option>
		
		<option value="BirthDate"><%= Caicai.Framework.Common.Language.Get("C_User_BirthDate") %></option>
		
		<option value="Email"><%= Caicai.Framework.Common.Language.Get("C_User_Email") %></option>
		
		<option value="Origin"><%= Caicai.Framework.Common.Language.Get("C_User_Origin") %></option>
		
		<option value="Tel"><%= Caicai.Framework.Common.Language.Get("C_User_Tel") %></option>
		
		<option value="Lock"><%= Caicai.Framework.Common.Language.Get("C_User_Lock") %></option>
		
		<option value="IsAdmin"><%= Caicai.Framework.Common.Language.Get("C_User_IsAdmin") %></option>
		
		<option value="UserGroup"><%= Caicai.Framework.Common.Language.Get("C_User_UserGroup") %></option>
		
		<option value="UserClass"><%= Caicai.Framework.Common.Language.Get("C_User_UserClass") %></option>
		
		<option value="InputDate"><%= Caicai.Framework.Common.Language.Get("InputDate") %></option>
		</select>
		<asp:Button ID="ButtonSearch" runat="server" CssClass="button" onclick="Search_Click" /></td>
</tr>
<tr class="noeffect">
	<td class="gridview">
	<asp:GridView ID="GridViewDefault" runat="server"></asp:GridView>
	</td>
</tr>
</table>
<table class="table">
</tr>
<tr>
	<th>&nbsp;</th>
	<td><asp:Button ID="ButtonExport" runat="server" CssClass="button" onclick="Export_Click" /></td>
</tr>
</table>
</asp:Panel>
</form>
</body>
</html>