From a1bda982f225ea7f0f1046c1aa29a06400944e6a Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 22 Aug 2008 06:44:27 +0000 Subject: [PATCH] Monotone-Parent: f36908690fb1287e17d7bb0eb4155ddc4c6f6a55 Monotone-Revision: 3ea5e4c3ab43c68fb675c5144a1c3378da620a48 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2008-08-22T06:44:27 Monotone-Branch: ca.inverse.sogo --- UI/Contacts/UIxContactEditor.h | 1 + UI/Contacts/UIxContactEditor.m | 22 +++++++++++ UI/Scheduler/UIxAppointmentEditor.h | 1 + UI/Scheduler/UIxAppointmentEditor.m | 37 +++++++++++-------- UI/Scheduler/UIxComponentEditor.h | 8 ++++ UI/Scheduler/UIxComponentEditor.m | 16 +++++--- .../SchedulerUI/UIxAppointmentEditor.wox | 1 + UI/WebServerResources/ContactsUI.css | 1 + UI/WebServerResources/UIxContactEditor.css | 2 +- 9 files changed, 66 insertions(+), 23 deletions(-) diff --git a/UI/Contacts/UIxContactEditor.h b/UI/Contacts/UIxContactEditor.h index c39196bea..0d6269818 100644 --- a/UI/Contacts/UIxContactEditor.h +++ b/UI/Contacts/UIxContactEditor.h @@ -38,6 +38,7 @@ NSString *item; NGVCard *card; NSMutableDictionary *snapshot; /* contains the values for editing */ + SOGoContactFolder *componentAddressBook; } - (void) setAddressBookItem: (id) _item; diff --git a/UI/Contacts/UIxContactEditor.m b/UI/Contacts/UIxContactEditor.m index 1b5989c22..f6451d069 100644 --- a/UI/Contacts/UIxContactEditor.m +++ b/UI/Contacts/UIxContactEditor.m @@ -204,6 +204,12 @@ return folder; } +- (void) setComponentAddressBook: (SOGoContactFolder *) _componentAddressBook +{ + ASSIGN (componentAddressBook, _componentAddressBook); +} + + - (NSString *) addressBookDisplayName { NSString *fDisplayName; @@ -595,6 +601,8 @@ SOGoContactGCSEntry *contact; id result; NSString *jsRefreshMethod; + SoSecurityManager *sm; + NSException *ex; contact = [self clientObject]; card = [contact vCard]; @@ -604,6 +612,20 @@ [self _saveSnapshot]; [contact save]; + if (componentAddressBook && componentAddressBook != [self componentAddressBook]) + { + sm = [SoSecurityManager sharedSecurityManager]; + if (![sm validatePermission: SoPerm_DeleteObjects + onObject: componentAddressBook + inContext: context]) + { + if (![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles + onObject: componentAddressBook + inContext: context]) + ex = [contact moveToFolder: componentAddressBook]; + } + } + if ([[[[self context] request] formValueForKey: @"nojs"] intValue]) result = [self redirectToLocation: [self applicationPath]]; else diff --git a/UI/Scheduler/UIxAppointmentEditor.h b/UI/Scheduler/UIxAppointmentEditor.h index fba6ed39b..75c5315ee 100644 --- a/UI/Scheduler/UIxAppointmentEditor.h +++ b/UI/Scheduler/UIxAppointmentEditor.h @@ -31,6 +31,7 @@ @interface UIxAppointmentEditor : UIxComponent { iCalEvent *event; + SOGoAppointmentFolder *componentCalendar; BOOL isAllDay; NSCalendarDate *aptStartDate; NSCalendarDate *aptEndDate; diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index e4d2277e4..c844ddd81 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -138,6 +138,16 @@ return item; } +- (SOGoAppointmentFolder *) componentCalendar +{ + return componentCalendar; +} + +- (void) setComponentCalendar: (SOGoAppointmentFolder *) _componentCalendar +{ + ASSIGN (componentCalendar, _componentCalendar); +} + /* actions */ - (NSCalendarDate *) newStartDate { @@ -236,7 +246,6 @@ - (id ) saveAction { - NSString *newCalendar; SOGoAppointmentFolder *thisFolder, *newFolder; SOGoAppointmentFolders *parentFolder; SOGoAppointmentObject *co; @@ -246,25 +255,21 @@ co = [self clientObject]; [co saveComponent: event]; - newCalendar = [self queryParameterForKey: @"moveToCalendar"]; - if ([newCalendar length]) + if (componentCalendar) { sm = [SoSecurityManager sharedSecurityManager]; thisFolder = [co container]; - if (![sm validatePermission: SoPerm_DeleteObjects - onObject: thisFolder - inContext: context]) - { - parentFolder = [[self container] container]; - newFolder = [[thisFolder container] lookupName: newCalendar - inContext: context - acquire: NO]; - if (![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles - onObject: newFolder - inContext: context]) - ex = [co moveToFolder: newFolder]; - } + if (componentCalendar != thisFolder) + if (![sm validatePermission: SoPerm_DeleteObjects + onObject: thisFolder + inContext: context]) + { + if (![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles + onObject: componentCalendar + inContext: context]) + ex = [co moveToFolder: componentCalendar]; + } } return [self jsCloseWithRefreshMethod: @"refreshEventsAndDisplay()"]; diff --git a/UI/Scheduler/UIxComponentEditor.h b/UI/Scheduler/UIxComponentEditor.h index 55bf57396..c6b822c97 100644 --- a/UI/Scheduler/UIxComponentEditor.h +++ b/UI/Scheduler/UIxComponentEditor.h @@ -48,6 +48,7 @@ NSCalendarDate *cycleUntilDate; NSString *title; NSString *location; + SOGoAppointmentFolder *componentCalendar; NSString *comment; NSString *url; NSString *priority; @@ -93,6 +94,13 @@ - (SOGoAppointmentFolder *) componentCalendar; +- (NSArray *) calendarList; +- (NSString *) calendarsFoldersList; +- (NSString *) calendarDisplayName; + +- (SOGoAppointmentFolder *) componentCalendar; +- (void) setComponentCalendar: (SOGoAppointmentFolder *) _componentCalendar; + - (NSArray *) categoryList; - (void) setCategories: (NSArray *) _categories; - (NSArray *) categories; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index c42ee6548..c2bbf5791 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -375,6 +375,10 @@ iRANGE(2); [self _loadCategories]; [self _loadAttendees]; [self _loadRRules]; + + componentCalendar = [co container]; + if ([componentCalendar isKindOfClass: [SOGoCalendarComponent class]]) + componentCalendar = [componentCalendar container]; } } // /* cycles */ @@ -821,15 +825,15 @@ iRANGE(2); return [calendars componentsJoinedByString: @","]; } + - (SOGoAppointmentFolder *) componentCalendar { - SOGoAppointmentFolder *calendar; + return componentCalendar; +} - calendar = [[self clientObject] container]; - if ([calendar isKindOfClass: [SOGoCalendarComponent class]]) - calendar = [calendar container]; - - return calendar; +- (void) setComponentCalendar: (SOGoAppointmentFolder *) _componentCalendar +{ + ASSIGN (componentCalendar, _componentCalendar); } /* priorities */ diff --git a/UI/Templates/SchedulerUI/UIxAppointmentEditor.wox b/UI/Templates/SchedulerUI/UIxAppointmentEditor.wox index 342634679..b3c6c5cc7 100644 --- a/UI/Templates/SchedulerUI/UIxAppointmentEditor.wox +++ b/UI/Templates/SchedulerUI/UIxAppointmentEditor.wox @@ -8,6 +8,7 @@ xmlns:rsrc="OGo:url" xmlns:label="OGo:label" className="UIxComponentEditor" + componentCalendar="componentCalendar" var:component="event" var:saveURL="saveURL"> diff --git a/UI/WebServerResources/ContactsUI.css b/UI/WebServerResources/ContactsUI.css index e0781aa74..83a20b711 100644 --- a/UI/WebServerResources/ContactsUI.css +++ b/UI/WebServerResources/ContactsUI.css @@ -198,6 +198,7 @@ TABLE#contactsList TD, TABLE#contactsList TH { overflow: hidden; line-height: 16px; + height: 18px; white-space: nowrap; } /* pre, normal, nowrap */ TABLE#contactsList TH diff --git a/UI/WebServerResources/UIxContactEditor.css b/UI/WebServerResources/UIxContactEditor.css index cd9c4160a..afe19f15b 100644 --- a/UI/WebServerResources/UIxContactEditor.css +++ b/UI/WebServerResources/UIxContactEditor.css @@ -2,7 +2,7 @@ DIV#addressBookSelector { margin: .5em; } DIV#addressBookSelector SELECT -{ width: auto; } +{ width: 32em; } DIV#editorTabs { position: absolute;