| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Program Files (x86)/Mail Enable/Bin/NETWebAdmin/Mondo/lang/sys/Controls/ |
Upload File : |
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="SiteMain.master.vb" Inherits="MailEnable.Clients.WebAdmin.Views.SiteMain" %>
<%@ Register TagPrefix="uc1" TagName="uscStyleHeader" Src="../Controls/uscStyleHeader.ascx" %>
<%@ Register TagPrefix="ucScriptsInclude" TagName="ScriptsInclude" Src="../Controls/ScriptsInclude.ascx" %>
<%@ Register TagPrefix="uc2" TagName="uscLanguageTokenMondo" Src="../Controls/uscLanguageToken.ascx" %>
<uc2:uscLanguageTokenMondo id="uscToken" runat="server"></uc2:uscLanguageTokenMondo>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta content="JavaScript" name="vs_defaultClientScript"/>
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"/>
<base target="_self"/>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
<uc1:uscstyleheader id="UscStyleHeader1" runat="server"></uc1:uscstyleheader>
<ucScriptsInclude:ScriptsInclude id="ScriptsInclude1" runat="server"></ucScriptsInclude:ScriptsInclude>
<script language="javascript" type="text/javascript" src="../Scripts/LIBCore.js"></script>
<script type="text/javascript" language="javascript" src="../Scripts/LIBCommon.js"></script>
<script type="text/javascript" language="javascript" src="../Scripts/LIBTabStrip.js"></script>
<script type="text/javascript" language="javascript" src="../Scripts/LIBJQLayout.js"></script>
<script type="text/javascript" language="javascript" src="../Scripts/LIBDialogs.js"></script>
<script type="text/javascript" language="javascript" src="../Scripts/LIBJQList.js"></script>
<style type="text/css">
.SettingsTable
{
width:100%;
}
.popupWin_dialogue
{
padding:5px;
}
.popupWin_body
{
padding:5px;
}
/* Apply padding to td elements that are direct children of the tr element. */
.SettingsTable tr > td
{
padding-bottom: 1px;
}
.SettingsTable label {}
.SettingsTable input:not([type=checkbox]), .SettingsTable select, .SettingsTable textarea
{
border:1px solid #969696;padding:4px 7px 4px 7px;margin-bottom:7px;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;
/*
-ms-box-sizing:content-box;
-moz-box-sizing:content-box;
-webkit-box-sizing:content-box;
box-sizing:content-box;
*/
}
y
.SettingsTable button
{
border:1px solid #969696;padding:4px 7px 4px 7px;
font-size:12px;
min-width: 80px;
margin-bottom:7px;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;
}
.SettingsTable button:hover {opacity: 0.6; }
.SettingsTable select:not([multiple])
{
height:25px;
}
.SettingsTable input[type="radio"]{
vertical-align: baseline;
}
.SettingsTable input[type="checkbox"]
{
margin-top:5px;
vertical-align: baseline;
}
.SettingsTable .checkboxes input[type="checkbox"]
{
margin-top:0px;
vertical-align:middle;
}
.SettingsTable .webmailbindingtable, .SettingsTable .webadminbindingtable, .SettingsTable .syncbindingtable
{
border:1px solid black;
height: 211px;
width:100%;
overflow-y:scroll;
}
.SettingsTable.globalfilterstable, .SettingsTable .filtercriteriatable, .SettingsTable .filteractionstable
{
border:1px solid black;
height: 211px;
width:100%;
}
/* .dataTable_table .highlight { background-color: #FFF9D0; }*/
.dataTable_table .highlight { background-color: #E6F3FF; }
.sysListTableData { background-color: white; }
.SettingsTable .webbindingtable .sysListTable_scrollContent, .SettingsTable .globalfilterstable .sysListTable_scrollContent, .SettingsTable .syncbindingtable .sysListTable_scrollContent, .SettingsTable .filtercriteriatable .sysListTable_scrollContent, .SettingsTable .filteractionstable .sysListTable_scrollContent
{
height: calc(211px - 25px);
background-color:white;
}
.SettingsTable td:first-child { width:200px;
white-space: nowrap;
vertical-align:top;
padding:6px;
}
.checkboxes
{
border:1px solid #969696;
margin-bottom:7px;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;
}
#table-container
{
border:1px solid #969696;
margin-bottom:7px;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;
}
.checkboxes input
{
margin-top:0px;
margin-bottom:0px;
}
.SettingsTable input[type=text]
{
/*height:18px;*/
border:1px solid #000000; /*remove 3d bevel effect */
}
.SettingsTable .smtpblockedaddresslist, .SettingsTable .popaccesslist, .SettingsTable .relaylist, .SettingsTable .smtpblockedaddresslist, .SettingsTable .greylistingexception, .SettingsTable .smtpaccesslist
{
width:200px;
height:150px;
}
.scriptfield
{
width:100%;
height:150px;
}
.pathfield
{
width:90%;
}
.ipaddresslistfield
{
width:90%;
}
.emailaddressfield
{
width:90%;
}
.domainnamefield
{
width:90%;
}
.checkboxes div
{
white-space: normal;
display: block;
float: none;
display: block;
}
.checkboxes label
{
display: block;
padding-right: 10px;
white-space: nowrap;
}
.checkboxes input {
vertical-align: middle;
}
.checkboxes label span {
padding-left: 10px;
vertical-align: middle;
}
.options_password_shell {position:relative;width:100%;height:19px;background:#E6E6E6;border:1px solid #ccc;overflow:hidden;margin-top:5px;}
.options_password_bar {position:relative;top:0;left:0;height:16px;font-size:10px;font-weight:bold;color:#000;padding-top:3px;}
.pw_very_weak {background:#CC0000;width:17%;}
.pw_weak {background:#F0B600;width:33%;}
.pw_medium {background:#FFFF00;width:50%;}
.pw_average {background:#C9E400;width:66%}
.pw_strong {background:#7EBF00;width:83%;}
.pw_very_strong {background:#339900;width:100%;}
</style>
<asp:ContentPlaceHolder ID="CustomSiteHeader" runat="server">
</asp:ContentPlaceHolder>
<script type="text/javascript" language="javascript">
//
// Dialog Routines
//
var dt_defaultColWidth = '100%'; //default table width
//var dt_defaultColWidth = '70px'; //default table width
function ClearHiddenFields(formName) {
var ofrm = $(formName);
if (ofrm) {
$(formName + " input[type='hidden'][name^='unchecked.']").remove(); //remove any existing hidden fields just in case someone enabled one and then re-enabled one
//remove the cmd setting too
$(formName + " input[type='hidden'][name='Cmd']").remove(); //remove the Cmd variable so our posting ie reentrant
$(formName + " input[type='hidden'][name='Params']").remove(); //remove additional field used to pass scoping variables (like backend the target)
}
}
function AppendInputToForm(formName, inputName, sValue) {
var ofrm = $(formName);
if (ofrm) {
$(formName + " input[type='hidden'][name='" + inputName + "']").remove(); //remove any existing hidden fields we may have added
var input = $("<input>").attr("type", "hidden").attr("name", inputName).val(sValue);
ofrm.append($(input));
}
else {
alert('form was not found');
}
}
function browserResize() {
var html_h = document.body.offsetHeight;
var foot_h = 0;
var tab_head_h = 0;
var inputList = 0;
var footjs = document.getElementById('popupWin_content_foot_js');
var tab_head_js = document.getElementById('TabContainer');
var inputListjs = document.getElementById('popupWin_content_scroll_js');
if (tab_head_js) {
tab_head_h = tab_head_js.clientHeight;
}
if (!footjs) {
footjs = document.getElementById('popupWin_foot_bttns_js');
}
if (footjs) {
foot_h = footjs.clientHeight;
}
if (inputListjs) {
inputList = inputListjs.clientHeight
var padding = 35;
var resize_h = html_h - foot_h - tab_head_h - padding;
inputListjs.style.height = resize_h + "px";
}
}
window.onresize = function () {
browserResize();
}
function TestPassword() {
var sPass = document.getElementById('txtPassword').value;
var hasupper = sPass.match(/[A-Z]/) ? 1 : 0;
var haslower = sPass.match(/[a-z]/) ? 1 : 0;
var hasnumber = sPass.match(/[0-9]/) ? 1 : 0;
var hassymbol = sPass.match(/[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]/) ? 1 : 0;
var hasmix = (hasupper && haslower) ? 1 : 0;
var strength = hasupper + haslower + hassymbol + hasnumber + hasmix;
if (sPass.length > 7) {
strength++;
}
var oS = document.getElementById('strength');
switch (strength) {
case 0:
oS.className = 'options_password_bar pw_very_weak';
oS.innerHTML = ' ' + t_('[ME_TXT-VeryWeak]');
break;
case 1:
oS.className = "options_password_bar pw_very_weak";
oS.innerHTML = ' ' + t_('[ME_TXT-VeryWeak]');
break;
case 2:
oS.className = "options_password_bar pw_weak";
oS.innerHTML = ' ' + t_('[ME_TXT-Weak]');
break;
case 3:
oS.className = "options_password_bar pw_medium";
oS.innerHTML = ' ' + t_('[ME_TXT-Medium]');
break;
case 4:
oS.className = "options_password_bar pw_average";
oS.innerHTML = ' ' + t_('[ME_TXT-Average]');
break;
case 5:
oS.className = "options_password_bar pw_strong";
oS.innerHTML = ' ' + t_('[ME_TXT-Strong]');
break;
default:
oS.className = "options_password_bar pw_very_strong";
oS.innerHTML = ' ' + t_('[ME_TXT-VeryStrong]');
break;
}
}
function convertSystemAddressToExternal(str) {
if (str.match("^\\[SMTP:")) {
return str.slice(6, -1);
}
return str;
}
/*
Client Side Control Rendering Functions
These are used to refresh values of lists and settings client side depending on the changes of value states
*/
function UpdateControl_DataTable(setting) {
if (setting.datatable) {
var settingsHTML = '';
var dataContainer = $("#tbldata_" + setting.id + " tbody")
if (dataContainer) {
$("#tbldata_" + setting.id + " tbody tr").remove(); //remove the rows, since we are updating them
//now for each row, we want to write out the table
$.each(setting.datatable.data, function (index, row) {
var settingsRowHTML = '';
var keyId = null;
var colindex = 0;
$.each(row, function (col, value) {
var bIsHidden = false;
var sWidth = '';
if (setting.datatable.columns[colindex].Display == 'hidden') {
bIsHidden = true;
}
if (bIsHidden) {
settingsRowHTML += "<td style=\"width: 0px;display:none;padding-left:0px;padding-right:0px;\">";
}
else {
sWidth = setting.datatable.columns[colindex].Width;
if (sWidth == '') {
sWidth = dt_defaultColWidth;
}
settingsRowHTML += "<td style=\"width: " + sWidth + ";\">";
}
if (!keyId) {
keyId = value;
}
if (setting.datatable.columns[colindex].OnRender) {
if (!(typeof setting.datatable.columns[colindex].OnRender === "function")) { setting.datatable.columns[colindex].OnRender = window[setting.datatable.columns[colindex].OnRender]; }
settingsRowHTML += setting.datatable.columns[colindex].OnRender(value)
}
else {
settingsRowHTML += value;
}
settingsRowHTML += "</td>";
colindex++;
});
settingsHTML += "<tr";
if (keyId) {
settingsHTML += " id=\"key_" + keyId + "\"";
}
settingsHTML += ">";
settingsHTML += settingsRowHTML;
settingsHTML += "<td width=\"*\"></td>";
settingsHTML += "</tr>";
});
dataContainer.append(settingsHTML);
}
setGridView('#tbldata_' + setting.id);
}
}
function UpdateControl_CheckList(setting) {
var settingsHTML = '';
if (setting.valueset) {
var i = 0;
var seperator = ' ';
if (setting.template == 'bindinglist') {
seperator = ';';
}
else if (setting.template == 'rdnsblacklists') {
seperator = ',';
}
var sSelectedValueList = setting.value.split(seperator);
$.each(setting.valueset, function (value, label) {
i++;
var cid = 'item_' + i;
var sChecked = "";
if ($.inArray(value, sSelectedValueList) != -1) {
sChecked = " checked=\"checked\"";
}
var sName = setting.id;
settingsHTML += '<div style=\"padding-top:2px;padding-bottom:2px\"><label for="' + cid + '\"><input type=\"checkbox\"' + sChecked + ' name=\"' + sName + '_' + i + '_Status\"/><span>' + label + '</span><input type=\"hidden\" name=\"' + sName + '\"';
//settings += ' value=\"' + value + '\"';
settingsHTML += '/></label></div>';
});
}
ExistingControl.empty();
ExistingControl.append(settingsHTML);
}
function UpdateControlState(setting) {
// This function sets the value of the control. This typically means deleting it's list of options and selecting the ones that are appropriate
var ExistingControl = $("#" + setting.id);
if (!ExistingControl.length) {
ExistingControl = $("#ctrl_" + setting.id); // more complex controls have a container around them, so we will look for that
}
if (ExistingControl.length) {
var settingsHTML = ''; //stores the values within the controlcontainer
if ((setting.control == "select") || (setting.control == "multiselect")) {
//need to go through options and select setting.value
if (setting.valueset) {
//alert('here22:' + setting.id + ':' + setting.value);
$.each(setting.valueset, function (value, label) {
settingsHTML += "<option";
if (setting.value == value) {
settingsHTML += " selected";
}
settingsHTML += " value=\"" + value + "\">" + label + "</option>";
});
}
ExistingControl.empty();
ExistingControl.append(settingsHTML);
}
else if (setting.control == "checklist") {
UpdateControl_CheckList(setting);
}
else if (setting.control == "checkbox") {
ExistingControl.attr('checked', setting.value == '1');
}
else if (setting.control == "datatable") {
//we need to update the control from JSON
UpdateControl_DataTable(setting);
}
else if (setting.control == "object") {
//sControlHTML = RenderControl_DataTable(setting);
if (setting.id == "filterRule") {
RenderControl_FilterRule(setting);
}
else {
RenderControl_FilterTask(setting);
}
}
}
else {
alert('Problem: An attempt was made to update control (' + setting.id + ') but it does not exist');
}
}
function alignHeadings(ctrlId) {
//iterate through each of the tbldata_globalFilters
var tblDataRow = $("#tbldata_" + ctrlId + " tr:first");
if (tblDataRow.length) {
//iterate through its tds
tblDataRow.children("td").each(function (j, otd) {
var HeadRow = jQuery("#tblhead" + ctrlId + " tr");
var col = HeadRow.find("td:eq(" + j + ")");
col.width(otd.clientWidth);
});
}
}
function RenderControl_DataTable(setting) {
var sControlHTML = '';
var sControlId = "ctrl_" + setting.id;
sControlHTML += "<div class=\"sysListTable_shell " + setting.template + "\" id=\"" + sControlId + "\">";
sControlHTML += "<table class=\"dataTable_table sysListTableHeader\" id=\"tblhead_" + setting.id + "\">";
sControlHTML += "<thead><tr class=\"sysListTable_tr\">";
if (setting.datatable) {
$.each(setting.datatable.columns, function (index, col) {
if (col.Display == 'hidden') {
sControlHTML += "<td style=\"width: 0;display:none;padding-left:0px;padding-right:0px;\">";
}
else {
var sWidth = col.Width;
if (sWidth == '') {
sWidth = dt_defaultColWidth;
}
sControlHTML += "<td style=\"width: " + sWidth + ";\">";
}
sControlHTML += col.Name
sControlHTML += "</td>";
});
}
else {
alert(setting.id + ': Client DataTable is not bound (JSON does not contain a datatable)');
}
sControlHTML += "<td width=\"*\"></td>";
sControlHTML += "</tr></thead>";
sControlHTML += "</table>";
sControlHTML += "<div class=\"sysListTable_scrollContent\" id=\"divData\">";
sControlHTML += "<table class=\"dataTable_table sysListTableData\" id=\"tbldata_" + setting.id + "\">";
sControlHTML += "<tbody>";
sControlHTML += "</tbody></table>";
sControlHTML += "</div>";
sControlHTML += "</div>";
return sControlHTML;
}
function RenderControl(setting, arrRenderOptions) {
//This function creates a control within a container in the browser. It is used to generate forms via JSON
var sControlHTML = '';
var labelalign = '';
var bContainerIsTable = true; //this is hardwired for now, but we may want to somehow communicate this to the client when we render.
var bShowLabel = true;
var bLabelAbove = false;
if (arrRenderOptions) {
if (arrRenderOptions.ShowLabel != null) {
bShowLabel = arrRenderOptions.ShowLabel;
}
if (arrRenderOptions.Table != null) {
bContainerIsTable = arrRenderOptions.InTable;
}
if (arrRenderOptions.LabelAbove != null) {
bLabelAbove = arrRenderOptions.LabelAbove;
}
}
var ExistingControl = $("#" + setting.id);
if (!ExistingControl.length) {
ExistingControl = $("#ctrl_" + setting.id); //some complex controls do not use the actual data as the container - things like gridview
}
if (!ExistingControl.length) {
if (setting.control == "select") {
sControlHTML = "<select name=\"" + setting.id + "\" id=\"" + setting.id + "\">";
sControlHTML += "</select>";
}
else if (setting.control == "checklist") {
labelalign = "valign=\"top\"";
sControlHTML = "<div id=\"" + setting.id + "\" class=\"checkboxes\" style=\"border:1px solid black;overflow-y:scroll; height:50px; padding-top:3px;\">";
sControlHTML += "</div>";
}
else if (setting.control == "datatable") {
sControlHTML = RenderControl_DataTable(setting);
}
else if (setting.control == "script") {
//alert(setting.id + ':' + setting.control);
sControlCSSClass = " class=\"scriptfield\"";
sControlHTML = "<textarea" + sControlCSSClass + " name=\"" + setting.id + "\" id=\"" + setting.id + "\">";
sControlHTML += setting.value;
sControlHTML += "</textarea>";
}
else {
var sControlValue = '';
var sControlCSSClass = " class=\"textfield\"";
var sInputType = setting.control;
var sValue = setting.value; // if it is a checkbox, then we want the value to be set to 1 - so that we get the value of 1 when we send it up
if (setting.control == "path") {
sInputType = "text";
sControlCSSClass = " class=\"pathfield\"";
} else if (setting.control == "checkbox") {
sValue = "1"; //we set it to 1, because forms will post 1 when checked - and will ommit when not checked
}
sControlHTML = "<input type=\"" + sInputType + "\"" + sControlCSSClass + " name=\"" + setting.id + "\" id=\"" + setting.id + "\" value=\"" + sValue + "\">";
}
// Place the control in the container
var sLabelHTML = "<label for=\"" + setting.id + "\">" + setting.label + "</label>";
var container = null;
if (setting.container) {
container = $("#" + setting.container);
}
else {
container = $("#IMAP_General");
}
if (bContainerIsTable) {
sControl = "<tr>";
if (bShowLabel) {
sControl += "<td " + labelalign + ">" + sLabelHTML + ":</td><td>";
}
else {
sControl += "<td colspan=\"2\">";
}
sControl += sControlHTML + "</td></tr>";
}
else {
sControl = "<span>";
if (bShowLabel) {
sControl += sLabelHTML + ": ";
if (bLabelAbove) {
sControl += "<br>";
}
}
sControl += sControlHTML + "</span>";
}
if (container) {
container.append(sControl);
}
else {
alert('container does not exit:' + setting.container);
}
//now do any actions, since the control has been added
if (setting.enablescontrols) {
//set the enabled/disabled state of the mentioned controls
$('#' + setting.id).change(function (event) {
EnableControls($(this), setting.enablescontrols);
});
}
if (setting.updatescontrols) {
//lets attempt to bind the change event of the control to the update contorl method
$('#' + setting.id).change(function (event) {
UpdateControls($(this), setting.updatescontrols);
});
}
}
//For now we will need to render the control and it's settings when we create it
UpdateControlState(setting);
}
function UpdateControls(source, controlnames) {
//passes some params from the initiator of the update to the fetch controls so that it knows how to apply the setting
if (controlnames) {
var sParams = null;
if (source) {
sParams = source.attr('id') + '=';
if (source.attr('type') == 'checkbox') {
sParams += (source.attr("checked") ? '1' : '0');
}
else {
sParams += source.val();
}
}
//we dont want to pass a filter because we are seeking by control
FetchControls(UpdateControlStates, null, controlnames, sParams);
}
}
function UpdateControlStates(oControls, sTargetContainers, arrRenderOptions) {
//we may split the target containers here and apply to updating control state
$.each(oControls.settings, function (key, setting) {
UpdateControlState(setting)
});
}
function GenerateControls(oControls, sTargetContainers, arrRenderOptions) {
if (oControls.settings) {
$.each(oControls.settings, function (key, setting) {
RenderControl(setting, arrRenderOptions)
});
}
else {
alert('Issue: Could not find controls');
}
}
function FetchControls(fnRenderer, sFilter, ControlNames, Params, sTargetContainers, arrRenderOptions) {
var sAction = "FETCH-SETTINGS&Format=JSON";
var validationToken = '<%=Session.Item("ME_VALIDATIONTOKEN")%>';
if (sFilter) {
sAction += '&Filter=' + sFilter
}
if (ControlNames) {
sAction += '&Controls=' + ControlNames
}
if (Params) {
sAction += '&Params=' + Params
}
if (sTargetContainers) {
sAction += '&Target=' + sTargetContainers
}
$.ajax({
type: 'GET',
url: getAppServletURL() + "?Cmd=" + sAction + '&ME_VALIDATIONTOKEN=' + validationToken,
dataType: 'json', async: false, cache: false,
success: function (data) { fnRenderer(data, sTargetContainers, arrRenderOptions); },
error: function (request, error) { console.log(arguments); alert(" Can't do because: " + error); }
//, complete: function (data) { alert('complete'); }
});
}
/*
$(document).ready(function () {
$('#chkDisableEnableElements').change(function () {
if ($('#chkDisableEnableElements').is(':checked')) {
enableElements($('#divDifferentElements').children());
}
else {
disableElements($('#divDifferentElements').children());
}
});
});
*/
function EnableControls(source, elList) {
//we should split this up into a list of controls (space delimited)
if (elList) {
var bIsChecked = false;
if (source.attr('type') == 'checkbox') {
bIsChecked = (source.is(':checked'));
}
else {
bIsChecked = (source.val() != 0);
}
var arr = elList.split(' ');
$.each(arr, function (key, value) {
if (bIsChecked) {
enableElements($('#' + value).parent().children());
}
else {
disableElements($('#' + value).parent().children());
}
});
}
}
function disableElements(el) {
for (var i = 0; i < el.length; i++) {
el[i].disabled = true;
disableElements(el[i].children);
}
}
function enableElements(el) {
for (var i = 0; i < el.length; i++) {
el[i].disabled = false;
enableElements(el[i].children);
}
}
function SubmitSettings(event, frmSelector, frmAction, arrParams, bClose, bAsynchronous) {
//form submits for checkboxes do not post the value (the ommision of the value implies that it is not set)
var bResult = true;
if (event) {
event.preventDefault();
}
if (bAsynchronous == null) {
bAsynchronous = true;
}
var sTargetURL = getAppServletURL();
var sMethod = 'POST';
var jqFormId = null;
var validationToken = '<%=Session.Item("ME_VALIDATIONTOKEN")%>';
if (!frmAction) {
frmAction = 'SET-SETTINGS';
}
if (!frmSelector) {
/* We were passed some params without a form selector, this means that we should do a get*/
if (arrParams) {
sMethod = 'GET';
}
else {
frmSelector = '#Settings';
}
}
var frmData = '';
if (frmSelector) {
jqFormId = $(frmSelector);
if (jqFormId) {
ClearHiddenFields(frmSelector);
AppendInputToForm(frmSelector, 'Cmd', frmAction);
if (arrParams != null) {
// we will append them to our post, post it and then remove them
$.each(arrParams, function (key, value) {
AppendInputToForm(frmSelector, key, value);
});
}
//note: disabled fields also will not be sent to the server
$(frmSelector + ' input[type=checkbox]').each(function () {
if (!this.checked) {
AppendInputToForm(frmSelector, 'unchecked.' + this.name, '0');
}
});
frmData = jqFormId.serialize();
}
else {
alert('not found');
}
}
else {
frmData = 'Cmd=' + frmAction;
if (arrParams != null) {
// we will append them to our post, post it and then remove them
$.each(arrParams, function (key, value) {
frmData += ('&' + key + '=' + value);
});
}
sMethod = 'GET';
console.log('issue:' + frmData);
}
if (sMethod == "GET") frmData += ('&ME_VALIDATIONTOKEN=' + validationToken);
//alert('frmData:' + frmData);
$.ajax({
type: sMethod,
url: sTargetURL,
data: frmData,
cache: false,
async: bAsynchronous,
success: function (response) {
//lets check the result for success or failure message.
var oResult = $(response).find('BASEELEMENT');
if (oResult.find('RETURN_VALUE').text() == '0')
{
if (getTopAppWindow) {
var taw = getTopAppWindow();
taw.ShowNotification(t_('[ME_TXT-Change(s)SavedOnServer!]'), false);
}
if (window.opener)
{
window.opener.returnValue = true;
}
if (bClose)
{
self.close();
}
}
else {
alert('Error:' + oResult.find('ERROR_DESCRIPTION').text());
bResult = false;
}
}
, error: function (jqXHR, sTextstatus, sErrorThrown) { alert('error:' + jqXHR.responseText); }
, complete: function (jqXHR, sTextstatus) { console.log('complete:' + jqXHR.responseText); }
});
if (arrParams != null) {
//removy params we added when we submitted
if (frmSelector) {
ClearHiddenFields(frmSelector);
$.each(arrParams, function (key, value) {
$(frmSelector + " input[type='hidden'][name='" + key + "']").remove();
});
}
}
return bResult;
}
function ValidateEmail(mail) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.emailAddr.value)) {
return (true)
}
alert("You have entered an invalid email address!")
return (false)
}
function ValidateIPaddress(ipaddress) {
if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(myForm.emailAddr.value)) {
return (true);
}
alert("You have entered an invalid IP address!")
return (false)
}
function addOptionToSelect(jqS, sKey, sVal) {
if (!sVal) {
sVal = sKey;
}
$(jqS).append($('<option>', { value: sKey }).text(sVal));
}
function addItemToList(formId, listId, Target, sPrompt) {
var sParams = prompt(sPrompt, '');
if (sParams) {
//submit to the new value to server, and add it to the list
var sSelector = null;
if (formId) {
sSelector = '#' + formId;
}
//could define the setting as array and then remove the options.
var arrParams = {};
arrParams['Items'] = sParams;
SubmitSettings(event, sSelector, Target + '-ADD', arrParams);
addOptionToSelect('#' + listId, sParams, sParams);
}
}
function addSelectOptions(jqSelector, sItems) {
if (sItems && (sItems.length > 0)) {
var sel = $(jqSelector);
if (sel.length) {
var arrItems = sItems.split(',');
$.each(arrItems, function (key, value) {
sel.append('<option value="' + value + '">' + value + '</option>');
});
}
}
}
function removeItemFromList(formId, listId, Target) {
var lstIPs = [];
$('#' + listId + ' :selected').each(function (i, selected) { lstIPs[i] = $(selected).text(); });
var sParams = lstIPs.join(",");
var sSelector = null;
if (formId) {
sSelector = '#' + formId;
}
var arrParams = {};
arrParams['Items'] = sParams;
SubmitSettings(event, sSelector, Target + '-REMOVE', arrParams);
jQuery.each(lstIPs, function (i, val) {
$("#" + listId + " option[value='" + val + "']").remove();
});
}
function removeIPFromList(formId, listId) {
var lstIPs = [];
$('#' + listId + ' :selected').each(function (i, selected) { lstIPs[i] = $(selected).text(); });
var sParams = lstIPs.join(",");
var arrParams = {};
arrParams['Items'] = sParams;
SubmitSettings(event, '#' + formId, 'IPLIST-REMOVE', arrParams);
jQuery.each(lstIPs, function (i, val) {
$("#" + listId + " option[value='" + val + "']").remove();
});
}
function addIPToList(formId, listId) {
var sParams = prompt('Please enter an IP Address', '');
if (sParams) {
var arrParams = {};
arrParams['Items'] = sParams;
//submit to the new value to server, and add it to the list
SubmitSettings(event, '#' + formId, 'IPLIST-ADD', arrParams);
//validate the ip address here?
$('#' + listId).append($('<option>', { value: sParams }).text(sParams));
}
}
function setGridView(tblData) {
//unbind so we do not double up on row selectors
$(tblData + " tr").unbind("click");
$(tblData + " tr").click(function () {
var selected = $(this).hasClass("highlight");
$(tblData + " tr").removeClass("highlight");
if (!selected)
$(this).addClass("highlight");
});
}
function addGridViewRow(jqTable, arrData) {
//adds a row to the table (might be better as an array of values
var sTDs = '';
$.each(arrData, function (i, item) {
sTDs += '<td'
sTDs += ' style=\"width: 70px;\">'; //should use CSS here
sTDs += (item + '</td>');
});
$(jqTable).append('<tr>' + sTDs + '<td></td></tr>');
}
function removeSelectedRows(jqTableId, className) {
var selectedRows = $(jqTableId + " tr[class='" + className + "']");
selectedRows.remove();
}
function getSelectedRow(jqTableId, className) {
//gets the details for the selected row, forming it as a comma delimited list
var selectedRows = $(jqTableId + " tr[class='" + className + "']");
var values = [];
selectedRows.each(function (i, obj) {
//need to iterate all the rows to get a list of the data
selectedRows.children("td").each(function (j, otd) {
values.push(otd.innerHTML);
});
});
values.pop(); //remove the last one (since it contains the formatting row)
return (values);
}
function formatPortData(arrValues) {
$.each(arrValues, function (i, item) {
if ((item == 'on') || (item == 'Never')) {
arrValues[i] = '1';
} else if ((item == 'off') || (item == 'Always')) {
arrValues[i] = '0';
}
else if (item == 'Secure') {
arrValues[i] = '2'; //secure
}
});
}
function AddPortBinding(event, ctrlId) {
//get the values and then add them (need to validate as well)
var sNewPort = $("#port_no").val();
if (sNewPort.length <= 0) {
alert('Port must contain a value');
return;
}
var sPortSettings = $("#smtpAdditionalPorts").val();
var arrPortSettings = [];
if (sPortSettings.length > 0) {
arrPortSettings = sPortSettings.split(';');
}
//get new value to add to settings list
var arrValues = [];
arrValues.push(sNewPort);
arrValues.push($("#port_auth").attr("checked") ? 'on' : 'off');
arrValues.push($("#port_ssl").attr("checked") ? 'on' : 'off');
arrValues.push($("#port_authmode").val());
addGridViewRow('#tbldata_' + ctrlId, arrValues);
setGridView('#tbldata_' + ctrlId);
//convert to actual data
formatPortData(arrValues);
arrPortSettings.push(arrValues.join(','));
sPortSettings = arrPortSettings.join(';');
$("#smtpAdditionalPorts").val(sPortSettings);
oPortSettingsDlg.Close();
}
function RemovePort(event, ctrlId) {
event.preventDefault();
var arrValues = getSelectedRow('#tbldata_' + ctrlId, 'highlight');
if (arrValues.length > 0) {
//convert to actual data
formatPortData(arrValues);
var arrPortSettings = [];
var sPortSettings = $("#smtpAdditionalPorts").val();
if (sPortSettings.length > 0) {
arrPortSettings = sPortSettings.split(';');
}
var Target = arrValues.join(',');
arrPortSettings = jQuery.grep(arrPortSettings, function (value) {
return value != Target;
});
sPortSettings = arrPortSettings.join(';');
$("#smtpAdditionalPorts").val(sPortSettings);
removeSelectedRows('#tbldata_' + ctrlId, 'highlight');
}
else {
alert('Please select a row');
}
}
function RemoveBlockedIP(event) {
event.preventDefault();
var sParams = prompt(sPrompt, '');
if (sParams) {
var arrParams = {};
arrParams['Items'] = sParams;
SubmitSettings(event, sSelector, 'IPBLOCK-REMOVE', arrParams);
}
}
function ResetSessionTimeout() {
if (getTopAppWindow) {
var taw = getTopAppWindow();
if (taw && taw.oTimeoutDialog) {
taw.oTimeoutDialog.ResetSession();
}
}
else {
alert('no taw');
}
}
</script>
</head>
<asp:ContentPlaceHolder ID="CustomSiteMainContent" runat="server"></asp:ContentPlaceHolder>
</html>