| 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/Forms/ |
Upload File : |
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Mondo/lang/sys/Controls/ListView.Master" CodeBehind="FilterSettings.aspx.vb" Inherits="MailEnable.Clients.WebAdmin.FilterSettings" %>
<asp:Content ID="CustomHeader" ContentPlaceHolderID="CustomHeader" runat="server">
<script type="text/javascript">
var oCriteriaDlg = null;
var oFilterDetailsDlg = null;
var oFilterNewDlg = null;
var oActionDlg = null;
var g_opt={}; g_opt['ME_VALIDATIONTOKEN'] = '<%=Session.Item("ME_VALIDATIONTOKEN")%>'; //could be moved to masterpage
var mParams = {}; //used to store params that are global so we can use with dialogs
<%=GetList()%>
$(document).ready(function () {
mParams['Postoffice']='<%=Postoffice %>';
mParams['Mailbox']='<%=Mailbox %>';
jsonList_Init(<%= GetListId()%>);
oCriteriaDlg = new Dialog("dlg_CriteriaDialog", 'Criteria Dialog', $("#divCriteriaDialog"), { Width: 510 });
//in the first instance we want to submit the details
oCriteriaDlg.AddOKAndCancelActions( function (event) { doAction_EditRule(event);}, function (event) { doAction_Close(event,oFilterNewDlg); }, 'OK', 'Cancel', false);
oFilterDetailsDlg = new Dialog("dlg_FilterDetailsDialog", 'Filter Dialog', $("#divFilterDetails"), { Width: 810 });
oActionDlg = new Dialog("dlg_ActionDialog", 'Action Dialog', $("#divActionDialog"), { Width: 510 });
//oActionDlg.AddOKAndCancelActions(function () {doAction_EditTask(event);}, function (event) { doAction_Close(event, oFilterNewDlg); }, 'OK', 'Cancel', false);
$("#btnTaskAction").click(dlgAction_EditTask);
$("#btnTaskClose").click(function () { event.preventDefault(); oActionDlg.Close();});
oFilterNewDlg = new Dialog("dlg_oFilterNewDlg", 'New Filter Dialog', $("#dvFormDetails"), { Width: 510 });
oFilterNewDlg.SetTitle('New Filter');
oFilterNewDlg.AddOKAndCancelActions(function () {Action_AddFilter(event);}, function (event) { doAction_Close(event,oFilterNewDlg); }, 'OK', 'Cancel', false);
$("#dvGlobalActions").show();
$("#btnRefreshList").click(RefreshFilterList);
$("#filterTaskType").click(
function(event) { ToggleTaskPanels($("#filterTaskType").val());});
BrowserResize();
});
function doPreventDefault(event) {
if (event != undefined)
{
if (event.preventDefault) {
event.preventDefault();
}
else
{
event.cancelBubble = true;
event.returnValue = false;
}
}
}
function doAction_Close(event,oDlg)
{
doPreventDefault(event);
oDlg.Close();
}
function doAction_EditRule(event)
{
doPreventDefault(event);
$('#jsList option').attr('selected', true);
SubmitSettings(event, '#CriteriaDialog', 'EDIT-FILTER-RULE', mParams);
RefreshCriteria();
oCriteriaDlg.Close();
}
function UpdateJSONObject(jObj, sAction)
{
$.ajax({ type: 'GET',url: getAppServletURL() + "?Cmd=" + sAction + '&ME_VALIDATIONTOKEN=' + getTopAppWindow().g_opt['ME_VALIDATIONTOKEN'], dataType: 'json', cache: false, async: false, success: function (data) { jObj.data = data; } });
}
function RefreshFilterList()
{
var jObj = {};
var sParams = '';
if (mParams['Postoffice']) sParams += ('&Postoffice=' + mParams['Postoffice']);
if (mParams['Mailbox']) sParams += ('&Mailbox=' + mParams['Mailbox']);
UpdateJSONObject(jObj, "LIST-FILTERS&Format=JSON" + sParams);
if (jObj.data)
{
<%= GetListId()%> = jObj.data;
//now redraw it
jsonList_ShowData(<%= GetListId()%>);
}
else
{
alert('Request returned no data');
}
}
function doAction_DeleteFilter(oItem, oAction, selectedIndex)
{
if (confirm('Are you sure you want to delete this filter?'))
{
var arrParams = {};
arrParams['FilterEntryId'] = oItem.FilterEntryID;
if (mParams['Postoffice']) arrParams['Postoffice'] = mParams['Postoffice'];
if (mParams['Mailbox']) arrParams['Mailbox'] = mParams['Mailbox'];
if (SubmitSettings(event, null, 'DELETE-FILTER', arrParams))
{
RefreshFilterList();
}
}
}
function GetAvailableActions(oItem)
{
var arrActions = {};
if (oItem)
{
arrActions["Edit"] = 1;
arrActions["MoveUp"] = 1;
arrActions["MoveDown"] = 1;
arrActions["Rename"] = 1;
arrActions["Delete"] = 1;
switch(oItem.Status)
{
case '1':
arrActions["Disable"] = 1;
arrActions["Enable"] = 0;
break;
default:
arrActions["Disable"] = 0;
arrActions["Enable"] = 1;
}
}
return arrActions;
}
function Action_AddFilter(event)
{
event.preventDefault();
var arrParams = {};
if (mParams['Postoffice']) arrParams['Postoffice'] = mParams['Postoffice'];
if (mParams['Mailbox']) arrParams['Mailbox'] = mParams['Mailbox'];
if (SubmitSettings(event, '#NewFilterDetails', 'ADD-FILTER', arrParams))
{
RefreshFilterList();
oFilterNewDlg.Close();
}
}
function doAction_AddFilter()
{
$("#jsFilterName").val("");
//$("#jsFilterName").focus(); //does not work
oFilterNewDlg.Show(true);
return true;
}
function doAction_DisableFilter(oItem, oAction, selectedIndex)
{
var arrParams = {};
arrParams['FilterEntryId'] = oItem.FilterEntryID;
arrParams['State'] = '0';
arrParams['Target'] = 'Filter';
if (mParams['Postoffice']) arrParams['Postoffice'] = mParams['Postoffice'];
if (mParams['Mailbox']) arrParams['Mailbox'] = mParams['Mailbox'];
if (SubmitSettings(event, null, 'SET-STATE', arrParams))
{
RefreshFilterList();
}
return true;
}
function filteractionstable_Status_OnRender(s)
{
if (s=='0')
{
return 'Disabled';
}
return 'Enabled';
}
function doAction_EnableFilter(oItem, oAction, selectedIndex)
{
var arrParams = {};
arrParams['FilterEntryId'] = oItem.FilterEntryID;
arrParams['State'] = '1';
arrParams['Target'] = 'Filter';
if (mParams['Postoffice']) arrParams['Postoffice'] = mParams['Postoffice'];
if (mParams['Mailbox']) arrParams['Mailbox'] = mParams['Mailbox'];
if (SubmitSettings(event, null, 'SET-STATE', arrParams))
{
RefreshFilterList();
}
return true;
}
function doAction_RenameFilter(oItem, oAction, selectedIndex)
{
var arrParams = {};
var sNewName = prompt("Please enter the filter name:", oItem.Description);
if (sNewName)
{
if (sNewName.length > 0)
{
arrParams['FilterEntryId'] = oItem.FilterEntryID;
arrParams['FilterName'] = sNewName;
if (mParams['Postoffice']) arrParams['Postoffice'] = mParams['Postoffice'];
if (mParams['Mailbox']) arrParams['Mailbox'] = mParams['Mailbox'];
//assign so we can use on any prospective child form
mParams['FilterEntryId'] = arrParams['FilterEntryId'];
if (SubmitSettings(event, null, 'RENAME-FILTER', arrParams))
{
RefreshFilterList();
}
}
else
{
alert('Invalid Filter Name');
}
}
return true;
}
function doAction_MoveFilterUp(oItem, oAction, selectedIndex)
{
var newPosition = selectedIndex-1;
if (newPosition >= 0)
{
//Call server method to set the filter position
var arrParams = {};
arrParams['FilterEntryId'] = oItem.FilterEntryID;
arrParams['Pos'] = selectedIndex;
if (mParams['Postoffice']) arrParams['Postoffice'] = mParams['Postoffice'];
if (mParams['Mailbox']) arrParams['Mailbox'] = mParams['Mailbox'];
SubmitSettings(null, null, 'SET-FILTER-POS', arrParams);
var temp = jsonList.Items[newPosition];
jsonList.Items[newPosition] = jsonList.Items[selectedIndex];
jsonList.Items[selectedIndex] = temp;
jsonList_SelectItem(jsonList, newPosition);
jsonList_ShowData(jsonList);
}
else
{
alert('Invalid position');
}
return true;
}
function doAction_MoveFilterDown(oItem, oAction, selectedIndex)
{
var newPosition = selectedIndex+1;
if (newPosition < jsonList.Items.length)
{
var arrParams = {};
arrParams['FilterEntryId'] = oItem.FilterEntryID;
arrParams['Pos'] = newPosition+1;
if (mParams['Postoffice']) arrParams['Postoffice'] = mParams['Postoffice'];
if (mParams['Mailbox']) arrParams['Mailbox'] = mParams['Mailbox'];
SubmitSettings(null, null, 'SET-FILTER-POS', arrParams);
var temp = jsonList.Items[newPosition];
jsonList.Items[newPosition] = jsonList.Items[selectedIndex];
jsonList.Items[selectedIndex] = temp;
jsonList_SelectItem(jsonList, newPosition);
jsonList_ShowData(jsonList);
}
else
{
alert('Invalid position');
}
return true;
}
function doAction_OpenFilter(oItem, oAction, selectedIndex)
{
var sParams = 'FilterEntryId=' + oItem.FilterEntryID;
sParams += ',CriteriaId=' + oItem.CriteriaID;
sParams += ',ActionId=' + oItem.ActionID;
sParams += ',FilterType=' + oItem.FilterType;
if (mParams['Postoffice']) sParams += ',Postoffice=' + mParams['Postoffice'];
if (mParams['Mailbox']) sParams += ',Mailbox=' + mParams['Mailbox'];
$("#tdFilterCriteriaType").empty();
$("#tdFilterCriteria").empty();
$("#tdFilterScript").empty();
$("#tdFilterActions").empty();
FetchControls(GenerateControls, null, "filterCriteriaType filterCriteria filterCriteriaScript filterActions", sParams, "tdFilterCriteriaType tdFilterCriteria tdFilterScript tdFilterActions", { ShowLabel: false,Table:false,LabelAbove:true });
ToggleCriteriaType(null);
$('#filterCriteriaType').click(ToggleCriteriaType);
$('#filterCriteriaType').change(SaveCriteriaType);
oFilterDetailsDlg.SetTitle('Filter: ' + oItem.Description);
mParams['FilterEntryId'] = oItem.FilterEntryID;
mParams['CriteriaId'] = oItem.CriteriaID;
mParams['ActionID'] = oItem.ActionID;
mParams['FilterType'] = oItem.FilterType;
oFilterDetailsDlg.Show(true);
}
function ToggleCriteriaType(event) {
if ($('#filterCriteriaType').val() == "Standard") {
//hide script
$('#tblFilterCriteria').show();
$('#tblFilterScript').hide();
}
else {
//hide standard
$('#tblFilterCriteria').hide();
$('#tblFilterScript').show();
}
}
function SaveCriteriaType(event) {
if ($('#filterCriteriaType').val() == "Standard") {
SubmitSettings(null, null, 'SAVE-FILTER-STANDARD', mParams);
}
else {
SubmitSettings(null, null, 'SAVE-FILTER-SCRIPTED', mParams);
}
}
function doShowCriteria(event) {
//opens the criteria for a filter (assuming it is not scripted)
event.preventDefault();
var arrValues = getSelectedRow('#tbldata_' + 'filterCriteria', 'highlight');
if (arrValues.length > 0) {
var sParams = 'CriteriaId=' + arrValues[0];
sParams += ',RuleId=' + arrValues[1];
if (mParams['Postoffice']) sParams += ',Postoffice=' + mParams['Postoffice'];
if (mParams['Mailbox']) sParams += ',Mailbox=' + mParams['Mailbox'];
FetchControls(GenerateControls, null, "filterRule", sParams, "filterRule");
if (oCriteriaDlg) {
$('#jsList').attr('selected', false); //remove seletions
SetRuleView(arrValues[1]);
mParams['RuleId']=arrValues[1];
oCriteriaDlg.Show(true);
}
}
else {
alert('Filter Rule not selected');
}
}
function RefreshCriteria(){
if (mParams['CriteriaId']) {
var sParams = 'CriteriaId=' + mParams['CriteriaId'];
if (mParams['Postoffice']) sParams += ',Postoffice=' + mParams['Postoffice'];
if (mParams['Mailbox']) sParams += ',Mailbox=' + mParams['Mailbox'];
FetchControls(GenerateControls, null, "filterCriteria", sParams, "filterCriteria");
}
else
{
alert('No filter selected');
}
}
function RefreshActions(){
if (!mParams['ActionID']) {
mParams['ActionID'] = mParams['CriteriaId'];
}
if (mParams['ActionID']) {
var sParams = 'ActionId=' + mParams['ActionID']; //not sure which one we need
if (mParams['Postoffice']) sParams += ',Postoffice=' + mParams['Postoffice'];
if (mParams['Mailbox']) sParams += ',Mailbox=' + mParams['Mailbox'];
FetchControls(GenerateControls, null, "filterActions", sParams, "filterActions");
}
else
{
alert('No filter selected');
}
}
function doAction_MoveTaskUp(event)
{
event.preventDefault();
var arrValues = getSelectedRow('#tbldata_' + 'filterActions', 'highlight');
if (arrValues.length > 0) {
var arrParams = {};
arrParams['ActionId'] = arrValues[0];
arrParams['TaskId'] = arrValues[1];
arrParams['RelPos'] = -1;
if (mParams['Postoffice']) arrParams['Postoffice'] = mParams['Postoffice'];
if (mParams['Mailbox']) arrParams['Mailbox'] = mParams['Mailbox'];
SubmitSettings(event, null, 'SET-TASK-POS', arrParams,false,false);
RefreshActions();
}
}
function doAction_MoveTaskDown(event)
{
event.preventDefault();
var arrValues = getSelectedRow('#tbldata_' + 'filterActions', 'highlight');
if (arrValues.length > 0) {
var arrParams = {};
arrParams['ActionId'] = arrValues[0];
arrParams['TaskId'] = arrValues[1];
arrParams['RelPos'] = 1;
if (mParams['Postoffice']) arrParams['Postoffice'] = mParams['Postoffice'];
if (mParams['Mailbox']) arrParams['Mailbox'] = mParams['Mailbox'];
SubmitSettings(event, null, 'SET-TASK-POS', arrParams,false,false);
RefreshActions();
}
}
function doAction_AddTask(event)
{
event.preventDefault();
if (!mParams['ActionID']) {
mParams['ActionID'] = mParams['CriteriaId'];
}
if (mParams['ActionID']) {
var arrParams = {};
//need to bind newfilter action to to OK button? done somewhere else.
if (oActionDlg) {
$("#btnTaskAction").unbind();
$("#btnTaskAction").click(dlgAction_AddTask);
oActionDlg.SetTitle('New Action');
ClearControl_FilterTask();
ToggleTaskPanels($("#filterTaskType").val());
arrParams['FormAction'] = 'Add';
arrParams['ActionId'] = mParams['ActionID'];
arrParams['TaskId'] = '';
if (mParams['Postoffice']) arrParams['Postoffice'] = mParams['Postoffice'];
if (mParams['Mailbox']) arrParams['Mailbox'] = mParams['Mailbox'];
//lets set the checkbox to enabled
$("#jsTaskEnabled").attr("checked","checked");
oActionDlg.Show(true);
}
}
else
{
alert('Filter not found');
}
}
function doAction_DeleteTask(event)
{
event.preventDefault();
var arrValues = getSelectedRow('#tbldata_' + 'filterActions', 'highlight');
if (arrValues.length > 0)
{
if (confirm('Are you sure you want to delete this action?'))
{
var arrParams = {};
arrParams['FormAction'] = 'Delete';
arrParams['ActionId'] = arrValues[0];
arrParams['TaskId'] = arrValues[1];
if (mParams['Postoffice']) arrParams['Postoffice'] = mParams['Postoffice'];
if (mParams['Mailbox']) arrParams['Mailbox'] = mParams['Mailbox'];
//add postoffice here?
SubmitSettings(event, null, 'DELETE-FILTER-ACTION', arrParams);
RefreshActions();
}
}
}
function doAction_EditTask(event) {
//opens the action of the filter
event.preventDefault();
var arrValues = getSelectedRow('#tbldata_' + 'filterActions', 'highlight');
if (arrValues.length > 0) {
$("#btnTaskAction").unbind();
$("#btnTaskAction").click(dlgAction_EditTask);
var sParams = 'ActionId=' + arrValues[0];
sParams += ',TaskId=' + arrValues[1];
if (mParams['Postoffice']) sParams += ',Postoffice=' + mParams['Postoffice'];
if (mParams['Mailbox']) sParams += ',Mailbox=' + mParams['Mailbox'];
FetchControls(GenerateControls, null, "filterTask", sParams, "filterTask");
if (oActionDlg) {
oActionDlg.SetTitle('Edit Action');
mParams['ActionID'] = arrValues[0];
mParams['TaskId'] = arrValues[1];
oActionDlg.Show(true);
}
}
else {
alert('Filter Action not selected');
}
}
function dlgAction_AddTask(event)
{
event.preventDefault();
SubmitSettings(event, '#ActionDialog', 'ADD-FILTER-ACTION', mParams);
RefreshActions();
oActionDlg.Close();
}
function dlgAction_EditTask(event)
{
event.preventDefault();
SubmitSettings(event, '#ActionDialog', 'EDIT-FILTER-ACTION', mParams);
RefreshActions();
oActionDlg.Close();
}
var RuleIds = {
CRITERIA_SUBJECT: 1,
CRITERIA_BODY: 2,
CRITERIA_TO: 3,
CRITERIA_CC: 4,
CRITERIA_TOorCC: 5,
CRITERIA_PRIORITY: 6,
CRITERIA_FROM: 7,
CRITERIA_SIZE: 8,
CRITERIA_HASATTACHMENTSMATCHING: 9,
CRITERIA_HASANATTACHMENT: 10,
CRITERIA_SECURE: 11,
CRITERIA_HEADERS_CONTAIN: 12,
CRITERIA_SPAM_PROBABILITY: 13,
CRITERIA_SPFMATCH: 14,
CRITERIA_HASVIRUS: 15,
CRITERIA_ALLMESSAGES: 16,
CRITERIA_SENDERAUTH: 17,
CRITERIA_IPADDRESS: 18,
CRITERIA_ACCOUNT: 19,
CRITERIA_CONNECTOR: 20,
CRITERIA_HASSBLRBL: 21,
CRITERIA_BOUNDARYHEADER_CONTAIN: 22,
CRITERIA_IPADDRESS_WHITELISTED: 23,
CRITERIA_DOMAINKEY_MATCH: 24,
CRITERIA_SPAMASSASSIN_MATCH: 25,
CRITERIA_COUNTRY_MATCH: 26,
CRITERIA_COUNTRY_NOMATCH: 27
};
function SetRuleView(sView) {
//changes what controls are enabled depending on the RuleId/Index
var iView = parseInt(sView, 10);
$("#divCriteriaDialog .FilterCriteria").hide();
switch (iView)
{
case RuleIds.CRITERIA_SUBJECT:
case RuleIds.CRITERIA_BODY:
case RuleIds.CRITERIA_TO:
case RuleIds.CRITERIA_CC:
case RuleIds.CRITERIA_TOorCC:
case RuleIds.CRITERIA_FROM:
case RuleIds.CRITERIA_HEADERS_CONTAIN:
case RuleIds.CRITERIA_BOUNDARYHEADER_CONTAIN:
{
$("#jsItem").val('');
$("#jsRuleSourceWordFileReference").show();
$("#jsRuleSourceWordFile").show();
$("#jsRuleSourceWordList").show();
$("#jsCriteria_wordlist").show();
break;
}
case RuleIds.CRITERIA_PRIORITY:
{
$("#jsCriteria_priority").show();
break;
}
case RuleIds.CRITERIA_SPFMATCH:
{
$("#jsCriteria_SPF").show();
break;
}
case RuleIds.CRITERIA_ACCOUNT:
{
$("#jsCriteria_postoffice").show();
break;
}
case RuleIds.CRITERIA_CONNECTOR:
{
$("#jsCriteria_Connector").show();
break;
}
case RuleIds.CRITERIA_DOMAINKEY_MATCH:
{
$("#jsCriteria_DKIM").show();
break;
}
case RuleIds.CRITERIA_COUNTRY_MATCH:
case RuleIds.CRITERIA_COUNTRY_NOMATCH:
{
$("#jsCriteria_CountryMatch").show();
break;
}
case RuleIds.CRITERIA_SIZE:
{
$("#jsCriteria_SizeMatch").show();
break;
}
case RuleIds.CRITERIA_SPAM_PROBABILITY:
{
$("#jsCriteria_SpamProbabilityMatch").show();
break;
}
case RuleIds.CRITERIA_IPADDRESS:
{
$("#jsCriteria_IPMatch").show();
break;
}
case RuleIds.CRITERIA_HASATTACHMENTSMATCHING:
{
$("#jsItem").val('');
$("#jsRuleSourceWordFileReference").hide();
$("#jsRuleSourceWordFile").hide();
$("#jsRuleSourceWordWordList").hide();
$("#jsCriteria_wordlist").show();
break;
}
case RuleIds.CRITERIA_SECURE:
case RuleIds.CRITERIA_HASVIRUS:
case RuleIds.CRITERIA_ALLMESSAGES:
case RuleIds.CRITERIA_HASANATTACHMENT:
case RuleIds.CRITERIA_SENDERAUTH:
case RuleIds.CRITERIA_HASSBLRBL:
case RuleIds.CRITERIA_IPADDRESS_WHITELISTED:
case RuleIds.CRITERIA_SPAMASSASSIN_MATCH:
{
break;
}
default:
{
alert('Error: Unknown Rule Id (some sort of data integrity error)');
}
}
}
function ClearControl_FilterRule() {
$("#jsDescription").text('');
}
function RenderControl_FilterRule(setting) {
ClearControl_FilterRule();
$("#jsDescription").text(setting.object.Description);
$("#jsEnabled").attr("checked", (setting.object.Status == '1'));
//empty the list
$('#jsList').empty();
if (setting.object.Reference) {
//set the dropdown
$('#fileReference').val('GENERAL');
$('#rulesource_words').attr('checked', '');
$('#rulesource_file').attr('checked', 'checked');
}
else {
$('#rulesource_file').attr('checked', '');
$('#rulesource_words').attr('checked', 'checked');
addSelectOptions("#jsList", setting.object.Values);
}
}
function ClearControl_FilterTask() {
$("#jsTaskDescription").val('');
$("#filterTaskType").val('');
$("#filterTaskHeaderName").val('');
$("#filterTaskExecuteCommand").val('');
$("#filterTaskHeaderValue").val('');
$("#filterTaskExecuteParameters").val('');
$("#filterTaskSubjectPrefix").val('');
$("#filterTaskAddress").val('');
}
function ToggleTaskPanels(sTaskType)
{
$("#jsTask_Folder").hide();
$("#jsTask_Address").hide();
$("#jsTask_Message").hide();
$("#jsTask_Prefix").hide();
$("#jsTask_Execute").hide();
$("#jsTask_Header").hide();
if (sTaskType == 'ADD_HEADER') {
$("#jsTask_Header").show();
}
else if ((sTaskType == 'MOVE') || (sTaskType == 'COPY')) {
$("#jsTask_Folder").show();
} else if ((sTaskType == 'NOTIFY_ADDRESS') || (sTaskType == 'FORWARD_TO_ADDRESS')) {
$("#jsTask_Address").show();
} else if (sTaskType == 'ADD_SUBJECT_PREFIX') {
$("#jsTask_Prefix").show();
}
else if (sTaskType == 'EXECUTE_APPLICATION') {
$("#jsTask_Execute").show();
}
}
function RenderControl_FilterTask(setting) {
ClearControl_FilterTask();
$("#jsTaskDescription").text(setting.object.Description);
$("#jsTaskEnabled").attr("checked", (setting.object.Status == '1'));
$("#filterTaskType").val(setting.object.TaskType);
$("#filterTaskSubjectPrefix").val(setting.object.Values);
$("#filterTaskMessageText").val(setting.object.Values);
$("#filterTaskAddress").val(setting.object.Values);
$("#filterTaskFolder").val(setting.object.Values);
ToggleTaskPanels(setting.object.TaskType);
if (setting.object.TaskType == 'ADD_HEADER') {
if (setting.object.Values) {
var arrValues = setting.object.Values.split("|");
$("#filterTaskHeaderName").val(arrValues[0]);
if (arrValues.length > 1)
{
$("#filterTaskHeaderValue").val(arrValues[1]);
}
}
}
else if ((setting.object.TaskType == 'MOVE') || (setting.object.TaskType == 'COPY')) {
$("#filterTaskFolder").val(setting.object.Values);
} else if ((setting.object.TaskType == 'NOTIFY_ADDRESS') || (setting.object.TaskType == 'FORWARD_TO_ADDRESS')) {
$("#filterTaskAddress").val(convertSystemAddressToExternal(setting.object.Values));
} else if (setting.object.TaskType == 'ADD_SUBJECT_PREFIX') {
$("#filterTaskSubjectPrefix").val(setting.object.Values);
}
else if (setting.object.TaskType == 'EXECUTE_APPLICATION') {
if (setting.object.Values)
{
var arrValues = setting.object.Values.split("|");
$("#filterTaskExecuteCommand").val(arrValues[0]);
if (arrValues.length > 1)
{
$("#filterTaskExecuteParameters").val(arrValues[1]);
}
}
}
}
function onStatusRender(item, sValue)
{
switch(sValue)
{
case "0": return "Disabled";
case "1": return "Enabled";
default: return "(" + sValue + "):Unknown";
}
}
function doSaveScript(event)
{
event.preventDefault();
SubmitSettings(event, '#FilterDetails', 'SAVE-FILTER-SCRIPT', mParams);
}
function doCheckScript(event)
{
event.preventDefault();
SubmitSettings(event, '#FilterDetails', 'CHECK-FILTER-SCRIPT', mParams);
}
</script>
</asp:Content>
<asp:Content ID="ListTitle" ContentPlaceHolderID="ListTitle" runat="server">
Filter Settings
</asp:Content>
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
<div id="divFilterDetails" style="height:620px">
<form id="FilterDetails" name="FilterDetails" action=""><%MailEnable.Utilities.WriteFormValidationField(Response, Session.SessionID, Session.Item("ME_VALIDATIONTOKEN"))%>
<table class="SettingsTable">
<tr><td>Filter Type:</td><td id="tdFilterCriteriaType"></td></tr>
</table>
<!--
<table id="tblFilterDetails" class="SettingsTable">
</table>
-->
<table id="tblFilterCriteria" class="SettingsTable">
<tr><td colspan="2">Rules:</td></tr>
<tr><td id="tdFilterCriteria" colspan="2"></td></tr>
<tr><td colspan="2" align="right"><button id="btnShowCriteria" onclick="doShowCriteria(event)">Edit Rule</button></td></tr>
</table>
<table id="tblFilterScript" class="SettingsTable">
<tr><td colspan="2">Script:</td></tr>
<tr><td id="tdFilterScript" colspan="2"></td></tr>
<tr><td colspan="2" align="right"><button id="btnCheckScript" onclick="doCheckScript(event)">Check Script</button> <button id="btnSaveScript" onclick="doSaveScript(event)">Save Script</button></td></tr>
</table>
<table id="tblFilterActions" class="SettingsTable">
<tr><td colspan="2">Actions:</td></tr>
<tr><td id="tdFilterActions" colspan="2"></td></tr>
<tr><td colspan="2" align="right">
<button id="btnMoveUpTask" onclick="doAction_MoveTaskUp(event)">Move Up</button>
<button id="btnMoveDownTask" onclick="doAction_MoveTaskDown(event)">Move Down</button>
<button id="btnAddTask" onclick="doAction_AddTask(event)">Add Action</button>
<button id="btnDeleteTask" onclick="doAction_DeleteTask(event)">Delete Action</button>
<button id="btnEditTask" onclick="doAction_EditTask(event)">Edit Action</button>
</td></tr>
</table>
<table id="tblFilterButtons" class="SettingsTable">
</table>
</form>
</div>
<div id="dvFormDetails">
<form id="NewFilterDetails" name="NewFilterDetails" action=""><%MailEnable.Utilities.WriteFormValidationField(Response, Session.SessionID, Session.Item("ME_VALIDATIONTOKEN"))%>
<table class="SettingsTable" >
<tr><td>Filter Name:</td><td id="tdFilterName"><input id="jsFilterName" name="FilterName" type="text"/></td></tr>
<tr><td>Enabled:</td><td id="tdFilterStatus"><input id="jsFilterStatus" type="checkbox" name="FilterStatus" checked="checked"/></td></tr>
</table>
</form>
</div>
<div id="divCriteriaDialog"><form id="CriteriaDialog" name="CriteriaDialog" action=""><%MailEnable.Utilities.WriteFormValidationField(Response, Session.SessionID, Session.Item("ME_VALIDATIONTOKEN"))%>
<input id="RuleId" name="RuleId" type="hidden" />
<table class="SettingsTable" id="filterRule">
<tr><td colspan="2"><div id="jsDescription"></div></td></tr>
<tr><td colspan="2"><input id="jsEnabled" name="enabled" type="checkbox"/> Enabled</td></tr>
</table>
<table class="SettingsTable FilterCriteria" id="jsCriteria_wordlist">
<tr id="jsRuleSourceWordList"><td colspan="2"><input id="rulesource_words" name="rulesource" type="radio" value="list"/>Word List</td></tr>
<tr><td><input id="jsItem" name="jsItem" style="width:300px"/></td><td><button id="addItem" onclick="event.preventDefault(); addOptionToSelect('#jsList',$('#jsItem').val());">Add</button></td></tr>
<tr><td><select id="jsList" name="jsList" style="height:200px;width:300px" size="15" multiple="multiple"></select></td><td><button id="deleteItem" onclick="event.preventDefault(); $('#jsList option:selected').remove();">Delete</button></td></tr>
<tr id="jsRuleSourceWordFile"><td colspan="2"><input id="rulesource_file" name="rulesource" type="radio" value="file"/>Use external word list file</td></tr>
<tr id="jsRuleSourceWordFileReference"><td colspan="2"><select id="fileReference" name="fileReference"><option>GENERAL</option></select></td></tr>
</table>
<table class="SettingsTable FilterCriteria" id="jsCriteria_postoffice">
<%=RenderSetting("filterRulePostoffice")%>
</table>
<table class="SettingsTable FilterCriteria" id="jsCriteria_priority">
<%=RenderSetting("filterRulePriority")%>
</table>
<table class="SettingsTable FilterCriteria" id="jsCriteria_CountryMatch">
<%=RenderSetting("filterRuleCountry")%>
</table>
<table class="SettingsTable FilterCriteria" id="jsCriteria_Connector">
<%=RenderSetting("filterRuleConnector")%>
</table>
<table class="SettingsTable FilterCriteria" id="jsCriteria_SPF">
<%=RenderSetting("filterRuleSPF")%>
</table>
<table class="SettingsTable FilterCriteria" id="jsCriteria_DKIM">
<%=RenderSetting("filterRuleDKIM")%>
</table>
<table class="SettingsTable FilterCriteria" id="jsCriteria_IPMatch">
<%=RenderSetting("filterRuleIP")%>
</table>
<table class="SettingsTable FilterCriteria" id="jsCriteria_SpamProbabilityMatch">
<%=RenderSetting("filterRuleSpamProbability")%>
</table>
<table class="SettingsTable FilterCriteria" id="jsCriteria_SizeMatch">
<%=RenderSetting("filterRuleSize")%>
</table>
</form>
</div>
<div id="divActionDialog"><form id="ActionDialog" name="ActionDialog" action=""><%MailEnable.Utilities.WriteFormValidationField(Response, Session.SessionID, Session.Item("ME_VALIDATIONTOKEN"))%>
<input id="TaskId" name="TaskId" type="hidden" />
<table class="SettingsTable" id="filterTask">
<%=RenderSetting("filterTaskType")%>
<tr><td colspan="2"><div id="jsTaskDescription"></div></td></tr>
<tr><td colspan="2"><input id="jsTaskEnabled" name="enabled" type="checkbox"/> Enabled</td></tr>
</table>
<table class="SettingsTable FilterTask" id="jsTask_Folder">
<%=RenderSetting("filterTaskFolder")%>
</table>
<table class="SettingsTable FilterTask" id="jsTask_Address">
<%=RenderSetting("filterTaskAddress")%>
</table>
<table class="SettingsTable FilterTask" id="jsTask_Message">
<%=RenderSetting("filterUseTemplate")%>
<%=RenderSetting("filterTaskMessageText")%>
<%=RenderSetting("filterTaskMessageTemplate")%>
</table>
<table class="SettingsTable FilterTask" id="jsTask_Prefix">
<%=RenderSetting("filterTaskSubjectPrefix")%>
</table>
<table class="SettingsTable FilterTask" id="jsTask_Execute">
<%=RenderSetting("filterTaskExecuteCommand")%>
<%=RenderSetting("filterTaskExecuteParameters")%>
</table>
<table class="SettingsTable FilterTask" id="jsTask_Header">
<%=RenderSetting("filterTaskHeaderName")%>
<%=RenderSetting("filterTaskHeaderValue")%>
</table>
<br />
<table class="SettingsTable">
<tr><td></td><td style='text-align: right'><button id="btnTaskAction">OK</button> <button id="btnTaskClose">Cancel</button></td></tr>
</table>
</form>
</div>
</asp:Content>