mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 21:49:21 +03:00
CardDAV (pre-alpha/unstable)
This commit is contained in:
parent
0ec965bccb
commit
599e934b4a
76 changed files with 6984 additions and 1512 deletions
|
|
@ -251,31 +251,30 @@ Enums.ContactPropertyType = {
|
|||
'FullName': 10,
|
||||
|
||||
'FirstName': 15,
|
||||
'SurName': 16,
|
||||
'MiddleName': 17,
|
||||
'LastName': 16,
|
||||
'MiddleName': 16,
|
||||
'Nick': 18,
|
||||
|
||||
'NamePrefix': 20,
|
||||
'NameSuffix': 21,
|
||||
|
||||
'EmailPersonal': 30,
|
||||
'EmailBussines': 31,
|
||||
'EmailOther': 32,
|
||||
|
||||
'PhonePersonal': 50,
|
||||
'PhoneBussines': 51,
|
||||
'PhoneOther': 52,
|
||||
|
||||
'MobilePersonal': 60,
|
||||
'MobileBussines': 61,
|
||||
'MobileOther': 62,
|
||||
|
||||
'FaxPesonal': 70,
|
||||
'FaxBussines': 71,
|
||||
'FaxOther': 72,
|
||||
|
||||
'Facebook': 90,
|
||||
'Skype': 91,
|
||||
'GitHub': 92,
|
||||
|
||||
'Description': 110,
|
||||
'Note': 110,
|
||||
|
||||
'Custom': 250
|
||||
};
|
||||
|
|
|
|||
|
|
@ -570,13 +570,13 @@ WebMailAjaxRemoteStorage.prototype.contacts = function (fCallback, iOffset, iLim
|
|||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
WebMailAjaxRemoteStorage.prototype.contactSave = function (fCallback, sRequestUid, sUid, sUidStr, nScopeType, aProperties)
|
||||
WebMailAjaxRemoteStorage.prototype.contactSave = function (fCallback, sRequestUid, sUid, sUidStr, iScopeType, aProperties)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'ContactSave', {
|
||||
'RequestUid': sRequestUid,
|
||||
'Uid': Utils.trim(sUid),
|
||||
'UidStr': Utils.trim(sUidStr),
|
||||
'ScopeType': nScopeType,
|
||||
'ScopeType': iScopeType,
|
||||
'Properties': aProperties
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -284,8 +284,8 @@
|
|||
}
|
||||
|
||||
.add-link {
|
||||
padding-top: 5px;
|
||||
padding-left: 7px;
|
||||
margin-left: 2px;
|
||||
padding: 5px;
|
||||
font-size: 12px;
|
||||
color: #aaa;
|
||||
}
|
||||
|
|
@ -334,15 +334,19 @@
|
|||
|
||||
.e-share-sign {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
top: 60px;
|
||||
right: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.button-save-contact {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
|
||||
&.dirty {
|
||||
color: #51a351;
|
||||
}
|
||||
}
|
||||
|
||||
&.read-only {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ function PopupsContactsViewModel()
|
|||
var
|
||||
self = this,
|
||||
oT = Enums.ContactPropertyType,
|
||||
aNameTypes = [oT.FullName, oT.FirstName, oT.SurName, oT.MiddleName],
|
||||
aNameTypes = [oT.FirstName, oT.LastName],
|
||||
aEmailTypes = [oT.EmailPersonal, oT.EmailBussines, oT.EmailOther],
|
||||
aPhonesTypes = [
|
||||
oT.PhonePersonal, oT.PhoneBussines, oT.PhoneOther,
|
||||
|
|
@ -267,6 +267,8 @@ function PopupsContactsViewModel()
|
|||
|
||||
if (bRes)
|
||||
{
|
||||
self.watchDirty(false);
|
||||
|
||||
_.delay(function () {
|
||||
self.viewSaveTrigger(Enums.SaveSettingsStep.Idle);
|
||||
}, 1000);
|
||||
|
|
@ -284,19 +286,21 @@ function PopupsContactsViewModel()
|
|||
|
||||
this.bDropPageAfterDelete = false;
|
||||
|
||||
this.watchDirty = ko.observable(false);
|
||||
this.watchHash = ko.observable(false);
|
||||
|
||||
this.viewHash = ko.computed(function () {
|
||||
return '' + self.viewScopeType() + ' - ' + _.map(self.viewProperties(), function (oItem) {
|
||||
return oItem.value();
|
||||
}).join('');
|
||||
});
|
||||
|
||||
this.saveCommandDebounce = _.debounce(_.bind(this.saveCommand, this), 1000);
|
||||
// this.saveCommandDebounce = _.debounce(_.bind(this.saveCommand, this), 1000);
|
||||
|
||||
this.viewHash.subscribe(function () {
|
||||
if (this.watchHash() && !this.viewReadOnly())
|
||||
if (this.watchHash() && !this.viewReadOnly() && !this.watchDirty())
|
||||
{
|
||||
this.saveCommandDebounce();
|
||||
this.watchDirty(true);
|
||||
}
|
||||
}, this);
|
||||
|
||||
|
|
@ -329,7 +333,7 @@ PopupsContactsViewModel.prototype.addNewEmail = function ()
|
|||
|
||||
PopupsContactsViewModel.prototype.addNewPhone = function ()
|
||||
{
|
||||
this.addNewProperty(Enums.ContactPropertyType.PhonePersonal);
|
||||
this.addNewProperty(Enums.ContactPropertyType.MobilePersonal);
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.removeCheckedOrSelectedContactsFromList = function ()
|
||||
|
|
@ -417,7 +421,8 @@ PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
|
|||
var
|
||||
sId = '',
|
||||
sIdStr = '',
|
||||
bHasName = false,
|
||||
sLastName = '',
|
||||
sFirstName = '',
|
||||
aList = []
|
||||
;
|
||||
|
||||
|
|
@ -437,12 +442,17 @@ PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
|
|||
_.each(oContact.properties, function (aProperty) {
|
||||
if (aProperty && aProperty[0])
|
||||
{
|
||||
aList.push(new ContactPropertyModel(aProperty[0], aProperty[1], false,
|
||||
Enums.ContactPropertyType.FullName === aProperty[0] ? 'CONTACTS/PLACEHOLDER_ENTER_DISPLAY_NAME' : ''));
|
||||
|
||||
if (Enums.ContactPropertyType.FullName === aProperty[0])
|
||||
if (Enums.ContactPropertyType.LastName === aProperty[0])
|
||||
{
|
||||
bHasName = true;
|
||||
sLastName = aProperty[1];
|
||||
}
|
||||
else if (Enums.ContactPropertyType.FirstName === aProperty[0])
|
||||
{
|
||||
sFirstName = aProperty[1];
|
||||
}
|
||||
else if (-1 === Utils.inArray(aProperty[0], [Enums.ContactPropertyType.FullName]))
|
||||
{
|
||||
aList.push(new ContactPropertyModel(aProperty[0], aProperty[1]));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -451,17 +461,16 @@ PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
|
|||
this.viewReadOnly(!!oContact.readOnly);
|
||||
this.viewScopeType(oContact.scopeType);
|
||||
}
|
||||
|
||||
if (!bHasName)
|
||||
{
|
||||
aList.push(new ContactPropertyModel(Enums.ContactPropertyType.FullName, '', !oContact, 'CONTACTS/PLACEHOLDER_ENTER_DISPLAY_NAME'));
|
||||
}
|
||||
|
||||
aList.unshift(new ContactPropertyModel(Enums.ContactPropertyType.FirstName, sFirstName, false, 'CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME'));
|
||||
aList.unshift(new ContactPropertyModel(Enums.ContactPropertyType.LastName, sLastName, !oContact, 'CONTACTS/PLACEHOLDER_ENTER_LAST_NAME'));
|
||||
|
||||
this.viewID(sId);
|
||||
this.viewIDStr(sIdStr);
|
||||
this.viewProperties([]);
|
||||
this.viewProperties(aList);
|
||||
|
||||
this.watchDirty(false);
|
||||
this.watchHash(true);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue