Added random cover graphic selector
This commit is contained in:
parent
7ed9e71ec5
commit
e07e02a486
13
xml/graphics/frontpage_graphics.xml
Normal file
13
xml/graphics/frontpage_graphics.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<frontpage_graphics>
|
||||||
|
<!-- doctype name should be equal to doc root element -->
|
||||||
|
<doctype name="pentest_report">
|
||||||
|
<!-- list available covers below -->
|
||||||
|
<file name="frontpage_report_1.jpg"/>
|
||||||
|
<file name="frontpage_report_2.jpg"/>
|
||||||
|
<!--<file name="frontpage_report_3.jpg"/>-->
|
||||||
|
</doctype>
|
||||||
|
<doctype name="offerte">
|
||||||
|
<file name="frontpage_quote.jpg"/>
|
||||||
|
</doctype>
|
||||||
|
</frontpage_graphics>
|
||||||
|
Before Width: | Height: | Size: 187 KiB After Width: | Height: | Size: 187 KiB |
BIN
xml/graphics/frontpage_report_2.jpg
Normal file
BIN
xml/graphics/frontpage_report_2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
@ -1,7 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||||
exclude-result-prefixes="xs" version="2.0">
|
xmlns:my="http://www.radical.sexy"
|
||||||
|
exclude-result-prefixes="my xs" version="2.0">
|
||||||
|
|
||||||
|
|
||||||
<xsl:template name="layout-master-set">
|
<xsl:template name="layout-master-set">
|
||||||
@ -10,7 +11,11 @@
|
|||||||
<!-- Cover page -->
|
<!-- Cover page -->
|
||||||
<fo:simple-page-master master-name="Front-Cover" xsl:use-attribute-sets="PortraitPage">
|
<fo:simple-page-master master-name="Front-Cover" xsl:use-attribute-sets="PortraitPage">
|
||||||
<fo:region-body region-name="cover-flow" xsl:use-attribute-sets="region-body-cover"
|
<fo:region-body region-name="cover-flow" xsl:use-attribute-sets="region-body-cover"
|
||||||
/>
|
>
|
||||||
|
<xsl:call-template name="select_frontpage_graphic">
|
||||||
|
<xsl:with-param name="doctype" select="local-name(/*)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</fo:region-body>
|
||||||
</fo:simple-page-master>
|
</fo:simple-page-master>
|
||||||
<!-- FrontMatter Content Pages (Odd) -->
|
<!-- FrontMatter Content Pages (Odd) -->
|
||||||
<fo:simple-page-master master-name="Front-Content-odd"
|
<fo:simple-page-master master-name="Front-Content-odd"
|
||||||
@ -78,6 +83,20 @@
|
|||||||
</fo:layout-master-set>
|
</fo:layout-master-set>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="select_frontpage_graphic">
|
||||||
|
<xsl:param name="doctype" select="'generic'"/>
|
||||||
|
<xsl:variable name="graphicsdoc"
|
||||||
|
select="document('../graphics/frontpage_graphics.xml')/frontpage_graphics/doctype[@name = $doctype]"/>
|
||||||
|
<xsl:variable name="available_frontpage_graphics" select="count($graphicsdoc/file)"/>
|
||||||
|
<xsl:variable name="current_second" select="seconds-from-dateTime(current-dateTime())"/>
|
||||||
|
<xsl:message><xsl:value-of select="$current_second"/></xsl:message>
|
||||||
|
<!-- taking the current second as a 'random number generator' -->
|
||||||
|
<xsl:variable name="selected_graphic" select="ceiling(number($available_frontpage_graphics div 60 * $current_second))"/>
|
||||||
|
<xsl:variable name="frontpage_graphic" select="$graphicsdoc/file[$selected_graphic]/@name"/>
|
||||||
|
<xsl:attribute name="background-image"
|
||||||
|
>url(../graphics/<xsl:value-of select="$frontpage_graphic"/>)</xsl:attribute>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="page_footer">
|
<xsl:template name="page_footer">
|
||||||
<fo:static-content flow-name="region-after-content-odd" xsl:use-attribute-sets="FooterFont">
|
<fo:static-content flow-name="region-after-content-odd" xsl:use-attribute-sets="FooterFont">
|
||||||
<fo:block xsl:use-attribute-sets="footer-odd">
|
<fo:block xsl:use-attribute-sets="footer-odd">
|
||||||
|
|||||||
@ -26,8 +26,7 @@
|
|||||||
|
|
||||||
<!-- Pages -->
|
<!-- Pages -->
|
||||||
<xsl:attribute-set name="region-body-cover">
|
<xsl:attribute-set name="region-body-cover">
|
||||||
<xsl:attribute name="background-image"
|
|
||||||
>url(../graphics/frontpage_report.jpg)</xsl:attribute>
|
|
||||||
</xsl:attribute-set>
|
</xsl:attribute-set>
|
||||||
|
|
||||||
<!-- Findings -->
|
<!-- Findings -->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user