mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-06-06 10:59:44 +00:00
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
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
2009-09-02 Cyril Robert <crobert@inverse.ca>
|
||||
|
||||
* 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 <wsourdeau@inverse.ca>
|
||||
|
||||
|
||||
@@ -144,6 +144,8 @@
|
||||
- (NSException *) setProxySubscribers: (NSArray *) newSubscribers
|
||||
withWriteAccess: (BOOL) hasWriteAccess;
|
||||
|
||||
- (void) importComponent: (iCalEntityObject *) event;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Appointments_SOGoAppointmentFolder_H__ */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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à";
|
||||
|
||||
@@ -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" = "Свойства";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#import <NGObjWeb/SoSecurityManager.h>
|
||||
#import <NGObjWeb/SoUser.h>
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGExtensions/NGCalendarDateRange.h>
|
||||
#import <NGExtensions/NSCalendarDate+misc.h>
|
||||
#import <NGExtensions/NSNull+misc.h>
|
||||
@@ -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 */
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -153,6 +153,11 @@
|
||||
protectedBy = "View";
|
||||
pageName = "UIxCalView";
|
||||
actionName = "export";
|
||||
};
|
||||
import = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxCalView";
|
||||
actionName = "import";
|
||||
};
|
||||
userRights = {
|
||||
protectedBy = "ReadAcls";
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><var:string label:value="Delete Calendar"/></li>
|
||||
<li><!-- separator --></li>
|
||||
<li><var:string label:value="Export Calendar..."/></li>
|
||||
<li><var:string label:value="Import Events..."/></li>
|
||||
<li><var:string label:value="Publish Calendar..."/></li>
|
||||
<li><!-- separator --></li>
|
||||
<li><var:string label:value="Reload Remote Calendars"/></li>
|
||||
@@ -88,7 +89,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="eventDialog" style="display: none;">
|
||||
<div id="eventDialog" style="display: none;" class="dialog">
|
||||
<div>
|
||||
<h1><!-- space --></h1>
|
||||
<p id="startTime"><span class="label"><var:string label:value="Start:" /></span> <span><!-- space --></span></p>
|
||||
@@ -97,6 +98,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="uploadDialog" style="display: none" class="dialog left">
|
||||
<div>
|
||||
<h3><var:string label:value="Select file..."/></h3>
|
||||
<form name="uploadForm" id="uploadForm" method="post"
|
||||
enctype="multipart/form-data"
|
||||
onsubmit="return validateUploadForm()">
|
||||
<p><input type="file" name="calendarFile" id="calendarFile" /></p>
|
||||
<p><input class="button" type="submit" const:id="uploadSubmit" label:value="Upload"/>
|
||||
<input class="button" type="button" const:id="uploadCancel" label:value="Cancel"/></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="leftPanel">
|
||||
<div class="tabsContainer" id="schedulerTabs">
|
||||
<ul>
|
||||
|
||||
@@ -291,39 +291,46 @@ TABLE#eventsList TH
|
||||
TABLE#eventsList TH
|
||||
{ white-space: pre; }
|
||||
|
||||
DIV#eventDialog
|
||||
DIV#uploadDialog
|
||||
{ border-width: 1px;
|
||||
width: 260px;
|
||||
height: 118px;
|
||||
}
|
||||
|
||||
DIV.dialog
|
||||
{ position: absolute;
|
||||
top: 100px;
|
||||
left: 75px;
|
||||
width: 200px;
|
||||
z-index: 50; }
|
||||
|
||||
DIV#eventDialog DIV
|
||||
DIV.dialog DIV
|
||||
{ border: 1px solid #444;
|
||||
/*height: 100px;*/
|
||||
background-color: #fff;
|
||||
padding: 5px; }
|
||||
|
||||
DIV#eventDialog.left
|
||||
DIV.dialog.left
|
||||
{ background-image: url("dialog-left.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: top left; }
|
||||
|
||||
DIV#eventDialog.left DIV
|
||||
DIV.dialog.left DIV
|
||||
{ border-left: 0;
|
||||
margin-left: 19px;
|
||||
text-align: left; }
|
||||
|
||||
DIV#eventDialog.right
|
||||
DIV.dialog.right
|
||||
{ background-image: url("dialog-right.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: top right; }
|
||||
|
||||
DIV#eventDialog.right DIV
|
||||
DIV.dialog.right DIV
|
||||
{ border-right: 0;
|
||||
margin-right: 19px;
|
||||
text-align: right; }
|
||||
|
||||
DIV#eventDialog
|
||||
{ width: 200px; }
|
||||
DIV#eventDialog H1,
|
||||
DIV#eventDialog P
|
||||
{ font-size: 10px;
|
||||
|
||||
@@ -1738,8 +1738,8 @@ function getMenus() {
|
||||
menus["calendarsMenu"] = new Array(onCalendarModify,
|
||||
"-",
|
||||
onCalendarNew, onCalendarRemove,
|
||||
"-", onCalendarExport, null, "-",
|
||||
null, "-", onMenuSharing);
|
||||
"-", onCalendarExport, onCalendarImport,
|
||||
null, "-", null, "-", onMenuSharing);
|
||||
menus["searchMenu"] = new Array(setSearchCriteria);
|
||||
|
||||
menus["tasksListMenu"] = new Array (editEvent, newTask, "-",
|
||||
@@ -1889,6 +1889,35 @@ function onCalendarExport(event) {
|
||||
}
|
||||
}
|
||||
|
||||
function onCalendarImport(event) {
|
||||
var node = $("calendarList").getSelectedNodes().first();
|
||||
var folderId = node.getAttribute("id");
|
||||
|
||||
var url = ApplicationBaseURL + folderId + "/import";
|
||||
$("uploadForm").action = url;
|
||||
$("uploadCancel").onclick = hideCalendarImport;
|
||||
$("calendarFile").value = "";
|
||||
|
||||
var cellPosition = node.cumulativeOffset();
|
||||
var cellDimensions = node.getDimensions();
|
||||
var left = cellDimensions['width'] - 20;
|
||||
var top = cellPosition[1];
|
||||
|
||||
var div = $("uploadDialog");
|
||||
div.style.top = top + "px";
|
||||
div.style.left = left + "px";
|
||||
div.style.display = "block";
|
||||
}
|
||||
function hideCalendarImport () {
|
||||
$("uploadDialog").style.display = "none";
|
||||
}
|
||||
function validateUploadForm () {
|
||||
rc = false;
|
||||
if ($("calendarFile").value.length)
|
||||
rc = true;
|
||||
return rc;
|
||||
}
|
||||
|
||||
function setEventsOnCalendar(checkBox, li) {
|
||||
li.observe("mousedown", listRowMouseDownHandler);
|
||||
li.observe("selectstart", listRowMouseDownHandler);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 456 B After Width: | Height: | Size: 2.8 KiB |
Reference in New Issue
Block a user