Warning, /graphics/digikam/core/dplugins/generic/tools/htmlgallery/themes/html5responsive/template.xsl is written in an unsupported language. File is not indexed.
0001 <?xml version="1.0" encoding="UTF-8" ?>
0002
0003 <!--
0004 * ============================================================
0005 *
0006 * This file is a part of a digiKam custom HTML gallery theme.
0007 * https://www.digikam.org
0008 *
0009 * Date : 2019-11-17
0010 * Description : An HTML gallery theme based on HTML5, CSS3,
0011 * UTF-8 and the PhotoSwipe utility.
0012 *
0013 * SPDX-FileCopyrightText: 2007 by Wojciech Jarosz <jiri at boha dot cz>
0014 * SPDX-FileCopyrightText: 2019 by Bobulous <https://www.bobulous.org.uk>
0015 *
0016 * SPDX-License-Identifier: GPL-2.0-or-later
0017 *
0018 * ============================================================
0019 -->
0020
0021 <xsl:transform version="1.0"
0022 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
0023 xmlns:exsl="http://exslt.org/common"
0024 xmlns:date="http://exslt.org/dates-and-times"
0025 extension-element-prefixes="exsl date">
0026
0027 <xsl:import href="resources/xslt/xmlJsEscapeTemplate.xsl"/>
0028 <xsl:import href="resources/xslt/convertNewlinesToHtmlBreaksTemplate.xsl"/>
0029
0030 <xsl:output method="html"
0031 indent="yes"
0032 encoding="utf-8"
0033 doctype-system="about:legacy-compat" />
0034
0035
0036 <!-- ##################### VARIABLE INITIALIZATION #################### -->
0037 <!-- Initialize some useful variables -->
0038 <xsl:variable name="theme" select="'grey'" />
0039 <xsl:variable name="outerBorder" select="boolean(0)" />
0040 <xsl:variable name="resizeSpeed" select="10" />
0041 <xsl:variable name="maxOpacity" select="80" />
0042 <xsl:variable name="navType" select="1" />
0043 <xsl:variable name="autoResize" select="boolean(1)" />
0044 <xsl:variable name="doAnimations" select="boolean(1)" />
0045 <xsl:variable name="showNavigation" select="boolean(1)" />
0046 <xsl:variable name="numCollections" select="count(collections/collection)"/>
0047
0048
0049 <!-- ##################### STARTING POINT ################################# -->
0050 <!--
0051 Determines if we need to create a collectionListPage or just one
0052 collectionStartPage.
0053 -->
0054 <xsl:template match="/">
0055 <xsl:choose>
0056 <xsl:when test="$numCollections > 1">
0057 <xsl:call-template name="collectionListPage"/>
0058 </xsl:when>
0059 <xsl:otherwise>
0060 <xsl:for-each select="collections/collection">
0061 <xsl:call-template name="generateDetailPages">
0062 <xsl:with-param name="soleCollection">true</xsl:with-param>
0063 </xsl:call-template>
0064 <xsl:call-template name="collectionPage">
0065 <xsl:with-param name="pageFilename">index.html</xsl:with-param>
0066 <xsl:with-param name="pageNum" select="0"/>
0067 </xsl:call-template>
0068 </xsl:for-each>
0069 </xsl:otherwise>
0070 </xsl:choose>
0071 </xsl:template>
0072 <!-- ##################### END STARTING POINT ############################# -->
0073
0074 <!-- ##################### COLLECTION LIST PAGE GENERATION ################ -->
0075 <!--
0076 If more than one collection was selected for export then a collectionListPage
0077 is generated which provides a list of all the individual collections.
0078 -->
0079 <xsl:template name="collectionListPage">
0080 <html>
0081 <head>
0082 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
0083 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
0084 <meta name="generator" content="digiKam"/>
0085 <title><xsl:value-of select="$i18nCollectionList"/></title>
0086 <link rel="stylesheet" type="text/css" media="screen">
0087 <xsl:attribute name="href">html5responsive/resources/css/<xsl:value-of select="$style"/></xsl:attribute>
0088 </link>
0089 </head>
0090 <body class="collectionListPage">
0091 <header>
0092 <h1><xsl:value-of select="$i18nCollectionList"/></h1>
0093 </header>
0094 <main>
0095 <ul class="collectionList">
0096 <xsl:for-each select="collections/collection">
0097 <xsl:call-template name="generateDetailPages">
0098 <xsl:with-param name="soleCollection">false</xsl:with-param>
0099 </xsl:call-template>
0100 <xsl:variable name="imageAspect">
0101 <xsl:call-template name="aspectLabel">
0102 <xsl:with-param name="imageWidth" select="image[1]/thumbnail/@width"/>
0103 <xsl:with-param name="imageHeight" select="image[1]/thumbnail/@height"/>
0104 </xsl:call-template>
0105 </xsl:variable>
0106 <xsl:variable name="altName" select="name"/>
0107 <li class="{$imageAspect}">
0108 <figure>
0109 <a href="{fileName}.html" class="thumbnailLink">
0110 <!-- Use first image as collection image -->
0111 <img src="{fileName}/{image[1]/thumbnail/@fileName}" width="{image[1]/thumbnail/@width}" height="{image[1]/thumbnail/@height}" alt="{$altName}"/>
0112 </a>
0113 <figcaption><a href="{fileName}.html"><xsl:value-of select="name"/></a></figcaption>
0114 </figure>
0115 </li>
0116 <exsl:document href="{fileName}.html"
0117 method="html"
0118 indent="yes"
0119 encoding="utf-8"
0120 doctype-system="about:legacy-compat">
0121 <xsl:call-template name="collectionPage">
0122 <xsl:with-param name="pageFilename"><xsl:value-of select="fileName"/>.html</xsl:with-param>
0123 <xsl:with-param name="pageNum" select="0"/>
0124 </xsl:call-template>
0125 </exsl:document>
0126 </xsl:for-each>
0127 </ul>
0128 </main>
0129 <!-- /content -->
0130 <xsl:if test="$author != ''">
0131 <footer>
0132 <xsl:call-template name="copyrightNotice"/>
0133 </footer>
0134 </xsl:if>
0135 </body>
0136 </html>
0137 </xsl:template>
0138 <!-- ##################### END COLLECTION LIST PAGE GENERATION ############ -->
0139
0140 <xsl:template name="aspectLabel">
0141 <xsl:param name="imageWidth"/>
0142 <xsl:param name="imageHeight"/>
0143 <xsl:choose>
0144 <xsl:when test="$imageWidth > $imageHeight">
0145 <xsl:text>landscape</xsl:text>
0146 </xsl:when>
0147 <xsl:when test="$imageWidth < $imageHeight">
0148 <xsl:text>portrait</xsl:text>
0149 </xsl:when>
0150 <xsl:otherwise>
0151 <xsl:text>square</xsl:text>
0152 </xsl:otherwise>
0153 </xsl:choose>
0154 </xsl:template>
0155
0156 <xsl:template name="copyrightNotice">
0157 <div class="copyright" lang="en">
0158 <xsl:text>All Images Copyright © </xsl:text>
0159 <xsl:value-of select="date:year()"/>
0160 <xsl:text> </xsl:text>
0161 <xsl:value-of select="$author"/>
0162 </div>
0163 </xsl:template>
0164
0165
0166 <!-- ##################### COLLECTION DETAIL PAGE GENERATION ################## -->
0167 <!--
0168 Each photo in a collection has a detail page which displays only that photo and
0169 data related to that photo (title, description, EXIF data, etc). This template
0170 generates all detail pages for the current collection.
0171 -->
0172 <xsl:template name="generateDetailPages">
0173 <xsl:param name="soleCollection"/>
0174 <xsl:variable name="folder" select='fileName'/>
0175 <xsl:for-each select="image">
0176 <xsl:variable name="photoIndex" select="position() - 1"/>
0177 <xsl:variable name="pageIndex" select="floor((position() - 1) div $pageSize)"/>
0178 <!-- TODO: MODIFY THIS SO THAT EVERY PHOTO POINTS TO THE COLLECTION THUMBNAIL PAGE WHICH HOLDS IT (not just to the first thumbnail page) -->
0179 <xsl:variable name="pageFilename">
0180 <xsl:choose>
0181 <xsl:when test="$soleCollection = 'true' and $pageIndex = 0">
0182 <xsl:text>../index.html</xsl:text>
0183 </xsl:when>
0184 <xsl:otherwise><xsl:text>../</xsl:text><xsl:value-of select="$folder"/>
0185 <xsl:choose>
0186 <xsl:when test="$pageIndex = 0">
0187 <xsl:text>.html</xsl:text>
0188 </xsl:when>
0189 <xsl:otherwise>
0190 <xsl:text>_</xsl:text><xsl:value-of select="$pageIndex"/><xsl:text>.html</xsl:text>
0191 </xsl:otherwise>
0192 </xsl:choose>
0193 </xsl:otherwise>
0194 </xsl:choose>
0195 </xsl:variable>
0196 <exsl:document href='{$folder}/{full/@fileName}.html'
0197 method="html"
0198 indent="yes"
0199 encoding="utf-8"
0200 doctype-system="about:legacy-compat">
0201 <xsl:call-template name="imagePage">
0202 <xsl:with-param name="indexPage"><xsl:value-of select="$pageFilename"/></xsl:with-param>
0203 </xsl:call-template>
0204 </exsl:document>
0205 </xsl:for-each>
0206 </xsl:template>
0207 <!-- ##################### END COLLECTION DETAIL PAGE GENERATION ############## -->
0208
0209
0210 <!-- ##################### COLLECTION PAGE GENERATION ##################### -->
0211 <!--
0212 A page of thumbnails for a sigle collection.
0213 If there are too many thumbnails to fit on one page then the content is split
0214 up into multiple pages.
0215 -->
0216 <xsl:template name="collectionPage">
0217 <xsl:param name="pageNum"/>
0218 <xsl:param name="pageFilename"/>
0219 <!-- <xsl:variable name="pageFilename" select="concat(fileName, '_', $pageNum, '.html')"/> -->
0220 <html>
0221 <head>
0222 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
0223 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
0224 <meta name="generator" content="digiKam"/>
0225 <title><xsl:value-of select="name"/></title>
0226 <link rel="stylesheet" type="text/css" media="screen">
0227 <xsl:attribute name="href">html5responsive/resources/css/<xsl:value-of select="$style"/></xsl:attribute>
0228 </link>
0229 <xsl:if test="$usePhotoSwipe = 'true'">
0230 <xsl:call-template name="photoSwipeStylesheets"/>
0231 <xsl:call-template name="photoSwipeJavaScriptLibraries"/>
0232 </xsl:if>
0233 </head>
0234 <body class="collectionPage">
0235 <xsl:variable name="numPages" select="ceiling(count(image) div $pageSize)"/>
0236 <xsl:variable name="folder" select='fileName'/>
0237 <xsl:variable name="pageName" select="name"/>
0238
0239 <header>
0240 <div id="pageTitleAndPagination">
0241 <h1>
0242 <xsl:value-of select="name"/>
0243 </h1>
0244 <xsl:if test="$numCollections > 1 or $paginationLocation = 'top' or $paginationLocation = 'both'">
0245 <nav class="topOfPage">
0246 <xsl:if test="$numCollections > 1">
0247 <p class="upLink albumListLink">
0248 <a href="index.html">
0249 <xsl:value-of select="$i18nCollectionList"/>
0250 </a>
0251 </p>
0252 </xsl:if>
0253 <xsl:if test="$paginationLocation = 'top' or $paginationLocation = 'both'">
0254 <xsl:call-template name="pagination">
0255 <xsl:with-param name="numPages" select="$numPages"/>
0256 <xsl:with-param name="pageNum" select="$pageNum"/>
0257 <xsl:with-param name="paginationMode" select="$paginationModeTop"/>
0258 </xsl:call-template>
0259 </xsl:if>
0260 </nav>
0261 </xsl:if>
0262 </div>
0263 </header>
0264 <main>
0265 <ol class="imageList">
0266 <!-- Add thumbnails and links to all images for the current page. -->
0267 <xsl:for-each select="image[(position() >= ($pageNum * $pageSize) + 1) and (position() <= $pageSize + ($pageSize * $pageNum))]">
0268 <xsl:variable name="photoIndex" select="$pageSize * $pageNum + position() - 1"/>
0269 <xsl:variable name="jiggleHooks">
0270 <xsl:if test="$addJiggle = 'true'">
0271 <xsl:variable name="mod2" select="$photoIndex mod 2"/>
0272 <xsl:variable name="mod3" select="$photoIndex mod 3"/>
0273 <xsl:variable name="mod5" select="$photoIndex mod 5"/>
0274 <xsl:text>mod2val</xsl:text>
0275 <xsl:value-of select="$mod2"/>
0276 <xsl:text> mod3val</xsl:text>
0277 <xsl:value-of select="$mod3"/>
0278 <xsl:text> mod5val</xsl:text>
0279 <xsl:value-of select="$mod5"/>
0280 </xsl:if>
0281 </xsl:variable>
0282 <xsl:variable name="imageAspect">
0283 <xsl:call-template name="aspectLabel">
0284 <xsl:with-param name="imageWidth" select="thumbnail/@width"/>
0285 <xsl:with-param name="imageHeight" select="thumbnail/@height"/>
0286 </xsl:call-template>
0287 </xsl:variable>
0288 <li class="{$imageAspect} {$jiggleHooks}">
0289 <figure>
0290 <xsl:variable name="onClickAction">
0291 <xsl:if test="$usePhotoSwipe = 'true'">
0292 <xsl:text>openImageInPhotoSwipe(</xsl:text>
0293 <xsl:value-of select="$photoIndex"/>
0294 <xsl:text>); return false;</xsl:text>
0295 </xsl:if>
0296 </xsl:variable>
0297 <a class="thumbnailLink" href="{$folder}/{full/@fileName}.html" id="collectionPhotoIndex_{$photoIndex}" onclick="{$onClickAction}">
0298 <img src="{$folder}/{thumbnail/@fileName}" width="{thumbnail/@width}" height="{thumbnail/@height}" alt="{title}"/>
0299 </a>
0300 <figcaption>
0301 <p class="imageTitle"><xsl:value-of select="title"/></p>
0302 <xsl:if test="date != ''">
0303 <p class="imageDate">
0304 <time datetime="{date}">
0305 <xsl:value-of select="date"/>
0306 </time>
0307 </p>
0308 </xsl:if>
0309 <xsl:if test="description != ''">
0310 <p class="imageDescription">
0311 <xsl:call-template name="convertNewlinesToHtmlBreaks">
0312 <xsl:with-param name="rawText" select="description"/>
0313 </xsl:call-template>
0314 </p>
0315 </xsl:if>
0316 </figcaption>
0317 </figure>
0318 </li>
0319 </xsl:for-each>
0320 </ol>
0321 </main>
0322 <xsl:if test="$paginationLocation = 'bottom' or $paginationLocation = 'both' or $author != ''">
0323 <footer>
0324 <div class="paginationAndCopyright">
0325 <xsl:if test="($paginationLocation = 'bottom') or ($paginationLocation = 'both')">
0326 <nav class="bottomOfPage">
0327 <xsl:call-template name="pagination">
0328 <xsl:with-param name="numPages" select="$numPages"/>
0329 <xsl:with-param name="pageNum" select="$pageNum"/>
0330 <xsl:with-param name="paginationMode" select="$paginationModeBottom"/>
0331 </xsl:call-template>
0332 </nav>
0333 </xsl:if>
0334 <xsl:if test="$author != ''">
0335 <xsl:call-template name="copyrightNotice"/>
0336 </xsl:if>
0337 </div>
0338 </footer>
0339 </xsl:if>
0340
0341 <xsl:if test="$usePhotoSwipe = 'true'">
0342 <xsl:call-template name="photoSwipeDomElements"/>
0343 <xsl:call-template name="photoSwipeJavaScriptInitialisation">
0344 <xsl:with-param name="numPages" select="$numPages"/>
0345 <xsl:with-param name="pageNum" select="$pageNum"/>
0346 <xsl:with-param name="folder" select="$folder"/>
0347 </xsl:call-template>
0348 </xsl:if>
0349 </body>
0350 </html>
0351 <xsl:if test="$pageNum = 0">
0352 <!-- Generate all subsequent collection pages. -->
0353 <xsl:call-template name="collectionPages"/>
0354 </xsl:if>
0355 </xsl:template>
0356 <!-- ##################### END COLLECTION PAGE GENERATION ################# -->
0357
0358
0359 <!-- ##################### PHOTOSWIPE COMPONENT GENERATION ###################### -->
0360 <!--
0361 Generates JavaScript and object data required by the PhotoSwipe software.
0362 -->
0363
0364 <xsl:template name="photoSwipeStylesheets">
0365 <link rel="stylesheet" href="html5responsive/resources/css/photoswipe.css" type="text/css" media="screen"/>
0366 <link rel="stylesheet" href="html5responsive/resources/css/default-skin/default-skin.css" type="text/css" media="screen"/>
0367 </xsl:template>
0368
0369 <xsl:template name="photoSwipeDomElements">
0370 <!-- Root element of PhotoSwipe. Must have class pswp. -->
0371 <div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
0372 <!-- Background of PhotoSwipe.
0373 It's a separate element as animating opacity is faster than rgba(). -->
0374 <div class="pswp__bg"></div>
0375 <!-- Slides wrapper with overflow:hidden. -->
0376 <div class="pswp__scroll-wrap">
0377 <!-- Container that holds slides.
0378 PhotoSwipe keeps only 3 of them in the DOM to save memory.
0379 Don't modify these 3 pswp__item elements, data is added later on. -->
0380 <div class="pswp__container">
0381 <div class="pswp__item"></div>
0382 <div class="pswp__item"></div>
0383 <div class="pswp__item"></div>
0384 </div>
0385 <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
0386 <div class="pswp__ui pswp__ui--hidden">
0387 <div class="pswp__top-bar">
0388 <!-- Controls are self-explanatory. Order can be changed. -->
0389 <div class="pswp__counter"></div>
0390 <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
0391 <button class="pswp__button pswp__button--share" title="Share"></button>
0392 <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
0393 <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
0394 <!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
0395 <!-- element will get class pswp__preloader_active when preloader is running -->
0396 <div class="pswp__preloader">
0397 <div class="pswp__preloader__icn">
0398 <div class="pswp__preloader__cut">
0399 <div class="pswp__preloader__donut"></div>
0400 </div>
0401 </div>
0402 </div>
0403 </div>
0404 <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
0405 <div class="pswp__share-tooltip"></div>
0406 </div>
0407 <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
0408 </button>
0409 <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
0410 </button>
0411 <div class="pswp__caption">
0412 <div class="pswp__caption__center"></div>
0413 </div>
0414 </div>
0415 </div>
0416 </div>
0417 </xsl:template>
0418
0419 <xsl:template name="photoSwipeJavaScriptLibraries">
0420 <script src="html5responsive/resources/js/photoswipe.min.js"/>
0421 <script src="html5responsive/resources/js/photoswipe-ui-default.min.js"/>
0422 </xsl:template>
0423
0424 <xsl:template name="photoSwipeJavaScriptInitialisation">
0425 <xsl:param name="numPages"/>
0426 <xsl:param name="pageNum"/>
0427 <xsl:param name="folder"/>
0428 <script>
0429 <xsl:text>
0430 var pswpElement = document.querySelectorAll('.pswp')[0];
0431
0432 // build items array
0433 var items = [</xsl:text>
0434 <xsl:for-each select="image">
0435 <xsl:text>{</xsl:text>
0436 <xsl:text>src: "</xsl:text><xsl:call-template name="escapeTextForJavaScript">
0437 <xsl:with-param name="text" select="$folder"/>
0438 </xsl:call-template><xsl:text>/</xsl:text><xsl:call-template name="escapeTextForJavaScript">
0439 <xsl:with-param name="text" select="full/@fileName"/>
0440 </xsl:call-template><xsl:text>",</xsl:text>
0441 <xsl:text>w: </xsl:text><xsl:value-of select="full/@width"/><xsl:text>,</xsl:text>
0442 <xsl:text>h: </xsl:text><xsl:value-of select="full/@height"/><xsl:text>,</xsl:text>
0443 <xsl:text>title: "</xsl:text><xsl:call-template name="escapeTextForJavaScript">
0444 <xsl:with-param name="text" select="title"/>
0445 </xsl:call-template><xsl:text>",</xsl:text>
0446 <xsl:text>description: "</xsl:text><xsl:call-template name="escapeTextForJavaScript">
0447 <xsl:with-param name="text" select="description"/>
0448 </xsl:call-template><xsl:text>",</xsl:text>
0449 <xsl:text>detailPage: "</xsl:text><xsl:call-template name="escapeTextForJavaScript">
0450 <xsl:with-param name="text">
0451 <xsl:value-of select="$folder"/><xsl:text>/</xsl:text><xsl:value-of select="full/@fileName"/><xsl:text>.html</xsl:text>
0452 </xsl:with-param>
0453 </xsl:call-template><xsl:text>"</xsl:text>
0454 <!-- TODO: Work out whether there's an elegant way to avoid writing an unwanted comma at the very end of the list. -->
0455 <xsl:text>},</xsl:text>
0456 </xsl:for-each>
0457 <xsl:text>];
0458
0459 // Define functions related to PhotoSwipe module.
0460
0461 function openImageInPhotoSwipe(photoIndex) {
0462 var options, gallery;
0463 // Initializes and opens PhotoSwipe (at the specified photo).
0464 options = {
0465 // optionName: 'option value'
0466 // for example:
0467 index: photoIndex, // start at selected photo
0468 addCaptionHTMLFn: photoCaptionGenerator,
0469 shareEl: </xsl:text><xsl:value-of select="$photoSwipeShowSharingButton" /><xsl:text>,
0470 bgOpacity: </xsl:text><xsl:value-of select="$photoSwipeBackgroundOpacity" /><xsl:text> / 10
0471 };
0472 gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
0473 gallery.init();
0474 }
0475
0476 var photoCaptionGenerator = function(item, captionEl, isFake) {
0477 var html;
0478 if(!item.title && !item.description && !item.detailPage) {
0479 captionEl.children[0].innerHTML = '';
0480 return false;
0481 }
0482 html = "<div class=\"galleryPhotoCaption\">";
0483 if (item.title) {
0484 html += "<p class=\"galleryPhotoTitle\">" + item.title.replace(/(?:\r\n|\r|\n)/g, '<br />') + "</p>";
0485 }
0486 if (item.description) {
0487 html += "<p class=\"galleryPhotoDescription\">" + item.description.replace(/(?:\r\n|\r|\n)/g, '<br />') + "</p>";
0488 }
0489 if (item.detailPage) {
0490 html += "<p class=\"galleryFullDetailsLink\"><a href=\"" + item.detailPage + "\"></xsl:text><xsl:value-of select="$i18nOriginalImage"/><xsl:text></a></p>";
0491 }
0492 html += "</div>";
0493 captionEl.children[0].innerHTML = html;
0494 return true;
0495 }
0496
0497 // This photoswipeParseHash function was taken from the code provided by Dimitry
0498 // Semenov at https://photoswipe.com/documentation/getting-started.html
0499 var photoswipeParseHash = function() {
0500 var hash = window.location.hash.substring(1),
0501 params = {};
0502
0503 if(hash.length < 5) {
0504 return params;
0505 }
0506
0507 var vars = hash.split('&');
0508 for (var i = 0; i < vars.length; i++) {
0509 if(!vars[i]) {
0510 continue;
0511 }
0512 var pair = vars[i].split('=');
0513 if(pair.length < 2) {
0514 continue;
0515 }
0516 params[pair[0]] = pair[1];
0517 }
0518
0519 if(params.gid) {
0520 params.gid = parseInt(params.gid, 10);
0521 }
0522
0523 return params;
0524 };
0525
0526 // If a PhotoSwipe history URL has been used then open PhotoSwipe directly at
0527 // the specified photo index.
0528 var hashData = photoswipeParseHash();
0529 if(hashData.pid && hashData.gid) {
0530 openImageInPhotoSwipe(hashData.pid);
0531 }
0532 </xsl:text>
0533 </script>
0534 </xsl:template>
0535 <!-- ##################### END PHOTOSWIPE COMPONENT GENERATION ################## -->
0536
0537
0538 <!-- ##################### PAGINATION LINK GENERATATION ################### -->
0539 <xsl:template name="pagination">
0540 <xsl:param name="numPages"/>
0541 <xsl:param name="pageNum"/>
0542 <xsl:param name="paginationMode"/>
0543 <xsl:if test="$numPages > 1">
0544 <div class="pagination">
0545 <xsl:choose>
0546 <xsl:when test="number($pageNum) = 0">
0547 <p class="previousLink disabled">
0548 <xsl:value-of select="$i18nPrevious"/>
0549 </p>
0550 </xsl:when>
0551 <xsl:otherwise>
0552 <p class="previousLink">
0553 <a>
0554 <xsl:attribute name="href">
0555 <xsl:call-template name="pageLink">
0556 <xsl:with-param name="collectionFilename" select="fileName"/>
0557 <xsl:with-param name="pageNum" select="number($pageNum)-1"/>
0558 </xsl:call-template>
0559 </xsl:attribute>
0560 <xsl:value-of select="$i18nPrevious"/>
0561 </a>
0562 </p>
0563 </xsl:otherwise>
0564 </xsl:choose>
0565 <xsl:choose>
0566 <xsl:when test="$paginationMode = 'fullList'">
0567 <ol class="pageNumbersList">
0568 <xsl:call-template name="pagination.for.loop">
0569 <xsl:with-param name="i" select="0"/>
0570 <xsl:with-param name="count" select="$numPages"/>
0571 <xsl:with-param name="currentPage" select="$pageNum"/>
0572 </xsl:call-template>
0573 </ol>
0574 </xsl:when>
0575 <xsl:when test="$paginationMode = 'currentOfTotal'">
0576 <xsl:call-template name="currentPageOfTotal">
0577 <xsl:with-param name="count" select="$numPages"/>
0578 <xsl:with-param name="currentPage" select="$pageNum"/>
0579 </xsl:call-template>
0580 </xsl:when>
0581 </xsl:choose>
0582 <xsl:choose>
0583 <xsl:when test="number($pageNum) = number($numPages)-1">
0584 <p class="nextLink disabled">
0585 <xsl:value-of select="$i18nNext"/>
0586 </p>
0587 </xsl:when>
0588 <xsl:otherwise>
0589 <p class="nextLink">
0590 <a>
0591 <xsl:attribute name="href">
0592 <xsl:call-template name="pageLink">
0593 <xsl:with-param name="collectionFilename" select="fileName"/>
0594 <xsl:with-param name="pageNum" select="number($pageNum)+1"/>
0595 </xsl:call-template>
0596 </xsl:attribute>
0597 <xsl:value-of select="$i18nNext"/>
0598 </a>
0599 </p>
0600 </xsl:otherwise>
0601 </xsl:choose>
0602 </div>
0603 </xsl:if>
0604 </xsl:template>
0605
0606 <!-- For loop used to generate pagination links -->
0607 <xsl:template name="pagination.for.loop">
0608 <xsl:param name="i"/>
0609 <xsl:param name="count"/>
0610 <xsl:param name="currentPage"/>
0611
0612 <xsl:if test="$i < $count">
0613 <xsl:choose>
0614 <xsl:when test="number($currentPage) = $i">
0615 <li class="pageNumber current"><xsl:value-of select="number($i)+1"/></li>
0616 </xsl:when>
0617 <xsl:otherwise>
0618 <li class="pageNumber">
0619 <a>
0620 <xsl:attribute name="href">
0621 <xsl:call-template name="pageLink">
0622 <xsl:with-param name="collectionFilename" select="fileName"/>
0623 <xsl:with-param name="pageNum" select="$i"/>
0624 </xsl:call-template>
0625 </xsl:attribute>
0626 <xsl:value-of select="number($i)+1"/>
0627 </a>
0628 </li>
0629 </xsl:otherwise>
0630 </xsl:choose>
0631
0632 <xsl:call-template name="pagination.for.loop">
0633 <xsl:with-param name="i" select="$i + 1"/>
0634 <xsl:with-param name="count" select="$count"/>
0635 <xsl:with-param name="currentPage" select="$currentPage"/>
0636 </xsl:call-template>
0637 </xsl:if>
0638 </xsl:template>
0639
0640 <!-- Template which prints out the html url for a particular page -->
0641 <xsl:template name="pageLink">
0642 <xsl:param name="collectionFilename"/>
0643 <xsl:param name="pageNum"/>
0644 <xsl:choose>
0645 <xsl:when test="($numCollections > 1) and ($pageNum = 0)">
0646 <xsl:value-of select="$collectionFilename"/><xsl:text>.html</xsl:text>
0647 </xsl:when>
0648 <xsl:when test="($numCollections <= 1) and ($pageNum = 0)">index.html</xsl:when>
0649 <xsl:otherwise><xsl:value-of select="$collectionFilename"/>_<xsl:value-of select="number($pageNum)" />.html</xsl:otherwise>
0650 </xsl:choose>
0651 </xsl:template>
0652
0653 <xsl:template name="currentPageOfTotal">
0654 <xsl:param name="count"/>
0655 <xsl:param name="currentPage"/>
0656 <p class="currentOfTotal">
0657 <span class="currentPageNumber">
0658 <xsl:value-of select="$currentPage + 1"/>
0659 </span>
0660 <span class="currentTotalSeparator"> / </span>
0661 <span class="totalPageCount">
0662 <xsl:value-of select="$count"/>
0663 </span>
0664 </p>
0665 </xsl:template>
0666
0667 <!-- ##################### IMAGE PAGE GENERATION ########################## -->
0668 <!--
0669 Displays a single image on the page, with full details about that image.
0670 -->
0671 <xsl:template name="imagePage">
0672 <xsl:param name="indexPage"/>
0673 <html>
0674 <head>
0675 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
0676 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
0677 <meta name="generator" content="digiKam"/>
0678 <title><xsl:value-of select="title"/></title>
0679 <link rel="stylesheet" type="text/css" media="screen">
0680 <xsl:attribute name="href">../html5responsive/resources/css/<xsl:value-of select="$style"/></xsl:attribute>
0681 </link>
0682 </head>
0683 <body class="imagePage">
0684 <header>
0685 <div id="pageTitleAndPagination">
0686 <h1>
0687 <xsl:value-of select="title"/>
0688 </h1>
0689 <nav class="topOfPage">
0690 <p class="upLink albumNameLink">
0691 <a href="{$indexPage}">
0692 <xsl:value-of select="../name"/>
0693 </a>
0694 </p>
0695 <xsl:if test="($paginationLocation = 'top') or ($paginationLocation = 'both')">
0696 <xsl:call-template name="image.pagination">
0697 <xsl:with-param name="indexPage" select="$indexPage"/>
0698 </xsl:call-template>
0699 </xsl:if>
0700 </nav>
0701 </div>
0702 </header>
0703 <main>
0704 <figure id="image">
0705 <a href="{$indexPage}">
0706 <img src="{full/@fileName}" width="{full/@width}" height="{full/@height}" />
0707 </a>
0708 <xsl:variable name="exifTableRequired">
0709 <xsl:call-template name="isExifTableRequired"/>
0710 </xsl:variable>
0711 <xsl:if test="description != '' or original/@fileName != '' or $exifTableRequired = 'true'">
0712 <figcaption>
0713 <xsl:if test="description != ''">
0714 <p class="imageDescription">
0715 <xsl:call-template name="convertNewlinesToHtmlBreaks">
0716 <xsl:with-param name="rawText" select="description"/>
0717 </xsl:call-template>
0718 </p>
0719 </xsl:if>
0720 <xsl:if test="$exifTableRequired = 'true'">
0721 <xsl:call-template name="addExifData"/>
0722 </xsl:if>
0723 <xsl:if test="original/@fileName != ''">
0724 <p class="originalImageLink">
0725 <a href="{original/@fileName}"><xsl:value-of select="$i18nOriginalImage"/></a>
0726 (<xsl:value-of select="original/@width"/>x<xsl:value-of select="original/@height"/>)
0727 </p>
0728 </xsl:if>
0729 </figcaption>
0730 </xsl:if>
0731 </figure>
0732 </main>
0733 <xsl:if test="$author != '' or ($paginationLocation = 'bottom') or ($paginationLocation = 'both')">
0734 <footer>
0735 <div class="paginationAndCopyright">
0736 <xsl:if test="($paginationLocation = 'bottom') or ($paginationLocation = 'both')">
0737 <nav class="bottomOfPage">
0738 <xsl:call-template name="image.pagination">
0739 <xsl:with-param name="indexPage" select="$indexPage"/>
0740 </xsl:call-template>
0741 </nav>
0742 </xsl:if>
0743 <xsl:if test="$author != ''">
0744 <xsl:call-template name="copyrightNotice"/>
0745 </xsl:if>
0746 </div>
0747 </footer>
0748 </xsl:if>
0749 </body>
0750 </html>
0751 </xsl:template>
0752
0753 <xsl:template name="isExifTableRequired">
0754 <xsl:choose>
0755 <!-- IMPORTANT: IF THE EXIF FIELDS CONSIDERED HERE ARE CHANGED THEN THE EXACT SAME LIST OF FIELDS MUST BE LISTED IN THE "addExifData" TEMPLATE! -->
0756 <xsl:when test="exif/exifimagedatetime != 'unavailable' or exif/exifimagemake != 'unavailable' or exif/exifimagemodel != 'unavailable' or exif/exifphotofocallength != 'unavailable' or exif/exifphotoaperturevalue != 'unavailable' or exif/exifphotoshutterspeedvalue != 'unavailable' or exif/exifphotoisospeedratings != 'unavailable' or exif/exifphotofnumber != 'unavailable' or exif/exifphotoexposuretime != 'unavailable' or ($showGPS = 'true' and (exif/exifgpslatitude != 'unavailable' or exif/exifgpslongitude != 'unavailable' or exif/exifgpsaltitude != 'unavailable'))">
0757 <xsl:text>true</xsl:text>
0758 </xsl:when>
0759 <xsl:otherwise>
0760 <xsl:text>false</xsl:text>
0761 </xsl:otherwise>
0762 </xsl:choose>
0763 </xsl:template>
0764
0765 <xsl:template name="addExifData">
0766 <table class="exifData">
0767 <caption><abbr title="Exchangeable image file">Exif</abbr> data</caption>
0768 <tr class="exifHeaderRow">
0769 <th scope="col">Field</th>
0770 <th scope="col">Value</th>
0771 </tr>
0772 <!-- IMPORTANT: IF THE EXIF FIELDS USED HERE ARE CHANGED THEN THE EXACT SAME LIST OF FIELDS MUST BE CONSIDERED IN THE "isExifTableRequired" TEMPLATE! -->
0773 <xsl:call-template name="addExifTableRow">
0774 <xsl:with-param name="cssClassName">exifDateTime</xsl:with-param>
0775 <xsl:with-param name="fieldName" select="$i18nexifimagedatetime"/>
0776 <xsl:with-param name="fieldValue" select="exif/exifimagedatetime"/>
0777 </xsl:call-template>
0778 <xsl:call-template name="addExifTableRow">
0779 <xsl:with-param name="cssClassName">hardwareMake</xsl:with-param>
0780 <xsl:with-param name="fieldName" select="$i18nexifimagemake"/>
0781 <xsl:with-param name="fieldValue" select="exif/exifimagemake"/>
0782 </xsl:call-template>
0783 <xsl:call-template name="addExifTableRow">
0784 <xsl:with-param name="cssClassName">hardwareModel</xsl:with-param>
0785 <xsl:with-param name="fieldName" select="$i18nexifimagemodel"/>
0786 <xsl:with-param name="fieldValue" select="exif/exifimagemodel"/>
0787 </xsl:call-template>
0788 <xsl:call-template name="addExifTableRow">
0789 <xsl:with-param name="cssClassName">focalLength</xsl:with-param>
0790 <xsl:with-param name="fieldName" select="$i18nexifphotofocallength"/>
0791 <xsl:with-param name="fieldValue" select="exif/exifphotofocallength"/>
0792 </xsl:call-template>
0793 <xsl:call-template name="addExifTableRow">
0794 <xsl:with-param name="cssClassName">apertureValue</xsl:with-param>
0795 <xsl:with-param name="fieldName" select="$i18nexifphotoaperturevalue"/>
0796 <xsl:with-param name="fieldValue" select="exif/exifphotoaperturevalue"/>
0797 </xsl:call-template>
0798 <xsl:call-template name="addExifTableRow">
0799 <xsl:with-param name="cssClassName">shutterSpeedValue</xsl:with-param>
0800 <xsl:with-param name="fieldName" select="$i18nexifphotoshutterspeedvalue"/>
0801 <xsl:with-param name="fieldValue" select="exif/exifphotoshutterspeedvalue"/>
0802 </xsl:call-template>
0803 <xsl:call-template name="addExifTableRow">
0804 <xsl:with-param name="cssClassName">fNumber</xsl:with-param>
0805 <xsl:with-param name="fieldName" select="$i18nexifphotofnumber"/>
0806 <xsl:with-param name="fieldValue" select="exif/exifphotofnumber"/>
0807 </xsl:call-template>
0808 <xsl:call-template name="addExifTableRow">
0809 <xsl:with-param name="cssClassName">exposureTime</xsl:with-param>
0810 <xsl:with-param name="fieldName" select="$i18nexifphotoexposuretime"/>
0811 <xsl:with-param name="fieldValue" select="exif/exifphotoexposuretime"/>
0812 </xsl:call-template>
0813 <xsl:call-template name="addExifTableRow">
0814 <xsl:with-param name="cssClassName">isoSpeed</xsl:with-param>
0815 <xsl:with-param name="fieldName" select="$i18nexifphotoisospeedratings"/>
0816 <xsl:with-param name="fieldValue" select="exif/exifphotoisospeedratings"/>
0817 </xsl:call-template>
0818 <xsl:if test="$showGPS = 'true'">
0819 <xsl:call-template name="addExifTableRow">
0820 <xsl:with-param name="cssClassName">gpsLatitude</xsl:with-param>
0821 <xsl:with-param name="fieldName">GPS latitude</xsl:with-param>
0822 <xsl:with-param name="fieldValue" select="exif/exifgpslatitude"/>
0823 </xsl:call-template>
0824 <xsl:call-template name="addExifTableRow">
0825 <xsl:with-param name="cssClassName">gpsLongitude</xsl:with-param>
0826 <xsl:with-param name="fieldName">GPS longitude</xsl:with-param>
0827 <xsl:with-param name="fieldValue" select="exif/exifgpslongitude"/>
0828 </xsl:call-template>
0829 <xsl:call-template name="addExifTableRow">
0830 <xsl:with-param name="cssClassName">gpsAltitude</xsl:with-param>
0831 <xsl:with-param name="fieldName">GPS altitude</xsl:with-param>
0832 <xsl:with-param name="fieldValue" select="exif/exifgpsaltitude"/>
0833 </xsl:call-template>
0834 </xsl:if>
0835 <!-- IMPORTANT: IF THE EXIF FIELDS USED HERE ARE CHANGED THEN THE EXACT SAME LIST OF FIELDS MUST BE CONSIDERED IN THE "isExifTableRequired" TEMPLATE! -->
0836 </table>
0837 </xsl:template>
0838
0839 <xsl:template name="addExifTableRow">
0840 <xsl:param name="cssClassName"/>
0841 <xsl:param name="fieldName"/>
0842 <xsl:param name="fieldValue"/>
0843 <xsl:if test="$fieldValue != '' and $fieldValue != 'unavailable'">
0844 <tr class="{$cssClassName}">
0845 <th scope="row"><xsl:value-of select="$fieldName"/></th>
0846 <td><xsl:value-of select="$fieldValue"/></td>
0847 </tr>
0848 </xsl:if>
0849 </xsl:template>
0850
0851 <!-- ##################### END IMAGE PAGE GENERATION ###################### -->
0852
0853
0854 <!-- ##################### IMAGE PAGINATION LINK GENERATATION ############# -->
0855 <xsl:template name="image.pagination">
0856 <xsl:param name="indexPage"/>
0857 <div class="pagination">
0858 <div>
0859 <xsl:choose>
0860 <xsl:when test="position() > 1">
0861 <p class="previousLink">
0862 <a href="{preceding-sibling::image[position()=1]/full/@fileName}.html">
0863 <xsl:value-of select="$i18nPrevious"/>
0864 </a>
0865 </p>
0866 </xsl:when>
0867 <xsl:otherwise>
0868 <p class="previousLink disabled">
0869 <xsl:value-of select="$i18nPrevious"/>
0870 </p>
0871 </xsl:otherwise>
0872 </xsl:choose>
0873
0874 <p class="currentOfTotal">
0875 <span class="currentPageNumber">
0876 <xsl:value-of select="position()"/>
0877 </span>
0878 <span class="currentTotalSeparator">/</span>
0879 <span class="totalPageCount">
0880 <xsl:value-of select="last()"/>
0881 </span>
0882 </p>
0883
0884 <xsl:choose>
0885 <xsl:when test="position() < last()">
0886 <p class="nextLink">
0887 <a href="{following-sibling::image[position()=1]/full/@fileName}.html"><xsl:value-of select="$i18nNext"/></a>
0888 </p>
0889 </xsl:when>
0890 <xsl:otherwise>
0891 <p class="nextLink disabled">
0892 <xsl:value-of select="$i18nNext"/>
0893 </p>
0894 </xsl:otherwise>
0895 </xsl:choose>
0896 </div>
0897 </div>
0898 </xsl:template>
0899 <!-- ##################### END PAGINATION LINK GENERATATION ############### -->
0900
0901
0902 <!-- ##################### COLLECTION PAGES GENERATION ##################### -->
0903 <xsl:template name="collectionPages">
0904 <xsl:call-template name="collectionPages.for.loop">
0905 <xsl:with-param name="i" select="1"/>
0906 <xsl:with-param name="count" select="ceiling(count(image) div $pageSize)"/>
0907 </xsl:call-template>
0908 </xsl:template>
0909
0910 <!-- For loop used to generate collection pages -->
0911 <xsl:template name="collectionPages.for.loop">
0912 <xsl:param name="i"/>
0913 <xsl:param name="count"/>
0914
0915 <xsl:if test="$i < $count">
0916 <xsl:variable name="pageFilename" select="concat(fileName, '_', $i, '.html')"/>
0917 <exsl:document href="{$pageFilename}"
0918 method="html"
0919 indent="yes"
0920 encoding="utf-8"
0921 doctype-system="about:legacy-compat">
0922 <xsl:call-template name="collectionPage">
0923 <xsl:with-param name="pageNum" select="$i"/>
0924 <xsl:with-param name="pageFilename" select="$pageFilename"/>
0925 </xsl:call-template>
0926 </exsl:document>
0927
0928 <xsl:call-template name="collectionPages.for.loop">
0929 <xsl:with-param name="i" select="$i + 1"/>
0930 <xsl:with-param name="count" select="$count"/>
0931 </xsl:call-template>
0932 </xsl:if>
0933 </xsl:template>
0934 <!-- ##################### END COLLECTION PAGE GENERATION ################# -->
0935
0936 </xsl:transform>