calendarimporter 1.2:

- New timezone management
 - more imported fields (Busystatus, importance, label, class, organizer, reminder)
 - smaller improvements
 - deploy/build script
 - support for shared folders
This commit is contained in:
Christoph Haas 2012-12-30 18:18:46 +00:00
parent 4795a0002a
commit 2e228b57da
3 changed files with 54 additions and 100 deletions

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>calendarimporter</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

View File

@ -3,6 +3,7 @@ calendarimporter 1.2:
- more imported fields (Busystatus, importance, label, class, organizer, reminder) - more imported fields (Busystatus, importance, label, class, organizer, reminder)
- smaller improvements - smaller improvements
- deploy/build script - deploy/build script
- support for shared/public folders
calendarimporter 1.1 final: calendarimporter 1.1 final:
- ics exporter - ics exporter

View File

@ -4,7 +4,7 @@
* The main Panel of the calendarimporter plugin. * The main Panel of the calendarimporter plugin.
* *
* @author Christoph Haas <mail@h44z.net> * @author Christoph Haas <mail@h44z.net>
* @modified 29.12.2012 * @modified 30.12.2012
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license http://www.opensource.org/licenses/mit-license.php MIT License
*/ */
Ext.namespace("Zarafa.plugins.calendarimporter.dialogs"); Ext.namespace("Zarafa.plugins.calendarimporter.dialogs");
@ -168,40 +168,28 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
}, },
createSelectBox: function() { createSelectBox: function() {
var ctx = container.getContextByName('calendar'); var defaultFolder = container.getHierarchyStore().getDefaultFolder('calendar'); // @type: Zarafa.hierarchy.data.MAPIFolderRecord
var model = ctx.getModel();
var defaultFolder = model.getDefaultFolder(); // @type: Zarafa.hierarchy.data.MAPIFolderRecord
var subFolders = defaultFolder.getChildren(); var subFolders = defaultFolder.getChildren();
var myStore = [];
var myStore = new Ext.data.ArrayStore({ /* add all local calendar folders */
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 i = 0; var i = 0;
myStore.push(new Array(defaultFolder.getDefaultFolderKey(), defaultFolder.getDisplayName()));
for(i = 0; i < subFolders.length; i++) { for(i = 0; i < subFolders.length; i++) {
/* Store all subfolders */ /* Store all subfolders */
myNewRecord = new CalendarRecord({ myStore.push(new Array(subFolders[i].getDisplayName(), subFolders[i].getDisplayName(), false)); // 3rd field = isPublicfolder
realname: subFolders[i].getDisplayName(), // TODO: get the real path...
displayname: subFolders[i].getDisplayName()
});
myStore.add(myNewRecord);
} }
/* commit the changes to the store */ /* add all shared calendar folders */
myStore.commitChanges(); 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 { return {
xtype: "selectbox", xtype: "selectbox",
@ -213,8 +201,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
width: 100, width: 100,
fieldLabel: "Select a calender", fieldLabel: "Select a calender",
store: myStore, store: myStore,
valueField: 'realname', mode: 'local',
displayField: 'displayname',
labelSeperator: ":", labelSeperator: ":",
border: false, border: false,
anchor: "100%", anchor: "100%",
@ -436,56 +423,16 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
return newRecord; return newRecord;
}, },
importCheckedEvents: function () {
var newRecords = this.eventgrid.selModel.getSelections();
this.importEvents(newRecords);
},
importAllEvents: function () { 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<subFolders.length;i++) {
// look up right folder
// TODO: improve!!
if(subFolders[i].getDisplayName() == calValue) {
calendarFolder = subFolders[i];
break;
}
}
if(calendarFolder.getDefaultFolderKey() != undefined) {
Zarafa.common.dialogs.MessageBox.show({
title : _('Error'),
msg : _('Selected calendar does not exist!'),
icon : Zarafa.common.dialogs.MessageBox.ERROR,
buttons : Zarafa.common.dialogs.MessageBox.OK
});
calexist = false;
}
}
if(calexist) {
//receive Records from grid rows //receive Records from grid rows
this.eventgrid.selModel.selectAll(); // select all entries this.eventgrid.selModel.selectAll(); // select all entries
var newRecords = this.eventgrid.selModel.getSelections(); var newRecords = this.eventgrid.selModel.getSelections();
Ext.each(newRecords, function(newRecord) { this.importEvents(newRecords);
var record = this.convertToAppointmentRecord(calendarFolder,newRecord.data);
calendarStore.add(record);
}, this);
calendarStore.save();
this.dialog.close();
}
}
}, },
exportAllEvents: function () { exportAllEvents: function () {
@ -502,9 +449,18 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
} else { } else {
var calexist = true; var calexist = true;
var calendarFolder = container.getHierarchyStore().getDefaultFolder('calendar'); var calendarFolder = container.getHierarchyStore().getDefaultFolder('calendar');
var pubStore = container.getHierarchyStore().getPublicStore();
var pubFolder = pubStore.getDefaultFolder("publicfolders");
var pubSubFolders = pubFolder.getChildren();
if(calValue != "calendar") { if(calValue != "calendar") {
var subFolders = calendarFolder.getChildren(); var subFolders = calendarFolder.getChildren();
var i = 0; var i = 0;
for(i = 0; i < pubSubFolders.length; i++) {
if(pubSubFolders[i].isContainerClass("IPF.Appointment")){
subFolders.push(pubSubFolders[i]);
}
}
for(i=0;i<subFolders.length;i++) { for(i=0;i<subFolders.length;i++) {
// loo up right folder // loo up right folder
// TODO: improve!! // TODO: improve!!
@ -514,7 +470,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
} }
} }
if(calendarFolder.getDefaultFolderKey() != undefined) { if(calendarFolder.isDefaultFolder()) {
Zarafa.common.dialogs.MessageBox.show({ Zarafa.common.dialogs.MessageBox.show({
title : _('Error'), title : _('Error'),
msg : _('Selected calendar does not exist!'), msg : _('Selected calendar does not exist!'),
@ -627,7 +583,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
} }
}, },
importCheckedEvents: function () { importEvents: function (events) {
//receive existing calendar store //receive existing calendar store
var calValue = this.calendarselector.value; var calValue = this.calendarselector.value;
@ -650,9 +606,18 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
} else { } else {
var calendarStore = new Zarafa.calendar.AppointmentStore(); var calendarStore = new Zarafa.calendar.AppointmentStore();
var calendarFolder = container.getHierarchyStore().getDefaultFolder('calendar'); var calendarFolder = container.getHierarchyStore().getDefaultFolder('calendar');
var pubStore = container.getHierarchyStore().getPublicStore();
var pubFolder = pubStore.getDefaultFolder("publicfolders");
var pubSubFolders = pubFolder.getChildren();
if(calValue != "calendar") { if(calValue != "calendar") {
var subFolders = calendarFolder.getChildren(); var subFolders = calendarFolder.getChildren();
var i = 0; var i = 0;
for(i = 0; i < pubSubFolders.length; i++) {
if(pubSubFolders[i].isContainerClass("IPF.Appointment")){
subFolders.push(pubSubFolders[i]);
}
}
for(i=0;i<subFolders.length;i++) { for(i=0;i<subFolders.length;i++) {
// look up right folder // look up right folder
// TODO: improve!! // TODO: improve!!
@ -662,7 +627,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
} }
} }
if(calendarFolder.getDefaultFolderKey() != undefined) { if(calendarFolder.isDefaultFolder()) {
Zarafa.common.dialogs.MessageBox.show({ Zarafa.common.dialogs.MessageBox.show({
title : _('Error'), title : _('Error'),
msg : _('Selected calendar does not exist!'), msg : _('Selected calendar does not exist!'),
@ -675,8 +640,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
if(calexist) { if(calexist) {
//receive Records from grid rows //receive Records from grid rows
var newRecords = this.eventgrid.selModel.getSelections(); Ext.each(events, function(newRecord) {
Ext.each(newRecords, function(newRecord) {
var record = this.convertToAppointmentRecord(calendarFolder,newRecord.data); var record = this.convertToAppointmentRecord(calendarFolder,newRecord.data);
calendarStore.add(record); calendarStore.add(record);
}, this); }, this);