<%@ Page language="c#" Codebehind="Template.aspx.cs" AutoEventWireup="true" Inherits="XpShop.Manage.Template" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
	<HEAD>
	    <!--#include file="inc/head.inc"-->
		<title>Template</title>
	</HEAD>
	<body>
	    <div class="container">
		<div class="sub_container">
		<div class="sub_container_title"><a href="<%=AdminDefault%>" target="_top">桌面</a><img src="images/admin_title.jpg" height=9px width=8px align="absmiddle" />
		    <% if(this.Request.QueryString["Action"] == "Manage"){%>管理模板<%}if(this.Request.QueryString["Action"] == "Add" | this.Request.QueryString["Action"] == "Modify"){%>添加模板<%}%>
		</div>
		<div class="sub_container_content">
		<form id="Form1" method="post" runat="server">
		    <div class="frame">
		        <div class="frame_title"><asp:label id="lblAction" runat="server" CssClass="tableHeaderText"></asp:label></div>
		        <div class="frame_content">
		            <% if(this.Request.QueryString["Action"] == "Manage"){%>
		            <table class="tableBorder" cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
			            <tr>
				            <td class="forumRowHighlight" height="23"><asp:datagrid id="dgTemplate" runat="server" HeaderStyle-CssClass="summary-title" HorizontalAlign="Center"
						            Width="100%" DataKeyField="TemplateID" AutoGenerateColumns="False" PagerStyle-Mode="NumericPages" AllowPaging="False">
						            <HeaderStyle Font-Bold="True"></HeaderStyle>
						            <Columns>
							            <asp:TemplateColumn HeaderText="序号">
								            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Left" Width="30px"></ItemStyle>
								            <ItemTemplate>
									            <%# DataBinder.Eval(Container.DataItem, "TemplateID") %>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:TemplateColumn HeaderText="文件夹名称">
								            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Center" Width="100px"></ItemStyle>
								            <ItemTemplate>
									            <%# DataBinder.Eval(Container.DataItem, "Folder") %>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:TemplateColumn HeaderText="模板名称">
								            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Center"></ItemStyle>
								            <ItemTemplate>
									            <%# DataBinder.Eval(Container.DataItem, "Name") %>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:TemplateColumn HeaderText="是否当前模板">
								            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Center" Width="80px"></ItemStyle>
								            <ItemTemplate>
									            <%# IsCurrentTemplate(DataBinder.Eval(Container.DataItem, "Folder").ToString()) %>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:ButtonColumn ButtonType="LinkButton" Visible="False" ItemStyle-Width="30px" Text="预览" CommandName="Preview"></asp:ButtonColumn>
							            <asp:ButtonColumn ButtonType="LinkButton" ItemStyle-Width="30px" Text="选择" CommandName="Choose"></asp:ButtonColumn>
							            <asp:TemplateColumn>
								            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle>
								            <ItemTemplate>
									            <a href='Template.aspx?Action=Modify&TemplateID=<%# DataBinder.Eval(Container.DataItem, "TemplateID") %>'>
										            修改</a>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:ButtonColumn Text="&lt;div id=&quot;de&quot; onclick=&quot;javascript:return confirm('确认删除吗？')&quot;&gt;删除&lt;/div&gt;"
								            CommandName="Delete">
								            <ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle>
							            </asp:ButtonColumn>
						            </Columns>
						            <PagerStyle Mode="NumericPages"></PagerStyle>
					            </asp:datagrid></td>
			            </tr>
		            </table>
		            <%}if(this.Request.QueryString["Action"] == "Add" | this.Request.QueryString["Action"] == "Modify"){%>
		            <table class="tableBorder" cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
			            <tr>
				            <td height="23">
					            <table class="ptable" cellSpacing="0" cellPadding="0" align="center" border="0"
						            valign="top">
						            <tr>
							            <th class="tl">模板文件夹：</th>
						                <td class="tr">
						                    <asp:textbox id="txtFolder" runat="server"></asp:textbox>&nbsp;&nbsp;
						                    <asp:button id="btnGetTemInfo" OnClick="btnGetTemInfo_Click" runat="server" Text="获取模板信息" CausesValidation="False" CssClass="inputbtn"></asp:button>
						                </td>
						            </tr>
					            </table>
					            <div <%=IsTemplate%>>
						            <TABLE class="ptable" cellSpacing="0" cellPadding="0" align="center" border="0" valign="top">
							            <TR>
								            <th class="tl">模板名称：</th>
								            <td class="tr">
									            <asp:textbox id="txtTName" runat="server"></asp:textbox>
									            </TD>
							            </TR>
							            <TR>
								            <th class="tl">模板缩图：</th>
								            <TD class="tr">
									            <asp:image id="imgTemplateImage" runat="server" Width="150"></asp:image>
									            <br /><br /><asp:Label id="lblDescription" runat="server"></asp:Label>
									        </TD>
							            </TR>
							            <TR>
							                <th class="tl"></th>
								            <TD class="tr" align="center"><BR>
									            <asp:button id="btnSave" OnClick="btnSave_Click" runat="server" Text="保存" CssClass="inputbtn"></asp:button>
									            <asp:button id="btnCancel" OnClick="btnCancel_Click" runat="server" CausesValidation="False" Text="取消" CssClass="inputbtn"></asp:button></TD>
							            </TR>
						            </TABLE>
					            </div>
				            </td>
			            </tr>
		            </table>
		            <%}%>
		        </div>
	        </div>
		</form>
		</div>
		</div>
		</div>
	</body>
</HTML>
