From 3919b2854739739f947f05a7c1b67aa111cc24d1 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Wed, 5 Jun 2013 11:03:10 -0400 Subject: Bug 879713 - product dashboard links does not urlencode ampersands --- extensions/ProductDashboard/web/js/components.js | 39 ++++++++++++++++-------- 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'extensions/ProductDashboard') diff --git a/extensions/ProductDashboard/web/js/components.js b/extensions/ProductDashboard/web/js/components.js index 538b15457..8b0d28587 100644 --- a/extensions/ProductDashboard/web/js/components.js +++ b/extensions/ProductDashboard/web/js/components.js @@ -3,13 +3,13 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. * * This Source Code Form is "Incompatible With Secondary Licenses", as - * defined by the Mozilla Public License, v. 2.0. + * defined by the Mozilla Public License, v. 2.0. */ YUI({ - base: 'js/yui3/', + base: 'js/yui3/', combine: false -}).use("datatable", "datatable-sort", function(Y) { +}).use("datatable", "datatable-sort", "escape", function(Y) { if (typeof PD.updated_recently != 'undefined') { var columns = [ { key:"id", label:"ID", sortable:true, allowHTML: true, @@ -37,16 +37,21 @@ YUI({ } if (typeof PD.component_counts != 'undefined') { - var summary_url = '{value}' }, + { key:"name", label:"Name", sortable:true, allowHTML: true, + formatter: function (o) { + return summary_url + '&component=' + + encodeURIComponent(o.value) + '">' + + Y.Escape.html(o.value) + '' + } + }, { key:"count", label:"Count", sortable:true }, { key:"percentage", label:"Percentage", sortable:false, allowHTML: true, - formatter: '
{value}%
' }, + formatter: '
{value}%
' }, { key:"link", label:"Link", sortable:false, allowHTML: true } ]; @@ -55,8 +60,13 @@ YUI({ data: PD.component_counts }); componentsDataTable.render("#component_counts"); - - columns[0].formatter = summary_url + '&version={value}">{value}'; + + columns[0].formatter = function (o) { + return summary_url + '&version=' + + encodeURIComponent(o.value) + '">' + + Y.Escape.html(o.value) + ''; + }; + var versionsDataTable = new Y.DataTable({ columns: columns, data: PD.version_counts @@ -64,7 +74,12 @@ YUI({ versionsDataTable.render('#version_counts'); if (typeof PD.milestone_counts != 'undefined') { - columns[0].formatter = summary_url + '&target_milestone={value}">{value}'; + columns[0].formatter = function (o) { + return summary_url + '&target_milestone=' + + encodeURIComponent(o.value) + '">' + + Y.Escape.html(o.value) + ''; + }; + var milestonesDataTable = new Y.DataTable({ columns: columns, data: PD.milestone_counts -- cgit v1.2.3-24-g4f1b