<%@ Page CodeBehind="record.aspx.cs" Language="c#" AutoEventWireup="True" Inherits="Webdisk.record" %>
<% @ Import Namespace="Webdisk" %>
<link href="<%=xml.GetStyle()%>" rel="stylesheet" type="text/css">
<script src="js/Common.js" type="text/javascript"></script>

<div class="menuBlock">
	<div class="menuHead" style="overflow:hidden;border-bottom: 1px dashed #cfcfcf;">
		<a id="but" class="floatR" onclick="getSearch();" href="javascript:void(0);">↓高级查找↓</a>
		<h2 style="font-size: 18px;color: #1EA7DF;"><img src="pics/drafts.gif" align="absMiddle"> 操作记录（仅记录他人有权限操作文件的记录）</h2>
	</div>
	<div id="search" class="clear search-con" style="DISPLAY: none;">
	<table class="form-table">
		<tr>
			<td class="label">用户名：</td>
			<td><input name="ActionUser" class="input3" id="ActionUser" value='<%if (Request["ActionUser"]!=null) Response.Write(Request["ActionUser"].ToString());%>'>
				（需精确输入，不填为不限）<input class="but1 " id="submit2" type="button" value=" 查 找 " name="submit22" ></td>
		</tr>
		<tr>
			<td class="label">行为：</td>
			<td><select name="ActionPostion" class="input4" id="ActionPostion">
			  <option value="" selected>全部</option>
			  <option value="上传文件">上传文件</option>
			  <option value="下载文件">下载文件</option>
			  <option value="新建目录">新建目录</option>
			  <option value="改名">改名</option>
			  <option value="修改注释">修改注释</option>
			  <option value="删除">删除</option>
			  <option value="复制">复制</option>
			  <option value="移动">移动</option>
			  <option value="压缩">压缩</option>
			  <option value="解压缩">解压缩</option>
			  <option value="设置共享">设置共享</option>
			  <option value="取消共享">取消共享</option>
			  <option value="设置提取码">设置提取码</option>
			  <option value="取消提取码">取消提取码</option>
			  <option value="转发文件">转发文件</option>
			  <option value="签收">签收</option>
		  </select></td>
		</tr>
		<tr>
		  <td  class="label">事件关键字：</td>
		  <td><input name="Action" class="input3" id="Action" value='<%if (Request["Action"]!=null) Response.Write(Request["Action"].ToString());%>'>
			（可模糊输文件名或目录名）</td>
		</tr>
		<tr>
			<td  class="label">操作时间：</td>
			<td><input name="ActionTime1" id="ActionTime1" value='<%if (Request["ActionTime1"]!=null) Response.Write(Request["ActionTime1"].ToString());%>' class="input4 dateinput">
				－ <input name="ActionTime2" id="ActionTime2" value='<%if (Request["ActionTime2"]!=null) Response.Write(Request["ActionTime2"].ToString());%>' class="input4 dateinput">（不填为不限）
				</td>
		</tr>
	</table>
</div>
	<div  class="menuBox2" style="border-top:none;">
            <div class="mListT">
                <span class="l7">行为</span> 
		        <span class="l5">事件</span>
                <span class="l3">操作时间</span>
                <span class="l3">操作人</span>
            </div>
            <div id="content"  style="">
			</div>
			<input id="type" type="hidden" runat="server"/>
			<input id="asc" type="hidden" runat="server"/>
			<input type="hidden" id="hiddenUser" value ='<%=Session["username"]==null?"":Session["username"].ToString() %>'/>
			<div class="pageList" id="page"> 
			</div>	</div>
		</div>
		<script>
        if ((getUrlParam('actionuser')!="") || (getUrlParam('actionpostion')!="") || (getUrlParam('actiontime1')!="") || (getUrlParam('actiontime2')!="") || (getUrlParam('action')!="")) document.getElementById("but").click();
        if (getUrlParam('actionpostion')!="") document.all.ActionPostion.value=getUrlParam('actionpostion');
		</script>
       <script type="text/javascript">
	   $.datepick.setDefaults({prevText:"上月",todayText :"今天",clearText:"清除",nextText:"下月",closeText:"关闭",dateFormat :"yyyy-mm-dd",dayNamesMin :["日","一","二","三","四","五","六"],
		monthNames:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]});
		$('.dateinput').datepick();
var Record = {};
Record.html = function(data) {
   $("#content").empty().append(data);
}
Record.iframeDialog = null;
Record.urlParam = {};
Record.dialogShow = function(href,title){
	var that = this ;
	var d = this.iframeDialog = dialog({
		content: "<iframe src='" +href + "' style='border:none;width:500px;height:350px;'></iframe>",
		title: title
	});
	d.showModal();
}

/**
*关闭模态窗口
*/
Record.closeWindow = function(flag){
	if(this.iframeDialog){
		this.iframeDialog.close().remove();
		this.iframeDialog = null ;
	}
}
/***
**刷新窗口 
***/
Record.refreshDialog = function(href ,title){
	this.iframeDialog.content( "<iframe src='" +href + "' style='border:none;width:500px;height:350px;'></iframe>");
	this.iframeDialog.title(title );
}
Record.autoClose = function(d){
	setTimeout(function(){
		d.close().remove();
	},2000);
}
Record.addEvent = function(){
	var that = this ;
	$("#submit2").click(function(){
		that.search();
	});
}
Record.page = function (currentPage) {
    var that = this;
    currentPage = currentPage ? currentPage : 0;
    var type = "", asc = "";
    type = $("#type").val();
    asc = $("#asc").val();
    function ajax(page, callback) {
        //var d = dialog();
        $.ajax({
            url: "recordList.aspx",
            data: { pageindex: page, type: type, asc: asc },
            cache: false,
            beforeSend: function () {
              //  d.showModal();
            },
            success: function (data) {
              //  d.close().remove();
                typeof callback == "function" && callback(data);
            }
        });
    }
    ajax(currentPage, function (data) {
        that.html(data);
        pageSize = $("#H_pagesize").val();
        var maxlength = parseInt($("#H_itemtCount").val());
        $("#page").pagination(maxlength, {
            prev_text: '< 上一页',
            next_text: '下一页 >',
            items_per_page: pageSize,
            num_display_entries: 5,
            current_page: 0,
            num_edge_entries: 2,
            link_to: "javascript:void(0);",
            callback: function (page_id, panel) {
                var self = this;
                ajax(page_id, function (vdata) {
                    self.maxentries = parseInt($("#H_itemtCount").val());
                    that.html(vdata);
                });
            }
        });
    })
}
Record.search = function (currentPage) {
	var that = this ;
   currentPage = currentPage ? currentPage : 0;
   var Action, type, asc, ActionPostion, ActionUser;
   Action = $("#Action").val();
   ActionUser = $("#ActionUser").val();
   type = getUrlParam("type");
   ActionPostion = $("#ActionPostion").val();
   asc = getUrlParam("asc");
   ActionTime1 = $("#ActionTime1").val();
   ActionTime2 = $("#ActionTime2").val();
	var d = dialog();
   function ajax(page, callback) {
	   $.ajax({
		   url: "recordList.aspx",
		   data: { pageindex: currentPage, Action: encodeURI(Action), ActionUser:encodeURI( ActionUser), ActionPostion: encodeURI(ActionPostion), ActionTime1: ActionTime1, ActionTime2: ActionTime2, type: type, asc: asc },
		   cache: false,
		   beforeSend: function () {
			   d.showModal();
		   },
		   success: function (data) {
			   d.close().remove();
			   typeof callback == "function" && callback(data);
		   }
	   });
   }
   ajax(currentPage, function (data) {
       that.html(data);
       var pageSize = $("#H_pagesize").val();
	   var maxlength = parseInt($("#H_itemtCount").val()); 
	   $("#page").pagination(maxlength, {
		   prev_text: '< 上一页',
		   next_text: '下一页 >',
		   items_per_page: pageSize,
		   num_display_entries: 5,
		   current_page: 0,
		   num_edge_entries: 2,
		   link_to: "javascript:void(0);",
		   callback: function (page_id, panel) {
			   var self = this;
			   ajax(page_id, function (vdata) {
				   that.html(vdata);
				   self.maxentries = parseInt($("#H_itemtCount").val());
			   });
		   }
	   });
   });
}
Record.init = function(){
	this.page();
	this.addEvent();
}
Record.init();
var refreshWindow = function(href,title){
	Record.refreshDialog(href ,title);
}
var closeWindow = function(flag){
	Record.closeWindow(flag);
}		   
function showly(tag){
	Record.dialogShow($(tag).data("href"),"查看用户信息");
}	   
function getSearch(){
	var tag = $('#search');
	var bTag = $("#but");
	if(bTag.text() == "↓高级查找↓"){
		bTag.text("↑高级查找↑");
		tag.slideDown(500);
	}else{
		bTag.text("↓高级查找↓");
		tag.slideUp(500);
	}
}
</script>
