Code comments
This commit is contained in:
parent
e0eb5cf1f0
commit
5c98fe9e56
@ -2,7 +2,7 @@
|
|||||||
* ABOUT.js zarafa contact to vcf im/exporter
|
* ABOUT.js zarafa contact to vcf im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||||
* Copyright (C) 2012-2013 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
|
||||||
|
@ -54,7 +54,7 @@ Zarafa.plugins.contactimporter.dialogs.ImportContentPanel = Ext.extend(Zarafa.co
|
|||||||
{
|
{
|
||||||
xtype : 'contactimporter.importcontactpanel',
|
xtype : 'contactimporter.importcontactpanel',
|
||||||
filename: config.filename,
|
filename: config.filename,
|
||||||
folder: config.folder
|
folder : config.folder
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
@ -29,7 +29,7 @@ Ext.namespace("Zarafa.plugins.contactimporter.dialogs");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Zarafa.plugins.contactimporter.dialogs.ImportPanel
|
* @class Zarafa.plugins.contactimporter.dialogs.ImportPanel
|
||||||
* @extends Ext.form.FormPanel
|
* @extends Ext.Panel
|
||||||
*/
|
*/
|
||||||
Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||||
|
|
||||||
@ -132,7 +132,12 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
getAllContactFolders: function(asDropdownStore) {
|
/**
|
||||||
|
* Get all contact folders.
|
||||||
|
* @param {boolean} asDropdownStore If true, a simple array store will be returned.
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
getAllContactFolders: function (asDropdownStore) {
|
||||||
asDropdownStore = Ext.isEmpty(asDropdownStore) ? false : asDropdownStore;
|
asDropdownStore = Ext.isEmpty(asDropdownStore) ? false : asDropdownStore;
|
||||||
|
|
||||||
var allFolders = [];
|
var allFolders = [];
|
||||||
@ -142,11 +147,11 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
var inbox = container.getHierarchyStore().getDefaultStore();
|
var inbox = container.getHierarchyStore().getDefaultStore();
|
||||||
var pub = container.getHierarchyStore().getPublicStore();
|
var pub = container.getHierarchyStore().getPublicStore();
|
||||||
|
|
||||||
if(!Ext.isEmpty(inbox.subStores) && inbox.subStores.folders.totalLength > 0) {
|
if (!Ext.isEmpty(inbox.subStores) && inbox.subStores.folders.totalLength > 0) {
|
||||||
for(var i=0; i < inbox.subStores.folders.totalLength; i++) {
|
for (var i = 0; i < inbox.subStores.folders.totalLength; i++) {
|
||||||
var folder = inbox.subStores.folders.getAt(i);
|
var folder = inbox.subStores.folders.getAt(i);
|
||||||
if(folder.get("container_class") == "IPF.Contact") {
|
if (folder.get("container_class") == "IPF.Contact") {
|
||||||
if(asDropdownStore) {
|
if (asDropdownStore) {
|
||||||
allFolders.push([
|
allFolders.push([
|
||||||
folder.get("entryid"),
|
folder.get("entryid"),
|
||||||
folder.get("display_name")
|
folder.get("display_name")
|
||||||
@ -163,11 +168,11 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Ext.isEmpty(pub.subStores) && pub.subStores.folders.totalLength > 0) {
|
if (!Ext.isEmpty(pub.subStores) && pub.subStores.folders.totalLength > 0) {
|
||||||
for(var j=0; j < pub.subStores.folders.totalLength; j++) {
|
for (var j = 0; j < pub.subStores.folders.totalLength; j++) {
|
||||||
var folder = pub.subStores.folders.getAt(j);
|
var folder = pub.subStores.folders.getAt(j);
|
||||||
if(folder.get("container_class") == "IPF.Contact") {
|
if (folder.get("container_class") == "IPF.Contact") {
|
||||||
if(asDropdownStore) {
|
if (asDropdownStore) {
|
||||||
allFolders.push([
|
allFolders.push([
|
||||||
folder.get("entryid"),
|
folder.get("entryid"),
|
||||||
folder.get("display_name") + " (Public)"
|
folder.get("display_name") + " (Public)"
|
||||||
@ -184,30 +189,40 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(asDropdownStore) {
|
if (asDropdownStore) {
|
||||||
return allFolders.sort(this.dynamicSort(1));
|
return allFolders.sort(this.dynamicSort(1));
|
||||||
} else {
|
} else {
|
||||||
return allFolders;
|
return allFolders;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
dynamicSort: function(property) {
|
/**
|
||||||
|
* Dynamic sort function, sorts by property name.
|
||||||
|
* @param {string|int} property
|
||||||
|
* @returns {Function}
|
||||||
|
*/
|
||||||
|
dynamicSort: function (property) {
|
||||||
var sortOrder = 1;
|
var sortOrder = 1;
|
||||||
if(property[0] === "-") {
|
if (property[0] === "-") {
|
||||||
sortOrder = -1;
|
sortOrder = -1;
|
||||||
property = property.substr(1);
|
property = property.substr(1);
|
||||||
}
|
}
|
||||||
return function (a,b) {
|
return function (a, b) {
|
||||||
var result = (a[property].toLowerCase() < b[property].toLowerCase()) ? -1 : (a[property].toLowerCase() > b[property].toLowerCase()) ? 1 : 0;
|
var result = (a[property].toLowerCase() < b[property].toLowerCase()) ? -1 : (a[property].toLowerCase() > b[property].toLowerCase()) ? 1 : 0;
|
||||||
return result * sortOrder;
|
return result * sortOrder;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getContactFolderByName: function(name) {
|
/**
|
||||||
|
* Return a contact folder element by name.
|
||||||
|
* @param {string} name
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
getContactFolderByName: function (name) {
|
||||||
var folders = this.getAllContactFolders(false);
|
var folders = this.getAllContactFolders(false);
|
||||||
|
|
||||||
for(var i=0; i<folders.length; i++) {
|
for (var i = 0; i < folders.length; i++) {
|
||||||
if(folders[i].display_name == name) {
|
if (folders[i].display_name == name) {
|
||||||
return folders[i];
|
return folders[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,6 +291,10 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the UI calendar select box.
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
createSelectBox: function () {
|
createSelectBox: function () {
|
||||||
var myStore = this.getAllContactFolders(true);
|
var myStore = this.getAllContactFolders(true);
|
||||||
|
|
||||||
@ -298,6 +317,10 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the UI upload field.
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
createUploadField: function () {
|
createUploadField: function () {
|
||||||
return {
|
return {
|
||||||
xtype : "fileuploadfield",
|
xtype : "fileuploadfield",
|
||||||
@ -318,6 +341,10 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the UI submit button.
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
createSubmitButton: function () {
|
createSubmitButton: function () {
|
||||||
return {
|
return {
|
||||||
xtype : "button",
|
xtype : "button",
|
||||||
@ -333,6 +360,10 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the UI submit all button.
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
createSubmitAllButton: function () {
|
createSubmitAllButton: function () {
|
||||||
return {
|
return {
|
||||||
xtype : "button",
|
xtype : "button",
|
||||||
@ -348,6 +379,10 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the UI cancel button.
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
createCancelButton: function () {
|
createCancelButton: function () {
|
||||||
return {
|
return {
|
||||||
xtype : "button",
|
xtype : "button",
|
||||||
@ -394,6 +429,10 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start request to server to parse the given vCard file.
|
||||||
|
* @param {string} vcfPath
|
||||||
|
*/
|
||||||
parseContacts: function (vcfPath) {
|
parseContacts: function (vcfPath) {
|
||||||
this.loadMask.show();
|
this.loadMask.show();
|
||||||
|
|
||||||
@ -412,6 +451,10 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for the parsing request.
|
||||||
|
* @param {Object} response
|
||||||
|
*/
|
||||||
handleParsingResult: function (response) {
|
handleParsingResult: function (response) {
|
||||||
this.loadMask.hide();
|
this.loadMask.hide();
|
||||||
|
|
||||||
@ -432,16 +475,25 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the UI dialog.
|
||||||
|
*/
|
||||||
close: function () {
|
close: function () {
|
||||||
this.addContactFormPanel.getForm().reset();
|
this.addContactFormPanel.getForm().reset();
|
||||||
this.dialog.close()
|
this.dialog.close()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a request to import all selected contacts.
|
||||||
|
*/
|
||||||
importCheckedContacts: function () {
|
importCheckedContacts: function () {
|
||||||
var newRecords = this.contactGrid.selModel.getSelections();
|
var newRecords = this.contactGrid.selModel.getSelections();
|
||||||
this.importContacts(newRecords);
|
this.importContacts(newRecords);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check all contacts and import them.
|
||||||
|
*/
|
||||||
importAllContacts: function () {
|
importAllContacts: function () {
|
||||||
//receive Records from grid rows
|
//receive Records from grid rows
|
||||||
this.contactGrid.selModel.selectAll(); // select all entries
|
this.contactGrid.selModel.selectAll(); // select all entries
|
||||||
@ -450,8 +502,8 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function stores all given events to the appointmentstore
|
* This function stores all given events to the contact store
|
||||||
* @param events
|
* @param {array} contacts
|
||||||
*/
|
*/
|
||||||
importContacts: function (contacts) {
|
importContacts: function (contacts) {
|
||||||
//receive existing contact store
|
//receive existing contact store
|
||||||
@ -540,6 +592,10 @@ Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for the import request.
|
||||||
|
* @param {Object} response
|
||||||
|
*/
|
||||||
importContactsDone: function (response) {
|
importContactsDone: function (response) {
|
||||||
this.loadMask.hide();
|
this.loadMask.hide();
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
|
@ -68,6 +68,10 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a request to download the selected records as vCard.
|
||||||
|
* @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!
|
||||||
@ -96,8 +100,12 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for the export request.
|
||||||
|
* @param {Object} response
|
||||||
|
*/
|
||||||
downloadVCF: function (response) {
|
downloadVCF: function (response) {
|
||||||
if(response.status == false) {
|
if (response.status == false) {
|
||||||
Zarafa.common.dialogs.MessageBox.show({
|
Zarafa.common.dialogs.MessageBox.show({
|
||||||
title : dgettext('plugin_files', 'Warning'),
|
title : dgettext('plugin_files', 'Warning'),
|
||||||
msg : dgettext('plugin_files', response.message),
|
msg : dgettext('plugin_files', response.message),
|
||||||
@ -146,6 +154,7 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for getAttachmentFileName
|
* Callback for getAttachmentFileName
|
||||||
|
* @param {Object} response
|
||||||
*/
|
*/
|
||||||
gotAttachmentFileName: function (response) {
|
gotAttachmentFileName: function (response) {
|
||||||
if (response.status == true) {
|
if (response.status == true) {
|
||||||
@ -162,6 +171,7 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Clickhandler for the button
|
* Clickhandler for the button
|
||||||
|
* @param {Ext.Button} btn
|
||||||
*/
|
*/
|
||||||
getAttachmentFileName: function (btn) {
|
getAttachmentFileName: function (btn) {
|
||||||
Zarafa.common.dialogs.MessageBox.show({
|
Zarafa.common.dialogs.MessageBox.show({
|
||||||
@ -225,14 +235,13 @@ Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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);
|
||||||
|
@ -11,8 +11,7 @@ Zarafa.plugins.contactimporter.ui.ContextMenu = Ext.extend(Zarafa.hierarchy.ui.C
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {Object} config Configuration object
|
* @param {Object} config Configuration object
|
||||||
*/
|
*/
|
||||||
constructor : function(config)
|
constructor: function (config) {
|
||||||
{
|
|
||||||
config = config || {};
|
config = config || {};
|
||||||
|
|
||||||
if (config.contextNode) {
|
if (config.contextNode) {
|
||||||
@ -23,7 +22,7 @@ Zarafa.plugins.contactimporter.ui.ContextMenu = Ext.extend(Zarafa.hierarchy.ui.C
|
|||||||
|
|
||||||
// add item to menu
|
// add item to menu
|
||||||
var additionalItems = this.createAdditionalContextMenuItems(config);
|
var additionalItems = this.createAdditionalContextMenuItems(config);
|
||||||
for(var i=0; i <additionalItems.length; i++) {
|
for (var i = 0; i < additionalItems.length; i++) {
|
||||||
config.items[0].push(additionalItems[i]);
|
config.items[0].push(additionalItems[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,15 +37,14 @@ Zarafa.plugins.contactimporter.ui.ContextMenu = Ext.extend(Zarafa.hierarchy.ui.C
|
|||||||
*
|
*
|
||||||
* Note: All handlers are called within the scope of {@link Zarafa.plugins.contactimporter.ui.ContextMenu HierarchyContextMenu}
|
* Note: All handlers are called within the scope of {@link Zarafa.plugins.contactimporter.ui.ContextMenu HierarchyContextMenu}
|
||||||
*/
|
*/
|
||||||
createAdditionalContextMenuItems : function(config)
|
createAdditionalContextMenuItems: function (config) {
|
||||||
{
|
|
||||||
return [{
|
return [{
|
||||||
xtype: 'menuseparator'
|
xtype: 'menuseparator'
|
||||||
}, {
|
}, {
|
||||||
text : _('Import vCard'),
|
text : _('Import vCard'),
|
||||||
iconCls : 'icon_contactimporter_import',
|
iconCls : 'icon_contactimporter_import',
|
||||||
handler : this.onContextItemImport,
|
handler : this.onContextItemImport,
|
||||||
beforeShow : function(item, record) {
|
beforeShow: function (item, record) {
|
||||||
var access = record.get('access') & Zarafa.core.mapi.Access.ACCESS_MODIFY;
|
var access = record.get('access') & Zarafa.core.mapi.Access.ACCESS_MODIFY;
|
||||||
if (!access || (record.isIPMSubTree() && !record.getMAPIStore().isDefaultStore())) {
|
if (!access || (record.isIPMSubTree() && !record.getMAPIStore().isDefaultStore())) {
|
||||||
item.setDisabled(true);
|
item.setDisabled(true);
|
||||||
@ -58,7 +56,7 @@ Zarafa.plugins.contactimporter.ui.ContextMenu = Ext.extend(Zarafa.hierarchy.ui.C
|
|||||||
text : _('Export vCard'),
|
text : _('Export vCard'),
|
||||||
iconCls : 'icon_contactimporter_export',
|
iconCls : 'icon_contactimporter_export',
|
||||||
handler : this.onContextItemExport,
|
handler : this.onContextItemExport,
|
||||||
beforeShow : function(item, record) {
|
beforeShow: function (item, record) {
|
||||||
var access = record.get('access') & Zarafa.core.mapi.Access.ACCESS_READ;
|
var access = record.get('access') & Zarafa.core.mapi.Access.ACCESS_READ;
|
||||||
if (!access || (record.isIPMSubTree() && !record.getMAPIStore().isDefaultStore())) {
|
if (!access || (record.isIPMSubTree() && !record.getMAPIStore().isDefaultStore())) {
|
||||||
item.setDisabled(true);
|
item.setDisabled(true);
|
||||||
@ -85,7 +83,7 @@ Zarafa.plugins.contactimporter.ui.ContextMenu = Ext.extend(Zarafa.hierarchy.ui.C
|
|||||||
'export',
|
'export',
|
||||||
{
|
{
|
||||||
storeid: this.records.get("store_entryid"),
|
storeid: this.records.get("store_entryid"),
|
||||||
folder: this.records.get("entryid")
|
folder : this.records.get("entryid")
|
||||||
},
|
},
|
||||||
responseHandler
|
responseHandler
|
||||||
);
|
);
|
||||||
@ -98,15 +96,19 @@ Zarafa.plugins.contactimporter.ui.ContextMenu = Ext.extend(Zarafa.hierarchy.ui.C
|
|||||||
onContextItemImport: function () {
|
onContextItemImport: function () {
|
||||||
var componentType = Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts'];
|
var componentType = Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts'];
|
||||||
var config = {
|
var config = {
|
||||||
modal: true,
|
modal : true,
|
||||||
folder: this.records.get("entryid")
|
folder: this.records.get("entryid")
|
||||||
};
|
};
|
||||||
|
|
||||||
Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, config);
|
Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, config);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for the export request.
|
||||||
|
* @param {Object} response
|
||||||
|
*/
|
||||||
downloadVCF: function (response) {
|
downloadVCF: function (response) {
|
||||||
if(response.status == false) {
|
if (response.status == false) {
|
||||||
Zarafa.common.dialogs.MessageBox.show({
|
Zarafa.common.dialogs.MessageBox.show({
|
||||||
title : dgettext('plugin_files', 'Warning'),
|
title : dgettext('plugin_files', 'Warning'),
|
||||||
msg : dgettext('plugin_files', response.message),
|
msg : dgettext('plugin_files', response.message),
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* download.php, zarafa contact to vcf im/exporter
|
* download.php, zarafa contact to vcf im/exporter
|
||||||
*
|
*
|
||||||
@ -22,7 +23,10 @@
|
|||||||
*/
|
*/
|
||||||
class DownloadHandler
|
class DownloadHandler
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Download the given vcf file.
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public static function doDownload()
|
public static function doDownload()
|
||||||
{
|
{
|
||||||
if (isset($_GET["token"])) {
|
if (isset($_GET["token"])) {
|
||||||
|
@ -29,7 +29,7 @@ use JeroenDesloovere\VCard\VCardParser;
|
|||||||
class ContactModule extends Module
|
class ContactModule extends Module
|
||||||
{
|
{
|
||||||
|
|
||||||
private $DEBUG = true; // enable error_log debugging
|
private $DEBUG = false; // enable error_log debugging
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@ -249,6 +249,12 @@ class ContactModule extends Module
|
|||||||
$GLOBALS["bus"]->addData($this->getResponseData());
|
$GLOBALS["bus"]->addData($this->getResponseData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a property from the array.
|
||||||
|
* @param $props
|
||||||
|
* @param $propname
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private function getProp($props, $propname)
|
private function getProp($props, $propname)
|
||||||
{
|
{
|
||||||
$p = $this->getProperties();
|
$p = $this->getProperties();
|
||||||
@ -258,6 +264,12 @@ class ContactModule extends Module
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export selected contacts to vCard.
|
||||||
|
* @param $actionType
|
||||||
|
* @param $actionData
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
private function exportContacts($actionType, $actionData)
|
private function exportContacts($actionType, $actionData)
|
||||||
{
|
{
|
||||||
// Get store id
|
// Get store id
|
||||||
@ -290,7 +302,7 @@ class ContactModule extends Module
|
|||||||
$store = $GLOBALS["mapisession"]->openMessageStore(hex2bin($storeid));
|
$store = $GLOBALS["mapisession"]->openMessageStore(hex2bin($storeid));
|
||||||
if ($store) {
|
if ($store) {
|
||||||
// load folder first
|
// load folder first
|
||||||
if($folder !== false) {
|
if ($folder !== false) {
|
||||||
$mapifolder = mapi_msgstore_openentry($store, hex2bin($folder));
|
$mapifolder = mapi_msgstore_openentry($store, hex2bin($folder));
|
||||||
|
|
||||||
$table = mapi_folder_getcontentstable($mapifolder);
|
$table = mapi_folder_getcontentstable($mapifolder);
|
||||||
@ -429,7 +441,7 @@ class ContactModule extends Module
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($records) > 0) {
|
if (count($records) > 0) {
|
||||||
$response['status'] = true;
|
$response['status'] = true;
|
||||||
$response['download_token'] = $token;
|
$response['download_token'] = $token;
|
||||||
$response['filename'] = count($records) . "contacts.vcf";
|
$response['filename'] = count($records) . "contacts.vcf";
|
||||||
@ -481,6 +493,12 @@ class ContactModule extends Module
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace String Property Tags
|
||||||
|
* @param $store
|
||||||
|
* @param $properties
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
private function replaceStringPropertyTags($store, $properties)
|
private function replaceStringPropertyTags($store, $properties)
|
||||||
{
|
{
|
||||||
$newProperties = array();
|
$newProperties = array();
|
||||||
@ -1131,6 +1149,12 @@ class ContactModule extends Module
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if string starts with other string.
|
||||||
|
* @param $haystack
|
||||||
|
* @param $needle
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
private function startswith($haystack, $needle)
|
private function startswith($haystack, $needle)
|
||||||
{
|
{
|
||||||
$haystack = str_replace("type=", "", $haystack); // remove type from string
|
$haystack = str_replace("type=", "", $haystack); // remove type from string
|
||||||
|
Loading…
Reference in New Issue
Block a user