diff --git a/ChangeLog b/ChangeLog index 1deda3f7f..fd765e255 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2011-12-09 Wolfgang Sourdeau + + * UI/SOGoUI/UIxComponent.m (-isCalendarEnabled) + (-isContactsEnabled, -isMailEnabled, -isPreferencesEnabled): new + accessors. + (-userHasCalendarAccess, -userHasMailAccess): moved from UIxPageFrame. + + * UI/Common/UIxToolbar.m (-cssClasses): new accessor that + generates the CSS classes dynamically depending on the button + state and it descriptor's cssClass. + + * UI/WebServerResources/generic.js (parent$): handle the case + where window.opener is null. + 2011-12-08 Wolfgang Sourdeau * OpenChange/MAPIStoreFSMessageTable.m diff --git a/UI/Common/UIxPageFrame.m b/UI/Common/UIxPageFrame.m index 68ddb1ee5..ee990ad73 100644 --- a/UI/Common/UIxPageFrame.m +++ b/UI/Common/UIxPageFrame.m @@ -479,24 +479,6 @@ return canLogoff; } -- (BOOL) userHasCalendarAccess -{ - SOGoUser *user; - - user = [context activeUser]; - - return [user canAccessModule: @"Calendar"]; -} - -- (BOOL) userHasMailAccess -{ - SOGoUser *user; - - user = [context activeUser]; - - return [user canAccessModule: @"Mail"]; -} - - (NSString *) userLanguage { SOGoUserDefaults *ud; diff --git a/UI/Common/UIxToolbar.m b/UI/Common/UIxToolbar.m index e5878a5f1..c9cc5d866 100644 --- a/UI/Common/UIxToolbar.m +++ b/UI/Common/UIxToolbar.m @@ -227,6 +227,24 @@ return [[[[self context] page] valueForKeyPath:onOffKey] boolValue]; } +- (NSString *) cssClasses +{ + NSMutableArray *cssClasses; + NSString *infoClasses; + + cssClasses = [NSMutableArray arrayWithCapacity: 16]; + if ([self isButtonEnabled]) + [cssClasses addObject: @"toolbarButton"]; + else + [cssClasses addObject: @"disabledToolbarButton"]; + + infoClasses = [[self buttonInfo] objectForKey: @"cssClass"]; + if ([infoClasses length] > 0) + [cssClasses addObject: infoClasses]; + + return [cssClasses componentsJoinedByString: @" "]; +} + - (BOOL) isLastGroup { return ([toolbarConfig indexOfObject: toolbarGroup] == ([toolbarConfig count] - 1)); diff --git a/UI/SOGoUI/UIxComponent.h b/UI/SOGoUI/UIxComponent.h index c343773f2..05477b801 100644 --- a/UI/SOGoUI/UIxComponent.h +++ b/UI/SOGoUI/UIxComponent.h @@ -66,6 +66,12 @@ - (NSString *)ownPath; - (NSString *)relativePathToUserFolderSubPath:(NSString *)_sub; +/* module access */ +- (BOOL) isCalendarEnabled; +- (BOOL) isContactsEnabled; +- (BOOL) isMailEnabled; +- (BOOL) isPreferencesEnabled; + /* date selection */ - (NSCalendarDate *) selectedDate; diff --git a/UI/SOGoUI/UIxComponent.m b/UI/SOGoUI/UIxComponent.m index 473d2bf9a..ed2194008 100644 --- a/UI/SOGoUI/UIxComponent.m +++ b/UI/SOGoUI/UIxComponent.m @@ -465,6 +465,45 @@ static NSMutableArray *abbrMonthLabelKeys = nil; return result; } +- (BOOL) userHasCalendarAccess +{ + SOGoUser *user; + + user = [context activeUser]; + + return [user canAccessModule: @"Calendar"]; +} + +- (BOOL) userHasMailAccess +{ + SOGoUser *user; + + user = [context activeUser]; + + return [user canAccessModule: @"Mail"]; +} + +#warning we might want to refine the tests here... +- (BOOL) isCalendarEnabled +{ + return [self userHasCalendarAccess] && ![self singleWindowModeEnabled]; +} + +- (BOOL) isContactsEnabled +{ + return ![self singleWindowModeEnabled]; +} + +- (BOOL) isMailEnabled +{ + return [self userHasMailAccess]; +} + +- (BOOL) isPreferencesEnabled +{ + return ![self singleWindowModeEnabled]; +} + /* SoUser */ - (NSString *) shortUserNameForDisplay diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 2b3cce7e4..06d0771c1 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -20,13 +20,15 @@