From 7ec440bbc1598008ad22d441acb1a9f2a7f36e38 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 9 Dec 2011 14:53:44 +0000 Subject: [PATCH] Monotone-Parent: 8641791497cbe0e199fc4b68731683dd533ce48e Monotone-Revision: 8d583d2e8977d0d63e028818f6f961246d256bdd Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-12-09T14:53:44 --- UI/Common/UIxPageFrame.m | 18 -------- UI/SOGoUI/UIxComponent.h | 6 +++ UI/SOGoUI/UIxComponent.m | 39 ++++++++++++++++++ UI/Templates/UIxPageFrame.wox | 78 +++++++++++++++++++++-------------- 4 files changed, 92 insertions(+), 49 deletions(-) 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/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/UIxPageFrame.wox b/UI/Templates/UIxPageFrame.wox index 2943db290..7f245037b 100644 --- a/UI/Templates/UIxPageFrame.wox +++ b/UI/Templates/UIxPageFrame.wox @@ -38,6 +38,16 @@ + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - + + + - @@ -136,6 +146,12 @@ var IsSuperUser = false; + var IsCalendarEnabled = truefalse; + var IsAddressBookEnabled = truefalse; + var IsMailEnabled = truefalse; var usesCASAuthentication = true;