Commit 9afa23b7 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

minor fixes

parent 50681ef8
......@@ -69,7 +69,7 @@ return
: @return on of listEvent, listOrg, listPlace, listPerson, list-works,
: list-Fontane, list-periodicals
:)
declare function local:get-list-by-entity($entity as node())
declare function local:get-list-by-entity($entity as node()?)
as xs:string {
switch ( $entity/local-name() )
case "event" return "listEvent"
......@@ -417,21 +417,35 @@ element xhtml:li {
}
};
(: -> A (irgendein Ding) hat_derzeitigen_Aufbewahrungsort B (irgendein Ort) :)
declare function local:has-former-or-current-location($links as element(tei:link)*)
as element(xhtml:li)* {
for $link in $links
let $thisId := string($link/parent::tei:linkGrp/parent::tei:*/@xml:id)
let $id := ($link/@target => replace("#|\w{3}:", "") => tokenize(" "))[. != $thisId]
let $id := ($link/@target => replace("\w{3}:|#", "") => tokenize(" "))[. != ""][. != $thisId]
return
if(count($id) != 1) then
(update insert comment {"unable to parse target: " || serialize($link)} following $link,
update delete $link)
else
let $targetNode := $f-indexproc:dataCollection/id($id)
return
if(count($targetNode) gt 1)
then (update insert comment {"xml:id used multiple times. this occurence is removed. please check and reinsert item when xml:id is unique. " || serialize($id[2])} following $id[2],
update delete $id[2]
)
else if(count($targetNode) = 0)
then
(update insert comment {"ID " || $id || " not found: Please create an appropriate item. " || serialize($link)} following $link,
update delete $link
)
else
let $list := local:get-list-by-entity($targetNode)
let $icon := local:get-icon-by-entity($targetNode)
return
element xhtml:li {
attribute class { "former-or-current-location" },
element xhtml:a {
attribute href { "register-" || $list || ".html?e=" || $id },
<xhtml:i class="fa {$icon}" aria-hidden="true"></xhtml:i>,
<xhtml:i class="fa fa-map-marker" aria-hidden="true"></xhtml:i>,
"&#160;",
$targetNode/*[1]/string(),
let $ancestors := $targetNode/ancestor::tei:place
......@@ -545,10 +559,11 @@ element xhtml:li {
: :)
declare function local:pointer($entry as element())
as element(xhtml:li) {
let $labelMain := ($entry/*)[1]
let $target := $entry/tei:note/tei:ptr/@target => substring-after('#')
let $labelMain := $entry/*[1]
let $target := substring-after(($entry/tei:note/tei:ptr/@target), '#')
let $targetNode := $f-indexproc:dataCollection/id($target)
return
if(not($targetNode)) then <div>target not found</div> else
element xhtml:li {
attribute class {
"registerEintrag",
......
......@@ -2,6 +2,7 @@ xquery version "3.1";
module namespace f-misc="http://fontane-nb.dariah.eu/ns/SADE/misc";
import module namespace config="http://textgrid.de/ns/SADE/config" at "../config/config.xqm";
import module namespace console="http://exist-db.org/xquery/console";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace test="http://exist-db.org/xquery/xqsuite";
......@@ -197,17 +198,17 @@ return
};
declare function f-misc:kaesten($node as node(), $model as map(*)){
let $q := request:get-parameter('n', '')
let $q := if(string-length($q) = 1) then upper-case($q)||"0" else $q
let $num := if(matches($q, "\d+$")) then number(substring($q, 2, 2)) else 0
let $q := substring($q, 1, 1)
let $n := request:get-parameter('n', 'a0')
let $num := if(matches($n, "\d+$")) then number(substring($n, 2)) else 0
let $k := lower-case(substring($n, 1, 1))
let $q := $k || $num
let $data-dir := config:get("data-dir")
return
(<ul class="nav nav-tabs">
{for $kasten in (('a', 'b', 'c', 'd', 'e'))
return
if ($q = $kasten)
if ($k = $kasten)
then
<li class="active">
<a href="#{$kasten}" data-toggle="tab">Kasten {upper-case($kasten)}</a>
......@@ -222,7 +223,7 @@ return
{
for $kasten in (('a', 'b', 'c', 'd', 'e'))
return
if ($q = $kasten)
if ($k = $kasten)
then
<div class="tab-pane active" id="{$kasten}">
<div class="panel-group" id="accordion{upper-case($kasten)}" role="tablist" aria-multiselectable="true">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment