mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Filters / Interface (part 2)
This commit is contained in:
parent
333c063cf1
commit
b1327c933b
20 changed files with 456 additions and 127 deletions
|
|
@ -280,31 +280,41 @@ Enums.Layout = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FilterConditionField = {
|
Enums.FilterConditionField = {
|
||||||
'From': 0,
|
'From': 'From',
|
||||||
'To': 1,
|
'To': 'To',
|
||||||
'Subject': 2
|
'Recipient': 'Recipient',
|
||||||
|
'Subject': 'Subject'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FilterConditionType = {
|
Enums.FilterConditionType = {
|
||||||
'contains': 0,
|
'Contains': 'Contains',
|
||||||
'NotContains': 1,
|
'NotContains': 'NotContains',
|
||||||
'EqualTo': 2,
|
'EqualTo': 'EqualTo',
|
||||||
'NotEqualTo': 3
|
'NotEqualTo': 'NotEqualTo'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FiltersAction = {
|
Enums.FiltersAction = {
|
||||||
'None': 0,
|
'Move': 'Move',
|
||||||
'Move': 1,
|
'Delete': 'Delete',
|
||||||
'Delete': 2
|
'Forward': 'Forward'
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
Enums.FilterRulesType = {
|
||||||
|
'And': 'And',
|
||||||
|
'Or': 'Or',
|
||||||
|
'All': 'All'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -113,9 +113,10 @@ Globals.oHtmlEditorDefaultConfig = {
|
||||||
|
|
||||||
'allowedContent': true,
|
'allowedContent': true,
|
||||||
'autoParagraph': false,
|
'autoParagraph': false,
|
||||||
|
'fillEmptyBlocks': false,
|
||||||
|
|
||||||
'enterMode': window.CKEDITOR.ENTER_BR,
|
'enterMode': window.CKEDITOR.ENTER_BR,
|
||||||
'shiftEnterMode': window.CKEDITOR.ENTER_BR,
|
'shiftEnterMode': window.CKEDITOR.ENTER_DIV,
|
||||||
|
|
||||||
'font_defaultLabel': 'Arial',
|
'font_defaultLabel': 'Arial',
|
||||||
'fontSize_defaultLabel': '13',
|
'fontSize_defaultLabel': '13',
|
||||||
|
|
|
||||||
50
dev/Models/FilterActionModel.js
Normal file
50
dev/Models/FilterActionModel.js
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function FilterActionModel(oKoList, oKoCanBeDeleted)
|
||||||
|
{
|
||||||
|
this.parentList = oKoList;
|
||||||
|
this.canBeDeleted = oKoCanBeDeleted;
|
||||||
|
|
||||||
|
this.value = ko.observable('');
|
||||||
|
|
||||||
|
this.type = ko.observable(Enums.FiltersAction.Move);
|
||||||
|
this.typeOptions = [ // TODO i18n
|
||||||
|
{'id': Enums.FiltersAction.Move, 'name': 'Move to'},
|
||||||
|
{'id': Enums.FiltersAction.Forward, 'name': 'Forward to'},
|
||||||
|
{'id': Enums.FiltersAction.Delete, 'name': 'Discard'},
|
||||||
|
{'id': Enums.FiltersAction.MarkAsRead, 'name': 'Mark as read'}
|
||||||
|
];
|
||||||
|
|
||||||
|
this.template = ko.computed(function () {
|
||||||
|
|
||||||
|
var sTemplate = '';
|
||||||
|
switch (this.type())
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case Enums.FiltersAction.Move:
|
||||||
|
sTemplate = 'SettingsFiltersActionValueAsFolders';
|
||||||
|
break;
|
||||||
|
case Enums.FiltersAction.Forward:
|
||||||
|
sTemplate = 'SettingsFiltersActionWithValue';
|
||||||
|
break;
|
||||||
|
case Enums.FiltersAction.MarkAsRead:
|
||||||
|
case Enums.FiltersAction.Delete:
|
||||||
|
sTemplate = 'SettingsFiltersActionNoValue';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sTemplate;
|
||||||
|
|
||||||
|
}, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
FilterActionModel.prototype.removeSelf = function ()
|
||||||
|
{
|
||||||
|
if (this.canBeDeleted())
|
||||||
|
{
|
||||||
|
this.parentList.remove(this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -3,6 +3,48 @@
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function FilterConditionModel()
|
function FilterConditionModel(oKoList, oKoCanBeDeleted)
|
||||||
{
|
{
|
||||||
|
this.parentList = oKoList;
|
||||||
|
this.canBeDeleted = oKoCanBeDeleted;
|
||||||
|
|
||||||
|
this.field = ko.observable(Enums.FilterConditionField.Subject);
|
||||||
|
this.fieldOptions = [ // TODO i18n
|
||||||
|
{'id': Enums.FilterConditionField.Subject, 'name': 'Subject'},
|
||||||
|
{'id': Enums.FilterConditionField.Recipient, 'name': 'Recipient (To or CC)'},
|
||||||
|
{'id': Enums.FilterConditionField.From, 'name': 'From'},
|
||||||
|
{'id': Enums.FilterConditionField.To, 'name': 'To'}
|
||||||
|
];
|
||||||
|
|
||||||
|
this.type = ko.observable(Enums.FilterConditionType.Contains);
|
||||||
|
this.typeOptions = [ // TODO i18n
|
||||||
|
{'id': Enums.FilterConditionType.Contains, 'name': 'Contains'},
|
||||||
|
{'id': Enums.FilterConditionType.NotContains, 'name': 'Not Contains'},
|
||||||
|
{'id': Enums.FilterConditionType.EqualTo, 'name': 'Equal To'},
|
||||||
|
{'id': Enums.FilterConditionType.NotEqualTo, 'name': 'Not Equal To'}
|
||||||
|
];
|
||||||
|
|
||||||
|
this.value = ko.observable('');
|
||||||
|
|
||||||
|
this.template = ko.computed(function () {
|
||||||
|
|
||||||
|
var sTemplate = '';
|
||||||
|
switch (this.type())
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
sTemplate = 'SettingsFiltersConditionDefault';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sTemplate;
|
||||||
|
|
||||||
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilterConditionModel.prototype.removeSelf = function ()
|
||||||
|
{
|
||||||
|
if (this.canBeDeleted())
|
||||||
|
{
|
||||||
|
this.parentList.remove(this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,19 +7,38 @@ function FilterModel()
|
||||||
{
|
{
|
||||||
this.enabled = ko.observable(true);
|
this.enabled = ko.observable(true);
|
||||||
|
|
||||||
|
this.name = ko.observable('');
|
||||||
|
|
||||||
|
this.conditionsType = ko.observable(Enums.FilterRulesType.And);
|
||||||
|
|
||||||
this.conditions = ko.observableArray([]);
|
this.conditions = ko.observableArray([]);
|
||||||
|
this.actions = ko.observableArray([]);
|
||||||
|
|
||||||
this.action = ko.observable(Enums.FiltersAction.None);
|
this.conditions.subscribe(function () {
|
||||||
|
Utils.windowResize();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.actions.subscribe(function () {
|
||||||
|
Utils.windowResize();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.conditionsCanBeDeleted = ko.computed(function () {
|
||||||
|
return 1 < this.conditions().length;
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
this.actionsCanBeDeleted = ko.computed(function () {
|
||||||
|
return 1 < this.actions().length;
|
||||||
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterModel.prototype.deleteCondition = function (oCondition)
|
|
||||||
{
|
|
||||||
this.conditions.remove(oCondition);
|
|
||||||
};
|
|
||||||
|
|
||||||
FilterModel.prototype.addCondition = function ()
|
FilterModel.prototype.addCondition = function ()
|
||||||
{
|
{
|
||||||
this.conditions.push(new FilterConditionModel());
|
this.conditions.push(new FilterConditionModel(this.conditions, this.conditionsCanBeDeleted));
|
||||||
|
};
|
||||||
|
|
||||||
|
FilterModel.prototype.addAction = function ()
|
||||||
|
{
|
||||||
|
this.actions.push(new FilterActionModel(this.actions, this.actionsCanBeDeleted));
|
||||||
};
|
};
|
||||||
|
|
||||||
FilterModel.prototype.parse = function (oItem)
|
FilterModel.prototype.parse = function (oItem)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ function SettingsFilters()
|
||||||
|
|
||||||
this.filters = ko.observableArray([]);
|
this.filters = ko.observableArray([]);
|
||||||
this.filters.loading = ko.observable(false);
|
this.filters.loading = ko.observable(false);
|
||||||
|
|
||||||
|
this.filters.subscribe(function () {
|
||||||
|
Utils.windowResize();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.addSettingsViewModel(SettingsFilters, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
Utils.addSettingsViewModel(SettingsFilters, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||||
|
|
@ -26,6 +30,7 @@ SettingsFilters.prototype.addFilter = function ()
|
||||||
{
|
{
|
||||||
var oFilter = new FilterModel();
|
var oFilter = new FilterModel();
|
||||||
oFilter.addCondition();
|
oFilter.addCondition();
|
||||||
|
oFilter.addAction();
|
||||||
|
|
||||||
this.filters.push(oFilter);
|
this.filters.push(oFilter);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,7 @@ cfg.paths.js = {
|
||||||
'dev/Models/FolderModel.js',
|
'dev/Models/FolderModel.js',
|
||||||
'dev/Models/AccountModel.js',
|
'dev/Models/AccountModel.js',
|
||||||
'dev/Models/IdentityModel.js',
|
'dev/Models/IdentityModel.js',
|
||||||
|
'dev/Models/FilterActionModel.js',
|
||||||
'dev/Models/FilterConditionModel.js',
|
'dev/Models/FilterConditionModel.js',
|
||||||
'dev/Models/FilterModel.js',
|
'dev/Models/FilterModel.js',
|
||||||
'dev/Models/OpenPgpKeyModel.js',
|
'dev/Models/OpenPgpKeyModel.js',
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,28 @@ class Utils
|
||||||
return $sResult;
|
return $sResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function ConvertSystemString($sSrt)
|
||||||
|
{
|
||||||
|
if (!empty($sSrt) && !\MailSo\Base\Utils::IsUtf8($sSrt))
|
||||||
|
{
|
||||||
|
$sCharset = \MailSo\Base\Utils::DetectSystemCharset();
|
||||||
|
if (!empty($sCharset))
|
||||||
|
{
|
||||||
|
$sSrt = \MailSo\Base\Utils::ConvertEncoding(
|
||||||
|
$sSrt, $sCharset, \MailSo\Base\Enumerations\Charset::UTF_8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sSrt = @\utf8_encode($sSrt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sSrt;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sEncoding
|
* @param string $sEncoding
|
||||||
* @param bool $bAsciAsUtf8 = false
|
* @param bool $bAsciAsUtf8 = false
|
||||||
|
|
|
||||||
|
|
@ -202,23 +202,9 @@ abstract class NetClient
|
||||||
|
|
||||||
if (!\is_resource($this->rConnect))
|
if (!\is_resource($this->rConnect))
|
||||||
{
|
{
|
||||||
if (!empty($sErrorStr) && !\MailSo\Base\Utils::IsUtf8($sErrorStr))
|
|
||||||
{
|
|
||||||
$sCharset = \MailSo\Base\Utils::DetectSystemCharset();
|
|
||||||
if (!empty($sCharset))
|
|
||||||
{
|
|
||||||
$sErrorStr = \MailSo\Base\Utils::ConvertEncoding(
|
|
||||||
$sErrorStr, $sCharset, \MailSo\Base\Enumerations\Charset::UTF_8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sErrorStr = @\utf8_encode($sErrorStr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new Exceptions\SocketCanNotConnectToHostException(
|
new Exceptions\SocketCanNotConnectToHostException(
|
||||||
$sErrorStr, $iErrorNo,
|
\MailSo\Base\Utils::ConvertSystemString($sErrorStr), (int) $iErrorNo,
|
||||||
'Can\'t connect to host "'.$this->sConnectedHost.':'.$this->iConnectedPort.'"'
|
'Can\'t connect to host "'.$this->sConnectedHost.':'.$this->iConnectedPort.'"'
|
||||||
), \MailSo\Log\Enumerations\Type::NOTICE, true);
|
), \MailSo\Log\Enumerations\Type::NOTICE, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@
|
||||||
<span class="i18n" data-i18n-text="MESSAGE_LIST/EMPTY_SEARCH_LIST"></span>
|
<span class="i18n" data-i18n-text="MESSAGE_LIST/EMPTY_SEARCH_LIST"></span>
|
||||||
</div>
|
</div>
|
||||||
<div data-bind="draggable: dragAndDronHelper, droppableSelector: '.b-folders .content.g-scrollbox'">
|
<div data-bind="draggable: dragAndDronHelper, droppableSelector: '.b-folders .content.g-scrollbox'">
|
||||||
<div class="messageListPlace" data-bind="template: { name: messageListItemTemplate(), foreach: messageList }"></div>
|
<div class="messageListPlace" data-bind="template: { name: messageListItemTemplate, foreach: messageList }"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -5,31 +5,64 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div data-bind="foreach: filters">
|
<div data-bind="foreach: filters, i18nUpdate: filters">
|
||||||
<div class="filter" style="background-color: #ddd">
|
<div class="filter span12 pull-left" style="background-color: #eee; padding: 15px; border-radius: 4px">
|
||||||
FILTER
|
|
||||||
<div data-bind="foreach: conditions">
|
<input type="text" data-bind="value: name" placeholder="Description:" />
|
||||||
COND
|
|
||||||
<br />
|
|
||||||
<span class="delete-condition" data-bind="click: function (oCondition) { $parent.deleteCondition(oCondition); }">
|
|
||||||
<i class="icon-trash"></i>
|
|
||||||
</span>
|
|
||||||
<br />
|
|
||||||
</div>
|
|
||||||
<br />
|
<br />
|
||||||
<a class="btn" data-bind="click: addCondition">
|
|
||||||
<i class="icon-plus"></i>
|
<label class="radio inline">
|
||||||
|
<input type="radio" name="conditionsType" value="And" data-bind="checked: conditionsType" />
|
||||||
|
Matching all of the following rules
|
||||||
|
</label>
|
||||||
|
<label class="radio inline">
|
||||||
|
<input type="radio" name="conditionsType" value="Or" data-bind="checked: conditionsType" />
|
||||||
|
Matching any of the following rules
|
||||||
|
</label>
|
||||||
|
<label class="radio inline">
|
||||||
|
<input type="radio" name="conditionsType" value="All" data-bind="checked: conditionsType" />
|
||||||
|
All messages
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a class="btn" data-bind="click: addCondition">
|
||||||
|
<i class="icon-plus"></i>
|
||||||
|
|
||||||
|
<span class="i18n" data-i18n-text="SETTINGS_FILTERS/BUTTON_ADD_CONDITION"></span>
|
||||||
|
</a>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<div data-bind="foreach: conditions">
|
||||||
|
<div data-bind="template: {'name': template, 'data': $data}"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
<div>
|
||||||
|
<a class="btn" data-bind="click: addAction">
|
||||||
|
<i class="icon-plus"></i>
|
||||||
|
|
||||||
|
<span class="i18n" data-i18n-text="SETTINGS_FILTERS/BUTTON_ADD_ACTION"></span>
|
||||||
|
</a>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<div data-bind="foreach: actions">
|
||||||
|
<div data-bind="template: {'name': template, 'data': $data}"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
<a class="btn" data-bind="click: function (oFilter) { $parent.deleteFilter(oFilter); }">
|
||||||
|
<i class="icon-trash"></i>
|
||||||
|
|
||||||
<span class="i18n" data-i18n-text="SETTINGS_FILTERS/BUTTON_ADD_CONDITION"></span>
|
<span class="i18n" data-i18n-text="SETTINGS_FILTERS/BUTTON_DELETE_FILTER"></span>
|
||||||
</a>
|
</a>
|
||||||
<br />
|
<br />
|
||||||
<span class="delete-filter" data-bind="click: function (oFilter) { $parent.deleteFilter(oFilter); }">
|
|
||||||
<i class="icon-trash"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<br />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<br />
|
||||||
<a class="btn" data-bind="click: addFilter">
|
<a class="btn" data-bind="click: addFilter">
|
||||||
<i class="icon-filter"></i>
|
<i class="icon-filter"></i>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<select data-bind="options: typeOptions, value: type, optionsText: 'name', optionsValue: 'id'"></select>
|
||||||
|
<span class="delete-action pull-right" data-bind="visible: canBeDeleted, click: removeSelf">
|
||||||
|
<i class="icon-trash"></i>
|
||||||
|
</span>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<select data-bind="options: typeOptions, value: type, optionsText: 'name', optionsValue: 'id'"></select>
|
||||||
|
Folders
|
||||||
|
<span class="delete-action pull-right" data-bind="visible: canBeDeleted, click: removeSelf">
|
||||||
|
<i class="icon-trash"></i>
|
||||||
|
</span>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<select data-bind="options: typeOptions, value: type, optionsText: 'name', optionsValue: 'id'"></select>
|
||||||
|
<input type="text" data-bind="value: value" />
|
||||||
|
<span class="delete-action pull-right" data-bind="visible: canBeDeleted, click: removeSelf">
|
||||||
|
<i class="icon-trash"></i>
|
||||||
|
</span>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<select data-bind="options: fieldOptions, value: field, optionsText: 'name', optionsValue: 'id'"></select>
|
||||||
|
<select data-bind="options: typeOptions, value: type, optionsText: 'name', optionsValue: 'id'"></select>
|
||||||
|
<input type="text" data-bind="value: value" />
|
||||||
|
<span class="delete-action pull-right" data-bind="visible: canBeDeleted, click: removeSelf">
|
||||||
|
<i class="icon-trash"></i>
|
||||||
|
</span>
|
||||||
|
|
@ -360,7 +360,9 @@ BUTTON_BACK = "Back"
|
||||||
[SETTINGS_FILTERS]
|
[SETTINGS_FILTERS]
|
||||||
LEGEND_FILTERS = "Filters"
|
LEGEND_FILTERS = "Filters"
|
||||||
BUTTON_ADD_FILTER = "Add Filter"
|
BUTTON_ADD_FILTER = "Add Filter"
|
||||||
|
BUTTON_DELETE_FILTER = "Delete Filter"
|
||||||
BUTTON_ADD_CONDITION = "Add Condition"
|
BUTTON_ADD_CONDITION = "Add Condition"
|
||||||
|
BUTTON_ADD_ACTION = "Add Action"
|
||||||
|
|
||||||
[SETTINGS_IDENTITY]
|
[SETTINGS_IDENTITY]
|
||||||
LEGEND_IDENTITY = "Identity"
|
LEGEND_IDENTITY = "Identity"
|
||||||
|
|
|
||||||
|
|
@ -203,9 +203,10 @@ Globals.oHtmlEditorDefaultConfig = {
|
||||||
|
|
||||||
'allowedContent': true,
|
'allowedContent': true,
|
||||||
'autoParagraph': false,
|
'autoParagraph': false,
|
||||||
|
'fillEmptyBlocks': false,
|
||||||
|
|
||||||
'enterMode': window.CKEDITOR.ENTER_BR,
|
'enterMode': window.CKEDITOR.ENTER_BR,
|
||||||
'shiftEnterMode': window.CKEDITOR.ENTER_BR,
|
'shiftEnterMode': window.CKEDITOR.ENTER_DIV,
|
||||||
|
|
||||||
'font_defaultLabel': 'Arial',
|
'font_defaultLabel': 'Arial',
|
||||||
'fontSize_defaultLabel': '13',
|
'fontSize_defaultLabel': '13',
|
||||||
|
|
@ -646,31 +647,41 @@ Enums.Layout = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FilterConditionField = {
|
Enums.FilterConditionField = {
|
||||||
'From': 0,
|
'From': 'From',
|
||||||
'To': 1,
|
'To': 'To',
|
||||||
'Subject': 2
|
'Recipient': 'Recipient',
|
||||||
|
'Subject': 'Subject'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FilterConditionType = {
|
Enums.FilterConditionType = {
|
||||||
'contains': 0,
|
'Contains': 'Contains',
|
||||||
'NotContains': 1,
|
'NotContains': 'NotContains',
|
||||||
'EqualTo': 2,
|
'EqualTo': 'EqualTo',
|
||||||
'NotEqualTo': 3
|
'NotEqualTo': 'NotEqualTo'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FiltersAction = {
|
Enums.FiltersAction = {
|
||||||
'None': 0,
|
'Move': 'Move',
|
||||||
'Move': 1,
|
'Delete': 'Delete',
|
||||||
'Delete': 2
|
'Forward': 'Forward'
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
Enums.FilterRulesType = {
|
||||||
|
'And': 'And',
|
||||||
|
'Or': 'Or',
|
||||||
|
'All': 'All'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
6
rainloop/v/0.0.0/static/js/admin.min.js
vendored
6
rainloop/v/0.0.0/static/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -206,9 +206,10 @@ Globals.oHtmlEditorDefaultConfig = {
|
||||||
|
|
||||||
'allowedContent': true,
|
'allowedContent': true,
|
||||||
'autoParagraph': false,
|
'autoParagraph': false,
|
||||||
|
'fillEmptyBlocks': false,
|
||||||
|
|
||||||
'enterMode': window.CKEDITOR.ENTER_BR,
|
'enterMode': window.CKEDITOR.ENTER_BR,
|
||||||
'shiftEnterMode': window.CKEDITOR.ENTER_BR,
|
'shiftEnterMode': window.CKEDITOR.ENTER_DIV,
|
||||||
|
|
||||||
'font_defaultLabel': 'Arial',
|
'font_defaultLabel': 'Arial',
|
||||||
'fontSize_defaultLabel': '13',
|
'fontSize_defaultLabel': '13',
|
||||||
|
|
@ -649,31 +650,41 @@ Enums.Layout = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FilterConditionField = {
|
Enums.FilterConditionField = {
|
||||||
'From': 0,
|
'From': 'From',
|
||||||
'To': 1,
|
'To': 'To',
|
||||||
'Subject': 2
|
'Recipient': 'Recipient',
|
||||||
|
'Subject': 'Subject'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FilterConditionType = {
|
Enums.FilterConditionType = {
|
||||||
'contains': 0,
|
'Contains': 'Contains',
|
||||||
'NotContains': 1,
|
'NotContains': 'NotContains',
|
||||||
'EqualTo': 2,
|
'EqualTo': 'EqualTo',
|
||||||
'NotEqualTo': 3
|
'NotEqualTo': 'NotEqualTo'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FiltersAction = {
|
Enums.FiltersAction = {
|
||||||
'None': 0,
|
'Move': 'Move',
|
||||||
'Move': 1,
|
'Delete': 'Delete',
|
||||||
'Delete': 2
|
'Forward': 'Forward'
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
Enums.FilterRulesType = {
|
||||||
|
'And': 'And',
|
||||||
|
'Or': 'Or',
|
||||||
|
'All': 'All'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -8146,10 +8157,102 @@ IdentityModel.prototype.formattedNameForEmail = function ()
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function FilterConditionModel()
|
function FilterActionModel(oKoList, oKoCanBeDeleted)
|
||||||
{
|
{
|
||||||
|
this.parentList = oKoList;
|
||||||
|
this.canBeDeleted = oKoCanBeDeleted;
|
||||||
|
|
||||||
|
this.value = ko.observable('');
|
||||||
|
|
||||||
|
this.type = ko.observable(Enums.FiltersAction.Move);
|
||||||
|
this.typeOptions = [ // TODO i18n
|
||||||
|
{'id': Enums.FiltersAction.Move, 'name': 'Move to'},
|
||||||
|
{'id': Enums.FiltersAction.Forward, 'name': 'Forward to'},
|
||||||
|
{'id': Enums.FiltersAction.Delete, 'name': 'Discard'},
|
||||||
|
{'id': Enums.FiltersAction.MarkAsRead, 'name': 'Mark as read'}
|
||||||
|
];
|
||||||
|
|
||||||
|
this.template = ko.computed(function () {
|
||||||
|
|
||||||
|
var sTemplate = '';
|
||||||
|
switch (this.type())
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case Enums.FiltersAction.Move:
|
||||||
|
sTemplate = 'SettingsFiltersActionValueAsFolders';
|
||||||
|
break;
|
||||||
|
case Enums.FiltersAction.Forward:
|
||||||
|
sTemplate = 'SettingsFiltersActionWithValue';
|
||||||
|
break;
|
||||||
|
case Enums.FiltersAction.MarkAsRead:
|
||||||
|
case Enums.FiltersAction.Delete:
|
||||||
|
sTemplate = 'SettingsFiltersActionNoValue';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sTemplate;
|
||||||
|
|
||||||
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilterActionModel.prototype.removeSelf = function ()
|
||||||
|
{
|
||||||
|
if (this.canBeDeleted())
|
||||||
|
{
|
||||||
|
this.parentList.remove(this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function FilterConditionModel(oKoList, oKoCanBeDeleted)
|
||||||
|
{
|
||||||
|
this.parentList = oKoList;
|
||||||
|
this.canBeDeleted = oKoCanBeDeleted;
|
||||||
|
|
||||||
|
this.field = ko.observable(Enums.FilterConditionField.Subject);
|
||||||
|
this.fieldOptions = [ // TODO i18n
|
||||||
|
{'id': Enums.FilterConditionField.Subject, 'name': 'Subject'},
|
||||||
|
{'id': Enums.FilterConditionField.Recipient, 'name': 'Recipient (To or CC)'},
|
||||||
|
{'id': Enums.FilterConditionField.From, 'name': 'From'},
|
||||||
|
{'id': Enums.FilterConditionField.To, 'name': 'To'}
|
||||||
|
];
|
||||||
|
|
||||||
|
this.type = ko.observable(Enums.FilterConditionType.Contains);
|
||||||
|
this.typeOptions = [ // TODO i18n
|
||||||
|
{'id': Enums.FilterConditionType.Contains, 'name': 'Contains'},
|
||||||
|
{'id': Enums.FilterConditionType.NotContains, 'name': 'Not Contains'},
|
||||||
|
{'id': Enums.FilterConditionType.EqualTo, 'name': 'Equal To'},
|
||||||
|
{'id': Enums.FilterConditionType.NotEqualTo, 'name': 'Not Equal To'}
|
||||||
|
];
|
||||||
|
|
||||||
|
this.value = ko.observable('');
|
||||||
|
|
||||||
|
this.template = ko.computed(function () {
|
||||||
|
|
||||||
|
var sTemplate = '';
|
||||||
|
switch (this.type())
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
sTemplate = 'SettingsFiltersConditionDefault';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sTemplate;
|
||||||
|
|
||||||
|
}, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
FilterConditionModel.prototype.removeSelf = function ()
|
||||||
|
{
|
||||||
|
if (this.canBeDeleted())
|
||||||
|
{
|
||||||
|
this.parentList.remove(this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -8159,19 +8262,38 @@ function FilterModel()
|
||||||
{
|
{
|
||||||
this.enabled = ko.observable(true);
|
this.enabled = ko.observable(true);
|
||||||
|
|
||||||
|
this.name = ko.observable('');
|
||||||
|
|
||||||
|
this.conditionsType = ko.observable(Enums.FilterRulesType.And);
|
||||||
|
|
||||||
this.conditions = ko.observableArray([]);
|
this.conditions = ko.observableArray([]);
|
||||||
|
this.actions = ko.observableArray([]);
|
||||||
|
|
||||||
this.action = ko.observable(Enums.FiltersAction.None);
|
this.conditions.subscribe(function () {
|
||||||
|
Utils.windowResize();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.actions.subscribe(function () {
|
||||||
|
Utils.windowResize();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.conditionsCanBeDeleted = ko.computed(function () {
|
||||||
|
return 1 < this.conditions().length;
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
this.actionsCanBeDeleted = ko.computed(function () {
|
||||||
|
return 1 < this.actions().length;
|
||||||
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterModel.prototype.deleteCondition = function (oCondition)
|
|
||||||
{
|
|
||||||
this.conditions.remove(oCondition);
|
|
||||||
};
|
|
||||||
|
|
||||||
FilterModel.prototype.addCondition = function ()
|
FilterModel.prototype.addCondition = function ()
|
||||||
{
|
{
|
||||||
this.conditions.push(new FilterConditionModel());
|
this.conditions.push(new FilterConditionModel(this.conditions, this.conditionsCanBeDeleted));
|
||||||
|
};
|
||||||
|
|
||||||
|
FilterModel.prototype.addAction = function ()
|
||||||
|
{
|
||||||
|
this.actions.push(new FilterActionModel(this.actions, this.actionsCanBeDeleted));
|
||||||
};
|
};
|
||||||
|
|
||||||
FilterModel.prototype.parse = function (oItem)
|
FilterModel.prototype.parse = function (oItem)
|
||||||
|
|
@ -14833,6 +14955,10 @@ function SettingsFilters()
|
||||||
|
|
||||||
this.filters = ko.observableArray([]);
|
this.filters = ko.observableArray([]);
|
||||||
this.filters.loading = ko.observable(false);
|
this.filters.loading = ko.observable(false);
|
||||||
|
|
||||||
|
this.filters.subscribe(function () {
|
||||||
|
Utils.windowResize();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.addSettingsViewModel(SettingsFilters, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
Utils.addSettingsViewModel(SettingsFilters, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||||
|
|
@ -14850,6 +14976,7 @@ SettingsFilters.prototype.addFilter = function ()
|
||||||
{
|
{
|
||||||
var oFilter = new FilterModel();
|
var oFilter = new FilterModel();
|
||||||
oFilter.addCondition();
|
oFilter.addCondition();
|
||||||
|
oFilter.addAction();
|
||||||
|
|
||||||
this.filters.push(oFilter);
|
this.filters.push(oFilter);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
18
rainloop/v/0.0.0/static/js/app.min.js
vendored
18
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue