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 = {
|
||||
'From': 0,
|
||||
'To': 1,
|
||||
'Subject': 2
|
||||
'From': 'From',
|
||||
'To': 'To',
|
||||
'Recipient': 'Recipient',
|
||||
'Subject': 'Subject'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterConditionType = {
|
||||
'contains': 0,
|
||||
'NotContains': 1,
|
||||
'EqualTo': 2,
|
||||
'NotEqualTo': 3
|
||||
'Contains': 'Contains',
|
||||
'NotContains': 'NotContains',
|
||||
'EqualTo': 'EqualTo',
|
||||
'NotEqualTo': 'NotEqualTo'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FiltersAction = {
|
||||
'None': 0,
|
||||
'Move': 1,
|
||||
'Delete': 2
|
||||
'Move': 'Move',
|
||||
'Delete': 'Delete',
|
||||
'Forward': 'Forward'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterRulesType = {
|
||||
'And': 'And',
|
||||
'Or': 'Or',
|
||||
'All': 'All'
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -110,12 +110,13 @@ Globals.oHtmlEditorDefaultConfig = {
|
|||
'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced',
|
||||
|
||||
'extraPlugins': 'plain',
|
||||
|
||||
|
||||
'allowedContent': true,
|
||||
'autoParagraph': false,
|
||||
'fillEmptyBlocks': false,
|
||||
|
||||
'enterMode': window.CKEDITOR.ENTER_BR,
|
||||
'shiftEnterMode': window.CKEDITOR.ENTER_BR,
|
||||
'shiftEnterMode': window.CKEDITOR.ENTER_DIV,
|
||||
|
||||
'font_defaultLabel': 'Arial',
|
||||
'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
|
||||
*/
|
||||
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.name = ko.observable('');
|
||||
|
||||
this.conditionsType = ko.observable(Enums.FilterRulesType.And);
|
||||
|
||||
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 ()
|
||||
{
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ function SettingsFilters()
|
|||
|
||||
this.filters = ko.observableArray([]);
|
||||
this.filters.loading = ko.observable(false);
|
||||
|
||||
this.filters.subscribe(function () {
|
||||
Utils.windowResize();
|
||||
});
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(SettingsFilters, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||
|
|
@ -26,6 +30,7 @@ SettingsFilters.prototype.addFilter = function ()
|
|||
{
|
||||
var oFilter = new FilterModel();
|
||||
oFilter.addCondition();
|
||||
|
||||
oFilter.addAction();
|
||||
|
||||
this.filters.push(oFilter);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ cfg.paths.js = {
|
|||
'dev/Models/FolderModel.js',
|
||||
'dev/Models/AccountModel.js',
|
||||
'dev/Models/IdentityModel.js',
|
||||
'dev/Models/FilterActionModel.js',
|
||||
'dev/Models/FilterConditionModel.js',
|
||||
'dev/Models/FilterModel.js',
|
||||
'dev/Models/OpenPgpKeyModel.js',
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Utils
|
|||
public static $aLocaleMapping = array(
|
||||
'.65001' => 'utf-8',
|
||||
'.20127' => 'iso-8859-1',
|
||||
|
||||
|
||||
'.1250' => 'windows-1250',
|
||||
'.cp1250' => 'windows-1250',
|
||||
'.cp-1250' => 'windows-1250',
|
||||
|
|
@ -104,7 +104,7 @@ class Utils
|
|||
$sResult = '';
|
||||
$sLocale = @\setlocale(LC_ALL, '');
|
||||
$sLocaleLower = \strtolower(\trim($sLocale));
|
||||
|
||||
|
||||
foreach (\MailSo\Base\Utils::$aLocaleMapping as $sKey => $sValue)
|
||||
{
|
||||
if (false !== \strpos($sLocaleLower, $sKey) ||
|
||||
|
|
@ -117,7 +117,29 @@ class Utils
|
|||
|
||||
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 bool $bAsciAsUtf8 = false
|
||||
|
|
@ -251,11 +273,11 @@ class Utils
|
|||
{
|
||||
$sMbstringSubCh = \mb_substitute_character();
|
||||
}
|
||||
|
||||
|
||||
\mb_substitute_character('none');
|
||||
$sResult = @\mb_convert_encoding($sInputString, \strtoupper($sInputToEncoding), \strtoupper($sInputFromEncoding));
|
||||
\mb_substitute_character($sMbstringSubCh);
|
||||
|
||||
|
||||
return $sResult;
|
||||
}
|
||||
|
||||
|
|
@ -502,7 +524,7 @@ class Utils
|
|||
if (0 < \strlen($aTempArr[0]))
|
||||
{
|
||||
$sCharset = 0 === \strlen($sForcedIncomingCharset) ? $aTempArr[0] : $sForcedIncomingCharset;
|
||||
|
||||
|
||||
if ('' === $sMainCharset)
|
||||
{
|
||||
$sMainCharset = $sCharset;
|
||||
|
|
@ -1180,11 +1202,11 @@ class Utils
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@\closedir($rDirH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $bResult;
|
||||
}
|
||||
|
||||
|
|
@ -1241,7 +1263,7 @@ class Utils
|
|||
{
|
||||
$sUtfString = $sNewUtfString;
|
||||
}
|
||||
|
||||
|
||||
$sUtfString = \preg_replace(
|
||||
'/[\x00-\x08\x10\x0B\x0C\x0E-\x1F\x7F]'.
|
||||
'|[\x00-\x7F][\x80-\xBF]+'.
|
||||
|
|
@ -1380,7 +1402,7 @@ class Utils
|
|||
{
|
||||
$iStart = null;
|
||||
$iPrev = null;
|
||||
|
||||
|
||||
foreach ($aSequence as $sItem)
|
||||
{
|
||||
// simple protection
|
||||
|
|
@ -1922,14 +1944,14 @@ class Utils
|
|||
$mResult = \md5(@\iconv('utf-8', 'utf-8//IGNORE', $sStr)) === \md5($sStr) ? 'utf-8' : '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return \is_string($mResult) && 0 < \strlen($mResult) ? $mResult : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sData
|
||||
* @param string $sKey
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function Hmac($sData, $sKey)
|
||||
|
|
@ -1944,11 +1966,11 @@ class Utils
|
|||
{
|
||||
$sKey = \pack('H*', \md5($sKey));
|
||||
}
|
||||
|
||||
|
||||
$sKey = \str_pad($sKey, $iLen, \chr(0x00));
|
||||
$sIpad = \str_pad('', $iLen, \chr(0x36));
|
||||
$sOpad = \str_pad('', $iLen, \chr(0x5c));
|
||||
|
||||
|
||||
return \md5(($sKey ^ $sOpad).\pack('H*', \md5(($sKey ^ $sIpad).$sData)));
|
||||
}
|
||||
|
||||
|
|
@ -1999,7 +2021,7 @@ class Utils
|
|||
|
||||
return $bLowerIfAscii ? \MailSo\Base\Utils::StrToLowerIfAscii($sStr) : $sStr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $sStr
|
||||
* @param bool $bLowerIfAscii = false
|
||||
|
|
@ -2017,7 +2039,7 @@ class Utils
|
|||
$sUser = \MailSo\Base\Utils::GetAccountNameFromEmail($sStr);
|
||||
$sDomain = \MailSo\Base\Utils::GetDomainFromEmail($sStr);
|
||||
}
|
||||
|
||||
|
||||
if (0 < \strlen($sDomain) && \preg_match('/[^\x20-\x7E]/', $sDomain))
|
||||
{
|
||||
try
|
||||
|
|
@ -2026,7 +2048,7 @@ class Utils
|
|||
}
|
||||
catch (\Exception $oException) {}
|
||||
}
|
||||
|
||||
|
||||
return ('' === $sUser ? '' : $sUser.'@').$sDomain;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,23 +202,9 @@ abstract class NetClient
|
|||
|
||||
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(
|
||||
new Exceptions\SocketCanNotConnectToHostException(
|
||||
$sErrorStr, $iErrorNo,
|
||||
\MailSo\Base\Utils::ConvertSystemString($sErrorStr), (int) $iErrorNo,
|
||||
'Can\'t connect to host "'.$this->sConnectedHost.':'.$this->iConnectedPort.'"'
|
||||
), \MailSo\Log\Enumerations\Type::NOTICE, true);
|
||||
}
|
||||
|
|
@ -232,7 +218,7 @@ abstract class NetClient
|
|||
{
|
||||
@\stream_set_timeout($this->rConnect, $this->iSocketTimeOut);
|
||||
}
|
||||
|
||||
|
||||
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('stream_set_blocking'))
|
||||
{
|
||||
@\stream_set_blocking($this->rConnect, 1);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@
|
|||
<span class="i18n" data-i18n-text="MESSAGE_LIST/EMPTY_SEARCH_LIST"></span>
|
||||
</div>
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -5,31 +5,64 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div data-bind="foreach: filters">
|
||||
<div class="filter" style="background-color: #ddd">
|
||||
FILTER
|
||||
<div data-bind="foreach: conditions">
|
||||
COND
|
||||
<br />
|
||||
<span class="delete-condition" data-bind="click: function (oCondition) { $parent.deleteCondition(oCondition); }">
|
||||
<i class="icon-trash"></i>
|
||||
</span>
|
||||
<br />
|
||||
</div>
|
||||
<div data-bind="foreach: filters, i18nUpdate: filters">
|
||||
<div class="filter span12 pull-left" style="background-color: #eee; padding: 15px; border-radius: 4px">
|
||||
|
||||
<input type="text" data-bind="value: name" placeholder="Description:" />
|
||||
|
||||
<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>
|
||||
<br />
|
||||
<span class="delete-filter" data-bind="click: function (oFilter) { $parent.deleteFilter(oFilter); }">
|
||||
<i class="icon-trash"></i>
|
||||
</span>
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<a class="btn" data-bind="click: addFilter">
|
||||
<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]
|
||||
LEGEND_FILTERS = "Filters"
|
||||
BUTTON_ADD_FILTER = "Add Filter"
|
||||
BUTTON_DELETE_FILTER = "Delete Filter"
|
||||
BUTTON_ADD_CONDITION = "Add Condition"
|
||||
BUTTON_ADD_ACTION = "Add Action"
|
||||
|
||||
[SETTINGS_IDENTITY]
|
||||
LEGEND_IDENTITY = "Identity"
|
||||
|
|
|
|||
|
|
@ -200,12 +200,13 @@ Globals.oHtmlEditorDefaultConfig = {
|
|||
'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced',
|
||||
|
||||
'extraPlugins': 'plain',
|
||||
|
||||
|
||||
'allowedContent': true,
|
||||
'autoParagraph': false,
|
||||
'fillEmptyBlocks': false,
|
||||
|
||||
'enterMode': window.CKEDITOR.ENTER_BR,
|
||||
'shiftEnterMode': window.CKEDITOR.ENTER_BR,
|
||||
'shiftEnterMode': window.CKEDITOR.ENTER_DIV,
|
||||
|
||||
'font_defaultLabel': 'Arial',
|
||||
'fontSize_defaultLabel': '13',
|
||||
|
|
@ -646,31 +647,41 @@ Enums.Layout = {
|
|||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterConditionField = {
|
||||
'From': 0,
|
||||
'To': 1,
|
||||
'Subject': 2
|
||||
'From': 'From',
|
||||
'To': 'To',
|
||||
'Recipient': 'Recipient',
|
||||
'Subject': 'Subject'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterConditionType = {
|
||||
'contains': 0,
|
||||
'NotContains': 1,
|
||||
'EqualTo': 2,
|
||||
'NotEqualTo': 3
|
||||
'Contains': 'Contains',
|
||||
'NotContains': 'NotContains',
|
||||
'EqualTo': 'EqualTo',
|
||||
'NotEqualTo': 'NotEqualTo'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FiltersAction = {
|
||||
'None': 0,
|
||||
'Move': 1,
|
||||
'Delete': 2
|
||||
'Move': 'Move',
|
||||
'Delete': 'Delete',
|
||||
'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
|
|
@ -203,12 +203,13 @@ Globals.oHtmlEditorDefaultConfig = {
|
|||
'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced',
|
||||
|
||||
'extraPlugins': 'plain',
|
||||
|
||||
|
||||
'allowedContent': true,
|
||||
'autoParagraph': false,
|
||||
'fillEmptyBlocks': false,
|
||||
|
||||
'enterMode': window.CKEDITOR.ENTER_BR,
|
||||
'shiftEnterMode': window.CKEDITOR.ENTER_BR,
|
||||
'shiftEnterMode': window.CKEDITOR.ENTER_DIV,
|
||||
|
||||
'font_defaultLabel': 'Arial',
|
||||
'fontSize_defaultLabel': '13',
|
||||
|
|
@ -649,31 +650,41 @@ Enums.Layout = {
|
|||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterConditionField = {
|
||||
'From': 0,
|
||||
'To': 1,
|
||||
'Subject': 2
|
||||
'From': 'From',
|
||||
'To': 'To',
|
||||
'Recipient': 'Recipient',
|
||||
'Subject': 'Subject'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterConditionType = {
|
||||
'contains': 0,
|
||||
'NotContains': 1,
|
||||
'EqualTo': 2,
|
||||
'NotEqualTo': 3
|
||||
'Contains': 'Contains',
|
||||
'NotContains': 'NotContains',
|
||||
'EqualTo': 'EqualTo',
|
||||
'NotEqualTo': 'NotEqualTo'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FiltersAction = {
|
||||
'None': 0,
|
||||
'Move': 1,
|
||||
'Delete': 2
|
||||
'Move': 'Move',
|
||||
'Delete': 'Delete',
|
||||
'Forward': 'Forward'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterRulesType = {
|
||||
'And': 'And',
|
||||
'Or': 'Or',
|
||||
'All': 'All'
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -8146,10 +8157,102 @@ IdentityModel.prototype.formattedNameForEmail = function ()
|
|||
/**
|
||||
* @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 */
|
||||
|
||||
/**
|
||||
|
|
@ -8159,19 +8262,38 @@ function FilterModel()
|
|||
{
|
||||
this.enabled = ko.observable(true);
|
||||
|
||||
this.name = ko.observable('');
|
||||
|
||||
this.conditionsType = ko.observable(Enums.FilterRulesType.And);
|
||||
|
||||
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 ()
|
||||
{
|
||||
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)
|
||||
|
|
@ -14833,6 +14955,10 @@ function SettingsFilters()
|
|||
|
||||
this.filters = ko.observableArray([]);
|
||||
this.filters.loading = ko.observable(false);
|
||||
|
||||
this.filters.subscribe(function () {
|
||||
Utils.windowResize();
|
||||
});
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(SettingsFilters, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||
|
|
@ -14850,7 +14976,8 @@ SettingsFilters.prototype.addFilter = function ()
|
|||
{
|
||||
var oFilter = new FilterModel();
|
||||
oFilter.addCondition();
|
||||
|
||||
oFilter.addAction();
|
||||
|
||||
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