From: znek Date: Thu, 14 Jul 2005 09:46:51 +0000 (+0000) Subject: implemented homepage (almost done), removed 'schedule' tab X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=362774e19cb1303330e64e4197d0e2fd73aff184;p=scalable-opengroupware.org implemented homepage (almost done), removed 'schedule' tab git-svn-id: http://svn.opengroupware.org/SOGo/trunk@745 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/Main/ChangeLog b/SOGo/Main/ChangeLog index 4c5e846f..e9066962 100644 --- a/SOGo/Main/ChangeLog +++ b/SOGo/Main/ChangeLog @@ -1,3 +1,15 @@ +2005-07-14 Marcus Mueller + + * v0.9.31 + + * SOGoUserHomePage.[m, wox]: added internet access lock + display/modification and vacation state (currently only faked) + + * homepage.js: JavaScript in use on the homepage + + * English.lproj/Localizable.strings: removed old labels and added a + bunch of new labels + 2005-07-12 Helge Hess * v0.9.30 diff --git a/SOGo/Main/English.lproj/Localizable.strings b/SOGo/Main/English.lproj/Localizable.strings index 3ddf092e..8bd9c98b 100644 --- a/SOGo/Main/English.lproj/Localizable.strings +++ b/SOGo/Main/English.lproj/Localizable.strings @@ -1,5 +1,11 @@ /* this file is in UTF-8 format! */ -"Calendar" = "Calendar"; -"Addressbook" = "Addressbook"; -"Mail" = "Mail"; +"Homepage" = "Homepage"; + +"Internet access authorized and" = "Internet access authorized and"; +"internetAccessState_0" = "CLOSED"; +"internetAccessState_1" = "OPEN"; + +"Automatic vacation messages activation" = "Automatic vacation messages activation"; +"Internet" = "Internet"; +"Intranet" = "Intranet"; diff --git a/SOGo/Main/GNUmakefile b/SOGo/Main/GNUmakefile index e2134055..414e7f18 100644 --- a/SOGo/Main/GNUmakefile +++ b/SOGo/Main/GNUmakefile @@ -41,6 +41,8 @@ MainUI_RESOURCE_FILES += \ SOGoUserHomePage.wox \ SOGoGroupPage.wox \ SOGoGroupsPage.wox \ + \ + homepage.js \ MainUI_LOCALIZED_RESOURCE_FILES += \ Locale Localizable.strings diff --git a/SOGo/Main/SOGoUserHomePage.m b/SOGo/Main/SOGoUserHomePage.m index e3cdd016..e5e821dd 100644 --- a/SOGo/Main/SOGoUserHomePage.m +++ b/SOGo/Main/SOGoUserHomePage.m @@ -23,6 +23,7 @@ @interface SOGoUserHomePage : SoComponent { + id item; } - (NSString *)ownPath; @@ -35,10 +36,28 @@ @end +#include +#include "SOGoUser.h" #include "common.h" @implementation SOGoUserHomePage +static NSArray *internetAccessStates = nil; + ++ (void)initialize { + static BOOL didInit = NO; + + if (didInit) return; + didInit = YES; + + internetAccessStates = [[NSArray alloc] initWithObjects:@"0", @"1", nil]; +} + +- (void)dealloc { + [self->item release]; + [super dealloc]; +} + /* lookup */ - (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag { @@ -52,6 +71,42 @@ return nil; } +/* accessors */ + +- (void)setItem:(id)_item { + ASSIGN(self->item, _item); +} +- (id)item { + return self->item; +} + +- (NSArray *)internetAccessStates { + return internetAccessStates; +} + +- (NSString *)internetAccessState { + NSUserDefaults *ud; + NSNumber *value; + + ud = [[[self context] activeUser] userDefaults]; + value = [ud objectForKey:@"allowinternet"]; + return [NSString stringWithFormat:@"%d", [value boolValue]]; +} +- (void)setInternetAccessState:(NSString *)_internetAccessState { + NSUserDefaults *ud; + + ud = [[[self context] activeUser] userDefaults]; + [ud setObject:_internetAccessState forKey:@"allowinternet"]; + [ud synchronize]; +} + +- (NSString *)itemInternetAccessStateText { + NSString *key; + + key = [NSString stringWithFormat:@"internetAccessState_%@", self->item]; + return key; +} + /* paths */ - (NSString *)ownPath { @@ -100,10 +155,65 @@ return [self relativePathToUserFolderSubPath:@"Mail/"]; } +/* objects */ + +- (id)calendarFolder { + return [[self clientObject] lookupName:@"Calendar" + inContext:[self context] + acquire:NO]; +} + +/* checking access */ + +- (BOOL)canAccess { + WOContext *ctx; + NSString *owner; + + ctx = [self context]; + owner = [[self clientObject] ownerInContext:ctx]; + return [owner isEqualToString:[[ctx activeUser] login]]; +} + +- (BOOL)isNotAllowedToChangeInternetAccess { + AgenorUserManager *um; + WOContext *ctx; + NSString *uid; + + ctx = [self context]; + /* do not allow changes when access is from Internet */ + if (![ctx isAccessFromIntranet]) + return YES; + um = [AgenorUserManager sharedUserManager]; + uid = [[ctx activeUser] login]; + return [um isUserAllowedToChangeSOGoInternetAccess:uid] ? NO : YES; +} + +- (BOOL)isVacationMessageEnabledForInternet { + return NO; +} + +- (BOOL)isVacationMessageEnabledForIntranet { + return YES; +} + /* actions */ +#if 0 - (id)defaultAction { return [self redirectToLocation:[self relativeCalendarPath]]; } +#endif + +/* this is triggered by an XMLHTTPRequest */ +- (id)saveInternetAccessStateAction { + NSString *state; + + if ([self isNotAllowedToChangeInternetAccess]) + return [NSException exceptionWithHTTPStatus:403 /* Forbidden */]; + + state = [[[self context] request] formValueForKey:@"allowinternet"]; + [self setInternetAccessState:state]; + return [NSException exceptionWithHTTPStatus:200 /* OK */]; +} @end /* SOGoUserHomePage */ diff --git a/SOGo/Main/SOGoUserHomePage.wox b/SOGo/Main/SOGoUserHomePage.wox index 391f20f7..48501276 100644 --- a/SOGo/Main/SOGoUserHomePage.wox +++ b/SOGo/Main/SOGoUserHomePage.wox @@ -1,24 +1,107 @@ - -

- OpenGroupware.org: - -

- -
    -
  • -
  • -
  • -
+ + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + +
+
+

+ +
+ : + + + +

+

+ +

+
+ + + + + + + + + + + +
+
+ + + +
+ + +
+
+
+
diff --git a/SOGo/Main/Version b/SOGo/Main/Version index ce7ecb1f..708a90e8 100644 --- a/SOGo/Main/Version +++ b/SOGo/Main/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=30 +SUBMINOR_VERSION:=31 # v0.9.24 requires libWEExtensions v4.5.67 # v0.9.16 requires libNGExtensions v4.5.136 diff --git a/SOGo/Main/homepage.js b/SOGo/Main/homepage.js new file mode 100644 index 00000000..69057dd6 --- /dev/null +++ b/SOGo/Main/homepage.js @@ -0,0 +1,48 @@ +/* + Copyright (C) 2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + */ +/* JavaScript for SOGo Homepage */ + +function toggleInternetAccessState(sender) { +// var form = document.getElementById("syncDefaultsForm"); +// document.syncDefaultsForm.action="saveInternetAccessState:method"; +// form.submit(); + this.postInternetAccessState(sender, sender.value); + return true; +} + +function postInternetAccessState(sender, state) { + var url; + var http = createHTTPClient(); + + url = "edit?allowinternet=" + state; + + if (http) { + http.open("POST", url, false); + http.send(null); + if (http.status != 200) { + alert("Failed to change state: " + http.statusText); + window.opener.location.reload(); + } + } + else { + window.opener.location.href = url; + } +} diff --git a/SOGo/Main/product.plist b/SOGo/Main/product.plist index 1303d9b1..fb29d2e7 100644 --- a/SOGo/Main/product.plist +++ b/SOGo/Main/product.plist @@ -48,14 +48,21 @@ SOGoUserFolder = { superclass = "SOGoFolder"; methods = { - index = { + view = { + protectedBy = "View"; + pageName = "SOGoUserHomePage"; + }; + edit = { protectedBy = "View"; pageName = "SOGoUserHomePage"; + actionName = "saveInternetAccessState"; }; + /* GET = { // more or less a hack, see README of dbd protectedBy = "View"; pageName = "SOGoUserHomePage"; }; + */ }; }; diff --git a/SOGo/SoObjects/Appointments/ChangeLog b/SOGo/SoObjects/Appointments/ChangeLog index ef7e4c60..be5e9604 100644 --- a/SOGo/SoObjects/Appointments/ChangeLog +++ b/SOGo/SoObjects/Appointments/ChangeLog @@ -1,3 +1,8 @@ +2005-07-14 Marcus Mueller + + * SOGoAppointmentFolder.m: changed redirect from 'schedule' to + 'weekoverview' (v0.9.43) + 2005-07-14 Helge Hess * SOGoAppointmentFolder.m: moved +globallyUniqueObjectId method to diff --git a/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m b/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m index 3faab108..5e56bb75 100644 --- a/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -696,7 +696,7 @@ static NSTimeZone *MET = nil; uri = [[_ctx request] uri]; if (![uri hasSuffix:@"/"]) uri = [uri stringByAppendingString:@"/"]; - uri = [uri stringByAppendingString:@"schedule"]; + uri = [uri stringByAppendingString:@"weekoverview"]; r = [_ctx response]; [r setStatus:302 /* moved */]; diff --git a/SOGo/SoObjects/Appointments/Version b/SOGo/SoObjects/Appointments/Version index 02257ba2..e6df4b3e 100644 --- a/SOGo/SoObjects/Appointments/Version +++ b/SOGo/SoObjects/Appointments/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=42 +SUBMINOR_VERSION:=43 # v0.9.42 requires libSOGo v0.9.54 # v0.9.32 requires libGDLContentStore v4.5.26 diff --git a/SOGo/SoObjects/SOGo/AgenorUserManager.h b/SOGo/SoObjects/SOGo/AgenorUserManager.h index 421ee1f2..0e278c73 100644 --- a/SOGo/SoObjects/SOGo/AgenorUserManager.h +++ b/SOGo/SoObjects/SOGo/AgenorUserManager.h @@ -42,6 +42,7 @@ SOGoLRUCache *emailCache; SOGoLRUCache *shareStoreCache; SOGoLRUCache *shareEMailCache; + SOGoLRUCache *changeInternetAccessCache; } + (id)sharedUserManager; @@ -70,6 +71,8 @@ - (NSUserDefaults *)getUserDefaultsForUID:(NSString *)_uid; +- (BOOL)isUserAllowedToChangeSOGoInternetAccess:(NSString *)_uid; + @end #endif /* __AgenorUserManager_H_ */ diff --git a/SOGo/SoObjects/SOGo/AgenorUserManager.m b/SOGo/SoObjects/SOGo/AgenorUserManager.m index 082f9660..687e7cad 100644 --- a/SOGo/SoObjects/SOGo/AgenorUserManager.m +++ b/SOGo/SoObjects/SOGo/AgenorUserManager.m @@ -37,7 +37,8 @@ - (NSString *)_cachedEmailForUID:(NSString *)_uid; - (void)_cacheUID:(NSString *)_uid forEmail:(NSString *)_email; - (NSString *)_cachedUIDForEmail:(NSString *)_email; - + +- (BOOL)primaryIsUserAllowedToChangeSOGoInternetAccess:(NSString *)_uid; @end // TODO: add a timer to flush LRU caches every some hours @@ -49,12 +50,13 @@ static BOOL useLDAP = NO; static NSString *ldapHost = nil; static NSString *ldapBaseDN = nil; static NSNull *sharedNull = nil; -static NSString *fallbackIMAP4Server = nil; -static NSString *defaultMailDomain = @"equipement.gouv.fr"; -static NSString *shareLDAPClass = @"mineqMelBoite"; -static NSString *shareLoginSeparator = @".-."; -static NSString *mailEmissionAttrName = @"mineqMelmailEmission"; -static NSURL *AgenorProfileURL = nil; +static NSString *fallbackIMAP4Server = nil; +static NSString *defaultMailDomain = @"equipement.gouv.fr"; +static NSString *shareLDAPClass = @"mineqMelBoite"; +static NSString *shareLoginSeparator = @".-."; +static NSString *mailEmissionAttrName = @"mineqMelmailEmission"; +static NSString *changeInternetAccessAttrName = @"mineqOgoAccesInternet"; +static NSURL *AgenorProfileURL = nil; static NSArray *fromEMailAttrs = nil; @@ -115,17 +117,20 @@ static NSArray *fromEMailAttrs = nil; self->emailCache = [[SOGoLRUCache alloc] initWithCacheSize:10000]; self->shareStoreCache = [[SOGoLRUCache alloc] initWithCacheSize:10000]; self->shareEMailCache = [[SOGoLRUCache alloc] initWithCacheSize:10000]; + self->changeInternetAccessCache = + [[SOGoLRUCache alloc] initWithCacheSize:10000]; } return self; } - (void)dealloc { - [self->shareStoreCache release]; - [self->shareEMailCache release]; - [self->serverCache release]; - [self->cnCache release]; - [self->uidCache release]; - [self->emailCache release]; + [self->serverCache release]; + [self->cnCache release]; + [self->uidCache release]; + [self->emailCache release]; + [self->shareStoreCache release]; + [self->shareEMailCache release]; + [self->changeInternetAccessCache release]; [super dealloc]; } @@ -843,6 +848,61 @@ static NSArray *fromEMailAttrs = nil; return defaults; } +/* internet access lock */ + +- (BOOL)isUserAllowedToChangeSOGoInternetAccess:(NSString *)_uid { + NSNumber *bv; + + bv = [self->changeInternetAccessCache objectForKey:_uid]; + if (!bv) { + BOOL value; + + value = [self primaryIsUserAllowedToChangeSOGoInternetAccess:_uid]; + bv = [NSNumber numberWithBool:value]; + [self->changeInternetAccessCache addObject:bv forKey:_uid]; + } + return [bv boolValue]; +} + +- (BOOL)primaryIsUserAllowedToChangeSOGoInternetAccess:(NSString *)_uid { + static NSArray *attrs = nil; + NGLdapConnection *conn; + EOQualifier *q; + NSEnumerator *resultEnum; + NGLdapEntry *entry; + NGLdapAttribute *attr; + NSString *value; + + if (attrs == nil) + attrs = [[NSArray alloc] initWithObjects:changeInternetAccessAttrName, nil]; + + q = [EOQualifier qualifierWithQualifierFormat:@"uid = %@", _uid]; + + conn = [self ldapConnection]; + resultEnum = [conn deepSearchAtBaseDN:ldapBaseDN + qualifier:q + attributes:attrs]; + entry = [resultEnum nextObject]; + if (entry == nil) { + if(debugOn) { + [self logWithFormat:@"%s Didn't find LDAP entry for uid '%@'!", + __PRETTY_FUNCTION__, + _uid]; + } + return NO; + } + attr = [entry attributeWithName:changeInternetAccessAttrName]; + if(attr == nil && debugOn) { + [self logWithFormat:@"%s LDAP entry for uid '%@' " + @"has no mineqOgoAccesInternet attribute?", + __PRETTY_FUNCTION__, + _uid]; + return NO; /* nothing we can do about it */ + } + value = [attr stringValueAtIndex:0]; + return [value boolValue]; +} + /* debugging */ - (BOOL)isDebuggingEnabled { diff --git a/SOGo/SoObjects/SOGo/ChangeLog b/SOGo/SoObjects/SOGo/ChangeLog index fd226845..950d2a6c 100644 --- a/SOGo/SoObjects/SOGo/ChangeLog +++ b/SOGo/SoObjects/SOGo/ChangeLog @@ -1,3 +1,8 @@ +2005-07-14 Marcus Mueller + + * AgenorUserManager.[hm]: added accessors and cache for the + 'mineqOgoAccesInternet' flag (v0.9.56) + 2005-07-14 Helge Hess * SOGoContentObject.m: added empty davCopy/davMove methods (v0.9.55) diff --git a/SOGo/UI/Common/ChangeLog b/SOGo/UI/Common/ChangeLog index d239cc14..a973f725 100644 --- a/SOGo/UI/Common/ChangeLog +++ b/SOGo/UI/Common/ChangeLog @@ -1,3 +1,8 @@ +2005-07-14 Marcus Mueller + + * calendar.css, uix.css: added homepagefont and added 'title' class + to use in the scheduler overview (v0.9.41) + 2005-07-13 Marcus Mueller * English.lproj/Localizable.strings: removed label "You are here" and diff --git a/SOGo/UI/Common/Version b/SOGo/UI/Common/Version index eee34e2b..e13dc403 100644 --- a/SOGo/UI/Common/Version +++ b/SOGo/UI/Common/Version @@ -1,5 +1,5 @@ # Version file -SUBMINOR_VERSION:=40 +SUBMINOR_VERSION:=41 # v0.9.28 requires NGExtensions v4.5.136 diff --git a/SOGo/UI/Common/calendar.css b/SOGo/UI/Common/calendar.css index 198eae4d..8097ff41 100644 --- a/SOGo/UI/Common/calendar.css +++ b/SOGo/UI/Common/calendar.css @@ -50,6 +50,12 @@ font-size: 10pt; } +.title { + font-size: 12pt; + font-weight: bold; + background-color: #d8d8d0; +} + th.schedoverview_title { font-size: 10pt; font-weight: bold; diff --git a/SOGo/UI/Common/uix.css b/SOGo/UI/Common/uix.css index de9a4fb4..0c5e2be4 100644 --- a/SOGo/UI/Common/uix.css +++ b/SOGo/UI/Common/uix.css @@ -48,6 +48,13 @@ a:hover { font-weight: bold; } +.homepagefont { + text-decoration: none; + font-family: Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif; + font-size: 10pt; + color: #000000; +} + /* tabs */ diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index 1d86f5a5..3bf94cda 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,8 @@ +2005-07-13 Marcus Mueller + + * English.lproj/Localizable.strings: "Schedule" maps to + "Appointment propositions" now (v0.9.129) + 2005-07-11 Marcus Mueller * UIxCalView.h: added -setAppointments: to the public API diff --git a/SOGo/UI/Scheduler/English.lproj/Localizable.strings b/SOGo/UI/Scheduler/English.lproj/Localizable.strings index 8e481dc8..121eb359 100644 --- a/SOGo/UI/Scheduler/English.lproj/Localizable.strings +++ b/SOGo/UI/Scheduler/English.lproj/Localizable.strings @@ -89,7 +89,7 @@ /* Schedule */ -"Schedule" = "Schedule"; +"Schedule" = "Appointment propositions"; "No appointments found" = "You don't have any appointments in the near future."; "Meetings proposed by you" = "Meetings proposed by you"; "Meetings proposed to you" = "Meetings proposed to you"; diff --git a/SOGo/UI/Scheduler/Version b/SOGo/UI/Scheduler/Version index b5a7494a..90762af8 100644 --- a/SOGo/UI/Scheduler/Version +++ b/SOGo/UI/Scheduler/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=128 +SUBMINOR_VERSION:=129 # v0.9.123 requires Appointments v0.9.35 # v0.9.123 requires SOGoUI v0.9.24 diff --git a/SOGo/UI/Templates/ChangeLog b/SOGo/UI/Templates/ChangeLog index 6a3c21cd..031e1d9e 100644 --- a/SOGo/UI/Templates/ChangeLog +++ b/SOGo/UI/Templates/ChangeLog @@ -1,3 +1,10 @@ +2005-07-14 Marcus Mueller + + * UIxCalSelectTab.wox: removed 'Schedule' tab. + + * UIxCalScheduleOverview.wox: rewritten to be a subcomponent instead + of a proper page. This is used by SOGoHomePage now. + 2005-07-13 Marcus Mueller * *.wox: fixed all corner_right.gif image resources diff --git a/SOGo/UI/Templates/UIxCalScheduleOverview.wox b/SOGo/UI/Templates/UIxCalScheduleOverview.wox index 50b7bdcd..9d46d97e 100644 --- a/SOGo/UI/Templates/UIxCalScheduleOverview.wox +++ b/SOGo/UI/Templates/UIxCalScheduleOverview.wox @@ -1,281 +1,191 @@ - - - - - - +
+ + + + - - - - - -
+ + - + +
- + + + + + + + + + + + + + + + + - + + + - -
+ +
+ +
- - - - - - - + + + + + + + - + +
-
- + + - - - + + + + + + + + + + + + + + + + + + + + + - + + + - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - -
- - ... - -
- -
- - - - - - - - - - - - - - - - -
- - ... - -
-
- -

- workflow
- ========
- - in fact, the workflow we wish to implement is : - person A sets a meeting with B and C - when he sets it, he clicks on a button : either "propose" or - "propose and mail" (obvious) - In both case, when B and C logs into SOGo, they see, in their - 'news page', that a new meeting has beeing proposed - then by clicking on it, they can accept it - on the news, you have to show : meetings proposed to the person - logging in, meetings proposed BY the person logging in, - and their different acceptance - - if you reject the meeting, it still appears in the news page - as refused - - We have still two issues : ergonomic and functionnal - - The ergonomic one : I propose two sections in the news page, - with each being a table, containing, each line, an apt, - with title, day, hour, participants (truncated), the line - being green if it has been accepted by all, red if rejected - by someone - grey if in another state - - the functionnal : a meeting that is still not accepted by - everyone must appear in each participant's view, and be - counted in the conflict manager, or not ? - it's an open point -

-
-
+
+ + ... +
- + + + + + +
+ +
+ + + + + - + + + + + + + + + +
- - -
+
+ + ... +
-
-
-
\ No newline at end of file + + + + + + \ No newline at end of file diff --git a/SOGo/UI/Templates/UIxCalSelectTab.wox b/SOGo/UI/Templates/UIxCalSelectTab.wox index 9b921062..fcc60180 100644 --- a/SOGo/UI/Templates/UIxCalSelectTab.wox +++ b/SOGo/UI/Templates/UIxCalSelectTab.wox @@ -11,12 +11,6 @@ const:selectedTabStyle="tab_selected" const:bodyStyle="tabview_body" > - - -