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

<%@ Register TagPrefix="cc2" 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 id="Head1" 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/common.js"></script>

    <script language="javascript" type="text/javascript">
       function WinOpenDialog(url,width,height){
	        var ret=window.showModalDialog(url,"","dialogWidth:"+width+"px;status:no;status:no;dialogHeight:"+height+"px;scrollbars:no");
	        try
	        {
	            if(ret.filename!="")
	            {
	              window.location.reload(); 
	            }
	        }
	        catch(e){}
        }
        
        function Unzip(pathname)
	    {
	        if(confirm("您确定要解压此文件吗？\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;>正在解压文件, <BR />请稍等...<BR /></td></tr></table><BR />';
	            window.location="?path=<%=path %>&unzip=" + pathname;
	        }
	    }
        
        function DownloadTemplate(url)
	    { 
	        if(confirm("您确定要下载整个站点文件吗？\r\n\r\n当前操作可能要运行一段时间，在此期间不要进行其它操作。")) 
	        {
                window.location=url;
            }
	    }
	    
	    function Createtms(pathname)
	    {
	        if(confirm("您确定要打包站点吗？\r\n\r\n当前操作可能要运行一段时间，在此期间不要进行其它操作。")) 
	        {
                window.location=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">
            <tbody>
                <tr>
                    <td width="60">&nbsp;
                    <input title="选中/取消选中" onclick="CheckAll(this.form)" type="checkbox" name="chkall"
                            id="chkall" />全选
                    </td>
                    <td>
                        <cc2:Button ID="DeleteTemplateFile" runat="server" Text="删除文件" ButtonImgUrl="images/dell.gif"
                            OnClick="DeleteTemplateFile_Click"></cc2:Button>&nbsp;
                        <button class="ManagerButton" type="button" onclick="javascript:DownloadTemplate('systemfilesmanage.aspx?download=1');">
                            <img src="images/ico_down.gif" />下载整站
                        </button>&nbsp;
                        <button class="ManagerButton" type="button" onclick="javascript:Createtms('systemfilesmanage.aspx?pack=1');">
                            <img src="images/CreateWeb.gif" />打包站点
                        </button>&nbsp;
                        <button class="ManagerButton" type="button" onclick="javascript:window.location.href='<%=repath%>';">
                            <img src="images/back.gif" />返回上级
                        </button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <cc2:DataGrid ID="DataGrid1" runat="server">
        <Columns>
            <asp:TemplateColumn HeaderText="选择">
                <ItemTemplate>
                    <input id="fileid" onclick="javascript:SH_SelectOne(this)" type="checkbox" value="<%# DataBinder.Eval(Container, "DataItem.id").ToString() %>"
                        name="fileid" />
                    <input type="hidden" name="file<%# DataBinder.Eval(Container, "DataItem.id").ToString() %>"
                        value="<%# DataBinder.Eval(Container, "DataItem.name").ToString() %>" />
                    <input type="hidden" name="type<%# DataBinder.Eval(Container, "DataItem.id").ToString() %>"
                        value="<%# DataBinder.Eval(Container, "DataItem.type").ToString() %>" />
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:BoundColumn DataField="id" HeaderText="ID [递增]" Visible="false"></asp:BoundColumn>
            <asp:TemplateColumn HeaderText="文件名称" ItemStyle-HorizontalAlign="Left">
                <ItemTemplate>
                    <span><a <%# GetLinkStr(path,DataBinder.Eval(Container, "DataItem.type").ToString(),DataBinder.Eval(Container, "DataItem.name").ToString()) %>>
                        <img src="<%# GetFileTypeIco(DataBinder.Eval(Container, "DataItem.type").ToString())%>"
                            style="vertical-align: middle" border="0" />&nbsp;
                        <%# DataBinder.Eval(Container, "DataItem.name").ToString()%></a> </span>
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:BoundColumn DataField="size" HeaderText="文件大小"></asp:BoundColumn>
            <asp:BoundColumn DataField="updatetime" HeaderText="修改时间"></asp:BoundColumn>
            <asp:TemplateColumn HeaderText="操作" ItemStyle-HorizontalAlign="Left">
                <ItemTemplate>
                    <a href="#" onclick="WinOpenDialog('createdirectory.aspx?path=<%=path%>&type=<%# DataBinder.Eval(Container, "DataItem.type").ToString() %>&filename=<%# DataBinder.Eval(Container, "DataItem.name").ToString() %>','400','123')">
                        改名</a> |
                    <asp:Label ID="Label2" runat="server" Text='<%# CreateStr(DataBinder.Eval(Container, "DataItem.type").ToString(),DataBinder.Eval(Container, "DataItem.name").ToString())%>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateColumn>
        </Columns>
    </cc2:DataGrid>
    <br />
    <div class="ManagerForm">
        <fieldset>
            <legend style="background: url(images/icon32/NewWeb.gif) no-repeat 3px; padding-left:40px;">创建目录或文件</legend>
            <table class="datagridStyles" cellspacing="0" cellpadding="3" rules="rows" border="0"
                width="100%" id="smilesgrid">
                <tr>
                    <td height="40" width="200" align="right">
                        创建目录：&nbsp;&nbsp;
                    </td>
                    <td width="300">
                        <asp:TextBox ID="txtForderName" runat="server" Width="250"></asp:TextBox>
                    </td>
                    <td>
                        <cc2:Button ID="btnCreateFolder" runat="server" Text=" 创建目录" ButtonImgUrl="images/create_folder.gif"
                            OnClick="btnCreateFolder_Click"></cc2:Button>
                    </td>
                </tr>
                <tr>
                    <td height="40" width="200" align="right">
                        创建文件：&nbsp;&nbsp;
                    </td>
                    <td width="300">
                        <cc2:DropDownList ID="filetype" runat="server">
                        </cc2:DropDownList>
                    </td>
                    <td>
                        <cc2:Button ID="btnCreateFile" runat="server" Text=" 创建文件" ButtonImgUrl="images/file.gif"
                            OnClick="btnCreateFile_Click"></cc2:Button>
                    </td>
                </tr>
                <tr>
                    <td height="40" width="200" align="right">
                        上传文件：&nbsp;&nbsp;
                    </td>
                    <td width="300">
                        <asp:FileUpload ID="fileUpload" CssClass="uploadfile" runat="server" Width="253" />
                    </td>
                    <td>
                        <cc2:Button ID="btnUpLoadFile" runat="server" Text=" 上传文件" ButtonImgUrl="images/ico_up.gif"
                            OnClick="btnUpLoadFile_Click"></cc2:Button>
                        <asp:CheckBox ID="iszip" runat="server" Text="自动解压" />
                    </td>
                </tr>
            </table>
        </fieldset>
    </div>
    <br />
    </form>
</body>
</html>
