<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="HL_Admin_Admin_ManageTemplate, WebApp_deploy" title="Untitled Page" enableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<script src="Js/Function.js" type="text/javascript"></script> 
<div style="width:98%;clear:both; margin:5px auto; height:20px;">
   <div style="float:left">当前目录：<asp:Literal ID="CurrentDir" runat="server" /></div>
   <div style="float:right"><asp:HyperLink ID="GoPrePage" runat="server" Text="返回上一级" /></div>
</div>

    <asp:GridView ID="GridView1" PageSize="20" runat="server" AutoGenerateColumns="False" CssClass="adminlist" AllowPaging="True"
        OnDataBound="GridView1_DataBound" EnableViewState="false">
        <Columns>
            <asp:TemplateField>
               <HeaderTemplate>
                  <input id="chkAll" onclick="SelectAllCheckboxes(this);" type="checkbox" />     
               </HeaderTemplate>
               <ItemTemplate>
                  <input type="checkbox" name="chkSelect"  value='<%# Server.UrlEncode(Eval("FileUrl").ToString()) %>' />
               </ItemTemplate>
               <HeaderStyle Width="5%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="名称">
               <ItemTemplate>
                  <%#Eval("Image")%>
                  <asp:HyperLink ID="name_url" runat="server" Text='<%# Eval("Name") %>' NavigateUrl='<%# Eval("FileUrl") %>' />
               </ItemTemplate>
               <ItemStyle HorizontalAlign="Left" />
            </asp:TemplateField>
            <asp:BoundField HeaderText="大小" DataField="Size" ItemStyle-HorizontalAlign="right">
                <HeaderStyle Width="60px" />
            </asp:BoundField>
            <asp:BoundField HeaderText="类型" DataField="Type">
                <HeaderStyle Width="60px" />
            </asp:BoundField>
            <asp:BoundField HeaderText="更新时间" DataField="UpdateTime">
                <HeaderStyle Width="130px" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="操作">
               <ItemTemplate>
                  <asp:LinkButton ID="CopyTemplate" Text="复制" runat="server" CommandName='<%#Eval("Name") %>' OnClientClick="return confirm('确定执行复制吗？');" CausesValidation="false" OnCommand="Copy_OnCommand"/>&nbsp;&nbsp;
                  <a href="javascript:void(0)" onclick="ReName('<%# Eval("Name") %>','<%# Eval("Type") %>')">重命名</a>&nbsp;&nbsp;
                  <asp:LinkButton ID="LinkButton1" Text="删除" runat="server" CommandArgument='<%# Server.UrlEncode(Eval("FileUrl").ToString()) %>' OnClientClick="return confirm('确定执行删除？')" CausesValidation="false" OnCommand="DeleteButton_Click"/>
               </ItemTemplate>
                <HeaderStyle Width="160px" />
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
           <div style="width:100%; height:50px; line-height:50px; text-align:center;">没任何数据!</div>
        </EmptyDataTemplate>       
    </asp:GridView>
    
 <div class="div_btm">
    <asp:Button ID="CreateTemplateButton" Text="新建模板" runat="server" OnClick="AddNewTemplateButton_Click"   CausesValidation="false" />&nbsp;
    <asp:Button ID="UploadTem" Text="上传模板" runat="server"  OnClientClick="javascript:document.getElementById('UploadTemplateDiv').style.display='block';return false;" />&nbsp;
    <asp:Button ID="DeleteButton" Text="删除模板" runat="server" OnClick="DeleteButton_Click" OnClientClick="return confirm('确定要删除所选中文件和文件吗？')" CausesValidation="false" />&nbsp;   
    <asp:Button runat="server" ID="CreateTem" Text="新建目录" OnClientClick="javascript:document.getElementById('CreateFolderDiv').style.display='block';return false;" />
 </div>
    
  <div id="CreateFolderDiv" class="FloatDivStyle" style="display:none;">
     <div  class="pageTitle">新建目录</div>  
     目录名：<asp:TextBox ID="AddFolder" runat="server" /><asp:RequiredFieldValidator ID="rfv1" runat="server" ControlToValidate="AddFolder" ErrorMessage="创建目录名不能为空" Display="Dynamic" /><br />
     <asp:Button ID="AddFolder_Button" Text="确定"  runat="server" OnClick="AddNewFolder_Click"/>&nbsp;<input type="button" value="取消"  onclick="javascript:document.getElementById('CreateFolderDiv').style.display='none'"/>
  </div>  
  <div id="UploadTemplateDiv" class="FloatDivStyle" style="display:none;">
     <div  class="pageTitle">上传模板</div>  
     上传模板名称：<asp:FileUpload ID="UploadTemplate" runat="server" /><br />
     <asp:Button ID="UploadTemButton" Text="确定"  runat="server"  OnClick="UploadTemplate_Click"  CausesValidation="false"/>&nbsp;<input type="button" value="取消"  onclick="javascript:document.getElementById('UploadTemplateDiv').style.display='none'"/>
     <br /><br /><div>只能上传的格式：<asp:Label ID="CanUpLoadType" Text="html、htm" runat="server" /></div>
     <asp:Label ID="CanNotUpLoadTypeMsg" Text="文件类型受限！" Visible="false" runat="server" />
  </div> 
  <div id="ReNameDdiv" class="FloatDivStyle" style="display:none;">
     <div  class="pageTitle">重命名：</div>  
     重命名文件：<asp:TextBox ID="ReNameText" runat="server" /><br />
     <asp:Button ID="ReNameButton" Text="确定" runat="server" OnClick="ReNameButton_Click" CausesValidation="false"/>&nbsp;<input type="button" value="取消"  onclick="javascript:document.getElementById('ReNameDdiv').style.display='none'"/>
  </div>
  
<script type="text/javascript">
    function ReName(ObjName,ObjType)
    {
        var showReNameObj=document.getElementById("ReNameDdiv");
        showReNameObj.style.display="block";
        var ReNameTextBoxObj=document.getElementById("ctl00_ContentPlaceHolder1_ReNameText");
        var hidenObj=document.getElementById("old_name");
        if(ReNameTextBoxObj!=null)
        {
            ReNameTextBoxObj.value=ObjName;
            hidenObj.value=ObjName;
        }
    }
</script>
<input type="hidden"  id="old_name" name="old_name" />


    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetDirectoryInfo"
        TypeName="FileIO">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="" Name="DriectoryName" QueryStringField="dir"
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    
</asp:Content>

