<%@ Page Title="文件管理" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="File_Mgr.aspx.cs" Inherits="Vote.Admin.File_Mgr" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<style>
.icons table img{ width:19px; height:19px}
.icons input[type="image"]{ width:16px; height:16px }
</style>

<div class="result-wrap">

<table width="100%">
 <tr valign="top">
 <td width="150px">
 
   <asp:TreeView
                ID="tvFolders" 
                runat="server"
                OnTreeNodePopulate="PopulateNode"
                OnSelectedNodeChanged="TvFolders_SelectedNodeChanged" 
                ExpandDepth="1" 
                ImageSet="Arrows"
                    >
                    <HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
                    <NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" 
                        HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />
                    <ParentNodeStyle Font-Bold="False" />
                    <SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" 
                        HorizontalPadding="0px" VerticalPadding="0px" />
             </asp:TreeView>  
                                          
 </td>
 
 <td style="  font-size:12px; font-family:Verdana">


 
     虚拟路径>> <asp:Label ID="lbl_currentpath"  ClientIDMode="Static"  runat="server" Text=""></asp:Label> (<b>主目录 <asp:Label ID="lb_root" runat="server" Text=""></asp:Label></b>)

     <div id="thetable" class="icons">
               <asp:GridView   style=" font-size:12px; font-family:Verdana"
                  AllowPaging="false"
                 BorderStyle="Solid" 
                 BorderWidth="1px"
                 BorderColor="#888888"    
                Width="650"
                ID="gvFolderItems" 
                runat="server"   
                 EmptyDataText="This folder is empty." 
                 GridLines="Both"   
                  OnRowDataBound="GvFolderItems_RowDataBound" 
                  OnRowCommand="GvFolderItems_RowCommand" 
                  AutoGenerateColumns="false" 
                  ShowHeaderWhenEmpty="true">
                                        <HeaderStyle HorizontalAlign="Left" />
                                        <Columns>
                                            <asp:TemplateField HeaderText="Name">
                                                <ItemTemplate> 
                                                    <asp:ImageButton 
                                                        ID="btnItemIcon" runat="server" 
                                                        ImageAlign="AbsMiddle" 
                                                        CommandArgument='<%# Eval("Name") %>' />
                                                    <asp:LinkButton 
                                                        ID="btnItemName" runat="server" 
                                                        Text='<%# Eval("Name") %>' 
                                                        CommandArgument='<%# Eval("Name") %>' 
                                                        Font-Underline="false" 
                                                        ForeColor="black" /> 


<asp:HiddenField ID="hf_isfolder" Value="1" runat="server" />
                                                </ItemTemplate> 
                                                
                                                   
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Size">
                                            <ItemStyle Width="100px" />
                                                <ItemTemplate>
                                                    <asp:Label ID="lblSize" runat="server" />                                                
                                                </ItemTemplate>
                                            </asp:TemplateField>


                        <asp:TemplateField HeaderText="Size">
                          <ItemStyle Width="100px" />
                        <HeaderTemplate>操作</HeaderTemplate>
                        <ItemTemplate>
                             
                   &nbsp;
                    <asp:ImageButton runat="server" ID="ib_edit" ImageUrl="img/edit.png" ToolTip='<%# Eval("Name") %>'  OnClientClick="Edit(this); return false;"  CommandArgument='<%# Eval("Name") %>'  CommandName="DeleteFile" /> 
                        
                                  &nbsp;&nbsp;
                           <asp:ImageButton runat="server" ID="ib_del" ImageUrl="img/del.jpg" OnClientClick="return confirm('确认要删除吗？');"  CommandArgument='<%# Eval("Name") %>'  CommandName="DeleteFolder" /> 
                                                                            
                        </ItemTemplate>
                    </asp:TemplateField>
                                       </Columns>


      <HeaderStyle BackColor="#E0E0E0" Font-Bold="True" HorizontalAlign="Center" />
    <AlternatingRowStyle BackColor="#F2F2F2" Height="25px" />
    <RowStyle Height="25px" />
     <PagerSettings Mode="NumericFirstLast" />   


                                    </asp:GridView>
                
             </div>   
 
 </td>
 </tr>

</table>

</div>




<script>

    String.prototype.endWith = function (s) {
        if (s == null || s == "" || this.length == 0 || s.length > this.length)
            return false;
        if (this.substring(this.length - s.length) == s)
            return true;
        else
            return false;
        return true;
    }


    function Edit(o) {
        var filename = $(o).attr("title");
        var path = $("#lbl_currentpath").html();
        if(path.endWith("/"))
        {
         window.open("File_Edit.aspx?f="+escape(path+filename));
        }
        else
        {
        window.open("File_Edit.aspx?f="+escape(path+"/"+filename));
        }

        
    
    }

</script>


</asp:Content>
