Skip to content

Commit

Permalink
Merge branch 'develop' into pr/120
Browse files Browse the repository at this point in the history
  • Loading branch information
roewenstrunk committed Dec 1, 2021
2 parents 51a432d + 05d13f5 commit 1f6495f
Show file tree
Hide file tree
Showing 98 changed files with 23,760 additions and 582 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions add/controller.xql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ xquery version "1.0";
declare variable $exist:path external;
declare variable $exist:resource external;

declare option exist:serialize "method=xhtml media-type=application/xhtml+html";

if ($exist:path eq "/") then
(: forward root path to index.xql :)
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
Expand Down
3 changes: 3 additions & 0 deletions add/data/locale/edirom-lang-de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<entry key="global_loading" value="Lade…"/>
<entry key="global_unknown" value="Unbekannt"/>

<entry key="controller.desktop.TaskBar_confirmReload" value="Die Anwendung muss neu gestartet werden, damit die Spracheinstellung vollständig umgesetzt wird."/>

<entry key="controller.window.Window_annotationView" value="Anmerkung"/>
<entry key="controller.window.Window_headerView" value="Metadaten"/>
<entry key="controller.window.Window_renderingView" value="Rendering"/>
Expand All @@ -57,6 +59,7 @@
<entry key="view.desktop.TaskBar_annotations" value="Anmerkungen einblenden"/>
<entry key="view.desktop.TaskBar_help" value="Hilfe"/>
<entry key="view.desktop.TaskBar_pref" value="Einstellungen"/>
<entry key="view.desktop.TaskBar_lang" value="Sprache umschalten"/>
<entry key="view.desktop.TaskBar_home" value="Startseite"/>
<entry key="view.desktop.TaskBar_work" value="Werk wählen"/>
<entry key="view.desktop.TaskBar_search" value="Suche"/>
Expand Down
5 changes: 4 additions & 1 deletion add/data/locale/edirom-lang-en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<entry key="global_loading" value="Loading…"/>
<entry key="global_unknown" value="Unknown"/>

<entry key="controller.desktop.TaskBar_confirmReload" value="The application must be reloaded for the language setting to be performed completely."/>

<entry key="controller.window.Window_annotationView" value="Annotations"/>
<entry key="controller.window.Window_headerView" value="Meta data"/>
<entry key="controller.window.Window_renderingView" value="Rendering"/>
Expand All @@ -57,6 +59,7 @@
<entry key="view.desktop.TaskBar_annotations" value="Show annotations"/>
<entry key="view.desktop.TaskBar_help" value="Help"/>
<entry key="view.desktop.TaskBar_pref" value="Preferences"/>
<entry key="view.desktop.TaskBar_lang" value="Switch language"/>
<entry key="view.desktop.TaskBar_home" value="Home"/>
<entry key="view.desktop.TaskBar_work" value="Select work"/>
<entry key="view.desktop.TaskBar_search" value="Search"/>
Expand Down Expand Up @@ -96,7 +99,7 @@
<entry key="view.window.source.SourceView_gotoMovement" value="Go to movement/number…"/>
<entry key="view.window.source.SourceView_layersMenu" value="Layers…"/>
<entry key="view.window.source.SourceView_showMeasures" value="Show/Hide measures"/>
<entry key="view.window.source.SourceView_fitView" value="Fit facsimile"/>
<entry key="view.window.source.SourceView_fitView" value="Fit score"/>
<entry key="view.window.source.SourceView_PageBasedView" value="Page based view"/>
<entry key="view.window.source.SourceView_PageBasedView_previousPage" value="Previous page"/>
<entry key="view.window.source.SourceView_PageBasedView_nextPage" value="Next page"/>
Expand Down
5 changes: 5 additions & 0 deletions add/data/prefs/edirom-prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@
<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
73 changes: 59 additions & 14 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));

declare variable $lang := request:get-parameter('lang', '');

Expand Down Expand Up @@ -178,8 +182,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 @@ -254,13 +265,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 All @@ -282,7 +306,7 @@ let $categoriesLabel := if ($lang = 'de')
then (if(count($categories) gt 1)then('Kategorien')else('Kategorie'))
else(if(count($categories) gt 1)then('Categories')else('Category'))

let $sources := eutil:getDocumentsLabelsAsArray($participants)
let $sources := eutil:getDocumentsLabelsAsArray($participants, $edition)
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'))
Expand Down Expand Up @@ -327,21 +351,41 @@ return
<h1>{local:getLocalizedTitle($annot)}</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">{if ($lang = 'de') then (concat('Takt ', $elem/@n)) else (concat('Bar ', $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 Down Expand Up @@ -370,14 +414,15 @@ return
</div>
<div class="contentBox">
<h1>{local:getLocalizedTitle($annot)}</h1>
{annotation:getContent($annot,'')}
{annotation:getContent($annot,'', $edition)}

</div>
<div class="previewArea">
<!-- <div class="previewArea">
{
local:calculatePreviewsForTip(tokenize($annot/string(@plist),' '))
}
</div>
</div>-->
</div>

)
4 changes: 3 additions & 1 deletion add/data/xql/getAnnotationMeta.xql
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ 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 $lang := request:get-parameter('lang', '')
let $edition := request:get-parameter('edition', '')
let $uri := request:get-parameter('uri', '')
let $docUri := substring-before($uri, '#')
let $internalId := substring-after($uri, '#')
Expand All @@ -56,7 +58,7 @@ let $categoriesLabel := if ($lang = 'de')
then (if(count($categories) gt 1)then('Kategorien')else('Kategorie'))
else(if(count($categories) gt 1)then('Categories')else('Category'))

let $sources := eutil:getDocumentsLabelsAsArray($participants)
let $sources := eutil:getDocumentsLabelsAsArray($participants, $edition)
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'))
Expand Down
20 changes: 16 additions & 4 deletions add/data/xql/getAnnotationPreviews.xql
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ xquery version "3.1";
Returns the HTML for a specific annotation for an AnnotationView.
@author <a href="mailto:roewenstrunk@edirom.de">Daniel Röwenstrunk</a>
@author <a href="mailto:bohl@edirom.de">Benjamin W. Bohl</a>
:)
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";
Expand All @@ -36,16 +37,23 @@ 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 $lang := request:get-parameter('lang', '');

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:getLocalizedTitle($node) {
let $nodeName := local-name($node)
Expand Down Expand Up @@ -131,7 +139,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 @@ -253,8 +261,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
4 changes: 3 additions & 1 deletion add/data/xql/getAnnotationText.xql
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ 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";

Expand All @@ -45,6 +46,7 @@ declare function local:getLocalizedName($node) {

};

let $edition := request:get-parameter('edition', '')
let $uri := request:get-parameter('uri', '')
let $docUri := substring-before($uri, '#')
let $internalId := substring-after($uri, '#')
Expand All @@ -56,6 +58,6 @@ return
<div class="annotView">
<div class="contentBox">
<h1>{local:getLocalizedName($annot)}</h1>
{annotation:getContent($annot,'')}
{annotation:getContent($annot,'', $edition)}
</div>
</div>
3 changes: 2 additions & 1 deletion add/data/xql/getAnnotations.xql
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ declare namespace mei="http://www.music-encoding.org/ns/mei";

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

let $edition := request:get-parameter('edition', '')
let $uri := request:get-parameter('uri', '')
let $uri := if(contains($uri, '#')) then(substring-before($uri, '#')) else($uri)

Expand All @@ -42,6 +43,6 @@ return
{
"success": true,
"total": ', count(doc($uri)//mei:annot[@type = 'editorialComment']), ',
"annotations": [', annotation:annotationsToJSON($uri), ']
"annotations": [', annotation:annotationsToJSON($uri, $edition), ']
}
')
Loading

0 comments on commit 1f6495f

Please sign in to comment.