From 988f56a95d01138da67a2c749a211d31d56a582d Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 15 Sep 2006 22:25:43 +0000 Subject: [PATCH] Monotone-Parent: 3db701467b1629fef3baaecc995b170c04847ae0 Monotone-Revision: 0e4026f4e1fdce64a64a67f1a4769316ea49d102 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-09-15T22:25:43 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 + UI/Contacts/UIxContactView.m | 70 +++-- UI/Templates/ContactsUI/UIxContactView.wox | 330 --------------------- 3 files changed, 45 insertions(+), 360 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44c0ff8ee..3f92b6ef8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2006-09-15 Wolfgang Sourdeau + * UI/Contacts/UIxContactView.m ([UIxContactView -preferredEmail]): + return a string with a "mailto" url. + ([UIxContactView -_urlOfType:aType]): generic method to return a + url string with a html anchor pointing to it. + * UI/Contacts/UIxContactEditor.[hm]: UIxContactEditorBase renamed since subclass "UIxContactEditor" did nothing. Implemented code to display and modify the values parsed from the vcards, displayed in diff --git a/UI/Contacts/UIxContactView.m b/UI/Contacts/UIxContactView.m index 248d9beb0..2dc5856a2 100644 --- a/UI/Contacts/UIxContactView.m +++ b/UI/Contacts/UIxContactView.m @@ -84,8 +84,18 @@ - (NSString *) preferredEmail { + NSString *email, *mailTo; + + email = [card preferredEMail]; + if (email && [email length] > 0) + mailTo = [NSString stringWithFormat: @"" + @"%@", email, email]; + else + mailTo = nil; + return [self _cardStringWithLabel: @"Email Address: " - value: [card preferredEMail]]; + value: mailTo]; } - (NSString *) preferredTel @@ -221,22 +231,32 @@ return [self _cardStringWithLabel: nil value: data]; } -- (NSString *) homeUrl +- (NSString *) _urlOfType: (NSString *) aType { NSArray *elements; - NSString *data; + NSString *data, *url; elements = [card childrenWithTag: @"url" andAttribute: @"type" - havingValue: @"home"]; + havingValue: aType]; if ([elements count] > 0) - data = [[elements objectAtIndex: 0] value: 0]; + { + url = [[elements objectAtIndex: 0] value: 0]; + data = [NSString stringWithFormat: + @"%@", + url, url]; + } else data = nil; return [self _cardStringWithLabel: nil value: data]; } +- (NSString *) homeUrl +{ + return [self _urlOfType: @"home"]; +} + - (BOOL) hasWorkInfos { BOOL result; @@ -273,7 +293,7 @@ org = [card org]; if (org && [org count] > 1) { - aRange = NSMakeRange (1, [org count] - 2); + aRange = NSMakeRange (1, [org count] - 1); orgServices = [org subarrayWithRange: aRange]; services = [orgServices componentsJoinedByString: @", "]; } @@ -348,25 +368,12 @@ - (NSString *) workUrl { - NSArray *elements; - NSString *data; - - elements = [card childrenWithTag: @"url" - andAttribute: @"type" - havingValue: @"work"]; - if ([elements count] > 0) - data = [[elements objectAtIndex: 0] value: 0]; - else - data = nil; - - return [self _cardStringWithLabel: nil value: data]; + return [self _urlOfType: @"home"]; } - (BOOL) hasOtherInfos { - return ([card note] - || [card bday] - || [card tz]); + return ([card note] || [card bday] || [card tz]); } - (NSString *) bday @@ -416,16 +423,16 @@ WOResponse *response; card = [[self clientObject] vCard]; - if (!card) - return [NSException exceptionWithHTTPStatus: 404 /* Not Found */ - reason:@"could not locate contact"]; - else + if (card) { response = [WOResponse new]; [response autorelease]; [response setHeader: @"text/vcard" forKey: @"Content-type"]; [response appendContentString: [card versitString]]; } + else + return [NSException exceptionWithHTTPStatus: 404 /* Not Found */ + reason:@"could not locate contact"]; return response; } @@ -433,14 +440,17 @@ - (id ) defaultAction { card = [[self clientObject] vCard]; - if (!card) + if (card) + { + NSLog (@"displaying card for contact id: %@", [[self clientObject] nameInContainer]); + phones = nil; + homeAdr = nil; + workAdr = nil; + } + else return [NSException exceptionWithHTTPStatus:404 /* Not Found */ reason:@"could not locate contact"]; - phones = nil; - homeAdr = nil; - workAdr = nil; - return self; } diff --git a/UI/Templates/ContactsUI/UIxContactView.wox b/UI/Templates/ContactsUI/UIxContactView.wox index 184b143a5..934ca7b5a 100644 --- a/UI/Templates/ContactsUI/UIxContactView.wox +++ b/UI/Templates/ContactsUI/UIxContactView.wox @@ -72,334 +72,4 @@ - - - - - - - - - - - - - - - -
- - - - - -
- - - - - -
-
- - - - - -
- - - - - - : - - - - - - - - - -
- - - -
-
-
- - - - - - - - - - - - - - - - -
- : - - - - -
- : - - - -
- : - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- : - - - -
- : - - - -
- : - - - -
- : - - - -
- : - - - -
- : - - - - -
- : - - - - -
- : - - - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- : - - - - -
- : - - - - -
- : - - -
-
-
-
-
- : - - - -
- : - - - -
- : - - - -
-
-
- - - - - - - SOGo Server - -
- Client: -
- Raw :
-
-
-
-
-
-
- - -
- clientObject: -
-