mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 04:59:21 +03:00
+ Updated contacts sql shema (breaking changes) + Fixes - Removed SabreDAV Server - Removed Contacts Sharing (awhile, code refactoring)
This commit is contained in:
parent
54a4c2657a
commit
d29f20789f
78 changed files with 2024 additions and 2317 deletions
|
|
@ -6,17 +6,14 @@
|
|||
function ContactModel()
|
||||
{
|
||||
this.idContact = 0;
|
||||
this.idContactStr = '';
|
||||
this.display = '';
|
||||
this.properties = [];
|
||||
this.readOnly = false;
|
||||
this.scopeType = Enums.ContactScopeType.Default;
|
||||
|
||||
this.focused = ko.observable(false);
|
||||
this.selected = ko.observable(false);
|
||||
this.checked = ko.observable(false);
|
||||
this.deleted = ko.observable(false);
|
||||
this.shared = ko.observable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -34,15 +31,15 @@ ContactModel.prototype.getNameAndEmailHelper = function ()
|
|||
_.each(this.properties, function (aProperty) {
|
||||
if (aProperty)
|
||||
{
|
||||
if ('' === sName && Enums.ContactPropertyType.FullName === aProperty[0])
|
||||
if (Enums.ContactPropertyType.FirstName === aProperty[0])
|
||||
{
|
||||
sName = aProperty[1];
|
||||
sName = Utils.trim(aProperty[1] + ' ' + sName);
|
||||
}
|
||||
else if ('' === sEmail && -1 < Utils.inArray(aProperty[0], [
|
||||
Enums.ContactPropertyType.EmailPersonal,
|
||||
Enums.ContactPropertyType.EmailBussines,
|
||||
Enums.ContactPropertyType.EmailOther
|
||||
]))
|
||||
else if (Enums.ContactPropertyType.LastName === aProperty[0])
|
||||
{
|
||||
sName = Utils.trim(sName + ' ' + aProperty[1]);
|
||||
}
|
||||
else if ('' === sEmail && Enums.ContactPropertyType.Email === aProperty[0])
|
||||
{
|
||||
sEmail = aProperty[1];
|
||||
}
|
||||
|
|
@ -59,22 +56,19 @@ ContactModel.prototype.parse = function (oItem)
|
|||
if (oItem && 'Object/Contact' === oItem['@Object'])
|
||||
{
|
||||
this.idContact = Utils.pInt(oItem['IdContact']);
|
||||
this.idContactStr = Utils.pString(oItem['IdContactStr']);
|
||||
this.display = Utils.pString(oItem['Display']);
|
||||
this.readOnly = !!oItem['ReadOnly'];
|
||||
this.scopeType = Utils.pInt(oItem['ScopeType']);
|
||||
|
||||
if (Utils.isNonEmptyArray(oItem['Properties']))
|
||||
{
|
||||
_.each(oItem['Properties'], function (oProperty) {
|
||||
if (oProperty && oProperty['Type'] && Utils.isNormal(oProperty['Value']))
|
||||
if (oProperty && oProperty['Type'] && Utils.isNormal(oProperty['Value']) && Utils.isNormal(oProperty['TypeStr']))
|
||||
{
|
||||
this.properties.push([Utils.pInt(oProperty['Type']), Utils.pString(oProperty['Value'])]);
|
||||
this.properties.push([Utils.pInt(oProperty['Type']), Utils.pString(oProperty['Value']), Utils.pString(oProperty['TypeStr'])]);
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
this.shared(Enums.ContactScopeType.ShareAll === this.scopeType);
|
||||
bResult = true;
|
||||
}
|
||||
|
||||
|
|
@ -115,10 +109,6 @@ ContactModel.prototype.lineAsCcc = function ()
|
|||
{
|
||||
aResult.push('checked');
|
||||
}
|
||||
if (this.shared())
|
||||
{
|
||||
aResult.push('shared');
|
||||
}
|
||||
if (this.focused())
|
||||
{
|
||||
aResult.push('focused');
|
||||
|
|
|
|||
|
|
@ -2,15 +2,17 @@
|
|||
|
||||
/**
|
||||
* @param {number=} iType = Enums.ContactPropertyType.Unknown
|
||||
* @param {string=} sTypeStr = ''
|
||||
* @param {string=} sValue = ''
|
||||
* @param {boolean=} bFocused = false
|
||||
* @param {string=} sPlaceholder = ''
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function ContactPropertyModel(iType, sValue, bFocused, sPlaceholder)
|
||||
function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder)
|
||||
{
|
||||
this.type = ko.observable(Utils.isUnd(iType) ? Enums.ContactPropertyType.Unknown : iType);
|
||||
this.typeStr = ko.observable(Utils.isUnd(sTypeStr) ? '' : sTypeStr);
|
||||
this.focused = ko.observable(Utils.isUnd(bFocused) ? false : !!bFocused);
|
||||
this.value = ko.observable(Utils.pString(sValue));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue