<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Categories.aspx.cs" Inherits="Webdisk.Categories" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<%@ Register Src="Top.ascx" TagName="top" TagPrefix="uc1" %>
<%@ Register Src="bottom.ascx" TagName="bottom" TagPrefix="uc2" %>
<%@ Register TagPrefix="uc3" TagName="login" Src="login.ascx" %>

<%@ Import Namespace="Global" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link href="css/common.css" rel="stylesheet" type="text/css" />
    <link href="js/lib/pagination.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="js/lib/jquery.pagination.js" type="text/javascript"></script>
    <script src="js/Common.js" type="text/javascript"></script>

    <title></title>
</head>
<body>
    <form runat="server" id="form1">
        <div>
            <uc1:top ID="top" runat="server" />
        </div>
        <div class="content">
        <div class="cLeft2 mt30">
            <div class="block06">
                    <div class="title02">
                        <h4>文件分类</h4>
                    </div>
                    <dl class="flList">
                    <asp:Repeater ID="repeater3" runat="server" OnItemDataBound="repeater2_ItemDataBound">
                        <ItemTemplate>
                            <dt><a href="Categories.aspx?strCmd=root&kind=<%# DataBinder.Eval(Container.DataItem,"id") %>">
                                <%# DataBinder.Eval(Container.DataItem, "Kind") %></a></dt>
                            <span>
                                <dd>
                                    <asp:Repeater ID="repWZ" runat="server">
                                        <ItemTemplate>
                                            <a class="ml10" href="ShareMng.aspx?kind=<%# DataBinder.Eval(Container.DataItem,"id") %>">
                                                <%# DataBinder.Eval(Container.DataItem, "Kind") %></a>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                </dd>
                            </span>
                        </ItemTemplate>
                    </asp:Repeater>

                    ----------------------------------------------

                    <asp:Repeater ID="repeater2" runat="server" OnItemDataBound="repeater2_ItemDataBound">
                        <ItemTemplate>
                            <dt><a href="Categories.aspx?strCmd=root&kind=<%# DataBinder.Eval(Container.DataItem,"id") %>">
                                <%# DataBinder.Eval(Container.DataItem, "Kind") %></a></dt>
                            <span>
                                <dd>
                                    <asp:Repeater ID="repWZ" runat="server">
                                        <ItemTemplate>
                                            <a class="ml10" href="ShareMng.aspx?kind=<%# DataBinder.Eval(Container.DataItem,"id") %>">
                                                <%# DataBinder.Eval(Container.DataItem, "Kind") %></a>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                </dd>
                            </span>
                        </ItemTemplate>
                    </asp:Repeater>
                    </dl>
                </div>
            </div>
           <div class="cRight3 mt30">
                <ul style="width:900px;display:inline;">
                    <asp:Repeater ID="repeater1" runat="server" OnItemDataBound="repeater1_ItemDataBound">
                        <ItemTemplate>
                            <li style="width:900px;">
                                <p style="width:900px;">
                                    <strong style="width:80px;">
                                        <%# DataBinder.Eval(Container.DataItem, "Kind") %></strong>
                                        <br />
                                        <span style="width:600px;text-align:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <asp:Repeater ID="repWZ" runat="server">
                                                <ItemTemplate>
                                                    <a href="shareMng.aspx?kind=<%# DataBinder.Eval(Container.DataItem,"id") %>">
                                                        <%# DataBinder.Eval(Container.DataItem, "Kind") %></a>
                                                </ItemTemplate>
                                            </asp:Repeater>
                                        </span>
                                        <br />
                                </p>
                                <gl/>
                            </li>
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
                <div class="zyBlock2 mt10" style="float:center;">
                <div class="xsfs" style="float:none;">
                    显示方式：<a runat="server" id="sltBtn">缩略显示</a> | <a class="slt" runat="server" id="lbBtn">列表显示</a></div>
                    <input type="hidden" id="zykind" />
                    <div id="divlist" runat="server">
                    <table class="zyList" id="sharedg" width="100%" border="0" cellspacing="0" cellpadding="0" style="clear:both;">
                        <tr class="title" id="title"> 
                            <td align="center">
                                文件名
                            </td>
                            <td align="center">
                                教材版本
                            </td>
                            <td align="center">
                                文件类型
                            </td>
                            <td align="center">
                                文件格式
                            </td>
                            <td align="center">
                                文件备注
                            </td>
                        </tr>
                        <tr class="td1" id="item">
                            <td class="name" align="left">
                                <a id="filename">
                                    <img src="images/ico_01.png" /></a>
                            </td>
                            <td align="center" id="jcvar">
                            </td>
                            <td align="center" id="zyType">
                            </td>
                            <td align="center" id="fileext">
                            </td>
                            <td align="center" id="note">
                            </td>
                        </tr>
                    </table>
                    </div>
                    <div id="divSlt" runat="server">
                    <ul class="menuSlt" id="shareul">
                    <li id="items" style="text-align:center">
                        <table><tr><td width="220" height="80" align="center" id="pic"></td></tr></table><br/>
                        <a id="filenames" class="files get-file"></a><br />
                    </li>
                    </ul>
                    </div>
                    <br/>
                    <div id="Pagination" class="pageList" align="center" style="float:left;"><!-- 这里显示分页 --></div>
                </div>
               </div>
		        <div class="clear"></div>
            </div>
            <div>
                <uc2:bottom ID="bottom" runat="server" />
            </div>
    </form>
</body>
<script type="text/javascript">
    setHeadMenu(3);
    var strUrl=window.location.href.toString();
    function SetData(page_index) {
        $.getJSON('FileSpaceHandler.ashx?cmd=GetShareAllpathPage&kind=<% if(Request["kind"]!=null) Response.Write(Request["kind"].ToString()); %>&page=' + page_index+ '&rows='+<%=Session["username"]==null?10:Convert.ToInt32(Common.GetListCount(Session["username"].ToString())) %>+'<% if(Request["strCmd"]!=null)Response.Write("&strCmd="+Request["strCmd"]); %>', null, function (obj) {
            $("tr").eq(1).nextAll().remove();
            $("#shareul li").eq(0).nextAll().remove();
            for (var i = 0; i < obj.rows.length; i++) {
                var row = $("#item").clone(), rows = $("#items").clone();
                row.find("#filename").html("<img src=\"" + obj.rows[i].showPicFileext + "\" width=\"15px\" height=\"15px\"/>" + obj.rows[i].filename);
                rows.find("#pic").html("<img src=\"" + obj.rows[i].showPicFileext2 + "\" width=\"100px\" height=\"100px\"/>");
                rows.find("#filenames").html(obj.rows[i].filename);
                row.find("#jcvar").text(obj.rows[i].jcvar);
//                rows.find("#jcvars").text(obj.rows[i].jcvar);
                row.find("#zyType").text(obj.rows[i].zytype);
//                rows.find("#zyTypes").text(obj.rows[i].zytype);
                row.find("#fileext").text(obj.rows[i].fileext);
//                rows.find("#fileexts").text(obj.rows[i].fileext);
                row.find("#note").text(obj.rows[i].note);
//                rows.find("#notes").text(obj.rows[i].note);
                row.appendTo("#sharedg");
                rows.appendTo("#shareul");
            }
            $("tr").eq(0).next().remove();
            $("#shareul li").eq(0).remove();
        });
    }
    $(function () {
        $(window).resize(function () {
            $("#showDiv").height($(window).height() - 345);
        })
        setTimeout(function () {
            $("#showDiv").height($(window).height() - 345);
        }, 50);
        var init=function() {
            var num_entries = 0;
            //设置ajax请求为同步
            $.ajaxSetup({ async: false });
            $.getJSON('FileSpaceHandler.ashx?cmd=GetShareAllpathPage&kind=<%=Request["kind"]==null?"":Request["kind"].ToString() %><% if(Request["strCmd"]!=null)Response.Write("&strCmd="+Request["strCmd"]); %>', null, function (obj) {
                num_entries = obj.total;
            });
            $("#Pagination").pagination(num_entries, {
                prev_text: "上一页",
                next_text: "下一页",
                num_edge_entries: 1, //边缘页数
                num_display_entries: 4, //主体页数
                callback: pageselectCallback,
                items_per_page:<%=Session["username"]==null?10:Convert.ToInt32(Common.GetListCount(Session["username"].ToString())) %> //每页显示项数
            });
        }();
        if(strUrl.indexOf("?")>-1){
            if(strUrl.indexOf("showDataType")==-1) tempPara="&"+strUrl.substr(strUrl.indexOf("?")+1);
            else tempPara=strUrl.substr(strUrl.indexOf("?")+1);
        }
        else tempPara="";
        $("#lbBtn").attr("href", 'Categories.aspx?'+(tempPara.indexOf("showDataType")>-1?tempPara.replace(tempPara.substr(tempPara.indexOf("showDataType"),14),"showDataType=0"):'showDataType=0'+tempPara));
        $("#sltBtn").attr("href", 'Categories.aspx?'+(tempPara.indexOf("showDataType")>-1?tempPara.replace(tempPara.substr(tempPara.indexOf("showDataType"),14),"showDataType=1"):'showDataType=1'+tempPara));
        function pageselectCallback(page_index, jq) {
            SetData(page_index);
            return false;
        }
    });  
</script>
</html>
