<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ServerExplorer.aspx.cs"
    Inherits="TopWinCMS.WebUI.Admin.Explorer.ServerExplorer1" %>

<%@ Register Src="../UC_AjaxLoading.ascx" TagName="UC_AjaxLoading" TagPrefix="uc1" %>
<%@ Register Assembly="TopWinCMS.WebControls" Namespace="TopWinCMS.WebControls" TagPrefix="cc1" %>
<!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>
    <link type="text/css" href="../Style.css" rel="stylesheet" />

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

    <script language="javascript" type="text/javascript" src="../../Images/skysoft.js"></script>

    <script type="text/javascript" language="javascript">

        function FileSize(length)
        {
            var l;
            if (length < 1024)
            {
                l = length + " B";
            }
            else if (length < 1048576) //1048576=1024 * 1024
            {
                l = (length / 1024).toFixed(2) + " KB";
            }
            else
            {
                l = (length / 1048576).toFixed(2) + " MB";
            }
            document.write(l);
        }
    </script>

    <style type="text/css">
        .JvZhong
        {
            height: 120px;
            width: 400px;
            position: absolute;
            left: 232px;
            top: 108px;
            margin-right: auto;
            margin-bottom: auto;
            margin-left: auto;
            background-color: #FFFFCC;
            padding: 6px;
         
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
        <ProgressTemplate>
            <uc1:UC_AjaxLoading ID="UC_AjaxLoading1" runat="server" />
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div style="text-align: left">
                <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                    <tr>
                        <td style="width: 180px" valign="top">
                            <div style="overflow: scroll; width: 180px; height: 480px">
                                <asp:GridView ID="GV_Directory" runat="server" AutoGenerateColumns="False" CssClass="GridView"
                                    OnRowCommand="GV_Directory_RowCommand" Width="160px" GridLines="None">
                                    <Columns>
                                        <asp:TemplateField HeaderText="目录" ShowHeader="False">
                                            <ItemTemplate>
                                                <img onerror="this.src='../Images/FileICO/err.gif'" src="../Images/FileICO/folder.gif" />
                                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName="GoTo"
                                                    Text='<%# Eval("key") %>' CommandArgument='<%# Eval("value") %>'></asp:LinkButton>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <HeaderStyle CssClass="HeaderStyle" />
                                </asp:GridView>
                            </div>
                        </td>
                        <td valign="top">
                            <asp:GridView ID="GV_List" runat="server" AutoGenerateColumns="False" CssClass="GridView"
                                OnRowDeleting="GV_List_RowDeleting" AllowPaging="True" PageSize="20" OnRowCommand="GV_List_RowCommand"
                                DataKeyNames="FullName" AllowSorting="True" OnSorting="GV_List_Sorting" OnRowDataBound="GV_List_RowDataBound">
                                <HeaderStyle CssClass="HeaderStyle"></HeaderStyle>
                                <Columns>
                                    <asp:TemplateField HeaderText="名称">
                                        <ItemTemplate>
                                            <div style="float: left;">
                                                <img src="../Images/FileICO/<%# Eval("Extension").ToString().TrimStart('.') %>.gif"
                                                    onerror="this.src='../Images/FileICO/err.gif'" alt="" />
                                                <a href="FileEditor.aspx?dir=<%# Eval("FullName") %>" target="_blank">
                                                    <%# Eval("Name") %></a>
                                            </div>
                                            <div style="float: right;">
                                                <asp:Button ID="BT_CFile" runat="server" Text="解压" CommandName="CFile" CommandArgument='<%# Eval("FullName") %>'
                                                    CssClass="btn" Visible='<%# CFile(Eval("FullName"))%>' /></div>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="文件大小">
                                        <ItemTemplate> <%# TopWinCMS.Common.FileIO.FileSize((long)Eval("Length"))%>  </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Right" Width="80px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="下载">
                                        <ItemTemplate>
                                            <a href="DownloadFile.aspx?dir=<%# Eval("FullName") %>" target="_blank">
                                                <img src="../Images/FileICO/download.png" /></a>
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" Width="40px" />
                                    </asp:TemplateField>
                                    <asp:ButtonField CommandName="Move" HeaderText="移动/重命名" Text="移动/重命名">
                                        <ItemStyle HorizontalAlign="Center" Width="80px" />
                                    </asp:ButtonField>
                                    <asp:CommandField HeaderText="删除" ShowDeleteButton="True" DeleteImageUrl="../img/del.gif"
                                        DeleteText="" ButtonType="Image">
                                        <ItemStyle HorizontalAlign="Center" Width="34px" />
                                    </asp:CommandField>
                                    <asp:BoundField HeaderText="最后修改" DataField="LastWriteTime" DataFormatString="{0:yy-MM-dd HH:mm:ss}"
                                        HtmlEncode="False" SortExpression="LastWriteTime">
                                        <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    </asp:BoundField>
                                </Columns>
                                <PagerSettings Visible="False" />
                            </asp:GridView>
                            <cc1:PageNavigation ID="PageNavigation1" runat="server" OnPageChanging="PageNavigation1_PageChanging"
                                PageSize="20" Width="100%" SubmitButtonClass="btn">
                            </cc1:PageNavigation>
                        </td>
                    </tr>
                </table>
            </div>
            <div align="center" class="pagefield">
                路径：<asp:TextBox ID="TB_Dir" runat="server" Width="500px"></asp:TextBox>
                <asp:Button ID="BT_GoTo" runat="server" OnClick="BT_GoTo_Click" Text="转到" CssClass="btn" />
                
            </div>
            <asp:Panel ID="Panel1" runat="server" CssClass="JvZhong" Visible="False" Style="left: 256px;
                top: 175px">
               
                旧：
                <asp:TextBox ID="TB_OldFilePath" runat="server" Width="280px" ReadOnly="True"></asp:TextBox>
                <br /><br />
                新：
                <asp:TextBox ID="TB_FilePath" runat="server" Width="281px" ValidationGroup="Mid_File"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TB_FilePath"
                    ErrorMessage="请输入" ValidationGroup="Mid_File"></asp:RequiredFieldValidator><br /><br />
                <asp:Button ID="BT_OK" runat="server" EnableViewState="False" Text="修改" OnClick="BT_OK_Click"
                    ValidationGroup="Mid_File" CssClass="btn" /> 
                <asp:Button ID="BT_Cancel" runat="server" EnableViewState="False" OnClick="BT_Cancel_Click"
                    Text="取消" CssClass="btn" /> </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>
