diff --git a/ChangeLog b/ChangeLog index 5b4987aca..b3c7f4f7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2011-10-14 Francis Lachapelle + + * UI/WebServerResources/SOGoMailDataSource.js (load): associated a + unique id to the source using the url and its parameters. + + * UI/WebServerResources/SOGoDataTable.js (render): add the new + source id to the current render id. This should solve incorrect + messages appearing when fast-switching between folders or sort order. + + * SoObjects/SOGo/NSString+Utilities.m (-_rangeOfURLInRange:): + fixed handling of brackets (inequality signs <>). + 2011-10-14 Ludovic Marcotte * SoObjects/SOGo/SOGoGCSFolder.m (setRoles:forUser:..) diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index ceac40666..094dd595d 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -142,6 +142,12 @@ static int cssEscapingCount; [self characterAtIndex: start]]) start--; start++; + + // In [UIxMailPartTextViewer flatContentAsString], we first escape HTML entities and then + // add URLs. Therefore, the brackets (inequality signs <>) have been encoded at this point. + if ([[self substringWithRange: NSMakeRange (start, 4)] compare: @"<"] == NSOrderedSame) + start += 4; + length = [self length] - start; workRange = NSMakeRange (start, length); workRange = [self rangeOfCharacterFromSet: urlAfterEndingChars @@ -154,6 +160,11 @@ static int cssEscapingCount; [self characterAtIndex: (start + length - 1)]]) length--; + // Remove trailing ">" + if (([self length] >= start + length + 1) + && [[self substringWithRange: NSMakeRange (start, length + 1)] hasSuffix: @">"]) + length -= 3; + return NSMakeRange (start, length); } diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index 4ddec2c6e..772bfd6d3 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -156,7 +156,7 @@ function markMailInWindow(win, msguid, markread) { img.setAttribute("title", title); } else { - log ("No IMG found for " + msguid); + log ("No IMG found for message " + msguid); } unseenCount = 1; } @@ -169,6 +169,9 @@ function markMailInWindow(win, msguid, markread) { } } } + else { + log ("No row found for message " + msguid); + } return (unseenCount != 0); } @@ -1658,6 +1661,7 @@ function loadMessageCallback(http) { else if (http.status == 404) { showAlertDialog (_("The message you have selected doesn't exist anymore.")); Mailer.dataTable.remove(http.callbackData.msguid); + Mailer.currentMessages[Mailer.currentMailbox] = null; } else log("messageCallback: problem during ajax request: " + http.status); diff --git a/UI/WebServerResources/SOGoDataTable.js b/UI/WebServerResources/SOGoDataTable.js index 9eebfc016..fd9189dd0 100644 --- a/UI/WebServerResources/SOGoDataTable.js +++ b/UI/WebServerResources/SOGoDataTable.js @@ -157,7 +157,7 @@ var SOGoDataTableInterface = { index = start; count = end - start; - this.currentRenderID = index + "-" + count; + this.currentRenderID = this.dataSource.id + "/" + index + "-" + count; // Query the data source only if at least one row is not loaded if (refresh === true || diff --git a/UI/WebServerResources/SOGoMailDataSource.js b/UI/WebServerResources/SOGoMailDataSource.js index 0bcfae667..5bc53820e 100644 --- a/UI/WebServerResources/SOGoMailDataSource.js +++ b/UI/WebServerResources/SOGoMailDataSource.js @@ -5,6 +5,7 @@ SOGoMailDataSource = Class.create({ initialize: function(dataTable, url) { // Instance variables this.dataTable = dataTable; + this.id = url; this.url = url; this.uids = new Array(); @@ -79,6 +80,7 @@ SOGoMailDataSource = Class.create({ } else params = ""; + this.id = this.url + "?" + params; // log ("MailDataSource.load() " + params); triggerAjaxRequest(this.url + "/uids",