From 1d4605b23ad27f379509596d9bec82603aebc250 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Tue, 14 Jun 2016 00:57:00 +0200 Subject: [PATCH] some ui improvements --- js/dialogs/ImportContentPanel.js | 3 ++- js/dialogs/ImportPanel.js | 10 ++++++++- js/plugin.contactimporter.js | 3 ++- js/ui/ContextMenu.js | 30 +++++++++++++++++++++++-- resources/css/contactimporter-main.css | 10 +++++++-- resources/images/upload.png | Bin 0 -> 213 bytes resources/images/upload.xcf | Bin 0 -> 930 bytes 7 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 resources/images/upload.png create mode 100755 resources/images/upload.xcf diff --git a/js/dialogs/ImportContentPanel.js b/js/dialogs/ImportContentPanel.js index 4a58ab7..973be71 100644 --- a/js/dialogs/ImportContentPanel.js +++ b/js/dialogs/ImportContentPanel.js @@ -53,7 +53,8 @@ Zarafa.plugins.contactimporter.dialogs.ImportContentPanel = Ext.extend(Zarafa.co items : [ { xtype : 'contactimporter.importcontactpanel', - filename: config.filename + filename: config.filename, + folder: config.folder } ] }); diff --git a/js/dialogs/ImportPanel.js b/js/dialogs/ImportPanel.js index 8f65415..486d5d0 100644 --- a/js/dialogs/ImportPanel.js +++ b/js/dialogs/ImportPanel.js @@ -39,6 +39,9 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, { /* The store for the selection grid */ store : null, + /* selected folder */ + folder : null, + /** * @constructor * @param {object} config @@ -51,6 +54,10 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, { this.vcffile = config.filename; } + if (!Ext.isEmpty(config.folder)) { + this.folder = config.folder; + } + // create the data store // we only display the firstname, lastname, homephone and primary email address in our grid this.store = new Ext.data.ArrayStore({ @@ -224,7 +231,7 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, { name : "choosen_addressbook", value : container.getSettingsModel().get("zarafa/v1/plugins/contactimporter/default_addressbook"), width : 100, - fieldLabel : "Select an addressbook", + fieldLabel : "Select folder", store : myStore, mode : 'local', labelSeperator: ":", @@ -245,6 +252,7 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, { emptyText : 'Select an .vcf addressbook', border : false, anchor : "100%", + height : "30", scope : this, allowBlank : false, listeners : { diff --git a/js/plugin.contactimporter.js b/js/plugin.contactimporter.js index e6338c8..52e88e4 100644 --- a/js/plugin.contactimporter.js +++ b/js/plugin.contactimporter.js @@ -266,7 +266,8 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, { openImportDialog: function (filename) { var componentType = Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts']; var config = { - filename: filename + filename: filename, + modal: true }; Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, config); diff --git a/js/ui/ContextMenu.js b/js/ui/ContextMenu.js index a8e104c..8d5037a 100644 --- a/js/ui/ContextMenu.js +++ b/js/ui/ContextMenu.js @@ -43,7 +43,19 @@ Zarafa.plugins.contactimporter.ui.ContextMenu = Ext.extend(Zarafa.hierarchy.ui.C return [{ xtype: 'menuseparator' }, { - text : _('Export VCF'), + text : _('Import vCard'), + iconCls : 'icon_contactimporter_import', + handler : this.onContextItemImport, + beforeShow : function(item, record) { + var access = record.get('access') & Zarafa.core.mapi.Access.ACCESS_MODIFY; + if (!access || (record.isIPMSubTree() && !record.getMAPIStore().isDefaultStore())) { + item.setDisabled(true); + } else { + item.setDisabled(false); + } + } + }, { + text : _('Export vCard'), iconCls : 'icon_contactimporter_export', handler : this.onContextItemExport, beforeShow : function(item, record) { @@ -58,7 +70,7 @@ Zarafa.plugins.contactimporter.ui.ContextMenu = Ext.extend(Zarafa.hierarchy.ui.C }, /** - * Fires on selecting 'Open' menu option from {@link Zarafa.hierarchy.ui.ContextMenu ContextMenu} + * Fires on selecting 'Open' menu option from {@link Zarafa.plugins.contactimporter.ui.ContextMenu ContextMenu} * @private */ onContextItemExport: function () { @@ -79,6 +91,20 @@ Zarafa.plugins.contactimporter.ui.ContextMenu = Ext.extend(Zarafa.hierarchy.ui.C ); }, + /** + * Fires on selecting 'Open' menu option from {@link Zarafa.plugins.contactimporter.ui.ContextMenu ContextMenu} + * @private + */ + onContextItemImport: function () { + var componentType = Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts']; + var config = { + modal: true, + folder: this.records.get("entryid") + }; + + Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, config); + }, + downloadVCF: function (response) { if(response.status == false) { Zarafa.common.dialogs.MessageBox.show({ diff --git a/resources/css/contactimporter-main.css b/resources/css/contactimporter-main.css index 397d613..258f31c 100644 --- a/resources/css/contactimporter-main.css +++ b/resources/css/contactimporter-main.css @@ -11,14 +11,20 @@ background-position: center; } +.icon_contactimporter_import { + background: url(../images/upload.png) no-repeat; + background-repeat: no-repeat; + background-position: center; +} + .zarafa-ciplg-container { width: 100%; height: 30px; } -.zarafa-ciplg-button.x-btn-small { +.zarafa-ciplg-button .x-btn-small { width: 80%; height: 25px; margin-left: auto; margin-right: auto; -} \ No newline at end of file +} diff --git a/resources/images/upload.png b/resources/images/upload.png new file mode 100644 index 0000000000000000000000000000000000000000..9e3158a4f4363faf5cf39ad03980820bc814009d GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pIsjaN)jHlV|5IZ!Cc)5S4Fi9Qd7{WOD*hM zLXX~YP<+N0a`aB8o`m@YxdzFt5C5ncAI?7iQ*K>mpY_V4&*BdQZDa6s^>bP0l+XkK DM?FXf literal 0 HcmV?d00001 diff --git a/resources/images/upload.xcf b/resources/images/upload.xcf new file mode 100755 index 0000000000000000000000000000000000000000..e89500d6498ef0f592c4e42e5c72a00ef6cb91dc GIT binary patch literal 930 zcmd6k%~HZJ5XaL}q0|p_P%nDO5e{|m6?g`ddnrxKOlg_6&cH1*zJL$lo5~P(A;B`@ z-JSVof8CF?yOnCOq^nd=q4JD?U0EUDfIJV5At;=F1fMA2TToziZ#~xCLH#56YYErJ zYLUn+mX(@Ah(O*Wqqgg}gEjBn5qP(B z+~MG*N{U*P)gozBSzwiq2Ur(`Yd4_KGPd+BgCn?ptU-%Fj?Y_s(c;S%4}kGrXFUMd z-~Qz`?@ukb&xcx{AIE%w&kt-!JRXrR&KM^>vgOQYTTaf90;CR77s*2k*@hF&qJ65v y`s7E!f4|Pauo{Nd#%LT?8{cd-4y#Ro1jB06MS@|q3C%_mZK8duV_?{W0`d(*c)UOW literal 0 HcmV?d00001