From 97632e3406f5110223e39a25907bec8249caa536 Mon Sep 17 00:00:00 2001 From: znek Date: Fri, 8 Oct 2004 16:45:00 +0000 Subject: [PATCH] fixes and requested features git-svn-id: http://svn.opengroupware.org/SOGo/trunk@376 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Contacts/ChangeLog | 10 +++ SOGo/UI/Contacts/UIxContactSelector.m | 40 +++++++++- SOGo/UI/Contacts/UIxContactsSelectionView.m | 19 +++-- SOGo/UI/Contacts/Version | 2 +- SOGo/UI/Scheduler/ChangeLog | 14 ++++ SOGo/UI/Scheduler/UIxAppointmentPrintview.wox | 16 ++++ SOGo/UI/Scheduler/UIxAppointmentProposal.wox | 2 + SOGo/UI/Scheduler/UIxAppointmentView.m | 20 +++++ SOGo/UI/Scheduler/UIxAppointmentView.wox | 5 +- SOGo/UI/Scheduler/Version | 2 +- SOGoLogic/AgenorUserManager.m | 80 ++++++++++--------- SOGoLogic/ChangeLog | 5 ++ SOGoLogic/Version | 2 +- 13 files changed, 164 insertions(+), 53 deletions(-) diff --git a/SOGo/UI/Contacts/ChangeLog b/SOGo/UI/Contacts/ChangeLog index 79957892..859ae65a 100644 --- a/SOGo/UI/Contacts/ChangeLog +++ b/SOGo/UI/Contacts/ChangeLog @@ -1,3 +1,13 @@ +2004-10-08 Marcus Mueller + + * v0.9.13 + + * UIxContactsSelectionView.m: pass more (previous empty) parameters + to the JavaScript callback. + + * UIxContactSelector.m: correctly compute the relative path to the + "Contacts" URL. + 2004-09-14 Marcus Mueller * v0.9.12 diff --git a/SOGo/UI/Contacts/UIxContactSelector.m b/SOGo/UI/Contacts/UIxContactSelector.m index 54a4521e..175aa720 100644 --- a/SOGo/UI/Contacts/UIxContactSelector.m +++ b/SOGo/UI/Contacts/UIxContactSelector.m @@ -37,12 +37,17 @@ - (void)setCallback:(NSString *)_callback; - (NSString *)callback; +- (NSString *)userRootURL; +- (NSString *)selfURL; +- (NSString *)relativeContactsURL; + - (NSString *)jsFunctionName; - (NSString *)jsFunctionHref; - (NSString *)jsCode; @end #include "common.h" +#include @implementation UIxContactSelector @@ -85,6 +90,38 @@ return self->callback; } +/* Helper */ + +- (NSString *)userRootURL { + WOContext *ctx; + NSArray *traversalObjects; + NSString *url; + + ctx = [self context]; + traversalObjects = [ctx objectTraversalStack]; + url = [[[traversalObjects objectAtIndex:1] + baseURLInContext:ctx] + stringByAppendingString:@"/"]; + return [[NSURL URLWithString:url] path]; +} + +- (NSString *)selfURL { + NSString *url; + + url = [[self clientObject] baseURLInContext:[self context]]; + return [[NSURL URLWithString:url] path]; +} + +- (NSString *)relativeContactsURL { + NSString *contactsURL, *selfURL, *relativeURL; + + contactsURL = [[self userRootURL] + stringByAppendingPathComponent:@"Contacts/select"]; + selfURL = [self selfURL]; + relativeURL = [contactsURL urlPathRelativeToPath:selfURL]; + return relativeURL; +} + /* JavaScript */ - (NSString *)jsFunctionName { @@ -100,12 +137,13 @@ - (NSString *)jsCode { static NSString *codeFmt = \ @"function %@() {\n" - @" var url = '../../Contacts/select?callback=%@';\n" + @" var url = '%@?callback=%@';\n" @" var contactsWindow = window.open(url, '%@', 'width=600, height=400, left=10, top=10, toolbar=no, dependent=yes, menubar=no, location=no, resizable=yes, scrollbars=yes, directories=no, status=no');\n" @" contactsWindow.focus();\n" @"}"; return [NSString stringWithFormat:codeFmt, [self jsFunctionName], + [self relativeContactsURL], [self callback], [self windowId]]; } diff --git a/SOGo/UI/Contacts/UIxContactsSelectionView.m b/SOGo/UI/Contacts/UIxContactsSelectionView.m index 47cc4cc9..4c6baba1 100644 --- a/SOGo/UI/Contacts/UIxContactsSelectionView.m +++ b/SOGo/UI/Contacts/UIxContactsSelectionView.m @@ -23,7 +23,6 @@ #include "UIxContactsListView.h" - @interface UIxContactsSelectionView : UIxContactsListView { NSString *callback; @@ -31,6 +30,7 @@ @end #include "common.h" +#include @implementation UIxContactsSelectionView @@ -48,18 +48,23 @@ } - (NSString *)jsOnClickCode { + /* callback parameters: (type, cn, dn, email, uid, sn) */ static NSString *jsCode = \ - @"javascript:opener.window.%@('', '%@', '', '%@', '', '');"; - NSString *cn; - + @"javascript:opener.window.%@('', '%@', '', '%@', '%@', '%@');"; + NSString *sn, *cn, *mail, *uid; + + sn = [self->contact valueForKey:@"sn"]; cn = [NSString stringWithFormat:@"%@ %@", - [self->contact valueForKey:@"sn"], + sn, [self->contact valueForKey:@"givenname"]]; - + mail = [self->contact valueForKey:@"mail"]; + uid = [[AgenorUserManager sharedUserManager] getUIDForEmail:mail]; return [NSString stringWithFormat:jsCode, [self callback], cn, - [self->contact valueForKey:@"mail"]]; + mail, + uid, + sn]; } @end /* UIxContactsInlineListView */ diff --git a/SOGo/UI/Contacts/Version b/SOGo/UI/Contacts/Version index 9cef7993..92c8fa08 100644 --- a/SOGo/UI/Contacts/Version +++ b/SOGo/UI/Contacts/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=12 +SUBMINOR_VERSION:=13 diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index f840def6..f531ed68 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,17 @@ +2004-10-08 Marcus Mueller + + * v0.9.86 + + * UIxAppointmentView.[m|wox]: new method to return categories as a + string. + + * UIxAppointmentPrintview.wox: added missing priority and categories. + + * UIxAppointmentProposal.wox: also allow selection from private address + book for resources/participants. This might lead to the fact that + contacts can be selected which do not have a calendar at all - there + should be some way of safeguarding this in the Contacts bundle. + 2004-10-06 Marcus Mueller * UIxAppointmentEditor.m: changed iCal template to use RFC2445 diff --git a/SOGo/UI/Scheduler/UIxAppointmentPrintview.wox b/SOGo/UI/Scheduler/UIxAppointmentPrintview.wox index 92f9b70e..b78bda47 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentPrintview.wox +++ b/SOGo/UI/Scheduler/UIxAppointmentPrintview.wox @@ -34,6 +34,14 @@ + + + : + + + + + @@ -60,6 +68,14 @@ /> + + + : + + + + + : diff --git a/SOGo/UI/Scheduler/UIxAppointmentProposal.wox b/SOGo/UI/Scheduler/UIxAppointmentProposal.wox index c918dad2..671bf51f 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentProposal.wox +++ b/SOGo/UI/Scheduler/UIxAppointmentProposal.wox @@ -132,6 +132,7 @@ const:role="NON-PARTICIPANT" attendees="resources" const:division="CC" + const:withAddressBook="YES" /> @@ -161,6 +162,7 @@ attendees="participants" var:emailForUser="emailForUser" var:cnForUser="cnForUser" + const:withAddressBook="YES" /> diff --git a/SOGo/UI/Scheduler/UIxAppointmentView.m b/SOGo/UI/Scheduler/UIxAppointmentView.m index e228b3e8..9b133b88 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentView.m +++ b/SOGo/UI/Scheduler/UIxAppointmentView.m @@ -75,6 +75,26 @@ return [cns componentsJoinedByString:@"
"]; } +- (NSString *)categoriesAsString { + unsigned i, count; + NSArray *cats; + NSMutableString *s; + + s = [[NSMutableString alloc] init]; + cats = [((SOGoAppointment *)self->appointment) categories]; + count = [cats count]; + for(i = 0; i < count; i++) { + NSString *cat, *label; + + cat = [cats objectAtIndex:i]; + label = [self labelForKey:cat]; + [s appendString:label]; + if(i != (count - 1)) + [s appendString:@", "]; + } + return s; +} + /* backend */ - (SOGoAppointment *)appointment { diff --git a/SOGo/UI/Scheduler/UIxAppointmentView.wox b/SOGo/UI/Scheduler/UIxAppointmentView.wox index de15933b..90cd422d 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentView.wox +++ b/SOGo/UI/Scheduler/UIxAppointmentView.wox @@ -146,10 +146,7 @@ : - - - + diff --git a/SOGo/UI/Scheduler/Version b/SOGo/UI/Scheduler/Version index dd616d8e..b9bc7713 100644 --- a/SOGo/UI/Scheduler/Version +++ b/SOGo/UI/Scheduler/Version @@ -1,6 +1,6 @@ # $Id$ -SUBMINOR_VERSION:=85 +SUBMINOR_VERSION:=86 # v0.9.84 requires libSOGoLogic v0.9.12 # v0.9.70 requires libNGExtensions v4.3.107 diff --git a/SOGoLogic/AgenorUserManager.m b/SOGoLogic/AgenorUserManager.m index 240bf544..60842b44 100644 --- a/SOGoLogic/AgenorUserManager.m +++ b/SOGoLogic/AgenorUserManager.m @@ -27,61 +27,65 @@ @implementation AgenorUserManager + (id)sharedUserManager { - static id mgr = nil; - if(mgr == nil) { - mgr = [[self alloc] init]; - } - return mgr; + static id mgr = nil; + if(mgr == nil) { + mgr = [[self alloc] init]; + } + return mgr; } - (id)init { - self = [super init]; - if(self) { - } - return self; + self = [super init]; + if(self) { + } + return self; } - (void)dealloc { - [super dealloc]; + [super dealloc]; } - (NSString *)getUIDForEmail:(NSString *)_email { - NSRange r; - NSString *domain; - - r = [_email rangeOfString:@"@"]; - domain = [_email substringFromIndex:r.location + 1]; - if(![domain isEqualToString:@"equipement.gouv.fr"]) - return _email; - return [_email substringToIndex:r.location]; + NSRange r; + NSString *domain; + + if(!_email || [_email length] == 0) + return nil; + + r = [_email rangeOfString:@"@"]; + domain = [_email substringFromIndex:r.location + 1]; + if(![domain isEqualToString:@"equipement.gouv.fr"]) + return _email; + return [_email substringToIndex:r.location]; } - (NSString *)getEmailForUID:(NSString *)_uid { - NSRange r; - - r = [_uid rangeOfString:@"@"]; - if(r.length > 0) - return _uid; - return [NSString stringWithFormat:@"%@@equipement.gouv.fr", _uid]; - + NSRange r; + + if(!_uid || [_uid length] == 0) + return nil; + r = [_uid rangeOfString:@"@"]; + if(r.length > 0) + return _uid; + return [NSString stringWithFormat:@"%@@equipement.gouv.fr", _uid]; } - (NSString *)getCNForUID:(NSString *)_uid { #warning !! IMPLEMENT ME!! - NSString *s; - NSRange r; - - s = _uid; - if ([s length] < 10) - return s; - - // TODO: algorithm might be inappropriate, depends on the actual UID - r = [s rangeOfString:@"."]; - if (r.length == 0) - return s; - - return [s substringToIndex:r.location]; + NSString *s; + NSRange r; + + s = _uid; + if ([s length] < 10) + return s; + + // TODO: algorithm might be inappropriate, depends on the actual UID + r = [s rangeOfString:@"."]; + if (r.length == 0) + return s; + + return [s substringToIndex:r.location]; } @end diff --git a/SOGoLogic/ChangeLog b/SOGoLogic/ChangeLog index 271c7d2f..fec335b9 100644 --- a/SOGoLogic/ChangeLog +++ b/SOGoLogic/ChangeLog @@ -1,3 +1,8 @@ +2004-10-08 Marcus Mueller + + * AgenorUserManager.m: some safe-guarding against improper values, + code pretty printing. (v0.9.15) + 2004-10-08 Helge Hess * SOGoAppointment.m: improved behaviour in some edge condition (the diff --git a/SOGoLogic/Version b/SOGoLogic/Version index dc9886a4..8c6b5872 100644 --- a/SOGoLogic/Version +++ b/SOGoLogic/Version @@ -1,5 +1,5 @@ # $Id$ -SUBMINOR_VERSION:=14 +SUBMINOR_VERSION:=15 # v0.9.13 requires libFoundation v1.0.62 -- 2.39.5