Commit acc63eb5 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

adjusting tg repstatus timings

parent 67c5cca5
......@@ -430,35 +430,36 @@ declare function f-misc:textgridStatus($node as node(), $model as map(*)) {
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("PT12H"))
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(), ())//xhtml:div[contains(@class, 'repstatus')][not( contains(@class, 'ok') )]
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")))
(xmldb:login($col, config:get("sade.user"), config:get("sade.password")),
xmldb:store($col, $res, <div>{$status}</div>))
else if($active and $lastMod < (current-dateTime() - xs:dayTimeDuration("PT5M")))
then
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:login($col, config:get("sade.user"), config:get("sade.password")), xmldb:store($col, $res, $status))
(xmldb:login($col, config:get("sade.user"), config:get("sade.password")), xmldb:store($col, $res, <div>{$status}</div>))
else ()
let $doc := doc( $col || "/" || $res )
return
let $status := $doc/xhtml:div[@class]/tokenize(@class, '\s+')[last()]
if( $doc//ok ) then () else
for $message at $pos in $doc/div/node()
let $status := $message/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
{if($pos gt 1) then () else <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>
Meldung von TextGrid.</p>}
<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)}
{for $i at $pos in $message//xhtml:p[@lang="de"] return (if($pos gt 1) then <hr/> else (),$i)}
</div>
};
......
Supports Markdown
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