<html>
<head>
<title>Quarantine_Query</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--<base href="$$BASE_URL$$" />-->

<link href="css/trend-style-new.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="javascripts/localization.js"></script>
<script language="JavaScript" src="javascripts/trend-ui-new.js"></script>
<script language="JavaScript" src="javascripts/OLH_Mapping.js"></script>
<script language="JavaScript" src="javascripts/TmCube_Common.js"></script>
<script language="JavaScript" src="javascripts/TmCube_Tree.js"></script>
<script language="JavaScript" src="cgiDispatcher.exe?Page=administration/SystemDateTime.htm">
<!-- //src="cgiDispatcher.exe?Page=administration/SystemDateTime.htm" return 4 values: vSvrDate, vSvrDateFormat, vSvrTime, vSvrTimeFormat, vSvrTwoDigitYearMax. //-->
</script>

<script language="JavaScript" type="text/JavaScript">
var SP_VERSION = $$SHAREPOINT_VERSION$$;

function setOption(strDateFrom, strDateTo, strReason, strSortBy, strSortOrder, strNumPerPage, strAccount, strSite, strFileName)
{
    document.fmMain.txtDateFrom.value = strDateFrom;
	document.fmMain.txtDateTo.value = strDateTo;
	document.fmMain.optReason.value = strReason;
    document.fmMain.optSort.value = strSortBy;
    document.fmMain.optSortType.value = strSortOrder;
    document.fmMain.txtNumPerPage.value =  strNumPerPage;
    document.fmMain.txtSite.value = strSite;
    document.fmMain.txtAccount.value = strAccount;
    document.fmMain.txtFileName.value = strFileName;
    //  Target Page initialize to 1
    document.fmMain.txtTargetPage.value = 1;
}

function jsQuery()
{  
    parent.document.fmMain.btnSearch.disabled = true;
    if (document.fmMain.txtAccount.value != "ANYONE")
    {
        var valueArray = new Array;
        jsSeparateStringWithLen(document.fmMain.txtAccount.value, valueArray);
        
        var vList = document.getElementById("lstSelectedAccount");
        vList.innerHTML = "";
        for(var i=0; i<valueArray.length; i++)
        {
            setUIAddItemWithValue("\n", valueArray[i], vList);
        }
        setOption2Selected(document.getElementById("lstSelectedAccount"));
    }
    
    jsAddCSRFToken(document.fmMain);
    document.fmMain.submit();
}

function jsDelete() 
{
	var strFileNames="";
	var oTable=document.getElementById('tabQLoglist');
	var row=oTable.getElementsByTagName('tr');
	if(document.fmMain.chkItemId.length!=null)
	{
       for(var i=0;i<document.fmMain.chkItemId.length;i++)
	   {
	     if(document.fmMain.chkItemId[i].checked)
	     {
		    var strFileName;
		    if((document.fmMain.optReason.value=="Security risk scan") || (SP_VERSION >= 8 ))
			  strFileName = row[i+1].cells[2].firstChild.nextSibling.innerText;
		    else
			  strFileName = row[i+1].cells[2].firstChild.firstChild.innerText;
		    strFileNames+=strFileName;
		    strFileNames+=",";	
	     }
	    }
	}
	else
	{
	   if(document.fmMain.chkItemId.checked)
	   {
	     if((document.fmMain.optReason.value=="Security risk scan") || (SP_VERSION >= 8 ))
			 strFileNames = row[1].cells[2].firstChild.nextSibling.innerText;
		 else
			  strFileNames = row[1].cells[2].firstChild.firstChild.innerText;
	   }
	}
	strFileNames = strFileNames.substr(0,strFileNames.length-1);
	document.fmMain.txtRecordName.value = strFileNames;
	setOption2Selected(document.getElementById("lstSelectedAccount")); //fix case 464
	if (document.getElementById("cmdDelItem").disabled) return;
	if (!window.confirm(STR_ALR_WARN_DELETE_FILES)) return;
	setUIFunctionLink(false, "cmdDelItem");
	setUIFunctionLink(false, "cmdDelItem2");
	setUIFunctionLink(false, "cmdRestore");
	setUIFunctionLink(false, "cmdRestore2");
  document.fmMain.FormAction.value = "$$DELETE_CMD_FORM_ACTION$$";
	jsAddCSRFToken(document.fmMain);
    document.fmMain.submit();
}

function jsRestore()
{
    var strFileNames="";
	var oTable=document.getElementById('tabQLoglist');
	var row=oTable.getElementsByTagName('tr');
	if(document.fmMain.chkItemId.length!=null)
	{
       for(var i=0;i<document.fmMain.chkItemId.length;i++)
	   {
	     if(document.fmMain.chkItemId[i].checked)
	     {
		    var strFileName;
		    if((document.fmMain.optReason.value=="Security risk scan") || (SP_VERSION >= 8 ))
			  strFileName = row[i+1].cells[2].firstChild.nextSibling.innerText;
		    else
			  strFileName = row[i+1].cells[2].firstChild.firstChild.innerText;
		    strFileNames+=strFileName;
		    strFileNames+=",";	
	     }
	    }
	}
	else
	{
	   if(document.fmMain.chkItemId.checked)
	   {
	     if((document.fmMain.optReason.value=="Security risk scan") || (SP_VERSION >= 8 ))
			 strFileNames = row[1].cells[2].firstChild.nextSibling.innerText;
		 else
			  strFileNames = row[1].cells[2].firstChild.firstChild.innerText;
	   }
	}
	strFileNames = strFileNames.substr(0,strFileNames.length-1);
	document.fmMain.txtRecordName.value = strFileNames;
	setOption2Selected(document.getElementById("lstSelectedAccount"));  //fix case 464
	if (document.getElementById("cmdRestore").disabled) return;
	setUIFunctionLink(false, "cmdRestore");
	setUIFunctionLink(false, "cmdRestore2");
	setUIFunctionLink(false, "cmdDelItem");
	setUIFunctionLink(false, "cmdDelItem2");
	document.fmMain.FormAction.value = "$$RESTORE_CMD_FORM_ACTION$$";
	jsAddCSRFToken(document.fmMain);
    document.fmMain.submit();
}

function jsDownload(itemId, siteId, webId, dirName, fileName, fileSize)
{
	document.fmDownload.browserType.value = TmCube_getBrowserType();
    document.fmDownload.downloadSiteId.value = siteId;
    document.fmDownload.downloadItemId.value = itemId;
    document.fmDownload.downloadWebId.value = webId;
    document.fmDownload.downloadDirName.value = dirName;
    document.fmDownload.downloadLeafName.value = fileName;
    document.fmDownload.downloadFileSize.value = fileSize;
    document.fmDownload.target = "ifmDownload";
    jsAddCSRFToken(document.fmDownload);
	document.fmDownload.submit();
}

function jsInitPage()
{
    var vReason     = "";
    var vSort        = 0;
    var vSortType    = 0;
    var vNumPerPage  = 15;
    var vTargetPage  = 0;
    var vViolator    = 0;
    var vRecCount    = 0;
    var vPageCount   = 0;
    var vCurrentPage = 0;

   	if (document.fmMain.txtDateFrom.value	!= "") { vDateFrom	= new Date(document.fmMain.txtDateFrom.value); }
	if (document.fmMain.txtDateTo.value		!= "") { vDateTo	= new Date(document.fmMain.txtDateTo.value); }
	if (document.fmMain.optReason.value		!= "") 
     { 
         vReason	= document.fmMain.optReason.value; 
        document.getElementById("searchreason").innerHTML= "Quarantined results from ";
     }
	if (document.fmMain.optSort.value		!= "") { vSort        = document.fmMain.optSort.value; }
	if (document.fmMain.optSortType.value	!= "") { vSortType    = document.fmMain.optSortType.value; }
	if (document.fmMain.txtNumPerPage.value	!= "") { vNumPerPage  = document.fmMain.txtNumPerPage.value; }
	if (document.fmMain.txtTargetPage.value	!= "") { vTargetPage  = document.fmMain.txtTargetPage.value; }
	if (document.fmMain.txtRecCount.value	!= "") { vRecCount    = document.fmMain.txtRecCount.value; }
	if (document.fmMain.txtPageCount.value	!= "") { vPageCount   = document.fmMain.txtPageCount.value; }
	if (document.fmMain.txtCurrentPage.value	!= "") { vCurrentPage = document.fmMain.txtCurrentPage.value; }

    if (document.fmMain.txtRecCount.value != "") {
	    if(document.fmMain.txtRecCount.value > 0) {
	        var tmpRecCount = document.fmMain.txtRecCount.value;
	        var tmpNumPerPage = document.fmMain.txtNumPerPage.value;
	        var vTotalPage = (tmpRecCount%tmpNumPerPage>0)?(parseInt(tmpRecCount/tmpNumPerPage)+1):(tmpRecCount/tmpNumPerPage);
	        document.getElementById("labTotalPage").innerText = vTotalPage;
	        document.getElementById("labTotalPage2").innerText = vTotalPage;
	     }
	    else{
	        document.getElementById("labTotalPage").innerText = 0;
	        document.getElementById("labTotalPage2").innerText = 0;
	    }
	}
   
   if (vCurrentPage != "" && vNumPerPage != "" && vRecCount != "") {
		var iRecCount = parseInt(vRecCount);
		if (iRecCount > 0) {
			var iBeginRec = parseInt(vNumPerPage) * (parseInt(vCurrentPage) - 1) + 1;
			var iEndRec   = parseInt(vNumPerPage) * (parseInt(vCurrentPage));
			if (iBeginRec > iRecCount) {iBeginRec = iRecCount;}
			if (iEndRec > iRecCount) {iEndRec = iRecCount;}
			document.getElementById("labRecordRange").innerText = iBeginRec.toString() + "-" + iEndRec.toString();
			document.getElementById("labRecordRange2").innerText = iBeginRec.toString() + "-" + iEndRec.toString();
            document.getElementById("labTotalRec").innerText = iRecCount.toString();
            document.getElementById("labTotalRec2").innerText = iRecCount.toString();

            document.fmMain.txtPageNum.value = document.fmMain.txtCurrentPage.value;
		    document.getElementById("txtPageNum2").value = document.fmMain.txtCurrentPage.value;
		}
        else
        {
            document.getElementById("ResultBar3").style.display = "none";
        }
	}
   if (document.fmMain.txtDateFrom.value != "") {
		document.getElementById("txtBeginTime").innerHTML = "$$QUERY_BEGIN_TIME$$";
		document.getElementById("txtEndTime").innerHTML = "$$QUERY_END_TIME$$";
   }
   if (document.fmMain.optSort.value != "") {
		if (objSort = document.getElementById(document.fmMain.optSort.value))
	    	document.getElementById(document.fmMain.optSort.value).innerHTML += parseInt(document.fmMain.optSortType.value) ? "<img src=\"images/arrow_down.gif\"/>" : "<img src=\"images/arrow_up.gif\"/>";
	} 
    jsSetFunction();
    

    // Set Title "Policy Name"
    if (vReason != "Security risk scan")
     {
         if (vReason == "Unscannable Files")
            document.getElementById("security_risk_name").innerText = "Reason";
         else
            document.getElementById("security_risk_name").innerText = "Policy name";
     }
    
     parent.document.fmMain.btnSearch.disabled = false;
	 var restoreFailedCount = "$$RESTORE_FAILED_COUNT$$";
	 var restoreErrorMSG = "$$RESTORE_FAILED_MSG$$";	
	 if(restoreFailedCount != "0"&&restoreFailedCount != "$$RESTORE_FAILED_COUNT$$")
	  {
		  errorMSG = restoreFailedCount +" item(s) restore failed because of the following reason(s): "+restoreErrorMSG;
		  alert(errorMSG);
	  }
	  var errorMSG = "$$ERROR_MSG$$";
	  if(errorMSG!="$$ERROR_MSG$$")
	      alert(errorMSG);
}

function jsPage(nPage,vId) {
	// add some checking
	if (document.getElementById("ResultBar2").disabled)
		return;
	var nPageCount   = parseInt(document.fmMain.txtPageCount.value);
	var nCurrentPage = parseInt(document.fmMain.txtCurrentPage.value);
	if (nPage == "_NEXT_")			nPage = nCurrentPage + 1;
	else if (nPage == "_PREV_")		nPage = nCurrentPage - 1;
	else if (nPage == "_FIRST_")	nPage = 1;
	else if (nPage == "_LAST_")		nPage = nPageCount;
	
	if (nPage < 1) nPage = 1;

	else if (nPage > nPageCount) nPage = nPageCount;
	else if (nPage == nCurrentPage) return;
	else if (!checkNumberRange(nPage,nPageCount,1,STR_ERR_INVALID_LOG_PAGE_NUM))
	{
		document.getElementById(vId).focus();
		document.getElementById(vId).select();
		return;
	}
	var vPageCount = document.fmMain.txtPageCount.value;	
	document.fmMain.txtTargetPage.value = nPage;
	jsAddCSRFToken(document.fmMain);
    document.fmMain.submit();
}

function jsToggleSort(txtField) 
{
	setOption2Selected(document.getElementById("lstSelectedAccount"));
	var intOrder = 0;
	
	if (txtField == document.fmMain.optSort.value) {
		if (document.fmMain.optSortType.value != "")
		intOrder = (parseInt(document.fmMain.optSortType.value)+ 1) % 2;
	}
	//jsCombineDateTime();
	document.fmMain.optSort.value = txtField;
	document.fmMain.optSortType.value = intOrder;
	jsAddCSRFToken(document.fmMain);
    document.fmMain.submit();
}

function jsKeyPressEvent(e,vId,nValue)
{
    var key = window.event ? e.keyCode : e.which;
    if(key == 13)
        jsPage(nValue,vId);
}

function jsSetFunction() {
	var nCount = 0;
	
	if (document.fmMain.chkItemId == null) {
		nCount = -1;
	} else if (document.fmMain.chkItemId.length == null) {
		if(document.fmMain.chkItemId.checked) nCount++;
	} else {
    	for(var i=0;i<document.fmMain.chkItemId.length;i++) {
      		if(document.fmMain.chkItemId[i].checked) nCount++;
    	}
  	}
  	setUIFunctionLink((nCount>0),"cmdDelItem");
  	setUIFunctionLink((nCount>0),"cmdDelItem2");
  	setUIFunctionLink((nCount>0),"cmdRestore");
  	setUIFunctionLink((nCount>0),"cmdRestore2");
}
function jsSelectAll() {
//	setUIChecked(document.fmQMCmd.chkSelectAll.checked,document.fmQMCmd.chkResendId);
//	don't use the common function for loading issue
	if (document.fmMain.chkItemId.length) {
		for (var i=0;i<document.fmMain.chkItemId.length;i++)
			document.fmMain.chkItemId[i].checked = document.fmMain.chkSelectAll.checked;
	} else {
		document.fmMain.chkItemId.checked = document.fmMain.chkSelectAll.checked;
	}
	jsSetFunction();
}
function jsItems_Click(oAll,oItems,bFlag) {
	setUIItemsChecked(oAll,oItems,bFlag);
  	jsSetFunction();
}
//-->
</script>
<body style="margin-left: 0px;margin-top: 0px;OVERFLOW-Y:HIDDEN" onLoad="jsInitPage();"> 
<form id="fmMain" name="fmMain" action="$$FORM_ACTION$$" method="POST">
<!--Hidden Field-->
    <input type="hidden" name="FormAction" value="$$QUERY_CMD_FORM_ACTION$$">
    <input type="hidden" name="txtDateFrom"     value="$$BEGIN_TIME$$"/>
    <input type="hidden" name="txtDateTo"       value="$$END_TIME$$"/>
    <input type="hidden" name="optReason"      value="$$REASON$$"/>
	<input type="hidden" name="optSort"         value="$$SORT_BY$$"/>
	<input type="hidden" name="optSortType"     value="$$SORT_ORDER$$"/>
	<input type="hidden" name="txtTargetPage"   value="$$TARGET_PAGE$$"/>
	<input type="hidden" name="txtNumPerPage"   value="$$REC_PER_PAGE$$"/>
	<input type="hidden" name="txtRecCount"         value="$$REC_COUNT$$"/>
	<input type="hidden" name="txtPageCount"        value="$$PAGE_COUNT$$"/>
	<input type="hidden" name="txtCurrentPage"      value="$$CURRENT_PAGE$$"/>
    <input type="hidden" name="txtSite" value="$$SITE$$">
    <input type="hidden" name="txtAccount" value="$$ACCOUNT$$">
    <input type="hidden" name="txtFileName" value="$$FILENAME$$">
	<input type="hidden" name="txtRecordName" id="txtRecordName" value="">
    <select id="lstSelectedAccount" name="lstSelectedAccount" multiple style="display:none">
    $$QUERY_USER$$
													            </select>

<!--/Hidden Field-->
<!--/Page Title-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<!--Page Description--><!--/Page Description-->
<!--Page Content-->
	<tr id="ResultBar1"><td class="tableheader" style="BORDER-TOP: #999999 2px solid;"><font id="searchreason"></font> <font id="txtBeginTime"></font>&nbsp;to&nbsp;<font id="txtEndTime"></font></td></tr>
		<tr id="ResultBar2" ><td class="data2">
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
				<tr><td><a id="cmdRestore" href="javascript:jsRestore();" class="databutton"><img id="cmdRestore_img" src="images/icon_deliver.gif"
                class="vAlignMid">Restore</a>
					<a id="cmdDelItem" href="javascript:jsDelete();" class="databutton"><img id="cmdDelItem_img" src="images/icon_delete.gif"
                    class="vAlignMid">Delete</images></a></td>
					<td align="right"><table border="0" cellspacing="0" cellpadding="0"><tr><td nowrap><font id="labRecordRange" name="labRecordRange">0</font> of <font id="labTotalRec" name="labTotalRec">0</font></td><td>&nbsp;logs</td>
						<td><img src="images/pagination-beginning.gif" style="cursor:pointer" onClick="jsPage('_FIRST_');" class="vAlignMid"></td>
						<td><img src="images/pagination-previous.gif" style="cursor:pointer" onClick="jsPage('_PREV_');" class="vAlignMid"></td>
						<td>Page</td>
						<td><input type="text" class="text" id="txtPageNum" name="txtPageNum" size="5" maxlength="5" onKeyPress="jsKeyPressEvent(event,this.id,this.value);"/></td>
						<td>of&nbsp;</td>
						<td><font id="labTotalPage" name="labTotalPage">0</font></td>
						<td><img src="images/pagination-next.gif" style="cursor:pointer" onClick="jsPage('_NEXT_');" class="vAlignMid"></td>
						<td><img src="images/pagination-end.gif" style="cursor:pointer" onClick="jsPage('_LAST_');" class="vAlignMid"></td><td>&nbsp;|&nbsp;</td>
						<td><input type=button class="text" value="Go" onClick="jsPage(this.form.txtPageNum.value,'txtPageNum');"></td></tr></table></td></tr>
				</table></td></tr>
		<!--||TABLE DATA||-->
		
		<tr id="ResultBar3"><td style="padding:0">
            <table name="tabQLoglist" id="tabQLoglist" width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr><td class="grey2" width="20"><input type="checkbox" name="chkSelectAll" onClick="javascript:jsSelectAll();"></td>
                <td nowrap="nowrap" class="grey2" id="DeleteDate"><a href="javascript: jsToggleSort('DeleteDate')">Date/Time</a></td>
                <td nowrap="nowrap" class="grey2" id="LeafName"><a href="javascript: jsToggleSort('LeafName')">File name</a></td>
                <td nowrap="nowrap" class="grey2" id="file_location">File location</a></td>
       
                <td nowrap="nowrap" class="grey2" id="LastModifiedUser"><a href="javascript: jsToggleSort('LastModifiedUser')">Violator</a></td>
                <td nowrap="nowrap" class="grey2-end" id="security_risk_name">Security risk name</td>
            </tr>
            $$PAGE_CONTENT$$
            </table>
		</td></tr>
		<tr id="ResultBar4"><td class="data2c">
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
				<tr><td><a id="cmdRestore2" href="javascript:jsRestore();" class="databutton"><img id="cmdRestore2_img" src="images/icon_deliver.gif"
                class="vAlignMid">Restore</a>
					<a id="cmdDelItem2" href="javascript:jsDelete();" class="databutton"><img id="cmdDelItem2_img" src="images/icon_delete.gif"
                    class="vAlignMid">Delete</images></a></td>
					<td align="right"><table border="0" cellspacing="0" cellpadding="0"><tr><td nowrap><font id="labRecordRange2" name="labRecordRange2">0</font> of <font id="labTotalRec2" name="labTotalRec2">0</font></td><td>&nbsp;logs</td>
						<td><img src="images/pagination-beginning.gif" style="cursor:pointer" onClick="jsPage('_FIRST_');" class="vAlignMid"></td>
						<td><img src="images/pagination-previous.gif" style="cursor:pointer" onClick="jsPage('_PREV_');" class="vAlignMid"></td>
						<td>Page</td>
						<td><input type="text" class="text" id="txtPageNum2" name="txtPageNum2" size="5" maxlength="5" onKeyPress="jsKeyPressEvent(event,this.id,this.value);"/></td>
						<td>of&nbsp;</td>
						<td><font id="labTotalPage2" name="labTotalPage2">0</font></td>
						<td><img src="images/pagination-next.gif" style="cursor:pointer" onClick="jsPage('_NEXT_');" class="vAlignMid"></td>
						<td><img src="images/pagination-end.gif" style="cursor:pointer" onClick="jsPage('_LAST_');" class="vAlignMid"></td><td>&nbsp;|&nbsp;</td>
						<td><input type=button class="text" value="Go" onClick="jsPage(document.getElementById('txtPageNum2').value,'txtPageNum2');"></td></tr></table></td></tr>
				</table></td></tr>
<!--/Page Content-->
</table>
</form>
<form id="fmDownload" name="fmDownload" action="$$DOWNLOAD_PAGE$$" method="Post">
    <input type="hidden" name="downloadSiteId" value="">
    <input type="hidden" name="downloadItemId" value="">
    <input type="hidden" name="downloadWebId" value="">
    <input type="hidden" name="downloadDirName" value="">
    <input type="hidden" name="downloadLeafName" value="">
    <input type="hidden" name="downloadFileSize" value="">
    <input type="hidden" name="browserType" value="">
</form>
<iframe id="ifmDownload" name="ifmDownload" style="display:none" src="html/UntitledFrame-1.htm"></iframe>

</body>
</html>
