Line endings

This commit is contained in:
Christoph Haas 2016-12-16 14:52:48 +01:00
parent 0db552608e
commit d93d9ca1b2
8 changed files with 1741 additions and 1741 deletions

View File

@ -1,25 +1,25 @@
v2.0.2: 29.11.2016 v2.0.2: 29.11.2016
- finally compatible with Kopano Webapp 3.1 - finally compatible with Kopano Webapp 3.1
- translation to german added - translation to german added
- Export notification is shown - Export notification is shown
v2.0.1: 01.11.2016 v2.0.1: 01.11.2016
- compatible with Kopano Webapp 3.1 - compatible with Kopano Webapp 3.1
- exporting contacts implemented - exporting contacts implemented
- GUI improvements - GUI improvements
v1.0.3: 01.05.2014 v1.0.3: 01.05.2014
- compatible with WebApp 1.5 and WebApp 1.6 - compatible with WebApp 1.5 and WebApp 1.6
v1.0.2: 06.11.2013 v1.0.2: 06.11.2013
- fixed: importing attachments - fixed: importing attachments
- fixed: plugin not enabled bug - fixed: plugin not enabled bug
- fixed: importing website bug - fixed: importing website bug
- fixed: some other bugs - fixed: some other bugs
v1.0.1: 03.10.2013 v1.0.1: 03.10.2013
- compatible with WebApp 1.4 - compatible with WebApp 1.4
v1.0: 24.6.2013 v1.0: 24.6.2013
- import vcards (1 or more vcards in a file) - import vcards (1 or more vcards in a file)
- chooseable destination addressbook - chooseable destination addressbook

View File

@ -1,58 +1,58 @@
/** /**
* ABOUT.js, Kopano Webapp contact to vcf im/exporter * ABOUT.js, Kopano Webapp contact to vcf im/exporter
* *
* Author: Christoph Haas <christoph.h@sprinternet.at> * Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2016 Christoph Haas * Copyright (C) 2012-2016 Christoph Haas
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
Ext.namespace('Zarafa.plugins.contactimporter'); Ext.namespace('Zarafa.plugins.contactimporter');
/** /**
* @class Zarafa.plugins.contactimporter.ABOUT * @class Zarafa.plugins.contactimporter.ABOUT
* @extends String * @extends String
* *
* The copyright string holding the copyright notice for the Zarafa contactimporter Plugin. * The copyright string holding the copyright notice for the Zarafa contactimporter Plugin.
*/ */
Zarafa.plugins.contactimporter.ABOUT = "" Zarafa.plugins.contactimporter.ABOUT = ""
+ "<p>Copyright (C) 2012-2016 Christoph Haas &lt;christoph.h@sprinternet.at&gt;</p>" + "<p>Copyright (C) 2012-2016 Christoph Haas &lt;christoph.h@sprinternet.at&gt;</p>"
+ "<p>This program is free software; you can redistribute it and/or " + "<p>This program is free software; you can redistribute it and/or "
+ "modify it under the terms of the GNU Lesser General Public " + "modify it under the terms of the GNU Lesser General Public "
+ "License as published by the Free Software Foundation; either " + "License as published by the Free Software Foundation; either "
+ "version 2.1 of the License, or (at your option) any later version.</p>" + "version 2.1 of the License, or (at your option) any later version.</p>"
+ "<p>This program is distributed in the hope that it will be useful, " + "<p>This program is distributed in the hope that it will be useful, "
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of " + "but WITHOUT ANY WARRANTY; without even the implied warranty of "
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU " + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "
+ "Lesser General Public License for more details.</p>" + "Lesser General Public License for more details.</p>"
+ "<p>You should have received a copy of the GNU Lesser General Public " + "<p>You should have received a copy of the GNU Lesser General Public "
+ "License along with this program; if not, write to the Free Software " + "License along with this program; if not, write to the Free Software "
+ "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p>" + "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p>"
+ "<hr />" + "<hr />"
+ "<p>The contactimporter plugin contains the following third-party components:</p>" + "<p>The contactimporter plugin contains the following third-party components:</p>"
+ "<h1>vCard-parser</h1>" + "<h1>vCard-parser</h1>"
+ "<p>Copyright (C) 2016 Jeroen Desloovere</p>" + "<p>Copyright (C) 2016 Jeroen Desloovere</p>"
+ "<p>Licensed under the MIT License.</p>" + "<p>Licensed under the MIT License.</p>"
+ "<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p>" + "<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p>"

View File

@ -1,85 +1,85 @@
/** /**
* ResponseHandler.js, Kopano Webapp contact to vcf im/exporter * ResponseHandler.js, Kopano Webapp contact to vcf im/exporter
* *
* Author: Christoph Haas <christoph.h@sprinternet.at> * Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2016 Christoph Haas * Copyright (C) 2012-2016 Christoph Haas
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
/** /**
* ResponseHandler * ResponseHandler
* *
* This class handles all responses from the php backend * This class handles all responses from the php backend
*/ */
Ext.namespace('Zarafa.plugins.contactimporter.data'); Ext.namespace('Zarafa.plugins.contactimporter.data');
/** /**
* @class Zarafa.plugins.contactimporter.data.ResponseHandler * @class Zarafa.plugins.contactimporter.data.ResponseHandler
* @extends Zarafa.plugins.contactimporter.data.AbstractResponseHandler * @extends Zarafa.plugins.contactimporter.data.AbstractResponseHandler
* *
* Calendar specific response handler. * Calendar specific response handler.
*/ */
Zarafa.plugins.contactimporter.data.ResponseHandler = Ext.extend(Zarafa.core.data.AbstractResponseHandler, { Zarafa.plugins.contactimporter.data.ResponseHandler = Ext.extend(Zarafa.core.data.AbstractResponseHandler, {
/** /**
* @cfg {Function} successCallback The function which * @cfg {Function} successCallback The function which
* will be called after success request. * will be called after success request.
*/ */
successCallback: null, successCallback: null,
/** /**
* Call the successCallback callback function. * Call the successCallback callback function.
* @param {Object} response Object contained the response data. * @param {Object} response Object contained the response data.
*/ */
doLoad: function (response) { doLoad: function (response) {
this.successCallback(response); this.successCallback(response);
}, },
/** /**
* Call the successCallback callback function. * Call the successCallback callback function.
* @param {Object} response Object contained the response data. * @param {Object} response Object contained the response data.
*/ */
doImport: function (response) { doImport: function (response) {
this.successCallback(response); this.successCallback(response);
}, },
/** /**
* Call the successCallback callback function. * Call the successCallback callback function.
* @param {Object} response Object contained the response data. * @param {Object} response Object contained the response data.
*/ */
doExport: function (response) { doExport: function (response) {
this.successCallback(response); this.successCallback(response);
}, },
/** /**
* Call the successCallback callback function. * Call the successCallback callback function.
* @param {Object} response Object contained the response data. * @param {Object} response Object contained the response data.
*/ */
doImportattachment: function (response) { doImportattachment: function (response) {
this.successCallback(response); this.successCallback(response);
}, },
/** /**
* In case exception happened on server, server will return * In case exception happened on server, server will return
* exception response with the code of exception. * exception response with the code of exception.
* @param {Object} response Object contained the response data. * @param {Object} response Object contained the response data.
*/ */
doError: function (response) { doError: function (response) {
alert("error response code: " + response.error.info.code); alert("error response code: " + response.error.info.code);
} }
}); });
Ext.reg('contactimporter.contactresponsehandler', Zarafa.plugins.contactimporter.data.ResponseHandler); Ext.reg('contactimporter.contactresponsehandler', Zarafa.plugins.contactimporter.data.ResponseHandler);

View File

@ -1,67 +1,67 @@
/** /**
* ImportContentPanel.js, Kopano Webapp contact to vcf im/exporter * ImportContentPanel.js, Kopano Webapp contact to vcf im/exporter
* *
* Author: Christoph Haas <christoph.h@sprinternet.at> * Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2016 Christoph Haas * Copyright (C) 2012-2016 Christoph Haas
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
/** /**
* ImportContentPanel * ImportContentPanel
* *
* Container for the importpanel. * Container for the importpanel.
*/ */
Ext.namespace("Zarafa.plugins.contactimporter.dialogs"); Ext.namespace("Zarafa.plugins.contactimporter.dialogs");
/** /**
* @class Zarafa.plugins.contactimporter.dialogs.ImportContentPanel * @class Zarafa.plugins.contactimporter.dialogs.ImportContentPanel
* @extends Zarafa.core.ui.ContentPanel * @extends Zarafa.core.ui.ContentPanel
* *
* The content panel which shows the hierarchy tree of Owncloud account files. * The content panel which shows the hierarchy tree of Owncloud account files.
* @xtype contactimportercontentpanel * @xtype contactimportercontentpanel
*/ */
Zarafa.plugins.contactimporter.dialogs.ImportContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, { Zarafa.plugins.contactimporter.dialogs.ImportContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
/** /**
* @constructor * @constructor
* @param config Configuration structure * @param config Configuration structure
*/ */
constructor: function (config) { constructor: function (config) {
config = config || {}; config = config || {};
var title = dgettext('plugin_contactimporter', 'Import Contacts'); var title = dgettext('plugin_contactimporter', 'Import Contacts');
Ext.applyIf(config, { Ext.applyIf(config, {
layout: 'fit', layout: 'fit',
title: title, title: title,
closeOnSave: true, closeOnSave: true,
width: 620, width: 620,
height: 465, height: 465,
//Add panel //Add panel
items: [ items: [
{ {
xtype: 'contactimporter.importcontactpanel', xtype: 'contactimporter.importcontactpanel',
filename: config.filename, filename: config.filename,
folder: config.folder folder: config.folder
} }
] ]
}); });
Zarafa.plugins.contactimporter.dialogs.ImportContentPanel.superclass.constructor.call(this, config); Zarafa.plugins.contactimporter.dialogs.ImportContentPanel.superclass.constructor.call(this, config);
} }
}); });
Ext.reg('contactimporter.contentpanel', Zarafa.plugins.contactimporter.dialogs.ImportContentPanel); Ext.reg('contactimporter.contentpanel', Zarafa.plugins.contactimporter.dialogs.ImportContentPanel);

View File

@ -1,266 +1,266 @@
/** /**
* plugin.contactimporter.js, Kopano Webapp contact to vcf im/exporter * plugin.contactimporter.js, Kopano Webapp contact to vcf im/exporter
* *
* Author: Christoph Haas <christoph.h@sprinternet.at> * Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2016 Christoph Haas * Copyright (C) 2012-2016 Christoph Haas
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
Ext.namespace("Zarafa.plugins.contactimporter"); // Assign the right namespace Ext.namespace("Zarafa.plugins.contactimporter"); // Assign the right namespace
Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, { // create new import plugin Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, { // create new import plugin
/** /**
* @constructor * @constructor
* @param {Object} config Configuration object * @param {Object} config Configuration object
* *
*/ */
constructor: function (config) { constructor: function (config) {
config = config || {}; config = config || {};
Zarafa.plugins.contactimporter.ImportPlugin.superclass.constructor.call(this, config); Zarafa.plugins.contactimporter.ImportPlugin.superclass.constructor.call(this, config);
}, },
/** /**
* initialises insertion point for plugin * initialises insertion point for plugin
* @protected * @protected
*/ */
initPlugin: function () { initPlugin: function () {
Zarafa.plugins.contactimporter.ImportPlugin.superclass.initPlugin.apply(this, arguments); Zarafa.plugins.contactimporter.ImportPlugin.superclass.initPlugin.apply(this, arguments);
/* our panel */ /* our panel */
Zarafa.core.data.SharedComponentType.addProperty('plugins.contactimporter.dialogs.importcontacts'); Zarafa.core.data.SharedComponentType.addProperty('plugins.contactimporter.dialogs.importcontacts');
/* directly import received vcfs */ /* directly import received vcfs */
this.registerInsertionPoint('common.contextmenu.attachment.actions', this.createAttachmentImportButton, this); this.registerInsertionPoint('common.contextmenu.attachment.actions', this.createAttachmentImportButton, this);
/* export a contact via rightclick */ /* export a contact via rightclick */
this.registerInsertionPoint('context.contact.contextmenu.actions', this.createItemExportInsertionPoint, this); this.registerInsertionPoint('context.contact.contextmenu.actions', this.createItemExportInsertionPoint, this);
}, },
/** /**
* This method hooks to the contact context menu and allows users to export users to vcf. * This method hooks to the contact context menu and allows users to export users to vcf.
* *
* @param include * @param include
* @param btn * @param btn
* @returns {Object} * @returns {Object}
*/ */
createItemExportInsertionPoint: function (include, btn) { createItemExportInsertionPoint: function (include, btn) {
return { return {
text: dgettext('plugin_contactimporter', 'Export vCard'), text: dgettext('plugin_contactimporter', 'Export vCard'),
handler: this.exportToVCF.createDelegate(this, [btn]), handler: this.exportToVCF.createDelegate(this, [btn]),
scope: this, scope: this,
iconCls: 'icon_contactimporter_export' iconCls: 'icon_contactimporter_export'
}; };
}, },
/** /**
* Generates a request to download the selected records as vCard. * Generates a request to download the selected records as vCard.
* @param {Ext.Button} btn * @param {Ext.Button} btn
*/ */
exportToVCF: function (btn) { exportToVCF: function (btn) {
if (btn.records.length == 0) { if (btn.records.length == 0) {
return; // skip if no records where given! return; // skip if no records where given!
} }
var recordIds = []; var recordIds = [];
for (var i = 0; i < btn.records.length; i++) { for (var i = 0; i < btn.records.length; i++) {
recordIds.push(btn.records[i].get("entryid")); recordIds.push(btn.records[i].get("entryid"));
} }
Zarafa.plugins.contactimporter.data.Actions.exportToVCF(btn.records[0].get("store_entryid"), recordIds, undefined); Zarafa.plugins.contactimporter.data.Actions.exportToVCF(btn.records[0].get("store_entryid"), recordIds, undefined);
}, },
/** /**
* Insert import button in all attachment suggestions * Insert import button in all attachment suggestions
* @return {Object} Configuration object for a {@link Ext.Button button} * @return {Object} Configuration object for a {@link Ext.Button button}
*/ */
createAttachmentImportButton: function (include, btn) { createAttachmentImportButton: function (include, btn) {
return { return {
text: dgettext('plugin_contactimporter', 'Import to Contacts'), text: dgettext('plugin_contactimporter', 'Import to Contacts'),
handler: this.getAttachmentFileName.createDelegate(this, [btn]), handler: this.getAttachmentFileName.createDelegate(this, [btn]),
scope: this, scope: this,
iconCls: 'icon_contactimporter_button', iconCls: 'icon_contactimporter_button',
beforeShow: function (item, record) { beforeShow: function (item, record) {
var extension = record.data.name.split('.').pop().toLowerCase(); var extension = record.data.name.split('.').pop().toLowerCase();
if (record.data.filetype == "text/vcard" || record.data.filetype == "text/x-vcard" || extension == "vcf" || extension == "vcard") { if (record.data.filetype == "text/vcard" || record.data.filetype == "text/x-vcard" || extension == "vcf" || extension == "vcard") {
item.setVisible(true); item.setVisible(true);
} else { } else {
item.setVisible(false); item.setVisible(false);
} }
} }
}; };
}, },
/** /**
* Callback for getAttachmentFileName * Callback for getAttachmentFileName
* @param {Object} response * @param {Object} response
*/ */
gotAttachmentFileName: function (response) { gotAttachmentFileName: function (response) {
if (response.status == true) { if (response.status == true) {
this.openImportDialog(response.tmpname); this.openImportDialog(response.tmpname);
} else { } else {
Zarafa.common.dialogs.MessageBox.show({ Zarafa.common.dialogs.MessageBox.show({
title: dgettext('plugin_contactimporter', 'Error'), title: dgettext('plugin_contactimporter', 'Error'),
msg: _(response["message"]), msg: _(response["message"]),
icon: Zarafa.common.dialogs.MessageBox.ERROR, icon: Zarafa.common.dialogs.MessageBox.ERROR,
buttons: Zarafa.common.dialogs.MessageBox.OK buttons: Zarafa.common.dialogs.MessageBox.OK
}); });
} }
}, },
/** /**
* Clickhandler for the button * Clickhandler for the button
* @param {Ext.Button} btn * @param {Ext.Button} btn
*/ */
getAttachmentFileName: function (btn) { getAttachmentFileName: function (btn) {
Zarafa.common.dialogs.MessageBox.show({ Zarafa.common.dialogs.MessageBox.show({
title: dgettext('plugin_contactimporter', 'Please wait'), title: dgettext('plugin_contactimporter', 'Please wait'),
msg: dgettext('plugin_contactimporter', 'Loading attachment...'), msg: dgettext('plugin_contactimporter', 'Loading attachment...'),
progressText: dgettext('plugin_contactimporter', 'Initializing...'), progressText: dgettext('plugin_contactimporter', 'Initializing...'),
width: 300, width: 300,
progress: true, progress: true,
closable: false closable: false
}); });
// progress bar... ;) // progress bar... ;)
var f = function (v) { var f = function (v) {
return function () { return function () {
if (v == 100) { if (v == 100) {
Zarafa.common.dialogs.MessageBox.hide(); Zarafa.common.dialogs.MessageBox.hide();
} else { } else {
// # TRANSLATORS: {0} will be replaced by the percentage value (0-100) // # TRANSLATORS: {0} will be replaced by the percentage value (0-100)
Zarafa.common.dialogs.MessageBox.updateProgress(v / 100, String.format(dgettext('plugin_contactimporter', '{0}% loaded'), Math.round(v))); Zarafa.common.dialogs.MessageBox.updateProgress(v / 100, String.format(dgettext('plugin_contactimporter', '{0}% loaded'), Math.round(v)));
} }
}; };
}; };
for (var i = 1; i < 101; i++) { for (var i = 1; i < 101; i++) {
setTimeout(f(i), 20 * i); setTimeout(f(i), 20 * i);
} }
/* store the attachment to a temporary folder and prepare it for uploading */ /* store the attachment to a temporary folder and prepare it for uploading */
var attachmentRecord = btn.records; var attachmentRecord = btn.records;
var attachmentStore = attachmentRecord.store; var attachmentStore = attachmentRecord.store;
var store = attachmentStore.getParentRecord().get('store_entryid'); var store = attachmentStore.getParentRecord().get('store_entryid');
var entryid = attachmentStore.getAttachmentParentRecordEntryId(); var entryid = attachmentStore.getAttachmentParentRecordEntryId();
var attachNum = new Array(1); var attachNum = new Array(1);
if (attachmentRecord.get('attach_num') != -1) { if (attachmentRecord.get('attach_num') != -1) {
attachNum[0] = attachmentRecord.get('attach_num'); attachNum[0] = attachmentRecord.get('attach_num');
} else { } else {
attachNum[0] = attachmentRecord.get('tmpname'); attachNum[0] = attachmentRecord.get('tmpname');
} }
var dialog_attachments = attachmentStore.getId(); var dialog_attachments = attachmentStore.getId();
var filename = attachmentRecord.data.name; var filename = attachmentRecord.data.name;
var responseHandler = new Zarafa.plugins.contactimporter.data.ResponseHandler({ var responseHandler = new Zarafa.plugins.contactimporter.data.ResponseHandler({
successCallback: this.gotAttachmentFileName.createDelegate(this), successCallback: this.gotAttachmentFileName.createDelegate(this),
scope: this scope: this
}); });
// request attachment preperation // request attachment preperation
container.getRequest().singleRequest( container.getRequest().singleRequest(
'contactmodule', 'contactmodule',
'importattachment', 'importattachment',
{ {
entryid: entryid, entryid: entryid,
store: store, store: store,
attachNum: attachNum, attachNum: attachNum,
dialog_attachments: dialog_attachments, dialog_attachments: dialog_attachments,
filename: filename filename: filename
}, },
responseHandler responseHandler
); );
}, },
/** /**
* Open the import dialog. * Open the import dialog.
* @param {String} filename * @param {String} filename
*/ */
openImportDialog: function (filename) { openImportDialog: function (filename) {
var componentType = Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts']; var componentType = Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts'];
var config = { var config = {
filename: filename, filename: filename,
modal: true modal: true
}; };
Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, config); Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, config);
}, },
/** /**
* Bid for the type of shared component * Bid for the type of shared component
* and the given record. * and the given record.
* This will bid on calendar.dialogs.importcontacts * This will bid on calendar.dialogs.importcontacts
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for. * @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
* @param {Ext.data.Record} record Optionally passed record. * @param {Ext.data.Record} record Optionally passed record.
* @return {Number} The bid for the shared component * @return {Number} The bid for the shared component
*/ */
bidSharedComponent: function (type, record) { bidSharedComponent: function (type, record) {
var bid = -1; var bid = -1;
switch (type) { switch (type) {
case Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts']: case Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts']:
bid = 1; bid = 1;
break; break;
case Zarafa.core.data.SharedComponentType['common.contextmenu']: case Zarafa.core.data.SharedComponentType['common.contextmenu']:
if (record instanceof Zarafa.core.data.MAPIRecord) { if (record instanceof Zarafa.core.data.MAPIRecord) {
if (record.get('object_type') == Zarafa.core.mapi.ObjectType.MAPI_FOLDER && record.get('container_class') == "IPF.Contact") { if (record.get('object_type') == Zarafa.core.mapi.ObjectType.MAPI_FOLDER && record.get('container_class') == "IPF.Contact") {
bid = 2; bid = 2;
} }
} }
break; break;
} }
return bid; return bid;
}, },
/** /**
* Will return the reference to the shared component. * Will return the reference to the shared component.
* Based on the type of component requested a component is returned. * Based on the type of component requested a component is returned.
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for. * @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
* @param {Ext.data.Record} record Optionally passed record. * @param {Ext.data.Record} record Optionally passed record.
* @return {Ext.Component} Component * @return {Ext.Component} Component
*/ */
getSharedComponent: function (type, record) { getSharedComponent: function (type, record) {
var component; var component;
switch (type) { switch (type) {
case Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts']: case Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts']:
component = Zarafa.plugins.contactimporter.dialogs.ImportContentPanel; component = Zarafa.plugins.contactimporter.dialogs.ImportContentPanel;
break; break;
case Zarafa.core.data.SharedComponentType['common.contextmenu']: case Zarafa.core.data.SharedComponentType['common.contextmenu']:
component = Zarafa.plugins.contactimporter.ui.ContextMenu; component = Zarafa.plugins.contactimporter.ui.ContextMenu;
break; break;
} }
return component; return component;
} }
}); });
/*############################################################################################################################ /*############################################################################################################################
* STARTUP * STARTUP
*############################################################################################################################*/ *############################################################################################################################*/
Zarafa.onReady(function () { Zarafa.onReady(function () {
container.registerPlugin(new Zarafa.core.PluginMetaData({ container.registerPlugin(new Zarafa.core.PluginMetaData({
name: 'contactimporter', name: 'contactimporter',
displayName: dgettext('plugin_contactimporter', 'Contactimporter Plugin'), displayName: dgettext('plugin_contactimporter', 'Contactimporter Plugin'),
about: Zarafa.plugins.contactimporter.ABOUT, about: Zarafa.plugins.contactimporter.ABOUT,
pluginConstructor: Zarafa.plugins.contactimporter.ImportPlugin pluginConstructor: Zarafa.plugins.contactimporter.ImportPlugin
})); }));
}); });

View File

@ -1,44 +1,44 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE plugin SYSTEM "manifest.dtd"> <!DOCTYPE plugin SYSTEM "manifest.dtd">
<plugin version="2"> <plugin version="2">
<info> <info>
<version>2.0.2</version> <version>2.0.2</version>
<name>contactimporter</name> <name>contactimporter</name>
<title>VCF Contact Importer/Exporter</title> <title>VCF Contact Importer/Exporter</title>
<author>Christoph Haas</author> <author>Christoph Haas</author>
<authorURL>http://www.sprinternet.at</authorURL> <authorURL>http://www.sprinternet.at</authorURL>
<description>Import or Export a VCF file to/from the zarafa addressbook</description> <description>Import or Export a VCF file to/from the zarafa addressbook</description>
</info> </info>
<translations> <translations>
<translationsdir>languages</translationsdir> <translationsdir>languages</translationsdir>
</translations> </translations>
<config> <config>
<configfile>config.php</configfile> <configfile>config.php</configfile>
</config> </config>
<components> <components>
<component> <component>
<files> <files>
<server> <server>
<serverfile>php/plugin.contactimporter.php</serverfile> <serverfile>php/plugin.contactimporter.php</serverfile>
<serverfile type="module" module="contactmodule">php/module.contact.php</serverfile> <serverfile type="module" module="contactmodule">php/module.contact.php</serverfile>
</server> </server>
<client> <client>
<clientfile load="release">js/contactimporter.js</clientfile> <clientfile load="release">js/contactimporter.js</clientfile>
<clientfile load="debug">js/contactimporter-debug.js</clientfile> <clientfile load="debug">js/contactimporter-debug.js</clientfile>
<clientfile load="source">js/plugin.contactimporter.js</clientfile> <clientfile load="source">js/plugin.contactimporter.js</clientfile>
<clientfile load="source">js/ABOUT.js</clientfile> <clientfile load="source">js/ABOUT.js</clientfile>
<clientfile load="source">js/data/ResponseHandler.js</clientfile> <clientfile load="source">js/data/ResponseHandler.js</clientfile>
<clientfile load="source">js/dialogs/ImportContentPanel.js</clientfile> <clientfile load="source">js/dialogs/ImportContentPanel.js</clientfile>
<clientfile load="source">js/dialogs/ImportPanel.js</clientfile> <clientfile load="source">js/dialogs/ImportPanel.js</clientfile>
<clientfile load="source">js/ui/ContextMenu.js</clientfile> <clientfile load="source">js/ui/ContextMenu.js</clientfile>
</client> </client>
<resources> <resources>
<resourcefile load="release">resources/css/contactimporter.css</resourcefile> <resourcefile load="release">resources/css/contactimporter.css</resourcefile>
<resourcefile load="debug">resources/css/contactimporter.css</resourcefile> <resourcefile load="debug">resources/css/contactimporter.css</resourcefile>
<resourcefile load="source">resources/css/contactimporter-main.css</resourcefile> <resourcefile load="source">resources/css/contactimporter-main.css</resourcefile>
</resources> </resources>
</files> </files>
</component> </component>
</components> </components>
</plugin> </plugin>

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,30 @@
.icon_contactimporter_button { .icon_contactimporter_button {
background: url(../images/import_icon.png) no-repeat !important; background: url(../images/import_icon.png) no-repeat !important;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
} }
.icon_contactimporter_export { .icon_contactimporter_export {
background: url(../images/download.png) no-repeat; background: url(../images/download.png) no-repeat;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
} }
.icon_contactimporter_import { .icon_contactimporter_import {
background: url(../images/upload.png) no-repeat; background: url(../images/upload.png) no-repeat;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
} }
.zarafa-ciplg-container { .zarafa-ciplg-container {
width: 100%; width: 100%;
height: 50px; height: 50px;
} }
.zarafa-ciplg-button .x-btn-small { .zarafa-ciplg-button .x-btn-small {
width: 80%; width: 80%;
height: 30px; height: 30px;
margin-left: 10%; margin-left: 10%;
margin-right: 10%; margin-right: 10%;
margin-top: 10px; margin-top: 10px;
} }