[36994] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
| 2 | <xsl:stylesheet version="1.0"
|
---|
| 3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 4 | xmlns:java="http://xml.apache.org/xslt/java"
|
---|
| 5 | xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
|
---|
| 6 | xmlns:gslib="http://www.greenstone.org/skinning"
|
---|
| 7 | xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
|
---|
| 8 | extension-element-prefixes="java util"
|
---|
| 9 | exclude-result-prefixes="java util gsf">
|
---|
| 10 |
|
---|
[37055] | 11 |
|
---|
| 12 | <xsl:variable name="httpDocument">
|
---|
| 13 | <xsl:value-of select="$library_name"/>
|
---|
| 14 | <xsl:text>/collection/</xsl:text>
|
---|
| 15 | <xsl:value-of select="/page/pageResponse/collection/@name"/>
|
---|
| 16 | <xsl:text>/document/</xsl:text>
|
---|
| 17 | <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'd']/@value"/> <!-- or use $docID from default/transform/pages/document.xsl ???? -->
|
---|
| 18 | </xsl:variable>
|
---|
| 19 |
|
---|
| 20 |
|
---|
[36997] | 21 | <xsl:template name="iiif-links">
|
---|
| 22 | <xsl:param name="identifier"/>
|
---|
[37055] | 23 |
|
---|
| 24 | <gsf:variable name="iiifImageRootIdentifier">
|
---|
| 25 | <xsl:text>/gs-cantaloupe/iiif/2/</xsl:text><xsl:value-of select="$site_name"/>:<xsl:value-of select="$collNameChecked"/>:<xsl:value-of select="$identifier"/>
|
---|
| 26 | </gsf:variable>
|
---|
| 27 |
|
---|
[37075] | 28 | <!--
|
---|
[37055] | 29 | <gsf:variable name="iiifPresentationRootIdentifier"><xsl:value-of select="$docID"/></gsf:variable>
|
---|
[37075] | 30 | -->
|
---|
| 31 |
|
---|
| 32 | <gsf:variable name="iiifPresentationRootIdentifier">http-greenstone://<xsl:value-of select="$site_name"/>/<xsl:value-of select="$collNameChecked"/>/<xsl:value-of select="$docID"/></gsf:variable>
|
---|
[37055] | 33 |
|
---|
| 34 | <!--
|
---|
[36997] | 35 | <div style="padding-top: 10px; padding-bottom: 10px;">
|
---|
| 36 | IIIF Server Info URL:
|
---|
| 37 | <a href="/gs-cantaloupe/iiif/2/{$site_name}:{$collNameChecked}:{$identifier}/info.json">
|
---|
| 38 | /gs-cantaloupe/iiif/2/<xsl:value-of select="$site_name"/>:<xsl:value-of select="$collNameChecked"/>:<xsl:value-of select="$identifier"/>/info.json
|
---|
| 39 | </a>
|
---|
| 40 | </div>
|
---|
| 41 |
|
---|
| 42 | <div style="padding-top: 10px; padding-bottom: 10px;">
|
---|
| 43 | IIIF Server Image URL:
|
---|
| 44 | <a href="/gs-cantaloupe/iiif/2/{$site_name}:{$collNameChecked}:{$identifier}/full/full/0/default.jpg">
|
---|
| 45 | /gs-cantaloupe/iiif/2/<xsl:value-of select="$site_name"/>:<xsl:value-of select="$collNameChecked"/>:<xsl:value-of select="$identifier"/>/full/full/0/default.jpg
|
---|
[37055] | 46 | </a>
|
---|
[36997] | 47 | </div>
|
---|
[37055] | 48 |
|
---|
| 49 | <div style="padding-top: 10px; padding-bottom: 10px;">
|
---|
| 50 | Single Page Manifest
|
---|
| 51 | <a href="{$httpDocument}?book=mirador&excerptid=run-iiif-manifest">
|
---|
| 52 | <xsl:value-of select="$httpDocument"/>?excerptid=run-iiif-manifest
|
---|
| 53 | </a>
|
---|
| 54 | </div>
|
---|
| 55 | -->
|
---|
[36997] | 56 |
|
---|
[37055] | 57 | <gsf:script>
|
---|
| 58 | var chosen_title = "untitled";
|
---|
| 59 |
|
---|
| 60 | if (gs.variables.chosenTitle && !gs.variables.docNodeID) {
|
---|
| 61 | // simple doc
|
---|
| 62 | chosen_title = gs.variables.chosenTitle;
|
---|
| 63 | }
|
---|
| 64 | else {
|
---|
| 65 | var docNodeID = gs.variables.docNodeID;
|
---|
| 66 | var page_pos = docNodeID.indexOf('.');
|
---|
| 67 | chosen_title = (page_pos>=0) ? "page " + docNodeID.substring(page_pos+1) : docNodeID;
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | var iiif_doc_image = {
|
---|
| 71 | "id": document.location.origin + gs.variables.iiifImageRootIdentifier,
|
---|
| 72 | //"format": mime_type, // ???? or is it OK to always have this as image/jpeg and rely on IIIF Image Server coverting as/when needed???
|
---|
| 73 | //"chosen_title": gs.variables.chosenTitle,
|
---|
| 74 | "chosen_title": chosen_title,
|
---|
| 75 | "x_dim": gs.variables.imageWidth,
|
---|
| 76 | "y_dim": gs.variables.imageHeight,
|
---|
| 77 | };
|
---|
| 78 |
|
---|
| 79 | IIIF_Doc_Images.push(iiif_doc_image);
|
---|
| 80 |
|
---|
| 81 | </gsf:script>
|
---|
| 82 |
|
---|
[36997] | 83 | </xsl:template>
|
---|
| 84 |
|
---|
| 85 |
|
---|
| 86 | <xsl:template name="googlevision-ocr-json">
|
---|
| 87 | <xsl:param name="assocfilepath"/>
|
---|
| 88 |
|
---|
[37017] | 89 | <gsf:variable name="GVDocumentOCRJSON"><gsf:metadata name="GVDocumentOCRJSON"/></gsf:variable>
|
---|
[37055] | 90 | <gsf:variable name="docSectionID"><xsl:value-of select="util:replace(@nodeID, '.', '_')"/></gsf:variable>
|
---|
| 91 |
|
---|
| 92 | <!--
|
---|
[36997] | 93 | <div style="padding-top: 10px; padding-bottom: 10px;">
|
---|
| 94 | Google Vision OCR JSON:
|
---|
| 95 | <a>
|
---|
| 96 | <xsl:attribute name="href">
|
---|
| 97 | <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name = 'httpPath']"/>
|
---|
[37017] | 98 | <xsl:text>/index/assoc/</xsl:text><xsl:value-of disable-output-escaping="yes" select="$assocfilepath" /><xsl:text>/</xsl:text><xsl:value-of select="$GVDocumentOCRJSON"/>
|
---|
[36997] | 99 | </xsl:attribute>
|
---|
[37017] | 100 | <xsl:value-of select="$GVDocumentOCRJSON"/>
|
---|
[36997] | 101 | </a>
|
---|
| 102 | </div>
|
---|
[37055] | 103 | -->
|
---|
[36997] | 104 | <gsf:script>
|
---|
[37011] | 105 | load_gv_dococr_json(gs.variables.GVDocumentOCRJSON,gs.variables.docSectionID,display_gv_ocr_bounding_boxes);
|
---|
[36997] | 106 | </gsf:script>
|
---|
| 107 | </xsl:template>
|
---|
| 108 |
|
---|
| 109 |
|
---|
[37011] | 110 | <xsl:template name="wrappedSectionPost">
|
---|
[36997] | 111 |
|
---|
| 112 | <!-- add in IIIF Server link for section image -->
|
---|
| 113 | <xsl:variable name="nodeID" select="@nodeID"/>
|
---|
| 114 | <xsl:call-template name="iiif-links">
|
---|
| 115 | <xsl:with-param name="identifier" select="$nodeID" />
|
---|
| 116 | </xsl:call-template>
|
---|
[37011] | 117 |
|
---|
[36997] | 118 | <!-- add in Google Vision OCR JSON link for section image -->
|
---|
| 119 | <xsl:call-template name="googlevision-ocr-json">
|
---|
| 120 | <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" select="root"/></xsl:with-param>
|
---|
| 121 | </xsl:call-template>
|
---|
[37011] | 122 |
|
---|
[36997] | 123 | </xsl:template>
|
---|
| 124 |
|
---|
[37055] | 125 | <xsl:template name="sectionImage">
|
---|
| 126 | <xsl:if test="$bookswitch != 'mirador'">
|
---|
| 127 | <gsf:image type="screen"/>
|
---|
| 128 | </xsl:if>
|
---|
| 129 | </xsl:template>
|
---|
[37011] | 130 |
|
---|
| 131 | <xsl:template name="sectionContent">
|
---|
[37055] | 132 |
|
---|
| 133 | <xsl:choose>
|
---|
| 134 | <xsl:when test="$bookswitch = 'mirador'">
|
---|
| 135 | <gsf:variable name="screenImageWidth"><gsf:metadata name="ScreenWidth"/></gsf:variable>
|
---|
| 136 | <gsf:variable name="screenImageHeight"><gsf:metadata name="ScreenHeight"/></gsf:variable>
|
---|
| 137 | <gsf:variable name="imageWidth"><gsf:metadata name="ImageWidth"/></gsf:variable>
|
---|
| 138 | <gsf:variable name="imageHeight"><gsf:metadata name="ImageHeight"/></gsf:variable>
|
---|
| 139 | <gsf:variable name="docNodeID"><xsl:value-of select="@nodeID"/></gsf:variable> <!-- used to make each 'tidyDiv' unique -->
|
---|
| 140 | </xsl:when>
|
---|
| 141 |
|
---|
| 142 | <xsl:otherwise>
|
---|
| 143 | <xsl:call-template name="wrappedSectionImage"/>
|
---|
| 144 |
|
---|
| 145 | <div style="padding: 10px 0px 10px 0px">Ocr'd Text:</div>
|
---|
| 146 | <i>
|
---|
| 147 | <xsl:call-template name="wrappedSectionText"/>
|
---|
| 148 | </i>
|
---|
| 149 | </xsl:otherwise>
|
---|
| 150 | </xsl:choose>
|
---|
| 151 |
|
---|
[37011] | 152 | <xsl:call-template name="wrappedSectionPost"/>
|
---|
| 153 | </xsl:template>
|
---|
| 154 |
|
---|
| 155 | <xsl:template name="sectionContentForEditing">
|
---|
| 156 | <xsl:call-template name="wrappedSectionImage"/>
|
---|
| 157 | <xsl:call-template name="wrappedSectionTextForEditing"/>
|
---|
| 158 | </xsl:template>
|
---|
| 159 |
|
---|
[36997] | 160 | <xsl:template name="documentPre">
|
---|
[37055] | 161 | <xsl:variable name="httpCollection">library/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:variable>
|
---|
| 162 | <gsf:variable name="chosenTitle"><xsl:call-template name="choose-title"/></gsf:variable>
|
---|
| 163 | <!-- <gsf:variable name="toplevelTitle"><gsf:metadata name="Title" select="root"/></gsf:variable> -->
|
---|
| 164 | <gsf:variable name="imageWidth"><gsf:metadata name="ImageWidth"/></gsf:variable>
|
---|
| 165 | <gsf:variable name="imageHeight"><gsf:metadata name="ImageHeight"/></gsf:variable>
|
---|
| 166 |
|
---|
| 167 | <gsf:script>
|
---|
| 168 | console.log("**** chosenTitle = " + gs.variables.chosenTitle);
|
---|
| 169 | </gsf:script>
|
---|
| 170 | <gsf:script src="{$httpCollection}/js/document_viewer.js"/>
|
---|
| 171 | <style>
|
---|
[36997] | 172 | div.ocr-boundingbox-overlay {
|
---|
| 173 | position: absolute;
|
---|
| 174 | left: 0;
|
---|
| 175 | top: 0;
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | div.ocr-boundingbox {
|
---|
| 179 | position: absolute;
|
---|
| 180 | border: solid black 1px;
|
---|
| 181 | }
|
---|
| 182 |
|
---|
[37055] | 183 | </style>
|
---|
[37018] | 184 |
|
---|
[37055] | 185 | <xsl:if test="$bookswitch = 'mirador'">
|
---|
| 186 | <!-- <gsf:script src="https://unpkg.com/mirador@latest/dist/mirador.min.js"/> -->
|
---|
| 187 |
|
---|
| 188 | <gsf:script src="ext/structured-image/mirador3/dist/mirador-with-annotations.js"/>
|
---|
[37018] | 189 |
|
---|
[37055] | 190 |
|
---|
| 191 | <!-- Mirador, by default, uses Roboto font, so load it in -->
|
---|
| 192 | <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" />
|
---|
| 193 | </xsl:if>
|
---|
[37018] | 194 |
|
---|
| 195 | <gsf:script>
|
---|
[37055] | 196 | var IIIF_Doc_Images = [];
|
---|
[37018] | 197 | </gsf:script>
|
---|
[37055] | 198 |
|
---|
| 199 | </xsl:template>
|
---|
| 200 |
|
---|
[37018] | 201 |
|
---|
[37055] | 202 | <xsl:template name="documentContentMirador3">
|
---|
[36997] | 203 | <xsl:if test="@docType='simple'">
|
---|
[37055] | 204 | <gsf:script>$('#tocLoadingImage').hide()</gsf:script>
|
---|
[37011] | 205 | <!-- add in IIIF Server link for simple page image -->
|
---|
[36997] | 206 | <xsl:call-template name="iiif-links">
|
---|
| 207 | <xsl:with-param name="identifier" select="$docID" />
|
---|
| 208 | </xsl:call-template>
|
---|
[37018] | 209 | </xsl:if>
|
---|
| 210 | </xsl:template>
|
---|
| 211 |
|
---|
| 212 | <xsl:template name="documentContent">
|
---|
[37055] | 213 | <!-- The way document.xsl tempaltes are structured, only get to here is if @docType = 'simple' -->
|
---|
| 214 | <!-- A 'paged' (or 'hierarical') document goes throgh 'wrappedContent' -->
|
---|
| 215 |
|
---|
[37018] | 216 | <div id="gs-document">
|
---|
| 217 |
|
---|
| 218 | <xsl:choose>
|
---|
| 219 | <xsl:when test="$bookswitch = 'mirador'">
|
---|
| 220 | <xsl:call-template name="documentPre"/>
|
---|
[37055] | 221 | <xsl:call-template name="documentContentMirador3"/>
|
---|
[37018] | 222 | <xsl:call-template name="documentPost"/>
|
---|
[37055] | 223 | <xsl:call-template name="documentPostMirador3"/>
|
---|
[37018] | 224 | </xsl:when>
|
---|
[37055] | 225 |
|
---|
[37018] | 226 | <xsl:otherwise>
|
---|
| 227 | <xsl:call-template name="documentPre"/>
|
---|
| 228 | <xsl:call-template name="wrappedSectionImage"/>
|
---|
| 229 | <div id="gs-document-text">
|
---|
| 230 | <xsl:call-template name="documentNodeText"/>
|
---|
| 231 | </div>
|
---|
| 232 | <xsl:call-template name="documentPost"/>
|
---|
| 233 | </xsl:otherwise>
|
---|
[37055] | 234 |
|
---|
[37018] | 235 | </xsl:choose>
|
---|
| 236 | </div>
|
---|
| 237 |
|
---|
| 238 | </xsl:template>
|
---|
| 239 |
|
---|
| 240 |
|
---|
| 241 | <xsl:template name="documentPost">
|
---|
[37055] | 242 |
|
---|
[37018] | 243 | <xsl:if test="@docType='simple'">
|
---|
| 244 |
|
---|
[37011] | 245 | <!--
|
---|
| 246 | <gsf:switch>
|
---|
| 247 | <gsf:metadata name='HasGoogleVisionDocumentOCRJSON";'/>
|
---|
| 248 | <gsf:when test='equals' test-value="1">
|
---|
| 249 | -->
|
---|
| 250 |
|
---|
| 251 | <!-- add in Google Vision OCR JSON link for simple page image -->
|
---|
| 252 | <xsl:call-template name="googlevision-ocr-json">
|
---|
| 253 | <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" pos="first"/></xsl:with-param>
|
---|
| 254 | </xsl:call-template>
|
---|
| 255 | <!--
|
---|
| 256 | </gsf:when>
|
---|
| 257 | </gsf:switch>
|
---|
| 258 | -->
|
---|
| 259 |
|
---|
[37018] | 260 | </xsl:if>
|
---|
[37055] | 261 | </xsl:template>
|
---|
[37018] | 262 |
|
---|
[37055] | 263 | <xsl:template name="documentPostMirador3">
|
---|
[37018] | 264 |
|
---|
[37055] | 265 | <!-- Container element of Mirador whose id should be passed to the instantiating call as "id" -->
|
---|
| 266 | <div style="position: relative; width: 100%; height: 800px;">
|
---|
| 267 | <div id="mirador3-viewer"> <xsl:comment>filler</xsl:comment></div>
|
---|
| 268 | </div>
|
---|
[37018] | 269 |
|
---|
[37055] | 270 | <gsf:script>
|
---|
| 271 | var iiifpres_root_id = gs.variables.iiifPresentationRootIdentifier;
|
---|
| 272 | console.log(gs);
|
---|
| 273 | var iiifpres_label = (gs.variables.toplevelTitle) ? gs.variables.toplevelTitle : gs.variables.chosenTitle;
|
---|
| 274 |
|
---|
| 275 | var iiif_manifest = initIIIFManifest(iiifpres_root_id,iiifpres_label, IIIF_Doc_Images);
|
---|
| 276 |
|
---|
| 277 | var mirador3 = createMirador3Viewer();
|
---|
| 278 | </gsf:script>
|
---|
| 279 |
|
---|
[36997] | 280 | </xsl:template>
|
---|
| 281 |
|
---|
[37055] | 282 | <xsl:template name="wrappedDocumentTopLevel">
|
---|
| 283 | <gsf:variable name="toplevelTitle"><xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']" /></gsf:variable>
|
---|
| 284 | <xsl:choose>
|
---|
| 285 | <xsl:when test="$bookswitch = 'mirador'">
|
---|
| 286 | <!-- <xsl:call-template name="documentPre"/> -->
|
---|
| 287 | <div style="display:none;">
|
---|
| 288 | <xsl:call-template name="wrappedDocument"/> <!-- without ed=1, this template misses the binds in of documentPre and documentPost -->
|
---|
| 289 | </div>
|
---|
| 290 | <!-- <xsl:call-template name="documentPost"/> -->
|
---|
| 291 | <xsl:call-template name="documentPostMirador3"/>
|
---|
| 292 | </xsl:when>
|
---|
| 293 | <xsl:otherwise>
|
---|
| 294 | <xsl:call-template name="wrappedDocument"/> <!-- without ed=1, this template misses the binds in of documentPre and documentPost -->
|
---|
| 295 | </xsl:otherwise>
|
---|
| 296 | </xsl:choose>
|
---|
| 297 | </xsl:template>
|
---|
| 298 |
|
---|
[36997] | 299 |
|
---|
[36994] | 300 | <!-- content of a simple document. Will not be used for editing mode -->
|
---|
| 301 | <xsl:template name="documentPostInProgress">
|
---|
| 302 |
|
---|
| 303 |
|
---|
| 304 | <!--
|
---|
| 305 | canDoEditing = <xsl:value-of select="$canDoEditing"/> <br />
|
---|
| 306 | editingTurnedOn = <xsl:value-of select="$editingTurnedOn"/>
|
---|
| 307 | -->
|
---|
| 308 |
|
---|
| 309 | <!--
|
---|
| 310 |
|
---|
| 311 | <xsl:choose>
|
---|
| 312 | <xsl:when test="$canDoEditing = 'true' and $editingTurnedOn = 'true'">
|
---|
| 313 |
|
---|
| 314 | <xsl:when test="$canDoEditing = 'true'">
|
---|
| 315 | -->
|
---|
| 316 | <gsf:script src="https://unpkg.com/mirador@latest/dist/mirador.min.js"/>
|
---|
| 317 |
|
---|
| 318 |
|
---|
| 319 | <!-- By default uses Roboto font. Be sure to load this or change the font -->
|
---|
| 320 | <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" />
|
---|
| 321 | <!-- Container element of Mirador whose id should be passed to the instantiating call as "id" -->
|
---|
| 322 |
|
---|
| 323 | <div style="position: relative; width: 100%; height: 800px;">
|
---|
| 324 | <div id="my-mirador"> <xsl:comment>filler</xsl:comment></div>
|
---|
| 325 | </div>
|
---|
| 326 |
|
---|
| 327 | <gsf:script>
|
---|
| 328 |
|
---|
| 329 | var mirador = Mirador.viewer({
|
---|
| 330 | "id": "my-mirador",
|
---|
| 331 | "manifests": {
|
---|
| 332 | "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json": {
|
---|
| 333 | "provider": "IntermusE"
|
---|
| 334 | }
|
---|
| 335 | },
|
---|
| 336 | "window" : { "panels" : { "annotations": true, "attribution": false } },
|
---|
| 337 | "annotations": {
|
---|
| 338 | "htmlSanitizationRuleSet": 'iiif', // See src/lib/htmlRules.js for acceptable values
|
---|
| 339 | "filteredMotivations": ['oa:commenting', 'oa:tagging', 'sc:painting', 'commenting', 'tagging'],
|
---|
| 340 | },
|
---|
| 341 | "windows": [
|
---|
| 342 | {
|
---|
| 343 | "loadedManifest": "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json",
|
---|
[37055] | 344 | "canvasIndex": 1,
|
---|
[36994] | 345 | "thumbnailNavigationPosition": 'far-bottom'
|
---|
| 346 | }
|
---|
| 347 | ]
|
---|
| 348 | });
|
---|
| 349 | </gsf:script>
|
---|
| 350 |
|
---|
| 351 | <!--
|
---|
| 352 | </xsl:when>
|
---|
| 353 | </xsl:choose>
|
---|
| 354 | -->
|
---|
| 355 |
|
---|
| 356 | </xsl:template>
|
---|
| 357 |
|
---|
| 358 |
|
---|
| 359 | </xsl:stylesheet>
|
---|