From acdce07ee0c69904b29d8ce2f4ac7d57aae20ae9 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 25 Aug 2008 19:13:18 +0000 Subject: [PATCH] Monotone-Parent: 38a512204cb4c49fbc144379e8587aaea3394a3a Monotone-Revision: 62820f08c88e6bd9bf5b0d9c61b83fb3d1a337e8 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2008-08-25T19:13:18 Monotone-Branch: ca.inverse.sogo --- UI/Contacts/UIxContactEditor.m | 2 +- UI/Scheduler/UIxAppointmentEditor.m | 21 ++++++++++++++----- UI/Scheduler/UIxCalendarSelector.m | 7 +------ UI/Scheduler/UIxTaskEditor.m | 16 ++++++++++++-- UI/Scheduler/product.plist | 4 ++-- .../SchedulerUI/UIxCalendarSelector.wox | 2 +- UI/WebServerResources/SchedulerUI.js | 9 +------- 7 files changed, 36 insertions(+), 25 deletions(-) diff --git a/UI/Contacts/UIxContactEditor.m b/UI/Contacts/UIxContactEditor.m index 22adabff2..ef2894aca 100644 --- a/UI/Contacts/UIxContactEditor.m +++ b/UI/Contacts/UIxContactEditor.m @@ -622,7 +622,7 @@ if (![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles onObject: componentAddressBook inContext: context]) - ex = [contact moveToFolder: componentAddressBook]; + ex = [contact moveToFolder: componentAddressBook]; // TODO: handle exception } } diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index c844ddd81..513025b05 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -227,13 +227,25 @@ NSString *objectId, *method, *uri; id result; SOGoAppointmentFolder *co; + SoSecurityManager *sm; co = [self clientObject]; objectId = [co globallyUniqueObjectId]; if ([objectId length]) { - method = [NSString stringWithFormat:@"%@/%@.ics/editAsAppointment", - [co soURL], objectId]; + sm = [SoSecurityManager sharedSecurityManager]; + if (![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles + onObject: co + inContext: context]) + { + method = [NSString stringWithFormat:@"%@/%@.ics/editAsAppointment", + [co soURL], objectId]; + } + else + { + method = [NSString stringWithFormat: @"%@/Calendar/personal/%@.vcf/editAsAppointment", + [self userFolderPath], objectId]; + } uri = [self completeHrefForMethod: method]; result = [self redirectToLocation: uri]; } @@ -246,8 +258,7 @@ - (id ) saveAction { - SOGoAppointmentFolder *thisFolder, *newFolder; - SOGoAppointmentFolders *parentFolder; + SOGoAppointmentFolder *thisFolder; SOGoAppointmentObject *co; SoSecurityManager *sm; NSException *ex; @@ -268,7 +279,7 @@ if (![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles onObject: componentCalendar inContext: context]) - ex = [co moveToFolder: componentCalendar]; + ex = [co moveToFolder: componentCalendar]; // TODO: handle exception } } diff --git a/UI/Scheduler/UIxCalendarSelector.m b/UI/Scheduler/UIxCalendarSelector.m index a4ec65ef3..25e3c8d61 100644 --- a/UI/Scheduler/UIxCalendarSelector.m +++ b/UI/Scheduler/UIxCalendarSelector.m @@ -87,26 +87,23 @@ _intValueFromHex (NSString *hexString) - (NSArray *) calendars { - NSArray *folders, *roles; + NSArray *folders; SOGoAppointmentFolders *co; SOGoAppointmentFolder *folder; NSMutableDictionary *calendar; unsigned int count, max; NSString *folderName, *fDisplayName; NSNumber *isActive; - SOGoUser *user; if (!calendars) { co = [self clientObject]; - user = [[self context] activeUser]; folders = [co subFolders]; max = [folders count]; calendars = [[NSMutableArray alloc] initWithCapacity: max]; for (count = 0; count < max; count++) { folder = [folders objectAtIndex: count]; - roles = [user rolesForObject: folder inContext: [self context]]; calendar = [NSMutableDictionary dictionary]; folderName = [folder nameInContainer]; fDisplayName = [folder displayName]; @@ -121,8 +118,6 @@ _intValueFromHex (NSString *hexString) [calendar setObject: isActive forKey: @"active"]; [calendar setObject: [folder ownerInContext: context] forKey: @"owner"]; - [calendar setObject: [roles componentsJoinedByString: @","] - forKey: @"roles"]; [calendars addObject: calendar]; } } diff --git a/UI/Scheduler/UIxTaskEditor.m b/UI/Scheduler/UIxTaskEditor.m index 71632e451..09b4b5d8e 100644 --- a/UI/Scheduler/UIxTaskEditor.m +++ b/UI/Scheduler/UIxTaskEditor.m @@ -299,13 +299,25 @@ NSString *objectId, *method, *uri; id result; SOGoAppointmentFolder *co; + SoSecurityManager *sm; co = [self clientObject]; objectId = [co globallyUniqueObjectId]; if ([objectId length] > 0) { - method = [NSString stringWithFormat:@"%@/%@.ics/editAsTask", - [co soURL], objectId]; + sm = [SoSecurityManager sharedSecurityManager]; + if (![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles + onObject: co + inContext: context]) + { + method = [NSString stringWithFormat:@"%@/%@.ics/editAsTask", + [co soURL], objectId]; + } + else + { + method = [NSString stringWithFormat: @"%@/Calendar/personal/%@.vcf/editAsTask", + [self userFolderPath], objectId]; + } uri = [self completeHrefForMethod: method]; result = [self redirectToLocation: uri]; } diff --git a/UI/Scheduler/product.plist b/UI/Scheduler/product.plist index ef7eab304..c58f5a70c 100644 --- a/UI/Scheduler/product.plist +++ b/UI/Scheduler/product.plist @@ -149,12 +149,12 @@ actionName = "saveUserRights"; }; newevent = { - protectedBy = "Add Documents, Images, and Files"; + protectedBy = ""; pageName = "UIxAppointmentEditor"; actionName = "new"; }; newtask = { - protectedBy = "Add Documents, Images, and Files"; + protectedBy = ""; pageName = "UIxTaskEditor"; actionName = "new"; }; diff --git a/UI/Templates/SchedulerUI/UIxCalendarSelector.wox b/UI/Templates/SchedulerUI/UIxCalendarSelector.wox index 245f7a8f3..de60479ad 100644 --- a/UI/Templates/SchedulerUI/UIxCalendarSelector.wox +++ b/UI/Templates/SchedulerUI/UIxCalendarSelector.wox @@ -32,7 +32,7 @@ div.colorBox.calendarFolder
  • + var:owner="currentCalendar.owner" > diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 9b464ab49..0c7868c7f 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -31,13 +31,6 @@ function newEvent(sender, type) { var hour = sender.readAttribute("hour"); var folder = getSelectedFolder(); var folderID = folder.readAttribute("id"); - var roles = folder.readAttribute("roles"); - if (roles) { - roles = roles.split(",") - if ($(roles).indexOf("Owner") < 0 && - $(roles).indexOf("PublicModifier") < 0) - folderID = "/personal"; - } var urlstr = ApplicationBaseURL + folderID + "/new" + type; var params = []; if (day) @@ -45,7 +38,7 @@ function newEvent(sender, type) { if (hour) params.push("hm=" + hour); if (params.length > 0) - urlstr += "?" + params.join("&"); log("newEvent: " + urlstr); + urlstr += "?" + params.join("&"); window.open(urlstr, "", "width=490,height=470,resizable=0"); return false; /* stop following the link */