From 39a545ffedc8b03efdfe1e0078a078a742796987 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 9 Dec 2011 14:47:39 +0000 Subject: [PATCH 1/6] Monotone-Parent: 18957933ff736ec180d169de7fd49cb3822d876b Monotone-Revision: 3d1fc008307ae248946dc870848b9b73d180f2b6 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-12-09T14:47:39 --- ChangeLog | 5 +++++ UI/WebServerResources/generic.js | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3efe0f5d3..f549cd2db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-12-09 Wolfgang Sourdeau + + * UI/WebServerResources/generic.js (parent$): handle the case + where window.opener is null. + 2011-12-06 Francis Lachapelle * UI/WebServerResources/ContactsUI.js (contactsListCallback): diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index b6c89d514..34de68a60 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -868,7 +868,7 @@ function log(message) { try { if (window.frameElement && window.frameElement.id) { logWindow = parent.window; - while (logWindow.frameElement && window.frameElement.id) + while (logWindow.frameElement && window.frameElement.id) logWindow = logWindow.parent.window; } else { @@ -1029,7 +1029,7 @@ function setSearchCriteria(event) { if (searchValue.ghostPhrase == searchValue.value) searchValue.value = ""; - + searchValue.ghostPhrase = this.innerHTML; searchCriteria.value = this.getAttribute('id'); @@ -1797,10 +1797,12 @@ function parent$(element) { if (div) p = parent.document; - else + else if (this.opener) p = this.opener.document; + else + p = null; - return p.getElementById(element); + return (p ? p.getElementById(element) : null); } /* stubs */ From 74c40e89590545bca6c88b0ccd49e32ef63f9836 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 9 Dec 2011 14:50:01 +0000 Subject: [PATCH 2/6] Monotone-Parent: 3d1fc008307ae248946dc870848b9b73d180f2b6 Monotone-Revision: 6c3c7e3510ce901c142883d3a80602befbb04934 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-12-09T14:50:01 --- UI/Common/UIxToolbar.m | 18 ++++++++++++++++++ UI/Templates/UIxToolbar.wox | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) 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/Templates/UIxToolbar.wox b/UI/Templates/UIxToolbar.wox index a56464a11..04efd3d0f 100644 --- a/UI/Templates/UIxToolbar.wox +++ b/UI/Templates/UIxToolbar.wox @@ -10,7 +10,7 @@ Date: Fri, 9 Dec 2011 14:52:47 +0000 Subject: [PATCH 3/6] Monotone-Parent: 6c3c7e3510ce901c142883d3a80602befbb04934 Monotone-Revision: 7032e083cacc1fa5cf4ee9c191a47cb9be17f0f4 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-12-09T14:52:47 --- UI/WebServerResources/UIxPreferences.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UI/WebServerResources/UIxPreferences.js b/UI/WebServerResources/UIxPreferences.js index 2da643202..1fb54bad4 100644 --- a/UI/WebServerResources/UIxPreferences.js +++ b/UI/WebServerResources/UIxPreferences.js @@ -95,7 +95,7 @@ function prototypeIfyFilters() { function _setupEvents() { var widgets = [ "timezone", "shortDateFormat", "longDateFormat", "timeFormat", "weekStartDay", "dayStartTime", "dayEndTime", - "firstWeek", "messageCheck", "sortByThreads", + "firstWeek", "messageCheck", "sortByThreads", "subscribedFoldersOnly", "language", "defaultCalendar", "enableVacation" ]; for (var i = 0; i < widgets.length; i++) { @@ -110,7 +110,7 @@ function _setupEvents() { // might not be present if ModulesConstraints disable those elements if ($("replyPlacementList")) $("replyPlacementList").observe ("change", onReplyPlacementListChange); - + if ($("composeMessagesType")) $("composeMessagesType").observe ("change", onComposeMessagesTypeChange); @@ -781,14 +781,14 @@ function saveMailAccounts() { /* This removal enables us to avoid a few warning from SOPE for the inputs that were created dynamically. */ var editor = $("mailAccountEditor"); - + // Could be null if ModuleConstraints disables email access if (editor) editor.parentNode.removeChild(editor); compactMailAccounts(); var mailAccountsJSON = $("mailAccountsJSON"); - + if (mailAccountsJSON) mailAccountsJSON.value = Object.toJSON(mailAccounts); } From 1918939a8c3fb8d453e9fdfe4be99d996cf2053e Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 9 Dec 2011 14:53:09 +0000 Subject: [PATCH 4/6] Monotone-Parent: 7032e083cacc1fa5cf4ee9c191a47cb9be17f0f4 Monotone-Revision: 8641791497cbe0e199fc4b68731683dd533ce48e Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-12-09T14:53:09 --- ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index f549cd2db..f51218421 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 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. From 7ec440bbc1598008ad22d441acb1a9f2a7f36e38 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 9 Dec 2011 14:53:44 +0000 Subject: [PATCH 5/6] 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; From bb5cf04e7e502fce0a7b4e35a9a8d29c5bd2020a Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 9 Dec 2011 14:54:00 +0000 Subject: [PATCH 6/6] Monotone-Parent: 8d583d2e8977d0d63e028818f6f961246d256bdd Monotone-Revision: 8c58bbcc380816930dac5d8da2d1d682049a6349 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-12-09T14:54:00 --- UI/Templates/PreferencesUI/UIxPreferences.wox | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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 @@
  • - +
  • + > +
  • +
  • - +
    - +