mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 13:09:21 +03:00
Merge new-contacts-api
New interface Contact storage move to plugin
This commit is contained in:
commit
efdca7ef77
44 changed files with 3454 additions and 1012 deletions
|
|
@ -7250,58 +7250,27 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
|
|||
color: #999;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .top-part {
|
||||
margin-top: 20px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .top-part .control-label {
|
||||
text-align: center;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .image-wrapper {
|
||||
margin-left: 30px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .image-wrapper img {
|
||||
border-radius: 10px;
|
||||
.b-contacts-content.modal .b-view-content .property-line {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .top-row {
|
||||
padding: 10px 0;
|
||||
height: 30px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactEmptyValueClick,
|
||||
.b-contacts-content.modal .b-view-content .contactValueClick,
|
||||
.b-contacts-content.modal .b-view-content .contactValueInput {
|
||||
display: inline-block;
|
||||
font-size: 24px;
|
||||
line-height: 28px;
|
||||
height: 28px;
|
||||
.b-contacts-content.modal .b-view-content .add-link {
|
||||
padding-top: 5px;
|
||||
font-size: 12px;
|
||||
color: #aaa;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactEmptyValueClick,
|
||||
.b-contacts-content.modal .b-view-content .contactValueClick {
|
||||
color: #ddd;
|
||||
cursor: pointer;
|
||||
margin: 5px 0 0 7px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactValueInput {
|
||||
padding-left: 6px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactEmptyValueClick {
|
||||
border-bottom: 1px dashed #ddd;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactValueClick {
|
||||
color: #555;
|
||||
border-bottom: 11px dashed transparent;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactValueClick:hover {
|
||||
color: #000;
|
||||
border-bottom: 1px dashed #000;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .hasError .contactValueClick,
|
||||
.b-contacts-content.modal .b-view-content .hasError .contactValueInput {
|
||||
color: #ee5f5b;
|
||||
border: 1px solid #ee5f5b;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .button-save-contact {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
}
|
||||
.b-contacts-content .e-contact-item {
|
||||
|
|
|
|||
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
File diff suppressed because one or more lines are too long
|
|
@ -5095,58 +5095,27 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
|
|||
color: #999;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .top-part {
|
||||
margin-top: 20px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .top-part .control-label {
|
||||
text-align: center;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .image-wrapper {
|
||||
margin-left: 30px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .image-wrapper img {
|
||||
border-radius: 10px;
|
||||
.b-contacts-content.modal .b-view-content .property-line {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .top-row {
|
||||
padding: 10px 0;
|
||||
height: 30px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactEmptyValueClick,
|
||||
.b-contacts-content.modal .b-view-content .contactValueClick,
|
||||
.b-contacts-content.modal .b-view-content .contactValueInput {
|
||||
display: inline-block;
|
||||
font-size: 24px;
|
||||
line-height: 28px;
|
||||
height: 28px;
|
||||
.b-contacts-content.modal .b-view-content .add-link {
|
||||
padding-top: 5px;
|
||||
font-size: 12px;
|
||||
color: #aaa;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactEmptyValueClick,
|
||||
.b-contacts-content.modal .b-view-content .contactValueClick {
|
||||
color: #ddd;
|
||||
cursor: pointer;
|
||||
margin: 5px 0 0 7px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactValueInput {
|
||||
padding-left: 6px;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactEmptyValueClick {
|
||||
border-bottom: 1px dashed #ddd;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactValueClick {
|
||||
color: #555;
|
||||
border-bottom: 11px dashed transparent;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .contactValueClick:hover {
|
||||
color: #000;
|
||||
border-bottom: 1px dashed #000;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .hasError .contactValueClick,
|
||||
.b-contacts-content.modal .b-view-content .hasError .contactValueInput {
|
||||
color: #ee5f5b;
|
||||
border: 1px solid #ee5f5b;
|
||||
}
|
||||
.b-contacts-content.modal .b-view-content .button-save-contact {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
}
|
||||
.b-contacts-content .e-contact-item {
|
||||
|
|
|
|||
|
|
@ -487,6 +487,45 @@ Enums.InterfaceAnimation = {
|
|||
'Full': 'Full'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.ContactPropertyType = {
|
||||
|
||||
'Unknown': 0,
|
||||
|
||||
'FullName': 10,
|
||||
|
||||
'FirstName': 15,
|
||||
'SurName': 16,
|
||||
'MiddleName': 17,
|
||||
'Nick': 18,
|
||||
|
||||
'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,
|
||||
|
||||
'Custom': 250
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
|
|
@ -1427,7 +1466,6 @@ Utils.initDataConstructorBySettings = function (oData)
|
|||
oData.dropboxEnable = ko.observable(false);
|
||||
oData.dropboxApiKey = ko.observable('');
|
||||
|
||||
oData.contactsIsSupported = ko.observable(false);
|
||||
oData.contactsIsAllowed = ko.observable(false);
|
||||
};
|
||||
|
||||
|
|
@ -2679,6 +2717,12 @@ ko.extenders.falseTimeout = function (oTarget, iOption)
|
|||
return oTarget;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateNone = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
return this;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateEmail = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
|
|
@ -4866,8 +4910,6 @@ function AdminGeneral()
|
|||
return Utils.convertLangName(this.mainLanguage());
|
||||
}, this);
|
||||
|
||||
this.contactsSupported = RL.settingsGet('ContactsIsSupported');
|
||||
this.contactsIsAllowed = RL.settingsGet('ContactsIsAllowed');
|
||||
this.weakPassword = !!RL.settingsGet('WeakPassword');
|
||||
|
||||
this.titleTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
|
@ -5588,7 +5630,6 @@ AbstractData.prototype.populateDataOnStart = function()
|
|||
this.dropboxEnable(!!RL.settingsGet('AllowDropboxSocial'));
|
||||
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
|
||||
|
||||
this.contactsIsSupported(!!RL.settingsGet('ContactsIsSupported'));
|
||||
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
|
||||
};
|
||||
|
||||
|
|
|
|||
6
rainloop/v/0.0.0/static/js/admin.min.js
vendored
6
rainloop/v/0.0.0/static/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -487,6 +487,45 @@ Enums.InterfaceAnimation = {
|
|||
'Full': 'Full'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.ContactPropertyType = {
|
||||
|
||||
'Unknown': 0,
|
||||
|
||||
'FullName': 10,
|
||||
|
||||
'FirstName': 15,
|
||||
'SurName': 16,
|
||||
'MiddleName': 17,
|
||||
'Nick': 18,
|
||||
|
||||
'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,
|
||||
|
||||
'Custom': 250
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
|
|
@ -1427,7 +1466,6 @@ Utils.initDataConstructorBySettings = function (oData)
|
|||
oData.dropboxEnable = ko.observable(false);
|
||||
oData.dropboxApiKey = ko.observable('');
|
||||
|
||||
oData.contactsIsSupported = ko.observable(false);
|
||||
oData.contactsIsAllowed = ko.observable(false);
|
||||
};
|
||||
|
||||
|
|
@ -2679,6 +2717,12 @@ ko.extenders.falseTimeout = function (oTarget, iOption)
|
|||
return oTarget;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateNone = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
return this;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateEmail = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
|
|
@ -5652,26 +5696,65 @@ EmailModel.prototype.inputoTagLine = function ()
|
|||
function ContactModel()
|
||||
{
|
||||
this.idContact = 0;
|
||||
this.imageHash = '';
|
||||
this.listName = '';
|
||||
this.name = '';
|
||||
this.emails = [];
|
||||
this.display = '';
|
||||
this.properties = [];
|
||||
|
||||
this.checked = ko.observable(false);
|
||||
this.selected = ko.observable(false);
|
||||
this.deleted = ko.observable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {Array|null}
|
||||
*/
|
||||
ContactModel.prototype.getNameAndEmailHelper = function ()
|
||||
{
|
||||
var
|
||||
sName = '',
|
||||
sEmail = ''
|
||||
;
|
||||
|
||||
if (Utils.isNonEmptyArray(this.properties))
|
||||
{
|
||||
_.each(this.properties, function (aProperty) {
|
||||
if (aProperty)
|
||||
{
|
||||
if ('' === sName && Enums.ContactPropertyType.FullName === aProperty[0])
|
||||
{
|
||||
sName = aProperty[1];
|
||||
}
|
||||
else if ('' === sEmail && -1 < Utils.inArray(aProperty[0], [
|
||||
Enums.ContactPropertyType.EmailPersonal,
|
||||
Enums.ContactPropertyType.EmailBussines,
|
||||
Enums.ContactPropertyType.EmailOther
|
||||
]))
|
||||
{
|
||||
sEmail = aProperty[1];
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
return '' === sEmail ? null : [sEmail, sName];
|
||||
};
|
||||
|
||||
ContactModel.prototype.parse = function (oItem)
|
||||
{
|
||||
var bResult = false;
|
||||
if (oItem && 'Object/Contact' === oItem['@Object'])
|
||||
{
|
||||
this.idContact = Utils.pInt(oItem['IdContact']);
|
||||
this.listName = Utils.pString(oItem['ListName']);
|
||||
this.name = Utils.pString(oItem['Name']);
|
||||
this.emails = Utils.isNonEmptyArray(oItem['Emails']) ? oItem['Emails'] : [];
|
||||
this.imageHash = Utils.pString(oItem['ImageHash']);
|
||||
this.display = Utils.pString(oItem['Display']);
|
||||
|
||||
if (Utils.isNonEmptyArray(oItem['Properties']))
|
||||
{
|
||||
_.each(oItem['Properties'], function (oProperty) {
|
||||
if (oProperty && oProperty['Type'] && Utils.isNormal(oProperty['Value']))
|
||||
{
|
||||
this.properties.push([Utils.pInt(oProperty['Type']), Utils.pString(oProperty['Value'])]);
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
bResult = true;
|
||||
}
|
||||
|
|
@ -5684,8 +5767,7 @@ ContactModel.prototype.parse = function (oItem)
|
|||
*/
|
||||
ContactModel.prototype.srcAttr = function ()
|
||||
{
|
||||
return '' === this.imageHash ? RL.link().emptyContactPic() :
|
||||
RL.link().getUserPicUrlFromHash(this.imageHash);
|
||||
return RL.link().emptyContactPic();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -5718,6 +5800,19 @@ ContactModel.prototype.lineAsCcc = function ()
|
|||
return aResult.join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number=} iType = Enums.ContactPropertyType.Unknown
|
||||
* @param {string=} sValue = ''
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function ContactPropertyModel(iType, sValue)
|
||||
{
|
||||
this.type = ko.observable(Utils.isUnd(iType) ? Enums.ContactPropertyType.Unknown : iType);
|
||||
this.focused = ko.observable(false);
|
||||
this.value = ko.observable(Utils.pString(sValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -8060,7 +8155,7 @@ PopupsComposeViewModel.prototype.sendMessageResponse = function (sResult, oData)
|
|||
else
|
||||
{
|
||||
this.sendError(true);
|
||||
window.alert(Utils.getNotification(oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantSendMessage));
|
||||
window.alert(Utils.getNotification(oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantSendMessage));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -8948,12 +9043,22 @@ function PopupsContactsViewModel()
|
|||
{
|
||||
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsContacts');
|
||||
|
||||
var self = this;
|
||||
var
|
||||
self = this,
|
||||
aNameTypes = [Enums.ContactPropertyType.FullName, Enums.ContactPropertyType.FirstName, Enums.ContactPropertyType.SurName, Enums.ContactPropertyType.MiddleName],
|
||||
aEmailTypes = [Enums.ContactPropertyType.EmailPersonal, Enums.ContactPropertyType.EmailBussines, Enums.ContactPropertyType.EmailOther],
|
||||
aPhonesTypes = [
|
||||
Enums.ContactPropertyType.PhonePersonal, Enums.ContactPropertyType.PhoneBussines, Enums.ContactPropertyType.PhoneOther,
|
||||
Enums.ContactPropertyType.MobilePersonal, Enums.ContactPropertyType.MobileBussines, Enums.ContactPropertyType.MobileOther,
|
||||
Enums.ContactPropertyType.FaxPesonal, Enums.ContactPropertyType.FaxBussines, Enums.ContactPropertyType.FaxOther
|
||||
],
|
||||
fFastClearEmptyListHelper = function (aList) {
|
||||
if (aList && 0 < aList.length) {
|
||||
self.viewProperties.removeAll(aList);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
this.imageUploader = ko.observable(null);
|
||||
this.imageDom = ko.observable(null);
|
||||
this.imageTrigger = ko.observable(false);
|
||||
|
||||
this.search = ko.observable('');
|
||||
this.contacts = ko.observableArray([]);
|
||||
this.contacts.loading = ko.observable(false).extend({'throttle': 200});
|
||||
|
|
@ -8963,11 +9068,50 @@ function PopupsContactsViewModel()
|
|||
this.viewClearSearch = ko.observable(false);
|
||||
|
||||
this.viewID = ko.observable('');
|
||||
this.viewName = ko.observable('');
|
||||
this.viewName.focused = ko.observable(false);
|
||||
this.viewEmail = ko.observable('').validateEmail();
|
||||
this.viewEmail.focused = ko.observable(false);
|
||||
this.viewImageUrl = ko.observable(RL.link().emptyContactPic());
|
||||
this.viewProperties = ko.observableArray([]);
|
||||
|
||||
this.viewPropertiesNames = this.viewProperties.filter(function(oProperty) {
|
||||
return -1 < Utils.inArray(oProperty.type(), aNameTypes);
|
||||
});
|
||||
|
||||
this.viewPropertiesEmails = this.viewProperties.filter(function(oProperty) {
|
||||
return -1 < Utils.inArray(oProperty.type(), aEmailTypes);
|
||||
});
|
||||
|
||||
this.viewHasNonEmptyRequaredProperties = ko.computed(function() {
|
||||
|
||||
var
|
||||
aNames = this.viewPropertiesNames(),
|
||||
aEmail = this.viewPropertiesEmails(),
|
||||
fHelper = function (oProperty) {
|
||||
return '' !== Utils.trim(oProperty.value());
|
||||
}
|
||||
;
|
||||
|
||||
return !!(_.find(aNames, fHelper) || _.find(aEmail, fHelper));
|
||||
}, this);
|
||||
|
||||
this.viewPropertiesPhones = this.viewProperties.filter(function(oProperty) {
|
||||
return -1 < Utils.inArray(oProperty.type(), aPhonesTypes);
|
||||
});
|
||||
|
||||
this.viewPropertiesEmailsEmptyAndOnFocused = this.viewPropertiesEmails.filter(function(oProperty) {
|
||||
var bF = oProperty.focused();
|
||||
return '' === Utils.trim(oProperty.value()) && !bF;
|
||||
});
|
||||
|
||||
this.viewPropertiesPhonesEmptyAndOnFocused = this.viewPropertiesPhones.filter(function(oProperty) {
|
||||
var bF = oProperty.focused();
|
||||
return '' === Utils.trim(oProperty.value()) && !bF;
|
||||
});
|
||||
|
||||
this.viewPropertiesEmailsEmptyAndOnFocused.subscribe(function(aList) {
|
||||
fFastClearEmptyListHelper(aList);
|
||||
});
|
||||
|
||||
this.viewPropertiesPhonesEmptyAndOnFocused.subscribe(function(aList) {
|
||||
fFastClearEmptyListHelper(aList);
|
||||
});
|
||||
|
||||
this.viewSaving = ko.observable(false);
|
||||
|
||||
|
|
@ -8981,8 +9125,8 @@ function PopupsContactsViewModel()
|
|||
Utils.windowResize();
|
||||
}, this);
|
||||
|
||||
this.viewImageUrl.subscribe(function (sUrl) {
|
||||
this.imageDom()['src'] = sUrl;
|
||||
this.viewProperties.subscribe(function () {
|
||||
Utils.windowResize();
|
||||
}, this);
|
||||
|
||||
this.contactsChecked = ko.computed(function () {
|
||||
|
|
@ -9043,22 +9187,26 @@ function PopupsContactsViewModel()
|
|||
if (Utils.isNonEmptyArray(aC))
|
||||
{
|
||||
aE = _.map(aC, function (oItem) {
|
||||
if (oItem && oItem['emails'])
|
||||
if (oItem)
|
||||
{
|
||||
var oEmail = new EmailModel(oItem['emails'][0] || '', oItem['name']);
|
||||
if (oEmail.validate())
|
||||
var
|
||||
aData = oItem.getNameAndEmailHelper(),
|
||||
oEmail = aData ? new EmailModel(aData[0], aData[1]) : null
|
||||
;
|
||||
|
||||
if (oEmail && oEmail.validate())
|
||||
{
|
||||
return oEmail;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
aE = _.compact(aE);
|
||||
}
|
||||
|
||||
if (Utils.isNonEmptyArray(aC))
|
||||
if (Utils.isNonEmptyArray(aE))
|
||||
{
|
||||
kn.hideScreenPopup(PopupsContactsViewModel);
|
||||
kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.Empty, null, aE]);
|
||||
|
|
@ -9073,12 +9221,21 @@ function PopupsContactsViewModel()
|
|||
});
|
||||
|
||||
this.saveCommand = Utils.createCommand(this, function () {
|
||||
var
|
||||
|
||||
this.viewSaving(true);
|
||||
|
||||
var
|
||||
sRequestUid = Utils.fakeMd5(),
|
||||
bImageTrigger = this.imageTrigger()
|
||||
aProperties = []
|
||||
;
|
||||
|
||||
this.viewSaving(true);
|
||||
_.each(this.viewProperties(), function (oItem) {
|
||||
if (oItem.type() && '' !== Utils.trim(oItem.value()))
|
||||
{
|
||||
aProperties.push([oItem.type(), oItem.value()]);
|
||||
}
|
||||
});
|
||||
|
||||
RL.remote().contactSave(function (sResult, oData) {
|
||||
|
||||
self.viewSaving(false);
|
||||
|
|
@ -9091,31 +9248,42 @@ function PopupsContactsViewModel()
|
|||
}
|
||||
|
||||
self.reloadContactList();
|
||||
if (bImageTrigger)
|
||||
{
|
||||
RL.emailsPicsHashes();
|
||||
}
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
}, sRequestUid, this.viewID(), this.viewName(), this.viewEmail(), bImageTrigger ? this.imageDom()['src'] : '');
|
||||
}, sRequestUid, this.viewID(), aProperties);
|
||||
|
||||
}, function () {
|
||||
var
|
||||
sViewName = this.viewName(),
|
||||
sViewEmail = this.viewEmail()
|
||||
;
|
||||
|
||||
return !this.viewSaving() &&
|
||||
('' !== sViewName || '' !== sViewEmail);
|
||||
var bV = this.viewHasNonEmptyRequaredProperties();
|
||||
return !this.viewSaving() && bV;
|
||||
});
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('PopupsContactsViewModel', PopupsContactsViewModel);
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewEmail = function ()
|
||||
{
|
||||
// if (0 === this.viewPropertiesEmailsEmpty().length)
|
||||
// {
|
||||
var oItem = new ContactPropertyModel(Enums.ContactPropertyType.EmailPersonal, '');
|
||||
oItem.focused(true);
|
||||
this.viewProperties.push(oItem);
|
||||
// }
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewPhone = function ()
|
||||
{
|
||||
// if (0 === this.viewPropertiesPhonesEmpty().length)
|
||||
// {
|
||||
var oItem = new ContactPropertyModel(Enums.ContactPropertyType.PhonePersonal, '');
|
||||
oItem.focused(true);
|
||||
this.viewProperties.push(oItem);
|
||||
// }
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.removeCheckedOrSelectedContactsFromList = function ()
|
||||
{
|
||||
var
|
||||
|
|
@ -9181,28 +9349,51 @@ PopupsContactsViewModel.prototype.deleteResponse = function (sResult, oData)
|
|||
}
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.removeProperty = function (oProp)
|
||||
{
|
||||
this.viewProperties.remove(oProp);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?ContactModel} oContact
|
||||
*/
|
||||
PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
|
||||
{
|
||||
this.imageTrigger(false);
|
||||
var
|
||||
sId = '',
|
||||
bHasName = false,
|
||||
aList = []
|
||||
;
|
||||
|
||||
this.emptySelection(false);
|
||||
|
||||
if (oContact)
|
||||
{
|
||||
this.viewID(oContact.idContact);
|
||||
this.viewName(oContact.name);
|
||||
this.viewEmail(oContact.emails[0] || '');
|
||||
this.viewImageUrl(oContact.srcAttr());
|
||||
sId = oContact.idContact;
|
||||
|
||||
if (Utils.isNonEmptyArray(oContact.properties))
|
||||
{
|
||||
_.each(oContact.properties, function (aProperty) {
|
||||
if (aProperty && aProperty[0])
|
||||
{
|
||||
aList.push(new ContactPropertyModel(aProperty[0], aProperty[1]));
|
||||
if (Enums.ContactPropertyType.FullName === aProperty[0])
|
||||
{
|
||||
bHasName = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (!bHasName)
|
||||
{
|
||||
this.viewID('');
|
||||
this.viewName('');
|
||||
this.viewEmail('');
|
||||
this.viewImageUrl(RL.link().emptyContactPic());
|
||||
aList.push(new ContactPropertyModel(Enums.ContactPropertyType.FullName, ''));
|
||||
}
|
||||
|
||||
this.viewID(sId);
|
||||
this.viewProperties([]);
|
||||
this.viewProperties(aList);
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.reloadContactList = function ()
|
||||
|
|
@ -9233,20 +9424,16 @@ PopupsContactsViewModel.prototype.reloadContactList = function ()
|
|||
self.contacts.setSelectedByUid('' + self.viewID());
|
||||
}
|
||||
|
||||
}, this.search());
|
||||
}, 0, 20, this.search());
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.onBuild = function (oDom)
|
||||
{
|
||||
this.initUploader();
|
||||
|
||||
this.oContentVisible = $('.b-list-content', oDom);
|
||||
this.oContentScrollable = $('.content', this.oContentVisible);
|
||||
|
||||
this.selector.init(this.oContentVisible, this.oContentScrollable);
|
||||
|
||||
this.viewImageUrl.valueHasMutated();
|
||||
|
||||
ko.computed(function () {
|
||||
var
|
||||
bModalVisibility = this.modalVisibility(),
|
||||
|
|
@ -9256,56 +9443,6 @@ PopupsContactsViewModel.prototype.onBuild = function (oDom)
|
|||
}, this).extend({'notify': 'always'});
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.initUploader = function ()
|
||||
{
|
||||
var self = this, oJua = null;
|
||||
if (window.File && window.FileReader && this.imageUploader())
|
||||
{
|
||||
oJua = new Jua({
|
||||
'queueSize': 1,
|
||||
'multipleSizeLimit': 1,
|
||||
'clickElement': this.imageUploader(),
|
||||
'disableDragAndDrop': true,
|
||||
'disableMultiple': true,
|
||||
'onSelect': function (sId, oData) {
|
||||
|
||||
if (oData && oData['File'] && oData['File']['type'])
|
||||
{
|
||||
var
|
||||
oReader = null,
|
||||
oFile = oData['File'],
|
||||
sType = oData['File']['type']
|
||||
;
|
||||
|
||||
if (!sType.match(/image.*/))
|
||||
{
|
||||
window.alert('this file is not an image.');
|
||||
}
|
||||
else
|
||||
{
|
||||
oReader = new window.FileReader();
|
||||
oReader.onload = function (oEvent) {
|
||||
if (oEvent && oEvent.target && oEvent.target.result)
|
||||
{
|
||||
Utils.resizeAndCrop(oEvent.target.result, 150, function (sUrl) {
|
||||
self.viewImageUrl(sUrl);
|
||||
self.imageTrigger(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
oReader.readAsDataURL(oFile);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return oJua;
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.onShow = function ()
|
||||
{
|
||||
kn.routeOff();
|
||||
|
|
@ -10112,7 +10249,7 @@ function MailBoxFolderListViewModel()
|
|||
|
||||
this.iDropOverTimer = 0;
|
||||
|
||||
this.allowContacts = !!RL.settingsGet('ContactsIsSupported') && !!RL.settingsGet('ContactsIsAllowed');
|
||||
this.allowContacts = !!RL.settingsGet('ContactsIsAllowed');
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('MailBoxFolderListViewModel', MailBoxFolderListViewModel);
|
||||
|
|
@ -12507,7 +12644,6 @@ AbstractData.prototype.populateDataOnStart = function()
|
|||
this.dropboxEnable(!!RL.settingsGet('AllowDropboxSocial'));
|
||||
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
|
||||
|
||||
this.contactsIsSupported(!!RL.settingsGet('ContactsIsSupported'));
|
||||
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
|
||||
};
|
||||
|
||||
|
|
@ -14218,11 +14354,15 @@ WebMailAjaxRemoteStorage.prototype.quota = function (fCallback)
|
|||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {number} iOffset
|
||||
* @param {number} iLimit
|
||||
* @param {string} sSearch
|
||||
*/
|
||||
WebMailAjaxRemoteStorage.prototype.contacts = function (fCallback, sSearch)
|
||||
WebMailAjaxRemoteStorage.prototype.contacts = function (fCallback, iOffset, iLimit, sSearch)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'Contacts', {
|
||||
'Offset': iOffset,
|
||||
'Limit': iLimit,
|
||||
'Search': sSearch
|
||||
}, null, '', ['Contacts']);
|
||||
};
|
||||
|
|
@ -14230,15 +14370,12 @@ WebMailAjaxRemoteStorage.prototype.contacts = function (fCallback, sSearch)
|
|||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
WebMailAjaxRemoteStorage.prototype.contactSave = function (fCallback, sRequestUid, sUid, sName, sEmail, sImageData)
|
||||
WebMailAjaxRemoteStorage.prototype.contactSave = function (fCallback, sRequestUid, sUid, aProperties)
|
||||
{
|
||||
sUid = Utils.trim(sUid);
|
||||
this.defaultRequest(fCallback, 'ContactSave', {
|
||||
'RequestUid': sRequestUid,
|
||||
'Uid': sUid,
|
||||
'Name': sName,
|
||||
'Email': sEmail,
|
||||
'ImageData': sImageData
|
||||
'Uid': Utils.trim(sUid),
|
||||
'Properties': aProperties
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -15865,9 +16002,9 @@ RainLoopApp.prototype.getAutocomplete = function (sQuery, fCallback)
|
|||
;
|
||||
|
||||
RL.remote().suggestions(function (sResult, oData) {
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result && Utils.isArray(oData.Result.List))
|
||||
if (Enums.StorageResultType.Success === sResult && oData && Utils.isArray(oData.Result))
|
||||
{
|
||||
aData = _.map(oData.Result.List, function (aItem) {
|
||||
aData = _.map(oData.Result, function (aItem) {
|
||||
return aItem && aItem[0] ? new EmailModel(aItem[0], aItem[1]) : null;
|
||||
});
|
||||
|
||||
|
|
@ -15877,6 +16014,7 @@ RainLoopApp.prototype.getAutocomplete = function (sQuery, fCallback)
|
|||
{
|
||||
fCallback([]);
|
||||
}
|
||||
|
||||
}, sQuery);
|
||||
};
|
||||
|
||||
|
|
@ -15904,7 +16042,7 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
bTwitter = RL.settingsGet('AllowTwitterSocial')
|
||||
;
|
||||
|
||||
if (!RL.settingsGet('AllowChangePassword'))
|
||||
if (!RL.settingsGet('ChangePasswordIsAllowed'))
|
||||
{
|
||||
Utils.removeSettingsViewModel(SettingsChangePasswordScreen);
|
||||
}
|
||||
|
|
|
|||
14
rainloop/v/0.0.0/static/js/app.min.js
vendored
14
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -183,6 +183,17 @@ new a.J;a.La(a.J.Aa);a.b("nativeTemplateEngine",a.J);(function(){a.Ba=function()
|
|||
new a.w;var b=new a.Ba;0<b.Rb&&a.La(b);a.b("jqueryTmplTemplateEngine",a.Ba)})()})})();})();
|
||||
|
||||
|
||||
/*! Knockout projections plugin
|
||||
------------------------------------------------------------------------------
|
||||
Copyright (c) Microsoft Corporation
|
||||
All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
See the Apache Version 2.0 License for specific language governing permissions and limitations under the License.
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
!function(a){"use strict";function b(a,b,c,d,e,f,g){this.inputItem=b,this.stateArrayIndex=c,this.mapping=e,this.arrayOfState=f,this.outputObservableArray=g,this.outputArray=this.outputObservableArray.peek(),this.isIncluded=null,this.suppressNotification=!1,this.outputArrayIndex=a.observable(d),this.mappedValueComputed=a.computed(this.mappingEvaluator,this),this.mappedValueComputed.subscribe(this.onMappingResultChanged,this),this.previousMappedValue=this.mappedValueComputed.peek()}function c(a,b){if(!a)return null;switch(a.status){case"added":return a.index;case"deleted":return a.index+b;default:throw new Error("Unknown diff status: "+a.status)}}function d(a,c,d,e,f,g,h,i,j){var k="number"==typeof c.moved,l=k?d[c.moved]:new b(a,c.value,e,f,g,h,i);return h.splice(e,0,l),l.isIncluded&&j.splice(f,0,l.mappedValueComputed.peek()),k&&(l.stateArrayIndex=e,l.setOutputArrayIndexSilently(f)),l}function e(a,b,c,d,e){var f=b.splice(c,1)[0];f.isIncluded&&e.splice(d,1),"number"!=typeof a.moved&&f.dispose()}function f(a,b,c){return a.stateArrayIndex=b,a.setOutputArrayIndexSilently(c),c+(a.isIncluded?1:0)}function g(a,b){for(var c={},d=0;d<a.length;d++){var e=a[d];"added"===e.status&&"number"==typeof e.moved&&(c[e.moved]=b[e.moved])}return c}function h(a,b,c){return c.length&&b[a.index]?b[a.index].outputArrayIndex.peek():c.length}function i(a,b,i,j,k,l){return b.subscribe(function(b){if(b.length){for(var m=g(b,i),n=0,o=b[0],p=0,q=o&&h(o,i,j),r=o.index;o||r<i.length;r++)if(c(o,p)===r){switch(o.status){case"added":var s=d(a,o,m,r,q,l,i,k,j);s.isIncluded&&q++,p++;break;case"deleted":e(o,i,r,q,j),p--,r--;break;default:throw new Error("Unknown diff status: "+o.status)}n++,o=b[n]}else r<i.length&&(q=f(i[r],r,q));k.valueHasMutated()}},null,"arrayChange")}function j(a,c){for(var d=this,e=[],f=[],g=a.observableArray(f),h=d.peek(),j=0;j<h.length;j++){var k=h[j],l=new b(a,k,j,f.length,c,e,g),n=l.mappedValueComputed.peek();e.push(l),l.isIncluded&&f.push(n)}var o=i(a,d,e,f,g,c),p=a.computed(g).extend({trackArrayChanges:!0}),q=p.dispose;return p.dispose=function(){o.dispose(),a.utils.arrayForEach(e,function(a){a.dispose()}),q.call(this,arguments)},m(a,p),p}function k(a,b){return j.call(this,a,function(a){return b(a)?a:p})}function l(a){function b(a,b){return function(){return b.apply(this,[a].concat(Array.prototype.slice.call(arguments,0)))}}a[q]={map:b(a,j),filter:b(a,k)}}function m(a,b){return a.utils.extend(b,a[q]),b}function n(a){a.projections={_exclusionMarker:p},l(a),m(a,a.observableArray.fn)}function o(){if("undefined"!=typeof module){var b=require("knockout");n(b),module.exports=b}else"ko"in a&&n(a.ko)}var p={};b.prototype.dispose=function(){this.mappedValueComputed.dispose()},b.prototype.mappingEvaluator=function(){var a=this.mapping(this.inputItem,this.outputArrayIndex),b=a!==p;return this.isIncluded!==b&&(null!==this.isIncluded&&this.moveSubsequentItemsBecauseInclusionStateChanged(b),this.isIncluded=b),a},b.prototype.onMappingResultChanged=function(a){a!==this.previousMappedValue&&(this.isIncluded&&this.outputArray.splice(this.outputArrayIndex.peek(),1,a),this.suppressNotification||this.outputObservableArray.valueHasMutated(),this.previousMappedValue=a)},b.prototype.moveSubsequentItemsBecauseInclusionStateChanged=function(a){var b,c,d=this.outputArrayIndex.peek();if(a)for(this.outputArray.splice(d,0,null),b=this.stateArrayIndex+1;b<this.arrayOfState.length;b++)c=this.arrayOfState[b],c.setOutputArrayIndexSilently(c.outputArrayIndex.peek()+1);else for(this.outputArray.splice(d,1),b=this.stateArrayIndex+1;b<this.arrayOfState.length;b++)c=this.arrayOfState[b],c.setOutputArrayIndexSilently(c.outputArrayIndex.peek()-1)},b.prototype.setOutputArrayIndexSilently=function(a){this.suppressNotification=!0,this.outputArrayIndex(a),this.suppressNotification=!1};var q="_ko.projections.cache";o()}(this);
|
||||
|
||||
/*! JUA v1.0 MIT */
|
||||
(function(){function a(a){function l(){if(g&&d<a){var b=g,c=b[0],f=Array.prototype.slice.call(b,1),m=b.index;g===h?g=h=null:g=g.next,++d,f.push(function(a,b){--d;if(i)return;a?e&&k(i=a,e=j=g=h=null):(j[m]=b,--e?l():k(null,j))}),c.apply(null,f)}}var c={},d=0,e=0,f=-1,g,h,i=null,j=[],k=b;return arguments.length<1&&(a=Infinity),c.defer=function(){if(!i){var a=arguments;a.index=++f,h?(h.next=a,h=h.next):g=h=a,++e,l()}return c},c.await=function(a){return k=a,e||k(i,j),c},c}function b(){}typeof module=="undefined"?self.queue=a:module.exports=a,a.version="0.0.2"})();var e=!0,f=null,g=!1,j,k=jQuery,l=window,m=queue;function n(a){return"undefined"===typeof a}function r(a){0<a&&clearTimeout(a)}function u(a){a=a&&(a.originalEvent?a.originalEvent:a)||l.event;return a.dataTransfer?a:f}function v(a,b,c){return!a||!b||n(a[b])?c:a[b]}function y(){for(var a=16,b="",a=n(a)?32:parseInt(a||0,10);b.length<a;)b+="0123456789abcdefghijklmnopqrstuvwxyz".substr(Math.round(36*Math.random()),1);return"jua-uid-"+b+"-"+(new Date).getTime().toString()}
|
||||
function z(a,b){return{FileName:n(a.fileName)?n(a.name)?f:a.name:a.fileName,Size:n(a.fileSize)?n(a.size)?f:a.size:a.fileSize,Type:n(a.type)?f:a.type,Folder:n(b)?"":b,File:a}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue