Skip to content

Commit

Permalink
Merge branch 'develop' into feature-freidi-integration
Browse files Browse the repository at this point in the history
Testing with "Messe in h-Moll BWV 232 von Johann Sebastian Bach" and "Krebs-Trio-Eb-2.xml" for rendering view
Fixed Bugs:
show annotations for digilib/leaflet;
show text;
Found Bugs:
"go to measure" not workinf for digilib/leaflet;
missing complete testing for annotations views for digilib/leaflet
  • Loading branch information
elena1113 committed Sep 15, 2017
1 parent 122cb52 commit 6d03058
Show file tree
Hide file tree
Showing 68 changed files with 23,005 additions and 736 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions add/data/prefs/edirom-prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
-->
<prefs>
<version>1.0</version>
<entries>

<entries>
<entry key="application_language" value="de"/>
<entry key="annotation_layout" value="EdiromOnline.view.window.annotationLayouts.AnnotationLayout1"/>
<entry key="image_prefix" value="../../../digilib/Scaler/"/>

<entry key="leaflet_prefix" value="/exist/rest/db/contents/leafletImages/"/>
<entry key="image_server" value="leaflet"/>
<!--<entry key="image_server" value="digilib"/>-->
<entry key="edition_path" value="/db/apps/contents"/>
</entries>
</prefs>
11 changes: 9 additions & 2 deletions add/data/xql/edirom_printPreview.xql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ declare option exist:serialize "method=html media-type=text/html omit-xml-declar

declare variable $lang := 'en';
declare variable $base := concat('file:', replace(system:get-module-load-path(),'\\','/'), '/../xslt/');
declare variable $facsBasePath := eutil:getPreference('image_prefix', request:get-parameter('edition', ''));

declare variable $edition := request:get-parameter('edition', '');
declare variable $imageserver := eutil:getPreference('image_server', $edition);
declare variable $facsBasePath := if($imageserver = 'leaflet')
then(eutil:getPreference('leaflet_prefix', $edition))
else(eutil:getPreference('image_prefix', $edition));

(:declare variable $facsBasePath := eutil:getPreference('image_prefix', request:get-parameter('edition', ''));:)
declare variable $printResolution := 150;
declare variable $facsAreaWidth := 6.5;(: in inch :)
declare variable $facsMetaHeight := 30;
Expand Down Expand Up @@ -87,7 +94,7 @@ let $paras := <parameters>
<param name="facsAreaWidth" value="{$facsAreaWidth}"/>
<param name="printResolution" value="{$printResolution}"/>
<param name="facsImgParas" value="{eof:getFacsImgParas($facsAreaWidth)}"/>
<param name="facsBasePath" value="{eutil:getPreference('image_prefix', request:get-parameter('edition', ''))}"/>
<param name="facsBasePath" value="{$facsBasePath}"/>
</parameters>

let $width := eof:getPageRegionBodyWidth()
Expand Down
68 changes: 56 additions & 12 deletions add/data/xql/getAnnotation.xql
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ import module namespace edition="http://www.edirom.de/xquery/edition" at "../xqm
declare namespace request="http://exist-db.org/xquery/request";
declare namespace mei="http://www.music-encoding.org/ns/mei";
declare namespace exist="http://exist.sourceforge.net/NS/exist";
declare namespace edirom_image="http://www.edirom.de/ns/image";
declare namespace xmldb="http://exist-db.org/xquery/xmldb";

declare option exist:serialize "method=xhtml media-type=text/html omit-xml-declaration=yes indent=yes";


declare variable $imageWidth := 600;
declare variable $imageBasePath := eutil:getPreference('image_prefix', request:get-parameter('edition', ''));
declare variable $edition := request:get-parameter('edition', '');
declare variable $imageserver := eutil:getPreference('image_server', $edition);
declare variable $imageBasePath := if($imageserver = 'leaflet')
then(eutil:getPreference('leaflet_prefix', $edition))
else(eutil:getPreference('image_prefix', $edition));

(: TODO: in Modul auslagern :)
(:~
Expand Down Expand Up @@ -167,8 +171,15 @@ declare function local:getImageAreaPathForTips($basePath as xs:string, $zone as
let $ww := $w div $imgWidth
let $wh := $h div $imgHeight

let $cut_path := substring-before($imagePath, '.')

let $im_path := if($imageserver = 'digilib')
then(concat($basePath, $imagePath, '?dw=', $width, '&amp;amp;dh=', $height, '&amp;amp;wx=', $wx, '&amp;amp;wy=', $wy, '&amp;amp;ww=', $ww, '&amp;amp;wh=', $wh, '&amp;amp;mo=fit'))
else(
concat($basePath, $cut_path, '/0-0-0.jpg'))
return
concat($basePath, $imagePath, '?dw=', $width, '&amp;amp;dh=', $height, '&amp;amp;wx=', $wx, '&amp;amp;wy=', $wy, '&amp;amp;ww=', $ww, '&amp;amp;wh=', $wh, '&amp;amp;mo=fit')
$im_path

};

(:
Expand Down Expand Up @@ -243,13 +254,26 @@ declare function local:calculatePreviewsForTip($participants as xs:string*) {
for $zone in $zones
let $e := $elems[substring(@facs,2) = $zone/@xml:id][1]
let $e := if($e)then($e)else($zone)
return
<div class="previewItem" style="width: {$width - (round(100 div $w))}px; height: {$height - round(100 div $h)}px;">

let $test := if($imageserver = 'digilib')
then(
<div class="previewItem" style="width: {$width - (round(100 div $w))}px; height: {$height - round(100 div $h)}px;">
<div class="imgBox">
<img src="{local:getImageAreaPathForTips($imageBasePath, $zone, $width - 4, $height - 4)}" class="previewImg" />
</div>
<div class="label">{local:getItemLabel($e)}</div>
</div>
)
else(
<div class="previewItem" style="width: {256}px; height: {256}px;">
<div class="imgBox">
<img src="{local:getImageAreaPathForTips($imageBasePath, $zone, $width - 4, $height - 4)}" class="previewImg" />
</div>
<div class="label">{local:getItemLabel($e)}</div>
</div>
)

return $test
};

let $uri := request:get-parameter('uri', '')
Expand Down Expand Up @@ -300,21 +324,41 @@ return
<h1>{$annot/mei:title/text()}</h1>
{annotation:getContent($annot,'')}
</div>
<div class="previewArea">

<!-- <div class="previewArea">
{
if($imageserver = 'digilib') then (
for $pUri in tokenize($annot/string(@plist), ' ')
let $elem := doc(substring-before($pUri, '#'))/id(substring-after($pUri, '#'))
let $zone := local:getZone($elem)
return
let $zone := local:getZone($elem)
return
<div class="previewItem">
<div class="imgBox">
<div class="imgBox">
<img src="{local:getImageAreaPath($imageBasePath, $zone, $imageWidth)}" class="previewImg" onclick="loadLink('{$pUri}')" />
<input type="hidden" class="previewImgData" value="{concat('{width:', number($zone/@lrx) - number($zone/@ulx), ', height:', number($zone/@lry) - number($zone/@uly), '}')}"/>
</div>
<div class="label">{concat('Takt ', $elem/@n)}</div>
</div>
)
else(
for $pUri in tokenize($annot/string(@plist), ' ')
let $elem := doc(substring-before($pUri, '#'))/id(substring-after($pUri, '#'))
let $zone := local:getZone($elem)
return
<div class="previewItem">
<div class="imgBox">
<img src="{local:getImageAreaPath($imageBasePath, $zone, $imageWidth)}" class="previewImg" onclick="loadLink('{$pUri}')" />
<input type="hidden" class="previewImgData" value="{concat('{width:', number($zone/@lrx) - number($zone/@ulx), ', height:', number($zone/@lry) - number($zone/@uly), '}')}"/>
</div>
<div class="label">{concat('Takt ', $elem/@n)}</div>
</div>
)
}
</div>
</div>-->

</div>
)
else(
Expand All @@ -341,12 +385,12 @@ return
<h1>{$annot/mei:title/text()}</h1>
{annotation:getContent($annot,'')}
</div>
<div class="previewArea">
<!-- <div class="previewArea">
{
local:calculatePreviewsForTip(tokenize($annot/string(@plist),' '))
}
</div>
</div>-->
</div>

)
2 changes: 1 addition & 1 deletion add/data/xql/getAnnotationMeta.xql
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ import module namespace eutil="http://www.edirom.de/xquery/util" at "../xqm/util
declare namespace request="http://exist-db.org/xquery/request";
declare namespace mei="http://www.music-encoding.org/ns/mei";
declare namespace exist="http://exist.sourceforge.net/NS/exist";
declare namespace edirom_image="http://www.edirom.de/ns/image";

declare namespace xmldb="http://exist-db.org/xquery/xmldb";

declare option exist:serialize "method=xhtml media-type=text/html omit-xml-declaration=yes indent=yes";


let $uri := request:get-parameter('uri', '')
let $docUri := substring-before($uri, '#')
let $internalId := substring-after($uri, '#')
Expand Down
19 changes: 15 additions & 4 deletions add/data/xql/getAnnotationPreviews.xql
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,22 @@ import module namespace functx = "http://www.functx.com" at "../xqm/functx-1.0-n
declare namespace exist="http://exist.sourceforge.net/NS/exist";
declare namespace request="http://exist-db.org/xquery/request";
declare namespace mei="http://www.music-encoding.org/ns/mei";
declare namespace edirom_image="http://www.edirom.de/ns/image";

declare namespace xmldb="http://exist-db.org/xquery/xmldb";

declare option exist:serialize "method=xhtml media-type=text/html omit-xml-declaration=yes indent=yes";


declare variable $imageWidth := 600;
declare variable $imageBasePath := eutil:getPreference('image_prefix', request:get-parameter('edition', ''));

declare variable $edition := request:get-parameter('edition', '');
declare variable $imageserver := eutil:getPreference('image_server', $edition);
declare variable $imageBasePath := if($imageserver = 'leaflet')
then(eutil:getPreference('leaflet_prefix', $edition))
else(eutil:getPreference('image_prefix', $edition));

(:declare variable $imageBasePath := eutil:getPreference('image_prefix', request:get-parameter('edition', ''));
:)


declare function local:getParticipants($annot as element()) as xs:string* {
Expand Down Expand Up @@ -121,7 +128,7 @@ declare function local:getSourceParticipants($participants as xs:string*, $doc a
let $rect := local:getBoundingZone($zones)

let $digilibSizeParams := local:getImageAreaParams($rect, $imgWidth, $imgHeight)
let $hiddenData := concat('{width:', number($rect/@lrx) - number($rect/@ulx), ', height:', number($rect/@lry) - number($rect/@uly), ', x:', number($rect/@ulx), ', y:', number($rect/@uly), '}')
let $hiddenData := concat('{width:', number($rect/@lrx) - number($rect/@ulx), ', height:', number($rect/@lry) - number($rect/@uly), ', x:', number($rect/@ulx), ', y:', number($rect/@uly), ', origH:', $imgHeight, ', origW:', $imgWidth,'}')
let $linkUri := concat('xmldb:exist://', document-uri($graphic/root()), '#', local:getSourceLinkTarget($elems, $zones))

return
Expand Down Expand Up @@ -243,8 +250,12 @@ declare function local:getImageAreaPath($basePath as xs:string, $graphic as elem
let $imgWidth := number($graphic/@width)
let $imgHeight := number($graphic/@height)

let $fields := if($imageserver = 'leaflet')then(substring-before($imagePath, '.') )else()


return
concat($basePath, $imagePath, '?')
if($imageserver = 'leaflet')then(concat($imageBasePath,$fields))else(concat($basePath, $imagePath, '?'))

};

(: TODO: in Modul auslagern :)
Expand Down
2 changes: 1 addition & 1 deletion add/data/xql/getAnnotationText.xql
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import module namespace annotation="http://www.edirom.de/xquery/annotation" at "

declare namespace request="http://exist-db.org/xquery/request";
declare namespace mei="http://www.music-encoding.org/ns/mei";
declare namespace edirom_image="http://www.edirom.de/ns/image";

declare namespace xmldb="http://exist-db.org/xquery/xmldb";

declare option exist:serialize "method=xhtml media-type=text/html omit-xml-declaration=yes indent=yes";



let $uri := request:get-parameter('uri', '')
let $docUri := substring-before($uri, '#')
let $internalId := substring-after($uri, '#')
Expand Down
18 changes: 13 additions & 5 deletions add/data/xql/getAnnotationsOnPage.xql
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ declare namespace request="http://exist-db.org/xquery/request";
declare namespace ft="http://exist-db.org/xquery/lucene";
declare namespace xmldb="http://exist-db.org/xquery/xmldb";

declare option exist:serialize "method=text media-type=text/plain omit-xml-declaration=yes";

(:declare option exist:serialize "method=text media-type=text/plain omit-xml-declaration=yes";:)
(:declare option exist:serialize "method=xhtml media-type=text/html omit-xml-declaration=yes indent=yes";:)

declare function local:getAnnotations($uriSharp as xs:string, $surfaceId as xs:string, $annotations as element()*, $elems as element()*) as xs:string* {
for $annotation in $annotations
Expand Down Expand Up @@ -116,9 +116,12 @@ declare function local:getAnnotSVGs($surfaceUri as xs:string, $anno as element()
return
string-join(
for $fig in $figs
let $fig := string($fig/@xml:id)
let $xslInstruction := $fig/svg:svg
let $ser := util:serialize($xslInstruction, ())
let $repl := replace(replace($ser, '"', '\\"'), '\n', '')
return
concat('{id:"', $annoId, '__', string($fig/@xml:id), '",svg:"', replace(replace(util:serialize($fig/svg:svg, ()), '"', '\\"'), '\n', ''),'"}')
, ",")
concat('{id:"', $annoId, '__', $fig, '",svg:"', $repl,'"}'), ",")
};

(:~
Expand Down Expand Up @@ -148,10 +151,15 @@ let $measureLike :=

let $targetLike := $zones | $measureLike


let $annotations := local:findAnnotations($uri, $targetLike/@xml:id)

let $annots := collection('/db/contents')//mei:annot[matches(@plist, $uri)] | $mei//mei:annot
let $test := local:getAnnotations($uriSharp, $surfaceId, $annots, $targetLike)

return (
concat('[',
string-join(local:getAnnotations($uriSharp, $surfaceId, $annotations, $targetLike), ','),
string-join($test, ','),
']')
)

7 changes: 4 additions & 3 deletions add/data/xql/getMeasurePage.xql
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ declare function local:findMeasure($mei, $movementId, $measureIdName) {
)
};

declare function local:getMeasure($mei, $measure) as xs:string {
declare function local:getMeasure($mei, $measure, $movementId) as xs:string {

let $measureId := $measure/string(@xml:id)
let $zoneId := substring-after($measure/string(@facs), '#')
Expand All @@ -52,6 +52,7 @@ declare function local:getMeasure($mei, $measure) as xs:string {
'measureId:"', $measureId, '",',
'zoneId:"', $zoneId, '",',
'pageId:"', $surface/string(@xml:id), '", ',
'movementId:"', $movementId, '",',
'path: "', $graphic/string(@target), '", ',
'width: "', $graphic/string(@width), '", ',
'height: "', $graphic/string(@height), '", ',
Expand All @@ -73,9 +74,9 @@ let $measure := local:findMeasure($mei, $movementId, $measureIdName)
let $extraMeasures := for $i in (2 to xs:integer($measureCount))
let $m := $measure/following-sibling::mei:measure[$i - 1] (: TODO: following-sibling könnte problematisch sein, da so section-Grenzen nicht überwunden werden :)
return
if($m)then(local:getMeasure($mei, $m))else()
if($m)then(local:getMeasure($mei, $m, $movementId))else()

return
concat('[',
string-join((local:getMeasure($mei, $measure), $extraMeasures), ','),
string-join((local:getMeasure($mei, $measure, $movementId), $extraMeasures), ','),
']')
2 changes: 1 addition & 1 deletion add/data/xql/getPreferences.xql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ declare option exist:serialize "method=xhtml media-type=text/html omit-xml-decla
let $mode := request:get-parameter('mode', '')
let $edition := request:get-parameter('edition', '')

let $base := concat('file:', system:get-module-load-path())
(:let $base := concat('file:', system:get-module-load-path()):)
(:let $file := doc(concat($base, '/../prefs/edirom-prefs.xml')):)
let $file := doc('../prefs/edirom-prefs.xml')

Expand Down
9 changes: 8 additions & 1 deletion add/data/xql/getReducedDocument.xql
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ let $xslInstruction := for $i in util:serialize($xslInstruction, ())
if(matches($i, 'type="text/xsl"'))
then(substring-before(substring-after($i, 'href="'), '"'))
else()
let $imagePrefix := eutil:getPreference('image_prefix', request:get-parameter('edition', ''))

declare variable $edition := request:get-parameter('edition', '');
declare variable $imageserver := eutil:getPreference('image_server', $edition);
declare variable $imagePrefix := if($imageserver = 'leaflet')
then(eutil:getPreference('leaflet_prefix', $edition))
else(eutil:getPreference('image_prefix', $edition));

(:let $imagePrefix := eutil:getPreference('image_prefix', request:get-parameter('edition', '')):)
let $xsl := if($xslInstruction)then(doc($xslInstruction))else('../xslt/teiBody2HTML.xsl')

let $params := (<param name="base" value="{concat($base, '/../xslt/')}"/>,<param name="idPrefix" value="{$idPrefix}"/>)
Expand Down
Loading

0 comments on commit 6d03058

Please sign in to comment.