<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="templatesgrid.aspx.cs"
    Inherits="FangPage.Admin.templatesgrid" %>

<%@ Register TagPrefix="cc1" Namespace="FangPage.Control" Assembly="FangPage.Control" %>
<!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 runat="server">
    <title>站点模板列表</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="styles/bmsmanager.css" type="text/css" rel="stylesheet">
    <link href="styles/datagrid.css" type="text/css" rel="stylesheet">

    <script type="text/javascript" src="js/commonshow.js"></script>

    <script type="text/javascript" src="js/menu.js"></script>
    
    <script type="text/javascript" src="js/common.js"></script>

    <script type="text/javascript">
	    function CreateTemplate(pathname)
	    {
	        if(confirm("您确定要编译" + pathname + "模板吗？\r\n\r\n当前操作可能要运行一段时间，在此期间不要进行其它操作。")) 
	        {
	            document.getElementById('success').style.display = 'block';
	            document.getElementById('Layer5').innerHTML='<BR /><table><tr><td valign=top><img border=0 src=images/ajax_loading.gif  /></td><td valign=middle style=font-size:14px;>正在编译'+pathname+'文件夹下的模板, <BR />请稍等...<BR /></td></tr></table><BR />';
	            window.location="?createtemplate=" + pathname;
	        }
	    }
	    
	    function DownloadTemplate(pathname)
	    {
	        if(confirm("您确定要下载" + pathname + "模板吗？\r\n\r\n当前操作可能要运行一段时间，在此期间不要进行其它操作。")) 
	        {
                window.location="?downloadtemplate=" + pathname;
            }
	    }
    </script>

</head>
<body leftmargin="5" topmargin="5" rightmargin="5" bottommargin="5">
    <form id="form1" runat="server">
    <div class="Navbutton" style="width: 98%;">
        <table cellspacing="1" cellpadding="4" align="left">
            <tr>
                <td>
                    <input title="选中/取消选中" onclick="CheckAll(this.form)" type="checkbox" name="chkall"
                        id="chkall" />全选
                    <cc1:Button ID="DelTemplates" runat="server" Text="删除模板" ButtonImgUrl="images/dell.gif"
                        OnClick="DelTemplates_Click" ScriptContent="document.getElementById('Layer5').innerHTML='<BR /><table><tr><td valign=top><img border=0 src=../images/ajax_loading.gif  /></td><td valign=middle style=font-size:14px;>正在删除选中模板, 请稍等...<BR /></td></tr></table><BR />';">
                    </cc1:Button>
                    <cc1:Button ID="DefaultTemplate" runat="server" Text="设为默认" 
                        ButtonImgUrl="images/actok.gif" onclick="DefaultTemplate_Click">
                    </cc1:Button>
                    <cc1:Button ID="BackupTemplate" runat="server" Text="备份模板" 
                        ButtonImgUrl="images/backuptemplates.gif" onclick="BackupTemplate_Click">
                    </cc1:Button>&nbsp;
                    <button class="ManagerButton" type="button" onclick="javascript:window.location.href='templatesnew.aspx';">
                        <img src="images/add.gif" />新建模板</button>
                </td>
            </tr>
        </table>
    </div>
    <cc1:DataGrid ID="DataGrid1" runat="server">
        <Columns>
            <asp:TemplateColumn HeaderText="选择">
                <ItemTemplate>
                    <input id="templateid" onclick="javascript:SH_SelectOne(this)" type="checkbox" value="<%# DataBinder.Eval(Container, "DataItem.templateid").ToString() %>"
                        name="templateid" />
                    <input type="hidden" name="temp<%# DataBinder.Eval(Container, "DataItem.templateid").ToString() %>"
                        value="<%# DataBinder.Eval(Container, "DataItem.templatepath").ToString() %>" />
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:BoundColumn DataField="templateid" Visible="false"></asp:BoundColumn>
            <asp:TemplateColumn HeaderText="模板名称">
                <ItemStyle HorizontalAlign="Left" />
                <ItemTemplate>
                    &nbsp;<span id="<%# DataBinder.Eval(Container, "DataItem.templatepath").ToString() %>"
                        onmouseover="showMenu(this.id, 0, 0, 1, 0);" style="font-weight: bold">
                        <%# DefaultStr(DataBinder.Eval(Container, "DataItem.aspxpath").ToString())%>&nbsp;
                        <a href="templatetree.aspx?path=<%# DataBinder.Eval(Container, "DataItem.templatepath").ToString() %>"><%# DataBinder.Eval(Container, "DataItem.name").ToString() %></a>
                    </span>
                    <div id="<%# DataBinder.Eval(Container, "DataItem.templatepath").ToString() %>_menu"
                        style="display: none">
                        <img src="../templates/<%# DataBinder.Eval(Container, "DataItem.templatepath").ToString() %>/about.jpg"
                            onerror="this.src='images/none.gif'" />
                    </div>
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:BoundColumn DataField="templatepath" HeaderText="模板路径"></asp:BoundColumn>
            <asp:BoundColumn DataField="copyright" HeaderText="模板版权"></asp:BoundColumn>
            <asp:BoundColumn DataField="author" HeaderText="作者"></asp:BoundColumn>
            <asp:BoundColumn DataField="createdate" HeaderText="创建日期"></asp:BoundColumn>
            <asp:BoundColumn DataField="forver" HeaderText="适用版本"></asp:BoundColumn>
            <asp:TemplateColumn HeaderText="状态">
                <ItemTemplate>
                    <%# StateStr(DataBinder.Eval(Container, "DataItem.state").ToString().Trim())%>
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:TemplateColumn HeaderText="操作">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# CreateStr(DataBinder.Eval(Container, "DataItem.templatepath").ToString(),DataBinder.Eval(Container, "DataItem.name").ToString(),DataBinder.Eval(Container, "DataItem.aspxpath").ToString())%>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateColumn>
        </Columns>
    </cc1:DataGrid>
    </form>
</body>
</html>
