Commit 376bdc6b authored by mrodzis's avatar mrodzis 🐸 Committed by Mathias Goebel
Browse files

Feature/infopage

parent cc7693ff
......@@ -16,6 +16,7 @@ declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace test="http://exist-db.org/xquery/xqsuite";
declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010";
declare namespace tgrel="http://textgrid.info/relation-ns#";
declare namespace pkg="http://expath.org/ns/pkg";
declare namespace xqdoc="http://www.xqdoc.org/1.0";
(:~
......@@ -224,6 +225,58 @@ function app:list-docs($node as node(), $model as map(*)) {
<li>{ $item }</li>
};
declare
%templates:wrap
function app:get-exist-version($node as node(), $model as map(*)) {
<li>{system:get-version()}</li>
};
declare
%templates:wrap
function app:get-sade-info($node as node(), $model as map(*)) {
let $doc := doc($config:app-root || "/expath-pkg.xml")
let $version := $doc//pkg:package/@version/string()
let $uri := $doc//pkg:package/@name/string()
let $name := $doc//pkg:package/@abbrev/string()
return
(<li>Version: {$version}</li>,
<li>Package URI: {$uri}</li>,
<li>Package name: {$name}</li>,
<li>Dependencies:
<ul>
{for $dep in $doc//pkg:dependency return
let $dep-name := $dep/(@* except @semver-min)/string()
return
<li>
{if($dep/@semver-min) then
$dep-name || " (min. " || $dep/@semver-min || ")"
else
$dep-name}
</li>
}
</ul>
</li>
)
};
declare
%templates:wrap
function app:get-charsyn-info($node as node(), $model as map(*)) {
let $file-system-path := system:get-exist-home() || util:system-property("file.separator")
let $dir-content := file:list($file-system-path)
let $charmap-available := if($dir-content//*[matches(@name, "charmap\.txt")]) then true() else false()
let $synonyms-available := if($dir-content//*[matches(@name, "synonyms\.txt")]) then true() else false()
let $yes := <i style="color: green" class="far fa-check-circle"></i>
let $no := <i style="color: green" class="far fa-times-circle"></i>
return
(<li>Charmap available? {if($charmap-available) then $yes else $no}</li>,
<li>Synonyms available? {if($synonyms-available) then $yes else $no}</li>)
};
(:~
: serves the error messages powered by programmingexcuses.com
: a random message is created on each error report and send out to the user.
......
......@@ -64,3 +64,10 @@ declare function tgmenu:list($uris as xs:string*, $metacollection, $aggcollectio
</ul>
};
declare function tgmenu:files-total($node as node(), $model as map(*)) {
let $no-of-items := count(collection( $config:data-root || "/meta" )) - 1
return
<span>Total numbers of items stored in SADE: {$no-of-items}</span>
};
<div data-template="templates:surround" data-template-with="templates/page_index.html" data-template-at="content-container">
<div class="container">
<section>
<h2 class="block-header">
<span class="title">TextGrid Objects</span>
</h2>
<ul class="nav-textgrid" data-template="tgmenu:template"/>
</section>
<section>
<h2 class="block-header">
<span class="title">SADE Documentation</span>
</h2>
<ul class="nav-docs" data-template="app:list-docs"/>
</section>
<section>
<h2 class="block-header">
<span class="title">Current eXist-db version</span>
</h2>
<ul class="nav-textgrid" data-template="app:get-exist-version"/>
</section>
<section>
<h2 class="block-header">
<span class="title">Information about SADE</span>
</h2>
<ul class="nav-textgrid" data-template="app:get-sade-info"/>
</section>
<section>
<h2 class="block-header">
<span class="title">Charmaps and Synonyms-file</span>
</h2>
<ul class="nav-textgrid" data-template="app:get-charsyn-info"/>
</section>
<section>
<h2 class="block-header">
<span class="title">TextGrid Objects</span>
</h2>
<ul class="nav-textgrid" data-template="tgmenu:files-total"/>
<ul class="nav-textgrid" data-template="tgmenu:template"/>
</section>
<section>
<h2 class="block-header">
<span class="title">SADE Documentation</span>
</h2>
<ul class="nav-docs" data-template="app:list-docs"/>
</section>
</div>
</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