Skip to content

Commit

Permalink
chore: sonarqube security & maintainability issues fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jumas committed Jul 19, 2024
1 parent a3acb2a commit 3b4543c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
5 changes: 1 addition & 4 deletions src/main/resources/default/wiki.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ body {
p {
line-height: 150% !important;
margin: 0px !important;
padding-top: 10px !important;
}

a,a:link,a:visited {
Expand Down Expand Up @@ -114,10 +115,6 @@ H6, .heading-1-1-1-1-1-1 {
BEGINNING OF COPY'N'PASTE STYLES from wiki.css (lists, tables, code, hint, polarion-Document-workitem...)*/

p {
padding-top: 10px !important;
}

ul {
margin: 1em 0 !important;
padding: 0px 0px 0px 40px !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@

<p>Supported localizations for workitems statuses and severities.</p>
<p>Supported languages are German, French and Italian.</p>
<p>Localization for each language can be imported in XLIFF 2.0 format <a href="https://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html" target="_blank">XLIFF 2.0 specification</a></p>
<p>Localization for each language can be imported in XLIFF 2.0 format <a href="https://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html" target="_blank" rel="noopener">XLIFF 2.0 specification</a></p>

</div>
</div>
Expand Down
12 changes: 7 additions & 5 deletions src/main/resources/webapp/pdf-exporter/js/export-pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ function prepareRequest(projectId, locationPath) {
return undefined;
}
}

let numberedListStyles = null;
if (document.getElementById("custom-list-styles").checked) {
numberedListStyles = document.getElementById("numbered-list-styles").value;
Expand All @@ -138,13 +139,14 @@ function prepareRequest(projectId, locationPath) {

const selectedRoles = [];
if (document.getElementById("selected-roles").checked) {
for (const opt of document.getElementById("roles-selector").options) {
if (opt.selected) {
selectedRoles.push(opt.value);
}
}
const selectedOptions = Array.from(document.getElementById("roles-selector").options).filter(opt => opt.selected);
selectedRoles.push(...selectedOptions.map(opt => opt.value));
}

return buildRequestJson(projectId, locationPath, selectedChapters, numberedListStyles, selectedRoles);
}

function buildRequestJson(projectId, locationPath, selectedChapters, numberedListStyles, selectedRoles) {
return JSON.stringify({
projectId: projectId,
locationPath: locationPath,
Expand Down
16 changes: 9 additions & 7 deletions src/main/resources/webapp/pdf-exporter/js/pdf-exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ const PdfExporter = {
return undefined;
}
}

let numberedListStyles = null;
if (document.getElementById("popup-custom-list-styles").checked) {
numberedListStyles = document.getElementById("popup-numbered-list-styles").value;
Expand All @@ -529,13 +530,14 @@ const PdfExporter = {

const selectedRoles = [];
if (document.getElementById("popup-selected-roles").checked) {
for (const opt of document.getElementById("popup-roles-selector").options) {
if (opt.selected) {
selectedRoles.push(opt.value);
}
}
const selectedOptions = Array.from(document.getElementById("popup-roles-selector").options).filter(opt => opt.selected);
selectedRoles.push(...selectedOptions.map(opt => opt.value));
}

return this.buildRequestJson(selectedChapters, numberedListStyles, selectedRoles);
},

buildRequestJson: function (selectedChapters, numberedListStyles, selectedRoles) {
const report = this.exportContext.documentType === "report";
return JSON.stringify({
projectId: this.exportContext.getProjectId(),
Expand All @@ -557,7 +559,7 @@ const PdfExporter = {
cutEmptyWIAttributes: !report && document.getElementById('popup-cut-empty-wi-attributes').checked,
cutLocalUrls: document.getElementById("popup-cut-urls").checked,
followHTMLPresentationalHints: document.getElementById("popup-presentational-hints").checked,
numberedListStyles: document.getElementById("popup-numbered-list-styles").value,
numberedListStyles: numberedListStyles,
chapters: selectedChapters,
language: !report && document.getElementById('popup-localization').checked ? document.getElementById("popup-language").value : null,
liveDocumentLanguage: this.exportContext.liveDocumentLanguage,
Expand Down Expand Up @@ -605,7 +607,7 @@ const PdfExporter = {
},

visibleIf: function (elementId, condition) {
document.getElementById(elementId).style.display = condition ? "visible" : "hidden";
document.getElementById(elementId).style.visibility = condition ? "visible" : "hidden";
},

setSelector: function (elementId, value) {
Expand Down

0 comments on commit 3b4543c

Please sign in to comment.