mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Sieve filters (interface/vacation action)
This commit is contained in:
parent
54edeaa645
commit
68cc322bd5
26 changed files with 235 additions and 104 deletions
|
|
@ -252,9 +252,7 @@
|
||||||
Utils.initNotificationLanguage();
|
Utils.initNotificationLanguage();
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
_.delay(function () {
|
_.delay(Utils.windowResizeCallback, 1000);
|
||||||
Utils.windowResize();
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
ssm.addState({
|
ssm.addState({
|
||||||
'id': 'mobile',
|
'id': 'mobile',
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,7 @@
|
||||||
'None': 'None',
|
'None': 'None',
|
||||||
'MoveTo': 'MoveTo',
|
'MoveTo': 'MoveTo',
|
||||||
'Discard': 'Discard',
|
'Discard': 'Discard',
|
||||||
|
'Vacation': 'Vacation',
|
||||||
'Forward': 'Forward'
|
'Forward': 'Forward'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,10 @@
|
||||||
}
|
}
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
|
Utils.windowResizeCallback = function () {
|
||||||
|
Utils.windowResize();
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {(string|number)} mValue
|
* @param {(string|number)} mValue
|
||||||
* @param {boolean=} bIncludeZero
|
* @param {boolean=} bIncludeZero
|
||||||
|
|
|
||||||
4
dev/External/ko.js
vendored
4
dev/External/ko.js
vendored
|
|
@ -266,9 +266,7 @@
|
||||||
'keyboard': false,
|
'keyboard': false,
|
||||||
'show': ko.unwrap(fValueAccessor())
|
'show': ko.unwrap(fValueAccessor())
|
||||||
})
|
})
|
||||||
.on('shown.koModal', function () {
|
.on('shown.koModal', Utils.windowResizeCallback)
|
||||||
Utils.windowResize();
|
|
||||||
})
|
|
||||||
.find('.close').on('click.koModal', function () {
|
.find('.close').on('click.koModal', function () {
|
||||||
fValueAccessor()(false);
|
fValueAccessor()(false);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
|
|
||||||
Enums = require('Common/Enums'),
|
Enums = require('Common/Enums'),
|
||||||
Utils = require('Common/Utils'),
|
Utils = require('Common/Utils'),
|
||||||
|
|
||||||
|
Cache = require('Storage/User/Cache'),
|
||||||
|
|
||||||
FilterConditionModel = require('Model/FilterCondition'),
|
FilterConditionModel = require('Model/FilterCondition'),
|
||||||
|
|
||||||
AbstractModel = require('Knoin/AbstractModel')
|
AbstractModel = require('Knoin/AbstractModel')
|
||||||
|
|
@ -29,13 +32,15 @@
|
||||||
this.name.error = ko.observable(false);
|
this.name.error = ko.observable(false);
|
||||||
this.name.focused = ko.observable(false);
|
this.name.focused = ko.observable(false);
|
||||||
|
|
||||||
this.raw = ko.observable('');
|
|
||||||
|
|
||||||
this.conditions = ko.observableArray([]);
|
this.conditions = ko.observableArray([]);
|
||||||
this.conditionsType = ko.observable(Enums.FilterRulesType.Any);
|
this.conditionsType = ko.observable(Enums.FilterRulesType.Any);
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
this.actionValue = ko.observable('');
|
this.actionValue = ko.observable('');
|
||||||
|
this.actionValue.error = ko.observable(false);
|
||||||
|
|
||||||
|
this.actionValueSecond = ko.observable('');
|
||||||
|
|
||||||
this.actionMarkAsRead = ko.observable(false);
|
this.actionMarkAsRead = ko.observable(false);
|
||||||
|
|
||||||
this.actionSkipOthers = ko.observable(false);
|
this.actionSkipOthers = ko.observable(false);
|
||||||
|
|
@ -44,8 +49,43 @@
|
||||||
|
|
||||||
this.actionType = ko.observable(Enums.FiltersAction.MoveTo);
|
this.actionType = ko.observable(Enums.FiltersAction.MoveTo);
|
||||||
|
|
||||||
this.actionType.subscribe(function (sValue) {
|
this.actionType.subscribe(function () {
|
||||||
this.actionValue('');
|
this.actionValue('');
|
||||||
|
this.actionValue.error(false);
|
||||||
|
this.actionValueSecond('');
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
var fGetRealFolderName = function (sFolderFullNameRaw) {
|
||||||
|
var oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw);
|
||||||
|
return oFolder ? oFolder.fullName.replace(
|
||||||
|
'.' === oFolder.delimiter ? /\./ : /[\\\/]+/, ' / ') : sFolderFullNameRaw;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.nameSub = ko.computed(function () {
|
||||||
|
|
||||||
|
var
|
||||||
|
sResult = '',
|
||||||
|
sActionValue = this.actionValue()
|
||||||
|
;
|
||||||
|
|
||||||
|
switch (this.actionType())
|
||||||
|
{
|
||||||
|
case Enums.FiltersAction.MoveTo:
|
||||||
|
sResult = 'MoveTo $i18n "' + fGetRealFolderName(sActionValue) + '"';
|
||||||
|
break;
|
||||||
|
case Enums.FiltersAction.Forward:
|
||||||
|
sResult = 'Forward @i18n "' + sActionValue + '"';
|
||||||
|
break;
|
||||||
|
case Enums.FiltersAction.Vacation:
|
||||||
|
sResult = 'Vacation message @i18n';
|
||||||
|
break;
|
||||||
|
case Enums.FiltersAction.Discard:
|
||||||
|
sResult = 'Discard @i18n';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sResult ? '(' + sResult + ')' : '';
|
||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.actionTemplate = ko.computed(function () {
|
this.actionTemplate = ko.computed(function () {
|
||||||
|
|
@ -55,17 +95,19 @@
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case Enums.FiltersAction.MoveTo:
|
case Enums.FiltersAction.MoveTo:
|
||||||
sTemplate = 'SettingsFiltersActionValueAsFolders';
|
sTemplate = 'SettingsFiltersActionMoveToFolder';
|
||||||
break;
|
break;
|
||||||
// case Enums.FiltersAction.Forward:
|
|
||||||
// sTemplate = 'SettingsFiltersActionWithValue';
|
|
||||||
// break;
|
|
||||||
case Enums.FiltersAction.Forward:
|
case Enums.FiltersAction.Forward:
|
||||||
sTemplate = 'SettingsFiltersActionForward';
|
sTemplate = 'SettingsFiltersActionForward';
|
||||||
break;
|
break;
|
||||||
|
case Enums.FiltersAction.Vacation:
|
||||||
|
sTemplate = 'SettingsFiltersActionVacation';
|
||||||
|
break;
|
||||||
case Enums.FiltersAction.None:
|
case Enums.FiltersAction.None:
|
||||||
|
sTemplate = 'SettingsFiltersActionNone';
|
||||||
|
break;
|
||||||
case Enums.FiltersAction.Discard:
|
case Enums.FiltersAction.Discard:
|
||||||
sTemplate = 'SettingsFiltersActionNoValue';
|
sTemplate = 'SettingsFiltersActionDiscard';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,14 +115,16 @@
|
||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.regDisposables(this.conditions.subscribe(function () {
|
this.regDisposables(this.conditions.subscribe(Utils.windowResizeCallback));
|
||||||
Utils.windowResize();
|
|
||||||
}));
|
|
||||||
|
|
||||||
this.regDisposables(this.name.subscribe(function (sValue) {
|
this.regDisposables(this.name.subscribe(function (sValue) {
|
||||||
this.name.error('' === sValue);
|
this.name.error('' === sValue);
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
|
this.regDisposables(this.actionValue.subscribe(function (sValue) {
|
||||||
|
this.actionValue.error('' === sValue);
|
||||||
|
}, this));
|
||||||
|
|
||||||
this.regDisposables([this.actionTemplate]);
|
this.regDisposables([this.actionTemplate]);
|
||||||
|
|
||||||
this.deleteAccess = ko.observable(false);
|
this.deleteAccess = ko.observable(false);
|
||||||
|
|
@ -94,6 +138,40 @@
|
||||||
this.id = Utils.fakeMd5();
|
this.id = Utils.fakeMd5();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FilterModel.prototype.verify = function ()
|
||||||
|
{
|
||||||
|
if ('' === this.name())
|
||||||
|
{
|
||||||
|
this.name.error(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('' === this.actionValue())
|
||||||
|
{
|
||||||
|
if (-1 < Utils.inArray(this.actionType(), [
|
||||||
|
Enums.FiltersAction.MoveTo,
|
||||||
|
Enums.FiltersAction.Forward,
|
||||||
|
Enums.FiltersAction.Vacation
|
||||||
|
]))
|
||||||
|
{
|
||||||
|
this.actionValue.error(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Enums.FiltersAction.Forward === this.actionType() &&
|
||||||
|
-1 === this.actionValue().indexOf('@'))
|
||||||
|
{
|
||||||
|
this.actionValue.error(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.name.error(false);
|
||||||
|
this.actionValue.error(false);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
FilterModel.prototype.toJson = function ()
|
FilterModel.prototype.toJson = function ()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
|
|
@ -106,10 +184,9 @@
|
||||||
}),
|
}),
|
||||||
|
|
||||||
'ActionValue': this.actionValue(),
|
'ActionValue': this.actionValue(),
|
||||||
|
'ActionValueSecond': this.actionValueSecond(),
|
||||||
'ActionType': this.actionType(),
|
'ActionType': this.actionType(),
|
||||||
|
|
||||||
'Raw': this.raw(),
|
|
||||||
|
|
||||||
'MarkAsRead': this.actionMarkAsRead() ? '1' : '0',
|
'MarkAsRead': this.actionMarkAsRead() ? '1' : '0',
|
||||||
'KeepForward': this.keepForward() ? '1' : '0',
|
'KeepForward': this.keepForward() ? '1' : '0',
|
||||||
'SkipOthers': this.actionSkipOthers() ? '1' : '0'
|
'SkipOthers': this.actionSkipOthers() ? '1' : '0'
|
||||||
|
|
@ -152,17 +229,18 @@
|
||||||
oClone.name(this.name());
|
oClone.name(this.name());
|
||||||
oClone.name.error(this.name.error());
|
oClone.name.error(this.name.error());
|
||||||
|
|
||||||
oClone.raw(this.raw());
|
|
||||||
|
|
||||||
oClone.conditionsType(this.conditionsType());
|
oClone.conditionsType(this.conditionsType());
|
||||||
|
|
||||||
oClone.actionMarkAsRead(this.actionMarkAsRead());
|
oClone.actionMarkAsRead(this.actionMarkAsRead());
|
||||||
oClone.actionSkipOthers(this.actionSkipOthers());
|
oClone.actionSkipOthers(this.actionSkipOthers());
|
||||||
|
|
||||||
oClone.actionValue(this.actionValue());
|
|
||||||
|
|
||||||
oClone.actionType(this.actionType());
|
oClone.actionType(this.actionType());
|
||||||
|
|
||||||
|
oClone.actionValue(this.actionValue());
|
||||||
|
oClone.actionValue.error(this.actionValue.error());
|
||||||
|
|
||||||
|
oClone.actionValueSecond(this.actionValueSecond());
|
||||||
|
|
||||||
oClone.keepForward(this.keepForward());
|
oClone.keepForward(this.keepForward());
|
||||||
|
|
||||||
oClone.conditions(_.map(this.conditions(), function (oCondition) {
|
oClone.conditions(_.map(this.conditions(), function (oCondition) {
|
||||||
|
|
|
||||||
|
|
@ -99,15 +99,9 @@
|
||||||
|
|
||||||
MailBoxUserScreen.prototype.onStart = function ()
|
MailBoxUserScreen.prototype.onStart = function ()
|
||||||
{
|
{
|
||||||
var
|
Data.folderList.subscribe(Utils.windowResizeCallback);
|
||||||
fResizeFunction = function () {
|
Data.messageList.subscribe(Utils.windowResizeCallback);
|
||||||
Utils.windowResize();
|
Data.message.subscribe(Utils.windowResizeCallback);
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
Data.folderList.subscribe(fResizeFunction);
|
|
||||||
Data.messageList.subscribe(fResizeFunction);
|
|
||||||
Data.message.subscribe(fResizeFunction);
|
|
||||||
|
|
||||||
Data.layout.subscribe(function (nValue) {
|
Data.layout.subscribe(function (nValue) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,7 @@
|
||||||
this.filters.loading = ko.observable(false).extend({'throttle': 200});
|
this.filters.loading = ko.observable(false).extend({'throttle': 200});
|
||||||
this.filters.saving = ko.observable(false).extend({'throttle': 200});
|
this.filters.saving = ko.observable(false).extend({'throttle': 200});
|
||||||
|
|
||||||
this.filters.subscribe(function () {
|
this.filters.subscribe(Utils.windowResizeCallback);
|
||||||
Utils.windowResize();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.processText = ko.computed(function () {
|
this.processText = ko.computed(function () {
|
||||||
return this.filters.loading() ? Utils.i18n('SETTINGS_FILTERS/LOADING_PROCESS') : '';
|
return this.filters.loading() ? Utils.i18n('SETTINGS_FILTERS/LOADING_PROCESS') : '';
|
||||||
|
|
@ -136,7 +134,7 @@
|
||||||
self.haveChanges(true);
|
self.haveChanges(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, false]);
|
}, true]);
|
||||||
};
|
};
|
||||||
|
|
||||||
FiltersUserSettings.prototype.onBuild = function (oDom)
|
FiltersUserSettings.prototype.onBuild = function (oDom)
|
||||||
|
|
|
||||||
|
|
@ -239,11 +239,11 @@
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.folderMenuForFilters = ko.computed(function () {
|
this.folderMenuForFilters = ko.computed(function () {
|
||||||
return Utils.folderListOptionsBuilder(this.folderListSystem(), this.folderList(), [
|
return Utils.folderListOptionsBuilder(this.folderListSystem(), this.folderList(),
|
||||||
'INBOX'
|
['INBOX'], [['', '']], null, null, null, function (oItem) {
|
||||||
], null, null, null, null, function (oItem) {
|
return oItem ? oItem.localName() : '';
|
||||||
return oItem ? oItem.localName() : '';
|
}
|
||||||
});
|
);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
// message list
|
// message list
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,17 @@
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-name {
|
.filter-name, .filter-sub-name {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filter-sub-name {
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-item {
|
.filter-item {
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,6 @@
|
||||||
|
|
||||||
var
|
var
|
||||||
self = this,
|
self = this,
|
||||||
fResizeSub = function () {
|
|
||||||
Utils.windowResize();
|
|
||||||
},
|
|
||||||
fCcAndBccCheckHelper = function (aValue) {
|
fCcAndBccCheckHelper = function (aValue) {
|
||||||
if (false === self.showCcAndBcc() && 0 < aValue.length)
|
if (false === self.showCcAndBcc() && 0 < aValue.length)
|
||||||
{
|
{
|
||||||
|
|
@ -134,8 +131,8 @@
|
||||||
|
|
||||||
this.attachmentsPlace = ko.observable(false);
|
this.attachmentsPlace = ko.observable(false);
|
||||||
|
|
||||||
this.attachments.subscribe(fResizeSub);
|
this.attachments.subscribe(Utils.windowResizeCallback);
|
||||||
this.attachmentsPlace.subscribe(fResizeSub);
|
this.attachmentsPlace.subscribe(Utils.windowResizeCallback);
|
||||||
|
|
||||||
this.attachmentsInErrorCount.subscribe(function (iN) {
|
this.attachmentsInErrorCount.subscribe(function (iN) {
|
||||||
if (0 === iN)
|
if (0 === iN)
|
||||||
|
|
|
||||||
|
|
@ -178,13 +178,8 @@
|
||||||
this.reloadContactList();
|
this.reloadContactList();
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.contacts.subscribe(function () {
|
this.contacts.subscribe(Utils.windowResizeCallback);
|
||||||
Utils.windowResize();
|
this.viewProperties.subscribe(Utils.windowResizeCallback);
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.viewProperties.subscribe(function () {
|
|
||||||
Utils.windowResize();
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.contactsChecked = ko.computed(function () {
|
this.contactsChecked = ko.computed(function () {
|
||||||
return _.filter(this.contacts(), function (oItem) {
|
return _.filter(this.contacts(), function (oItem) {
|
||||||
|
|
@ -745,7 +740,7 @@
|
||||||
if (this.bBackToCompose)
|
if (this.bBackToCompose)
|
||||||
{
|
{
|
||||||
this.bBackToCompose = false;
|
this.bBackToCompose = false;
|
||||||
|
|
||||||
kn.showScreenPopup(require('View/Popup/Compose'));
|
kn.showScreenPopup(require('View/Popup/Compose'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,31 +30,33 @@
|
||||||
this.fTrueCallback = null;
|
this.fTrueCallback = null;
|
||||||
this.filter = ko.observable(null);
|
this.filter = ko.observable(null);
|
||||||
|
|
||||||
this.selectedFolderValue = ko.observable(Consts.Values.UnuseOptionValue);
|
|
||||||
this.folderSelectList = Data.folderMenuForFilters;
|
|
||||||
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
||||||
|
this.folderSelectList = Data.folderMenuForFilters;
|
||||||
|
this.selectedFolderValue = ko.observable('');
|
||||||
|
|
||||||
|
this.selectedFolderValue.subscribe(function() {
|
||||||
|
if (this.filter())
|
||||||
|
{
|
||||||
|
this.filter().actionValue.error(false);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
this.saveFilter = Utils.createCommand(this, function () {
|
this.saveFilter = Utils.createCommand(this, function () {
|
||||||
|
|
||||||
if (this.filter())
|
if (this.filter())
|
||||||
{
|
{
|
||||||
if ('' === this.filter().name())
|
if (Enums.FiltersAction.MoveTo === this.filter().actionType())
|
||||||
|
{
|
||||||
|
this.filter().actionValue(this.selectedFolderValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.filter().verify())
|
||||||
{
|
{
|
||||||
this.filter().name.error(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fTrueCallback)
|
if (this.fTrueCallback)
|
||||||
{
|
{
|
||||||
if (Enums.FiltersAction.MoveTo === this.filter().actionType())
|
|
||||||
{
|
|
||||||
this.filter().actionValue(this.selectedFolderValue());
|
|
||||||
}
|
|
||||||
else if (Enums.FiltersAction.Forward !== this.filter().actionType())
|
|
||||||
{
|
|
||||||
this.filter().actionValue('');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fTrueCallback(this.filter());
|
this.fTrueCallback(this.filter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,9 +70,10 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.actionTypeOptions = [
|
this.actionTypeOptions = [
|
||||||
{'id': Enums.FiltersAction.None, 'name': 'None @i18n'},
|
// {'id': Enums.FiltersAction.None, 'name': 'None @i18n'},
|
||||||
{'id': Enums.FiltersAction.MoveTo, 'name': ' Move to @i18n'},
|
{'id': Enums.FiltersAction.MoveTo, 'name': ' Move to @i18n'},
|
||||||
{'id': Enums.FiltersAction.Forward, 'name': 'Forward to @i18n'},
|
{'id': Enums.FiltersAction.Forward, 'name': 'Forward to @i18n'},
|
||||||
|
{'id': Enums.FiltersAction.Vacation, 'name': 'Vacation message @i18n'},
|
||||||
{'id': Enums.FiltersAction.Discard, 'name': 'Discard @i18n'}
|
{'id': Enums.FiltersAction.Discard, 'name': 'Discard @i18n'}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -292,12 +292,7 @@
|
||||||
Utils.windowResize();
|
Utils.windowResize();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.messageLoadingThrottle.subscribe(function (bV) {
|
this.messageLoadingThrottle.subscribe(Utils.windowResizeCallback);
|
||||||
if (bV)
|
|
||||||
{
|
|
||||||
Utils.windowResize();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.goUpCommand = Utils.createCommand(this, function () {
|
this.goUpCommand = Utils.createCommand(this, function () {
|
||||||
Events.pub('mailbox.message-list.selector.go-up');
|
Events.pub('mailbox.message-list.selector.go-up');
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,11 @@ class Filter
|
||||||
*/
|
*/
|
||||||
private $sActionValue;
|
private $sActionValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $sActionValueSecond;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
|
|
@ -72,6 +77,7 @@ class Filter
|
||||||
|
|
||||||
$this->sActionType = \RainLoop\Providers\Filters\Enumerations\ActionType::MOVE_TO;
|
$this->sActionType = \RainLoop\Providers\Filters\Enumerations\ActionType::MOVE_TO;
|
||||||
$this->sActionValue = '';
|
$this->sActionValue = '';
|
||||||
|
$this->sActionValueSecond = '';
|
||||||
|
|
||||||
$this->bMarkAsRead = false;
|
$this->bMarkAsRead = false;
|
||||||
$this->bSkipOthers = false;
|
$this->bSkipOthers = false;
|
||||||
|
|
@ -134,6 +140,14 @@ class Filter
|
||||||
return $this->sActionValue;
|
return $this->sActionValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function ActionValueSecond()
|
||||||
|
{
|
||||||
|
return $this->sActionValueSecond;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|
@ -201,6 +215,7 @@ class Filter
|
||||||
\RainLoop\Providers\Filters\Enumerations\ActionType::MOVE_TO;
|
\RainLoop\Providers\Filters\Enumerations\ActionType::MOVE_TO;
|
||||||
|
|
||||||
$this->sActionValue = isset($aFilter['ActionValue']) ? $aFilter['ActionValue'] : '';
|
$this->sActionValue = isset($aFilter['ActionValue']) ? $aFilter['ActionValue'] : '';
|
||||||
|
$this->sActionValueSecond = isset($aFilter['ActionValueSecond']) ? $aFilter['ActionValueSecond'] : '';
|
||||||
|
|
||||||
$this->bMarkAsRead = isset($aFilter['MarkAsRead']) ? $aFilter['MarkAsRead'] : false;
|
$this->bMarkAsRead = isset($aFilter['MarkAsRead']) ? $aFilter['MarkAsRead'] : false;
|
||||||
$this->bSkipOthers = isset($aFilter['SkipOthers']) ? $aFilter['SkipOthers'] : false;
|
$this->bSkipOthers = isset($aFilter['SkipOthers']) ? $aFilter['SkipOthers'] : false;
|
||||||
|
|
@ -239,6 +254,7 @@ class Filter
|
||||||
'ConditionsType' => $this->ConditionsType(),
|
'ConditionsType' => $this->ConditionsType(),
|
||||||
'ActionType' => $this->ActionType(),
|
'ActionType' => $this->ActionType(),
|
||||||
'ActionValue' => $this->ActionValue(),
|
'ActionValue' => $this->ActionValue(),
|
||||||
|
'ActionValueSecond' => $this->ActionValueSecond(),
|
||||||
'MarkAsRead' => $this->MarkAsRead(),
|
'MarkAsRead' => $this->MarkAsRead(),
|
||||||
'SkipOthers' => $this->SkipOthers()
|
'SkipOthers' => $this->SkipOthers()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,6 @@ class ActionType
|
||||||
const NONE = 'None';
|
const NONE = 'None';
|
||||||
const MOVE_TO = 'MoveTo';
|
const MOVE_TO = 'MoveTo';
|
||||||
const DISCARD = 'Discard';
|
const DISCARD = 'Discard';
|
||||||
|
const VACATION = 'Vacation';
|
||||||
const FORWARD = 'Forward';
|
const FORWARD = 'Forward';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,28 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
|
||||||
$aResult[] = $sTab.'discard;';
|
$aResult[] = $sTab.'discard;';
|
||||||
$aResult[] = $sTab.'stop;';
|
$aResult[] = $sTab.'stop;';
|
||||||
break;
|
break;
|
||||||
|
case \RainLoop\Providers\Filters\Enumerations\ActionType::VACATION:
|
||||||
|
$sValue = \trim($oFilter->ActionValue());
|
||||||
|
$sValueSecond = \trim($oFilter->ActionValueSecond());
|
||||||
|
if (0 < \strlen($sValue))
|
||||||
|
{
|
||||||
|
$aCapa['vacation'] = true;
|
||||||
|
|
||||||
|
$sSubject = '';
|
||||||
|
if (0 < \strlen($sValueSecond))
|
||||||
|
{
|
||||||
|
$sSubject = ':subject "'.$this->quote(
|
||||||
|
\preg_replace('/[\s]+/u', ' ', $sValueSecond)).'" ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$aResult[] = $sTab.'vacation :days 1 '.$sSubject.'"'.$this->quote($sValue).'";';
|
||||||
|
$aResult[] = $sTab.'stop;';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$aResult[] = $sTab.'# @Error (vacation): empty action value';
|
||||||
|
}
|
||||||
|
break;
|
||||||
case \RainLoop\Providers\Filters\Enumerations\ActionType::FORWARD:
|
case \RainLoop\Providers\Filters\Enumerations\ActionType::FORWARD:
|
||||||
$sValue = $oFilter->ActionValue();
|
$sValue = $oFilter->ActionValue();
|
||||||
if (0 < \strlen($sValue))
|
if (0 < \strlen($sValue))
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
<div class="control-group" data-bind="css: {'error': name.error}">
|
<div class="control-group" data-bind="css: {'error': name.error}">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" class="span5" data-bind="value: name, hasFocus: name.focused" placeholder="Name"
|
<input type="text" class="span5" data-bind="value: name, hasFocus: name.focused" placeholder="Name @i18n"
|
||||||
autocorrect="off" autocapitalize="off" spellcheck="false" />
|
autocorrect="off" autocapitalize="off" spellcheck="false" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -51,17 +51,10 @@
|
||||||
<br />
|
<br />
|
||||||
<div class="legend">
|
<div class="legend">
|
||||||
<span>
|
<span>
|
||||||
Actions
|
Actions @i18n
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div data-bind="component: {
|
<select data-bind="options: $root.actionTypeOptions, value: actionType, optionsText: 'name', optionsValue: 'id'"></select>
|
||||||
name: 'Checkbox',
|
|
||||||
params: {
|
|
||||||
label: 'Mark as read @i18n',
|
|
||||||
value: actionMarkAsRead
|
|
||||||
}
|
|
||||||
}"></div>
|
|
||||||
<br />
|
|
||||||
<div data-bind="template: {'name': actionTemplate()}"></div>
|
<div data-bind="template: {'name': actionTemplate()}"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="e-action">
|
<td class="e-action">
|
||||||
<span class="filter-name" data-bind="text: name()"></span>
|
<span class="filter-name" data-bind="text: name()"></span>
|
||||||
|
|
||||||
|
<span class="filter-sub-name" data-bind="text: nameSub()"></span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: function(oFilter) { $root.deleteFilter(oFilter); }">
|
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: function(oFilter) { $root.deleteFilter(oFilter); }">
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,23 @@
|
||||||
<select data-bind="options: $root.actionTypeOptions, value: actionType, optionsText: 'name', optionsValue: 'id'"></select>
|
<div class="control-group" data-bind="css: {'error': actionValue.error}">
|
||||||
|
<div class="controls">
|
||||||
<input type="text" data-bind="value: actionValue" />
|
<input type="text" data-bind="value: actionValue" placeholder="Email @i18n" />
|
||||||
|
</div>
|
||||||
<div data-bind="component: {
|
</div>
|
||||||
name: 'Checkbox',
|
<div class="control-group">
|
||||||
params: {
|
<div class="controls">
|
||||||
label: 'keep in INBOX @i18n',
|
<div data-bind="component: {
|
||||||
value: keepForward
|
name: 'Checkbox',
|
||||||
}
|
params: {
|
||||||
}"></div>
|
label: 'keep in INBOX @i18n',
|
||||||
|
value: keepForward
|
||||||
|
}
|
||||||
|
}"></div>
|
||||||
|
<div data-bind="component: {
|
||||||
|
name: 'Checkbox',
|
||||||
|
params: {
|
||||||
|
label: 'Mark as read @i18n',
|
||||||
|
value: actionMarkAsRead
|
||||||
|
}
|
||||||
|
}"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<div class="control-group" data-bind="css: {'error': actionValue.error}">
|
||||||
|
<div class="controls">
|
||||||
|
<select data-bind="options: $root.folderSelectList, value: $root.selectedFolderValue,
|
||||||
|
optionsText: 'name', optionsValue: 'id', optionsAfterRender: $root.defautOptionsAfterRender"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<div data-bind="component: {
|
||||||
|
name: 'Checkbox',
|
||||||
|
params: {
|
||||||
|
label: 'Mark as read @i18n',
|
||||||
|
value: actionMarkAsRead
|
||||||
|
}
|
||||||
|
}"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<select data-bind="options: $root.actionTypeOptions, value: actionType, optionsText: 'name', optionsValue: 'id'"></select>
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<br />
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="span5" data-bind="value: actionValueSecond" placeholder="Subject (optional) @i18n" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group" data-bind="css: {'error': actionValue.error}">
|
||||||
|
<div class="controls">
|
||||||
|
<textarea class="span5" data-bind="value: actionValue" style="height: 100px;" placeholder="Message @i18n"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
<select data-bind="options: $root.actionTypeOptions, value: actionType, optionsText: 'name', optionsValue: 'id'"></select>
|
|
||||||
|
|
||||||
<select data-bind="options: $root.folderSelectList, value: $root.selectedFolderValue,
|
|
||||||
optionsText: 'name', optionsValue: 'id', optionsAfterRender: $root.defautOptionsAfterRender"></select>
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<select data-bind="options: $root.actionTypeOptions, value: actionType, optionsText: 'name', optionsValue: 'id'"></select>
|
|
||||||
|
|
||||||
<input type="text" data-bind="value: actionValue" />
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue