Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fontane-notizbuecher
SADE
Commits
3eb77ec2
Commit
3eb77ec2
authored
Jul 15, 2017
by
Mathias Goebel
🎠
Browse files
server status added
parent
5d866779
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/fontane/misc.xqm
View file @
3eb77ec2
...
...
@@ -456,7 +456,7 @@ return
let $status := $doc/xhtml:div[@class]/tokenize(@class, '\s+')[last()]
return
if( $doc//ok ) then () else
<div class="alert alert-{$status}">
<div class="alert alert-{
if($status = "error") then "danger" else
$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
...
...
@@ -467,6 +467,45 @@ return
</div>
};
declare function f-misc:serverStatus($node as node(), $model as map(*)) {
let $col := "/db/sade-projects/textgrid"
let $res := "serverstatus.xml"
let $url := "https://dariah-de.github.io/status/index.html"
let $lastMod := xmldb:last-modified($col, $res)
let $path := $col || "/" || $res
let $doc := doc( $path )
let $active := not( exists( $doc//ok ) )
let $needUpdate := not(doc-available($path)) or $lastMod < (current-dateTime() - xs:dayTimeDuration("PT6H"))
let $getStatus :=
if( $needUpdate )
then
let $status := httpclient:get(xs:anyURI($url), false(), ())//*:li[contains(., "Fontane")]/ancestor::*:div[contains(@class, "alert")]
let $status := if( exists( $status ) ) then $status else <ok/>
return
(xmldb:login($col, config:get("sade.user"), config:get("sade.password")),
xmldb:store($col, $res, $status))
else if($active and $lastMod < (current-dateTime() - xs:dayTimeDuration("PT2H")))
then
let $status := httpclient:get(xs:anyURI($url), false(), ())//*:li[contains(., "Fontane")]/ancestor::*:div[contains(@class, "alert")]
let $status := if( exists( $status ) ) then $status else <ok/>
return
(xmldb:login($col, config:get("sade.user"), config:get("sade.password")), xmldb:store($col, $res, $status))
else ()
let $doc := doc( $col || "/" || $res )
return
let $status := $doc/*:div[@class]/tokenize(@class, '\s+')[last()]
return
if( $doc//ok ) then () else
<div class="alert {$status}">
<h4>Statusmeldung</h4>
<p>Es liegt eine aktuelle Meldung zum Betrieb dieses Servers vor.</p>
<h5>Status: {substring-after($status, "-")}<br/>
Datum: {string-join( ($doc//*:time/string(@datetime)), ";")}</h5>
<!-- at DARIAH-DE status page no p@lang='de' available -->
<p>Die vollständige Statusmeldung finden Sie unter <a href="https://dariah-de.github.io/status/">dariah-de.github.io/status/</a></p>
</div>
};
declare function f-misc:nbTitle($id as xs:string, $model as map(*)){
let $doc := doc( config:get("data-dir") || $id)
let $title := $doc//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title/string(.)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment