Changeset 37055


Ignore:
Timestamp:
2022-12-23T22:50:30+13:00 (16 months ago)
Author:
davidb
Message:

A range of changes, mostly to do with the display of the Greenstone doc-view as Mirador3: regular Greenstone view still operational (whether single-page simple doc, or paged); VList statements simplified so it always takes the user to the Mirador version

Location:
gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/etc/collectionConfig.xml

    r37018 r37055  
    3030                    <gsf:metadata name="exp.Title"/>
    3131                    <gsf:metadata name="ex.dc.Title"/>
     32                    <gsf:metadata name="ex.Title"/>
    3233                    <gsf:metadata name="Title"/>
    3334                    <gsf:default>Untitled</gsf:default>
     
    3536            </gsf:template>
    3637
     38            <xsl:template name="document-link-mirador-ahref">
     39              <xsl:param name="embed"/>
     40              <xsl:variable name="href"><xsl:value-of select="$library_name"/><xsl:text>/collection/</xsl:text><xsl:value-of select="/page/pageResponse/collection/@name"/><xsl:text>/document/</xsl:text><xsl:choose><xsl:when test="@OID"><xsl:value-of select="@OID"/></xsl:when><xsl:when test="@OIDmetadata"><xsl:variable name="OIDmeta" select="@OIDmetadata"/><xsl:value-of select="metadataList/metadata[@name='{$OIDmeta}']"/></xsl:when><xsl:otherwise><xsl:value-of select="@nodeID"/></xsl:otherwise></xsl:choose><xsl:text>?book=mirador&amp;ed=1</xsl:text></xsl:variable>             
     41              <a>
     42                <xsl:attribute name="href"><xsl:value-of select="$href"/></xsl:attribute>
     43                <xsl:copy-of select="$embed"/>
     44              </a>
     45              </xsl:template>
    3746
    3847            <xsl:template name="document-link-mirador">
    3948              <a>
    40                 <xsl:attribute name="href">
    41                   <xsl:value-of select='$library_name'/>
    42                   <xsl:text>/collection/</xsl:text>
    43                   <xsl:value-of select='/page/pageResponse/collection/@name'/>
    44                   <xsl:text>/document/</xsl:text>
    45                   <xsl:choose>
    46                 <xsl:when test="@OID">
    47                   <xsl:value-of select="@OID"/>
    48                 </xsl:when>
    49                 <xsl:when test="@OIDmetadata">
    50                   <xsl:variable name="OIDmeta" select="@OIDmetadata"/>
    51                   <xsl:value-of select="metadataList/metadata[@name='{$OIDmeta}']"/>
    52                 </xsl:when>
    53                 <xsl:otherwise>
    54                   <xsl:value-of select='@nodeID'/>
    55                 </xsl:otherwise>
    56                   </xsl:choose>               
    57                   <xsl:text>?book=mirador</xsl:text>
    58                 </xsl:attribute>
    59                 (<gsf:icon type="document" style="vertical-align:middle;"/> Mirador Annotate)
    60                 <!-- <xsl:copy-of select="@value"/> -->
    61                 <!-- <xsl:apply-templates selet="@*|node()"/> -->
     49                <xsl:attribute name="href"><xsl:value-of select="$library_name"/><xsl:text>/collection/</xsl:text><xsl:value-of select="/page/pageResponse/collection/@name"/><xsl:text>/document/</xsl:text><xsl:choose><xsl:when test="@OID"><xsl:value-of select="@OID"/></xsl:when><xsl:when test="@OIDmetadata"><xsl:variable name="OIDmeta" select="@OIDmetadata"/><xsl:value-of select="metadataList/metadata[@name='{$OIDmeta}']"/></xsl:when><xsl:otherwise><xsl:value-of select="@nodeID"/></xsl:otherwise></xsl:choose><xsl:text>?book=mirador&amp;ed=1</xsl:text></xsl:attribute>
     50                <gsf:icon type="document" style="vertical-align:middle;"/><xsl:call-template name="choose-title"/>
    6251              </a>
     52              </xsl:template>
     53             
     54            <xsl:template name="document-link-miradorORIG">
     55                <a><xsl:attribute name="href"><xsl:value-of select="$library_name"/><xsl:text>/collection/</xsl:text><xsl:value-of select="/page/pageResponse/collection/@name"/><xsl:text>/document/</xsl:text><xsl:choose><xsl:when test="@OID"><xsl:value-of select="@OID"/></xsl:when><xsl:when test="@OIDmetadata"><xsl:variable name="OIDmeta" select="@OIDmetadata"/><xsl:value-of select="metadataList/metadata[@name='{$OIDmeta}']"/></xsl:when><xsl:otherwise><xsl:value-of select="@nodeID"/></xsl:otherwise></xsl:choose><xsl:text>?book=mirador&amp;ed=1</xsl:text></xsl:attribute><img src="interfaces/{$interface_name}/images/iannotate.png" style="vertical-align:middle;"/> (Annotate)<!--
     56(<gsf:icon type="document" style="vertical-align:middle;"/> Mirador Annotate)
     57-->
     58<!--
     59<xsl:copy-of select="@value"/>
     60-->
     61<!--
     62<xsl:apply-templates selet="@*|node()"/>
     63-->
     64</a>
    6365            </xsl:template>
    64            
    6566<!--
    6667modify the collection description template to output the "this collection contains X documents and was last built Y days ago" message
     
    114115            <gsf:template match="documentNode">
    115116              <td valign="top">
    116                 <gsf:link type="document">
    117                   <gsf:icon type="document"/>
    118                 </gsf:link>
     117                <!--
     118                  <gsf:link type="document"><gsf:icon style="vertical-align:middle;" type="document"/> (Page view)</gsf:link>
     119                -->
     120                  <xsl:call-template name="document-link-mirador-ahref">
     121                    <xsl:with-param name="embed"><gsf:icon style="vertical-align:middle;" type="document"/></xsl:with-param>
     122                  </xsl:call-template>
     123                 
    119124              </td>
    120               <td valign="top">
    121                 <xsl:call-template name="document-link-mirador" />
    122               </td>
    123               <td>
    124                 <gsf:link type="document">
    125                   <xsl:call-template name="choose-title"/>
    126                 </gsf:link>
    127               </td>
     125              <!--
     126                <td valign="top">
     127                    <xsl:call-template name="document-link-mirador"/>
     128                </td>
     129              -->
     130                <td>
     131                  <!--
     132                    <gsf:link type="document">
     133                        <xsl:call-template name="choose-title"/>
     134                    </gsf:link>
     135                    -->
     136                  <xsl:call-template name="document-link-mirador-ahref">
     137                    <xsl:with-param name="embed">
     138                      <xsl:call-template name="choose-title"/>
     139                      <gsf:switch>
     140                    <gsf:metadata name="ex.im.Artist"/>
     141                    <gsf:when test="exists">, performed by<gsf:metadata name="ex.im.Artist"/></gsf:when>
     142                      </gsf:switch>                   
     143                    </xsl:with-param>
     144                  </xsl:call-template>
     145                   
     146                </td>
    128147            </gsf:template>
    129148        </format>
     
    134153            <plugin name="ZIPPlugin"/>
    135154            <plugin name="GreenstoneXMLPlugin"/>
    136 
    137             <!--
    138             <plugin name="CSVPlugin">
    139               <option name="-use_namespace_for_field_names" value="ex.im" />
    140               <option name="-OIDtype" value="assigned"/>
    141               <option name="-OIDmetadata" value="ex.im.No"/>
    142               <option name="-metadata_value_separator" value=","/>
    143               <option name="-store_field_values_as_document_text" />             
     155            <plugin name="GoogleVisionPagedImagePlugin">
     156                <option name="-enable_cache"/>
     157                <option name="-enable_document_ocr"/>
     158                <option name="-OIDtype" value="filename"/>
     159                <option name="-create_screenview" value="true"/>
     160                <option name="-create_thumbnail" value="true"/>
     161                <option name="-screenviewtype" value="png"/>
     162                <option name="-thumbnailtype" value="png"/>
    144163            </plugin>
    145             -->
    146             <plugin name="GoogleVisionPagedImagePlugin">             
    147                           <option name="-enable_cache"/>
    148               <option name="-enable_document_ocr"/>           
    149                           <option name="-OIDtype" value="filename"/>
    150                           <option name="-create_screenview" value="true"/>
    151                           <option name="-create_thumbnail"  value="true"/>
    152               <!--
    153                           <option name="-converttotype"  value="png"/>
    154               -->
    155                           <option name="-screenviewtype" value="png"/>
    156                           <option name="-thumbnailtype"  value="png"/>
     164            <plugin name="GoogleVisionImagePlugin">
     165                <option name="-enable_cache"/>
     166                <option name="-enable_document_ocr"/>
     167                <option name="-enable_image_labelling"/>
    157168            </plugin>
    158            
    159 
    160             <plugin name="GoogleVisionImagePlugin">
    161               <option name="-enable_cache"/>
    162               <option name="-enable_document_ocr"/>
    163               <option name="-enable_image_labelling"/>
    164               <!--
    165               <option name="-block_exp" value="(?i)\.(txt|item)$"/>
    166               -->
    167             </plugin>
    168            
    169169            <plugin name="TextPlugin">
    170170                <option name="-process_exp" value="(?=(?i).te?xt\$)(?=^(?!.*tk_))"/>
     
    194194    </import>
    195195    <browse>
    196 
    197196        <classifier name="List">
    198197            <option name="-metadata" value="dc.Title,Title"/>
     
    201200            <option name="-metadata_selection_mode_within_level" value="firstvalue"/>
    202201        </classifier>
    203 
    204      
    205202        <format>
    206203            <gsf:template match="documentNode">
    207204              <td valign="top">
    208                 <gsf:link type="document">
    209                   <gsf:choose-metadata>
    210                 <gsf:metadata name="thumbicon"/>
    211                 <gsf:metadata name="srcicon"/>
    212                 <gsf:default>
    213                   <gsf:icon type="document"/>
    214                 </gsf:default>
    215                   </gsf:choose-metadata>
    216                 </gsf:link>
    217               </td>
    218 
    219               <td valign="top">
    220                 <xsl:call-template name="document-link-mirador"/>
    221               </td>
    222              
    223               <td valign="top">
    224                 <gsf:link type="document">
    225                   <!--
    226                   Defined in the global format statement
    227                   -->
    228                   <xsl:call-template name="choose-title"/>
    229                    <gsf:switch>
    230                                  <gsf:metadata name="ex.im.Artist"/>
    231                                  <gsf:when test="exists">, performed by <gsf:metadata name="ex.im.Artist"/></gsf:when>
    232                                </gsf:switch>
    233                    <!--
    234                    <gsf:switch>
    235                                  <gsf:metadata name="Composer"/>
    236                                  <gsf:when test="exists">
    237                                    <i> (Composed by <gsf:metadata name="Composer"/>)</i>
    238                                  </gsf:when>
    239                                </gsf:switch>
    240                    -->
    241 
    242                 </gsf:link>
    243               </td>
    244             </gsf:template>
    245            
     205                <!--
     206                  <gsf:link type="document"><gsf:icon style="vertical-align:middle;" type="document"/> (Page view)</gsf:link>
     207                --> 
     208                  <xsl:call-template name="document-link-mirador-ahref">
     209                    <xsl:with-param name="embed"><gsf:icon style="vertical-align:middle;" type="document"/></xsl:with-param>
     210                  </xsl:call-template>
     211                </td>
     212                <td valign="top">
     213                  <!--
     214                  <xsl:call-template name="document-link-mirador"/>
     215                  -->
     216                  <xsl:call-template name="document-link-mirador-ahref">
     217                    <xsl:with-param name="embed">
     218                      <xsl:call-template name="choose-title"/>
     219                      <gsf:switch>
     220                    <gsf:metadata name="ex.im.Artist"/>
     221                    <gsf:when test="exists">, performed by<gsf:metadata name="ex.im.Artist"/></gsf:when>
     222                      </gsf:switch>                   
     223                    </xsl:with-param>
     224                  </xsl:call-template>
     225                </td>
     226                <!--
     227                <td valign="top">
     228                    <gsf:link type="document">
     229                        <xsl:call-template name="choose-title"/>
     230                        <gsf:switch>
     231                            <gsf:metadata name="ex.im.Artist"/>
     232                            <gsf:when test="exists">, performed by<gsf:metadata name="ex.im.Artist"/></gsf:when>
     233                        </gsf:switch>
     234
     235                    </gsf:link>
     236                </td>
     237                -->
     238            </gsf:template>
    246239            <gsf:template match="classifierNode[@classifierStyle = 'VList']">
    247240                <td valign="top">
     
    256249                </td>
    257250            </gsf:template>
    258            
    259251            <gsf:template match="classifierNode[@classifierStyle = 'HList']">
    260252                <gsf:link style="static" type="classifier">
     
    265257    </browse>
    266258    <display>
    267         <format>
     259      <format>
     260           <gsf:headMetaTags>
     261             <gsf:metadata name="Title"/>
     262           </gsf:headMetaTags>
     263
    268264            <gsf:option name="TOC" value="true"/>
    269265            <gsf:option name="allowUserComments" value="true"/>
     
    274270-->
    275271<!--
    276             <gsf:template name="documentHeading">
     272<gsf:template name="documentHeading">
    277273                <span style="font-weight:italic; font-size: 120%;">
    278274                    <xsl:call-template name="choose-title"/>
     
    280276            </gsf:template>
    281277-->
    282 
    283                     <xsl:template name="documentHeading">
    284 
    285               <gsf:metadata name="HasGoogleVisionDocumentOCRJSON" hidden="true"/>
    286               <gsf:metadata name="GVDocumentOCRJSON" hidden="true"/>
    287               <gsf:metadata name="Image" hidden="true"/> <!-- **** currently needed to ensure ILT TOC gets Image (rather than Source) metadata ????? -->
    288               <span style="font-weight:bold; font-size: 120%;">
    289                 <xsl:call-template name="choose-title"/>
    290               </span>
    291               <gsf:metadata-table>
    292                 <gsf:metadata name="ex.im.No">Catalogue No:</gsf:metadata>
    293                 <gsf:metadata name="ex.im.Work">Work:</gsf:metadata>
    294                 <gsf:metadata name="ex.im.Artist">Artist(s):</gsf:metadata>
    295                 <gsf:metadata name="ex.im.Venue">Venue:</gsf:metadata>
    296                 <gsf:metadata name="ex.im.Composer">Composer:</gsf:metadata>
    297               </gsf:metadata-table>
     278            <xsl:template name="documentHeading">
     279                <gsf:metadata hidden="true" name="HasGoogleVisionDocumentOCRJSON"/>
     280                <gsf:metadata hidden="true" name="GVDocumentOCRJSON"/>
     281                <gsf:metadata hidden="true" name="Image"/>
     282                <!--
     283                    **** currently needed to ensure ILT TOC gets Image (rather than Source) metadata ?????
     284                -->
     285
     286                <xsl:if test="$bookswitch != 'mirador'">
     287                  <span style="font-weight:bold; font-size: 120%;">
     288                    <xsl:call-template name="choose-title"/>
     289                  </span>
     290                </xsl:if>
     291
     292                <gsf:metadata-table>
     293                    <gsf:metadata name="ex.im.No">Catalogue No:</gsf:metadata>
     294                    <gsf:metadata name="ex.im.Work">Work:</gsf:metadata>
     295                    <gsf:metadata name="ex.im.Artist">Artist(s):</gsf:metadata>
     296                    <gsf:metadata name="ex.im.Venue">Venue:</gsf:metadata>
     297                    <gsf:metadata name="ex.im.Composer">Composer:</gsf:metadata>
     298                </gsf:metadata-table>
    298299            </xsl:template>
    299            
    300 
    301300<!--
    302301Overwriting this template can be used to redefine the content of the whole document. This is useful for simple documents, but not recommended for more complex documents (e.g. hierachical and paged documents) as it can prevent any sub-sections from showing.
     
    317316-->
    318317            <gsf:template name="sectionHeading">
    319                 <xsl:call-template name="choose-title"/>
     318              <xsl:call-template name="choose-title"/>
    320319            </gsf:template>
    321320<!--
  • gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/js/document_viewer.js

    r37017 r37055  
    292292
    293293*/
     294
     295
     296
     297function createMirador3Viewer()
     298{
     299   
     300    var mirador3_config = {
     301    "manifests": {
     302        "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json": {
     303        "provider": "InterMusE"
     304        }
     305    },
     306    "window" : { "panels" : { "annotations": true, "attribution": true } },
     307
     308    //"annotations": {
     309    //  "htmlSanitizationRuleSet": 'iiif', // See src/lib/htmlRules.js for acceptable values
     310    //  "filteredMotivations": ['oa:commenting', 'oa:tagging', 'sc:painting', 'commenting', 'tagging'],
     311    //},
     312    "requests": {
     313        "postprocessors": [
     314        (url, action) => {
     315            if (action.type === "mirador/RECEIVE_MANIFEST") {
     316            //console.log(action)
     317            //console.log(iiif_manifest);
     318            return {
     319                ...action ,
     320                "manifestJson": iiif_manifest
     321            };
     322            }
     323        }
     324        ]
     325    },
     326   
     327    "windows": [
     328        {
     329        "loadedManifest": "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json",
     330        "canvasIndex": 0,
     331        "thumbnailNavigationPosition": 'far-bottom'
     332        }
     333    ]
     334    };
     335
     336   
     337    var mirador3_viewer = mirador3WithAnnotations.initMirador3Viewer('mirador3-viewer',mirador3_config);
     338
     339    /*
     340    var mirador3_viewer = Mirador.viewer({
     341    "id": "mirador3-viewer",
     342    "manifests": {
     343        "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json": {
     344        "provider": "IntermusE"
     345        }
     346    },
     347    "window" : { "panels" : { "annotations": true, "attribution": false } },
     348    //"annotations": {
     349    //  "htmlSanitizationRuleSet": 'iiif', // See src/lib/htmlRules.js for acceptable values
     350    //  "filteredMotivations": ['oa:commenting', 'oa:tagging', 'sc:painting', 'commenting', 'tagging'],
     351    //},
     352    "requests": {
     353        "postprocessors": [
     354        (url, action) => {
     355            if (action.type === "mirador/RECEIVE_MANIFEST") {
     356            //console.log(action)
     357            //console.log(iiif_manifest);
     358            return {
     359                ...action ,
     360                "manifestJson": iiif_manifest
     361            };
     362            }
     363        }
     364        ]
     365    },
     366   
     367    "windows": [
     368        {
     369        "loadedManifest": "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json",
     370        "canvasIndex": 0,
     371        "thumbnailNavigationPosition": 'far-bottom'
     372        }
     373    ]
     374    });
     375    */
     376   
     377    return mirador3_viewer;
     378}
     379
     380function initIIIFAnnotations()
     381{
     382    var iiif_annotations_example = {
     383    "@context": "http://www.shared-canvas.org/ns/context.json",
     384    "@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/list/47174896",
     385    "@type": "sc:AnnotationList",
     386    "resources": [
     387            {
     388        "@context": "http://iiif.io/api/presentation/2/context.json",
     389        "@id": "https://iiif.harvardartmuseums.org/annotations/9641482",
     390        "@type": "oa:Annotation",
     391        "motivation": [
     392                    "oa:commenting"
     393        ],
     394        "on": {
     395                    "@type": "oa:SpecificResource",
     396                    "full": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896",
     397                    "selector": {
     398            "@type": "oa:FragmentSelector",
     399            "value": "xywh=622,591,642,940"
     400                    },
     401                    "within": {
     402            "@id": "https://iiif.harvardartmuseums.org/manifests/object/299843",
     403            "@type": "sc:Manifest"
     404                    }
     405        },
     406        "resource": [
     407                    {
     408            "@type": "dctypes:Text",
     409            "chars": "<p>age: 35-52<br/>gender: Female(66.337677%)<br/>CALM: 55.438412%<br/>CONFUSED: 3.949288%<br/>SURPRISED: 2.33092%<br/>DISGUSTED: 0.545727%<br/>HAPPY: 1.549943%<br/>ANGRY: 2.082294%<br/>SAD: 34.103416%<br/></p><p>Generated by AWS Rekognition</p>",
     410            "format": "text/html"
     411                    }
     412        ]
     413            }
     414        // More ...
     415    ]
     416    };
     417
     418    document.open("application/json");
     419    document.write(JSON.stringify(iiif_annotations_example));
     420    document.close();
     421}
     422
     423       
     424function initIIIFManifest(iiifpres_root_id,iiifpres_label, iiif_doc_images)
     425{
     426    console.log("IIIF_Doc_Images");
     427    console.log(iiif_doc_images);
     428    // Developed with reference to the following manifest example:
     429    //  https://iiif.archivelab.org/iiif/McGillLibrary-rbsc_ms-medieval-073-18802/manifest.json
     430   
     431    var iiif_manifest = {
     432        "@context": "http://iiif.io/api/presentation/2/context.json",
     433    "@id": iiifpres_root_id + "/manifest",
     434    "@type": "sc:Manifest",
     435    "label": iiifpres_label,
     436    "attribution": "The Internet of Musical Events (InterMusE): Digital Scholarship, Community, and the Archiving of Performance",
     437    "license": "https://**** To Be Determined ****",
     438    "logo": "https://intermuse.datatodata.org/wp-content/uploads/sites/4/2021/03/cropped-cropped-cropped-1.png"
     439    };
     440
     441    /*
     442    var iiif_metadata = [
     443    { "label": "creator", "value": ["aaa1","aaa2"] },
     444    { "label": "title", "value": ["ttt"] }
     445    ];
     446
     447    iiif_manifest.metadata = iiif_metadata;
     448    */
     449   
     450   
     451    // trival IIIF sequences => has one IIIF canvas in it
     452    var iiif_sequence = {
     453    "@context": "http://iiif.io/api/image/2/context.json",
     454        "@id": iiifpres_root_id + "/sequence/normal",
     455        "@type": "sc:Sequence"
     456    };
     457
     458
     459    var iiif_canvases = [];
     460
     461    var assocfilepath = gs.documentMetadata['assocfilepath'];
     462   
     463    for (var i=0; i<iiif_doc_images.length; i++) {
     464    var section = i+1; // assumes flat (i.e. non-hierarchical) image document structure
     465   
     466    var iiif_doc_image = iiif_doc_images[i];
     467    console.log(iiif_doc_image);
     468    var iiifimg_root_id = iiif_doc_image.id;
     469
     470    var iiifimg_x_dim = iiif_doc_image.x_dim;
     471    var iiifimg_y_dim = iiif_doc_image.y_dim;
     472    var iiifimg_label = iiif_doc_image.chosen_title;
     473   
     474    var iiif_canvas = {
     475        "@context": "http://iiif.io/api/presentation/2/context.json",
     476        //"@id": "https://iiif.lib.harvard.edu/manifests/drs:48309543/canvas/canvas-48309544.json",
     477        "@id": iiifpres_root_id +"/canvas/" + section,
     478            "@type": "sc:Canvas",
     479            "width":  iiifimg_x_dim,
     480        "height": iiifimg_y_dim,
     481        "label":  iiifimg_label,
     482
     483        // **** Annotation JSON File
     484        "otherContent": [
     485                {
     486                    //"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/list/47174896",
     487            "@id": "https://intermuse.sowemustthink.space/greenstone3/library/sites/intermuse/collect/programmes/index/assoc/"+assocfilepath+"/openannotation-list.json",
     488                    "@type": "sc:AnnotationList"
     489                }
     490            ]     
     491    };
     492   
     493    var iiif_image = {
     494        "@context": "http://iiif.io/api/image/2/context.json",
     495            //"@id": "https://iiif.lib.harvard.edu/manifests/drs:48309543/annotation/anno-48309544.json",
     496            "@id": iiifpres_root_id +"/annotation/" + section,
     497            "@type": "oa:Annotation",
     498            "motivation": "sc:painting",
     499            //"on": "https://iiif.lib.harvard.edu/manifests/drs:48309543/canvas/canvas-48309544.json",
     500            "on": iiifpres_root_id +"/canvas",
     501            "resource": {
     502        //"@id": "https://intermuse.sowemustthink.space/gs-cantaloupe/iiif/2/intermuse:programmes:HASH012cd965c3e83d504f4a78cd//full/full/0/default.jpg",
     503        "@id": iiifimg_root_id+"/full/full/0/default.jpg",
     504        "@type": "dctypes:Image",
     505        "format": "image/jpeg",
     506        //"width":  1700,
     507        //"height": 2338,
     508        "width":  iiifimg_x_dim,
     509        "height": iiifimg_y_dim,
     510        "service": {
     511                    "@context": "http://iiif.io/api/image/2/context.json",
     512                    //"@id": "https://intermuse.sowemustthink.space/gs-cantaloupe/iiif/2/intermuse:programmes:HASH012cd965c3e83d504f4a78cd",
     513                    "@id": iiifimg_root_id,
     514                    "profile": "https://iiif.io/api/image/2/profiles/level2.json"
     515        }
     516            }
     517    };
     518
     519
     520    var iiif_thumbnail = {
     521            //"@id": "https://intermuse.sowemustthink.space/gs-cantaloupe/iiif/2/intermuse:programmes:HASH012cd965c3e83d504f4a78cd/full/,150/0/default.jpg",
     522            "@id": iiifimg_root_id + "/full/,150/0/default.jpg",
     523            "@type": "dctypes:Image"
     524    };
     525
     526    iiif_canvas.images    = [ iiif_image ];
     527    iiif_canvas.thumbnail = iiif_thumbnail;
     528
     529    iiif_canvases.push(iiif_canvas);
     530    }
     531   
     532    iiif_sequence.canvases = iiif_canvases;
     533    iiif_manifest.sequences = [ iiif_sequence ];
     534       
     535    return iiif_manifest;
     536}
  • gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/transform/pages/document.xsl

    r37018 r37055  
    99    exclude-result-prefixes="java util gsf">
    1010
    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
    1221  <xsl:template name="iiif-links">
    1322    <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    <!--
    1531    <div style="padding-top: 10px; padding-bottom: 10px;">
    1632      IIIF Server Info URL:
     
    2440      <a href="/gs-cantaloupe/iiif/2/{$site_name}:{$collNameChecked}:{$identifier}/full/full/0/default.jpg">
    2541    /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&amp;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 &amp;&amp; !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
    2979  </xsl:template>
    3080
     
    3484   
    3585    <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    <!--
    3889    <div style="padding-top: 10px; padding-bottom: 10px;">
    3990      Google Vision OCR JSON:
     
    4697      </a>
    4798    </div>
     99    -->
    48100    <gsf:script>
    49101      load_gv_dococr_json(gs.variables.GVDocumentOCRJSON,gs.variables.docSectionID,display_gv_ocr_bounding_boxes);
     
    67119  </xsl:template>
    68120
     121  <xsl:template name="sectionImage">
     122    <xsl:if test="$bookswitch != 'mirador'">
     123      <gsf:image type="screen"/>
     124    </xsl:if>
     125  </xsl:template>
    69126
    70127  <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   
    76148    <xsl:call-template name="wrappedSectionPost"/>
    77149  </xsl:template>
     
    83155
    84156  <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>
    88168       div.ocr-boundingbox-overlay {
    89169         position: absolute;
     
    97177       }
    98178
    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>
    115190   
    116191    <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">
    141199    <xsl:if test="@docType='simple'">
     200      <gsf:script>$('#tocLoadingImage').hide()</gsf:script>
    142201      <!-- add in IIIF Server link for simple page image -->
    143202      <xsl:call-template name="iiif-links">
     
    145204      </xsl:call-template>
    146205    </xsl:if>
    147 
    148 
    149206  </xsl:template>
    150207 
    151208  <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   
    152212    <div id="gs-document">
    153213
     
    155215    <xsl:when test="$bookswitch = 'mirador'">
    156216      <xsl:call-template name="documentPre"/>
    157       <xsl:call-template name="documentContentMirador"/>
     217      <xsl:call-template name="documentContentMirador3"/>
    158218      <xsl:call-template name="documentPost"/>
     219      <xsl:call-template name="documentPostMirador3"/>
    159220    </xsl:when>
     221
    160222    <xsl:otherwise>
    161       <div>book swith = <xsl:value-of select="$bookswitch"/></div>
    162223      <xsl:call-template name="documentPre"/>
    163224      <xsl:call-template name="wrappedSectionImage"/>
     
    167228      <xsl:call-template name="documentPost"/>
    168229    </xsl:otherwise>
     230
    169231      </xsl:choose>
    170232    </div>
     
    174236 
    175237  <xsl:template name="documentPost">
     238   
    176239    <xsl:if test="@docType='simple'">
    177240
     
    192255     
    193256    </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>
    197293  </xsl:template>
    198294
     
    242338    {
    243339      "loadedManifest": "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json",
    244       "canvasIndex": 2,
     340      "canvasIndex": 1,
    245341      "thumbnailNavigationPosition": 'far-bottom'
    246342    }
Note: See TracChangeset for help on using the changeset viewer.