From 36d3205ea3a46a41e14fc01288ca2f70902c6b70 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Wed, 5 Sep 2007 15:33:53 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1168 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 3 +++ NEWS | 1 + UI/Scheduler/UIxCalendarSelector.m | 14 ++++++++++---- UI/WebServerResources/JavascriptAPIExtensions.js | 8 ++++++++ UI/WebServerResources/SchedulerUI.js | 14 +++++++------- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c36be425..1a506694 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2007-09-05 Wolfgang Sourdeau + * UI/Scheduler/UIxCalendarSelector.m ([UIxCalendarSelector + -currentCalendarLogin]): replace css-unsafe characters with _. + * UI/SOGoUI/UIxComponent.m ([UIxComponent -shortUserNameForDisplay]): simplified method. ([-user]): removed method since [context activeUser] is as useful. diff --git a/NEWS b/NEWS index 8e8a4f28..9c7872c5 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ 0.9.0-200709XX -------------- +- implemented cookie-based identification in the web interface; - fixed a bug where a false positive happening whenever a wrong user login was given during an indirect bind; diff --git a/UI/Scheduler/UIxCalendarSelector.m b/UI/Scheduler/UIxCalendarSelector.m index 7205bfec..1beef4b4 100644 --- a/UI/Scheduler/UIxCalendarSelector.m +++ b/UI/Scheduler/UIxCalendarSelector.m @@ -152,13 +152,19 @@ colorForNumber (unsigned int number) - (NSString *) currentCalendarLogin { NSArray *parts; + NSMutableString *login; + login = [NSMutableString string]; parts = [[currentCalendarFolder objectForKey: @"folder"] componentsSeparatedByString: @":"]; - - return (([parts count] > 1) - ? [parts objectAtIndex: 0] - : [[context activeUser] login]); + [login appendString: (([parts count] > 1) + ? [parts objectAtIndex: 0] + : [[context activeUser] login])]; + [login replaceString: @"." withString: @"_"]; + [login replaceString: @"#" withString: @"_"]; + [login replaceString: @"@" withString: @"_"]; + + return login; } - (NSString *) currentCalendarStyle diff --git a/UI/WebServerResources/JavascriptAPIExtensions.js b/UI/WebServerResources/JavascriptAPIExtensions.js index 2e39fe69..69aa6bd5 100644 --- a/UI/WebServerResources/JavascriptAPIExtensions.js +++ b/UI/WebServerResources/JavascriptAPIExtensions.js @@ -343,3 +343,11 @@ String.prototype._base64_utf8_decode = function() { return string; }; + +String.prototype.cssSafeString = function() { + var newString = this.replace("#", "_", "g"); + newString = newString.replace(".", "_", "g"); + newString = newString.replace("@", "_", "g"); + + return newString; +} diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 0fb99c34..fc864847 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -374,7 +374,7 @@ function tasksListCallback(http) { $(listItem).addClassName(data[i][5]); var owner = data[i][1]; listItem.owner = owner; - $(listItem).addClassName("ownerIs" + owner); + $(listItem).addClassName("ownerIs" + owner.cssSafeString()); listItem.cname = escape(data[i][0]); var input = document.createElement("input"); input.setAttribute("type", "checkbox"); @@ -723,7 +723,7 @@ function newEventDIV(cname, owner, starts, lasts, var innerDiv = document.createElement("div"); eventDiv.appendChild(innerDiv); $(innerDiv).addClassName("eventInside"); - $(innerDiv).addClassName("ownerIs" + owner); + $(innerDiv).addClassName("ownerIs" + owner.cssSafeString()); var gradientDiv = document.createElement("div"); innerDiv.appendChild(gradientDiv); @@ -1390,16 +1390,16 @@ function appendCalendar(folderName, folder) { var theRules = new Array(); var lastSheet = document.styleSheets[document.styleSheets.length - 1]; if (lastSheet.insertRule) { // Mozilla - lastSheet.insertRule('.ownerIs' + contactId + ' {' + lastSheet.insertRule('.ownerIs' + contactId.cssSafeString() + ' {' + ' background-color: ' + color + ' !important; }', 0); } else { // IE - lastSheet.addRule('.ownerIs' + contactId, - ' background-color: ' - + color - + ' !important; }'); + lastSheet.addRule('.ownerIs' + contactId.cssSafeString(), + ' background-color: ' + + color + + ' !important; }'); } } -- 2.39.5