From af3fcfb457e3f872eca8a34626ddc64bda5f87c9 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Tue, 13 Nov 2012 20:25:52 +0000 Subject: [PATCH] save timezone, multiple import bug fix? --- js/dialogs/ImportPanel.js | 20 ++++-- js/dialogs/MainPanel.js | 133 -------------------------------------- php/ical/calendar.txt | 4 +- 3 files changed, 15 insertions(+), 142 deletions(-) delete mode 100644 js/dialogs/MainPanel.js diff --git a/js/dialogs/ImportPanel.js b/js/dialogs/ImportPanel.js index 710f6a3..8c1a367 100644 --- a/js/dialogs/ImportPanel.js +++ b/js/dialogs/ImportPanel.js @@ -6,6 +6,9 @@ Ext.namespace("Zarafa.plugins.calendarimporter.dialogs"); */ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.form.FormPanel, { + /* store the imported timezone here... */ + timezone: null, + /** * @constructor * @param {object} config @@ -110,11 +113,11 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.form.FormPa sortable: true }, columns: [ - {id: 'title', header: 'Title', width: 300, sortable: true, dataIndex: 'title'}, - {header: 'startDate', width: 150, sortable: true, dataIndex: 'start'}, - {header: 'endDate', width: 150, sortable: true, dataIndex: 'end'}, - {header: 'startDate', width: 150, sortable: true, dataIndex: 'location'}, - {header: 'endDate', width: 150, sortable: true, dataIndex: 'description'} + {id: 'Summary', header: 'Title', width: 300, sortable: true, dataIndex: 'title'}, + {header: 'Start', width: 150, sortable: true, dataIndex: 'start'}, + {header: 'End', width: 150, sortable: true, dataIndex: 'end'}, + {header: 'Location', width: 150, sortable: true, dataIndex: 'location'}, + {header: 'Description', width: 150, sortable: true, dataIndex: 'description'} ] }), sm: new Ext.grid.RowSelectionModel({multiSelect:true}) @@ -246,6 +249,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.form.FormPa success: function(file, action){ uploadField.reset(); Ext.getCmp('submitButton').enable(); + this.timezone = action.result.response.calendar["X-WR-TIMEZONE"]; this.insert(this.items.length,this.createGrid(action.result.response)); this.doLayout(); }, @@ -273,6 +277,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.form.FormPa commonend: (entry.end) ? new Date(entry.end) : new Date(entry.start).add(Date.HOUR, 1), + timezone: this.timezone, parent_entryid: calendarFolder.get('entryid'), store_entryid: calendarFolder.get('store_entryid') }); @@ -288,9 +293,10 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.form.FormPa var newRecords = this.eventgrid.selModel.getSelections(); Ext.each(newRecords, function(newRecord) { var record = this.convertToAppointmentRecord(calendarFolder,newRecord.data); - calendarStore.add(record); - calendarStore.save(); + console.log(record); + calendarStore.add(record); }, this); + calendarStore.save(); this.dialog.close(); } diff --git a/js/dialogs/MainPanel.js b/js/dialogs/MainPanel.js deleted file mode 100644 index f6c4c82..0000000 --- a/js/dialogs/MainPanel.js +++ /dev/null @@ -1,133 +0,0 @@ -/*############################################################################################################################ - * 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