2014-05-13 16:29:36 +08:00
|
|
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
|
2014-08-25 23:49:01 +08:00
|
|
|
(function (module, require) {
|
2014-08-20 23:03:12 +08:00
|
|
|
|
2014-08-25 23:49:01 +08:00
|
|
|
'use strict';
|
|
|
|
|
2014-08-20 23:03:12 +08:00
|
|
|
var
|
2014-08-25 23:49:01 +08:00
|
|
|
ko = require('ko'),
|
|
|
|
Utils = require('Utils')
|
2014-08-20 23:03:12 +08:00
|
|
|
;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
function ContactTagModel()
|
|
|
|
{
|
|
|
|
this.idContactTag = 0;
|
|
|
|
this.name = ko.observable('');
|
|
|
|
this.readOnly = false;
|
2014-05-13 16:29:36 +08:00
|
|
|
}
|
|
|
|
|
2014-08-20 23:03:12 +08:00
|
|
|
ContactTagModel.prototype.parse = function (oItem)
|
|
|
|
{
|
|
|
|
var bResult = false;
|
|
|
|
if (oItem && 'Object/Tag' === oItem['@Object'])
|
|
|
|
{
|
|
|
|
this.idContact = Utils.pInt(oItem['IdContactTag']);
|
|
|
|
this.name(Utils.pString(oItem['Name']));
|
|
|
|
this.readOnly = !!oItem['ReadOnly'];
|
|
|
|
|
|
|
|
bResult = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bResult;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} sSearch
|
|
|
|
* @return {boolean}
|
|
|
|
*/
|
|
|
|
ContactTagModel.prototype.filterHelper = function (sSearch)
|
|
|
|
{
|
|
|
|
return this.name().toLowerCase().indexOf(sSearch.toLowerCase()) !== -1;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {boolean=} bEncodeHtml = false
|
|
|
|
* @return {string}
|
|
|
|
*/
|
|
|
|
ContactTagModel.prototype.toLine = function (bEncodeHtml)
|
|
|
|
{
|
|
|
|
return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
|
|
|
|
Utils.encodeHtml(this.name()) : this.name();
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = ContactTagModel;
|
|
|
|
|
2014-08-25 23:49:01 +08:00
|
|
|
}(module, require));
|