From: wolfgang Date: Tue, 15 May 2007 21:56:58 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1066 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e828f8e5f080a3684684094d724a1dc688aa33c9;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1066 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/ChangeLog b/ChangeLog index 9c1229d3..912c9c48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2007-05-15 Wolfgang Sourdeau + + * SoObjects/Appointments/SOGoAppointmentFolder.m + ([SOGoAppointmentFolder -fetchContentObjectNames]): override + method to return the events in the range of 2 weeks ago up to 4 + weeks from "now". + + * UI/MailPartViewers/UIxMailPartTextViewer.m + ([UIxMailPartTextViewer -flatContentAsString]): use the new + "stringByDetectingURLs" method to offer clickable urls. + + * SoObjects/SOGo/NSString+Utilities.m ([NSString + -stringByDetectingURLs]): this new method replaces passive URLS + with active ones for HTML resolution of the text. + 2007-05-14 Wolfgang Sourdeau * SoObjects/Mailer/SOGoDraftObject.m ([NSString diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index f07b81bf..2300c7e1 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -1257,6 +1257,33 @@ static NSNumber *sharedYes = nil; return calendarFolders; } +- (NSArray *) fetchContentObjectNames +{ + NSMutableArray *objectNames; + NSArray *records; + NSCalendarDate *today, *startDate, *endDate; + +#warning this should be user-configurable + objectNames = [NSMutableArray array]; + today = [[NSCalendarDate calendarDate] beginOfDay]; + [today setTimeZone: timeZone]; + + startDate = [today dateByAddingYears: 0 months: 0 days: -14 + hours: 0 minutes: 0 seconds: 0]; + endDate = [startDate dateByAddingYears: 0 months: 1 days: 0 + hours: 0 minutes: 0 seconds: 0]; + records = [self fetchFields: [NSArray arrayWithObject: @"c_name"] + from: startDate to: endDate + component: @"vevent"]; + [objectNames addObjectsFromArray: [records valueForKey: @"c_name"]]; + records = [self fetchFields: [NSArray arrayWithObject: @"c_name"] + from: startDate to: endDate + component: @"vtodo"]; + [objectNames addObjectsFromArray: [records valueForKey: @"c_name"]]; + + return objectNames; +} + /* folder type */ - (NSString *) folderType diff --git a/SoObjects/SOGo/NSString+Utilities.h b/SoObjects/SOGo/NSString+Utilities.h index ff120c2f..01728e9e 100644 --- a/SoObjects/SOGo/NSString+Utilities.h +++ b/SoObjects/SOGo/NSString+Utilities.h @@ -38,6 +38,8 @@ - (NSString *) davMethodToObjC; +- (NSString *) stringByDetectingURLs; + #ifndef GNUSTEP_BASE_LIBRARY - (BOOL) boolValue; #endif diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index 66ddda63..4d8acf86 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -21,11 +21,15 @@ */ #import +#import #import #import "NSString+Utilities.h" #import "NSDictionary+URL.h" +static NSMutableCharacterSet *urlNonEndingChars = nil; +static NSMutableCharacterSet *urlAfterEndingChars = nil; + @implementation NSString (SOGoURLExtension) - (NSString *) composeURLWithAction: (NSString *) action @@ -101,7 +105,71 @@ return newName; } -#ifndef GNUSTEP_BASE_LIBRARY +- (NSRange) _rangeOfURLInRange: (NSRange) refRange +{ + int start, length; + NSRange endRange; + + if (!urlNonEndingChars) + { + urlNonEndingChars = [NSMutableCharacterSet new]; + [urlNonEndingChars addCharactersInString: @",.:;\t \r\n"]; + } + if (!urlAfterEndingChars) + { + urlAfterEndingChars = [NSMutableCharacterSet new]; + [urlAfterEndingChars addCharactersInString: @"\t \r\n"]; + } + + start = refRange.location; + while (start > -1 + && [self characterAtIndex: start] != ' ') + start--; + start++; + length = [self length] - start; + endRange = NSMakeRange (start, length); + endRange = [self rangeOfCharacterFromSet: urlAfterEndingChars + options: NSLiteralSearch range: endRange]; + if (endRange.location != NSNotFound) + length = endRange.location; + length -= start; + while + ([urlNonEndingChars characterIsMember: + [self characterAtIndex: (start + length - 1)]]) + length--; + + return NSMakeRange (start, length); +} + +- (NSString *) stringByDetectingURLs +{ + NSMutableString *selfCopy; + NSRange httpRange, currentURL, rest; + NSString *urlText, *newUrlText; + unsigned int length; + + selfCopy = [NSMutableString stringWithString: self]; + + httpRange = [selfCopy rangeOfString: @"://"]; + while (httpRange.location != NSNotFound) + { + currentURL = [selfCopy _rangeOfURLInRange: httpRange]; + urlText = [selfCopy substringFromRange: currentURL]; + newUrlText = [NSString stringWithFormat: @"%@", + urlText, urlText]; + [selfCopy replaceCharactersInRange: currentURL + withString: newUrlText]; + length = [selfCopy length]; + rest.location = currentURL.location + [newUrlText length]; + rest.length = length - rest.location; + httpRange = [selfCopy rangeOfString: @"://" + options: 0 range: rest]; + } + + return selfCopy; +} + +#if LIB_FOUNDATION_LIBRARY - (BOOL) boolValue { return !([self isEqualToString: @"0"] diff --git a/UI/MailPartViewers/UIxMailPartTextViewer.m b/UI/MailPartViewers/UIxMailPartTextViewer.m index f37364b5..ae25992e 100644 --- a/UI/MailPartViewers/UIxMailPartTextViewer.m +++ b/UI/MailPartViewers/UIxMailPartTextViewer.m @@ -28,6 +28,8 @@ TODO: add contained link detection. */ +#import + #import "common.h" #import "UIxMailPartTextViewer.h" @@ -36,14 +38,18 @@ - (NSString *) flatContentAsString { - NSString *content; - - content = [[super flatContentAsString] stringByEscapingHTMLString]; - content = [content stringByReplacingString: @"\r\n" - withString: @"
"]; - - return [content stringByReplacingString: @"\n" - withString: @"
"]; + NSMutableString *content; + NSString *superContent, *urlText, *newUrlText; + NSRange httpRange, rest, currentURL; + unsigned int length; + + content = [NSMutableString string]; + superContent = [[super flatContentAsString] stringByEscapingHTMLString]; + [content appendString: [superContent stringByDetectingURLs]]; + [content replaceString: @"\r\n" withString: @"
"]; + [content replaceString: @"\n" withString: @"
"]; + + return content; } @end /* UIxMailPartTextViewer */ diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index 5d1bb554..d2861de9 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -607,13 +607,13 @@ function onMessageSelectionChange() { } function loadMessage(idx) { - var cachedMessage = getCachedMessage(idx); - if (document.messageAjaxRequest) { document.messageAjaxRequest.aborted = true; document.messageAjaxRequest.abort(); } + var cachedMessage = getCachedMessage(idx); + if (cachedMessage == null) { var url = (ApplicationBaseURL + currentMailbox + "/" + idx + "/view?noframe=1"); @@ -625,9 +625,21 @@ function loadMessage(idx) { div.innerHTML = cachedMessage['text']; cachedMessage['time'] = (new Date()).getTime(); document.messageAjaxRequest = null; + configureLinksInMessageDIV(div); } } +function configureLinksInMessageDIV(div) { + var anchors = div.getElementsByTagName('a'); + for (var i = 0; i < anchors.length; i++) + anchors[i].addEventListener("click", onMessageAnchorClick, false); +} + +function onMessageAnchorClick (event) { + window.open(this.href); + event.preventDefault(); +} + function messageCallback(http) { var div = $('messageContent'); @@ -635,7 +647,8 @@ function messageCallback(http) { && http.status == 200) { document.messageAjaxRequest = null; div.innerHTML = http.responseText; - + configureLinksInMessageDIV(div); + if (http.callbackData) { var cachedMessage = new Array(); cachedMessage['idx'] = currentMailbox + '/' + http.callbackData; diff --git a/UI/WebServerResources/SchedulerUI.css b/UI/WebServerResources/SchedulerUI.css index f5478271..13d11feb 100644 --- a/UI/WebServerResources/SchedulerUI.css +++ b/UI/WebServerResources/SchedulerUI.css @@ -40,6 +40,9 @@ DIV#tasksListView LABEL DIV#calendarSelectorView { top: 0px; } +DIV#calendarSelectorView +{ overflow: hidden; } + DIV#calendarsList { height: 100%; padding: 0px; @@ -58,7 +61,6 @@ UL#tasksList, UL#calendarList { cursor: default; margin: .25em; padding: 0px; - overflow: auto; overflow-x: hidden; overflow-y: auto; border-bottom: 1px solid #fff; @@ -136,19 +138,16 @@ DIV#rightPanel margin: 0px; margin-left: 5px; padding: 0px; - overflow: hidden; -} + overflow: hidden; } DIV#appointmentsListView { position: absolute; + display: block; background: #fff; height: 15.5em; - top: 2.5em; - left: 0px; - width: 100%; - overflow: auto; -} + margin: 0.5em 0px 0px 0px; + min-width: 600px; } DIV#calendarView { @@ -158,7 +157,6 @@ DIV#calendarView margin-top: 5px; bottom: 0px; width: 100%; - overflow: hidden; border-top: 1px solid #aaa; border-left: 1px solid #aaa; } @@ -294,7 +292,16 @@ DIV#calendarView A border: 1px solid #deebf7; } TABLE#appointmentsList -{ width: 100%; } +{ ddisplay: table; } + +TABLE#appointmentsList td.tbtv_subject_headercell + { width: 35%; } + +TABLE#appointmentsList td.headerDateTime +{ width: 17em; } + +TABLE#appointmentsList td.headerLocation +{ width: 20%; } #dateSelector TD._selected, UL > LI._selected,