Import contacts (close #44)

+ Some small improvements and fixes
This commit is contained in:
RainLoop Team 2014-01-15 00:02:30 +04:00
parent 9cc791caba
commit 8c0276631b
36 changed files with 628 additions and 66 deletions

View file

@ -5267,7 +5267,8 @@ a.badge:hover {
line-height: 18px;
font-size: 18px;
margin-top: -2px;
margin-left: -2px;
margin-left: -1px;
width: 17px;
}
.iconsize24 {
line-height: 24px;
@ -5680,11 +5681,13 @@ html.no-rgba .modal {
}
.g-ui-user-select-none {
-webkit-user-select: none;
-webkit-touch-callout: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
-webkit-touch-callout: none;
standard-user-select: none;
}
.g-ui-clearfix {
*zoom: 1;
@ -7483,7 +7486,7 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
box-shadow: none;
border-color: #fff;
font-size: 18px;
width: 250px;
width: 300px;
}
.b-contacts-content.modal .b-view-content .contactValueInput:hover {
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);

File diff suppressed because one or more lines are too long

View file

@ -3022,6 +3022,14 @@ LinkBuilder.prototype.upload = function ()
return this.sServer + '/Upload/' + this.sSpecSuffix + '/';
};
/**
* @return {string}
*/
LinkBuilder.prototype.uploadContacts = function ()
{
return this.sServer + '/UploadContacts/' + this.sSpecSuffix + '/';
};
/**
* @return {string}
*/

File diff suppressed because one or more lines are too long

View file

@ -3022,6 +3022,14 @@ LinkBuilder.prototype.upload = function ()
return this.sServer + '/Upload/' + this.sSpecSuffix + '/';
};
/**
* @return {string}
*/
LinkBuilder.prototype.uploadContacts = function ()
{
return this.sServer + '/UploadContacts/' + this.sSpecSuffix + '/';
};
/**
* @return {string}
*/
@ -4376,9 +4384,16 @@ Selector.prototype.init = function (oContentVisible, oContentScrollable)
;
$(this.oContentVisible)
.on('selectstart', function (oEvent) {
if (oEvent && oEvent.preventDefault)
{
oEvent.preventDefault();
}
})
.on('click', this.sItemSelector, function (oEvent) {
self.actionClick(ko.dataFor(this), oEvent);
}).on('click', this.sItemCheckedSelector, function (oEvent) {
})
.on('click', this.sItemCheckedSelector, function (oEvent) {
var oItem = ko.dataFor(this);
if (oItem)
{
@ -9429,8 +9444,11 @@ function PopupsContactsViewModel()
this.contactsCount = ko.observable(0);
this.contacts = ko.observableArray([]);
this.contacts.loading = ko.observable(false).extend({'throttle': 200});
this.contacts.importing = ko.observable(false).extend({'throttle': 200});
this.currentContact = ko.observable(null);
this.importUploaderButton = ko.observable(null);
this.contactsSharingIsAllowed = !!RL.settingsGet('ContactsSharingIsAllowed');
this.contactsPage = ko.observable(1);
@ -9733,6 +9751,46 @@ PopupsContactsViewModel.prototype.addNewPhone = function ()
this.addNewProperty(Enums.ContactPropertyType.MobilePersonal);
};
PopupsContactsViewModel.prototype.initUploader = function ()
{
if (this.importUploaderButton())
{
var
oJua = new Jua({
'action': RL.link().uploadContacts(),
'name': 'uploader',
'queueSize': 1,
'multipleSizeLimit': 1,
'disableFolderDragAndDrop': true,
'disableDragAndDrop': true,
'disableMultiple': true,
'disableDocumentDropPrevent': true,
'clickElement': this.importUploaderButton()
})
;
if (oJua)
{
oJua
.on('onStart', _.bind(function () {
this.contacts.importing(true);
}, this))
.on('onComplete', _.bind(function (sId, bResult, oData) {
this.contacts.importing(false);
this.reloadContactList();
if (!sId || !bResult || !oData || !oData.Result)
{
window.alert(Utils.i18n('CONTACTS/ERROR_IMPORT_FILE'));
}
}, this))
;
}
}
};
PopupsContactsViewModel.prototype.removeCheckedOrSelectedContactsFromList = function ()
{
var
@ -9972,6 +10030,8 @@ PopupsContactsViewModel.prototype.onBuild = function (oDom)
return bResult;
});
this.initUploader();
};
PopupsContactsViewModel.prototype.onShow = function ()

File diff suppressed because one or more lines are too long