<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FileList.aspx.cs" Inherits="KstCMS.KstCMS_Manager.WebContent.products.pro.FileList" %>
<%@Register TagPrefix="Webdiver" Namespace="Webdiver" Assembly="AspnetPager" %>

<html>
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function check() {
            var frm = document.forms[0];
            if (frm.txt_FileName.value == "") {
                alert("请输入文件标题!");
                frm.txt_FileName.focus();
                return false;
            }
            if (frm.txt_FilePath.value == "") {
                alert("请先上传文件!");
                return false;
            }
            return true;
        }

        function selectall() {

            var obj = document.getElementById("chxall");
            var chxobj = document.getElementsByTagName("input");

            for (var i = 0; i < chxobj.length; i++) {
                if (chxobj[i].type == "checkbox") {
                    if (obj.checked) {
                        chxobj[i].checked = true;
                    } else {
                        chxobj[i].checked = false;
                    }
                }
            }
        }

        function isSelectPro() {
            var obj = document.getElementById("chxall");
            var chxobj = document.getElementsByTagName("input");
            var SelectNum = 0;
            for (var i = 0; i < chxobj.length; i++) {
                if (chxobj[i].type == "checkbox") {
                    if (chxobj[i].checked) {
                        if (chxobj[i] != obj) {
                            SelectNum++;
                        }
                    }
                }
            }
            return SelectNum;
        }

        function checkdel() {
            if (isSelectPro() == 0) {
                alert("请先选择要删除操作的文件!");
                return false;
            }
            var msg = confirm('真的要删除所选文件吗？');
            return msg;
        }

        function updatesort() {
            if (isSelectPro() == 0) {
                alert("请先选择要更新操作的文件!");
                return false;
            }
            var msg = confirm('真的要更新吗？');
            return msg;
        }
    </script>
</head>
<body style="background-color:ButtonFace">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <div>
<table width="100%" border="0" cellspacing="1" cellpadding="4" style="background-color:ButtonFace; border-bottom:1px solid #cccccc">
  <tr>
    <td width="2%" nowrap="nowrap">文件标题</td>
    <td width="98%">
        <asp:TextBox ID="txt_FileName" runat="server" MaxLength="100"></asp:TextBox> 
        <asp:TextBox ID="txt_FilePath" Enabled="false" BackColor="ButtonFace" runat="server" MaxLength="200"></asp:TextBox>
        <input type="button" value="上传" onclick="OpenDialog('../../../Module/Upload/index.aspx?FromUpload=1&TextBoxId=txt_FilePath',400,150);" /> 
        <asp:Button ID="Button1" runat="server" Text="保存" OnClientClick="return check();" />
        </td>
  </tr>
</table>
        <asp:Panel ID="Panel1" runat="server">
       
<asp:Repeater ID="RepMain" runat="server">
       <HeaderTemplate>    
       <table width="100%" border="0" cellspacing="1" cellpadding="5" class="Table_Gray">
  <tr class="TableHeader">
    <td>选中</td>
    <td>排序</td>
    <td>文件标题</td>
    <td>大小(KB)</td>
    <td>上传时间</td>
  </tr>
  </HeaderTemplate>
  <ItemTemplate>
  <tr class="TableTd_Gray">
    <td align="center"><input type="checkbox" id="chxbox" name="chxbox" value="<%#DataBinder.Eval(Container.DataItem,"DownID") %>" /></td>
    <td align="center"><input type="text" class="input_text" name="SortNo_<%#DataBinder.Eval(Container.DataItem,"DownID") %>" value="<%#DataBinder.Eval(Container.DataItem,"SortNo") %>" /></td>
    <td align="center"><input type="text" class="input_text" name="FileName_<%#DataBinder.Eval(Container.DataItem,"DownID") %>" value="<%#DataBinder.Eval(Container.DataItem,"FileName") %>" /></td>
    <td align="center">
      <%#string.Format("{0:n}",(Convert.ToInt32(DataBinder.Eval(Container.DataItem,"FileSize").ToString())/1024).ToString()) %>
    </td>
    <td align="center">
       <%#string.Format("{0:d}",Convert.ToDateTime(DataBinder.Eval(Container.DataItem,"uTime").ToString())) %>
    </td>
  </tr>
  </ItemTemplate>
  <AlternatingItemTemplate>
    <tr class="TableTd_Gray1">
    <td align="center"><input type="checkbox" id="chxbox" name="chxbox" value="<%#DataBinder.Eval(Container.DataItem,"DownID") %>" /></td>
    <td align="center"><input type="text" class="input_text" name="SortNo_<%#DataBinder.Eval(Container.DataItem,"DownID") %>" value="<%#DataBinder.Eval(Container.DataItem,"SortNo") %>" /></td>
    <td align="center"><input type="text" class="input_text" name="FileName_<%#DataBinder.Eval(Container.DataItem,"DownID") %>" value="<%#DataBinder.Eval(Container.DataItem,"FileName") %>" /></td>
    <td align="center">
      <%#string.Format("{0:n}",(Convert.ToInt32(DataBinder.Eval(Container.DataItem,"FileSize").ToString())/1024).ToString()) %>
    </td>
    <td align="center">
       <%#string.Format("{0:d}",Convert.ToDateTime(DataBinder.Eval(Container.DataItem,"uTime").ToString())) %>
    </td>
  </tr>
  </AlternatingItemTemplate>
  <FooterTemplate>
</table>
</FooterTemplate>
   </asp:Repeater>   

 <br />
 <table width="100%" border="0" cellspacing="2" cellpadding="0" align="center"  class="PageBox">
  <tr>
    <td>
                   <input type="checkbox" id="chxall" name="chxall" onclick="selectall();" />
                   <asp:Button ID="btn_Del" runat="server" Text="删除" CssClass="uPageBtn" OnClientClick="return checkdel();" />
                   <asp:Button ID="btn_Sort" runat="server" Text="更新" CssClass="uPageBtn" OnClientClick="return updatesort();" />    <asp:Literal ID="PageInfo" runat="server"></asp:Literal>
    </td>
    <td>
    
<Webdiver:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="True" PageSize="10" DisabledButtonImageNameExtension="g" CpiButtonImageNameExtension="r" ButtonImageNameExtension="n" ImagePath="~/images" PagingButtonSpacing="0" CustomInfoSectionWidth="35%"  UrlPaging="false" NumericButtonTextFormatString="[{0}]" SubmitButtonText="GO" ShowInputBox="Always" ShowCustomInfoSection="left" HorizontalAlign="Right" OnPageChanged="AspNetPager1_PageChanged" Font-Size="10pt" SubmitButtonClass="uPageBtn" InputBoxClass="input_text" CssClass="uPage"> 
</Webdiver:AspNetPager>
    
    </td>
  </tr>
</table> 
 </asp:Panel>


    </div>
    </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
    <ProgressTemplate>正在处理中，请稍候...</ProgressTemplate>
    </asp:UpdateProgress>
    </form>
</body>
</html>
