Skip to content

Commit

Permalink
#6 but there is some encoding issue
Browse files Browse the repository at this point in the history
  • Loading branch information
csae8092 committed Apr 23, 2019
1 parent 62739d9 commit fe35212
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
22 changes: 22 additions & 0 deletions modules/app.xql
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ declare variable $app:description := doc(concat($config:app-root, "/repo.xml"))/
declare variable $app:purpose_de := "der Bereitstellung von Forschungsdaten";
declare variable $app:purpose_en := "is the publication of research data.";

declare variable $app:redmineBaseUrl := "https://shared.acdh.oeaw.ac.at/acdh-common-assets/api/imprint.php?serviceID=";
declare variable $app:redmineID := "6930";

declare function functx:contains-case-insensitive
( $arg as xs:string? ,
$substring as xs:string ) as xs:boolean? {
Expand Down Expand Up @@ -502,4 +505,23 @@ declare function app:firstDoc($node as node(), $model as map(*)) {
<a class="btn btn-main btn-outline-primary btn-lg" href="{$href}" role="button">Start Reading</a>
};

(:~
: fetches html snippets from ACDH's imprint service; Make sure you'll have $app:redmineBaseUrl and $app:redmineID set
:)

declare function app:fetchImprint($node as node(), $model as map(*)) {
let $url := $app:redmineBaseUrl||$app:redmineID

let $headers :=
<headers>
<header name="Accept" value="text/html"/>
<header name="Accept-Charset" value="utf-8"/>
</headers>

let $request := httpclient:get(($url), true(), $headers)
return
<div>
{$request//BODY}
</div>

};
19 changes: 3 additions & 16 deletions pages/imprint.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<div class="templates:surround?with=templates/page.html&amp;at=content" id="test_id">
<div id="imprint-content" class="container"/><!-- #imprint-content -->
<script>
const params = {
'language': 'both',
'projectName': "dsebaseapp",
'projectPurpose': {
'de': "der Bereitstellung von Forschungsdaten",
'en': "is the publication of research data."
}
};
const imprintService = 'https://shared.acdh.oeaw.ac.at/acdh-common-assets/api/imprint.php';
$.get(imprintService, params, function(response){
document.getElementById('imprint-content').innerHTML = response;
});
</script>
<div class="container-fluid">
<div data-template="app:fetchImprint"/>
</div>
</div>
2 changes: 1 addition & 1 deletion templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
</div>
</div>
<div class="footer-imprint-bar">
<a href="https://www.oeaw.ac.at/die-oeaw/impressum/">Impressum/Imprint</a>
<a href="imprint.html">Impressum/Imprint</a>
</div>
</footer>

Expand Down

0 comments on commit fe35212

Please sign in to comment.