<html>
<head>
<title>Notification_Settings</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">
<!--
function jsInitPage() {
	// Init Page
	
	// set max length
	document.fmMain.txtEmail.maxLength = INT_LMAX_EM_ADDR_M;
	document.fmMain.txtSNMPCommunity.maxLength = INT_LMAX_SNMP;
	document.fmMain.txtFromEmail.maxLength = INT_LMAX_EM_ADDR;
	document.fmMain.txtAdminSendName.maxLength = INT_LMAX_EM_DISPLAY_NAME;
	document.fmMain.txtAdminSendSMTPIP.maxLength = INT_LMAX_ADDR_PROXY;
	document.fmMain.txtAdminSendSMTPPort.maxLength = INT_LMAX_PORT;

}
function jsSubmit(strAction) {
	// add some checking
	setOption2Selected(document.fmMain.lstMail);
	document.fmMain.FormAction.value = strAction;
	if(strAction == 'save') {
	    if (!checkDisplayNameFormat(document.fmMain.txtAdminSendName.value, STR_ADMIN_NTF_WARN_DISPLAYNAME, true)) {
		    document.fmMain.txtAdminSendName.focus();
		    document.fmMain.txtAdminSendName.select();
		    return false;
	    }		
//	    if (!checkIPAddressFormat(document.fmMain.txtAdminSendSMTPIP.value, STR_WARN_IP_ADDR, true)) {
//		    document.fmMain.txtAdminSendSMTPIP.focus();
//		    document.fmMain.txtAdminSendSMTPIP.select();
//		    return false;
//	    }
	    if (document.fmMain.txtAdminSendSMTPPort.value != "") {
		    if (!checkPortRange(document.fmMain.txtAdminSendSMTPPort.value,STR_WARN_SMTP_PORT)) {
			    document.fmMain.txtAdminSendSMTPPort.focus();
		        document.fmMain.txtAdminSendSMTPPort.select();
			    return false;
		    }
	    }
		if (!checkIPAddressFormat(document.fmMain.txtSNMPIP.value,"") && !checkIsIPv6Address(document.fmMain.txtSNMPIP.value) ){
		    alert(STR_ERR_INVALID_IPADDRESS);
			document.fmMain.txtSNMPIP.focus();
			document.fmMain.txtSNMPIP.select();
			return false;
		}
		if (!checkNumberRange(document.fmMain.txtSNMPCommunity.value.length,INT_NMIN_SNMP,INT_NMAX_SNMP,STR_WARN_SNMP)) {
			jsFocus(document.fmMain.txtSNMPCommunity);
			document.fmMain.txtSNMPCommunity.focus();
			document.fmMain.txtSNMPCommunity.select();
			return false;	
		}
		if(jsTrim(document.fmMain.txtSNMPCommunity) == "" && jsTrim(document.fmMain.txtSNMPIP) != ""){
		    alert(STR_WARN_SNMP_IP_COMM);
		    document.fmMain.txtSNMPCommunity.focus();
			document.fmMain.txtSNMPCommunity.select();
			return false;
		}
		if(jsTrim(document.fmMain.txtSNMPCommunity) != "" && jsTrim(document.fmMain.txtSNMPIP) == ""){
		    alert(STR_WARN_SNMP_IP_COMM);
		    document.fmMain.txtSNMPIP.focus();
			document.fmMain.txtSNMPIP.select();
			return false;
		}
		if(document.fmMain.txtEmail.value.length == 0){
		        alert(STR_ERR_NOTIFY_ADMIN_ACCOUNT);
		      	document.fmMain.txtEmail.focus();
			document.fmMain.txtEmail.select();
			return false;
		}
		if (!checkMultiEmailPatternFormat(document.fmMain.txtEmail.value,STR_ERR_INVALID_EMAIL) ||
			!checkNumberRange(document.fmMain.txtEmail.value.length,1,INT_LMAX_EM_ADDR_M,STR_WARN_EM_ADDR_M)) {
			document.fmMain.txtEmail.focus();
			document.fmMain.txtEmail.select();
			return false;
		}
		if (!checkEmailFormat(document.fmMain.txtFromEmail.value,STR_ERR_INVALID_EMAIL)) {
			document.fmMain.txtFromEmail.focus();
			document.fmMain.txtFromEmail.select();
			return false;
		}
		if (document.fmMain.txtFromEmail.value.length == 0) {
			alert(STR_WARN_NF_DISPLAYNAME);
			document.fmMain.txtFromEmail.focus();
			document.fmMain.txtFromEmail.select();
			return false;
		}
		document.fmMain.btnSave.disabled = true;
	} else if(strAction == 'applyEmail') {
		if(document.fmMain.txtEmail.value.length == 0){
		        alert(STR_ERR_NOTIFY_ADMIN_ACCOUNT);
		      	document.fmMain.txtEmail.focus();
			document.fmMain.txtEmail.select();
			return false;
		}
		if (!checkMultiEmailPatternFormat(document.fmMain.txtEmail.value,STR_ERR_INVALID_EMAIL) ||
			!checkNumberRange(document.fmMain.txtEmail.value.length,1,INT_LMAX_EM_ADDR_M,STR_WARN_EM_ADDR_M)) {
			document.fmMain.txtEmail.focus();
			document.fmMain.txtEmail.select();
			return false;
		}
		document.fmMain.btnAdmin_ApplyAll.disabled = true;
	} else if(strAction == 'applySNMP') {
		if (!checkIPAddressFormat(document.fmMain.txtSNMPIP.value,"") && !checkIsIPv6Address(document.fmMain.txtSNMPIP.value) ) {
		    alert(STR_ERR_INVALID_IPADDRESS);
			document.fmMain.txtSNMPIP.focus();
			document.fmMain.txtSNMPIP.select();
			return false;
		}
		if (!checkNumberRange(document.fmMain.txtSNMPCommunity.value.length,INT_NMIN_SNMP,INT_NMAX_SNMP,STR_WARN_SNMP)) {
			jsFocus(document.fmMain.txtSNMPCommunity);
			document.fmMain.txtSNMPCommunity.focus();
			document.fmMain.txtSNMPCommunity.select();
			return false;	
		}
		if(jsTrim(document.fmMain.txtSNMPCommunity) == "" && jsTrim(document.fmMain.txtSNMPIP) != ""){
		    alert(STR_WARN_SNMP_IP_COMM);
		    document.fmMain.txtSNMPCommunity.focus();
			document.fmMain.txtSNMPCommunity.select();
			return false;
		}
		if(jsTrim(document.fmMain.txtSNMPCommunity) != "" && jsTrim(document.fmMain.txtSNMPIP) == ""){
		    alert(STR_WARN_SNMP_IP_COMM);
		    document.fmMain.txtSNMPIP.focus();
			document.fmMain.txtSNMPIP.select();
			return false;
		}
		document.fmMain.btnSNMP_ApplyAll.disabled = true;
	} else if(strAction == 'Reset') {
		if(!confirm(STR_ALR_RESET_SETTING))
	        return false;		
		document.fmMain.btnReset.disabled = true;
	}
	jsAddCSRFToken(document.fmMain);
    document.fmMain.submit();
}
function jsAddMail() {
	if (document.fmMain.txtMail.value == "") { return; }
	if (!checkEmailPatternFormat(document.fmMain.txtMail.value,STR_ERR_INVALID_EMAIL) ||
		!checkNumberRange(document.fmMain.txtMail.value.length,1,INT_LMAX_EM_ADDR,STR_WARN_EM_ADDR)) {
		document.fmMain.txtMail.focus();
		document.fmMain.txtMail.select();
		return false;
	}
	setUIMoveItem(document.fmMain.txtMail,document.fmMain.lstMail,true);
}
//-->
</script>
<body onLoad="jsInitPage();">
<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">Notification Settings</td>
	<td align="right" valign="bottom">
		<a href="javascript:jsMapOnlineHelp('administration\Notification_Settings.htm');" class="moretestblue">
		<img src="images/question.gif" class="vAlignMid"> Help</a></td></tr>
<tr><td height="4" colspan="2"></td></tr>
<tr><td height="1" colspan="2" background="images/dot.gif"></td></tr>
<tr><td height="10" colspan="2"></td></tr>
</table>
<!--/Page Title-->

<table width="98%" border="0" cellspacing="0" cellpadding="0">
<!--Page Description--><!--/Page Description-->
<!--Page Content-->
<tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
		<!--||Administrator Notification||-->
		<tr><td class="tableheadergreyS" colspan="2">Administrator Notification</td></tr>
		<tr><td class="data2" colspan="2" height="20">Type the email address of the administrator that will receive notifications.</td></tr>
		<tr><td class="data1" width="10%" nowrap>Email address: </td>
			<td class="data1" width="90%">
				<input type=text class="text" id="txtEmail" name="txtEmail" style="width:250" value="$$ID_VAR_ADMIN_EMAIL$$">
				<input type=button class="text" id="btnAdmin_ApplyAll" name="btnAdmin_ApplyAll" value="Apply All" onClick="jsSubmit('applyEmail');"></td></tr>
		<tr><td class="data1"></td>
			<td class="data1" height="40">Use semicolon";" to separate multiple addresses<br>For example: user1@domain.com;</td></tr> 
		<!--||Sender Display Name||-->
		<tr id="DisName_Title"><td class="tableheadergreyM" colspan="2">Sender Settings</td></tr>
		<tr id="DisName_Description"><td class="data2" colspan="2" height="20">Type the email address of the sender who will send alerts and notifications.</td></tr>
		<tr id="DisName_Settings"><td class="data1" nowrap>Sender <font class="highlight-red">*</font>: </td>
			<td class="data1"><input type=text class="text" id="txtFromEmail" name="txtFromEmail" style="width:250" value="$$ID_VAR_ADMIN_FROM_EMAIL$$"></td></tr>
		<tr><td class="data1"></td>
			<td class="data1" height="20">For example: user@domain.com</td></tr> 
		<!--||Email Account Settings||-->
		<tr><td class="tableheadergreyM" colspan="2">Email Account Settings</td></tr>
		<tr><td class="data2" colspan="2" height="22">Type the SMTP server settings that PortalProtect will use to send email-based notifications.</td></tr>
		<tr><td class="data1">Display name: </td>
		       <td class="data1"><input type=text class="text" id="txtAdminSendName" name="txtAdminSendName" style="width:250" value="$$TEXT_SMTP_ADMIN_DISPLAY_NAME$$"></td></tr>
		<tr><td class="data1"></td>
		       <td class="data1" height="20">For example: Administrator</td></tr>
		<tr><td class="data1">SMTP Server: </td>
		       <td class="data1"><input type=text class="text" id="txtAdminSendSMTPIP" name="txtAdminSendSMTPIP" style="width:250" value="$$TEXT_SMTP_SERVER$$"></td></tr>
		<tr><td class="data1">Port: </td>
		       <td class="data1"><input type=text class="text" id="txtAdminSendSMTPPort" name="txtAdminSendSMTPPort" maxLength="16" value="$$TEXT_SMTP_PORT$$"></td></tr>
		<!--||SNMP||-->
		<tr><td class="tableheadergreyM" colspan="2">SNMP</td></tr>
		<tr><td class="data1" nowrap>IP address: </td>
			<td class="data1"><input type=text class="text" maxLength="39" id="txtSNMPIP" name="txtSNMPIP" style="width:250" value="$$ID_VAR_SNMP_IP$$"></td></tr>
		<tr><td class="data1" nowrap>Community: </td>
			<td class="data1">
				<input type=text class="text" id="txtSNMPCommunity" name="txtSNMPCommunity" style="width:250" value="$$ID_VAR_SNMP_COMMUNITY$$">
				<input type=button class="text" id="btnSNMP_ApplyAll" name="btnSNMP_ApplyAll" value="Apply All" onClick="jsSubmit('applySNMP');"></td></tr>
		<!--||Internal Mail Definition||-->
		<tr style="display:none"><td class="tableheadergreyM" colspan="2">Internal Email Definition</td></tr>
		<tr style="display:none"><td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0">
				<tr><td class="data1" width="20"><input type=radio id="optMail" name="optMail" value="0" $$ID_VAR_CHECKED_INTERNAL_DEFAULT$$></td>
					<td class="data1">Default (Internal mail: email messages with the same domain.)</td></tr>
				<tr><td class="data1"><input type=radio id="optMail" name="optMail" value="1" $$ID_VAR_CHECKED_INTERNAL_SPECIFIED$$></td>
					<td class="data1">Custom internal mail definition
					    <img src="images/info_mark.gif" style="cursor:hand;position:relative" onMouseOut="hideToolTip('ifmToolTip');" 
						onmouseover="showToolTip('ifmToolTip',this,300,110,TIP_NT_INTERNALMAIL_TITLE,TIP_NT_INTERNALMAIL_CONTENT);">
					</td></tr>
				<tr><td class="data1"></td>
					<td class="data1">Add email addresses or domain names:</td></tr>
				<tr><td class="data1"></td>
					<td class="data1"><table border="0" cellpadding="0" cellspacing="0">
						<tr><td width="250"><input type=text maxLength="255" class="text" id="txtMail" name="txtMail" style="width:100%"></td>
							<td><input type=button class="text" value="Add" style="width:60" onClick="jsAddMail();"></td></tr>
						<tr><td><select class="text" id="lstMail" name="lstMail" style="width:100%" size="8" multiple>$$ID_VAR_INTERNAL_MAILS$$</td></select>
							<td valign="top"><input type=button class="text" value="Remove" style="width:60" onClick="setUIDelfromList(fmMain.lstMail);"></td></tr>
						</table></td></tr>
				</table></td></tr>
		<tr><td height="5" colspan="2"></td></tr>
		</table></td></tr>
<tr><td height="10"></td></tr>
<tr><td><input type=button class="text" id="btnSave" name="btnSave" value="Save" onClick="jsSubmit('save');">
		<input type=button class="text" id="btnReset" name="btnReset" value="Reset" onClick="jsSubmit('Reset');"></td></tr>
		<input type="hidden" name="FormAction">
<!--/Page Content-->
</table>
</form>

<iframe id="ifmToolTip" name="ifmToolTip" src="html/ToolTip.htm" frameborder="0" style="z-index:10000;position:absolute;width:0;height:0;scrolling:no"/>
</body>
</html>
