mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-19 18:35:25 +00:00
Monotone-Parent: 0e5da06a5c5166a41629d40ff43cf8d9f3b4335c
Monotone-Revision: 0417738db917e76880a84c6d4e6d8721c51cd310 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-05-15T20:52:38 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
2007-05-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* 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.
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
TODO: add contained link detection.
|
||||
*/
|
||||
|
||||
#import <SoObjects/SOGo/NSString+Utilities.h>
|
||||
|
||||
#import "common.h"
|
||||
|
||||
#import "UIxMailPartTextViewer.h"
|
||||
@@ -36,14 +38,18 @@
|
||||
|
||||
- (NSString *) flatContentAsString
|
||||
{
|
||||
NSString *content;
|
||||
NSMutableString *content;
|
||||
NSString *superContent, *urlText, *newUrlText;
|
||||
NSRange httpRange, rest, currentURL;
|
||||
unsigned int length;
|
||||
|
||||
content = [[super flatContentAsString] stringByEscapingHTMLString];
|
||||
content = [content stringByReplacingString: @"\r\n"
|
||||
withString: @"<br />"];
|
||||
content = [NSMutableString string];
|
||||
superContent = [[super flatContentAsString] stringByEscapingHTMLString];
|
||||
[content appendString: [superContent stringByDetectingURLs]];
|
||||
[content replaceString: @"\r\n" withString: @"<br />"];
|
||||
[content replaceString: @"\n" withString: @"<br />"];
|
||||
|
||||
return [content stringByReplacingString: @"\n"
|
||||
withString: @"<br />"];
|
||||
return content;
|
||||
}
|
||||
|
||||
@end /* UIxMailPartTextViewer */
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user