mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
Sieve filters (beta)
This commit is contained in:
parent
94789632f0
commit
929bffccef
45 changed files with 1599 additions and 403 deletions
|
|
@ -399,6 +399,9 @@
|
|||
'CantSendMessage': 302,
|
||||
'InvalidRecipients': 303,
|
||||
|
||||
'CantSaveFilters': 351,
|
||||
'FiltersAreNotCorrect': 352,
|
||||
|
||||
'CantCreateFolder': 400,
|
||||
'CantRenameFolder': 401,
|
||||
'CantDeleteFolder': 402,
|
||||
|
|
|
|||
|
|
@ -700,6 +700,9 @@
|
|||
oN[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
|
||||
oN[Enums.Notification.InvalidRecipients] = Utils.i18n('NOTIFICATIONS/INVALID_RECIPIENTS');
|
||||
|
||||
oN[Enums.Notification.CantSaveFilters] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_FILTERS');
|
||||
oN[Enums.Notification.FiltersAreNotCorrect] = Utils.i18n('NOTIFICATIONS/FILTERS_ARE_NOT_CORRECT');
|
||||
|
||||
oN[Enums.Notification.CantCreateFolder] = Utils.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER');
|
||||
oN[Enums.Notification.CantRenameFolder] = Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER');
|
||||
oN[Enums.Notification.CantDeleteFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER');
|
||||
|
|
|
|||
|
|
@ -139,6 +139,9 @@
|
|||
ViewModelClass.__builded = true;
|
||||
ViewModelClass.__vm = oViewModel;
|
||||
|
||||
oViewModel.onShowTrigger = ko.observable(false);
|
||||
oViewModel.onHideTrigger = ko.observable(false);
|
||||
|
||||
oViewModel.viewModelName = ViewModelClass.__name;
|
||||
oViewModel.viewModelNames = ViewModelClass.__names;
|
||||
|
||||
|
|
@ -172,6 +175,11 @@
|
|||
else
|
||||
{
|
||||
Utils.delegateRun(this, 'onHide');
|
||||
if (this.onHideTrigger)
|
||||
{
|
||||
this.onHideTrigger(!this.onHideTrigger());
|
||||
}
|
||||
|
||||
this.restoreKeyScope();
|
||||
|
||||
_.each(this.viewModelNames, function (sName) {
|
||||
|
|
@ -244,6 +252,10 @@
|
|||
{
|
||||
ViewModelClassToShow.__vm.modalVisibility(true);
|
||||
Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []);
|
||||
if (ViewModelClassToShow.__vm.onShowTrigger)
|
||||
{
|
||||
ViewModelClassToShow.__vm.onShowTrigger(!ViewModelClassToShow.__vm.onShowTrigger());
|
||||
}
|
||||
|
||||
_.each(ViewModelClassToShow.__names, function (sName) {
|
||||
Plugins.runHook('view-model-on-show', [sName, ViewModelClassToShow.__vm, aParameters || []]);
|
||||
|
|
@ -314,6 +326,11 @@
|
|||
{
|
||||
Utils.delegateRun(self.oCurrentScreen, 'onHide');
|
||||
|
||||
if (self.oCurrentScreen.onHideTrigger)
|
||||
{
|
||||
self.oCurrentScreen.onHideTrigger(!self.oCurrentScreen.onHideTrigger());
|
||||
}
|
||||
|
||||
if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels()))
|
||||
{
|
||||
_.each(self.oCurrentScreen.viewModels(), function (ViewModelClass) {
|
||||
|
|
@ -324,6 +341,11 @@
|
|||
ViewModelClass.__dom.hide();
|
||||
ViewModelClass.__vm.viewModelVisibility(false);
|
||||
Utils.delegateRun(ViewModelClass.__vm, 'onHide');
|
||||
|
||||
if (ViewModelClass.__vm.onHideTrigger)
|
||||
{
|
||||
ViewModelClass.__vm.onHideTrigger(!ViewModelClass.__vm.onHideTrigger());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -337,6 +359,10 @@
|
|||
if (self.oCurrentScreen)
|
||||
{
|
||||
Utils.delegateRun(self.oCurrentScreen, 'onShow');
|
||||
if (self.oCurrentScreen.onShowTrigger)
|
||||
{
|
||||
self.oCurrentScreen.onShowTrigger(!self.oCurrentScreen.onShowTrigger());
|
||||
}
|
||||
|
||||
Plugins.runHook('screen-on-show', [self.oCurrentScreen.screenName(), self.oCurrentScreen]);
|
||||
|
||||
|
|
@ -351,6 +377,11 @@
|
|||
ViewModelClass.__vm.viewModelVisibility(true);
|
||||
|
||||
Utils.delegateRun(ViewModelClass.__vm, 'onShow');
|
||||
if (ViewModelClass.__vm.onShowTrigger)
|
||||
{
|
||||
ViewModelClass.__vm.onShowTrigger(!ViewModelClass.__vm.onShowTrigger());
|
||||
}
|
||||
|
||||
Utils.delegateRun(ViewModelClass.__vm, 'onFocus', [], 200);
|
||||
|
||||
_.each(ViewModelClass.__names, function (sName) {
|
||||
|
|
|
|||
|
|
@ -71,19 +71,23 @@
|
|||
switch (this.actionType())
|
||||
{
|
||||
case Enums.FiltersAction.MoveTo:
|
||||
sResult = 'MoveTo $i18n "' + fGetRealFolderName(sActionValue) + '"';
|
||||
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_MOVE_TO', {
|
||||
'FOLDER': fGetRealFolderName(sActionValue)
|
||||
});
|
||||
break;
|
||||
case Enums.FiltersAction.Forward:
|
||||
sResult = 'Forward @i18n "' + sActionValue + '"';
|
||||
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_FORWARD_TO', {
|
||||
'EMAIL': sActionValue
|
||||
});
|
||||
break;
|
||||
case Enums.FiltersAction.Vacation:
|
||||
sResult = 'Vacation message @i18n';
|
||||
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_VACATION_MESSAGE');
|
||||
break;
|
||||
case Enums.FiltersAction.Reject:
|
||||
sResult = 'Reject @i18n';
|
||||
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_REJECT');
|
||||
break;
|
||||
case Enums.FiltersAction.Discard:
|
||||
sResult = 'Discard @i18n';
|
||||
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_DISCARD');
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
this.haveChanges = ko.observable(false);
|
||||
|
||||
this.processText = ko.observable('');
|
||||
this.saveErrorText = ko.observable('');
|
||||
|
||||
this.visibility = ko.observable(false);
|
||||
|
||||
this.modules = Data.filterModules;
|
||||
|
|
@ -39,6 +41,7 @@
|
|||
this.filterRaw.capa = ko.observable('');
|
||||
this.filterRaw.active = ko.observable(false);
|
||||
this.filterRaw.allow = ko.observable(false);
|
||||
this.filterRaw.error = ko.observable(false);
|
||||
|
||||
this.processText = ko.computed(function () {
|
||||
return this.filters.loading() ? Utils.i18n('SETTINGS_FILTERS/LOADING_PROCESS') : '';
|
||||
|
|
@ -55,7 +58,14 @@
|
|||
|
||||
if (!this.filters.saving())
|
||||
{
|
||||
if ('' === Utils.trim(this.filterRaw()))
|
||||
{
|
||||
this.filterRaw.error(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.filters.saving(true);
|
||||
this.saveErrorText('');
|
||||
|
||||
Remote.filtersSave(function (sResult, oData) {
|
||||
|
||||
|
|
@ -66,6 +76,11 @@
|
|||
self.haveChanges(false);
|
||||
self.updateList();
|
||||
}
|
||||
else
|
||||
{
|
||||
self.saveErrorText(oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) :
|
||||
Utils.getNotification(Enums.Notification.CantSaveFilters));
|
||||
}
|
||||
|
||||
}, this.filters(), this.filterRaw(), this.filterRaw.active());
|
||||
}
|
||||
|
|
@ -82,10 +97,12 @@
|
|||
|
||||
this.filterRaw.subscribe(function () {
|
||||
this.haveChanges(true);
|
||||
this.filterRaw.error(false);
|
||||
}, this);
|
||||
|
||||
this.filterRaw.active.subscribe(function () {
|
||||
this.haveChanges(true);
|
||||
this.filterRaw.error(false);
|
||||
}, this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -226,4 +226,8 @@ html.cssanimations {
|
|||
@keyframes bouncedelay {
|
||||
0%, 80%, 100% { transform: scale(0.0); }
|
||||
40% { transform: scale(1.0); }
|
||||
}
|
||||
|
||||
.command.command-disabled.hide-on-disabled-command {
|
||||
display:none;
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
this.populateOptions();
|
||||
|
||||
this.modules.subscribe(this.populateOptions, this)
|
||||
this.modules.subscribe(this.populateOptions, this);
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
|
@ -87,8 +87,9 @@
|
|||
|
||||
FilterPopupView.prototype.populateOptions = function ()
|
||||
{
|
||||
this.actionTypeOptions = []
|
||||
// this.actionTypeOptions.push({'id': Enums.FiltersAction.None, 'name': 'None @i18n'});
|
||||
this.actionTypeOptions = [];
|
||||
// this.actionTypeOptions.push({'id': Enums.FiltersAction.None,
|
||||
// 'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_NONE')});
|
||||
|
||||
var oModules = this.modules();
|
||||
if (oModules)
|
||||
|
|
@ -100,38 +101,44 @@
|
|||
|
||||
if (oModules.moveto)
|
||||
{
|
||||
this.actionTypeOptions.push({'id': Enums.FiltersAction.MoveTo, 'name': 'Move to @i18n'});
|
||||
this.actionTypeOptions.push({'id': Enums.FiltersAction.MoveTo,
|
||||
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')});
|
||||
}
|
||||
|
||||
if (oModules.redirect)
|
||||
{
|
||||
this.actionTypeOptions.push({'id': Enums.FiltersAction.Forward, 'name': 'Forward to @i18n'});
|
||||
this.actionTypeOptions.push({'id': Enums.FiltersAction.Forward,
|
||||
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')});
|
||||
}
|
||||
|
||||
if (oModules.reject)
|
||||
{
|
||||
this.actionTypeOptions.push({'id': Enums.FiltersAction.Reject, 'name': 'Reject @i18n'});
|
||||
this.actionTypeOptions.push({'id': Enums.FiltersAction.Reject,
|
||||
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_REJECT')});
|
||||
}
|
||||
|
||||
if (oModules.vacation)
|
||||
{
|
||||
this.actionTypeOptions.push({'id': Enums.FiltersAction.Vacation, 'name': 'Vacation message @i18n'});
|
||||
this.actionTypeOptions.push({'id': Enums.FiltersAction.Vacation,
|
||||
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
this.actionTypeOptions.push({'id': Enums.FiltersAction.Discard, 'name': 'Discard @i18n'});
|
||||
this.actionTypeOptions.push({'id': Enums.FiltersAction.Discard,
|
||||
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD')});
|
||||
|
||||
this.fieldOptions = [
|
||||
{'id': Enums.FilterConditionField.From, 'name': 'From @i18n'},
|
||||
{'id': Enums.FilterConditionField.Recipient, 'name': 'Recipient (To or CC) @i18n'},
|
||||
{'id': Enums.FilterConditionField.Subject, 'name': 'Subject @i18n'}
|
||||
{'id': Enums.FilterConditionField.From, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_FROM')},
|
||||
{'id': Enums.FilterConditionField.Recipient, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS')},
|
||||
{'id': Enums.FilterConditionField.Subject, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_SUBJECT')}
|
||||
];
|
||||
|
||||
this.typeOptions = [
|
||||
{'id': Enums.FilterConditionType.Contains, 'name': 'Contains @i18n'},
|
||||
{'id': Enums.FilterConditionType.NotContains, 'name': 'Not Contains @i18n'},
|
||||
{'id': Enums.FilterConditionType.EqualTo, 'name': 'Equal To @i18n'},
|
||||
{'id': Enums.FilterConditionType.NotEqualTo, 'name': 'Not Equal To @i18n'}
|
||||
{'id': Enums.FilterConditionType.Contains, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_CONTAINS')},
|
||||
{'id': Enums.FilterConditionType.NotContains, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_CONTAINS')},
|
||||
{'id': Enums.FilterConditionType.EqualTo, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_EQUAL_TO')},
|
||||
{'id': Enums.FilterConditionType.NotEqualTo, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO')}
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue