From 9111a196b26f952895f56feaec004c6e1e90272c Mon Sep 17 00:00:00 2001 From: C Robert Date: Wed, 2 Sep 2009 19:14:15 +0000 Subject: [PATCH] Calendar Import Monotone-Parent: 1e66868696d71db915497bde02848e689ed48c7a Monotone-Revision: 49714b85ec1539aa299cf3397138aa2bd21086cb Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-09-02T19:14:15 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 ++- .../Appointments/SOGoAppointmentFolder.h | 2 + .../Appointments/SOGoAppointmentFolder.m | 16 +++++++ .../Localizable.strings | 3 ++ UI/Scheduler/Czech.lproj/Localizable.strings | 3 ++ UI/Scheduler/Dutch.lproj/Localizable.strings | 3 ++ .../English.lproj/Localizable.strings | 3 ++ UI/Scheduler/French.lproj/Localizable.strings | 3 ++ UI/Scheduler/German.lproj/Localizable.strings | 3 ++ .../Hungarian.lproj/Localizable.strings | 3 ++ .../Italian.lproj/Localizable.strings | 3 ++ .../Russian.lproj/Localizable.strings | 3 ++ .../Spanish.lproj/Localizable.strings | 3 ++ UI/Scheduler/UIxCalView.m | 45 ++++++++++++++++++ UI/Scheduler/Welsh.lproj/Localizable.strings | 3 ++ UI/Scheduler/product.plist | 5 ++ UI/Templates/SchedulerUI/UIxCalMainView.wox | 16 ++++++- UI/WebServerResources/SchedulerUI.css | 21 +++++--- UI/WebServerResources/SchedulerUI.js | 33 ++++++++++++- UI/WebServerResources/dialog-left.png | Bin 456 -> 2862 bytes 20 files changed, 166 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f1007f3f..b273a66ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,10 @@ 2009-09-02 Cyril Robert - * UI/Contacts/UIxContactsListView.m (exportAction): Added - * UI/Scheduler/UIxCalView.m (exportAction): Added + * UI/Contacts/UIxContactsListView.m (exportAction): Added to support export. + * UI/Scheduler/UIxCalView.m (exportAction): Added to support export. + * SoObjects/Appointments/SOGoAppointmentFolder.m (importComponent): Added to + support import. + * UI/Scheduler/UIxCalView.m (importAction): Added to support import. 2009-08-27 Wolfgang Sourdeau diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.h b/SoObjects/Appointments/SOGoAppointmentFolder.h index 383a615c4..9bec32fea 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.h +++ b/SoObjects/Appointments/SOGoAppointmentFolder.h @@ -144,6 +144,8 @@ - (NSException *) setProxySubscribers: (NSArray *) newSubscribers withWriteAccess: (BOOL) hasWriteAccess; +- (void) importComponent: (iCalEntityObject *) event; + @end #endif /* __Appointments_SOGoAppointmentFolder_H__ */ diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index c6b439a13..3538e5d00 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -3173,4 +3173,20 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir return error; } +- (void) importComponent: (iCalEntityObject *) event +{ + SOGoAppointmentObject *object; + NSString *uid; + NSString *content; + + uid = [self globallyUniqueObjectId]; + [event setUid: uid]; + object = [SOGoAppointmentObject objectWithName: uid + inContainer: self]; + content = + [NSString stringWithFormat: @"BEGIN:VCALENDAR\n%@END:VCALENDAR\n", + [event versitString]]; + [object saveContentString: content]; +} + @end /* SOGoAppointmentFolder */ diff --git a/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings b/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings index 3df91c025..2ab4030cf 100644 --- a/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings +++ b/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings @@ -105,6 +105,9 @@ "Delete Calendar" = "Apagar Calendário"; "Sharing..." = "Compartilhamento..."; "Export Calendar..." = "Exportar Calendário..."; +"Import Events..." = "Import Events..."; +"Select file..." = "Select file..."; +"Upload" = "Upload"; "Publish Calendar..." = "Publicar Calendário..."; "Reload Remote Calendars" = "Recarregar Calendários Remotos"; "Properties" = "Propriedades"; diff --git a/UI/Scheduler/Czech.lproj/Localizable.strings b/UI/Scheduler/Czech.lproj/Localizable.strings index 3239600a8..d226ba3fa 100644 --- a/UI/Scheduler/Czech.lproj/Localizable.strings +++ b/UI/Scheduler/Czech.lproj/Localizable.strings @@ -105,6 +105,9 @@ "Delete Calendar" = "Smazat kalendář"; "Sharing..." = "Sdílení..."; "Export Calendar..." = "Exportovat kalendář..."; +"Import Events..." = "Import Events..."; +"Select file..." = "Select file..."; +"Upload" = "Upload"; "Publish Calendar..." = "Publikovat kalendář..."; "Reload Remote Calendars" = "Nahrát vzdálené kalendáře"; "Properties" = "Vlastnosti"; diff --git a/UI/Scheduler/Dutch.lproj/Localizable.strings b/UI/Scheduler/Dutch.lproj/Localizable.strings index 7e97dee3d..40fef0f93 100644 --- a/UI/Scheduler/Dutch.lproj/Localizable.strings +++ b/UI/Scheduler/Dutch.lproj/Localizable.strings @@ -105,6 +105,9 @@ "Delete Calendar" = "Agenda verwijderen"; "Sharing..." = "Delen..."; "Export Calendar..." = "Agenda exporteren..."; +"Import Events..." = "Import Events..."; +"Select file..." = "Select file..."; +"Upload" = "Upload"; "Publish Calendar..." = "Agenda publiceren..."; "Reload Remote Calendars" = "Externe agenda vernieuwen"; "Properties" = "Instellingen"; diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index 0c1be8105..b782bc10a 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -105,6 +105,9 @@ "Delete Calendar" = "Delete Calendar"; "Sharing..." = "Sharing..."; "Export Calendar..." = "Export Calendar..."; +"Import Events..." = "Import Events..."; +"Select file..." = "Select file..."; +"Upload" = "Upload"; "Publish Calendar..." = "Publish Calendar..."; "Reload Remote Calendars" = "Reload Remote Calendars"; "Properties" = "Properties"; diff --git a/UI/Scheduler/French.lproj/Localizable.strings b/UI/Scheduler/French.lproj/Localizable.strings index ff677d60a..b9c6ae2db 100644 --- a/UI/Scheduler/French.lproj/Localizable.strings +++ b/UI/Scheduler/French.lproj/Localizable.strings @@ -105,6 +105,9 @@ "Delete Calendar" = "Effacer l'agenda"; "Sharing..." = "Partage..."; "Export Calendar..." = "Exporter l'agenda..."; +"Import Events..." = "Importer des événements..."; +"Select file..." = "Sélectionner un fichier..."; +"Upload" = "Ajouter"; "Publish Calendar..." = "Publier l'agenda..."; "Reload Remote Calendars" = "Recharger les agendas distants"; "Properties" = "Propriétés"; diff --git a/UI/Scheduler/German.lproj/Localizable.strings b/UI/Scheduler/German.lproj/Localizable.strings index bf877067d..6fa49c57c 100644 --- a/UI/Scheduler/German.lproj/Localizable.strings +++ b/UI/Scheduler/German.lproj/Localizable.strings @@ -105,6 +105,9 @@ "Delete Calendar" = "Kalender löschen"; "Sharing..." = "Benutzerrechte..."; "Export Calendar..." = "Kalender exportieren..."; +"Import Events..." = "Import Events..."; +"Select file..." = "Select file..."; +"Upload" = "Upload"; "Publish Calendar..." = "Kalender publizieren..."; "Reload Remote Calendars" = "Externe Kalender neu laden"; "Properties" = "Einstellungen"; diff --git a/UI/Scheduler/Hungarian.lproj/Localizable.strings b/UI/Scheduler/Hungarian.lproj/Localizable.strings index 3b005fb6c..60feff351 100644 --- a/UI/Scheduler/Hungarian.lproj/Localizable.strings +++ b/UI/Scheduler/Hungarian.lproj/Localizable.strings @@ -105,6 +105,9 @@ "Delete Calendar" = "Naptár törlése"; "Sharing..." = "Megosztás..."; "Export Calendar..." = "Naptár exportálása..."; +"Import Events..." = "Import Events..."; +"Select file..." = "Select file..."; +"Upload" = "Upload"; "Publish Calendar..." = "Naptár közzététele..."; "Reload Remote Calendars" = "Távoli naptárak frissítése"; "Properties" = "Tulajdonságok"; diff --git a/UI/Scheduler/Italian.lproj/Localizable.strings b/UI/Scheduler/Italian.lproj/Localizable.strings index 537f4dad3..049383646 100644 --- a/UI/Scheduler/Italian.lproj/Localizable.strings +++ b/UI/Scheduler/Italian.lproj/Localizable.strings @@ -105,6 +105,9 @@ "Delete Calendar" = "Rimuovi calendario..."; "Sharing..." = "Condivisione"; "Export Calendar..." = "Esporta calendario..."; +"Import Events..." = "Import Events..."; +"Select file..." = "Select file..."; +"Upload" = "Upload"; "Publish Calendar..." = "Pubblica calendario..."; "Reload Remote Calendars" = "Aggiorna calendari remoti"; "Properties" = "Proprietà"; diff --git a/UI/Scheduler/Russian.lproj/Localizable.strings b/UI/Scheduler/Russian.lproj/Localizable.strings index cfab7d06e..97c4522c9 100644 --- a/UI/Scheduler/Russian.lproj/Localizable.strings +++ b/UI/Scheduler/Russian.lproj/Localizable.strings @@ -105,6 +105,9 @@ "Delete Calendar" = "Удалить календарь"; "Sharing..." = "Sharing..."; "Export Calendar..." = "Экспортировать календарь..."; +"Import Events..." = "Import Events..."; +"Select file..." = "Select file..."; +"Upload" = "Upload"; "Publish Calendar..." = "Опубликовать календарь..."; "Reload Remote Calendars" = "Обновить удаленные календари"; "Properties" = "Свойства"; diff --git a/UI/Scheduler/Spanish.lproj/Localizable.strings b/UI/Scheduler/Spanish.lproj/Localizable.strings index 7ded3c134..98fc2f3a6 100644 --- a/UI/Scheduler/Spanish.lproj/Localizable.strings +++ b/UI/Scheduler/Spanish.lproj/Localizable.strings @@ -105,6 +105,9 @@ "Delete Calendar" = "Borrar calendario"; "Sharing..." = "Compartir..."; "Export Calendar..." = "Exportar calendario..."; +"Import Events..." = "Import Events..."; +"Select file..." = "Select file..."; +"Upload" = "Upload"; "Publish Calendar..." = "Publicar calendario..."; "Reload Remote Calendars" = "Recargar calendarios remotos"; "Properties" = "Propiedades"; diff --git a/UI/Scheduler/UIxCalView.m b/UI/Scheduler/UIxCalView.m index ad51a23f6..7d91c6e30 100644 --- a/UI/Scheduler/UIxCalView.m +++ b/UI/Scheduler/UIxCalView.m @@ -23,6 +23,7 @@ #import #import #import +#import #import #import #import @@ -693,5 +694,49 @@ static BOOL shouldDisplayWeekend = NO; return response; } +- (WOResponse *) importAction +{ + SOGoAppointmentFolder *folder; + NSArray *components; + WORequest *request; + NSString *fileContent; + NSData *data; + iCalCalendar *additions; + int i, count; + + request = [context request]; + folder = [self clientObject]; + data = (NSData *)[request formValueForKey: @"calendarFile"]; + fileContent = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]; + [fileContent autorelease]; + + if (fileContent && [fileContent length]) + { + NSLog (@"FILE: %@", fileContent); + additions = [iCalCalendar parseSingleFromSource: fileContent]; + if (additions) + { + NSLog (@"Events: %d", [[additions events] count]); + + components = [additions events]; + count = [components count]; + for (i = 0; i < count; i++) + [folder importComponent: [components objectAtIndex: i]]; + components = [additions todos]; + count = [components count]; + for (i = 0; i < count; i++) + [folder importComponent: [components objectAtIndex: i]]; + components = [additions journals]; + count = [components count]; + for (i = 0; i < count; i++) + [folder importComponent: [components objectAtIndex: i]]; + components = [additions freeBusys]; + count = [components count]; + for (i = 0; i < count; i++) + [folder importComponent: [components objectAtIndex: i]]; + } + } + return [self redirectToLocation: @"../view"]; +} @end /* UIxCalView */ diff --git a/UI/Scheduler/Welsh.lproj/Localizable.strings b/UI/Scheduler/Welsh.lproj/Localizable.strings index 820831fbf..7ecd7d081 100644 --- a/UI/Scheduler/Welsh.lproj/Localizable.strings +++ b/UI/Scheduler/Welsh.lproj/Localizable.strings @@ -105,6 +105,9 @@ "Delete Calendar" = "Dileu Calendar"; "Sharing..." = "Rhannu..."; "Export Calendar..." = "Allfudo Calendr..."; +"Import Events..." = "Import Events..."; +"Select file..." = "Select file..."; +"Upload" = "Upload"; "Publish Calendar..." = "Cyhoeddi Calendr..."; "Reload Remote Calendars" = "Ail-lwytho Calendrau Anghysbell"; "Properties" = "Dewisiadau"; diff --git a/UI/Scheduler/product.plist b/UI/Scheduler/product.plist index db6634a6d..bc4239256 100644 --- a/UI/Scheduler/product.plist +++ b/UI/Scheduler/product.plist @@ -153,6 +153,11 @@ protectedBy = "View"; pageName = "UIxCalView"; actionName = "export"; + }; + import = { + protectedBy = "View"; + pageName = "UIxCalView"; + actionName = "import"; }; userRights = { protectedBy = "ReadAcls"; diff --git a/UI/Templates/SchedulerUI/UIxCalMainView.wox b/UI/Templates/SchedulerUI/UIxCalMainView.wox index 3275ed9ac..d7926285f 100644 --- a/UI/Templates/SchedulerUI/UIxCalMainView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMainView.wox @@ -80,6 +80,7 @@
  • +
  • @@ -88,7 +89,7 @@ -