Skip to content
Snippets Groups Projects
Commit 8cb2adbf authored by Mathias Goebel's avatar Mathias Goebel :reminder_ribbon:
Browse files

Merge branch 'release/2.2'

parents 1c673277 c74a868a
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,10 @@ xquery version "3.1";
import module namespace config="http://textgrid.de/ns/SADE/config" at "modules/config/config.xqm";
import module namespace digilib="http://textgrid.info/namespaces/xquery/digilib" at "../textgrid-connect/digilibProxy.xqm";
import module namespace fontaneTransfo="http://fontane-nb.dariah.eu/Transfo" at "modules/fontane/transform.xqm";
import module namespace console="http://exist-db.org/xquery/console";
declare namespace xhtml="http://www.w3.org/1999/xhtml";
declare variable $exist:path external;
declare variable $exist:resource external;
......@@ -45,6 +49,36 @@ else if (tokenize($exist:path, '/') = "digilib") then
return
digilib:proxy($project, $id, $if-modified-since)
(: REST interface of the interface! :)
else if (tokenize($exist:path, '/') = "get") then
let $reqid := request:get-parameter("id", "/xml/data/16b00.xml"),
$id := $reqid => substring-after("/xml/data/") => substring-before(".xml"),
$pagereq := request:get-parameter("page", "1r"),
$page := if( $pagereq = "" ) then "outer_front_cover" else $pagereq,
$docCollection := $config:projects-dir || $project ||"/data/xml/xhtml/"|| $id ||"/",
$docpath := $docCollection || $page ||".xml",
$doc := doc( $docpath ),
$content :=
switch ($exist:resource)
case "code.html" return
replace(serialize($doc//xhtml:div[@class="teixml"]), "xhtml:", "")
case "trans.html" return
replace(serialize($doc/xhtml:body/xhtml:div/xhtml:div[not(@class="teixml")][not(@class="facs")]), "xhtml:", "")
case "facs.html" return
replace(serialize($doc//xhtml:div[@class="facs"]), "xhtml:", "")
case "toc.html" return
replace(serialize(doc( $docCollection || "toc.xml" )), "xhtml:", "")
case "comm.html" return
replace(serialize($doc//xhtml:div[@class="notes"]), "xhtml:", "")
default return "supported requests are: facs, trans, code"
return
response:stream($content, "method=text media-type=text/plain")
(: the important stuff :)
else if (ends-with($exist:resource, ".html")) then
let $doc-path := $config:projects-dir || $project || config:get("template") || $exist:resource
......
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://expath.org/ns/pkg" name="http://textgrid.de/ns/SADE" abbrev="SADE" version="2.1" spec="1.0">
<package xmlns="http://expath.org/ns/pkg" name="http://textgrid.de/ns/SADE" abbrev="SADE" version="2.2" spec="1.0">
<title>Scalable Architecture for Digital Editions powered by TextGrid</title>
<dependency package="http://exist-db.org/apps/markdown"/>
<dependency package="http://exist-db.org/apps/monex"/>
......
......@@ -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 xhtml="http://www.w3.org/1999/xhtml";
......@@ -176,6 +177,7 @@ declare function f-misc:list($datadir, $param, $num as xs:integer) {
: 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 := $param||$pos = $param||$num
return
<div class="panel panel-dark">
<div class="panel-heading" role="tab" id="heading{$param||$pos}">
......@@ -185,7 +187,7 @@ declare function f-misc:list($datadir, $param, $num as xs:integer) {
</a>
</h3>
</div>
<div id="collapse{$param||$pos}" class="panel-collapse collapse {if ($param||$pos = $param||$num) then ' in' else ()}" role="tabpanel" aria-labelledby="heading{$param||$pos}">
<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">
......@@ -204,7 +206,7 @@ declare function f-misc:list($datadir, $param, $num as xs:integer) {
<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="createCookie('facs', 'inactive' , 180); createCookie('xml', 'inactive', 180); createCookie('trans', 'true', 180)">Transkriptionsansicht</a></li>
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="createCookie('facs', 'inactive' , 180); createCookie('xml', 'true', 180); createCookie('trans', 'inactive', 180)"><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>
......@@ -229,28 +231,19 @@ declare function f-misc:list($datadir, $param, $num as xs:integer) {
</ul>
</div>
<div class="col-md-3">
<div id="thumb">
{if ($param||$pos = 'C7') then
(<a href="#" data-toggle="modal" data-target="#modal"><img src="/public/img/loader.svg" data-original="digilib/{substring-after($item, ' ')}_001.jpg?dh=350&amp;mo=jpg"/></a>,
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="citationrecommendation" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
<h4 class="modal-title">{ if (matches($item, '0\d')) then replace($item, '0', '') else $item }</h4>
<div class="clearfix"></div>
</div>
<div class="modal-body">
{doc('/db/sade-projects/textgrid/data/xml/xhtml/16b00/outer_front_cover.xml')//xhtml:div[@id="outer_front_cover"][@class="surface "]}
</div>
</div>
</div>
</div>
)
else <img class="imgLazy" src="/public/img/loader.svg" data-original="digilib/{substring-after($item, ' ')}_001.jpg?dh=350&amp;mo=jpg"/>
<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>
......@@ -260,7 +253,7 @@ declare function f-misc:list($datadir, $param, $num as xs:integer) {
};
declare function f-misc:content($node as node(), $model as map(*), $id, $page){
<div id="nb-title" class="col-xs-3 col-md-2">
<div id="nb-title" class="col-xs-3 col-md-2" title="reset layout">
<h1 class="animated slideInLeft">
<span>{f-misc:nbTitle(request:get-parameter('id', ''), $model)}
{if(matches($page, '\d+(r|v)')) then ': '||$page else ()}</span>
......@@ -432,34 +425,37 @@ switch ($develop)
declare function f-misc:textgridStatus($node as node(), $model as map(*)) {
let $col := "/db/sade-projects/textgrid"
let $res := "tgstatus.xml"
let $url := "https://dariah-de.github.io/status/textgrid/repstatus.html"
let $lastMod := xmldb:last-modified($col, $res)
let $doc := doc( $col || "/" || $res )
let $active := not( exists( $doc//ok ) )
let $getStatus :=
if( not( $active ) and $lastMod < (current-dateTime() - xs:dayTimeDuration("PT12H")) )
then
let $status := httpclient:get(xs:anyURI("https://raw.githubusercontent.com/DARIAH-DE/textgridrep-status/master/repstatus.html"), false(), ())//xhtml:div[contains(@class, 'repstatus')][not( contains(@class, 'ok') )]
let $status := httpclient:get(xs:anyURI($url), false(), ())//xhtml:div[contains(@class, 'repstatus')][not( contains(@class, 'ok') )]
let $status := if( exists( $status ) ) then $status else <ok/>
return
xmldb:store($col, $res, $status)
else if($active and $lastMod < (current-dateTime() - xs:dayTimeDuration("PT2H")))
then
let $status := httpclient:get(xs:anyURI("https://raw.githubusercontent.com/DARIAH-DE/textgridrep-status/master/repstatus.html"), false(), ())//xhtml:div[contains(@class, 'repstatus')][not( contains(@class, 'ok') )]
let $status := httpclient:get(xs:anyURI($url), false(), ())//xhtml:div[contains(@class, 'repstatus')][not( contains(@class, 'ok') )]
let $status := if( exists( $status ) ) then $status else <ok/>
return
xmldb:store($col, $res, $status)
else ()
let $doc := doc( $col || "/" || $res )
return
let $status := $doc/xhtml:div[@class]/tokenize(@class, '\s+')[last()]
return
if( $doc//ok ) then () else
<div class="alert alert-danger">
<div class="alert alert-{$status}">
<h4>TextGrid-Statusmeldung</h4>
<p>Es liegt eine aktuelle Meldung zum TextGrid Repository vor. Einige
Funktionen, z.Bsp die Darstellung der Faksimiles, sind vom TextGrid
Repository abhängig und daher evtl. davon betroffen. Hier folgt die
Meldung von TextGrid.</p>
<h5>Status: {$doc/xhtml:div[@class]/tokenize(@class, '\s+')[last()]}</h5>
{$doc/xhtml:div//xhtml:p[@lang="de"]}
<h5>Status: {$status}</h5>
{for $i at $pos in $doc/xhtml:div//xhtml:p[@lang="de"] return (if($pos gt 1) then <hr/> else (),$i)}
</div>
};
......
xquery version "3.1";
module namespace f-render="http://fontane-nb.dariah.eu/ns/SADE/render";
import module namespace config="http://textgrid.de/ns/SADE/config" at "../config/config.xqm";
import module namespace f-transform="http://fontane-nb.dariah.eu/Transfo" at "transform.xqm";
import module namespace templates="http://exist-db.org/xquery/templates" ;
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace xhtml="http://www.w3.org/1999/xhtml";
declare variable $f-render:id := request:get-parameter("id", "/xml/data/16b00.xml");
declare variable $f-render:page :=
let $para := request:get-parameter("page", "outer_front_cover")
return
if($para = "") then "outer_front_cover" else $para
;
declare variable $f-render:doc := doc( config:get("data-dir") || $f-render:id );
declare variable $f-render:surface := $f-render:doc//tei:surface[@n = $f-render:page];
declare variable $f-render:xhtml := doc( config:get("data-dir") || "/xml/xhtml/" ||tokenize($f-render:id, "/|\.xml")[4] || "/" || $f-render:page || ".xml" );
declare variable $f-render:notebook := substring-after($f-render:doc//tei:sourceDoc/@n, 'er_');
declare function f-render:initView($node as node(), $model as map()) {
let $nodes := for $n in $node/node() return templates:process($n, $model)
return
element {$node/name()} {
attribute id {$f-render:notebook},
$node/@*[not(local-name() => starts-with("data-") )],
$nodes
}
};
declare function f-render:facs($node as node(), $model as map()) {
<xhtml:div>
{$node/@*[not(local-name() => starts-with("data-") )]}
{f-transform:facs($f-render:surface)}
</xhtml:div>
};
declare function f-render:tran($node as node(), $model as map()) {
<xhtml:div>
{$node/@*[not(local-name() => starts-with("data-") )]}
{($f-render:xhtml//xhtml:div[contains(@class, "surface")])[1]}
</xhtml:div>
};
declare function f-render:code($node as node(), $model as map()) {
<xhtml:div>
{$node/@*[not(local-name() => starts-with("data-") )]}
{$f-render:xhtml//xhtml:div[@class = "teixml"]}
</xhtml:div>
};
\ No newline at end of file
This diff is collapsed.
......@@ -9,6 +9,7 @@ import module namespace templates="http://exist-db.org/xquery/templates" ;
import module namespace mviewer="http://sade/multiviewer" at "multiviewer/multiviewer.xqm" ;
import module namespace console="http://exist-db.org/xquery/console" at "java:org.exist.console.xquery.ConsoleModule";
import module namespace f-misc="http://fontane-nb.dariah.eu/ns/SADE/misc" at "fontane/misc.xqm";
import module namespace f-render="http://fontane-nb.dariah.eu/ns/SADE/render" at "fontane/render.xqm";
import module namespace config="http://textgrid.de/ns/SADE/config" at "config/config.xqm";
import module namespace fsearch = "http://sade/faceted-search" at "faceted-search/faceted-search.xqm";
import module namespace nav="http://sade/tmpl-nav" at "tmpl-nav/tmpl-nav.xqm";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment