Skip to content

Commit

Permalink
suppressed portraits only effect Wikipedia images, fixes #161
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Mar 3, 2017
1 parent d40146a commit 223eaca
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions modules/img.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ declare
%templates:wrap
function img:iconography($node as node(), $model as map(*), $lang as xs:string) as map(*)* {
let $local-image := img:wega-images($model, $lang)
let $suppressExternalPortrait := core:getOrCreateColl('iconography', $model('docID'), true())//tei:figure[not(tei:graphic)]
let $suppressWikipediaPortrait := core:getOrCreateColl('iconography', $model('docID'), true())//tei:figure[not(tei:graphic)]
let $beaconMap := (: when loaded via AJAX there's no beaconMap in $model :)
if(exists($model('beaconMap'))) then $model('beaconMap')
else try {
Expand All @@ -53,7 +53,7 @@ declare
if(count(map:keys($beaconMap)[contains(., 'Portraitindex')]) gt 0) then img:portraitindex-images($model, $lang)
else ()
let $wikipedia-images :=
if(count(map:keys($beaconMap)[contains(., 'Wikipedia-Personenartikel')]) gt 0) then img:wikipedia-images($model, $lang)
if(not($suppressWikipediaPortrait) and count(map:keys($beaconMap)[contains(., 'Wikipedia-Personenartikel')]) gt 0) then img:wikipedia-images($model, $lang)
else ()
let $tripota-images :=
if(count(map:keys($beaconMap)[contains(., 'GND-Zuordnung')]) gt 0) then img:tripota-images($model, $lang)
Expand All @@ -62,9 +62,7 @@ declare
if(count(map:keys($beaconMap)[contains(., 'Porträtsammlung')]) gt 0) then img:munich-stadtmuseum-images($model, $lang)
else ()
let $iconographyImages := ($local-image, $wikipedia-images, $portraitindex-images, $tripota-images, $munich-stadtmuseum-images)
let $portrait :=
if($suppressExternalPortrait) then img:get-generic-portrait($model, $lang)
else ($iconographyImages, img:get-generic-portrait($model, $lang))[1]
let $portrait := ($iconographyImages, img:get-generic-portrait($model, $lang))[1]
return
map {
'iconographyImages' := $iconographyImages,
Expand Down

0 comments on commit 223eaca

Please sign in to comment.