2014-05-24 06:14:16 +08:00
|
|
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
2014-08-07 05:02:20 +08:00
|
|
|
function FilterConditionModel(oKoList)
|
2014-05-24 06:14:16 +08:00
|
|
|
{
|
2014-06-18 04:57:38 +08:00
|
|
|
this.parentList = oKoList;
|
|
|
|
|
2014-08-07 05:02:20 +08:00
|
|
|
this.field = ko.observable(Enums.FilterConditionField.From);
|
|
|
|
|
2014-06-18 04:57:38 +08:00
|
|
|
this.fieldOptions = [ // TODO i18n
|
|
|
|
{'id': Enums.FilterConditionField.From, 'name': 'From'},
|
2014-08-07 05:02:20 +08:00
|
|
|
{'id': Enums.FilterConditionField.Recipient, 'name': 'Recipient (To or CC)'},
|
|
|
|
{'id': Enums.FilterConditionField.To, 'name': 'To'},
|
|
|
|
{'id': Enums.FilterConditionField.Subject, 'name': 'Subject'}
|
2014-06-18 04:57:38 +08:00
|
|
|
];
|
|
|
|
|
2014-08-07 05:02:20 +08:00
|
|
|
this.type = ko.observable(Enums.FilterConditionType.EqualTo);
|
|
|
|
|
2014-06-18 04:57:38 +08:00
|
|
|
this.typeOptions = [ // TODO i18n
|
|
|
|
{'id': Enums.FilterConditionType.EqualTo, 'name': 'Equal To'},
|
2014-08-07 05:02:20 +08:00
|
|
|
{'id': Enums.FilterConditionType.NotEqualTo, 'name': 'Not Equal To'},
|
|
|
|
{'id': Enums.FilterConditionType.Contains, 'name': 'Contains'},
|
|
|
|
{'id': Enums.FilterConditionType.NotContains, 'name': 'Not Contains'}
|
2014-06-18 04:57:38 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
this.value = ko.observable('');
|
|
|
|
|
|
|
|
this.template = ko.computed(function () {
|
|
|
|
|
|
|
|
var sTemplate = '';
|
|
|
|
switch (this.type())
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
sTemplate = 'SettingsFiltersConditionDefault';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sTemplate;
|
|
|
|
|
|
|
|
}, this);
|
2014-05-24 06:14:16 +08:00
|
|
|
}
|
2014-06-18 04:57:38 +08:00
|
|
|
|
|
|
|
FilterConditionModel.prototype.removeSelf = function ()
|
|
|
|
{
|
2014-08-07 05:02:20 +08:00
|
|
|
this.parentList.remove(this);
|
2014-06-18 04:57:38 +08:00
|
|
|
};
|