From ad23a0980245a0ab1835aa1fac5e51ef5ce6ac86 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Sun, 25 Aug 2013 22:01:21 +0000 Subject: [PATCH] temp commit --- js/settings/SettingsCalSyncWidget.js | 4 +- js/settings/dialogs/CalSyncEditPanel.js | 59 +++++++++++++++++++++++-- js/settings/ui/CalSyncGrid.js | 5 +++ 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/js/settings/SettingsCalSyncWidget.js b/js/settings/SettingsCalSyncWidget.js index 557026d..9224e9c 100644 --- a/js/settings/SettingsCalSyncWidget.js +++ b/js/settings/SettingsCalSyncWidget.js @@ -27,6 +27,7 @@ Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zara { name : 'user' }, { name : 'pass' }, { name : 'intervall', type : 'int' }, + { name : 'calendar' }, { name : 'lastsync' } ], sortInfo : { @@ -99,7 +100,8 @@ Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zara 'intervall' : icslink.get('intervall'), 'user' : icslink.get('user'), 'pass' : icslink.get('pass'), - 'lastsync' : icslink.get('lastsync') + 'lastsync' : icslink.get('lastsync'), + 'calendar' : icslink.get('calendar') }; } settingsModel.set('zarafa/v1/contexts/calendar/icssync', icslinkData); diff --git a/js/settings/dialogs/CalSyncEditPanel.js b/js/settings/dialogs/CalSyncEditPanel.js index b2dffd3..ebd7af4 100644 --- a/js/settings/dialogs/CalSyncEditPanel.js +++ b/js/settings/dialogs/CalSyncEditPanel.js @@ -69,6 +69,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E intervall: this.intervall.getValue(), user: this.user.getValue(), pass: this.pass.getValue(), + calendar: this.calendar.getValue(), lastsync: 0 }); } @@ -81,6 +82,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E this.currentItem.set('intervall', this.intervall.getValue()); this.currentItem.set('user', this.user.getValue()); this.currentItem.set('pass', this.pass.getValue()); + this.currentItem.set('calendar', this.calendar.getValue()); } this.dialog.close(); } @@ -97,22 +99,58 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E var intervall = ""; var user = ""; var pass = ""; + var calendar = ""; + + var defaultFolder = container.getHierarchyStore().getDefaultFolder('calendar'); // @type: Zarafa.hierarchy.data.MAPIFolderRecord + var subFolders = defaultFolder.getChildren(); + var myStore = []; if(config.item){ icsurl = config.item.get('icsurl'); intervall = config.item.get('intervall'); user = config.item.get('user'); pass = config.item.get('pass'); + calendar = config.item.get('calendar'); } + + /* add all local calendar 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 calendar 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.Appointment")){ + 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: 'fieldset', title: _('ICAL Information'), - defaultType: 'textfield', - labelWidth: 120, + defaultType: 'textfield', layout: 'anchor', + flex: 1, defaults: { - anchor: '100%' + anchor: '100%', + flex: 1, + labelWidth: 120 }, items: [{ fieldLabel: _('ICS Url'), @@ -121,6 +159,21 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E value: icsurl, allowBlank: false }, + { + xtype:'selectbox', + fieldLabel: _('Destination Calendar'), + name: 'calendar', + ref: '../calendar', + value: calendar, + editable: false, + store: myStore, + mode: 'local', + labelSeperator: ":", + border: false, + anchor: "100%", + scope: this, + allowBlank: false + }, { xtype:'numberfield', fieldLabel: _('Sync Intervall'), diff --git a/js/settings/ui/CalSyncGrid.js b/js/settings/ui/CalSyncGrid.js index a4cc692..7535659 100644 --- a/js/settings/ui/CalSyncGrid.js +++ b/js/settings/ui/CalSyncGrid.js @@ -70,6 +70,11 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.Gr header : _('ICS File'), renderer : Zarafa.common.ui.grid.Renderers.text }, + { + dataIndex : 'calendar', + header : _('Destination Calender'), + renderer : Zarafa.common.ui.grid.Renderers.text + }, { dataIndex : 'user', header : _('Authentication'),