<html>
<head>
<title>Server Management</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/prototype.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
//Other domain server list
var strServers = "$$REMOTE_SITE_SERVER_LIST$$";
var aryServers = strServers.split("|").reverse();
var bLocalOppStatus = "$$OPP_STATUS$$";
var bACExpired = "$$AC_EXPIRED$$";
var bHideDLP = $$PR_DLP_HIDE$$;
var AjaxGetServerBrief = false;
var AjaxGetServerMore = false;

function jsInitPage() {
	if(bLocalOppStatus == "true"){
        $("idOppStatus").style.display = "";
	}
	if(bACExpired == "true"){
        $("idACExpired").style.display = "";
    }
	if(bHideDLP)
	{
		document.getElementById("prDLP").style.display = "none";
	}
	jsGetMoreServerInfo();
}
function jsSubmit() {
	document.fmMain.action = document.fmMain.optFor.options[document.fmMain.optFor.selectedIndex].value;
	jsAddCSRFToken(document.fmMain);
    document.fmMain.submit();
}
function jsRefresh() {
	jsAddCSRFToken(document.fmMain);
    document.fmMain.submit();
}

function jsGetMoreServerInfo(){
    $("divLoading").style.display = "";
    var i = aryServers.length - 1;
    if(aryServers.length > 0)
    {
	    var trgServerName = setTrim(aryServers[i]);
	    if( trgServerName.length != 0)
	    {
	        var url = "cgiDispatcher.exe";
	        // this script for testing
	        //url = "xml/localization.xml";
	        var PostArgument = "Page=summary/SM_request.htm&Action=GetScanResult&Argument=" + encodeURIComponent(trgServerName);
	        var cacheBuster = "&tick=" + new Date() * 1;
            PostArgument += cacheBuster;
 	        //var myAjax = new Ajax.Request(url, {method:'post', postBody:PostArgument , onComplete:jsGetServerInfoDone});
 	        //AjaxGetServerBrief = myAjax.transport;
 	        
 	        AjaxGetServerBrief = createXMLHttpRequest();
	        AjaxGetServerBrief.open("POST", url, true);
            AjaxGetServerBrief.onreadystatechange = function(){
                if (AjaxGetServerBrief.readyState == 4) {
                    if (AjaxGetServerBrief.status == 200) {
                        jsGetServerInfoDone(AjaxGetServerBrief.responseText);
                    }
                }
            };
            AjaxGetServerBrief.send(PostArgument);
            
 	        return;
	    }
	    else
	    {
	        aryServers.pop();
	        jsGetMoreServerInfo();
	        return;
	     }
    }
    $("divLoading").style.display = "none";
}
function jsGetServerInfoDone(originalRequest){
    //var response = originalRequest.responseText;
    var response = originalRequest;
    // this script for testing
    //response = "0:ServerName=SNxxx|Virus=Vrxxx|VirusUncleanable=VUxxx|BlockedAttachments=BAxxx|Spam=SPxxx|ContentViolations=CVxxx|MessagesScanned=|UnscannableFiles=WPxxx";
    var vResultSignal = response.substring(0,response.indexOf(":"));
    var strServerInfo = response.substring(response.indexOf(":")+1,response.length);
    if(vResultSignal == "0")
        jsAddServerToUI(strServerInfo);
    
    aryServers.pop();
    jsGetMoreServerInfo();
}
function jsAddServerToUI(strServerInfo){
    var aryServerInfoResponse = strServerInfo.split("|");
    
    for(var i=0;i<aryServerInfoResponse.length;i++)
    {
        if(aryServerInfoResponse[i].indexOf("ServerName=") > -1 )
            var vServerName = aryServerInfoResponse[i].split("=");
        else if(aryServerInfoResponse[i].indexOf("SecurityRisk=") > -1 )
            var vSecurityRisk = aryServerInfoResponse[i].split("=");
        else if(aryServerInfoResponse[i].indexOf("VirusUncleanable=") > -1 )
            var vVirusUncleanable = aryServerInfoResponse[i].split("=");
        else if(aryServerInfoResponse[i].indexOf("BlockedFiles=") > -1 )
            var vBlockedFile = aryServerInfoResponse[i].split("=");
        else if(aryServerInfoResponse[i].indexOf("SuspiciousURLs=") > -1 )
            var SuspiciousURLs = aryServerInfoResponse[i].split("=");
        else if(aryServerInfoResponse[i].indexOf("ContentViolations=") > -1 )
            var vContentViolations = aryServerInfoResponse[i].split("=");
        else if(aryServerInfoResponse[i].indexOf("UnscannableFiles=") > -1 )
            var vUnscannableFiles = aryServerInfoResponse[i].split("=");
        else if(aryServerInfoResponse[i].indexOf("OPPStatus=") > -1)
            var vOPPStatus = aryServerInfoResponse[i].split("=");
        else if(aryServerInfoResponse[i].indexOf("ServerAvailable=") > -1)
            var vServerAvailable = aryServerInfoResponse[i].split("=");
        else if(aryServerInfoResponse[i].indexOf("Description=") > -1)
            var vDescription = aryServerInfoResponse[i].split("=");
		else if(aryServerInfoResponse[i].indexOf("DataLossPrevention=") > -1)
            var vDataLossPrevention = aryServerInfoResponse[i].split("=");
    }

	var objVersionTable;
	var srcString;
	
	if(vServerAvailable[1] == "true")
	{	
		var OPPIconStr = "";
		if(vOPPStatus[1] == "true")
			OPPIconStr = "<img title=\"Server in OPP period\" src=\"images/server_opp.gif\" />"

		if(bHideDLP)
		{
			objVersionTable = new objTable("scanning_result_table", 8);
			srcString = OPPIconStr + "|" + vServerName[1] + "|" + vSecurityRisk[1] + "|" + vVirusUncleanable[1] + "|" + vBlockedFile[1] + "|" + SuspiciousURLs[1] + "|" + vContentViolations[1] + "|" + vUnscannableFiles[1];		
		}
		else
		{
			objVersionTable = new objTable("scanning_result_table", 9);
			srcString = OPPIconStr + "|" + vServerName[1] + "|" + vSecurityRisk[1] + "|" + vVirusUncleanable[1] + "|" + vBlockedFile[1] + "|" + SuspiciousURLs[1] + "|" + vDataLossPrevention[1] + "|" + vContentViolations[1] + "|" + vUnscannableFiles[1];
		}
	}
	else
	{
		objVersionTable = new objTable("scanning_result_table", 3);
		srcString = "" + "|" + vServerName[1] + "|" + vDescription[1];
	}
	
    var nRow = objVersionTable.getRowAmount();
    if((nRow-1)%2==0)
        {objVersionTable.addTableRow(srcString,"data1b","data1");}
    else
        {objVersionTable.addTableRow(srcString,"data2b","data2");}
   
	if(vServerAvailable[1] != "true")
	{
			if(vBrowser=="IE")
			{
				document.getElementById('scanning_result_table').rows[nRow].cells[2].colSpan = 8;
			}
			else
			{
				document.getElementById('scanning_result_table').rows[nRow-1].cells[2].setAttribute("colspan", "8");	
			}
  }
}

//Display more Server detail information
var sTarget;
function jsShowServerInfo(originalRequest){    
    $("divLoading").style.display = "none";
    //var response = originalRequest.responseText;
    var response = originalRequest; 
    response = response.replace("ServerName",STR_ServerManagement_ServerName);
    response = response.replace("ServerFqdn",STR_ServerManagement_ServerFQDN);
    response = response.replace("ServerRole",STR_ServerManagement_ServerRole);
    
    var vResultSignal = response.substring(0,response.indexOf(":"));
    var strServerInfo = response.substring(response.indexOf(":")+1,response.length);
 
    if(vResultSignal == "0"){ 
        var strTitleSet = strServerInfo.substring(0,strServerInfo.indexOf("|"));
        var strTitlePair = strTitleSet.split("=");
        var miTitle = strTitlePair[1];
        var miContent = strServerInfo.substring(strServerInfo.indexOf(":")+1,strServerInfo.length);
    	
        showMoreInfo("ifmMoreInfo",document.getElementById(sTarget),480,180,miTitle,miContent);
    } 
}
function jsAbort(){
    if(AjaxGetServerBrief){
        AjaxGetServerBrief.abort();
        AjaxGetServerBrief = false;
    }
    if(AjaxGetServerMore){
        AjaxGetServerMore.abort();
        AjaxGetServerMore = false;
    }
}
//-->
</script>

</head>
<body onLoad="jsInitPage();" onUnload="jsAbort();">
<form id="fmMain" name="fmMain" action="$$FORM_ACTION$$" method="POST">
  <!--Hidden Field-->
  <!--/Hidden Field-->
  <!--Page Title-->
  <table width="98%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td class="content-title">Server Management </td>
      <td valign="bottom" id="divLoading" style="display:none;"><img src="images/icon_loading.gif" /> <font size="1" color="#0000FF"><b>Downloading...</b></font></td>
      <td valign="bottom" align="right"><a href="javascript:jsRefresh();" class="moretestblue"><img src="images/icon_refresh.gif" border="0"  align="absmiddle" class="vAlignMid"> Refresh</a> <a href="javascript:jsMapOnlineHelp('summary\server_management_console.htm');" class="moretestblue"> <img src="images/question.gif"   width="16" height="16" border="0" align="absmiddle" class="vAlignMid"> Help</a></td>
    </tr>
    <tr>
      <td colspan="4" width="100%" height="10" valign="middle" class="hor-dotted-line"><img src="images/1space.gif" width="98%" height="1"></td>
    </tr>
    <tr id="idOppStatus" style="display:none">
      <td colspan="3"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td class="warnning-text"><img src="images/server_opp.gif" />&nbsp;Now local server is in OPP period. You can't replicate settings.</td>
          </tr>
          <tr>
            <td height="20"></td>
          </tr>
        </table></td>
    </tr>
    <tr id="idACExpired" style="display:none">
      <td colspan="3"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td class="warnning-text"><img src="images/icon_error.gif" />&nbsp;Your product license is trial, expired or not activated. Other servers cannot be detected.</td>
          </tr>
          <tr>
            <td height="20"></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td height="1" colspan="2" background="images/dot.gif"></td>
    </tr>
  </table>
  <!--/Page Title-->
  <table width="98%" border="0" cellspacing="0" cellpadding="0">
    <!--Page Description-->
    <tr>
      <td height="10"></td>
    </tr>
    <!--/Page Description-->
    <!--Page Content-->
    <!--    <tr id="trRCServer_Stop" style="display:none;">
      <td>&nbsp;</td>
    </tr>
    <tr id="blnkRCServer_Stop" style="display:none;">
      <td height="10"></td>
    </tr>
-->
    <tr>
      <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td background="images/tab_background_cui.gif"><table border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td><img src="images/tab_active1_left_cui.gif" width="11" height="23" id="Tag1_imgS" style="vertical-align:top"></td>
                  <td valign="top" nowrap id="Tag1"  background="images/tab_active_background_cui.gif" class="tabactive">Query</td>
                  <td><img src="images/tab_active_right_cui.gif" width="23" height="23" id="Tag1_imgE" style="vertical-align:top"></td>
                  <td><img src="images/tab_inactive2_left_cui.gif" width="11" height="23" id="Tag2_imgS" style="vertical-align:top"></td>
                  <td valign="top" nowrap id="Tag2" background="images/tab_inactive_background_cui.gif" class="tabinactive"><a class="subnavselect" href="$$ID_PAGE_SERVER_MANAGEMENT_REPLICATE$$">Replication</a></td>
                  <td><img src="images/tab_inactive_right_cui.gif" width="23" height="23" id="Tag2_imgE" style="vertical-align:top"></td>
                </tr>
              </table></td>
            <td width="13" align="right" background="images/tab_background_cui.gif"><img src="images/tab_right_corner_cui.gif" width="6" height="23" style="vertical-align:top"></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td ><table width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
          <tr>
            <td colspan="5" class="tableheadergreyS"><span class="tableheadergrey">Criteria</span></td>
          </tr>
          <tr>
            <td height="10" colspan="3"></td>
          </tr>
          <tr>
            <td  height="11" class="data1">Type:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td width="669" height="11" colspan="4" class="data1"><select class="button" id="optFor" name="optFor" onChange="jsSubmit();">
                <option value="$$ID_PAGE_PATTERN_ENGINE_LIST_VIEW$$">Pattern and engine version</option>
            <option value="$$ID_PAGE_SCANNING_STATUS_LIST_VIEW$$">Scanning status</option>
            <option value="$$ID_PAGE_SCANNING_RESULT_LIST_VIEW$$" selected="true">Scanning result</option>
                <option value="$$ID_PAGE_LAST_REPLICATION_LIST_VIEW$$">Last replication</option>
              </select></td>
          </tr>
          <tr>
            <td height="10" colspan="3"></td>
          </tr>
          <tr>
        <td colspan="5"><table width="100%" border="0" cellpadding="0" cellspacing="0" id="scanning_result_table">
                <tr>
                  <td width="0" class="grey2" id="idOPPIcon">&nbsp;</td>
      			  <td class="grey2">Server Name</td>
              	  <td class="grey2">Security Risk</td>
              	  <td class="grey2">Virus/Malware Uncleanable</td>
              	  <td class="grey2">Blocked Files</td>
              	  <td class="grey2">Suspicious URLs</td>
				  <td class="grey2" name="prDLP" id="prDLP">Data Loss Prevention</td>
              	  <td class="grey2">Content Violations</td>
              	  <td class="grey2-end">Unscannable Files</td>
                </tr>
              </table></td>
          </tr>
        </table></td>
  </table>
</form>
<iframe id="ifmMoreInfo" name="ifmMoreInfo" frameborder="0" src="html/moreinfo_board.htm" style="z-index:1000;position:absolute;display:none;scrolling:no;" />
</body>
</html>
