starting changes for v2
This commit is contained in:
@@ -47,7 +47,7 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
config = config || {};
|
||||
var self = this;
|
||||
|
||||
if(typeof config.filename !== "undefined") {
|
||||
if(!Ext.isEmpty(config.filename)) {
|
||||
this.vcffile = config.filename;
|
||||
}
|
||||
|
||||
@@ -146,13 +146,13 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
var i = 0;
|
||||
for(i = 0; i < contactdata.contacts.length; i++) {
|
||||
|
||||
parsedData[i] = new Array(
|
||||
parsedData[i] = [
|
||||
contactdata.contacts[i]["display_name"],
|
||||
contactdata.contacts[i]["given_name"],
|
||||
contactdata.contacts[i]["surname"],
|
||||
contactdata.contacts[i]["company_name"],
|
||||
contactdata.contacts[i]
|
||||
);
|
||||
];
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
@@ -202,10 +202,10 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
|
||||
/* add all local contact folders */
|
||||
var i = 0;
|
||||
myStore.push(new Array(defaultFolder.getDefaultFolderKey(), defaultFolder.getDisplayName()));
|
||||
myStore.push([defaultFolder.getDefaultFolderKey(), defaultFolder.getDisplayName()]);
|
||||
for(i = 0; i < subFolders.length; i++) {
|
||||
/* Store all subfolders */
|
||||
myStore.push(new Array(subFolders[i].getDisplayName(), subFolders[i].getDisplayName(), false)); // 3rd field = isPublicfolder
|
||||
myStore.push([subFolders[i].getDisplayName(), subFolders[i].getDisplayName(), false]); // 3rd field = isPublicfolder
|
||||
}
|
||||
|
||||
/* add all shared contact folders */
|
||||
@@ -217,7 +217,7 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
var pubSubFolders = pubFolder.getChildren();
|
||||
for(i = 0; i < pubSubFolders.length; i++) {
|
||||
if(pubSubFolders[i].isContainerClass("IPF.Contact")){
|
||||
myStore.push(new Array(pubSubFolders[i].getDisplayName(), pubSubFolders[i].getDisplayName() + " [Shared]", true)); // 3rd field = isPublicfolder
|
||||
myStore.push([pubSubFolders[i].getDisplayName(), pubSubFolders[i].getDisplayName() + " [Shared]", true]); // 3rd field = isPublicfolder
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -455,7 +455,7 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
|
||||
if(addressbookexist) {
|
||||
this.loadMask.show();
|
||||
var uids = new Array();
|
||||
var uids = [];
|
||||
var store_entryid = "";
|
||||
|
||||
//receive Records from grid rows
|
||||
|
@@ -47,6 +47,7 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
|
||||
|
||||
/* directly import received vcfs */
|
||||
this.registerInsertionPoint('common.contextmenu.attachment.actions', this.createAttachmentImportButton);
|
||||
|
||||
/* add import button to south navigation */
|
||||
this.registerInsertionPoint("navigation.south", this.createImportButton, this);
|
||||
},
|
||||
@@ -60,7 +61,6 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
|
||||
createImportButton: function () {
|
||||
var button = {
|
||||
xtype : 'button',
|
||||
id : "importcontactsbutton",
|
||||
text : _('Import Contacts'),
|
||||
iconCls : 'icon_contactimporter_button',
|
||||
navigationContext : container.getContextByName('contact'),
|
||||
@@ -90,9 +90,9 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
|
||||
var extension = record.data.name.split('.').pop().toLowerCase();
|
||||
|
||||
if(record.data.filetype == "text/vcard" || extension == "vcf" || extension == "vcard") {
|
||||
item.setDisabled(false);
|
||||
item.setVisible(false);
|
||||
} else {
|
||||
item.setDisabled(true);
|
||||
item.setVisible(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -103,10 +103,7 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
|
||||
*/
|
||||
gotAttachmentFileName: function(response) {
|
||||
if(response.status == true) {
|
||||
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts'], undefined, {
|
||||
manager : Ext.WindowMgr,
|
||||
filename : response.tmpname
|
||||
});
|
||||
this.openImportDialog(response.tmpname);
|
||||
} else {
|
||||
Zarafa.common.dialogs.MessageBox.show({
|
||||
title : _('Error'),
|
||||
@@ -182,12 +179,23 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
|
||||
* Clickhandler for the button
|
||||
*/
|
||||
onImportButtonClick: function () {
|
||||
Ext.getCmp("importcontactsbutton").disable();
|
||||
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts'], undefined, {
|
||||
manager : Ext.WindowMgr
|
||||
});
|
||||
this.openImportDialog();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Open the import dialog.
|
||||
*
|
||||
* @param {String} filename
|
||||
*/
|
||||
openImportDialog: function(filename) {
|
||||
var componentType = Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts'];
|
||||
var config = {
|
||||
filename: filename
|
||||
};
|
||||
|
||||
Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* Bid for the type of shared component
|
||||
* and the given record.
|
||||
@@ -200,7 +208,7 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
|
||||
var bid = -1;
|
||||
switch(type) {
|
||||
case Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts']:
|
||||
bid = 2;
|
||||
bid = 1;
|
||||
break;
|
||||
}
|
||||
return bid;
|
||||
|
Reference in New Issue
Block a user