Skip to content

Commit

Permalink
Fixed #2549
Browse files Browse the repository at this point in the history
Special character support on campaign and tag name.
  • Loading branch information
vertigo17 committed Nov 28, 2024
1 parent 8afe840 commit 47138a8
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions source/src/main/webapp/js/pages/CampaignList.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,19 @@ function aoColumnsFunc(tableId) {
"mRender": function (data, type, obj) {
var hasPermissions = $("#" + tableId).attr("hasPermissions");

var editTestcampaign = '<button id="editTestcampaign" onclick="editEntryClick(\'' + obj["campaign"] + '\');"\n\
var editTestcampaign = '<button id="editTestcampaign" onclick="editEntryClick(\'' + escapeHtml(obj["campaign"]) + '\');"\n\
class="editCampaign btn btn-default btn-xs margin-right5" \n\
name="editTestcampaign" title="' + doc.getDocLabel("page_testcampaign", "button_edit") + '" type="button">\n\
<span class="glyphicon glyphicon-pencil"></span></button>';
var removeTestcampaign = '<button id="removeTestcampaign" onclick="removeEntryClick(\'' + obj["campaign"] + '\');"\n\
var removeTestcampaign = '<button id="removeTestcampaign" onclick="removeEntryClick(\'' + escapeHtml(obj["campaign"]) + '\');"\n\
class="removeTestcampaign btn btn-default btn-xs margin-right25" \n\
name="removeTestcampaign" title="' + doc.getDocLabel("page_testcampaign", "button_remove") + '" type="button">\n\
<span class="glyphicon glyphicon-trash"></span></button>';
var viewTestcampaign = '<button id="viewTestcampaign" onclick="viewEntryClick(\'' + obj["campaign"] + '\');"\n\
var viewTestcampaign = '<button id="viewTestcampaign" onclick="viewEntryClick(\'' + escapeHtml(obj["campaign"]) + '\');"\n\
class="viewTestcampaign btn btn-default btn-xs margin-right5" \n\
name="viewTestcampaign" title="' + doc.getDocLabel("page_testcampaign", "button_testcaselist") + '" type="button">\n\
<span class="glyphicon glyphicon-list"></span></button>';
var viewStatcampaign = '<button id="viewStatcampaign" onclick="viewStatEntryClick(\'' + obj["campaign"] + '\');"\n\
var viewStatcampaign = '<button id="viewStatcampaign" onclick="viewStatEntryClick(\'' + escapeHtml(obj["campaign"]) + '\');"\n\
class="viewStatcampaign btn btn-default btn-xs margin-right5" \n\
name="viewStatcampaign" title="' + doc.getDocLabel("page_testcampaign", "button_taglist") + '" type="button">\n\
<span class="glyphicon glyphicon-stats"></span></button>';
Expand Down
2 changes: 1 addition & 1 deletion source/src/main/webapp/js/pages/Homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ function loadLastTagResultList() {
for (var index = 0; index < tagList.length; index++) {
let tagName = tagList[index];
//TODO find a way to remove the use for resendTag
var requestToServlet = "ReadTestCaseExecutionByTag?Tag=" + tagName + "&" + "outputReport=totalStatsCharts" + "&" + "outputReport=resendTag" + "&" + "sEcho=" + index;
var requestToServlet = "ReadTestCaseExecutionByTag?Tag=" + encodeURIComponent(tagName) + "&" + "outputReport=totalStatsCharts" + "&" + "outputReport=resendTag" + "&" + "sEcho=" + index;
var jqxhr = $.get(requestToServlet, null, "json");

$.when(jqxhr).then(function (data) {
Expand Down
6 changes: 3 additions & 3 deletions source/src/main/webapp/js/pages/ReportingExecutionByTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ function loadReportingData(selectTag) {
fullL = "fullList=" + !isRefreshAutoHide;
}

var param = "?Tag=" + selectTag + "&" + statusFilter.serialize() + "&" + countryFilter.serialize() + "&" + params.serialize() + "&" + paramsLabel.serialize() + fullL;
var param = "?Tag=" + encodeURIComponent(selectTag) + "&" + statusFilter.serialize() + "&" + countryFilter.serialize() + "&" + params.serialize() + "&" + paramsLabel.serialize() + fullL;

//Retrieve data for charts and draw them
var jqxhr = $.get("ReadTestCaseExecutionByTag" + param, null, "json");
Expand Down Expand Up @@ -735,7 +735,7 @@ function filterCountryBrowserReport(selectTag, splitFilterSettings) {
var statusFilter = $("#statusFilter input");
var countryFilter = $("#countryFilter input");
var params = $("#splitFilter input");
var requestToServlet = "ReadTestCaseExecutionByTag?Tag=" + selectTag + "&" + statusFilter.serialize() + "&" + countryFilter.serialize() + "&" + params.serialize() + "&" + "outputReport=statsChart";
var requestToServlet = "ReadTestCaseExecutionByTag?Tag=" + encodeURIComponent(selectTag) + "&" + statusFilter.serialize() + "&" + countryFilter.serialize() + "&" + params.serialize() + "&" + "outputReport=statsChart";
var jqxhr = $.get(requestToServlet, null, "json");

$.when(jqxhr).then(function (data) {
Expand All @@ -749,7 +749,7 @@ function filterLabelReport(selectTag) {
var statusFilter = $("#statusFilter input");
var countryFilter = $("#countryFilter input");
var params = $("#splitLabelFilter input");
var requestToServlet = "ReadTestCaseExecutionByTag?Tag=" + selectTag + "&" + statusFilter.serialize() + "&" + countryFilter.serialize() + "&" + params.serialize() + "&" + "outputReport=labelStat";
var requestToServlet = "ReadTestCaseExecutionByTag?Tag=" + encodeURIComponent(selectTag) + "&" + statusFilter.serialize() + "&" + countryFilter.serialize() + "&" + params.serialize() + "&" + "outputReport=labelStat";
var jqxhr = $.get(requestToServlet, null, "json");

$.when(jqxhr).then(function (data) {
Expand Down
4 changes: 2 additions & 2 deletions source/src/main/webapp/js/pages/RunTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ function handleAddToQueueResponse(data, doRedirect) {
data.message = data.message + "<br><a href='TestCaseExecution.jsp?executionQueueId=" + data.queueList[0].queueId + "'><button class='btn btn-primary' id='goToExecution'>Open Execution</button></a>";
}
if (data.nbExe > 1) {
data.message = data.message + "<br><a href='ReportingExecutionByTag.jsp?Tag=" + data.tag + "'><button class='btn btn-primary' id='goToTagReport'>Report by Tag</button></a>"
data.message = data.message + "<br><a href='ReportingExecutionByTag.jsp?Tag=" + encodeURIComponent(data.tag) + "'><button class='btn btn-primary' id='goToTagReport'>Report by Tag</button></a>"
}
var rc = getAlertType(data.messageType);
if ((rc === "success") && (data.nbExe === 0)) {
Expand All @@ -667,7 +667,7 @@ function handleAddToQueueResponse(data, doRedirect) {
window.location.href = "TestCaseExecution.jsp?executionQueueId=" + data.queueList[0].queueId;
}
if ((data.nbExe > 1) && doRedirect) {
window.location.href = "ReportingExecutionByTag.jsp?Tag=" + data.tag;
window.location.href = "ReportingExecutionByTag.jsp?Tag=" + encodeURIComponent(data.tag);
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/src/main/webapp/js/pages/TestCaseExecutionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function aoColumnsFunc() {
<span class="glyphicon glyphicon-filter"></span>\n\
</a>';
var tag = '<a id="tagExec' + (obj["id"]) + '" class="btn btn-primary btn-xs marginRight5"\n\
data-toggle="tooltip" title="' + doc.getDocLabel("page_executiondetail", "see_execution_tag") + '" href="./ReportingExecutionByTag.jsp?Tag=' + obj["tag"] + '">\n\
data-toggle="tooltip" title="' + doc.getDocLabel("page_executiondetail", "see_execution_tag") + '" href="./ReportingExecutionByTag.jsp?Tag=' + encodeURIComponent(obj["tag"]) + '">\n\
<span class="glyphicon glyphicon-tag"></span>\n\
</a>';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ function aoColumnsFunc(tableId) {
if (isEmpty(obj["tag"])) {
return "";
} else {
return '<a href="ReportingExecutionByTag.jsp?Tag=' + obj["tag"] + '">' + obj["tag"] + '</a>';
return '<a href="ReportingExecutionByTag.jsp?Tag=' + encodeURIComponent(obj["tag"]) + '">' + obj["tag"] + '</a>';
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions source/src/main/webapp/js/transversalobject/Campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function viewEntryClick(param) {
showLoader("#testcampaignList");


var jqxhr = $.getJSON("ReadCampaign?testcases=true&", "campaign=" + param);
var jqxhr = $.getJSON("ReadCampaign?testcases=true&", "campaign=" + encodeURIComponent(param));
$.when(jqxhr).then(function (data) {
var obj = data["contentTable"];

Expand Down Expand Up @@ -264,7 +264,7 @@ function viewStatEntryClick(param) {
showLoader("#testcampaignList");


var jqxhr = $.getJSON("ReadCampaign?tags=true&", "campaign=" + param);
var jqxhr = $.getJSON("ReadCampaign?tags=true&", "campaign=" + encodeURIComponent(param));
$.when(jqxhr).then(function (data) {
var obj = data["contentTable"];

Expand Down Expand Up @@ -329,7 +329,7 @@ function editEntryClick(param) {

showLoader("#testcampaignList");

var jqxhr = $.getJSON("ReadCampaign?parameters=true&labels=true&eventHooks=true&scheduledEntries=true", "campaign=" + param);
var jqxhr = $.getJSON("ReadCampaign?parameters=true&labels=true&eventHooks=true&scheduledEntries=true", "campaign=" + encodeURIComponent(param));
$.when(jqxhr).then(function (data) {
var obj = data["contentTable"];
var parameters = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function handleAddToQueueResponse(data, doRedirect) {
data.message = data.message + "<br><a href='TestCaseExecution.jsp?executionQueueId=" + data.queueList[0].queueId + "'><button class='btn btn-primary' id='goToExecution'>Open Execution</button></a>";
}
if (data.nbExe > 1) {
data.message = data.message + "<br><a href='ReportingExecutionByTag.jsp?Tag=" + data.tag + "'><button class='btn btn-primary' id='goToTagReport'>Report by Tag</button></a>"
data.message = data.message + "<br><a href='ReportingExecutionByTag.jsp?Tag=" + encodeURIComponent(data.tag) + "'><button class='btn btn-primary' id='goToTagReport'>Report by Tag</button></a>"
}

if ((data.nbExe === 1) && doRedirect) {
Expand Down

0 comments on commit 47138a8

Please sign in to comment.