Ignore:
Timestamp:
2023-01-05T23:53:30+13:00 (16 months ago)
Author:
davidb
Message:

A series of changes getting the code and XSLT up to the point where the Mirador annotation viewer can be operated without annotations, with annotaitons from a static manifest, with annotations from the store (editable)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/transform/pages/document.xsl

    r37088 r37105  
    8484
    8585
    86   <xsl:template name="googlevision-ocr-json">
     86  <xsl:template name="opt-googlevision-ocr-json">
    8787    <xsl:param name="assocfilepath"/>
    8888   
     
    9090    <gsf:variable name="docSectionID"><xsl:value-of select="util:replace(@nodeID, '.', '_')"/></gsf:variable>
    9191
    92     <!--
    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']"/>
    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"/>
    99     </xsl:attribute>
    100     <xsl:value-of select="$GVDocumentOCRJSON"/>
    101       </a>
    102     </div>
    103     -->
    104     <gsf:script>
    105       load_gv_dococr_json(gs.variables.GVDocumentOCRJSON,gs.variables.docSectionID,display_gv_ocr_bounding_boxes);
    106     </gsf:script>
     92    <gsf:switch>
     93      <gsf:metadata name="HasGoogleVisionDocumentOCRJSON"/>
     94      <gsf:when test='equals' test-value="1">
     95
     96    <gsf:script>
     97      // Load in the Google Vision OCR JSON file and display bounding boxes for this document (docType=simple) or page (docType=paged)
     98      load_gv_dococr_json(gs.variables.GVDocumentOCRJSON,gs.variables.docSectionID,display_gv_ocr_bounding_boxes);
     99    </gsf:script>
     100      </gsf:when>
     101    </gsf:switch>
     102   
    107103  </xsl:template>
    108104
     
    117113
    118114    <!-- add in Google Vision OCR JSON link for section image -->
    119     <xsl:call-template name="googlevision-ocr-json">
     115    <xsl:call-template name="opt-googlevision-ocr-json">
    120116      <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" select="root"/></xsl:with-param>
    121117    </xsl:call-template>   
     
    177173  <xsl:template name="documentPre">
    178174    <xsl:variable name="httpCollection">library/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:variable>
     175
     176    <gsf:variable name="optionIncludeFileAssocOpenAnnotations">
     177      <xsl:value-of select="/page/pageResponse/format[@type='display']/gsf:option[@name='includeFileAssocOpenAnnotations']/@value"/>
     178    </gsf:variable>
     179    <gsf:variable name="optionIncludeEditableOpenAnnotations">
     180      <xsl:value-of select="/page/pageResponse/format[@type='display']/gsf:option[@name='includeEditableOpenAnnotations']/@value"/>
     181    </gsf:variable>
     182    <gsf:variable name="optionIncludeEditableOpenAnnotationsEndpointURL">
     183      <xsl:value-of select="/page/pageResponse/format[@type='display']/gsf:option[@name='includeEditableOpenAnnotations']/@endpointURL"/>
     184    </gsf:variable>
     185
     186
    179187    <gsf:variable name="chosenTitle"><xsl:call-template name="choose-title"/></gsf:variable>
    180188    <!-- <gsf:variable name="toplevelTitle"><gsf:metadata name="Title" select="root"/></gsf:variable> -->
     
    259267   
    260268    <xsl:if test="@docType='simple'">
    261 
    262       <!--
    263       <gsf:switch>
    264     <gsf:metadata name='HasGoogleVisionDocumentOCRJSON";'/>
    265       <gsf:when test='equals' test-value="1">
    266       -->
    267 
    268       <!-- add in Google Vision OCR JSON link for simple page image -->     
    269       <xsl:call-template name="googlevision-ocr-json">
    270         <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" pos="first"/></xsl:with-param>
    271       </xsl:call-template>
    272       <!--
    273     </gsf:when>
    274       </gsf:switch>
    275 -->
    276      
     269      <xsl:call-template name="opt-googlevision-ocr-json">
     270    <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" pos="first"/></xsl:with-param>
     271      </xsl:call-template>     
    277272    </xsl:if>
    278273  </xsl:template>
     
    282277    <!-- Container element of Mirador whose id should be passed to the instantiating call as "id" -->   
    283278    <div style="position: relative; width: 100%; height: 800px;">
    284       <div id="mirador3-viewer"> <xsl:comment>filler</xsl:comment></div>
    285     </div>
     279      <div id="mirador3-viewer"><xsl:comment>filler</xsl:comment></div>
     280    </div>
     281
     282    <!--
     283    <gsf:variable name="endpointURL">
     284      <xsl:choose>
     285    <xsl:when test="/page/pageResponse/format[@type='display']/gsf:option[@name='includeEditableOpenAnnotations']/@value='true'">
     286      <xsl:choose>
     287        <xsl:when test="/page/pageResponse/format[@type='display']/gsf:option[@name='includeEditableOpenAnnotations']/@endpointURL">
     288          <xsl:value-of select="/page/pageResponse/format[@type='display']/gsf:option[@name='includeEditableOpenAnnotations']/@endpointURL"/>
     289        </xsl:when>
     290        <xsl:otherwise>
     291          <xsl:text>localStorage</xsl:text> < ! - - default - - >
     292        </xsl:otherwise>
     293      </xsl:choose>
     294        </xsl:when>
     295    <xsl:otherwise></xsl:otherwise>
     296      </xsl:choose>
     297    </gsf:variable>
     298    -->
    286299
    287300    <gsf:script>     
Note: See TracChangeset for help on using the changeset viewer.