<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Admin.Master" AutoEventWireup="true" CodeBehind="FolderMgr.aspx.cs" Inherits="oa.admin.FolderMgr" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


    
      <style>
          #thediv {
           line-height:25px;
          }
        #thediv a {
         text-decoration:none; color:#808080;   
        }

         #thediv a:hover {
         text-decoration:none;  color:#808080;   
        }
    </style>

    
    
         <table width="100%" >
             <tr valign="top">
                 <td width="200px" >

                      


<div class="sidebar" id="sidebar">	
					 
	 
    
        
    
    <div id="thediv">
          
             <asp:TreeView runat="server" OnPreRender="tvFolders_PreRender"   
             
             ExpandDepth=1    ShowLines="true"   ID="TreeView1" >

                   <Nodes>
                   <asp:TreeNode Text="===总公司文档===" NavigateUrl="~/admin/foldermgr.aspx">
                      
                   </asp:TreeNode>
                      
               </Nodes>

            <SelectedNodeStyle Font-Bold="true" />
          </asp:TreeView>
    </div>
              
          
    </div>
                      



                 </td>

                 <td > 

                     <div style="margin:10px">


<div class="breadcrumb" style="height:50px;">
<div class="pull-left" style="margin-top:10px;">

      <ul class="breadcrumb1 fontbt">
        <asp:Literal runat="server" ID="lbl_currentpath"></asp:Literal>

   </ul>
      
</div>

                         <div class="pull-right" style="width:230px">

                               <div class="input-group">
   
                 <asp:TextBox runat="server" Width="180px" ID="txt_key"  CssClass="form-control"></asp:TextBox>
 
                   <span class="input-group-btn">
          <asp:Button ID="btn_search"  runat="server" Text="搜索"  class="btn btn-default"  />
      </span>
    </div> 

                         </div>

    </div>


            
              <div  class="alert alert-danger">


  在下面文档上，鼠标邮件可以对文档进行更新，删除等操作。

    
</div>         
         
          
          
       <asp:PlaceHolder runat="server" ID="pl_note">
           <div class="alert alert-danger">

               <asp:Label runat="server" ID="lbl_note"></asp:Label>
           </div>

       </asp:PlaceHolder>  
          
          
          
  




 <asp:Repeater runat="server" ID="rpt_list" 
   onitemdatabound="rpt_list_ItemDataBound" >
 <HeaderTemplate>

<table id="doclist" class="table table-hover table-bordered"> 
    <tr>
        <th width="30px">

        </th>
        <th  >
            文件名

        </th>
       

         <th width="80px">
            上传人
        </th>

         <th width="100px">
            上传时间
        </th>

         <th width="80px">
            点击
        </th>

    </tr>

 </HeaderTemplate>
 
 <ItemTemplate>
  <tr id="tr_<%#Eval("id") %>" data-id="<%#Eval("id") %>">
 <td>
 
   <img src="../images<%#FileIcon.GetIcon("."+Eval("ext")) %>" />                                        
     </td>
     <td>
     
         
    <a href="../doc/Binn.ashx?id=<%#Eval("id") %>&guid=<%#Eval("guid") %>&filename=<%#Eval("filename") %>" target="_blank"><%#Eval("filename")%></a>

    
</td>
 
   <td>
     <asp:Label ID="lblusername" runat="server"  />    
           
    </td>
  <td>
  <asp:Label ID="lbl_createdate" runat="server"  />  
  </td>
    
     <td> 
         <%#Eval("click") %>
     </td>
 </tr>
 
 
 </ItemTemplate>
 

     <FooterTemplate>
         
 </table>


     </FooterTemplate>
 
 </asp:Repeater>
 


 

 <div class="page-module page-doc-module">
<asp:Label ID="lbl_pagesize" runat="server" Text=""></asp:Label>
 
 </div>

 



  <asp:HiddenField runat="server" ID="hf_pagesize"  Value="15"  />


       </div>
 </td>

                 <td width="150px"  >





         <div style="border-left: 1px solid #cec8c8; min-height:400px; width:200px; padding-left:5px; margin-top:10px; line-height:40px;">
                          
 <asp:PlaceHolder runat="server" ID="pl_upload">
               <a href="#"  class="btn btn-primary btn-flat btn-sm"  onclick="openPop('UploadDoc.aspx?treeid=<%=_treeid %>'); return false;">上传新文件</a>  <br />

 </asp:PlaceHolder>
                                
 
           
                 <a href="#"  class="btn btn-default btn-flat btn-sm"  onclick="openPop('NewPage.aspx?t=quick&treeid=<%=_treeid %>&action=add'); return false;">新建文件夹</a> <br />
                       
 
 
         <a href="#"    class="btn btn-default btn-flat btn-sm"  onclick="openPop('NewPage.aspx?t=quick&treeid=<%=_treeid %>&action=edit'); return false;" >修改文件夹</a> <br />               
 

         <a href="#"   class="btn btn-default btn-flat btn-sm" onclick="openPop('NewPage.aspx?t=quick&treeid=<%=_treeid %>&action=del'); return false;">删除文件夹</a>     <br />           
  
                  <a href="#"  class="btn btn-default btn-flat btn-sm"  onclick="openPop('NewPage.aspx?t=quick&treeid=<%=_treeid %>&action=move'); return false;">移动文件夹</a> <br />
       


      
                         
                         
                         
                         
                         
                
                         
                         
                                    
                     </div>


                 </td>
             </tr>

         </table>





    <script>


        function showaction()
        {
            $("#div_op").toggle();
        }

    </script>


    

          <input type="hidden" id="hf_trid" value="0" />



    
     <ul class="dropdown-menu" id="contextMenu">
        
         <li>
         <a href="#"    onclick="upload();return false;">上传新文件</a>   

         </li>

         
           <li>
           <a href="#"  onclick="rename(); return false;"  >重命名文件</a>    
        </li>

           <li>
           <a href="#"  onclick="updateDoc(); return false;"  >更新文件</a>    
        </li>
        <li>
            <a href="#"  onclick="del(); return false;"  >删除</a>    
        </li>
      
  

    

     

               <li role="separator" class="divider"></li>


         


           <li>
            <a  href="#" onclick="viewLog(); return false;">查看历史版本</a>    
        </li>

          

                 
         

</ul>

   
  


    <script>

        layer.config({
            extend: 'extend/layer.ext.js'
        });

       

        function upload()
        {
            _theid = $("#hf_trid").val();
            openPop('UploadDoc.aspx?treeid='+_theid);
            $("#contextMenu").hide();
        }
        function updateDoc()
        {
            _theid = $("#hf_trid").val(); 
            openPop('UpdateDoc.aspx?id=' + _theid); 
            $("#contextMenu").hide();
             
        }




        function viewLog() {
            _theid = $("#hf_trid").val();
 
            openPop('Doc_ViewLog.aspx?id=' + _theid);

            $("#contextMenu").hide();

        }


        function viewNote() {
            _theid = $("#hf_trid").val();

            openPop('Doc_ViewNote.aspx?id=' + _theid);

            $("#contextMenu").hide();

        }


        


        function del() {

            _theid = $("#hf_trid").val();

            $.ajax({ cache: false, url: "ajax/doc_op.aspx?t=del&id=" + _theid });
            $("#contextMenu").hide();

            $("#tr_" + _theid).remove();

        }





        function rename()
        {
             

            _theid = $("#hf_trid").val();
            
            layer.prompt({
                title: '请输入新文件名，并确认（不含扩展名）',
                formType: 0 //prompt风格，支持0-2
            }, function (text) {
              
                $.ajax({ cache: false, url: "ajax/doc_op.aspx?t=rename&id=" + _theid + "&newname=" + escape(text) });
                $("#contextMenu").hide();
                layer.msg('更新成功',{ time: 2000   });


            });

 
           
        }

       








        //文档对象注册鼠标按下事件；
        $(document).on("mousedown", function (event) {
            //button等于0代表左键，button等于1代表中键
            if (event.button == 0 || event.button == 1) {

                if (event.target.nodeName.toLowerCase() == "a") {
                }
                else {
                    $("#contextMenu").hide();//获取菜单停止动画，进行隐藏使用淡出效果
                }
            }
        });




        //文档对象注册上下文（右键）菜单事件
        $("#doclist tbody tr").on("contextmenu", function (event) {
            var pageX = event.pageX;//鼠标单击的x坐标
            var pageY = event.pageY;//鼠标单击的y坐标
            $("#hf_trid").val($(this).attr("data-id"));

            //获取菜单
            var contextMenu = $("#contextMenu");

            var cssObj = {
                top: pageY + "px",//设置菜单离页面上边距离，top等效于y坐标
                left: pageX + "px"//设置菜单离页面左边距离，left等效于x坐标
            };

            //判断横向位置（pageX）+自定义菜单宽度之和，如果超过页面宽度及为溢出，需要特殊处理；
            var menuWidth = contextMenu.width();
            var pageWidth = $(document).width();
            if (pageX + contextMenu.width() > pageWidth) {
                cssObj.left = pageWidth - menuWidth - 5 + "px"; //-5是预留右边一点空隙，距离右边太紧不太美观；
            }

            //设置菜单的位置
            $("#contextMenu").css(cssObj).show();//显示使用淡入效果,比如不需要动画可以使用show()替换;

            event.preventDefault();//阻止浏览器与事件相关的默认行为；此处就是弹出右键菜单
        });







    </script>

</asp:Content>
