Implementation of share contacts (begin)

This commit is contained in:
RainLoop Team 2013-12-18 20:05:30 +04:00
parent 5198dcfa20
commit 026839d864
17 changed files with 469 additions and 50 deletions

View file

@ -8,10 +8,14 @@ function ContactModel()
this.idContact = 0;
this.display = '';
this.properties = [];
this.readOnly = false;
this.scopeType = Enums.ContactScopeType.Default;
this.scopeValue = '';
this.checked = ko.observable(false);
this.selected = ko.observable(false);
this.deleted = ko.observable(false);
this.shared = ko.observable(false);
}
/**
@ -55,6 +59,9 @@ ContactModel.prototype.parse = function (oItem)
{
this.idContact = Utils.pInt(oItem['IdContact']);
this.display = Utils.pString(oItem['Display']);
this.readOnly = !!oItem['ReadOnly'];
this.scopeType = Utils.pInt(oItem['ScopeType']);
this.scopeValue = Utils.pString(oItem['ScopeValue']);
if (Utils.isNonEmptyArray(oItem['Properties']))
{
@ -65,6 +72,10 @@ ContactModel.prototype.parse = function (oItem)
}
}, this);
}
this.shared(-1 < Utils.inArray(this.scopeType, [
Enums.ContactScopeType.ShareAll, Enums.ContactScopeType.ShareDomain, Enums.ContactScopeType.ShareEmail
]));
bResult = true;
}
@ -106,6 +117,10 @@ ContactModel.prototype.lineAsCcc = function ()
{
aResult.push('checked');
}
if (this.shared())
{
aResult.push('shared');
}
return aResult.join(' ');
};