Skip to content

Commit

Permalink
Support for localized disclaimers #34 (CR preview)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Nguyen committed Dec 12, 2024
1 parent 62d40b0 commit 30197b5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
9 changes: 6 additions & 3 deletions add/data/xql/getAnnotationPreviews.xql
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ declare function local:getTextParticipants($participants as xs:string*, $doc as
let $id := substring-after($participant, '#')
let $hiddenData := concat('uri:', $doc, '__$$__participantId:', $id)
return
local:toJSON('text', 'Textstelle', (), (), (), teitext:getLabel($doc), (), (), (), $hiddenData, normalize-space(local:getTextNoteContent($doc, $id)), $participant) (: TODO: "Textstelle" durch sinnvolleres ersetzen :)
local:toJSON('text', 'Textstelle', (), (), (), teitext:getLabel($doc), (), (), (), (), $hiddenData, normalize-space(local:getTextNoteContent($doc, $id)), $participant) (: TODO: "Textstelle" durch sinnvolleres ersetzen :)
};

declare function local:getTextNoteContent($doc as xs:string, $id as xs:string) as xs:string {
Expand Down Expand Up @@ -126,6 +126,8 @@ declare function local:getSourceParticipants($participants as xs:string*, $doc a
let $siglum := $sourceSiglum
let $part := string-join(distinct-values(for $e in $elems return $e/ancestor::mei:part/@label),'-')

let $disclaimer := doc($doc)//mei:pubStmt//mei:useRestrict[@type = 'disclaimer'][if (./@xml:lang) then (./@xml:lang = $lang) else (.)]/string() => replace('\n', '<br>')

let $graphic := $zones[1]/../mei:graphic[@type = 'facsimile']
let $imgWidth := number($graphic/@width)
let $imgHeight := number($graphic/@height)
Expand All @@ -141,7 +143,7 @@ declare function local:getSourceParticipants($participants as xs:string*, $doc a
where not($elems[1]/root()//mei:availability[@type = 'rwaOnline'] = 'hidden')

return
local:toJSON($type, $label, $mdiv, $part, $page, $source, $siglum, $digilibBaseParams, $digilibSizeParams, $hiddenData, (), $linkUri)
local:toJSON($type, $label, $mdiv, $part, $page, $source, $siglum, $disclaimer, $digilibBaseParams, $digilibSizeParams, $hiddenData, (), $linkUri)
};

declare function local:getSourceLinkTarget($elems as node()*, $zones as node()*) as xs:string {
Expand Down Expand Up @@ -360,7 +362,7 @@ declare function local:getItemLabel($elems as element()*) as xs:string {
(: Test: single url for images in annotation view :)

declare function local:toJSON($type as xs:string, $label as xs:string, $mdiv as xs:string?, $part as xs:string?,
$page as xs:string?, $source as xs:string, $siglum as xs:string?, $digilibBaseParams as xs:string?,
$page as xs:string?, $source as xs:string, $siglum as xs:string?, $disclaimer as xs:string?, $digilibBaseParams as xs:string?,
$digilibSizeParams as xs:string?, $hiddenData as xs:string?, $content as xs:string?, $linkUri as xs:string?) as xs:string {

let $configResource := doc('xmldb:exist:///db/apps/mriExistDBconf/config.xml')
Expand Down Expand Up @@ -404,6 +406,7 @@ declare function local:toJSON($type as xs:string, $label as xs:string, $mdiv as
'","page":"',$page,
'","source":"',$source,
'","siglum":"',$siglum,
'","disclaimer":"',$disclaimer,
'","digilibURL":"', $singleURL,
'","hiddenData":"',$hiddenData,
'","content":"',$content,
Expand Down
4 changes: 3 additions & 1 deletion app/view/window/AnnotationView.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ Ext.define('EdiromOnline.view.window.AnnotationView', {
tplImg.compile();

var tplText = dh.createTemplate({tag:'div', cls: 'previewItem',
html:'<div id="{0}" class="txtBox">{1}</div><div class="label">{2}</div>'});
html:'<div id="{0}" class="txtBox">{1}</div><div class="label">s{2}</div>'});
tplText.compile();

var elems = new Array();
Expand All @@ -479,6 +479,7 @@ Ext.define('EdiromOnline.view.window.AnnotationView', {
var page = participant['page'];
var source = participant['source'];
var siglum = participant['siglum'];
var disclaimer = participant['disclaimer'];
var part = participant['part'];
// var digilibBaseParams = participant['digilibBaseParams'];
// var digilibSizeParams = participant['digilibSizeParams'];
Expand All @@ -487,6 +488,7 @@ Ext.define('EdiromOnline.view.window.AnnotationView', {
var content = participant['content'];

label = (siglum == ''?source:siglum) + (part == ''?'':', '+part);// + ": " + label;
label = disclaimer == '' ? label : label + '<div style="font-size: smaller;">'+disclaimer+'</div>';

if(type == 'text') {

Expand Down
7 changes: 7 additions & 0 deletions resources/css/EdiromOnlineRWA.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ span.uline {
text-decoration: underline;
}

.annotView .previewArea .previewItem .imgBox {
bottom: 40px;
}

.annotView .previewArea .previewItem .label {
height: 32px;
}

span.title {
font-style: italic;
Expand Down

0 comments on commit 30197b5

Please sign in to comment.