Commit 8caafff2 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

Merge branch 'release/3.2.0'

parents 5ef3a357 e88b527f
project.name=http://textgrid.de/ns/SADE-fontane-develop
project.version=3.1.0
project.version=3.2.0
project.title=[Fontane] SADE
project.abbrev=SADE-fontane-develop
project.processorversion=4.3.1
......@@ -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"
......@@ -89,6 +89,19 @@ switch ( $entity/local-name() )
$list/local-name() || "-" || string($list/@type)
};
declare function local:get-icon-by-entity($entity as node())
as xs:string {
switch ( $entity/local-name() )
case "event" return "fa-flag"
case "org" return "fa-university"
case "person" return "fa-user"
case "personGrp" return "fa-users"
case "place" return "fa-map-marker"
case "item" return "fa-book"
default return
"fa-exclamation-triangle"
};
(:~
: Helper function to use an efficient map data type to store the model.
:)
......@@ -407,13 +420,31 @@ element xhtml:li {
declare function local:has-former-or-current-location($links as element(tei:link)*)
as element(xhtml:li)* {
for $link in $links
let $id := $link/@target => substring-after(" ") => substring-after(":")
let $thisId := string($link/parent::tei:linkGrp/parent::tei:*/@xml:id)
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)
return
element xhtml:li {
attribute class { "former-or-current-location" },
element xhtml:a {
attribute href { "register-listPlace.html?e=" || $id },
attribute href { "register-" || $list || ".html?e=" || $id },
<xhtml:i class="fa fa-map-marker" aria-hidden="true"></xhtml:i>,
"&#160;",
$targetNode/*[1]/string(),
......@@ -528,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 $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">
......@@ -238,88 +239,93 @@ return
}
</div>)
};
declare function f-misc:list($datadir, $param, $num as xs:integer) {
let $tgnav:= doc('/db/sade-projects/textgrid/navigation-fontane.xml')
for $item at $pos in distinct-values($tgnav//object[string(@type)="text/xml"][starts-with(string(@title), 'Notizbuch ' || $param)]/string(@title))
(:
: use these lines, when more than on revision is in the database
: let $maxRev:= max($tgnav//object[@title = $item]/number(substring-after(@uri, '.'))),:)
(: $uri:= $tgnav//object[@title = $item][number(substring-after(@uri, '.')) = $maxRev]/substring-after(@uri, 'textgrid:'):)
let $uri:= $tgnav//object[string(@title) = $item]/substring-before(substring-after(@uri, 'textgrid:'), '.')
let $thisIn := upper-case(replace(request:get-parameter('n', ''), "\d", "")) || $num eq replace($item, "Notizbuch ([A-E])0(\d)", "$1$2")
declare function f-misc:list($datadir, $param, $num as xs:integer)
as element(xhtml:div)+ {
let $tgnav := doc("/db/sade-projects/textgrid/data/xml/data/3qnsx.xml")
let $tgnavObjects := $tgnav//object[starts-with(./@title, 'Notizbuch ' || $param)]/string(@title)
=> distinct-values()
for $item at $pos in $tgnavObjects
let $uri:= $tgnav//object[string(@title) = $item]/substring-after(@uri, 'textgrid:')
let $teiDoc := doc("/db/sade-projects/textgrid/data/xml/data/" || $uri || ".xml")
let $title := if (matches($item, '0\d')) then $item => replace('0', '') else $item
let $beta := if(contains(($teiDoc//tei:revisionDesc/tei:change)[last()]/text(), 'Version 0.')) then <xhtml:sup>beta</xhtml:sup> else ()
let $thisIn := (request:get-parameter('n', '') => replace("0(\d)", "$1") => upper-case()) = $param||$pos
return
<div class="panel panel-dark">
<div class="panel-heading" role="tab" id="heading{$param||$pos}">
<h3 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion{$param}" href="#collapse{$param||$pos}" aria-expanded="false" aria-controls="collapse{$param||$pos}">
{ if (matches($item, '0\d')) then replace($item, '0', '') else $item }{if($param||$pos = ('C5', 'C6', 'C7')) then <xhtml:sup>beta</xhtml:sup> else ()}
</a>
</h3>
</div>
<div id="collapse{$param||$pos}" class="panel-collapse collapse{if ($thisIn) then ' in' else ()}" role="tabpanel" aria-labelledby="heading{$param||$pos}">
<div class="panel-body">
<div class="row">
<div class="col-md-9">
<a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page=">Synoptische Ansicht</a>
<span style="margin-left:20px;"/>
<form class="form-inline" style="display:inline;" action="edition.html" metod="get">
<input type="hidden" name="id" value="/xml/data/{$uri[last()]}.xml"/>
<div class="form-group">
<div class="panel-heading" role="tab" id="heading{$param||$pos}">
<h3 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion{$param}" href="#collapse{$param||$pos}" aria-expanded="false" aria-controls="collapse{$param||$pos}">
{$title}
{$beta}
</a>
</h3>
</div>
<div id="collapse{$param||$pos}" class="panel-collapse collapse{if ($thisIn) then ' in' else ()}" role="tabpanel" aria-labelledby="heading{$param||$pos}">
<div class="panel-body">
<div class="row">
<div class="col-md-9">
<a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page=">Synoptische Ansicht</a>
<span style="margin-left:20px;"/>
<form class="form-inline" style="display:inline;" action="edition.html" metod="get">
<input type="hidden" name="id" value="/xml/data/{$uri[last()]}.xml"/>
<div class="form-group">
<input name="page" type="text" style="border-radius:0;border-style:solid;width:40px;" placeholder="1r" data-toggle="tooltip" data-placement="bottom" title="Blattnummer"/>
<button type="submit" class="btn btn-default"><i class="fa fa-chevron-right"></i></button>
<input name="page" type="text" style="border-radius:0;border-style:solid;width:40px;" placeholder="1r" data-toggle="tooltip" data-placement="bottom" title="Blattnummer"/>
<button type="submit" class="btn btn-default"><i class="fa fa-chevron-right"></i></button>
</div>
</form>
<br/>
</div>
</form>
<br/>
<ul>
<li><a href="mirador.html?n={$param||$pos}">Digitalisate</a></li>
<li><a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page="
onclick="goldenState('trans')">Transkriptionsansicht</a></li>
<li>Edierter Text/Textkritischer Apparat</li>
<li>TEI/XML-Ansicht: <a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page="
onclick="goldenState('code')"><i title="seitenweise" class="fa fa-file-o"></i></a> | <a href="xml.html?id=/xml/data/{$uri[last()]}.xml"><i title="gesamtes XML auf der Webseite betrachten" class="fa fa-file-code-o"></i></a> |<a target="_blank" href="/rest/data/{$uri[last()]}.xml">REST</a></li>
<li>Kommentare und Register
<ul>
<li><a href="ueberblickskommentar.html?id=/xml/data/{$uri[last()]}.xml">Überblickskommentar</a></li>
<li>Stellenkommentar</li>
<li>Register
<ul>
<li><a href="mirador.html?n={$param||$pos}">Digitalisate</a></li>
<li><a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page="
onclick="goldenState('trans')">Transkriptionsansicht</a></li>
<li>Edierter Text/Textkritischer Apparat</li>
<li>TEI/XML-Ansicht: <a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page="
onclick="goldenState('code')"><i title="seitenweise" class="fa fa-file-o"></i></a> | <a href="xml.html?id=/xml/data/{$uri[last()]}.xml"><i title="gesamtes XML auf der Webseite betrachten" class="fa fa-file-code-o"></i></a> |<a target="_blank" href="/rest/data/{$uri[last()]}.xml">REST</a></li>
<li>Kommentare und Register
<ul>
<li><a href="ueberblickskommentar.html?id=/xml/data/{$uri[last()]}.xml">Überblickskommentar</a></li>
<li>Stellenkommentar</li>
<li>Register
<ul>
<li><a href="register-listPerson.html?nb={$uri[last()]}">Register der Personen und Werke</a></li>
<li><a href="register-list-works.html?nb={$uri[last()]}">Register der Werke</a></li>
<li><a href="register-list-Fontane.html?nb={$uri[last()]}">Register der Werke Theodor Fontanes</a></li>
<li><a href="register-list-periodicals.html?nb={$uri[last()]}">Register der Periodika</a></li>
<li><a href="register-listPlace.html?nb={$uri[last()]}">Geographisches Register</a></li>
<li><a href="register-listEvent.html?nb={$uri[last()]}">Register der Ereignisse</a></li>
<li><a href="register-listOrg.html?nb={$uri[last()]}">Register der Institutionen und Körperschaften</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="inhalt.html?id=/xml/data/{$uri[last()]}.xml">Inhaltsverzeichnis</a></li>
<li><a href="register-listPerson.html?nb={$uri[last()]}">Register der Personen und Werke</a></li>
<li><a href="register-list-works.html?nb={$uri[last()]}">Register der Werke</a></li>
<li><a href="register-list-Fontane.html?nb={$uri[last()]}">Register der Werke Theodor Fontanes</a></li>
<li><a href="register-list-periodicals.html?nb={$uri[last()]}">Register der Periodika</a></li>
<li><a href="register-listPlace.html?nb={$uri[last()]}">Geographisches Register</a></li>
<li><a href="register-listEvent.html?nb={$uri[last()]}">Register der Ereignisse</a></li>
<li><a href="register-listOrg.html?nb={$uri[last()]}">Register der Institutionen und Körperschaften</a></li>
</ul>
</div>
<div class="col-md-3">
<div id="thumb">{
let $img := "digilib/"||substring-after($item, ' ')||"_001.jpg?dh=350&amp;mo=jpg"
return
element xhtml:img {
attribute class {"imgLazy"},
attribute src {
if ($thisIn) then $img else "/public/img/loader.svg"
},
if(not($thisIn)) then
attribute data-original {$img}
else ()
}
}
</div>
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
</li>
<li><a href="inhalt.html?id=/xml/data/{$uri[last()]}.xml">Inhaltsverzeichnis</a></li>
</ul>
</div>
<div class="col-md-3">
<div id="thumb">{
let $img := "digilib/"||substring-after($item, ' ')||"_001.jpg?dh=350&amp;mo=jpg"
return
element xhtml:img {
attribute class {"imgLazy"},
attribute src {
if ($thisIn) then $img else "/public/img/loader.svg"
},
if(not($thisIn)) then
attribute data-original {$img}
else ()
}
}
</div>
</div>
</div>
</div>
</div>
</div>
};
declare function f-misc:content($node as node(), $model as map(*), $id, $page){
......
......@@ -3,7 +3,7 @@ xquery version "3.1";
: Provides a REST-API to get table of contents
:
: @author Mathias Göbel
: @version 1.0
: @version 1.1
: @since 2.6
: :)
......@@ -59,7 +59,13 @@ function toc:table-of-contents($uri as xs:string)
attribute class {"panel-body tocview"},
element ul {
for $ref in $item//tei:ref
let $targetPage := $ref/@target => substring-after("[@n='") => substring-before("']")
let $target := string($ref/@target)
let $targetPage :=
if(starts-with($target, "#xpath(//surface"))
then $target => substring-after("[@n='") => substring-before("']")
else if (matches($target, "^#[A-E]\d\d_.+_[a-z0-9]+$"))
then $target => substring-after("_") => substring-before("_")
else error(QName("FONTANE", "TOC-API1"), "invalid target: " || $target)
return
element li {
attribute class { "target" || $targetPage },
......
......@@ -2047,7 +2047,7 @@ declare function local:teiref2href($ref as xs:string) as xs:string {
case "lit" return $fontaneTransfo:base-url || "literaturvz.html?id=" || $id
default return
let $listName := index:get-list-by-id($id)
return $fontaneTransfo:base-url || $listName || ".html?e=" || $id
return $fontaneTransfo:base-url || "register-" || $listName || ".html?e=" || $id
};
declare function fontaneTransfo:figure($node as node()*) {
......
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