Skip to content

Commit

Permalink
fix(ui): SVG icons in status views compatible with Firefox (centreon#…
Browse files Browse the repository at this point in the history
…11527)

- Replace in XML responses SVG data by SVG url
- Replace in XSL transformations SVG code by IMG tag
- Avoid the XSL attribute disable-output-escaping

Refs: centreon#11527
Signed-off-by: Grégory Marigot <[email protected]>
  • Loading branch information
proxyconcept committed Sep 7, 2022
1 parent f6b3e9b commit a409bbe
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion www/include/monitoring/status/Hosts/xml/hostXML.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@
} else {
$obj->XML->writeElement("hau", "none");
}
$obj->XML->writeElement("chartIcon", returnSvg("www/img/icons/chart.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("chartIcon", "./img/icons/chart.svg");
$obj->XML->endElement();
}
$dbResult->closeCursor();
Expand Down
2 changes: 1 addition & 1 deletion www/include/monitoring/status/Hosts/xsl/host.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
<xsl:attribute name="href">./main.php?p=204&amp;mode=0&amp;svc_id=<xsl:value-of select="hnl"/></xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="chartIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="chartIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>

Expand Down
4 changes: 2 additions & 2 deletions www/include/monitoring/status/Services/xml/serviceGridXML.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@
]),
])
);
$obj->XML->writeElement("chartIcon", returnSvg("www/img/icons/chart.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("viewIcon", returnSvg("www/img/icons/view.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("chartIcon", "./img/icons/chart.svg");
$obj->XML->writeElement("viewIcon", "./img/icons/view.svg");
$obj->XML->endElement();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@
? $serviceListingDeprecatedUri . '&statusFilter=pending'
: $buildServicesUri($host_name, [$pendingStatus])
);
$obj->XML->writeElement("chartIcon", returnSvg("www/img/icons/chart.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("viewIcon", returnSvg("www/img/icons/view.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("chartIcon", "./img/icons/chart.svg");
$obj->XML->writeElement("viewIcon", "./img/icons/view.svg");
$obj->XML->endElement();
}

Expand Down
2 changes: 1 addition & 1 deletion www/include/monitoring/status/Services/xml/serviceXML.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@
"svc_index",
(isset($graphs[$data["host_id"]][$data["service_id"]]) ? $graphs[$data["host_id"]][$data["service_id"]] : 0)
);
$obj->XML->writeElement("chartIcon", returnSvg("www/img/icons/chart.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("chartIcon", "./img/icons/chart.svg");
$obj->XML->endElement();
}
$dbResult->closeCursor();
Expand Down
2 changes: 1 addition & 1 deletion www/include/monitoring/status/Services/xsl/service.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
<xsl:attribute name="href">main.php?p=204&amp;mode=0&amp;svc_id=<xsl:value-of select="hnl"/>;<xsl:value-of select="sdl"/></xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="chartIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="chartIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
</xsl:if>
Expand Down
4 changes: 2 additions & 2 deletions www/include/monitoring/status/Services/xsl/serviceGrid.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
<xsl:attribute name="isreact">true</xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="viewIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="viewIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="a">
<xsl:attribute name="href">main.php?p=204&amp;mode=0&amp;svc_id=<xsl:value-of select="hnl"/></xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="chartIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="chartIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
</td>
Expand Down
4 changes: 2 additions & 2 deletions www/include/monitoring/status/Services/xsl/serviceSummary.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
<xsl:attribute name="isreact">true</xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="viewIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="viewIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="a">
<xsl:attribute name="href">main.php?p=204&amp;mode=0&amp;svc_id=<xsl:value-of select="hnl"/></xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="chartIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="chartIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@
);
$obj->XML->writeElement(
"chartIcon",
returnSvg("www/img/icons/chart.svg", "var(--icons-fill-color)", 18, 18)
"./img/icons/chart.svg"
);
$obj->XML->writeElement(
"viewIcon",
returnSvg("www/img/icons/view.svg", "var(--icons-fill-color)", 18, 18)
"./img/icons/view.svg"
);
$obj->XML->endElement();
$count++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@
? $serviceListingDeprecatedUri . '&statusFilter=pending'
: $buildServicesUri($host_name, [$pendingStatus])
);
$obj->XML->writeElement("chartIcon", returnSvg("www/img/icons/chart.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("viewIcon", returnSvg("www/img/icons/view.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("chartIcon", "./img/icons/chart.svg");
$obj->XML->writeElement("viewIcon", "./img/icons/view.svg");
$obj->XML->endElement();
$count++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@
<xsl:attribute name="isreact">true</xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="viewIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="viewIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="a">
<xsl:attribute name="href">main.php?p=204&amp;mode=0&amp;svc_id=<xsl:value-of select="hnl"/></xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="chartIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="chartIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@
<xsl:attribute name="isreact">true</xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="viewIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="viewIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="a">
<xsl:attribute name="href">main.php?p=204&amp;mode=0&amp;svc_id=<xsl:value-of select="hnl"/></xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="chartIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="chartIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@
);
$obj->XML->endElement();
}
$obj->XML->writeElement("chartIcon", returnSvg("www/img/icons/chart.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("viewIcon", returnSvg("www/img/icons/view.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("chartIcon", "./img/icons/chart.svg");
$obj->XML->writeElement("viewIcon", "./img/icons/view.svg");
$obj->XML->endElement();
$count++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@
foreach ($hostInfos['states'] as $state => $count) {
$obj->XML->writeElement($state, $count);
}
$obj->XML->writeElement("chartIcon", returnSvg("www/img/icons/chart.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("viewIcon", returnSvg("www/img/icons/view.svg", "var(--icons-fill-color)", 18, 18));
$obj->XML->writeElement("chartIcon", "./img/icons/chart.svg");
$obj->XML->writeElement("viewIcon", "./img/icons/view.svg");
$obj->XML->endElement();
}
$obj->XML->endElement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@
<xsl:attribute name="isreact">true</xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="viewIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="viewIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="a">
<xsl:attribute name="href">main.php?p=20401&amp;mode=0&amp;svc_id=<xsl:value-of select="hnl"/></xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="chartIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="chartIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
<xsl:attribute name="href"><xsl:value-of select="s_listing_uri"/></xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="viewIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="viewIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="a">
<xsl:attribute name="href">main.php?p=20401&amp;mode=0&amp;svc_id=<xsl:value-of select="hnl"/></xsl:attribute>
<xsl:element name="span">
<xsl:attribute name="class">svgs</xsl:attribute>
<xsl:value-of select="chartIcon" disable-output-escaping="yes"/>
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="chartIcon"/></xsl:attribute></xsl:element>
</xsl:element>
</xsl:element>
</td>
Expand Down

0 comments on commit a409bbe

Please sign in to comment.