From 3567a3f6d5a10dd04668944658cf73933b9373cf Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 21 Jan 2009 17:01:06 +0000 Subject: [PATCH] Monotone-Parent: 5352547fba6d82f422f3bb300b39427b9ebf5653 Monotone-Revision: 07ab3efb7fca7b90bb3250e66fef539e6ccac57c Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-01-21T17:01:06 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 10 ++++++++++ SoObjects/SOGo/NSString+Utilities.m | 1 + SoObjects/SOGo/SOGoFolder.m | 2 +- SoObjects/SOGo/SOGoGCSFolder.m | 5 +++-- UI/WebServerResources/JavascriptAPIExtensions.js | 3 ++- UI/WebServerResources/SchedulerUI.js | 12 +++++++----- UI/WebServerResources/generic.js | 2 +- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d40a38e3..261bce841 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2009-01-21 Wolfgang Sourdeau + * SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder + +folderWithSubscriptionReference:referenceinContainer:aContainer]): + same as below. + + * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -realNameInContainer]): + escape the owner name as a potential CSS identifier. + + * SoObjects/SOGo/NSString+Utilities.m ([NSString + -asCSSIdentifier]): escape the "_" character first. + * SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder -subscribe:reallyDoinTheNamesOf:delegatedUsersfromMailInvitation:isMailInvitationinContext:localContext]): explicitly set the content-type of the response to text/plain with diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index 55bcedf03..f26d0e5aa 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -310,6 +310,7 @@ static NSMutableCharacterSet *urlStartChars = nil; NSMutableString *cssIdentifier; cssIdentifier = [NSMutableString stringWithString: self]; + [cssIdentifier replaceString: @"_" withString: @"_U_"]; [cssIdentifier replaceString: @"." withString: @"_D_"]; [cssIdentifier replaceString: @"#" withString: @"_H_"]; [cssIdentifier replaceString: @"@" withString: @"_A_"]; diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index 244583e42..7c4bb6063 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -107,7 +107,7 @@ if (isSubscription) { - ownerName = [self ownerInContext: context]; + ownerName = [[self ownerInContext: context] asCSSIdentifier]; realNameInContainer = [nameInContainer substringFromIndex: [ownerName length] + 1]; } diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 4339f240e..d36eead45 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -43,10 +43,10 @@ #import #import #import +#import #import #import #import -#import #import #import #import @@ -164,7 +164,8 @@ static NSArray *childRecordFields = nil; path = [NSString stringWithFormat: @"/Users/%@/%@/%@", login, [pathElements objectAtIndex: 0], ocsName]; - folderName = [NSString stringWithFormat: @"%@_%@", login, ocsName]; + folderName = [NSString stringWithFormat: @"%@_%@", + [login asCSSIdentifier], ocsName]; newFolder = [self objectWithName: folderName inContainer: aContainer]; [newFolder setOCSPath: path]; [newFolder setOwner: login]; diff --git a/UI/WebServerResources/JavascriptAPIExtensions.js b/UI/WebServerResources/JavascriptAPIExtensions.js index 3ba3f2f3f..cee6de8d6 100644 --- a/UI/WebServerResources/JavascriptAPIExtensions.js +++ b/UI/WebServerResources/JavascriptAPIExtensions.js @@ -59,7 +59,8 @@ String.prototype.asDate = function () { }; String.prototype.asCSSIdentifier = function () { - var substitutions = { '.': '_D_', + var substitutions = { '_': '_U_', + '.': '_D_', '#': '_H_', '@': '_A_', '*': '_S_', diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 39e121924..cb3c3d3f9 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -1739,14 +1739,16 @@ function updateCalendarProperties(calendarID, calendarName, calendarColor) { var idParts = calendarID.split(":"); var folderName = idParts[1].split("/")[1]; var nodeID; + if (idParts[0] != UserLogin) - nodeID = "/" + idParts[0] + "_" + folderName; - else + nodeID = "/" + idParts[0].asCSSIdentifier() + "_" + folderName; + else { nodeID = "/" + folderName; // log("nodeID: " + nodeID); - var calendarNode = $(nodeID); - var childNodes = calendarNode.childNodes; - childNodes[childNodes.length-1].nodeValue = calendarName; + var calendarNode = $(nodeID); + var childNodes = calendarNode.childNodes; + childNodes[childNodes.length-1].nodeValue = calendarName; + } appendStyleElement(nodeID, calendarColor); } diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index 3fc6d568e..51aaf5524 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -1135,7 +1135,7 @@ function accessToSubscribedFolder(serverFolder) { var parts = serverFolder.split(":"); if (parts.length > 1) { var paths = parts[1].split("/"); - folder = "/" + parts[0] + "_" + paths[2]; + folder = "/" + parts[0].asCSSIdentifier() + "_" + paths[2]; } else folder = serverFolder;