commit ea1a60743d74e079a9c88a829a666d1a2a72c90d Author: Christoph Haas Date: Sun Nov 11 16:48:37 2012 +0000 formular for webapp 1.0 finished (not working with 1.2 due to api changes...) diff --git a/.project b/.project new file mode 100644 index 0000000..c511de9 --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + calendarimporter + + + + + + + + diff --git a/config.php b/config.php new file mode 100644 index 0000000..4cd6fbd --- /dev/null +++ b/config.php @@ -0,0 +1,7 @@ + diff --git a/js/calendarimporter.js b/js/calendarimporter.js new file mode 100644 index 0000000..21a630f --- /dev/null +++ b/js/calendarimporter.js @@ -0,0 +1,217 @@ +/*############################################################################################################################ + * IMPORT PANEL + *############################################################################################################################*/ +Ext.namespace("Zarafa.plugins.calendarimporter"); // Assign the right namespace +Zarafa.plugins.calendarimporter.ImportPanel = Ext.extend(Ext.form.FormPanel, { + constructor: function (a) { + a = a || {}; + var b = this; + Ext.apply(a, { + xtype: "calendarimporter.ImportPanel", + 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.createUploadField(), this.createSubmitButton(), this.createCancelButton()] + }); + Zarafa.plugins.calendarimporter.ImportPanel.superclass.constructor.call(this, a) + }, + createSelectBox: function() { + ctx = container.getContextByName('calendar'); + model = ctx.getModel(); + defaultFolder = model.getDefaultFolder(); + subFolders = defaultFolder.getChildren(); + + var myStore = new Ext.data.ArrayStore({ + fields: ['calendar_id', 'calendar_displayname'], + idIndex: 0 // id for each record will be the first element + }); + + /* Calendar Record holds the name and real name of the calender */ + var CalendarRecord = Ext.data.Record.create([ + {name: 'realname', type: "string"}, + {name: 'displayname', type: "string"} + ]); + + /* Store the default folder */ + var myNewRecord = new CalendarRecord({ + realname: defaultFolder.getDefaultFolderKey(), + displayname: defaultFolder.getDisplayName() + }); + myStore.add(myNewRecord); + + for(i=0;i + + + + 0.1 + calendarimporter + ICS Calendar Importer + Christoph Haas + http://www.sprinternet.at + Import a ICS file to the zarafa calendar + + + config.php + + + + + + php/plugin.calendarimporter.php + + + js/calendarimporter.js + js/calendarimporter.js + + + resources/css/calendarimporter.css + + + + + diff --git a/php/plugin.calendarimporter.php b/php/plugin.calendarimporter.php new file mode 100644 index 0000000..5b47b31 --- /dev/null +++ b/php/plugin.calendarimporter.php @@ -0,0 +1,58 @@ +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( + 'calendarimporter' => Array( + 'enable' => PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE, + 'default_calendar' => PLUGIN_CALENDARIMPORTER_DEFAULT + ) + ) + ) + ) + )); + } +} +?> diff --git a/resources/css/calendarimporter.css b/resources/css/calendarimporter.css new file mode 100644 index 0000000..d3d595a --- /dev/null +++ b/resources/css/calendarimporter.css @@ -0,0 +1,6 @@ +.icon_calendarimporter_button { + background: url(../images/import_icon.png) no-repeat !important; + background-repeat: no-repeat; + background-position: center; + background-size: 18px!important; +} \ No newline at end of file diff --git a/resources/images/import_icon.png b/resources/images/import_icon.png new file mode 100644 index 0000000..db81205 Binary files /dev/null and b/resources/images/import_icon.png differ