diff --git a/.project b/.project deleted file mode 100644 index c511de9..0000000 --- a/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - calendarimporter - - - - - - - - diff --git a/changelog.txt b/changelog.txt index bb7cf86..ad339d1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ calendarimporter 1.2: - more imported fields (Busystatus, importance, label, class, organizer, reminder) - smaller improvements - deploy/build script + - support for shared/public folders calendarimporter 1.1 final: - ics exporter diff --git a/js/dialogs/ImportPanel.js b/js/dialogs/ImportPanel.js index a0917b8..2f826e0 100644 --- a/js/dialogs/ImportPanel.js +++ b/js/dialogs/ImportPanel.js @@ -4,7 +4,7 @@ * The main Panel of the calendarimporter plugin. * * @author Christoph Haas - * @modified 29.12.2012 + * @modified 30.12.2012 * @license http://www.opensource.org/licenses/mit-license.php MIT License */ Ext.namespace("Zarafa.plugins.calendarimporter.dialogs"); @@ -168,41 +168,29 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, { }, createSelectBox: function() { - var ctx = container.getContextByName('calendar'); - var model = ctx.getModel(); - var defaultFolder = model.getDefaultFolder(); // @type: Zarafa.hierarchy.data.MAPIFolderRecord + var defaultFolder = container.getHierarchyStore().getDefaultFolder('calendar'); // @type: Zarafa.hierarchy.data.MAPIFolderRecord var 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); + var myStore = []; + + /* 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 */ - myNewRecord = new CalendarRecord({ - realname: subFolders[i].getDisplayName(), // TODO: get the real path... - displayname: subFolders[i].getDisplayName() - }); - myStore.add(myNewRecord); + myStore.push(new Array(subFolders[i].getDisplayName(), subFolders[i].getDisplayName(), false)); // 3rd field = isPublicfolder } - - /* commit the changes to the store */ - myStore.commitChanges(); - + + /* add all shared calendar folders */ + var pubStore = container.getHierarchyStore().getPublicStore(); + 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 + } + } + return { xtype: "selectbox", ref: 'calendarselector', @@ -213,8 +201,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, { width: 100, fieldLabel: "Select a calender", store: myStore, - valueField: 'realname', - displayField: 'displayname', + mode: 'local', labelSeperator: ":", border: false, anchor: "100%", @@ -435,57 +422,17 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, { return newRecord; }, + + importCheckedEvents: function () { + var newRecords = this.eventgrid.selModel.getSelections(); + this.importEvents(newRecords); + }, importAllEvents: function () { - //receive existing calendar store - var calValue = this.calendarselector.value; - - if(calValue == undefined) { // no calendar choosen - Zarafa.common.dialogs.MessageBox.show({ - title : _('Error'), - msg : _('You have to choose a calendar!'), - icon : Zarafa.common.dialogs.MessageBox.ERROR, - buttons : Zarafa.common.dialogs.MessageBox.OK - }); - } else { - var calexist = true; - var calendarStore = new Zarafa.calendar.AppointmentStore(); - var calendarFolder = container.getHierarchyStore().getDefaultFolder('calendar'); - if(calValue != "calendar") { - var subFolders = calendarFolder.getChildren(); - var i = 0; - for(i=0;i