Changeset 37055 for gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/transform/pages/document.xsl
- Timestamp:
- 2022-12-23T22:50:30+13:00 (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/transform/pages/document.xsl
r37018 r37055 9 9 exclude-result-prefixes="java util gsf"> 10 10 11 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 12 21 <xsl:template name="iiif-links"> 13 22 <xsl:param name="identifier"/> 14 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 <!-- 15 31 <div style="padding-top: 10px; padding-bottom: 10px;"> 16 32 IIIF Server Info URL: … … 24 40 <a href="/gs-cantaloupe/iiif/2/{$site_name}:{$collNameChecked}:{$identifier}/full/full/0/default.jpg"> 25 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 26 </a> <br /> 27 </div> 28 42 </a> 43 </div> 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 --> 52 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 29 79 </xsl:template> 30 80 … … 34 84 35 85 <gsf:variable name="GVDocumentOCRJSON"><gsf:metadata name="GVDocumentOCRJSON"/></gsf:variable> 36 <gsf:variable name="docSectionID"><xsl:value-of select="util:replace(@nodeID, '.', '_')}"/></gsf:variable> 37 86 <gsf:variable name="docSectionID"><xsl:value-of select="util:replace(@nodeID, '.', '_')"/></gsf:variable> 87 88 <!-- 38 89 <div style="padding-top: 10px; padding-bottom: 10px;"> 39 90 Google Vision OCR JSON: … … 46 97 </a> 47 98 </div> 99 --> 48 100 <gsf:script> 49 101 load_gv_dococr_json(gs.variables.GVDocumentOCRJSON,gs.variables.docSectionID,display_gv_ocr_bounding_boxes); … … 67 119 </xsl:template> 68 120 121 <xsl:template name="sectionImage"> 122 <xsl:if test="$bookswitch != 'mirador'"> 123 <gsf:image type="screen"/> 124 </xsl:if> 125 </xsl:template> 69 126 70 127 <xsl:template name="sectionContent"> 71 <xsl:call-template name="wrappedSectionImage"/> 72 <div style="padding: 10px 0px 10px 0px">Ocr'd Text:</div> 73 <i> 74 <xsl:call-template name="wrappedSectionText"/> 75 </i> 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 76 148 <xsl:call-template name="wrappedSectionPost"/> 77 149 </xsl:template> … … 83 155 84 156 <xsl:template name="documentPre"> 85 <xsl:variable name="httpCollection">library/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:variable> 86 <gsf:script src="{$httpCollection}/js/document_viewer.js"/> 87 <style> 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> 88 168 div.ocr-boundingbox-overlay { 89 169 position: absolute; … … 97 177 } 98 178 99 </style> 100 </xsl:template> 101 102 103 <xsl:template name="documentContentMirador"> 104 105 <gsf:script src="https://unpkg.com/mirador@latest/dist/mirador.min.js"/> 106 107 108 <!-- By default uses Roboto font. Be sure to load this or change the font --> 109 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" /> 110 <!-- Container element of Mirador whose id should be passed to the instantiating call as "id" --> 111 112 <div style="position: relative; width: 100%; height: 800px;"> 113 <div id="my-mirador"> <xsl:comment>filler</xsl:comment></div> 114 </div> 179 </style> 180 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"/> 185 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> 115 190 116 191 <gsf:script> 117 118 var mirador = Mirador.viewer({ 119 "id": "my-mirador", 120 "manifests": { 121 "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json": { 122 "provider": "IntermusE" 123 } 124 }, 125 "window" : { "panels" : { "annotations": true, "attribution": false } }, 126 "annotations": { 127 "htmlSanitizationRuleSet": 'iiif', // See src/lib/htmlRules.js for acceptable values 128 "filteredMotivations": ['oa:commenting', 'oa:tagging', 'sc:painting', 'commenting', 'tagging'], 129 }, 130 "windows": [ 131 { 132 "loadedManifest": "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json", 133 "canvasIndex": 2, 134 "thumbnailNavigationPosition": 'far-bottom' 135 } 136 ] 137 }); 138 </gsf:script> 139 140 192 var IIIF_Doc_Images = []; 193 </gsf:script> 194 195 </xsl:template> 196 197 198 <xsl:template name="documentContentMirador3"> 141 199 <xsl:if test="@docType='simple'"> 200 <gsf:script>$('#tocLoadingImage').hide()</gsf:script> 142 201 <!-- add in IIIF Server link for simple page image --> 143 202 <xsl:call-template name="iiif-links"> … … 145 204 </xsl:call-template> 146 205 </xsl:if> 147 148 149 206 </xsl:template> 150 207 151 208 <xsl:template name="documentContent"> 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 152 212 <div id="gs-document"> 153 213 … … 155 215 <xsl:when test="$bookswitch = 'mirador'"> 156 216 <xsl:call-template name="documentPre"/> 157 <xsl:call-template name="documentContentMirador "/>217 <xsl:call-template name="documentContentMirador3"/> 158 218 <xsl:call-template name="documentPost"/> 219 <xsl:call-template name="documentPostMirador3"/> 159 220 </xsl:when> 221 160 222 <xsl:otherwise> 161 <div>book swith = <xsl:value-of select="$bookswitch"/></div>162 223 <xsl:call-template name="documentPre"/> 163 224 <xsl:call-template name="wrappedSectionImage"/> … … 167 228 <xsl:call-template name="documentPost"/> 168 229 </xsl:otherwise> 230 169 231 </xsl:choose> 170 232 </div> … … 174 236 175 237 <xsl:template name="documentPost"> 238 176 239 <xsl:if test="@docType='simple'"> 177 240 … … 192 255 193 256 </xsl:if> 194 195 196 257 </xsl:template> 258 259 <xsl:template name="documentPostMirador3"> 260 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> 265 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 276 </xsl:template> 277 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> 197 293 </xsl:template> 198 294 … … 242 338 { 243 339 "loadedManifest": "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json", 244 "canvasIndex": 2,340 "canvasIndex": 1, 245 341 "thumbnailNavigationPosition": 'far-bottom' 246 342 }
Note:
See TracChangeset
for help on using the changeset viewer.