Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Dec 22, 2017
2 parents 8428cce + 1d37651 commit 5212bb3
Show file tree
Hide file tree
Showing 664 changed files with 49,970 additions and 25,927 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Quick start guide
If you have a running eXist database you can simply install the WeGA-data-samples.xar as well as the WeGA-WebApp.xar from the [Release section](https://github.com/Edirom/WeGA-WebApp/releases) via the eXist-Dashboard.

### Dependencies on other eXist apps/libs
* functx (http://www.functx.com), installable via dashboard
* `functx` [http://www.functx.com](http://www.xqueryfunctions.com), installable via dashboard
* `WeGA-WebApp-lib`, get it from [https://github.com/Edirom/WeGA-WebApp-lib](https://github.com/Edirom/WeGA-WebApp-lib)



Expand Down
25 changes: 15 additions & 10 deletions api/v1/controller.xql
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ declare function local:serialize-xml($response as item()*, $root as xs:string) a
for $i in $response
return
typeswitch($i)
case map() return $i?* ! local:serialize-xml($i(.), .)
case map() return map:keys($i) ! local:serialize-xml($i(.), .)
case function() as item() return <array>{ for $j in $i?* return local:serialize-xml($j, 'root')/node() }</array>
default return $response
}
Expand Down Expand Up @@ -139,8 +139,8 @@ let $validate-params := function($params as map()?) as map()? {
for $param in map:keys($params)
let $lookup := function-lookup(xs:QName($local:api-module-prefix || ':validate-' || $param), 1)
return
if(exists($lookup)) then $lookup(map:entry($param, $params($param)))
else if(exists($validate-unknown-param)) then $validate-unknown-param(map:entry($param, $params($param)))
if(exists($lookup)) then $lookup(map {$param := $params($param), 'swagger:config' := $local:swagger-config })
else if(exists($validate-unknown-param)) then $validate-unknown-param(map {$param := $params($param), 'swagger:config' := $local:swagger-config })
else (
util:log-system-out('It seems you did not provide a validate-unknown-param function'),
error($local:INVALID_PARAMETER, 'Unknown parameter "' || $param || '". Details should be provided in the system log.')
Expand All @@ -154,10 +154,10 @@ let $validate-params := function($params as map()?) as map()? {
: Sending one parameter to the function of type map()
: If $lookup is empty, return a map() with error message and code
~:)
let $response := function() {
typeswitch($lookup?func)
case empty() return map {'code' := 404, 'message' := 'not implemented', 'fields' := ''}
default return
let $response := function($lookup as map(*)) {
(: typeswitch($lookup?func)
case empty() return $unknown-function
default return :)
try { $lookup?func(map:new(($local:defaults, map {'swagger:config' := $local:swagger-config}, $validate-params($lookup?path-params), $validate-params($local:url-parameters)))) }
catch * { map {'code' := 404, 'message' := $err:description, 'fields' := 'Error Code: ' || $err:code} }
}
Expand All @@ -167,6 +167,8 @@ let $response := function() {
: Browsers send a comma separated list of possible values
~:)
let $accept-header := tokenize(request:get-header('Accept'), '[,;]')
let $unknown-function :=
map {'code' := 404, 'message' := 'Unknown/unsupported API function. Please refer to the swagger.conf file for supported functions.', 'fields' := ''}

return (:(
util:log-system-out($exist:path),
Expand All @@ -181,6 +183,9 @@ return (:(
<set-header name="Cache-Control" value="max-age=3600,public"/>
</forward>
</dispatch>
else if($accept-header[.='application/xml']) then local:serialize-xml($response(), if(empty($lookup)) then 'Error' else $exist:resource )
else if($accept-header[.='application/json']) then local:serialize-json($response())
else ()
else if(exists($lookup)) then
if($accept-header[.='application/xml']) then local:serialize-xml($response($lookup), if(empty($lookup)) then 'Error' else $exist:resource )
else if($accept-header[.='application/json']) then local:serialize-json($response($lookup))
else local:serialize-xml(map { 'msg':= 'Unknown/unsupported HTTP Accept Header. Please refer to the swagger.conf file for supported response formats.', 'code':= 406 }, 'apiResponse')
else if($accept-header[.='application/json']) then local:serialize-json($unknown-function)
else local:serialize-xml($unknown-function, 'apiResponse')
44 changes: 22 additions & 22 deletions api/v1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
<meta name="theme-color" content="#ffffff"/>

<link rel="stylesheet" type="text/css" href="$resources/lib/Easy-Responsive-Tabs-to-Accordion/css/easy-responsive-tabs.css"/>
<link rel="stylesheet" type="text/css" href="$resources/css/jquery.loadmask.css" data-template="app:if-matches" data-template-key="environment" data-template-value="development"/>
<link rel="stylesheet" type="text/css" href="$resources/css/styles.css" data-template="app:if-matches" data-template-key="environment" data-template-value="development"/>
<link rel="stylesheet" type="text/css" href="$resources/css/jquery.loadmask-min.css" data-template="app:if-not-matches" data-template-key="environment" data-template-value="development"/>
<link rel="stylesheet" type="text/css" href="$resources/css/styles-min.css" data-template="app:if-not-matches" data-template-key="environment" data-template-value="development"/>
<link rel="stylesheet" type="text/css" href="$resources/css/jquery.loadmask.css" data-template="app-shared:if-matches" data-template-key="environment" data-template-value="development"/>
<link rel="stylesheet" type="text/css" href="$resources/css/styles.css" data-template="app-shared:if-matches" data-template-key="environment" data-template-value="development"/>
<link rel="stylesheet" type="text/css" href="$resources/css/jquery.loadmask-min.css" data-template="app-shared:if-not-matches" data-template-key="environment" data-template-value="development"/>
<link rel="stylesheet" type="text/css" href="$resources/css/styles-min.css" data-template="app-shared:if-not-matches" data-template-key="environment" data-template-value="development"/>
<link rel="stylesheet" type="text/css" href="$resources/lib/selectize/dist/css/selectize.bootstrap3.css"/>
<link rel="stylesheet" type="text/css" href="$resources/lib/google-code-prettify/bin/prettify.min.css"/>
<link rel="stylesheet" type="text/css" href="$resources/css/swagger.css"/>
Expand Down Expand Up @@ -73,7 +73,7 @@
</li>
<li class="dropdown">
<a class="dropdown-secondlevel-nav dropdown-toggle" data-toggle="dropdown" href="#">Weber</a>
<ul class="dropdown-menu" role="menu" data-template="app:order-list-items">
<ul class="dropdown-menu" role="menu" data-template="app-shared:order-list-items">
<li>
<a href="$link/A002068/bio.html" data-template="lang:translate">bio</a>
</li>
Expand All @@ -93,7 +93,7 @@
</li>
<li class="dropdown">
<a class="dropdown-secondlevel-nav dropdown-toggle" data-toggle="dropdown" data-template="lang:translate" href="#">indices</a>
<ul class="dropdown-menu" role="menu" data-template="app:order-list-items">
<ul class="dropdown-menu" role="menu" data-template="app-shared:order-list-items">
<li>
<a href="$link/indices/persons" data-template="lang:translate">persons</a>
</li>
Expand All @@ -119,7 +119,7 @@
</li>
<li id="project-nav" class="dropdown">
<a class="dropdown-secondlevel-nav dropdown-toggle" data-toggle="dropdown" data-template="lang:translate" href="#">project</a>
<ul class="dropdown-menu" role="menu" data-template="app:order-list-items">
<ul class="dropdown-menu" role="menu" data-template="app-shared:order-list-items">
<li>
<a href="$link/project/news" data-template="lang:translate">news</a>
</li>
Expand Down Expand Up @@ -148,7 +148,7 @@
</li>
<li id="help-nav" class="active dropdown">
<a class="dropdown-secondlevel-nav dropdown-toggle" data-toggle="dropdown" data-template="lang:translate" href="#">help</a>
<ul class="dropdown-menu" role="menu" data-template="app:order-list-items">
<ul class="dropdown-menu" role="menu" data-template="app-shared:order-list-items">
<li>
<a href="$link/help/faq.html" data-template="lang:translate">faq</a>
</li>
Expand Down Expand Up @@ -193,7 +193,7 @@ <h1 data-template="lang:translate">openapiDocumentation</h1>
<div class="container paddingTopIcon paddingBottomIcon">
<div class="row swagger-section" data-template="app:inject-api-base">
<div class="col-md-12">
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate="">&#160;</div>
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate=""> </div>
<div id="swagger-ui-container" class="swagger-ui-wrap"/>
</div>
</div>
Expand All @@ -202,10 +202,10 @@ <h1 data-template="lang:translate">openapiDocumentation</h1>
<div class="container documentFooter">
<div class="row bugreport" data-template="app:bugreport">
<div class="col-md-9">
<p data-template="app:if-matches" data-template-key="lang" data-template-value="de">Wenn Ihnen auf dieser Seite ein Fehler oder eine Ungenauigkeit aufgefallen ist, <br/>so bitten wir um eine kurze Nachricht an
<a href="#" class="obfuscate-email" data-template="app:print" data-template-key="bugEmail">bugEmail</a>.</p>
<p data-template="app:if-matches" data-template-key="lang" data-template-value="en">If you've spotted some error or inaccurateness please do not hesitate to inform us via
<a href="#" class="obfuscate-email" data-template="app:print" data-template-key="bugEmail">bugEmail</a>.</p>
<p data-template="app-shared:if-matches" data-template-key="lang" data-template-value="de">Wenn Ihnen auf dieser Seite ein Fehler oder eine Ungenauigkeit aufgefallen ist, <br/>so bitten wir um eine kurze Nachricht an
<a href="#" class="obfuscate-email" data-template="app-shared:print" data-template-key="bugEmail">bugEmail</a>.</p>
<p data-template="app-shared:if-matches" data-template-key="lang" data-template-value="en">If you've spotted some error or inaccurateness please do not hesitate to inform us via
<a href="#" class="obfuscate-email" data-template="app-shared:print" data-template-key="bugEmail">bugEmail</a>.</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -275,8 +275,8 @@ <h1 data-template="lang:translate">openapiDocumentation</h1>
<script type="text/javascript" src="$resources/lib/bootstrap/dist/js/bootstrap.min.js"/>
<script type="text/javascript" src="$resources/lib/Easy-Responsive-Tabs-to-Accordion/js/easyResponsiveTabs.js"/>
<script type="text/javascript" src="$resources/lib/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js"/>
<!-- <script type="text/javascript" src="$resources/js/jquery.loadmask.js" data-template="app:if-matches" data-template-key="environment" data-template-value="development"/>-->
<!-- <script type="text/javascript" src="$resources/js/jquery.loadmask-min.js" data-template="app:if-not-matches" data-template-key="environment" data-template-value="development"/>-->
<!-- <script type="text/javascript" src="$resources/js/jquery.loadmask.js" data-template="app-shared:if-matches" data-template-key="environment" data-template-value="development"/>-->
<!-- <script type="text/javascript" src="$resources/js/jquery.loadmask-min.js" data-template="app-shared:if-not-matches" data-template-key="environment" data-template-value="development"/>-->
<!-- <script type="text/javascript" src="$resources/lib/bootstrap-remote-data/js/bootstrap-remote-tabs.min.js"/>-->
<!-- <script type="text/javascript" src="$resources/lib/datepicker-fr/ui/widgets/datepicker-min.js"/>-->
<!-- <script type="text/javascript" src="$resources/lib/datepicker-fr/ui/i18n/datepicker-de.js"/>-->
Expand All @@ -287,10 +287,10 @@ <h1 data-template="lang:translate">openapiDocumentation</h1>
<!-- <script type="text/javascript" src="$resources/lib/leaflet/dist/leaflet.js"/>-->
<!-- <script type="text/javascript" src="$resources/lib/leaflet-iiif/leaflet-iiif.js"/>-->
<script type="text/javascript" src="$resources/lib/flip/dist/jquery.flip.min.js"/>
<script type="text/javascript" src="$resources/js/greedynav.js" data-template="app:if-matches" data-template-key="environment" data-template-value="development"/>
<script type="text/javascript" src="$resources/js/greedynav-min.js" data-template="app:if-not-matches" data-template-key="environment" data-template-value="development"/>
<script type="text/javascript" src="$resources/js/init.js" data-template="app:if-matches" data-template-key="environment" data-template-value="development"/>
<script type="text/javascript" src="$resources/js/init-min.js" data-template="app:if-not-matches" data-template-key="environment" data-template-value="development"/>
<script type="text/javascript" src="$resources/js/greedynav.js" data-template="app-shared:if-matches" data-template-key="environment" data-template-value="development"/>
<script type="text/javascript" src="$resources/js/greedynav-min.js" data-template="app-shared:if-not-matches" data-template-key="environment" data-template-value="development"/>
<script type="text/javascript" src="$resources/js/init.js" data-template="app-shared:if-matches" data-template-key="environment" data-template-value="development"/>
<script type="text/javascript" src="$resources/js/init-min.js" data-template="app-shared:if-not-matches" data-template-key="environment" data-template-value="development"/>
<script type="text/javascript" src="$resources/lib/swagger-ui/dist/lib/object-assign-pollyfill.js"/>
<script type="text/javascript" src="$resources/lib/swagger-ui/dist/lib/jquery.slideto.min.js"/>
<script type="text/javascript" src="$resources/lib/swagger-ui/dist/lib/jquery.wiggle.min.js"/>
Expand All @@ -306,12 +306,12 @@ <h1 data-template="lang:translate">openapiDocumentation</h1>
<!-- <script type="text/javascript" src="$resources/lib/swagger-ui/dist/lib/swagger-oauth.js"/>-->
<!-- <script type="text/javascript" src="$resources/lib/swagger-ui/dist/lang/translator.js"/>-->
<!-- <script type="text/javascript" src="$resources/lib/swagger-ui/dist/lang/de.js"/>-->
<script type="text/javascript" src="$resources/js/swagger.js" data-template="app:if-matches" data-template-key="environment" data-template-value="development"/>
<script type="text/javascript" src="$resources/js/swagger-min.js" data-template="app:if-not-matches" data-template-key="environment" data-template-value="development"/>
<script type="text/javascript" src="$resources/js/swagger.js" data-template="app-shared:if-matches" data-template-key="environment" data-template-value="development"/>
<script type="text/javascript" src="$resources/js/swagger-min.js" data-template="app-shared:if-not-matches" data-template-key="environment" data-template-value="development"/>



<div data-template="app:if-matches" data-template-key="environment" data-template-value="production" data-template-wrap="false">
<div data-template="app-shared:if-matches" data-template-key="environment" data-template-value="production" data-template-wrap="false">
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
Expand Down
13 changes: 11 additions & 2 deletions api/v1/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,22 @@
],
"parameters": [
{
"name": "date",
"name": "fromDate",
"in": "query",
"description": "The date to search for",
"description": "The min date to search for",
"type": "string",
"default": "1786-11-18",
"format": "date",
"required": true
},
{
"name": "toDate",
"in": "query",
"description": "The max date to search for",
"type": "string",
"format": "date",
"required": false
},
{
"$ref": "#/parameters/docTypeParam"
},
Expand Down
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
project.app=WeGA-WebApp
project.name=http://weber-gesamtausgabe.de/webapp
project.version=3.1.0
project.version=3.2.0
build.dir=build
dist.dir=dist
tmp.dir=tmp
Expand Down
4 changes: 4 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<regressiontest doctype="thematicCommentaries"/>
<regressiontest doctype="var"/>
<regressiontest doctype="writings"/>
<regressiontest doctype="places"/>
</target>

<target name="download-smufl-font" depends="bower" if="${update.smufl-font}">
Expand Down Expand Up @@ -149,11 +150,14 @@
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
<include name="**/*.xsl"/>
<include name="**/*.xml"/>
<!-- exclude html files. non-well-formed html makes eXist choke -->
<exclude name="**/*.html"/>
<!-- exclude tests to reduce file size -->
<exclude name="**/test/**"/>
<exclude name="**/tests.js"/>
<exclude name="**/docs/**"/>
</fileset>
</copy>

Expand Down
Loading

0 comments on commit 5212bb3

Please sign in to comment.