diff --git a/add/data/xql/getAnnotationMeta.xql b/add/data/xql/getAnnotationMeta.xql index 4a13b08d82c85e58f27d8aece234d257c0510089..eca743caaa78e5b8bfb49c1c6d303b194ed89d36 100644 --- a/add/data/xql/getAnnotationMeta.xql +++ b/add/data/xql/getAnnotationMeta.xql @@ -28,6 +28,7 @@ xquery version "1.0"; import module namespace annotation="http://www.edirom.de/xquery/annotation" at "../xqm/annotation.xqm"; import module namespace source="http://www.edirom.de/xquery/source" at "../xqm/source.xqm"; import module namespace eutil="http://www.edirom.de/xquery/util" at "../xqm/util.xqm"; +import module namespace functx = "http://www.functx.com" at "../xqm/functx-1.0-nodoc-2007-01.xq"; declare namespace request="http://exist-db.org/xquery/request"; declare namespace mei="http://www.music-encoding.org/ns/mei"; @@ -43,6 +44,7 @@ let $docUri := substring-before($uri, '#') let $internalId := substring-after($uri, '#') let $doc := doc($docUri) let $annot := $doc/id($internalId) +let $workID := substring-before(functx:substring-after-last($docUri, '/'), '.xml') let $participants := annotation:getParticipants($annot) @@ -61,7 +63,7 @@ let $sourcesLabel := if ($lang = 'de') then (if(count($sources) gt 1)then('Quellen')else('Quelle')) else(if(count($sources) gt 1)then('Sources')else('Source')) -let $sigla := source:getSiglaAsArray($participants) +let $sigla := source:getSiglaAsArray($participants, $workID) let $siglaLabel := if ($lang = 'de') then (if(count($sigla) gt 1)then('Siglen')else('Siglum')) else(if(count($sigla) gt 1)then('Sources')else('Source')) diff --git a/add/data/xql/getAnnotationPreviews.xql b/add/data/xql/getAnnotationPreviews.xql index 1f8444aeb768eb247521d56d5944f84aa7d13ca4..2d58ef64d4077279e75965085e28a4593d5ff6ae 100644 --- a/add/data/xql/getAnnotationPreviews.xql +++ b/add/data/xql/getAnnotationPreviews.xql @@ -30,6 +30,8 @@ import module namespace source="http://www.edirom.de/xquery/source" at "../xqm/s import module namespace teitext="http://www.edirom.de/xquery/teitext" at "../xqm/teitext.xqm"; import module namespace eutil = "http://www.edirom.de/xquery/util" at "../xqm/util.xqm"; import module namespace edition="http://www.edirom.de/xquery/edition" at "../xqm/edition.xqm"; +import module namespace mriSource="https://maxreger.info/mriSource" at "/db/apps/mriCat/modules/mriSource.xqm"; + import module namespace functx = "http://www.functx.com" at "../xqm/functx-1.0-nodoc-2007-01.xq"; @@ -94,6 +96,9 @@ declare function local:getTextNotePrecedingContent($elem as element()) as xs:str }; declare function local:getSourceParticipants($participants as xs:string*, $doc as xs:string) as xs:string* { + let $uri := request:get-parameter('uri', '') (: TODO remove temporary workaround :) + let $docUri := substring-before($uri, '.xml#') + let $workID := functx:substring-after-last($docUri, '/') let $combs := local:groupParticipants($participants, $doc) @@ -111,8 +116,14 @@ declare function local:getSourceParticipants($participants as xs:string*, $doc a let $label := local:getItemLabel($elems) let $mdiv := ''(: TODO if($elem/ancestor-or-self::mei:mdiv) then($elem/ancestor-or-self::mei:mdiv/@label) else(''):) let $page := if($zones[1]/parent::mei:surface/@label != '') then($zones[1]/parent::mei:surface/@label) else($zones[1]/parent::mei:surface/@n) - let $source := eutil:getLocalizedName($elems[1]/root()//mei:source/mei:titleStmt, $lang) - let $siglum := $elems[1]/root()//mei:source/mei:identifier[@type eq 'siglum']/text() + + let $sourceID := functx:substring-after-last(substring-before($doc, '.xml'), '/') + let $sourceIdent := mriSource:getTitleData($sourceID, $workID, $lang) + let $sourceType := $sourceIdent?type + let $sourceSiglum := $sourceIdent?siglum + + let $source := $sourceType + let $siglum := $sourceSiglum let $part := string-join(distinct-values(for $e in $elems return $e/ancestor::mei:part/@label),'-') let $graphic := $zones[1]/../mei:graphic[@type = 'facsimile'] diff --git a/add/data/xql/getLinkTarget.xql b/add/data/xql/getLinkTarget.xql index f74b5958ff6dd329bca90cf5d829e340163ad41b..2a33ccf41640a2d555b6cae47a8cd908bc72eb20 100644 --- a/add/data/xql/getLinkTarget.xql +++ b/add/data/xql/getLinkTarget.xql @@ -26,6 +26,7 @@ declare namespace request="http://exist-db.org/xquery/request"; declare namespace mei="http://www.music-encoding.org/ns/mei"; declare namespace tei="http://www.tei-c.org/ns/1.0"; declare namespace xmldb="http://exist-db.org/xquery/xmldb"; +declare namespace conf="https://www.maxreger.info/conf"; declare option exist:serialize "method=text media-type=text/plain omit-xml-declaration=yes"; @@ -35,7 +36,7 @@ declare variable $lang := request:get-parameter('lang', ''); declare function local:getLocalizedMEITitle($node) { let $nodeName := local-name($node) - let $titleMain := $node/mei:title[@xml:lang = $lang]/mei:title[@type='main']/text() + let $titleMain := ($node/mei:title[@xml:lang = $lang]/mei:title[@type='main']/text() | $node/mei:title[@xml:lang = $lang]/mei:titlePart[@type='main']/text()) let $titlePerf := $node/mei:title[@xml:lang = $lang]/mei:title[@type='perf']/text() let $identifierOpus := $node/../mei:identifier[@type='opus']/text() let $identifierWoo := $node/../mei:identifier[@type='woo']/text() @@ -122,6 +123,7 @@ declare function local:getViews($type, $docUri, $doc) { ), ',') }; +let $workID := request:get-parameter('workId', '') let $uri := request:get-parameter('uri', '') let $uriParams := if(contains($uri, '?')) then(substring-after($uri, '?')) else('') @@ -182,6 +184,11 @@ let $type := else(string('unknown')) +let $configResource := doc('xmldb:exist:///db/apps/mriExistDBconf/config.xml') +let $mrpUrl := $configResource//conf:mrpURL +let $getEdiromObjectWindowTitleUrl := concat($mrpUrl, '/cat/rest/getEdiromObjectWindowTitle.xql?workID=', $workID, '&sourceID=', substring-before(functx:substring-after-last($uri, '/'), '.xml'), '&lang=', $lang) + + let $title := (: Work :) if(exists($doc//mei:mei) and exists($doc//mei:work) and not(exists($doc//mei:perfMedium))) (: RWA specific implementation, starts here: :) @@ -196,14 +203,11 @@ let $title := (: Work :) (: Edition :) else if (exists($doc//mei:mei) and starts-with($doc//mei:mei/@xml:id, 'rwa_edition')) then(normalize-space(local:getLocalizedMEITitle($doc//mei:source/mei:titleStmt[1]))) - - (: Source / Score without Shelfmark:) - else if(exists($doc//mei:mei) and exists($doc//mei:source) and not(exists($doc//mei:identifier[@type='shelfmark']))) - then(normalize-space(local:getLocalizedMEITitle($doc//mei:source/mei:titleStmt[1]))) - (: Source / Score with Shelfmark:) - else if(exists($doc//mei:mei) and exists($doc//mei:source) and exists($doc//mei:identifier[@type='shelfmark'])) - then(concat(normalize-space(local:getLocalizedMEITitle($doc//mei:source/mei:titleStmt[1])),' | ',normalize-space($doc//mei:source//mei:identifier[@type='shelfmark']))) + (: Source :) + else if(exists($doc//mei:mei) and (exists($doc//mei:source) or exists($doc//mei:manifestation))) + (: then(concat(normalize-space(local:getLocalizedMEITitle($doc//mei:source/mei:titleStmt[1])),' | ',normalize-space($doc//mei:source//mei:identifier[@type='shelfmark']))) :) + then(hc:send-request(<hc:request href="{$getEdiromObjectWindowTitleUrl}" method="get"/>)[2]) (: Text :) else if(exists($doc/tei:TEI)) diff --git a/add/data/xqm/annotation.xqm b/add/data/xqm/annotation.xqm index e41181ffad88f8f3e4a18846823d14d54857fc74..1f02df48bbd0753e23df473d33f4d69dc28ced27 100644 --- a/add/data/xqm/annotation.xqm +++ b/add/data/xqm/annotation.xqm @@ -152,6 +152,7 @@ declare function annotation:toJSON($anno as element()) as xs:string { let $id := $anno/@xml:id let $title := normalize-space(local:getLocalizedTitle($anno)) let $doc := $anno/root() + let $workID := $doc/mei:mei/@xml:id/string() let $prio := local:getLocalizedName($doc/id(substring($anno/mei:ptr[@type = 'priority']/@target,2))) let $pList := distinct-values(tokenize($anno/@plist, ' ')) let $pList := for $p in $pList @@ -162,9 +163,13 @@ declare function annotation:toJSON($anno as element()) as xs:string { for $p in distinct-values($pList) let $pDoc := doc($p) where not($pDoc//mei:availability[@type = 'rwaOnline'] = 'hidden') - return if ($pDoc//mei:sourceDesc/mei:source/mei:identifier[@type = 'siglum']) - then $pDoc//mei:sourceDesc/mei:source/mei:identifier[@type = 'siglum']/text() - else () + return if ($pDoc//mei:sourceDesc/mei:source/mei:identifier[@type eq 'siglum']) + then ($pDoc//mei:sourceDesc/mei:source/mei:identifier[@type eq 'siglum'][1]//text()) + else if (exists($pDoc//mei:manifestation//mei:relation[@target = $workID])) + then if ($pDoc//mei:manifestation//mei:relation[@target = $workID]/@label = 'null') + then () + else $pDoc//mei:manifestation//mei:relation[@target = $workID]/@label/string() + else ($workID) , ', ') let $catURIs := tokenize(replace($anno/mei:ptr[@type = 'categories']/@target,'#',''),' ') let $cats := string-join( diff --git a/add/data/xqm/source.xqm b/add/data/xqm/source.xqm index 4458554af8dfbdef8b19d17be299443af6ae7cda..b9cf172734b1a1cb571c2c00b66d1d734c9814ea 100644 --- a/add/data/xqm/source.xqm +++ b/add/data/xqm/source.xqm @@ -41,7 +41,7 @@ declare namespace mei="http://www.music-encoding.org/ns/mei"; :) declare function source:isSource($uri as xs:string) as xs:boolean { - exists(doc($uri)//mei:mei) and exists(doc($uri)//mei:source) + exists(doc($uri)//mei:mei) and (exists(doc($uri)//mei:source) or exists(doc($uri)//mei:manifestation//mei:relation[@rel = 'isEmbodimentOf'])) }; (:~ @@ -64,7 +64,12 @@ declare function source:getLabels($sources as xs:string*) as xs:string { :) declare function source:getLabel($source as xs:string) as xs:string { - doc($source)//mei:source/mei:titleStmt/data(mei:title[1]) + let $sourceDoc := doc($source) + return if ($sourceDoc//mei:source/mei:titleStmt/mei:title) + then $sourceDoc//mei:source/mei:titleStmt/data(mei:title[1]) + else if ($sourceDoc//mei:manifestation//mei:title//mei:titlePart[@type = 'main']) + then data($sourceDoc//mei:manifestation//mei:title//mei:titlePart[@type = 'main']) + else ('ERROR') }; (:~ @@ -73,9 +78,9 @@ declare function source:getLabel($source as xs:string) as xs:string { : @param $sources The URIs of the Sources' documents to process : @return The sigla :) -declare function source:getSigla($sources as xs:string*) as xs:string { +declare function source:getSigla($sources as xs:string*, $workID as xs:string) as xs:string { string-join( - source:getSiglaAsArray($sources) + source:getSiglaAsArray($sources, $workID) , ', ') }; @@ -85,11 +90,11 @@ declare function source:getSigla($sources as xs:string*) as xs:string { : @param $sources The URIs of the Sources' documents to process : @return The sigla :) -declare function source:getSiglaAsArray($sources as xs:string*) as xs:string* { +declare function source:getSiglaAsArray($sources as xs:string*, $workID as xs:string) as xs:string* { for $source in $sources where not(doc($source)//mei:availability[@type = 'rwaOnline'] = 'hidden') return - source:getSiglum($source) + source:getSiglum($source, $workID) }; (::) (:~ @@ -98,7 +103,14 @@ declare function source:getSiglaAsArray($sources as xs:string*) as xs:string* { : @param $source The URIs of the Source's document to process : @return The siglum :) -declare function source:getSiglum($source as xs:string) as xs:string? { +declare function source:getSiglum($source as xs:string, $workID as xs:string) as xs:string? { - doc($source)//mei:source/mei:identifier[@type eq 'siglum'][1]//text() + let $sourceDoc := doc($source) + return if ($sourceDoc//mei:source/mei:identifier[@type eq 'siglum']) + then ($sourceDoc//mei:source/mei:identifier[@type eq 'siglum'][1]//text()) + else if (exists($sourceDoc//mei:manifestation//mei:relation[@target = $workID])) + then if ($sourceDoc//mei:manifestation//mei:relation[@target = $workID]/@label = 'null') + then () + else $sourceDoc//mei:manifestation//mei:relation[@target = $workID]/@label/string() + else ('ERROR') }; \ No newline at end of file diff --git a/app/controller/window/SingleWindowController.js b/app/controller/window/SingleWindowController.js index 24bb52b616fbc7481bd657658a4ba3f5f8f1aba3..2f4335a4c7515dfccbffe45bfbcff14ccb5095d1 100644 --- a/app/controller/window/SingleWindowController.js +++ b/app/controller/window/SingleWindowController.js @@ -55,9 +55,10 @@ Ext.define('EdiromOnline.controller.window.SingleWindowController', { win.initialized = true; window.doAJAXRequest('data/xql/getLinkTarget.xql', - 'POST', + 'POST', { uri: win.uri, + workId: this.application.activeWork, lang: lang }, Ext.bind(function(response){ diff --git a/app/view/window/AnnotationView.js b/app/view/window/AnnotationView.js index 4e51209285ecc9a3fb02172ca57c450cc9856713..aae56665b7adb40b0faec33b21e4788c501d6f36 100644 --- a/app/view/window/AnnotationView.js +++ b/app/view/window/AnnotationView.js @@ -581,8 +581,9 @@ Ext.define('EdiromOnline.view.window.AnnotationView', { var page = participant['page']; var source = participant['source']; var siglum = participant['siglum']; - var digilibBaseParams = participant['digilibBaseParams']; - var digilibSizeParams = participant['digilibSizeParams']; + // var digilibBaseParams = participant['digilibBaseParams']; + // var digilibSizeParams = participant['digilibSizeParams']; + var digilibURL = participant['digilibURL']; var hiddenData = participant['hiddenData']; var content = participant['content']; @@ -594,7 +595,7 @@ Ext.define('EdiromOnline.view.window.AnnotationView', { shape = tplText.append(div, [content, hiddenData, label], true); } else { - shape = tplImg.append(div, [digilibBaseParams + "dw=600&amp;dh=600" + digilibSizeParams, hiddenData, label], true); + shape = tplImg.append(div, [/* digilibBaseParams + "dw=600&amp;dh=600" + digilibSizeParams*/ digilibURL, hiddenData, label], true); } shape.setWidth('100%');