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