vcf importer pre alpha. Import working but contact pictures are not saved.

This commit is contained in:
Christoph Haas 2013-05-20 21:09:51 +00:00
commit 185c885687
20 changed files with 4273 additions and 0 deletions

276
build.xml Normal file
View File

@ -0,0 +1,276 @@
<project default="all">
<!--############# CONFIGURE ALL PROPERTIES FOR THE REPLACER HERE ################-->
<property name="plugin_version" value="0.9"/>
<!-- EOC -->
<property name="root-folder" value="${basedir}/../"/>
<property name="tools-folder" value="${root-folder}/TOOLS/"/>
<property name="target-folder" value="${root-folder}/DEPLOY/plugins"/>
<import file="${tools-folder}/antutil.xml"/>
<typedef file="${tools-folder}/antlib.xml">
<classpath>
<pathelement location="${tools-folder}/tools.jar"/>
<pathelement location="${tools-folder}/lib/compiler.jar"/>
</classpath>
</typedef>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${tools-folder}/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<!-- os checks for xmllint... -->
<condition property="isWindows" value="true">
<os family="windows" />
</condition>
<!-- define nicknames for libraries -->
<property name="yui-compressor" location="${tools-folder}/lib/yuicompressor-2.4.2.jar" />
<property name="yui-compressor-ant-task" location="${tools-folder}/lib/yui-compressor-ant-task-0.5.jar" />
<!-- adds libraries to the classpath -->
<path id="yui.classpath">
<pathelement location="${yui-compressor}" />
<pathelement location="${yui-compressor-ant-task}" />
</path>
<!-- define tasks -->
<taskdef name="yui-compressor" classname="net.noha.tools.ant.yuicompressor.tasks.YuiCompressorTask">
<classpath refid="yui.classpath" />
</taskdef>
<!-- Determine plugin name -->
<var name="plugin" unset="true"/>
<basename file="${basedir}" property="plugin"/>
<!-- The Plugin distribution files -->
<property name="plugin-folder" value="${plugin}"/>
<property name="plugin-debugfile" value="${plugin}-debug.js"/>
<property name="plugin-file" value="${plugin}.js"/>
<!-- The Plugin CSS files -->
<property name="plugin-css-folder" value="resources/css"/>
<property name="plugin-css-file" value="${plugin}-min.css"/>
<property name="plugin-css-debug-file" value="${plugin}.css"/>
<!-- Meta target -->
<target name="all" depends="concat, compress"/>
<!-- Clean -->
<target name="clean">
<delete includeemptydirs="true" failonerror="false">
<!-- Delete the Plugin files -->
<fileset dir="${target-folder}/${plugin-folder}/js">
<include name="${plugin-file}"/>
<include name="${plugin-debugfile}"/>
</fileset>
<fileset dir="${target-folder}/${plugin-folder}/php">
<include name="**/*.php"/>
</fileset>
<fileset dir="${target-folder}/${plugin-folder}/resources">
<include name="**/*"/>
</fileset>
<fileset dir="${target-folder}/${plugin-folder}/${plugin-css-folder}">
<include name="${plugin-css-debug-file}"/>
<include name="${plugin-css-file}"/>
</fileset>
</delete>
</target>
<!-- Concatenates JavaScript files with automatic dependency generation -->
<target name="concat">
<!-- Concatenate plugin JS file -->
<if>
<available file="js" type="dir" />
<then>
<mkdir dir="${target-folder}/${plugin-folder}/js"/>
<echo message="Concatenating: ${plugin-debugfile}"/>
<!-- TODO: fix JS files for zConcat -->
<!--zConcat outputFolder="${target-folder}/${plugin-folder}/js" outputFile="${plugin-debugfile}" prioritize="\w+">
<concatfiles>
<fileset dir="js" includes="**/*.js" />
</concatfiles>
</zConcat-->
<concat destfile="${target-folder}/${plugin-folder}/js/${plugin-debugfile}">
<fileset file="js/ABOUT.js" />
<fileset file="js/plugin.contactimporter.js" />
<fileset file="js/data/ResponseHandler.js" />
<fileset file="js/dialogs/ImportContentPanel.js" />
<fileset file="js/dialogs/ImportPanel.js" />
</concat>
</then>
</if>
<!-- Concatenate plugin CSS files -->
<if>
<available file="${plugin-css-folder}" type="dir" />
<then>
<mkdir dir="${target-folder}/${plugin-folder}/${plugin-css-folder}"/>
<echo message="Concatenating: ${plugin-css-debug-file}"/>
<zConcat outputFolder="${target-folder}/${plugin-folder}/${plugin-css-folder}" outputFile="${plugin-css-debug-file}">
<concatfiles>
<fileset dir="${plugin-css-folder}" includes="**/*.css" />
</concatfiles>
</zConcat>
</then>
</if>
</target>
<!-- Preformat the Concatenated Javascript files to improve compilation -->
<target name="preformat" depends="concat">
<if>
<available file="${target-folder}/${plugin-folder}/js/${plugin-debugfile}" type="file" />
<then>
<echo message="Preformatting: ${plugin-debugfile}"/>
<replaceregexp byline="true">
<regexp pattern="(^[ ,\t]*\*[ ,\t]@.*)\{(.*)\[\]\}"/>
<substitution expression="\1{\2\|Array}"/>
<fileset dir="${target-folder}/${plugin-folder}/js" includes="${plugin-debugfile}"/>
</replaceregexp>
</then>
</if>
</target>
<!-- Compress JavaScript -->
<target name="compress" depends="preformat">
<if>
<available file="${target-folder}/${plugin-folder}/js/${plugin-debugfile}" type="file" />
<then>
<echo message="Compiling: ${plugin-debugfile}" />
<zCompile inputFolder="${target-folder}/${plugin-folder}/js" inputFile="${plugin-debugfile}" outputFolder="${target-folder}/${plugin-folder}/js" outputFile="${plugin-file}">
<externs>
var Ext = {};
var Zarafa = {};
var container = {};
var _ = function(key, domain) {};
var dgettext = function(domain, msgid) {};
var dngettext = function(domain, msgid, msgid_plural, count) {};
var dnpgettext = function(domain, msgctxt, msgid, msgid_plural, count) {};
var dpgettext = function(domain, msgctxt, msgid) {};
var ngettext = function(msgid, msgid_plural, count) {};
var npgettext = function(msgctxt, msgid, msgid_plural, count) {};
var pgettext = function(msgctxt, msgid) {};
</externs>
</zCompile>
<!--yui-compressor
warn="false"
munge="true"
preserveallsemicolons="false"
fromdir="${target-folder}/${plugin-folder}/js"
todir="${target-folder}/${plugin-folder}/js">
<include name="${plugin-debugfile}" />
</yui-compressor-->
</then>
</if>
</target>
<!-- syntax check all PHP files -->
<target name="validate">
<if>
<available file="config.php" type="file" />
<then>
<antcall target="syntax-check">
<param name="file" value="config.php"/>
</antcall>
</then>
</if>
<if>
<available file="php" type="dir" />
<then>
<foreach target="syntax-check" param="file">
<path>
<fileset dir=".">
<include name="**/*.php"/>
</fileset>
</path>
</foreach>
</then>
</if>
</target>
<target name="syntax-check">
<echo message="validating ${file}"/>
<exec executable="php" failonerror="true" failifexecutionfails="false">
<arg value="-l"/>
<arg value="${file}"/>
</exec>
</target>
<!-- on windows we do not check the xml file -->
<target name="xml-os-sel" depends="xml-check,xml-copy">
<echo>Processing manifest.xml</echo>
</target>
<!-- check manifest.xml if we are on windows... -->
<target name="xml-check" unless="isWindows">
<echo message="Checking xml: manifest.xml" />
<!-- Copy (and validate) manifest.xml -->
<exec executable="xmllint" output="${target-folder}/${plugin-folder}/manifest.xml" failonerror="true" error="/dev/stdout" failifexecutionfails="false">
<arg value="--valid"/>
<arg value="--path"/>
<arg value="${root-folder}/server"/>
<arg value="manifest.xml"/>
</exec>
</target>
<!-- check manifest.xml if we are on windows... -->
<target name="xml-copy" if="isWindows">
<echo message="Copying xml: manifest.xml" />
<!-- Copy manifest.xml -->
<copy todir="${target-folder}/${plugin-folder}">
<fileset dir=".">
<include name="manifest.xml"/>
</fileset>
</copy>
</target>
<!-- Install all files into the target folder -->
<target name="deploy" depends="clean, compress, compresscss, validate, xml-os-sel">
<mkdir dir="${target-folder}/${plugin-folder}"/>
<!-- copy files -->
<copy todir="${target-folder}/${plugin-folder}">
<fileset dir=".">
<include name="resources/**/*"/>
<include name="php/**/*.php"/>
<include name="config.php"/>
<include name="changelog.txt"/>
<!-- exclude the ant script -->
<exclude name="build.xml"/>
<!-- CSS is generated during build -->
<exclude name="resources/css/*.*"/>
</fileset>
</copy>
<!-- replace all variables... -->
<replace file="${target-folder}/${plugin-folder}/manifest.xml" token="@_@PLUGIN_VERSION@_@" value="${plugin_version}" />
</target>
<!-- compresses each CSS file -->
<target name="compresscss" depends="concat">
<available file="${tools-folder}/lib/yui-compressor-ant-task-0.5.jar" property="YUIANT_AVAILABLE" />
<fail unless="YUIANT_AVAILABLE" message="yui-compressor-ant-task-0.5.jar not found" />
<if>
<available file="${target-folder}/${plugin-folder}/${plugin-css-folder}/${plugin-css-debug-file}" type="file" />
<then>
<yui-compressor
warn="false"
munge="true"
preserveallsemicolons="false"
fromdir="${target-folder}/${plugin-folder}/${plugin-css-folder}"
todir="${target-folder}/${plugin-folder}/${plugin-css-folder}">
<include name="${plugin-css-debug-file}" />
</yui-compressor>
</then>
</if>
</target>
</project>

0
changelog.txt Normal file
View File

12
config.php Normal file
View File

@ -0,0 +1,12 @@
<?php
/** Disable the import plugin for all clients */
define('PLUGIN_CONTACTIMPORTER_USER_DEFAULT_ENABLE', true);
/** Disable the export feature for all clients */
define('PLUGIN_CONTACTIMPORTER_USER_DEFAULT_ENABLE_EXPORT', false);
/** The default addressbook to import to (default: contact)*/
define('PLUGIN_CONTACTIMPORTER_DEFAULT', "contact");
/** Tempory path for uploaded files... */
define('PLUGIN_CONTACTIMPORTER_TMP_UPLOAD', "/var/lib/zarafa-webapp/tmp/");
?>

58
js/ABOUT.js Normal file
View File

@ -0,0 +1,58 @@
/**
* ABOUT.js zarafa contact to vcf im/exporter
*
* Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2013 Christoph Haas
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* 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,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
Ext.namespace('Zarafa.plugins.contactimporter');
/**
* @class Zarafa.plugins.contactimporter.ABOUT
* @extends String
*
* The copyright string holding the copyright notice for the Zarafa contactimporter Plugin.
*/
Zarafa.plugins.contactimporter.ABOUT = ""
+ "<p>Copyright (C) 2012-2013 Christoph Haas &lt;christoph.h@sprinternet.at&gt;</p>"
+ "<p>This program is free software; you can redistribute it and/or "
+ "modify it under the terms of the GNU Lesser General Public "
+ "License as published by the Free Software Foundation; either "
+ "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, "
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of "
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "
+ "Lesser General Public License for more details.</p>"
+ "<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 "
+ "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p>"
+ "<hr />"
+ "<p>The contactimporter plugin contains the following third-party components:</p>"
+ "<h1>vCard-parser</h1>"
+ "<p>Copyright (C) 2012 Nuovo</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>"

View File

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

View File

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

545
js/dialogs/ImportPanel.js Normal file
View File

@ -0,0 +1,545 @@
/**
* ImportPanel.js zarafa contact to vcf im/exporter
*
* Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2013 Christoph Haas
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* 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,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/**
* ImportPanel
*
* The main Panel of the contactimporter plugin.
*/
Ext.namespace("Zarafa.plugins.contactimporter.dialogs");
/**
* @class Zarafa.plugins.contactimporter.dialogs.ImportPanel
* @extends Ext.form.FormPanel
*/
Zarafa.plugins.contactimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
/* path to vcf file on server... */
vcffile: null,
/* export contacts buffer */
exportResponse: new Array(),
/* how many requests are still running? */
runningRequests: null,
/* The store for the selection grid */
store: null,
/**
* The internal 'iframe' which is hidden from the user, which is used for downloading
* attachments. See {@link #doOpen}.
* @property
* @type Ext.Element
*/
downloadFrame : undefined,
/**
* @constructor
* @param {object} config
*/
constructor : function (config) {
config = config || {};
var self = this;
if(typeof config.filename !== "undefined") {
this.vcffile = config.filename;
}
// create the data store
// we only display the firstname, lastname, homephone and primary email address in our grid
this.store = new Ext.data.ArrayStore({
fields: [
{name: 'display_name'},
{name: 'given_name'},
{name: 'surname'},
{name: 'company_name'},
{name: 'record'}
]
});
Ext.apply(config, {
xtype : 'contactimporter.importpanel',
ref : "importcontactpanel",
layout : {
type : 'form',
align : 'stretch'
},
anchor : '100%',
bodyStyle : 'background-color: inherit;',
defaults : {
border : true,
bodyStyle : 'background-color: inherit; padding: 3px 0px 3px 0px; border-style: none none solid none;'
},
items : [
this.createSelectBox(),
this.initForm(),
this.createGrid()
],
buttons: [
this.createSubmitAllButton(),
this.createSubmitButton(),
this.createCancelButton()
],
listeners: {
afterrender: function (cmp) {
this.loadMask = new Ext.LoadMask(this.getEl(), {msg:'Loading...'});
if(this.vcffile != null) { // if we have got the filename from an attachment
this.parseContacts(this.vcffile);
}
},
close: function (cmp) {
Ext.getCmp("importcontactsbutton").enable();
},
hide: function (cmp) {
Ext.getCmp("importcontactsbutton").enable();
},
destroy: function (cmp) {
Ext.getCmp("importcontactsbutton").enable();
},
scope: this
}
});
Zarafa.plugins.contactimporter.dialogs.ImportPanel.superclass.constructor.call(this, config);
},
/**
* Init embedded form, this is the form that is
* posted and contains the attachments
* @private
*/
initForm : function () {
return {
xtype: 'form',
ref: 'addContactFormPanel',
layout : 'column',
fileUpload: true,
autoWidth: true,
autoHeight: true,
border: false,
bodyStyle: 'padding: 5px;',
defaults: {
anchor: '95%',
border: false,
bodyStyle: 'padding: 5px;'
},
items: [this.createUploadField()]
};
},
/**
* Reloads the data of the grid
* @private
*/
reloadGridStore: function(contactdata) {
var parsedData = [];
if(contactdata) {
parsedData = new Array(contactdata.contacts.length);
var i = 0;
for(i = 0; i < contactdata.contacts.length; i++) {
parsedData[i] = new Array(
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;
}
this.store.loadData(parsedData, false);
},
/**
* Init embedded form, this is the form that is
* posted and contains the attachments
* @private
*/
createGrid : function() {
return {
xtype: 'grid',
ref: 'contactGrid',
columnWidth: 1.0,
store: this.store,
width: '100%',
height: 300,
title: 'Select contacts to import',
frame: false,
viewConfig:{
forceFit:true
},
colModel: new Ext.grid.ColumnModel({
defaults: {
width: 300,
sortable: true
},
columns: [
{id: 'Displayname', header: 'Displayname', width: 350, sortable: true, dataIndex: 'display_name'},
{header: 'Firstname', width: 200, sortable: true, dataIndex: 'given_name'},
{header: 'Lastname', width: 200, sortable: true, dataIndex: 'surname'},
{header: 'Company', sortable: true, dataIndex: 'company_name'}
]
}),
sm: new Ext.grid.RowSelectionModel({multiSelect:true})
}
},
createSelectBox: function() {
var defaultFolder = container.getHierarchyStore().getDefaultFolder('contact'); // @type: Zarafa.hierarchy.data.MAPIFolderRecord
var subFolders = defaultFolder.getChildren();
var myStore = [];
/* add all local contact folders */
var i = 0;
myStore.push(new Array(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
}
/* add all shared contact folders */
var pubStore = container.getHierarchyStore().getPublicStore();
if(typeof pubStore !== "undefined") {
try {
var pubFolder = pubStore.getDefaultFolder("publicfolders");
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
}
}
} catch (e) {
console.log("Error opening the shared folder...");
console.log(e);
}
}
return {
xtype: "selectbox",
ref: 'addressbookSelector',
editable: false,
name: "choosen_addressbook",
value: container.getSettingsModel().get("zarafa/v1/plugins/contactimporter/default_addressbook"),
width: 100,
fieldLabel: "Select an addressbook",
store: myStore,
mode: 'local',
labelSeperator: ":",
border: false,
anchor: "100%",
scope: this,
allowBlank: false
}
},
createUploadField: function() {
return {
xtype: "fileuploadfield",
ref: 'contactfileuploadfield',
columnWidth: 1.0,
id: 'form-file',
name: 'vcfdata',
emptyText: 'Select an .vcf addressbook',
border: false,
anchor: "100%",
scope: this,
allowBlank: false,
listeners: {
'fileselected': this.onFileSelected,
scope: this
}
}
},
createSubmitButton: function() {
return {
xtype: "button",
ref: "../submitButton",
disabled: true,
width: 100,
border: false,
text: _("Import"),
anchor: "100%",
handler: this.importCheckedContacts,
scope: this,
allowBlank: false
}
},
createSubmitAllButton: function() {
return {
xtype: "button",
ref: "../submitAllButton",
disabled: true,
width: 100,
border: false,
text: _("Import All"),
anchor: "100%",
handler: this.importAllContacts,
scope: this,
allowBlank: false
}
},
createCancelButton: function() {
return {
xtype: "button",
width: 100,
border: false,
text: _("Cancel"),
anchor: "100%",
handler: this.close,
scope: this,
allowBlank: false
}
},
/**
* This is called when a file has been seleceted in the file dialog
* in the {@link Ext.ux.form.FileUploadField} and the dialog is closed
* @param {Ext.ux.form.FileUploadField} uploadField being added a file to
*/
onFileSelected : function(uploadField) {
var form = this.addContactFormPanel.getForm();
if (form.isValid()) {
form.submit({
waitMsg: 'Uploading and parsing contacts...',
url: 'plugins/contactimporter/php/upload.php',
failure: function(file, action) {
this.submitButton.disable();
this.submitAllButton.disable();
Zarafa.common.dialogs.MessageBox.show({
title : _('Error'),
msg : _(action.result.error),
icon : Zarafa.common.dialogs.MessageBox.ERROR,
buttons : Zarafa.common.dialogs.MessageBox.OK
});
},
success: function(file, action){
uploadField.reset();
this.vcffile = action.result.vcf_file;
this.parseContacts(this.vcffile);
},
scope : this
});
}
},
parseContacts: function (vcfPath) {
this.loadMask.show();
// call export function here!
var responseHandler = new Zarafa.plugins.contactimporter.data.ResponseHandler({
successCallback: this.handleParsingResult.createDelegate(this)
});
container.getRequest().singleRequest(
'contactmodule',
'import',
{
vcf_filepath: vcfPath
},
responseHandler
);
},
handleParsingResult: function(response) {
this.loadMask.hide();
if(response["status"] == true) {
this.submitButton.enable();
this.submitAllButton.enable();
this.reloadGridStore(response.parsed);
} else {
this.submitButton.disable();
this.submitAllButton.disable();
Zarafa.common.dialogs.MessageBox.show({
title : _('Parser Error'),
msg : _(response["message"]),
icon : Zarafa.common.dialogs.MessageBox.ERROR,
buttons : Zarafa.common.dialogs.MessageBox.OK
});
}
},
close: function () {
this.addContactFormPanel.getForm().reset();
this.dialog.close()
},
importCheckedContacts: function () {
var newRecords = this.contactGrid.selModel.getSelections();
this.importContacts(newRecords);
},
importAllContacts: function () {
//receive Records from grid rows
this.contactGrid.selModel.selectAll(); // select all entries
var newRecords = this.contactGrid.selModel.getSelections();
this.importContacts(newRecords);
},
/**
* This function stores all given events to the appointmentstore
* @param events
*/
importContacts: function (contacts) {
//receive existing contact store
var folderValue = this.addressbookSelector.getValue();
if(folderValue == undefined) { // no addressbook choosen
Zarafa.common.dialogs.MessageBox.show({
title : _('Error'),
msg : _('You have to choose an addressbook!'),
icon : Zarafa.common.dialogs.MessageBox.ERROR,
buttons : Zarafa.common.dialogs.MessageBox.OK
});
} else {
var addressbookexist = true;
if(this.contactGrid.selModel.getCount() < 1) {
Zarafa.common.dialogs.MessageBox.show({
title : _('Error'),
msg : _('You have to choose at least one contact to import!'),
icon : Zarafa.common.dialogs.MessageBox.ERROR,
buttons : Zarafa.common.dialogs.MessageBox.OK
});
} else {
var contactStore = new Zarafa.contact.ContactStore();
var contactFolder = container.getHierarchyStore().getDefaultFolder('contact');
var pubStore = container.getHierarchyStore().getPublicStore();
var pubFolder = pubStore.getDefaultFolder("publicfolders");
var pubSubFolders = pubFolder.getChildren();
if(folderValue != "contact") {
var subFolders = contactFolder.getChildren();
var i = 0;
for(i = 0; i < pubSubFolders.length; i++) {
if(pubSubFolders[i].isContainerClass("IPF.Contact")){
subFolders.push(pubSubFolders[i]);
}
}
for(i=0;i<subFolders.length;i++) {
// look up right folder
// TODO: improve!!
if(subFolders[i].getDisplayName() == folderValue) {
contactFolder = subFolders[i];
break;
}
}
if(contactFolder.isDefaultFolder()) {
Zarafa.common.dialogs.MessageBox.show({
title : _('Error'),
msg : _('Selected addressbook does not exist!'),
icon : Zarafa.common.dialogs.MessageBox.ERROR,
buttons : Zarafa.common.dialogs.MessageBox.OK
});
addressbookexist = false;
}
}
if(addressbookexist) {
this.loadMask.show();
var imageRecords = new Array();
//receive Records from grid rows
Ext.each(contacts, function(newRecord) {
var tmprec = newRecord.data.record;
tmprec['parent_entryid'] = contactFolder.get('entryid');
tmprec['store_entryid'] = contactFolder.get('store_entryid');
var record = Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass('IPM.Contact', tmprec);
contactStore.add(record);
if(tmprec.x_photo_path) { // add the contact picture
imageRecords.push(record);
}
}, this);
contactStore.on('write', this.storeImages, this);
contactStore.save();
this.loadMask.hide();
this.dialog.close();
//contactStore.un('write', this.storeImages, this);
container.getNotifier().notify('info', 'Imported', 'Imported ' + contacts.length + ' contacts. Please reload your addressbook!');
}
}
}
},
/**
* Store the attachment/contact pictures
*/
storeImages : function (store, action, result, res, records) {
var attachStores = new Array();
Ext.each(records, function(record) {
var attachstore = record.createAttachmentStore();
record.save();
attachStores[attachstore.getId()] = attachstore;
var responseHandler = new Zarafa.plugins.contactimporter.data.ResponseHandler({
successCallback: function (response) {
console.log(response);
/*var attachmentRecord = Zarafa.core.data.RecordFactory.createRecordObjectByObjectType(Zarafa.core.mapi.ObjectType.MAPI_ATTACH, {
attachment_contactphoto: true,
hidden: true,
tmpname: response.tmpname,
name: response.name,
attach_num: 0,
filetype: response.type,
size: response.size
});
attachStores[response.storeid].add(attachmentRecord);
attachStores[response.storeid].commitChanges();
console.log(attachStores[response.storeid]);
console.log(attachmentRecord.getAttachmentUrl());*/
}
});
container.getRequest().singleRequest(
'contactmodule',
'addattachment',
{
storeid: attachstore.getId(),
entryid: record.id,
tmpfile: record.get("x_photo_path")
},
responseHandler
);
});
}
});
Ext.reg('contactimporter.importcontactpanel', Zarafa.plugins.contactimporter.dialogs.ImportPanel);

826
js/dialogs/fields.txt Normal file
View File

@ -0,0 +1,826 @@
access
2
address_book_long
0
address_book_mv
null
address_type
"SMTP"
anniversary_eventid
""
assistant
""
assistant_telephone_number
""
birthday
null
birthday_eventid
""
body
""
business2_telephone_number
""
business_address
""
business_address_city
""
business_address_country
""
business_address_postal_code
""
business_address_state
""
business_address_street
""
business_fax_number
""
business_home_page
""
business_telephone_number
""
callback_telephone_number
""
car_telephone_number
""
categories
""
cellular_telephone_number
""
company_name
"testcompany"
company_telephone_number
""
contacts
""
contacts_string
""
creation_time
null
department_name
"departm"
display_bcc
""
display_cc
""
display_name
"Dr. testf testm testl Jr."
display_name_prefix
"Dr."
display_to
""
dstendday
""
dstendhour
""
dstendmonth
""
dstendweek
""
dststartday
""
dststarthour
""
dststartmonth
""
dststartweek
""
email_address
""
email_address_1
""
email_address_2
""
email_address_3
""
email_address_display_name_1
""
email_address_display_name_2
""
email_address_display_name_3
""
email_address_display_name_email_1
""
email_address_display_name_email_2
""
email_address_display_name_email_3
""
email_address_entryid_1
""
email_address_entryid_2
""
email_address_entryid_3
""
email_address_type_1
""
email_address_type_2
""
email_address_type_3
""
email_index
-1
fax_1_address_type
""
fax_1_email_address
""
fax_1_original_display_name
""
fax_1_original_entryid
""
fax_2_address_type
""
fax_2_email_address
""
fax_2_original_display_name
""
fax_2_original_entryid
""
fax_3_address_type
""
fax_3_email_address
""
fax_3_original_display_name
""
fax_3_original_entryid
""
fileas
"testl, testf testm"
fileas_selection
-1
generation
"Jr."
given_name
"testf"
hasattach
false
home2_telephone_number
""
home_address
""
home_address_city
""
home_address_country
""
home_address_postal_code
""
home_address_state
""
home_address_street
""
home_fax_number
""
home_telephone_number
""
html_body
"<font face="tahoma"><br></font>"
icon_index
512
im
""
isHTML
false
isdn_number
""
last_modification_time
null
mailing_address
""
manager_name
""
message_class
"IPM.Contact"
message_flags
1
message_size
""
middle_name
"testm"
nickname
"nickn"
normalized_subject
""
object_type
5
office_location
"olocation"
other_address
""
other_address_city
""
other_address_country
""
other_address_postal_code
""
other_address_state
""
other_address_street
""
other_telephone_number
""
pager_telephone_number
""
primary_fax_number
""
primary_telephone_number
""
private
false
profession
"profess"
radio_telephone_number
""
read_receipt_requested
false
sender_address_type
""
sender_email_address
""
sender_entryid
""
sender_name
""
sender_search_key
""
sensitivity
0
sent_representing_address_type
""
sent_representing_email_address
""
sent_representing_entryid
""
sent_representing_name
""
sent_representing_search_key
""
spouse_name
""
subject
"testf testm testl"
surname
"testl"
telex_telephone_number
""
timezone
""
timezonedst
""
title
"jobt"
ttytdd_telephone_number
""
unk
""
webpage
""
wedding_anniversary
null

View File

@ -0,0 +1,242 @@
/**
* plugin.contactimporter.js zarafa calender to ics im/exporter
*
* Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2013 Christoph Haas
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* 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,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
Ext.namespace("Zarafa.plugins.contactimporter"); // Assign the right namespace
Zarafa.plugins.contactimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, { // create new import plugin
/**
* @constructor
* @param {Object} config Configuration object
*
*/
constructor: function (config) {
config = config || {};
Ext.applyIf(config, {
name : 'contactimporter',
displayName : _('Contactimporter Plugin'),
about : Zarafa.plugins.contactimporter.ABOUT
});
Zarafa.plugins.contactimporter.ImportPlugin.superclass.constructor.call(this, config);
},
/**
* initialises insertion point for plugin
* @protected
*/
initPlugin : function() {
Zarafa.plugins.contactimporter.ImportPlugin.superclass.initPlugin.apply(this, arguments);
/* our panel */
Zarafa.core.data.SharedComponentType.addProperty('plugins.contactimporter.dialogs.importcontacts');
/* 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);
},
/**
* Creates the button
*
* @return {Object} Configuration object for a {@link Ext.Button button}
*
*/
createImportButton: function () {
var button = {
xtype : 'button',
id : "importcontactsbutton",
text : _('Import Contacts'),
iconCls : 'icon_contactimporter_button',
navigationContext : container.getContextByName('contact'),
handler : this.onImportButtonClick,
scope : this
};
if(container.getSettingsModel().get("zarafa/v1/plugins/contactimporter/enable_export")) {
button.text = _('Import/Export Contacts');
}
return button;
},
/**
* Insert import button in all attachment suggestions
* @return {Object} Configuration object for a {@link Ext.Button button}
*/
createAttachmentImportButton : function(include, btn) {
return {
text : _('Import Contacts'),
handler : this.getAttachmentFileName.createDelegate(this, [btn, this.gotAttachmentFileName]),
scope : this,
iconCls : 'icon_contactimporter_button',
beforeShow : function(item, record) {
var extension = record.data.name.split('.').pop().toLowerCase();
if(record.data.filetype == "text/vcard" || extension == "vcf" || extension == "vcard") {
item.setDisabled(false);
} else {
item.setDisabled(true);
}
}
};
},
/**
* Callback for getAttachmentFileName
*/
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
});
} else {
Zarafa.common.dialogs.MessageBox.show({
title : _('Error'),
msg : _(response["message"]),
icon : Zarafa.common.dialogs.MessageBox.ERROR,
buttons : Zarafa.common.dialogs.MessageBox.OK
});
}
},
/**
* Clickhandler for the button
*/
getAttachmentFileName: function (btn, callback) {
Zarafa.common.dialogs.MessageBox.show({
title: 'Please wait',
msg: 'Loading attachment...',
progressText: 'Initializing...',
width:300,
progress:true,
closable:false
});
// progress bar... ;)
var f = function(v){
return function(){
if(v == 100){
Zarafa.common.dialogs.MessageBox.hide();
}else{
Zarafa.common.dialogs.MessageBox.updateProgress(v/100, Math.round(v)+'% loaded');
}
};
};
for(var i = 1; i < 101; i++){
setTimeout(f(i), 20*i);
}
/* store the attachment to a temporary folder and prepare it for uploading */
var attachmentRecord = btn.records;
var attachmentStore = attachmentRecord.store;
var store = attachmentStore.getParentRecord().get('store_entryid');
var entryid = attachmentStore.getAttachmentParentRecordEntryId();
var attachNum = new Array(1);
if (attachmentRecord.get('attach_num') != -1)
attachNum[0] = attachmentRecord.get('attach_num');
else
attachNum[0] = attachmentRecord.get('tmpname');
var dialog_attachments = attachmentStore.getId();
var filename = attachmentRecord.data.name;
var responseHandler = new Zarafa.plugins.contactimporter.data.ResponseHandler({
successCallback: callback
});
// request attachment preperation
container.getRequest().singleRequest(
'calendarmodule',
'attachmentpath',
{
entryid : entryid,
store: store,
attachNum: attachNum,
dialog_attachments: dialog_attachments,
filename: filename
},
responseHandler
);
},
/**
* 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
});
},
/**
* Bid for the type of shared component
* and the given record.
* This will bid on calendar.dialogs.importcontacts
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
* @param {Ext.data.Record} record Optionally passed record.
* @return {Number} The bid for the shared component
*/
bidSharedComponent : function(type, record) {
var bid = -1;
switch(type) {
case Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts']:
bid = 2;
break;
}
return bid;
},
/**
* Will return the reference to the shared component.
* 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 {Ext.data.Record} record Optionally passed record.
* @return {Ext.Component} Component
*/
getSharedComponent : function(type, record) {
var component;
switch(type) {
case Zarafa.core.data.SharedComponentType['plugins.contactimporter.dialogs.importcontacts']:
component = Zarafa.plugins.contactimporter.dialogs.ImportContentPanel;
break;
}
return component;
}
});
/*############################################################################################################################
* STARTUP
*############################################################################################################################*/
Zarafa.onReady(function() {
if(container.getSettingsModel().get("zarafa/v1/plugins/contactimporter/enable") === true) {
container.registerPlugin(new Zarafa.plugins.contactimporter.ImportPlugin);
}
});

39
manifest.xml Normal file
View File

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

44
php/download.php Normal file
View File

@ -0,0 +1,44 @@
<?php
/**
* download.php, zarafa contact to vcf im/exporter
*
* Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2013 Christoph Haas
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* 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,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
$basedir = $_GET["basedir"];
$secid = $_GET["secid"];
$fileid = $_GET["fileid"];
$realname = $_GET["realname"];
$secfile = $basedir . "/secid." . $secid;
$vcffile = $basedir . "/" . $fileid . "." . $secid;
// if the secid file exists -> download!
if(file_exists($secfile)) {
@header("Last-Modified: " . @gmdate("D, d M Y H:i:s",time()) . " GMT");
@header("Content-type: text/vcard");
header("Content-Length: " . filesize($vcffile));
header("Content-Disposition: attachment; filename=" . $realname . ".vcf");
//write vcf
readfile($vcffile);
unlink($secfile);
unlink($vcffile);
}
?>

594
php/module.contact.php Normal file
View File

@ -0,0 +1,594 @@
<?php
/**
* class.calendar.php, zarafa contact to vcf im/exporter
*
* Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2013 Christoph Haas
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* 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,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
include_once('vcf/class.vCard.php');
class ContactModule extends Module {
private $DEBUG = true; // enable error_log debugging
/**
* @constructor
* @param $id
* @param $data
*/
public function __construct($id, $data) {
parent::Module($id, $data);
}
/**
* Executes all the actions in the $data variable.
* Exception part is used for authentication errors also
* @return boolean true on success or false on failure.
*/
public function execute() {
$result = false;
if(!$this->DEBUG) {
/* disable error printing - otherwise json communication might break... */
ini_set('display_errors', '0');
}
foreach($this->data as $actionType => $actionData) {
if(isset($actionType)) {
try {
if($this->DEBUG) {
error_log("exec: " . $actionType);
}
switch($actionType) {
case "export":
$result = $this->exportCalendar($actionType, $actionData);
break;
case "import":
$result = $this->importContacts($actionType, $actionData);
break;
case "addattachment":
$result = $this->addAttachment($actionType, $actionData);
break;
case "attachmentpath":
$result = $this->getAttachmentPath($actionType, $actionData);
break;
default:
$this->handleUnknownActionType($actionType);
}
} catch (MAPIException $e) {
if($this->DEBUG) {
error_log("mapi exception: " . $e->getMessage());
}
} catch (Exception $e) {
if($this->DEBUG) {
error_log("exception: " . $e->getMessage());
}
}
}
}
return $result;
}
/**
* Generates a random string with variable length.
* @param $length the lenght of the generated string
* @return string a random string
*/
private function randomstring($length = 6) {
// $chars - all allowed charakters
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
srand((double)microtime()*1000000);
$i = 0;
$pass = "";
while ($i < $length) {
$num = rand() % strlen($chars);
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
/**
* Generates the secid file (used to verify the download path)
* @param $secid the secid, a random security token
*/
private function createSecIDFile($secid) {
$lockFile = TMP_PATH . "/secid." . $secid;
$fh = fopen($lockFile, 'w') or die("can't open secid file");
$stringData = date(DATE_RFC822);
fwrite($fh, $stringData);
fclose($fh);
}
/**
* Generates the secid file (used to verify the download path)
* @param $time a timestamp
* @param $incl_time true if date should include time
* @ return date object
*/
private function getIcalDate($time, $incl_time = true) {
return $incl_time ? date('Ymd\THis', $time) : date('Ymd', $time);
}
/**
* Add an attachment to the give contact
* @param $actionType
* @param $actionData
*/
private function addAttachment($actionType, $actionData) {
// Get Attachment data from state
$attachment_state = new AttachmentState();
$attachment_state->open();
$filename = "ContactPicture.jpg";
$tmppath = $actionData["tmpfile"];
$filesize = filesize($tmppath);
$f = getimagesize($tmppath);
$filetype = $f["mime"];
// Move the uploaded file into the attachment state
$attachid = $attachment_state->addProvidedAttachmentFile($actionData["storeid"], $filename, $tmppath, array(
"name" => $filename,
"size" => $filesize,
"type" => $filetype,
"sourcetype" => 'default'
));
$attachment_state->close();
$response['status'] = true;
$response['storeid'] = $actionData["storeid"];
$response['tmpname'] = $attachid;
$response['name'] = $filename;
$response['size'] = $filesize;
$response['type'] = $filetype;
$this->addActionData($actionType, $response);
$GLOBALS["bus"]->addData($this->getResponseData());
}
/**
* The main export function, creates the ics file for download
* @param $actionType
* @param $actionData
*/
private function exportContacts($actionType, $actionData) {
$secid = $this->randomstring();
$this->createSecIDFile($secid);
$tmpname = stripslashes($actionData["calendar"] . ".ics." . $this->randomstring(8));
$filename = TMP_PATH . "/" . $tmpname . "." . $secid;
if(!is_writable(TMP_PATH . "/")) {
error_log("could not write to export tmp directory!");
}
$tz = date("e"); // use php timezone (maybe set up in php.ini, date.timezone)
if($this->DEBUG) {
error_log("PHP Timezone: " . $tz);
}
$config = array(
"language" => substr($GLOBALS["settings"]->get("zarafa/v1/main/language"),0,2),
"directory" => TMP_PATH . "/",
"filename" => $tmpname . "." . $secid,
"unique_id" => "zarafa-export-plugin",
"TZID" => $tz
);
$v = new vcalendar($config);
$v->setProperty("method", "PUBLISH"); // required of some calendar software
$v->setProperty("x-wr-calname", $actionData["calendar"]); // required of some calendar software
$v->setProperty("X-WR-CALDESC", "Exported Zarafa Calendar"); // required of some calendar software
$v->setProperty("X-WR-TIMEZONE", $tz);
$xprops = array("X-LIC-LOCATION" => $tz); // required of some calendar software
iCalUtilityFunctions::createTimezone($v, $tz, $xprops); // create timezone object in calendar
foreach($actionData["data"] as $event) {
$event["props"]["description"] = $this->loadEventDescription($event);
$event["props"]["attendees"] = $this->loadAttendees($event);
$vevent = & $v->newComponent("vevent"); // create a new event object
$this->addEvent($vevent, $event["props"]);
}
$v->saveCalendar();
$response['status'] = true;
$response['fileid'] = $tmpname; // number of entries that will be exported
$response['basedir'] = TMP_PATH;
$response['secid'] = $secid;
$response['realname'] = $actionData["calendar"];
$this->addActionData($actionType, $response);
$GLOBALS["bus"]->addData($this->getResponseData());
if($this->DEBUG) {
error_log("export done, bus data written!");
}
}
/**
* The main import function, parses the uploaded vcf file
* @param $actionType
* @param $actionData
*/
private function importContacts($actionType, $actionData) {
if($this->DEBUG) {
error_log("PHP Timezone: " . $tz);
}
if(is_readable ($actionData["vcf_filepath"])) {
$vcard = new vCard($actionData["vcf_filepath"], false, array('Collapse' => false)); // Parse it!
error_log(print_r($vcard, true));
if(count($vcard) == 0) {
$response['status'] = false;
$response['message']= "No contacts in vcf file";
} else {
$vCard = $vcard;
if (count($vCard) == 1) {
$vCard = array($vcard);
}
$response['status'] = true;
$response['parsed_file']= $actionData["vcf_filepath"];
$response['parsed'] = array (
'contacts' => $this->parseContactsToArray($vCard)
);
}
} else {
$response['status'] = false;
$response['message']= "File could not be read by server";
}
$this->addActionData($actionType, $response);
$GLOBALS["bus"]->addData($this->getResponseData());
if($this->DEBUG) {
error_log("parsing done, bus data written!");
}
}
/**
* Create a array with contacts
*
* @param contacts vcard or csv contacts
* @param csv optional, true if contacts are csv contacts
* @return array parsed contacts
* @private
*/
private function parseContactsToArray($contacts, $csv = false) {
$carr = array();
if(!$csv) {
foreach ($contacts as $Index => $vCard) {
$properties = array();
$properties["display_name"] = $vCard -> FN[0];
$properties["fileas"] = $vCard -> FN[0];
foreach ($vCard -> N as $Name) {
$properties["given_name"] = $Name['FirstName'];
$properties["middle_name"] = $Name['AdditionalNames'];
$properties["surname"] = $Name['LastName'];
$properties["display_name_prefix"] = $Name['Prefixes'];
}
if ($vCard -> TEL) {
foreach ($vCard -> TEL as $Tel) {
if(!is_scalar($Tel)) {
if(in_array("home", $Tel['Type'])) {
$properties["home_telephone_number"] = $Tel['Value'];
} else if(in_array("cell", $Tel['Type'])) {
$properties["cellular_telephone_number"] = $Tel['Value'];
} else if(in_array("work", $Tel['Type'])) {
$properties["business_telephone_number"] = $Tel['Value'];
} else if(in_array("fax", $Tel['Type'])) {
$properties["business_fax_number"] = $Tel['Value'];
} else if(in_array("pager", $Tel['Type'])) {
$properties["pager_telephone_number"] = $Tel['Value'];
} else if(in_array("isdn", $Tel['Type'])) {
$properties["isdn_number"] = $Tel['Value'];
} else if(in_array("car", $Tel['Type'])) {
$properties["car_telephone_number"] = $Tel['Value'];
} else if(in_array("modem", $Tel['Type'])) {
$properties["ttytdd_telephone_number"] = $Tel['Value'];
}
}
}
}
if ($vCard -> EMAIL) {
$e=0;
foreach ($vCard -> EMAIL as $Email) {
$fileas = $Email['Value'];
if(isset($properties["fileas"]) && !empty($properties["fileas"])) {
$fileas = $properties["fileas"];
}
if(!is_scalar($Email)) {
switch($e) {
case 0:
$properties["email_address_1"] = $Email['Value'];
$properties["email_address_display_name_1"] = $fileas . " (" . $Email['Value'] . ")";
break;
case 1:
$properties["email_address_2"] = $Email['Value'];
$properties["email_address_display_name_2"] = $fileas . " (" . $Email['Value'] . ")";
break;
case 2:
$properties["email_address_3"] = $Email['Value'];
$properties["email_address_display_name_3"] = $fileas . " (" . $Email['Value'] . ")";
break;
default: break;
}
$e++;
}
}
}
if ($vCard -> ORG) {
foreach ($vCard -> ORG as $Organization) {
$properties["company_name"] = $Organization['Name'];
if(empty($properties["display_name"])) {
$properties["display_name"] = $Organization['Name']; // if we have no displayname - use the company name as displayname
$properties["fileas"] = $Organization['Name'];
}
}
}
if ($vCard -> TITLE) {
$properties["title"] = $vCard -> TITLE[0];
}
if ($vCard -> URL) {
$properties["webpage"] = $vCard -> URL[0];
}
if ($vCard -> IMPP) {
foreach ($vCard -> IMPP as $IMPP) {
if (!is_scalar($IMPP)) {
$properties["im"] = $IMPP['Value'];
}
}
}
if ($vCard -> ADR) {
foreach ($vCard -> ADR as $Address) {
if(in_array("work", $Address['Type'])) {
$properties["business_address_street"] = $Address['StreetAddress'];
$properties["business_address_city"] = $Address['Locality'];
$properties["business_address_state"] = $Address['Region'];
$properties["business_address_postal_code"] = $Address['PostalCode'];
$properties["business_address_country"] = $Address['Country'];
$properties["business_address"] = $this->buildAddressString($Address['StreetAddress'], $Address['PostalCode'], $Address['Locality'], $Address['Region'], $Address['Country']);
} else if(in_array("home", $Address['Type'])) {
$properties["home_address_street"] = $Address['StreetAddress'];
$properties["home_address_city"] = $Address['Locality'];
$properties["home_address_state"] = $Address['Region'];
$properties["home_address_postal_code"] = $Address['PostalCode'];
$properties["home_address_country"] = $Address['Country'];
$properties["home_address"] = $this->buildAddressString($Address['StreetAddress'], $Address['PostalCode'], $Address['Locality'], $Address['Region'], $Address['Country']);
} else if(in_array("postal", $Address['Type'])||in_array("parcel", $Address['Type'])||in_array("intl", $Address['Type'])||in_array("dom", $Address['Type'])) {
$properties["other_address_street"] = $Address['StreetAddress'];
$properties["other_address_city"] = $Address['Locality'];
$properties["other_address_state"] = $Address['Region'];
$properties["other_address_postal_code"] = $Address['PostalCode'];
$properties["other_address_country"] = $Address['Country'];
$properties["other_address"] = $this->buildAddressString($Address['StreetAddress'], $Address['PostalCode'], $Address['Locality'], $Address['Region'], $Address['Country']);
}
}
}
if ($vCard -> BDAY) {
$properties["birthday"] = strtotime($vCard -> BDAY[0]);
}
if ($vCard -> NOTE) {
$properties["body"] = $vCard -> NOTE[0];
}
if ($vCard -> PHOTO) {
if(!is_writable(TMP_PATH . "/")) {
error_log("could not write to export tmp directory!: " . $E);
} else {
$tmppath = TMP_PATH . "/" . $this->randomstring(15);
try {
if($vCard -> SaveFile('photo', 0, $tmppath)) {
$properties["x_photo_path"] = $tmppath;
} else {
if($this->DEBUG) {
error_log("remote imagefetching not implemented");
}
}
} catch (Exception $E) {
error_log("Image exception: " . $E);
}
}
}
array_push($carr, $properties);
}
} else {
error_log("csv parsing not implemented");
}
return $carr;
}
/**
* Generate the whole addressstring
*
* @param street
* @param zip
* @param city
* @param state
* @param country
* @return string the concatinated address string
* @private
*/
private function buildAddressString($street, $zip, $city, $state, $country) {
$out = "";
if (isset($country) && $street != "") $out = $country;
$zcs = "";
if (isset($zip) && $zip != "") $zcs = $zip;
if (isset($city) && $city != "") $zcs .= (($zcs)?" ":"") . $city;
if (isset($state) && $state != "") $zcs .= (($zcs)?" ":"") . $state;
if ($zcs) $out = $zcs . "\r\n" . $out;
if (isset($street) && $street != "") $out = $street . (($out)?"\r\n". $out: "") ;
return $out;
}
/**
* Store the file to a temporary directory, prepare it for oc upload
* @param $actionType
* @param $actionData
* @private
*/
private function getAttachmentPath($actionType, $actionData) {
// Get store id
$storeid = false;
if(isset($actionData["store"])) {
$storeid = $actionData["store"];
}
// Get message entryid
$entryid = false;
if(isset($actionData["entryid"])) {
$entryid = $actionData["entryid"];
}
// Check which type isset
$openType = "attachment";
// Get number of attachment which should be opened.
$attachNum = false;
if(isset($actionData["attachNum"])) {
$attachNum = $actionData["attachNum"];
}
// Check if storeid and entryid isset
if($storeid && $entryid) {
// Open the store
$store = $GLOBALS["mapisession"]->openMessageStore(hex2bin($storeid));
if($store) {
// Open the message
$message = mapi_msgstore_openentry($store, hex2bin($entryid));
if($message) {
$attachment = false;
// Check if attachNum isset
if($attachNum) {
// Loop through the attachNums, message in message in message ...
for($i = 0; $i < (count($attachNum) - 1); $i++)
{
// Open the attachment
$tempattach = mapi_message_openattach($message, (int) $attachNum[$i]);
if($tempattach) {
// Open the object in the attachment
$message = mapi_attach_openobj($tempattach);
}
}
// Open the attachment
$attachment = mapi_message_openattach($message, (int) $attachNum[(count($attachNum) - 1)]);
}
// Check if the attachment is opened
if($attachment) {
// Get the props of the attachment
$props = mapi_attach_getprops($attachment, array(PR_ATTACH_LONG_FILENAME, PR_ATTACH_MIME_TAG, PR_DISPLAY_NAME, PR_ATTACH_METHOD));
// Content Type
$contentType = "application/octet-stream";
// Filename
$filename = "ERROR";
// Set filename
if(isset($props[PR_ATTACH_LONG_FILENAME])) {
$filename = $props[PR_ATTACH_LONG_FILENAME];
} else if(isset($props[PR_ATTACH_FILENAME])) {
$filename = $props[PR_ATTACH_FILENAME];
} else if(isset($props[PR_DISPLAY_NAME])) {
$filename = $props[PR_DISPLAY_NAME];
}
// Set content type
if(isset($props[PR_ATTACH_MIME_TAG])) {
$contentType = $props[PR_ATTACH_MIME_TAG];
} else {
// Parse the extension of the filename to get the content type
if(strrpos($filename, ".") !== false) {
$extension = strtolower(substr($filename, strrpos($filename, ".")));
$contentType = "application/octet-stream";
if (is_readable("mimetypes.dat")){
$fh = fopen("mimetypes.dat","r");
$ext_found = false;
while (!feof($fh) && !$ext_found){
$line = fgets($fh);
preg_match("/(\.[a-z0-9]+)[ \t]+([^ \t\n\r]*)/i", $line, $result);
if ($extension == $result[1]){
$ext_found = true;
$contentType = $result[2];
}
}
fclose($fh);
}
}
}
$tmpname = tempnam(TMP_PATH, stripslashes($filename));
// Open a stream to get the attachment data
$stream = mapi_openpropertytostream($attachment, PR_ATTACH_DATA_BIN);
$stat = mapi_stream_stat($stream);
// File length = $stat["cb"]
$fhandle = fopen($tmpname,'w');
$buffer = null;
for($i = 0; $i < $stat["cb"]; $i += BLOCK_SIZE) {
// Write stream
$buffer = mapi_stream_read($stream, BLOCK_SIZE);
fwrite($fhandle,$buffer,strlen($buffer));
}
fclose($fhandle);
$response = array();
$response['tmpname'] = $tmpname;
$response['filename'] = $filename;
$response['status'] = true;
$this->addActionData($actionType, $response);
$GLOBALS["bus"]->addData($this->getResponseData());
}
}
} else {
$response['status'] = false;
$response['message'] = "Store could not be opened!";
$this->addActionData($actionType, $response);
$GLOBALS["bus"]->addData($this->getResponseData());
}
} else {
$response['status'] = false;
$response['message'] = "Wrong call, store and entryid have to be set!";
$this->addActionData($actionType, $response);
$GLOBALS["bus"]->addData($this->getResponseData());
}
}
};
?>

View File

@ -0,0 +1,81 @@
<?php
/**
* plugin.contactimporter.php, zarafa contact to vcf im/exporter
*
* Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2013 Christoph Haas
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* 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,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/**
* contactimporter Plugin
*
* With this plugin you can import a vcf file to your zarafa addressbook
*
*/
class Plugincontactimporter extends Plugin {
/**
* Constructor
*/
function Plugincontactimporter() {}
/**
* Function initializes the Plugin and registers all hooks
*
* @return void
*/
function init() {
$this->registerHook('server.core.settings.init.before');
}
/**
* Function is executed when a hook is triggered by the PluginManager
*
* @param string $eventID the id of the triggered hook
* @param mixed $data object(s) related to the hook
* @return void
*/
function execute($eventID, &$data) {
switch($eventID) {
case 'server.core.settings.init.before' :
$this->injectPluginSettings($data);
break;
}
}
/**
* Called when the core Settings class is initialized and ready to accept sysadmin default
* settings.
* @param Array $data Reference to the data of the triggered hook
*/
function injectPluginSettings(&$data) {
$data['settingsObj']->addSysAdminDefaults(Array(
'zarafa' => Array(
'v1' => Array(
'plugins' => Array(
'contactimporter' => Array(
'enable' => PLUGIN_CONTACTIMPORTER_USER_DEFAULT_ENABLE,
'enable_export' => PLUGIN_CONTACTIMPORTER_USER_DEFAULT_ENABLE_EXPORT,
'default_addressbook' => PLUGIN_CONTACTIMPORTER_DEFAULT
)
)
)
)
));
}
}
?>

72
php/upload.php Normal file
View File

@ -0,0 +1,72 @@
<?php
/**
* upload.php, zarafa contact to vcf im/exporter
*
* Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2013 Christoph Haas
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* 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,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
require_once("../config.php");
/* disable error printing - otherwise json communication might break... */
ini_set('display_errors', '0');
/**
* respond/echo JSON
* @param $arr
*/
function respondJSON($arr) {
echo json_encode($arr);
}
/**
* Generates a random string with variable length.
* @param $length the lenght of the generated string
* @return string a random string
*/
function randomstring($length = 6) {
// $chars - all allowed charakters
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
srand((double)microtime()*1000000);
$i = 0;
$pass = "";
while ($i < $length) {
$num = rand() % strlen($chars);
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$destpath = PLUGIN_CONTACTIMPORTER_TMP_UPLOAD;
$destpath .= $_FILES['vcfdata']['name'] . randomstring();
if(is_readable ($_FILES['vcfdata']['tmp_name'])) {
$result = move_uploaded_file($_FILES['vcfdata']['tmp_name'],$destpath);
if($result) {
respondJSON(array ('success'=>true, 'vcf_file'=>$destpath));
} else {
respondJSON(array ('success'=>false,'error'=>"File could not be moved to TMP path! Check plugin config and folder permissions!"));
}
} else {
respondJSON(array ('success'=>false,'error'=>"File could not be read by server, upload error!"));
}
?>

View File

@ -0,0 +1,410 @@
BEGIN:VCARD
VERSION:2.1
N;LANGUAGE=de:master;test;of;Herr;jun.
FN:Herr test of master jun.
ORG:testcomp;Abteilung X
TITLE:chef
TEL;WORK;VOICE:123456
TEL;HOME;VOICE:234567
TEL;CELL;VOICE:456789
ADR;WORK:;;test 1;entenh;tirol;789;Albanien
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:test 1=0D=0A=
789 entenh tirol=0D=0A=
Albanien
ADR;HOME;PREF:;;priv 2;sepplh;vorarlberg;213;Anguilla
LABEL;HOME;PREF;ENCODING=QUOTED-PRINTABLE:priv 2=0D=0A=
213 sepplh vorarlberg=0D=0A=
Anguilla
ADR;POSTAL:;;other 4;saadsf;addsag;5649;Brasilien
LABEL;POSTAL;ENCODING=QUOTED-PRINTABLE:other 4=0D=0A=
saadsf - addsag=0D=0A=
Brasilien=0D=0A=
5649
X-MS-OL-DEFAULT-POSTAL-ADDRESS:1
URL;WORK:www.google.at
EMAIL;PREF;INTERNET:email1@at.e
EMAIL;INTERNET:email2@at.e
EMAIL;INTERNET:email3@at.e
PHOTO;TYPE=JPEG;ENCODING=BASE64:
/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgK
CgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkL
EBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAAR
CAE6AToDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAA
AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK
FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWG
h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl
5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREA
AgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYk
NOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOE
hYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0t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msWl
myKUSdgKro3vUgcEcdaVh3uWUkDDBPSpFYE4JqkHYcZqeJiT1pMpSV7FlGOetTpLg1WByKcp
5yallp6lwSmlWY5yDVVXPc09G5yTSL5maEUhPU1OJADjFUI5MdDUolxzmptY2i9C4JOelOVy
T1qmsuT1qeJiTkmky1LoWVJPFTxEZqurCpozg8CoaN4bk5GRwaq3AwDmriDcKguICVNSdS1W
hi3I2ng1UMgz979Ks3yOpJxWS0h3Hk9a2jG5lJ2Z6je2cc6lWX8xXL6poaEEhBXazAY6VlX4
GwnFY3a1R6dSKcWeXaroSqSVWueuLEoSCuK9E1lQWbIHT0rl75VCEhR37V10ptrU8OtCN9Dm
mhMZxUZXByau3AG3OO5qofvGug5XawoJHSl3NjGabTm6VLViGrkigEAVct1BTv8ASqcVXrf7
p+lS1qc1bYcTtGAMUwuQMYzTn+9TaSOaKV7sMlTkVbt5B3FUz941JETvxntVNaF2TNq3iSUU
+W2HYY+lRacT61fwDwRWD0djSKVjPFsRng0iwEE5FaBUc8D8qZKAMYHajm1L5Si0RFNMZxtA
q24GM4pMD0p8wWKmwg5NLsI4xUzAb+lDAY6U7iejK5UgmlAJOOKlAGTxSMABwKdwWogjOeTU
0aHoRREB6VPEBzxUtm1OKbHLE5GVHvQVYckVaQAIMCpnVSq5UdB2qGzs9gnG9zO2sO1OXd3F
OfqfqKaelMwcbEqMQcCpFc45FV1Jz1qRTwKTBE6MSelWomwMiqak5FWYSaTNIvUuIxJyBmrM
IJOcVTi6ir1v1qG7nXT1ZdgjJHK1JJApXpTrbp071ZcDb0qD0qUVY5vUbQkHaDWEbA5PyH8j
XX3YBDZA71mlVz90flVRbQToxZ//2Q==
X-MS-OL-DESIGN;CHARSET=utf-8:<card xmlns="http://schemas.microsoft.com/office/outlook/12/electronicbusinesscards" ver="1.0" layout="left" bgcolor="ffffff"><img xmlns="" align="tleft" area="32" use="photo"/><fld xmlns="" prop="name" align="left" dir="ltr" style="b" color="000000" size="10"/><fld xmlns="" prop="org" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="title" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="dept" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="telwork" align="left" dir="ltr" color="000000" size="8"><label align="right" color="626262">Geschäftlich</label></fld><fld xmlns="" prop="telcell" align="left" dir="ltr" color="000000" size="8"><label align="right" color="626262">Mobiltelefon</label></fld><fld xmlns="" prop="telhome" align="left" dir="ltr" color="000000" size="8"><label align="right" color="626262">Privat</label></fld><fld xmlns="" prop="email" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="email2" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="email3" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="addrhome" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="addrwork" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="addrother" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="webwork" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/></card>
REV:20130520T141721Z
END:VCARD

690
php/vcf/class.vCard.php Normal file
View File

@ -0,0 +1,690 @@
<?php
/**
* vCard class for parsing a vCard and/or creating one
*
* @link https://github.com/nuovo/vCard-parser
* @author Martins Pilsetnieks, Roberts Bruveris
* @see RFC 2426, RFC 2425
* @version 0.4.8
*/
class vCard implements Countable, Iterator
{
const MODE_ERROR = 'error';
const MODE_SINGLE = 'single';
const MODE_MULTIPLE = 'multiple';
const endl = "\n";
/**
* @var string Current object mode - error, single or multiple (for a single vCard within a file and multiple combined vCards)
*/
private $Mode; //single, multiple, error
private $Path = '';
private $RawData = '';
/**
* @var array Internal options container. Options:
* bool Collapse: If true, elements that can have multiple values but have only a single value are returned as that value instead of an array
* If false, an array is returned even if it has only one value.
*/
private $Options = array(
'Collapse' => false
);
/**
* @var array Internal data container. Contains vCard objects for multiple vCards and just the data for single vCards.
*/
private $Data = array();
/**
* @static Parts of structured elements according to the spec.
*/
private static $Spec_StructuredElements = array(
'n' => array('LastName', 'FirstName', 'AdditionalNames', 'Prefixes', 'Suffixes'),
'adr' => array('POBox', 'ExtendedAddress', 'StreetAddress', 'Locality', 'Region', 'PostalCode', 'Country'),
'geo' => array('Latitude', 'Longitude'),
'org' => array('Name', 'Unit1', 'Unit2')
);
private static $Spec_MultipleValueElements = array('nickname', 'categories');
private static $Spec_ElementTypes = array(
'email' => array('internet', 'x400', 'pref'),
'adr' => array('dom', 'intl', 'postal', 'parcel', 'home', 'work', 'pref'),
'label' => array('dom', 'intl', 'postal', 'parcel', 'home', 'work', 'pref'),
'tel' => array('home', 'msg', 'work', 'pref', 'voice', 'fax', 'cell', 'video', 'pager', 'bbs', 'modem', 'car', 'isdn', 'pcs'),
'impp' => array('personal', 'business', 'home', 'work', 'mobile', 'pref')
);
private static $Spec_FileElements = array('photo', 'logo', 'sound');
/**
* vCard constructor
*
* @param string Path to file, optional.
* @param string Raw data, optional.
* @param array Additional options, optional. Currently supported options:
* bool Collapse: If true, elements that can have multiple values but have only a single value are returned as that value instead of an array
* If false, an array is returned even if it has only one value.
*
* One of these parameters must be provided, otherwise an exception is thrown.
*/
public function __construct($Path = false, $RawData = false, array $Options = null)
{
// Checking preconditions for the parser.
// If path is given, the file should be accessible.
// If raw data is given, it is taken as it is.
// In both cases the real content is put in $this -> RawData
if ($Path)
{
if (!is_readable($Path))
{
throw new Exception('vCard: Path not accessible ('.$Path.')');
}
$this -> Path = $Path;
$this -> RawData = file_get_contents($this -> Path);
}
elseif ($RawData)
{
$this -> RawData = $RawData;
}
else
{
//throw new Exception('vCard: No content provided');
// Not necessary anymore as possibility to create vCards is added
}
if (!$this -> Path && !$this -> RawData)
{
return true;
}
if ($Options)
{
$this -> Options = array_merge($this -> Options, $Options);
}
// Counting the begin/end separators. If there aren't any or the count doesn't match, there is a problem with the file.
// If there is only one, this is a single vCard, if more, multiple vCards are combined.
$Matches = array();
$vCardBeginCount = preg_match_all('{^BEGIN\:VCARD}miS', $this -> RawData, $Matches);
$vCardEndCount = preg_match_all('{^END\:VCARD}miS', $this -> RawData, $Matches);
if (($vCardBeginCount != $vCardEndCount) || !$vCardBeginCount)
{
$this -> Mode = vCard::MODE_ERROR;
throw new Exception('vCard: invalid vCard');
}
$this -> Mode = $vCardBeginCount == 1 ? vCard::MODE_SINGLE : vCard::MODE_MULTIPLE;
// Removing/changing inappropriate newlines, i.e., all CRs or multiple newlines are changed to a single newline
$this -> RawData = str_replace("\r", "\n", $this -> RawData);
$this -> RawData = preg_replace('{(\n+)}', "\n", $this -> RawData);
// In multiple card mode the raw text is split at card beginning markers and each
// fragment is parsed in a separate vCard object.
if ($this -> Mode == self::MODE_MULTIPLE)
{
$this -> RawData = explode('BEGIN:VCARD', $this -> RawData);
$this -> RawData = array_filter($this -> RawData);
foreach ($this -> RawData as $SinglevCardRawData)
{
// Prepending "BEGIN:VCARD" to the raw string because we exploded on that one.
// If there won't be the BEGIN marker in the new object, it will fail.
$SinglevCardRawData = 'BEGIN:VCARD'."\n".$SinglevCardRawData;
$ClassName = get_class($this);
$this -> Data[] = new $ClassName(false, $SinglevCardRawData);
}
}
else
{
// Protect the BASE64 final = sign (detected by the line beginning with whitespace), otherwise the next replace will get rid of it
$this -> RawData = preg_replace('{(\n\s.+)=(\n)}', '$1-base64=-$2', $this -> RawData);
// Joining multiple lines that are split with a hard wrap and indicated by an equals sign at the end of line
// (quoted-printable-encoded values in v2.1 vCards)
$this -> RawData = str_replace("=\n", '', $this -> RawData);
// Joining multiple lines that are split with a soft wrap (space or tab on the beginning of the next line
$this -> RawData = str_replace(array("\n ", "\n\t"), '-wrap-', $this -> RawData);
// Restoring the BASE64 final equals sign (see a few lines above)
$this -> RawData = str_replace("-base64=-\n", "=\n", $this -> RawData);
$Lines = explode("\n", $this -> RawData);
foreach ($Lines as $Line)
{
// Lines without colons are skipped because, most likely, they contain no data.
if (strpos($Line, ':') === false)
{
continue;
}
// Each line is split into two parts. The key contains the element name and additional parameters, if present,
// value is just the value
list($Key, $Value) = explode(':', $Line, 2);
// Key is transformed to lowercase because, even though the element and parameter names are written in uppercase,
// it is quite possible that they will be in lower- or mixed case.
// The key is trimmed to allow for non-significant WSP characters as allowed by v2.1
$Key = strtolower(trim(self::Unescape($Key)));
// These two lines can be skipped as they aren't necessary at all.
if ($Key == 'begin' || $Key == 'end')
{
continue;
}
if ((strpos($Key, 'agent') === 0) && (stripos($Value, 'begin:vcard') !== false))
{
$ClassName = get_class($this);
$Value = new $ClassName(false, str_replace('-wrap-', "\n", $Value));
if (!isset($this -> Data[$Key]))
{
$this -> Data[$Key] = array();
}
$this -> Data[$Key][] = $Value;
continue;
}
else
{
$Value = str_replace('-wrap-', '', $Value);
}
$Value = trim(self::Unescape($Value));
$Type = array();
// Here additional parameters are parsed
$KeyParts = explode(';', $Key);
$Key = $KeyParts[0];
$Encoding = false;
if (strpos($Key, 'item') === 0)
{
$TmpKey = explode('.', $Key, 2);
$Key = $TmpKey[1];
$ItemIndex = (int)str_ireplace('item', '', $TmpKey[0]);
}
if (count($KeyParts) > 1)
{
$Parameters = self::ParseParameters($Key, array_slice($KeyParts, 1));
foreach ($Parameters as $ParamKey => $ParamValue)
{
switch ($ParamKey)
{
case 'encoding':
$Encoding = $ParamValue;
if (in_array($ParamValue, array('b', 'base64')))
{
//$Value = base64_decode($Value);
}
elseif ($ParamValue == 'quoted-printable') // v2.1
{
$Value = quoted_printable_decode($Value);
}
break;
case 'charset': // v2.1
if ($ParamValue != 'utf-8' && $ParamValue != 'utf8')
{
$Value = mb_convert_encoding($Value, 'UTF-8', $ParamValue);
}
break;
case 'type':
$Type = $ParamValue;
break;
}
}
}
// Checking files for colon-separated additional parameters (Apple's Address Book does this), for example, "X-ABCROP-RECTANGLE" for photos
if (in_array($Key, self::$Spec_FileElements) && isset($Parameters['encoding']) && in_array($Parameters['encoding'], array('b', 'base64')))
{
// If colon is present in the value, it must contain Address Book parameters
// (colon is an invalid character for base64 so it shouldn't appear in valid files)
if (strpos($Value, ':') !== false)
{
$Value = explode(':', $Value);
$Value = array_pop($Value);
}
}
// Values are parsed according to their type
if (isset(self::$Spec_StructuredElements[$Key]))
{
$Value = self::ParseStructuredValue($Value, $Key);
if ($Type)
{
$Value['Type'] = $Type;
}
}
else
{
if (in_array($Key, self::$Spec_MultipleValueElements))
{
$Value = self::ParseMultipleTextValue($Value, $Key);
}
if ($Type)
{
$Value = array(
'Value' => $Value,
'Type' => $Type
);
}
}
if (is_array($Value) && $Encoding)
{
$Value['Encoding'] = $Encoding;
}
if (!isset($this -> Data[$Key]))
{
$this -> Data[$Key] = array();
}
$this -> Data[$Key][] = $Value;
}
}
}
/**
* Magic method to get the various vCard values as object members, e.g.
* a call to $vCard -> N gets the "N" value
*
* @param string Key
*
* @return mixed Value
*/
public function __get($Key)
{
$Key = strtolower($Key);
if (isset($this -> Data[$Key]))
{
if ($Key == 'agent')
{
return $this -> Data[$Key];
}
elseif (in_array($Key, self::$Spec_FileElements))
{
$Value = $this -> Data[$Key];
foreach ($Value as $K => $V)
{
if (stripos($V['Value'], 'uri:') === 0)
{
$Value[$K]['Value'] = substr($V, 4);
$Value[$K]['Encoding'] = 'uri';
}
}
return $Value;
}
if ($this -> Options['Collapse'] && is_array($this -> Data[$Key]) && (count($this -> Data[$Key]) == 1))
{
return $this -> Data[$Key][0];
}
return $this -> Data[$Key];
}
elseif ($Key == 'Mode')
{
return $this -> Mode;
}
return array();
}
/**
* Saves an embedded file
*
* @param string Key
* @param int Index of the file, defaults to 0
* @param string Target path where the file should be saved, including the filename
*
* @return bool Operation status
*/
public function SaveFile($Key, $Index = 0, $TargetPath = '')
{
if (!isset($this -> Data[$Key]))
{
return false;
}
if (!isset($this -> Data[$Key][$Index]))
{
return false;
}
// Returing false if it is an image URL
if (stripos($this -> Data[$Key][$Index]['Value'], 'uri:') === 0)
{
return false;
}
if (is_writable($TargetPath) || (!file_exists($TargetPath) && is_writable(dirname($TargetPath))))
{
$RawContent = $this -> Data[$Key][$Index]['Value'];
if (isset($this -> Data[$Key][$Index]['Encoding']) && $this -> Data[$Key][$Index]['Encoding'] == 'b')
{
$RawContent = base64_decode($RawContent);
}
$Status = file_put_contents($TargetPath, $RawContent);
return (bool)$Status;
}
else
{
throw new Exception('vCard: Cannot save file ('.$Key.'), target path not writable ('.$TargetPath.')');
}
return false;
}
/**
* Magic method for adding data to the vCard
*
* @param string Key
* @param string Method call arguments. First element is value.
*
* @return vCard Current object for method chaining
*/
public function __call($Key, $Arguments)
{
$Key = strtolower($Key);
if (!isset($this -> Data[$Key]))
{
$this -> Data[$Key] = array();
}
$Value = isset($Arguments[0]) ? $Arguments[0] : false;
if (count($Arguments) > 1)
{
$Types = array_values(array_slice($Arguments, 1));
if (isset(self::$Spec_StructuredElements[$Key]) &&
in_array($Arguments[1], self::$Spec_StructuredElements[$Key])
)
{
$LastElementIndex = 0;
if (count($this -> Data[$Key]))
{
$LastElementIndex = count($this -> Data[$Key]) - 1;
}
if (isset($this -> Data[$Key][$LastElementIndex]))
{
if (empty($this -> Data[$Key][$LastElementIndex][$Types[0]]))
{
$this -> Data[$Key][$LastElementIndex][$Types[0]] = $Value;
}
else
{
$LastElementIndex++;
}
}
if (!isset($this -> Data[$Key][$LastElementIndex]))
{
$this -> Data[$Key][$LastElementIndex] = array(
$Types[0] => $Value
);
}
}
elseif (isset(self::$Spec_ElementTypes[$Key]))
{
$this -> Data[$Key][] = array(
'Value' => $Value,
'Type' => $Types
);
}
}
elseif ($Value)
{
$this -> Data[$Key][] = $Value;
}
return $this;
}
/**
* Magic method for getting vCard content out
*
* @return string Raw vCard content
*/
public function __toString()
{
$Text = 'BEGIN:VCARD'.self::endl;
$Text .= 'VERSION:3.0'.self::endl;
foreach ($this -> Data as $Key => $Values)
{
$KeyUC = strtoupper($Key);
$Key = strtolower($Key);
if (in_array($KeyUC, array('PHOTO', 'VERSION')))
{
continue;
}
foreach ($Values as $Index => $Value)
{
$Text .= $KeyUC;
if (is_array($Value) && isset($Value['Type']))
{
$Text .= ';TYPE='.self::PrepareTypeStrForOutput($Value['Type']);
}
$Text .= ':';
if (isset(self::$Spec_StructuredElements[$Key]))
{
$PartArray = array();
foreach (self::$Spec_StructuredElements[$Key] as $Part)
{
$PartArray[] = isset($Value[$Part]) ? $Value[$Part] : '';
}
$Text .= implode(';', $PartArray);
}
elseif (is_array($Value) && isset(self::$Spec_ElementTypes[$Key]))
{
$Text .= $Value['Value'];
}
else
{
$Text .= $Value;
}
$Text .= self::endl;
}
}
$Text .= 'END:VCARD'.self::endl;
return $Text;
}
// !Helper methods
private static function PrepareTypeStrForOutput($Type)
{
return implode(',', array_map('strtoupper', $Type));
}
/**
* Removes the escaping slashes from the text.
*
* @access private
*
* @param string Text to prepare.
*
* @return string Resulting text.
*/
private static function Unescape($Text)
{
return str_replace(array('\:', '\;', '\,', "\n"), array(':', ';', ',', ''), $Text);
}
/**
* Separates the various parts of a structured value according to the spec.
*
* @access private
*
* @param string Raw text string
* @param string Key (e.g., N, ADR, ORG, etc.)
*
* @return array Parts in an associative array.
*/
private static function ParseStructuredValue($Text, $Key)
{
$Text = array_map('trim', explode(';', $Text));
$Result = array();
$Ctr = 0;
foreach (self::$Spec_StructuredElements[$Key] as $Index => $StructurePart)
{
$Result[$StructurePart] = isset($Text[$Index]) ? $Text[$Index] : null;
}
return $Result;
}
/**
* @access private
*/
private static function ParseMultipleTextValue($Text)
{
return explode(',', $Text);
}
/**
* @access private
*/
private static function ParseParameters($Key, array $RawParams = null)
{
if (!$RawParams)
{
return array();
}
// Parameters are split into (key, value) pairs
$Parameters = array();
foreach ($RawParams as $Item)
{
$Parameters[] = explode('=', strtolower($Item));
}
$Type = array();
$Result = array();
// And each parameter is checked whether anything can/should be done because of it
foreach ($Parameters as $Index => $Parameter)
{
// Skipping empty elements
if (!$Parameter)
{
continue;
}
// Handling type parameters without the explicit TYPE parameter name (2.1 valid)
if (count($Parameter) == 1)
{
// Checks if the type value is allowed for the specific element
// The second part of the "if" statement means that email elements can have non-standard types (see the spec)
if (
(isset(self::$Spec_ElementTypes[$Key]) && in_array($Parameter[0], self::$Spec_ElementTypes[$Key])) ||
($Key == 'email' && is_scalar($Parameter[0]))
)
{
$Type[] = $Parameter[0];
}
}
elseif (count($Parameter) > 2)
{
$TempTypeParams = self::ParseParameters($Key, explode(',', $RawParams[$Index]));
if ($TempTypeParams['type'])
{
$Type = array_merge($Type, $TempTypeParams['type']);
}
}
else
{
switch ($Parameter[0])
{
case 'encoding':
if (in_array($Parameter[1], array('quoted-printable', 'b', 'base64')))
{
$Result['encoding'] = $Parameter[1] == 'base64' ? 'b' : $Parameter[1];
}
break;
case 'charset':
$Result['charset'] = $Parameter[1];
break;
case 'type':
$Type = array_merge($Type, explode(',', $Parameter[1]));
break;
case 'value':
if (strtolower($Parameter[1]) == 'url')
{
$Result['encoding'] = 'uri';
}
break;
}
}
}
$Result['type'] = $Type;
return $Result;
}
// !Interface methods
// Countable interface
public function count()
{
switch ($this -> Mode)
{
case self::MODE_ERROR:
return 0;
break;
case self::MODE_SINGLE:
return 1;
break;
case self::MODE_MULTIPLE:
return count($this -> Data);
break;
}
return 0;
}
// Iterator interface
public function rewind()
{
reset($this -> Data);
}
public function current()
{
return current($this -> Data);
}
public function next()
{
return next($this -> Data);
}
public function valid()
{
return ($this -> current() !== false);
}
public function key()
{
return key($this -> Data);
}
}
?>

216
php/vcf/test.php Normal file
View File

@ -0,0 +1,216 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style type="text/css">
body
{
font-family: Corbel, Arial, sans-serif;
padding: 20px 50px;
}
div.Agent
{
padding: 20px;
border: 1px solid #ddd;
background-color: #fafafa;
}
img
{
float: right;
margin: 10px;
padding: 10px;
border: 1px solid #ddd;
}
</style>
</head>
<body>
<?php
require_once('class.vCard.php');
/**
* Test function for vCard content output
* @param vCard vCard object
*/
function OutputvCard(vCard $vCard)
{
echo '<h2>'.$vCard -> FN[0].'</h2>';
if ($vCard -> PHOTO)
{
foreach ($vCard -> PHOTO as $Photo)
{
if ($Photo['Encoding'] == 'b')
{
echo '<img src="data:image/'.$Photo['Type'][0].';base64,'.$Photo['Value'].'" /><br />';
}
else
{
echo '<img src="'.$Photo['Value'].'" /><br />';
}
/*
// It can also be saved to a file
try
{
$vCard -> SaveFile('photo', 0, 'test_image.jpg');
// The parameters are:
// - name of the file we want to save (photo, logo or sound)
// - index of the file in case of multiple files (defaults to 0)
// - target path to save to, including the filenam
}
catch (Exception $E)
{
// Target path not writable
}
*/
}
}
foreach ($vCard -> N as $Name)
{
echo '<h3>Name: '.$Name['FirstName'].' '.$Name['LastName'].'</h3>';
}
foreach ($vCard -> ORG as $Organization)
{
echo '<h3>Organization: '.$Organization['Name'].
($Organization['Unit1'] || $Organization['Unit2'] ?
' ('.implode(', ', array($Organization['Unit1'], $Organization['Unit2'])).')' :
''
).'</h3>';
}
if ($vCard -> TEL)
{
echo '<p><h4>Phone</h4>';
foreach ($vCard -> TEL as $Tel)
{
if (is_scalar($Tel))
{
echo $Tel.'<br />';
}
else
{
echo $Tel['Value'].' ('.implode(', ', $Tel['Type']).')<br />';
}
}
echo '</p>';
}
if ($vCard -> EMAIL)
{
echo '<p><h4>Email</h4>';
foreach ($vCard -> EMAIL as $Email)
{
if (is_scalar($Email))
{
echo $Email;
}
else
{
echo $Email['Value'].' ('.implode(', ', $Email['Type']).')<br />';
}
}
echo '</p>';
}
if ($vCard -> URL)
{
echo '<p><h4>URL</h4>';
foreach ($vCard -> URL as $URL)
{
if (is_scalar($URL))
{
echo $URL.'<br />';
}
else
{
echo $URL['Value'].'<br />';
}
}
echo '</p>';
}
if ($vCard -> IMPP)
{
echo '<p><h4>Instant messaging</h4>';
foreach ($vCard -> IMPP as $IMPP)
{
if (is_scalar($IMPP))
{
echo $IMPP.'<br />';
}
else
{
echo $IMPP['Value'].'<br/ >';
}
}
echo '</p>';
}
if ($vCard -> ADR)
{
foreach ($vCard -> ADR as $Address)
{
echo '<p><h4>Address ('.implode(', ', $Address['Type']).')</h4>';
echo 'Street address: <strong>'.($Address['StreetAddress'] ? $Address['StreetAddress'] : '-').'</strong><br />'.
'PO Box: <strong>'.($Address['POBox'] ? $Address['POBox'] : '-').'</strong><br />'.
'Extended address: <strong>'.($Address['ExtendedAddress'] ? $Address['ExtendedAddress'] : '-').'</strong><br />'.
'Locality: <strong>'.($Address['Locality'] ? $Address['Locality'] : '-').'</strong><br />'.
'Region: <strong>'.($Address['Region'] ? $Address['Region'] : '-').'</strong><br />'.
'ZIP/Post code: <strong>'.($Address['PostalCode'] ? $Address['PostalCode'] : '-').'</strong><br />'.
'Country: <strong>'.($Address['Country'] ? $Address['Country'] : '-').'</strong>';
}
echo '</p>';
}
if ($vCard -> AGENT)
{
echo '<h4>Agents</h4>';
foreach ($vCard -> AGENT as $Agent)
{
if (is_scalar($Agent))
{
echo '<div class="Agent">'.$Agent.'</div>';
}
elseif (is_a($Agent, 'vCard'))
{
echo '<div class="Agent">';
OutputvCard($Agent);
echo '</div>';
}
}
}
}
$vCard = new vCard(
'test.vcf', // Path to vCard file
false, // Raw vCard text, can be used instead of a file
array( // Option array
// This lets you get single values for elements that could contain multiple values but have only one value.
// This defaults to false so every value that could have multiple values is returned as array.
'Collapse' => false
)
);
if (count($vCard) == 0)
{
throw new Exception('vCard test: empty vCard!');
}
// if the file contains a single vCard, it is accessible directly.
elseif (count($vCard) == 1)
{
OutputvCard($vCard);
}
// if the file contains multiple vCards, they are accessible as elements of an array
else
{
foreach ($vCard as $Index => $vCardPart)
{
OutputvCard($vCardPart);
}
}
?>
</body>
</html>

View File

@ -0,0 +1,6 @@
.icon_contactimporter_button {
background: url(../images/import_icon.png) no-repeat !important;
background-repeat: no-repeat;
background-position: center;
background-size: 18px!important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

Binary file not shown.