[otrs-cvs] otrs/var/httpd/htdocs/js Core.Agent.Admin.ProcessManagement.Canvas.js, 1.45, 1.46

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/var/httpd/htdocs/js
In directory lancelot:/tmp/cvs-serv28711/var/httpd/htdocs/js

Modified Files:
	Core.Agent.Admin.ProcessManagement.Canvas.js 
Log Message:
Fixed bug#9089 - Activities and transitions with HTML special characters are not displayed correctly.

Author: mn

Index: Core.Agent.Admin.ProcessManagement.Canvas.js
===================================================================
RCS file: /home/cvs/otrs/var/httpd/htdocs/js/Core.Agent.Admin.ProcessManagement.Canvas.js,v
retrieving revision 1.45
retrieving revision 1.46
diff -2 -u -d -r1.45 -r1.46
--- Core.Agent.Admin.ProcessManagement.Canvas.js	21 Jan 2013 10:32:04 -0000	1.45
+++ Core.Agent.Admin.ProcessManagement.Canvas.js	28 Jan 2013 09:43:43 -0000	1.46
@@ -32,4 +32,13 @@
     var Elements = {};
 
+    function EscapeHTML(Content) {
+        return Content
+            .replace(/&/g, '&amp;')
+            .replace(/"/g, '&quot;')
+            .replace(/'/g, '&#39;')
+            .replace(/</g, '&lt;')
+            .replace(/>/g, '&gt;');
+    }
+
     function GetCanvasSize($Element) {
         var MinWidth = 500,
@@ -98,5 +107,5 @@
 
         $('#Canvas')
-            .append('<div class="Activity" id="' + EntityID + '"><span>' + EntityName + '</span><div class="Icon Loader"></div><div class="Icon Success"></div></div>')
+            .append('<div class="Activity" id="' + EntityID + '"><span>' + EscapeHTML(EntityName) + '</span><div class="Icon Loader"></div><div class="Icon Success"></div></div>')
             .find('#' + EntityID)
             .css({
@@ -160,5 +169,5 @@
 
         $TitleElement.find('a').remove();
-        text = '<h4>' + $TitleElement.text() + '</h4>';
+        text = '<h4>' + EscapeHTML($TitleElement.text()) + '</h4>';
 
         if (typeof Transition[ElementID] === 'undefined') {
@@ -191,5 +200,5 @@
         if (AssignedTransitionActions.length) {
             $.each(AssignedTransitionActions, function (Key, Value) {
-                text += "<li>" + Core.Agent.Admin.ProcessManagement.ProcessData.TransitionAction[Value].Name + " (" + Value + ") </li>";
+                text += "<li>" + EscapeHTML(Core.Agent.Admin.ProcessManagement.ProcessData.TransitionAction[Value].Name) + " (" + Value + ") </li>";
             });
         }
@@ -208,5 +217,5 @@
     TargetNS.ShowActivityTooltip = function ($Element) {
         var $tooltip = $('#DiagramTooltip'),
-            text = '<h4>' + $Element.find('span').text() + '</h4>',
+            text = '<h4>' + EscapeHTML($Element.find('span').text()) + '</h4>',
             position = { x: 0, y: 0},
             Activity = Core.Agent.Admin.ProcessManagement.ProcessData.Activity,
@@ -247,5 +256,5 @@
                     SelectedInterface += Value.substr(0,1);
                 });
-                text += "<li><span class=\"AvailableIn\">" + SelectedInterface + "</span> " + Core.Agent.Admin.ProcessManagement.ProcessData.ActivityDialog[Value].Name + " (" + Value + ") </li>";
+                text += "<li><span class=\"AvailableIn\">" + SelectedInterface + "</span> " + EscapeHTML(Core.Agent.Admin.ProcessManagement.ProcessData.ActivityDialog[Value].Name) + " (" + Value + ") </li>";
             });
         }
@@ -452,5 +461,5 @@
                 [ "Diamond", { location: 18, width: 15, length: 25, paintStyle: { fillStyle: '#FFF', outlineWidth: 1, outlineColor: '#000'} } ],
                 [ "PlainArrow", { location: -15, width: 20, length: 15 } ],
-                [ "Label", { label: TransitionName, location: 0.5, cssClass: 'TransitionLabel', id: EntityID, events: {
+                [ "Label", { label: EscapeHTML(TransitionName), location: 0.5, cssClass: 'TransitionLabel', id: EntityID, events: {
                     mouseenter: function(labelOverlay, originalEvent) {
                         TargetNS.HighlightTransitionLabel(labelOverlay, StartElement, EndElement);
@@ -698,5 +707,5 @@
                 Data.connection.addOverlay([ "Diamond", { location: 18, width: 15, length: 25, paintStyle: { fillStyle: '#FFF', outlineWidth: 1, outlineColor: '#000'} } ]);
                 Data.connection.addOverlay([ "PlainArrow", { location: -15, width: 20, length: 15 } ]);
-                Data.connection.addOverlay([ "Label", { label: TransitionName, location: 0.5, cssClass: 'TransitionLabel', id: TransitionID, events: {
+                Data.connection.addOverlay([ "Label", { label: EscapeHTML(TransitionName), location: 0.5, cssClass: 'TransitionLabel', id: TransitionID, events: {
                     mouseenter: function(labelOverlay, originalEvent) {
                         TargetNS.HighlightTransitionLabel(labelOverlay, Data.sourceId, Data.targetId);
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.