Owen Leonard
eb92d94be1
The goal of this theme is to provide a fully-responsive OPAC which offers a high level of functionality across multiple devices with varied viewport sizes. Its style is based on the CCSR theme, with elements of the Bootstrap framework providing default styling of buttons, menus, modals, etc. The Bootstrap grid is used everywhere, but Bootstrap's default responsive breakpoints have been expanded to allow for better flexibility for our needs. All non-translation-depended files are in the root directory of this new theme: css, images, itemtypeimg, js, less, and lib. Languages.pm has been modified to ignore the new directories when parsing the theme language directories. This theme introduces the use of LESS (http://lesscss.org/) to build CSS. Three LESS files can be found in the "less" directory: mixins.less, opac.less, and responsive.less. These three files are compiled into one CSS file for production: opac.css. "Base" theme styles are found in opac.less. A few "mixins" (http://lesscss.org/#-mixins) are found in mixins.less. Any CSS which is conditional on specific media queries is found in responsive.less. At the template level some general sturctural changes have been made. For the most part JavaScript is now at the end of each template as is recommended for performance reasons. JavaScript formerly in doc-head-close.inc is now in opac-bottom.inc. In order to be able to maintain this structure and accommodate page-specific scripts at the same time the use of BLOCK and PROCESS are added. By default opac-bottom.inc will PROCESS a "jsinclude" block: [% PROCESS jsinclude %] Each page template in the theme must contain this block, even if it is empty: [% BLOCK jsinclude %][% END %] Pages which require that page-specific JavaScript be inserted can add it to the jsinclude block and it will appear correctly at the bottom of the rendered page. The same is true for page-specific CSS. Each page contains a cssinclude block: [% BLOCK cssinclude %][% END %] ...which is processed in doc-head-close.inc: [% PROCESS cssinclude %] Using these methods helps us maintain a strict separation of CSS links and blocks (at the top of each page) and JavaScript (at the bottom). A few exceptions are made for some JavaScript which must be processed sooner: respond.js (https://github.com/scottjehl/Respond, conditionally applied to Internet Explorer versions < 9 to allow for layout responsiveness), the _() function required for JS translatability, and Modernizr (http://modernizr.com/, a script which detects browser features and allows us to conditionally load JavaScript based on available features--or lack thereof). Another new JavaScript dependency in this theme is enquire.js (http://wicky.nillia.ms/enquire.js/), which lets us trigger JavaScript events based on viewport size. I have made an effort to re-indent the templates in a sane way, eliminating trailing spaces and tabs. However, I have not wrapped lines at a specific line length. In order to improve template legibility I have also tried to insert comments indicating the origin of closing tags like <div> or template directives like [% END %]: </div> <!-- / .container-fluid --> [% END # / IF ( OpacBrowseResults && busc ) %] TESTING Proper testing of this theme is no easy task: Every template has been touched. Each page should work reasonable well at a variety of screen dimensions. Pages should be tested under many conditions which are controlled by toggling OPAC system preferences on and off. A variety of devices, platforms, and browsers should be tested. Signed-off-by: Galen Charlton <gmc@esilibrary.com>
244 lines
10 KiB
XML
244 lines
10 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE stylesheet [<!ENTITY nbsp " " >]>
|
|
|
|
<xsl:stylesheet version="1.0"
|
|
xmlns:marc="http://www.loc.gov/MARC21/slim"
|
|
xmlns:items="http://www.koha-community.org/items"
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
exclude-result-prefixes="marc items">
|
|
|
|
<xsl:import href="UNIMARCslimUtils.xsl"/>
|
|
<xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
|
|
<xsl:key name="item-by-status" match="items:item" use="items:status"/>
|
|
<xsl:key name="item-by-status-and-branch" match="items:item" use="concat(items:status, ' ', items:homebranch)"/>
|
|
|
|
<xsl:template match="/">
|
|
<xsl:apply-templates/>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="marc:record">
|
|
<xsl:variable name="leader" select="marc:leader"/>
|
|
<xsl:variable name="leader6" select="substring($leader,7,1)"/>
|
|
<xsl:variable name="leader7" select="substring($leader,8,1)"/>
|
|
<xsl:variable name="biblionumber"
|
|
select="marc:datafield[@tag=090]/marc:subfield[@code='a']"/>
|
|
<xsl:variable name="isbn"
|
|
select="marc:datafield[@tag=010]/marc:subfield[@code='a']"/>
|
|
|
|
<xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/>
|
|
<xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/>
|
|
|
|
<xsl:if test="marc:datafield[@tag=200]">
|
|
<xsl:for-each select="marc:datafield[@tag=200]">
|
|
<xsl:call-template name="addClassRtl" />
|
|
<xsl:for-each select="marc:subfield">
|
|
<xsl:choose>
|
|
<xsl:when test="@code='a'">
|
|
<xsl:variable name="title" select="."/>
|
|
<xsl:variable name="ntitle"
|
|
select="translate($title, 'ˆ‰˜œ','')"/>
|
|
<a>
|
|
<xsl:attribute name="href">
|
|
<xsl:text>/cgi-bin/koha/opac-detail.pl?biblionumber=</xsl:text>
|
|
<xsl:value-of select="$biblionumber"/>
|
|
</xsl:attribute>
|
|
<xsl:value-of select="$ntitle" />
|
|
</a>
|
|
</xsl:when>
|
|
<xsl:when test="@code='b'">
|
|
<xsl:text> [</xsl:text>
|
|
<xsl:value-of select="."/>
|
|
<xsl:text>]</xsl:text>
|
|
</xsl:when>
|
|
<xsl:when test="@code='d'">
|
|
<xsl:text> = </xsl:text>
|
|
<xsl:value-of select="."/>
|
|
</xsl:when>
|
|
<xsl:when test="@code='e'">
|
|
<xsl:text> : </xsl:text>
|
|
<xsl:value-of select="."/>
|
|
</xsl:when>
|
|
<xsl:when test="@code='f'">
|
|
<xsl:text> / </xsl:text>
|
|
<xsl:value-of select="."/>
|
|
</xsl:when>
|
|
<xsl:when test="@code='g'">
|
|
<xsl:text> ; </xsl:text>
|
|
<xsl:value-of select="."/>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:text>, </xsl:text>
|
|
<xsl:value-of select="."/>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:for-each>
|
|
</xsl:for-each>
|
|
</xsl:if>
|
|
|
|
<xsl:call-template name="tag_title">
|
|
<xsl:with-param name="tag">454</xsl:with-param>
|
|
<xsl:with-param name="label">Translation of</xsl:with-param>
|
|
</xsl:call-template>
|
|
|
|
<xsl:call-template name="tag_title">
|
|
<xsl:with-param name="tag">461</xsl:with-param>
|
|
<xsl:with-param name="label">Set Level</xsl:with-param>
|
|
</xsl:call-template>
|
|
|
|
<xsl:call-template name="tag_title">
|
|
<xsl:with-param name="tag">464</xsl:with-param>
|
|
<xsl:with-param name="label">Piece-Analytic Level</xsl:with-param>
|
|
</xsl:call-template>
|
|
|
|
<xsl:call-template name="tag_210" />
|
|
|
|
<xsl:call-template name="tag_215" />
|
|
|
|
<span class="results_summary">
|
|
<span class="label">Availability: </span>
|
|
<xsl:choose>
|
|
<xsl:when test="marc:datafield[@tag=856]">
|
|
<xsl:for-each select="marc:datafield[@tag=856]">
|
|
<xsl:choose>
|
|
<xsl:when test="@ind2=0">
|
|
<a>
|
|
<xsl:attribute name="href">
|
|
<xsl:value-of select="marc:subfield[@code='u']"/>
|
|
</xsl:attribute>
|
|
<xsl:choose>
|
|
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
|
|
<xsl:call-template name="subfieldSelect">
|
|
<xsl:with-param name="codes">y3z</xsl:with-param>
|
|
</xsl:call-template>
|
|
</xsl:when>
|
|
<xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
|
|
Click here to access online
|
|
</xsl:when>
|
|
</xsl:choose>
|
|
</a>
|
|
<xsl:choose>
|
|
<xsl:when test="position()=last()"></xsl:when>
|
|
<xsl:otherwise> | </xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:when>
|
|
</xsl:choose>
|
|
</xsl:for-each>
|
|
</xsl:when>
|
|
<xsl:when test="count(key('item-by-status', 'available'))=0 and count(key('item-by-status', 'reference'))=0">
|
|
No copies available
|
|
</xsl:when>
|
|
<xsl:when test="count(key('item-by-status', 'available'))>0">
|
|
<span class="available">
|
|
<b><xsl:text>Copies available for loan: </xsl:text></b>
|
|
<xsl:variable name="available_items" select="key('item-by-status', 'available')"/>
|
|
<xsl:choose>
|
|
<xsl:when test="$singleBranchMode=1">
|
|
<xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
|
|
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
|
|
<xsl:text> (</xsl:text>
|
|
<xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
|
|
<xsl:text>)</xsl:text>
|
|
<xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
|
|
</xsl:for-each>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
|
|
<xsl:value-of select="items:homebranch"/>
|
|
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">[<xsl:value-of select="items:itemcallnumber"/>]
|
|
</xsl:if>
|
|
<xsl:text> (</xsl:text>
|
|
<xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
|
|
<xsl:text>)</xsl:text>
|
|
<xsl:choose>
|
|
<xsl:when test="position()=last()">
|
|
<xsl:text>. </xsl:text>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:text>, </xsl:text>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:for-each>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</span>
|
|
</xsl:when>
|
|
</xsl:choose>
|
|
<xsl:choose>
|
|
<xsl:when test="count(key('item-by-status', 'reference'))>0">
|
|
<span class="available">
|
|
<b><xsl:text>Copies available for reference: </xsl:text></b>
|
|
<xsl:variable name="reference_items"
|
|
select="key('item-by-status', 'reference')"/>
|
|
<xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
|
|
<xsl:value-of select="items:homebranch"/>
|
|
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">[<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
|
|
<xsl:text> (</xsl:text>
|
|
<xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
|
|
<xsl:text>)</xsl:text>
|
|
<xsl:choose>
|
|
<xsl:when test="position()=last()">
|
|
<xsl:text>. </xsl:text>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:text>, </xsl:text>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:for-each>
|
|
</span>
|
|
</xsl:when>
|
|
</xsl:choose>
|
|
<xsl:if test="count(key('item-by-status', 'Checked out'))>0">
|
|
<span class="unavailable">
|
|
<xsl:text>Checked out (</xsl:text>
|
|
<xsl:value-of select="count(key('item-by-status', 'Checked out'))"/>
|
|
<xsl:text>). </xsl:text>
|
|
</span>
|
|
</xsl:if>
|
|
<xsl:if test="count(key('item-by-status', 'Withdrawn'))>0">
|
|
<span class="unavailable">
|
|
<xsl:text>Withdrawn (</xsl:text>
|
|
<xsl:value-of select="count(key('item-by-status', 'Withdrawn'))"/>
|
|
<xsl:text>). </xsl:text>
|
|
</span>
|
|
</xsl:if>
|
|
<xsl:if test="$hidelostitems='0' and count(key('item-by-status', 'Lost'))>0">
|
|
<span class="unavailable">
|
|
<xsl:text>Lost (</xsl:text>
|
|
<xsl:value-of select="count(key('item-by-status', 'Lost'))"/>
|
|
<xsl:text>). </xsl:text>
|
|
</span>
|
|
</xsl:if>
|
|
<xsl:if test="count(key('item-by-status', 'Damaged'))>0">
|
|
<span class="unavailable">
|
|
<xsl:text>Damaged (</xsl:text>
|
|
<xsl:value-of select="count(key('item-by-status', 'Damaged'))"/>
|
|
<xsl:text>). </xsl:text>
|
|
</span>
|
|
</xsl:if>
|
|
<xsl:if test="count(key('item-by-status', 'On order'))>0">
|
|
<span class="unavailable">
|
|
<xsl:text>On order (</xsl:text>
|
|
<xsl:value-of select="count(key('item-by-status', 'On order'))"/>
|
|
<xsl:text>). </xsl:text>
|
|
</span>
|
|
</xsl:if>
|
|
<xsl:if test="count(key('item-by-status', 'In transit'))>0">
|
|
<span class="unavailable">
|
|
<xsl:text>In transit (</xsl:text>
|
|
<xsl:value-of select="count(key('item-by-status', 'In transit'))"/>
|
|
<xsl:text>). </xsl:text>
|
|
</span>
|
|
</xsl:if>
|
|
<xsl:if test="count(key('item-by-status', 'Waiting'))>0">
|
|
<span class="unavailable">
|
|
<xsl:text>On hold (</xsl:text>
|
|
<xsl:value-of select="count(key('item-by-status', 'Waiting'))"/>
|
|
<xsl:text>). </xsl:text>
|
|
</span>
|
|
</xsl:if>
|
|
</span>
|
|
|
|
</xsl:template>
|
|
|
|
</xsl:stylesheet>
|