diff --git a/.gitignore b/.gitignore
index 16c31aef..ec6ca00a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@ __pycache__/
# internal
edoc/resources/xsl/xspec/
.existdb.json
+edoc/rest2/v2.json
# node-reladted stuff
node_modules/
diff --git a/README.md b/README.md
index a09379b8..30fc5d4d 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,47 @@ This framework still lacks a good name. If you have an idea, please let me know!
## Incompatible changes
+### 25Q3
+
+Release 25Q3 dropped support for more unsued functions:
+- `wdb:getFilePath ( $id as xs:string )`: use the map from `wdbFiles:getFullPath` instead
+- the default layout of all `resources` collections has changed to group files by type. This also affects the main
+ project specific overrides, i.e. `project.js` and `project.css`. An XQuery is provided to move all files to their
+ appropriate new locations (TODO: add file name here).
+ This also affects `edoc/data/resources` and `edoc/resources` so you might have to change imports manually if you make
+ use of any file in these collections.
+
+Changes in standard behaviour
+- sub-projects will now make use of process inheritance; i.e., they only define empty `processes` with no `command`. A
+ `command` is then picked by traversing up through parent `wdbmeta.xml` (i.e., one that is pointed to by a
+ `struct/import`; worst case: data). This way, you can still have different `command` defined for sub-projects (and
+ their children) but do not need to change the path for every sub-project.
+- as part of this, no XSLTs are being copied to `{$subproject}/resources` as inheritance is now the standard. This way,
+ surplus XSLTs do not have to be deleted or kept up to date. As said above, it is still possible to create a `command`
+ for this sub-project tree and create specific XSLTs (usually by including the main XSLTs)
+- standard XSLTs for a new project are now bare: they only include `/edoc/data/resources/xslt/{$currentFileName}`, and
+ `tei-common.xsl` (unless it’s common itself).
+
+### 24Q4
+
+Release 24Q4 dropped another set of functions that were unused:
+- `wdb:getEdFromFileID( $id as xs:string )`: `(wdbFiles:getFullPath($id))?projectPath` returns the base path to `wdbmeta.xml`
+- `wdb:getMetaElementFromEd ( $ed as xs:string )`: use
+ `doc( (doc("/db/apps/edoc/index/project-index.xml")/id($ed))/@path || '/wdbmeta.xml' )/id($ed)[self::meta:projectMD]` instead
+- `wdb:getMetaFile( $pathToEd )`: `(wdbFiles:getFullPath($ed))?projectPath` returns the base path to `wdbmeta.xml`
+- `wdb:getProjectPathFromId ( $ed )`: use `(wdbFiles:getFullPath($ed))?projectPath` instead
+
+### 24Q2
+
+Release 24Q2 dropped functions `wdb:getEdPath( $ed as xs:string , $absolute as xs:boolean() )`,
+`wdb:getEdPath( $ed as xs:string )`, and `wdb:findProjectXQM( $project )`. These queries can be replaced by
+`(wdbFiles:getFullPath($id))` which returns a map with `projectPath` (the path to the project, i.e. the collection where
+`wdbmeta.xml`¹ is stored), `collectionPath` (for the subcollection where a file is actually located), `mainProject` for
+the path to the project containing `project.xqm`, and `fileName`.
+1) (24Q4): this corrects a typo as previous versions incorrectly read `project.xqm`.
+
+### 24Q1
+
Release 24Q1 dropped support for METS-based projects. As METS files can have a number of very different ways of encoding
information, especially when it comes to behaviours, native support is hard to achieve. At the same time, most
installations use wdb+’s native wdbmeta system as this is what the admin functions work with.
@@ -64,9 +105,11 @@ into `/db/apps/edoc` and want to put your projects into `/db/apps/edoc/data/your
-
- /db/apps/edoc/resources/xsl/tei-transcript.xsl
-
+
+
+ /db/apps/edoc/resources/xsl/tei-transcript.xsl
+
+
@@ -96,5 +139,12 @@ See the Wiki for details!
* Akademie der Wissenschaften, Heidelberg
* Theologenbriefwechsel
* ULB Darmstadt
+ * TUEditions
+ * WDM
If you use wdbplus for your editions, please drop me a message so I can add you to this list.
+
+## Sponsoring
+
+Development of wdb+ is chiefly done in projects funded by DFG and the German BMBF.
+Additionally, we would like to say thank you to BrowserStack for giving us sponsored access!
diff --git a/build.xml b/build.xml
index d1a0ed34..40d61c3d 100644
--- a/build.xml
+++ b/build.xml
@@ -1,23 +1,25 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/edoc/admin/admin.xqm b/edoc/admin/admin.xqm
index 7f9aaa44..4c3e8538 100644
--- a/edoc/admin/admin.xqm
+++ b/edoc/admin/admin.xqm
@@ -2,46 +2,26 @@ xquery version "3.1";
module namespace wdbAdmin = "https://github.com/dariok/wdbplus/Admin";
-import module namespace console = "http://exist-db.org/xquery/console" at "java:org.exist.console.xquery.ConsoleModule";
-import module namespace templates = "http://exist-db.org/xquery/html-templating";
-import module namespace wdb = "https://github.com/dariok/wdbplus/wdb" at "/db/apps/edoc/modules/app.xqm";
-import module namespace wdbErr = "https://github.com/dariok/wdbplus/errors" at "/db/apps/edoc/modules/error.xqm";
+import module namespace config = "https://github.com/dariok/wdbplus/config" at "../modules/wdb-config.xqm";
+import module namespace wdbErr = "https://github.com/dariok/wdbplus/errors" at "../modules/error.xqm";
+import module namespace wdbFiles = "https://github.com/dariok/wdbplus/files" at "../modules/wdb-files.xqm";
+import module namespace wdbm = "https://github.com/dariok/wdbplus/model" at "../modules/model.xqm";
-declare namespace meta = "https://github.com/dariok/wdbplus/wdbmeta";
-declare namespace sm = "http://exist-db.org/xquery/securitymanager";
+declare namespace meta = "https://github.com/dariok/wdbplus/wdbmeta";
+declare namespace sm = "http://exist-db.org/xquery/securitymanager";
+declare namespace templates = "http://exist-db.org/xquery/html-templating";
+declare namespace wdb = "https://github.com/dariok/wdbplus/wdb";
(:~
- : populate the model for functions pages (similar but not identical to wdb:populateModel)
+ : populate the model for admin pages
:
: @param $ed The ID of a _project_
: @return The model
:)
declare
- %templates:default("ed", "")
-function wdbAdmin:start ( $node as node(), $model as map(*), $ed as xs:string ) {
- try {
- let $pathToEd := if ( $ed = "" )
- then $wdb:data
- else wdb:getEdPath($ed, true())
-
- (: The meta data are taken from wdbmeta.xml :)
- let $infoFileLoc := wdb:getMetaFile($pathToEd)
- , $title := normalize-space((doc($infoFileLoc)//meta:title)[1])
-
- return map {
- "ed": if ( $pathToEd = $wdb:data ) then "data" else $ed,
- "infoFileLoc": $infoFileLoc,
- "page": substring-after(request:get-uri(), "admin/"),
- "pathToEd": $pathToEd,
- "title": $title,
- "auth": sm:id()/sm:id
- }
- } catch * {
- util:log("error", "No collection found for project ID " || $ed),
- map {
- "ed": ""
- }
- }
+ %templates:default("ed", "data")
+function wdbAdmin:start ( $node as node(), $model as map(*), $ed as xs:string ) as item()* {
+ wdbm:populateModel((), $ed, "", "", "")
};
declare function wdbAdmin:getEd ( $node as node(), $model as map(*) ) as element(meta) {
@@ -89,10 +69,10 @@ declare function wdbAdmin:getAside ($node as node(), $model as map(*)) as elemen
};
declare function wdbAdmin:css ( $node as node(), $model as map(*) ) as element()* {
- if ( unparsed-text-available($wdb:data || "/resources/wdb.css") )
- then
+ if ( unparsed-text-available($config:data || "/resources/css/wdb.css") )
+ then
else (),
- if ( unparsed-text-available($wdb:data || "/resources/admin.css") )
- then
+ if ( unparsed-text-available($config:data || "/resources/css/admin.css") )
+ then
else ()
};
diff --git a/edoc/admin/global.xqm b/edoc/admin/global.xqm
index 1e759203..30a91cec 100644
--- a/edoc/admin/global.xqm
+++ b/edoc/admin/global.xqm
@@ -1,22 +1,19 @@
-xquery version "3.0";
+xquery version "3.1";
module namespace wdbGS = "https://github.com/dariok/wdbplus/GlobalSettings";
-import module namespace wdb = "https://github.com/dariok/wdbplus/wdb" at "../modules/app.xqm";
-import module namespace console = "http://exist-db.org/xquery/console";
+import module namespace config = "https://github.com/dariok/wdbplus/config" at "../modules/wdb-config.xqm";
-declare namespace config = "https://github.com/dariok/wdbplus/config";
declare namespace exgit = "http://exist-db.org/xquery/exgit";
declare namespace meta = "https://github.com/dariok/wdbplus/wdbmeta";
declare namespace system = "http://exist-db.org/xquery/system";
-declare function wdbGS:getRest ( $node as node(), $model as map(*) ) {
-
+declare function wdbGS:getRest ( $node as node(), $model as map(*) ) as element(meta) {
+
};
declare function wdbGS:body ( $node as node(), $model as map(*) ) {
let $param := request:get-parameter('job', 'main')
- let $metaFile := doc('../config.xml')
return switch ( $param )
case 'main' return
@@ -32,24 +29,24 @@ declare function wdbGS:body ( $node as node(), $model as map(*) ) {
case 'title' return
- local:titleForm($metaFile)
+ local:titleForm($config:configFile)
case 'chgTitle' return
- let $u1 := update replace $metaFile//config:meta/config:name
+ let $u1 := update replace $config:configFile//config:meta/config:name
with {request:get-parameter('longTitle', '')}
- let $u1 := update replace $metaFile//config:meta/config:short
+ let $u1 := update replace $config:configFile//config:meta/config:short
with {request:get-parameter('shortTitle', '')}
- return local:titleForm($metaFile)
+ return local:titleForm($config:configFile)
case 'role' return
- local:roleForm($metaFile)
+ local:roleForm($config:configFile)
case 'chgRole' return
- let $u1 := update replace $metaFile//config:role/config:type
+ let $u1 := update replace $config:configFile//config:role/config:type
with {request:get-parameter('role', '')}
- let $u1 := update replace $metaFile//config:role/config:other
+ let $u1 := update replace $config:configFile//config:role/config:other
with {request:get-parameter('other', '')}
- return local:roleForm($metaFile)
+ return local:roleForm($config:configFile)
default return
@@ -58,23 +55,23 @@ declare function wdbGS:body ( $node as node(), $model as map(*) ) {
};
-declare function local:titleForm($metaFile) {
+declare function local:titleForm($config:configFile) {
Titeldaten verändern
};
-declare function local:roleForm($metaFile) {
- let $role := $metaFile//config:role/config:type
- let $other := $metaFile//config:role/config:other
+declare function local:roleForm($config:configFile) {
+ let $role := $config:configFile//config:role/config:type
+ let $other := $config:configFile//config:role/config:other
return
@@ -85,7 +82,7 @@ declare function local:roleForm($metaFile) {
@@ -95,5 +92,5 @@ declare function local:roleForm($metaFile) {
};
declare function wdbGS:ingest($node as node(), $model as map(*)) {
- bestehendes Projekt hochladen
-};
\ No newline at end of file
+ bestehendes Projekt hochladen
+};
diff --git a/edoc/admin/modelFunctions.xql b/edoc/admin/modelFunctions.xql
index a7cd83b4..75d05bd2 100644
--- a/edoc/admin/modelFunctions.xql
+++ b/edoc/admin/modelFunctions.xql
@@ -2,6 +2,9 @@ xquery version "3.1";
module namespace trigger="http://exist-db.org/xquery/trigger";
+declare namespace meta = "https://github.com/dariok/wdbplus/wdbmeta";
+declare namespace index = "https://github.com/dariok/wdbplus/index";
+
declare function trigger:after-update-document ( $uri as xs:anyURI ) as xs:string {
if ( ends-with($uri, 'instance.xqm') or ends-with($uri, 'project.xqm') ) then
let $projectPath := if ( ends-with($uri, 'instance.xqm') )
@@ -12,5 +15,59 @@ declare function trigger:after-update-document ( $uri as xs:anyURI ) as xs:strin
else 'project-functions.xml'
return xmldb:store($projectPath, $statFileName, inspect:inspect-module($uri))
+ else if ( ends-with($uri, 'wdbmeta.xml') ) then
+ let $meta := doc($uri)
+ , $projectId := $meta/meta:projectMD/@xml:id
+ , $files := $meta//meta:file
+ , $title := $meta//meta:title[@type='main']
+ , $projectIndex := doc("/db/apps/edoc/index/project-index.xml")
+ , $fileIndex := doc("/db/apps/edoc/index/file-index.xml")
+ , $projectEntry :=
+
+ (: enter or update project :)
+ let $insertProject := if ( exists($projectIndex/id($projectId)) )
+ then update replace $projectIndex/id($projectId) with $projectEntry
+ else update insert $projectEntry into $projectIndex/index:index
+
+ (: enter or update files entries :)
+ let $entries := for $file in $files
+ let $id := $file/@xml:id
+ , $entry :=
+
+ return if ( exists($fileIndex/id($id)) )
+ then update replace $fileIndex/id($id) with $entry
+ else update insert $entry into $fileIndex/index:index
+
+ (: enter or update subcorpora :)
+ let $subcorpora := for $subcorpus in $meta//meta:struct[@xml:id]
+ let $id := $subcorpus/@xml:id
+ , $entry :=
+
+ return if ( exists($fileIndex/id($id)) )
+ then update replace $fileIndex/id($id) with $entry
+ else update insert $entry into $fileIndex/index:index
+
+ return $uri
+ (: else if ( ends-with($uri, '.xml') ) then
+ let $id := doc($uri)/*/@xml:id
+ , $present := doc("/db/apps/edoc/index/file-index.xml")/id($id)
+ , $entry :=
+ , $insert := if ( $present )
+ then update replace $present with $entry
+ else update insert $entry into doc("/db/apps/edoc/index/file-index.xml")/*
+ return $uri :)
else ""
};
diff --git a/edoc/admin/new.xqm b/edoc/admin/new.xqm
index 540770d6..99b27f7b 100644
--- a/edoc/admin/new.xqm
+++ b/edoc/admin/new.xqm
@@ -1,108 +1,48 @@
-xquery version "3.0";
+xquery version "3.1";
module namespace wdbPN = "https://github.com/dariok/wdbplus/ProjectNew";
-import module namespace wdb = "https://github.com/dariok/wdbplus/wdb" at "/db/apps/edoc/modules/app.xqm";
-import module namespace wdbRc = "https://github.com/dariok/wdbplus/RestCollections" at "/db/apps/edoc/rest/rest-coll.xql";
-import module namespace sm = "http://exist-db.org/xquery/securitymanager";
+import module namespace sm = "http://exist-db.org/xquery/securitymanager";
-declare namespace config = "https://github.com/dariok/wdbplus/config";
-declare namespace http = "http://expath.org/ns/http-client";
-declare namespace map = "http://www.w3.org/2005/xpath-functions/map";
-declare namespace meta = "https://github.com/dariok/wdbplus/wdbmeta";
-declare namespace tei = "http://www.tei-c.org/ns/1.0";
+declare namespace http = "http://expath.org/ns/http-client";
+declare namespace map = "http://www.w3.org/2005/xpath-functions/map";
+declare namespace meta = "https://github.com/dariok/wdbplus/wdbmeta";
+declare namespace tei = "http://www.tei-c.org/ns/1.0";
declare function wdbPN:body ( $node as node(), $model as map(*), $pName as xs:string*, $pShort as xs:string*,
- $pID as xs:string*, $pColl as xs:string*, $pDate as xs:string*, $pDesc as xs:string*, $pLic as xs:string* ) {
- let $user := sm:id()
-
- return if (not($user//sm:group = 'dba'))
+ $pID as xs:string*, $collection as xs:string* )
+ (:), $pDate as xs:string*, $pDesc as xs:string*, $pLic as xs:string*, $data as xs:string* ) to be implemented later when a UI for project MD exists :)
+ as element() {
+ if ( not(sm:id()//sm:group = 'dba') )
then
Diese Seite ist nur für Administratoren zugänglich!
- else if (0 = (string-length($pName), string-length($pID), string-length($pColl)))
+ else if (0 = (string-length($pName), string-length($pID), string-length($collection)))
then
-
else
- let $collectionData :=
-
- {$pName}
- {$pID}
- {$pColl}
-
-
- let $targetCollection := if ( $model?ed eq '' ) then 'data' else $model?ed
- , $create := wdbRc:createSubcollectionXml ($collectionData, $targetCollection)
-
- return if ( ($create)[1]//http:response/@status = '201')
- then
- let $collection-uri := $create[2]
- let $textCollection := xmldb:create-collection($collection-uri, "texts")
- let $resourcesCollection := xmldb:create-collection($collection-uri, "resources")
- let $metaFile := $collection-uri || "/wdbmeta.xml"
-
- let $copy := if (system:function-available(xs:QName("xmldb:copy-collection"), 2))
- then util:eval("xmldb:copy-collection($source, $destination)", false(), (
- xs:QName("source"), $wdb:edocBaseDB || "/resources/xsl",
- xs:QName("destination"), $collection-uri
- ))
- else util:eval("xmldb:copy($source, $destination)", false(), (
- xs:QName("source"), $wdb:edocBaseDB || "/resources/xsl",
- xs:QName("destination"), $collection-uri
- ))
-
- let $chmod := (
- sm:chmod(xs:anyURI($collection-uri), 'rwxrwxr-x'),
- sm:chmod(xs:anyURI($textCollection), 'rwxrwxr-x'),
- sm:chmod(xs:anyURI($resourcesCollection), 'rwxrwxr-x'),
- sm:chmod(xs:anyURI($metaFile), 'rw-rw-r--'),
- sm:chmod(xs:anyURI($collection-uri || "/xsl"), "rwxrwxr-x"),
- sm:chown(xs:anyURI($collection-uri), "wdb:wdbusers"),
- sm:chown(xs:anyURI($textCollection), "wdb:wdbusers"),
- sm:chown(xs:anyURI($resourcesCollection), "wdb:wdbusers"),
- sm:chown(xs:anyURI($metaFile), "wdb:wdbusers"),
- sm:chown(xs:anyURI($collection-uri || "/xsl"), "wdb:wdbusers"),
- for $f in xmldb:get-child-resources($collection-uri || "/xsl")
- return (
- sm:chmod(xs:anyURI($collection-uri || "/xsl/" || $f), "rwxrwxr-x"),
- sm:chown(xs:anyURI($collection-uri || "/xsl/" || $f), "wdb:wdbusers")
- )
- )
-
- let $MD := doc($metaFile)
- let $addMD := (
- if ($pShort != "")
- then
- update insert {$pShort} into $MD//meta:titleData
- else (),
- if ($pDate != "")
- then
- update insert {$pDate} into $MD//meta:titleData
- else (),
- if ($pLic != "")
- then
- update insert {$pLic} into $MD//meta:legal
- else ()
- )
-
- return
-
)
@@ -228,8 +226,8 @@ declare function local:getFileStat($model, $file) {
{
- if ($wdb:role = 'workbench') then
- let $remoteMetaFilePath := $wdb:peer || '/' || substring-after($model?pathToEd, $wdb:data) || '/wdbmeta.xml'
+ (: if ( $config:role = 'workbench' ) then
+ let $remoteMetaFilePath := $config:peer || '/' || substring-after($model?pathToEd, $config:data) || '/wdbmeta.xml'
let $remoteMetaFile := try {
doc($remoteMetaFilePath)
} catch * {
@@ -238,7 +236,7 @@ declare function local:getFileStat($model, $file) {
c: ' || $err:value || ' in ' || $err:module || '
a: ' || $err:additional)
}
- let $remoteEntry := $remoteMetaFile//meta:file[@xml:id = $file]
+ let $remoteEntry := $remoteMetaFile//meta:file[@xml:id = $id]
return (
Peer Info
,
@@ -246,7 +244,7 @@ declare function local:getFileStat($model, $file) {
Peer Server
-
{$wdb:peer}
+
{ $config:peer }
Eintrag in wdbmeta.xml vorhanden?
@@ -273,8 +271,8 @@ declare function local:getFileStat($model, $file) {
,
@xml:id in wdbMeta
- {if ($remoteEntry/@xml:id = $file)
- then
OK: {$file}
+ {if ($remoteEntry/@xml:id = $id)
+ then
OK: { $id }
else
Diff: {normalize-space($remoteEntry/@xml:id)}
}
@@ -284,13 +282,13 @@ declare function local:getFileStat($model, $file) {
)
- else ()
+ else () :)
}
{
- if ($wdb:role = 'standalone') then
- let $status := if ($metaFile//meta:view[@file = $file])
+ if ( $config:role = 'standalone' ) then
+ let $status := if ($metaFile//meta:view[@file = $id])
then
- let $view := ($metaFile//meta:view[@file = $file])[1]
+ let $view := ($metaFile//meta:view[@file = $id])[1]
return if ($view/@private = true())
then 'intern'
else 'sichtbar'
@@ -305,7 +303,7 @@ declare function local:getFileStat($model, $file) {
if ($status = 'Kein Struktureintrag') then
$status
else
- let $link := umschalten
+ let $link := umschalten
return ($status, , $link)
}
@@ -316,4 +314,4 @@ declare function local:getFileStat($model, $file) {
}
-};
\ No newline at end of file
+};
diff --git a/edoc/admin/transform-test.xql b/edoc/admin/transform-test.xql
deleted file mode 100644
index 9bbecb62..00000000
--- a/edoc/admin/transform-test.xql
+++ /dev/null
@@ -1,40 +0,0 @@
-xquery version "3.1";
-
-import module namespace wdb = "https://github.com/dariok/wdbplus/wdb" at "modules/app.xql";
-
-let $id := "edoc_wd_1703-08-20"
-
-let $model := wdb:populateModel($id, "", map{})
-
- let $file := $model("fileLoc")
- let $xslt := $model("xslt")
- let $params :=
-
-
-
-
-
- {
- if ($model("view") != '')
- then
- else ()
- }
-
- (: ambiguous rule match soll nicht zum Abbruch führen :)
- let $attr :=
-
- let $re :=
- try { transform:transform(doc($file), doc($xslt), $params, $attr, "expand-xincludes=no") }
- catch * {
-
- {$file}
- {$xslt}
- {$params}
- {$attr}
- {$err:code || ': ' || $err:description}
- {$err:module || '@' || $err:line-number ||':'||$err:column-number}
- {$err:additional}
-
- }
-
-return ($model, $re)
\ No newline at end of file
diff --git a/edoc/admin/view.xql b/edoc/admin/view.xql
index 211c57b4..09eedc4b 100644
--- a/edoc/admin/view.xql
+++ b/edoc/admin/view.xql
@@ -7,7 +7,6 @@ xquery version "3.1";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
-import module namespace config = "http://exist-db.org/xquery/apps/config" at "../modules/config.xqm";
import module namespace templates = "http://exist-db.org/xquery/html-templating";
import module namespace wdb = "https://github.com/dariok/wdbplus/wdb" at "../modules/app.xqm";
import module namespace wdbAdmin = "https://github.com/dariok/wdbplus/Admin" at "admin.xqm";
@@ -24,8 +23,9 @@ declare option output:media-type "text/html";
: The following modules provide functions which will be called by the
: templating.
:)
+let $app-root := "/db/" || substring-after(system:get-module-load-path(), "/db/") => substring-before("admin")
let $config := map {
- $templates:CONFIG_APP_ROOT: $config:app-root,
+ $templates:CONFIG_APP_ROOT: $app-root,
$templates:CONFIG_STOP_ON_ERROR: true()
}
diff --git a/edoc/apiv2.html b/edoc/apiv2.html
new file mode 100644
index 00000000..c25addc1
--- /dev/null
+++ b/edoc/apiv2.html
@@ -0,0 +1,34 @@
+
+
+
+ wdb+ - OpenAPI
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/edoc/config/edoc/data/collection.xconf b/edoc/config/edoc/data/collection.xconf
index 503ecb9a..0a993258 100644
--- a/edoc/config/edoc/data/collection.xconf
+++ b/edoc/config/edoc/data/collection.xconf
@@ -10,7 +10,6 @@
-
@@ -18,6 +17,7 @@
+
@@ -41,10 +41,7 @@
-
-
-
-
+
@@ -77,6 +74,8 @@
+
+
diff --git a/edoc/config/edoc/data/documentation/collection.xconf b/edoc/config/edoc/data/documentation/collection.xconf
new file mode 100644
index 00000000..56fb2470
--- /dev/null
+++ b/edoc/config/edoc/data/documentation/collection.xconf
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/edoc/controller.xql b/edoc/controller.xql
index f39f39e8..25332ccb 100644
--- a/edoc/controller.xql
+++ b/edoc/controller.xql
@@ -5,11 +5,10 @@
:)
xquery version "3.1";
-import module namespace config = "http://exist-db.org/xquery/apps/config" at "/db/apps/eXide/modules/config.xqm";
import module namespace login = "http://exist-db.org/xquery/login" at "resource:org/exist/xquery/modules/persistentlogin/login.xql";
import module namespace request = "http://exist-db.org/xquery/request" at "java:org.exist.xquery.functions.request.RequestModule";
-import module namespace sm = "http://exist-db.org/xquery/securitymanager" at "java:org.exist.xquery.functions.securitymanager.SecurityManagerModule";
-import module namespace wdba = "https://github.com/dariok/wdbplus/auth" at "/db/apps/edoc/modules/auth.xqm";
+(: import module namespace sm = "http://exist-db.org/xquery/securitymanager" at "java:org.exist.xquery.functions.securitymanager.SecurityManagerModule";:)
+import module namespace wdba = "https://github.com/dariok/wdbplus/auth" at "modules/auth.xqm";
declare namespace exist = "http://exist.sourceforge.net/NS/exist";
@@ -17,57 +16,47 @@ declare variable $exist:path external;
declare variable $exist:resource external;
declare variable $exist:controller external;
declare variable $exist:prefix external;
-declare variable $exist:root external;
+(: declare variable $exist:root external; :)
-(: von eXide geklaut :)
-declare function local:user-allowed() {
- (
- request:get-attribute("wd.user") and
- request:get-attribute("wd.user") != "guest"
- ) or config:get-configuration()/restrictions/@guest = "yes"
-};
-declare function local:query-execution-allowed() {
- (
- config:get-configuration()/restrictions/@execute-query = "yes"
- and local:user-allowed()
- )
- or sm:is-dba((request:get-attribute("wd.user"),request:get-attribute("xquery.user"), 'nobody')[1])
-};
+declare variable $local:isget := request:get-method() = ("GET","get");
-let $cookiePath := substring-before(request:get-uri(), $exist:path)
- , $duration := xs:dayTimeDuration("P2D")
+util:log("info", "request:get-method(): " || request:get-method()),
+util:log("info", "exist:path: " || $exist:path),
-return
-if ( $exist:resource eq '' or $exist:resource eq 'index.html' ) then
-
-
-
+(: static HTML page for API documentation should be served directly to make sure it is always accessible :)
+if (
+ ( $local:isget and $exist:path eq "/apiv2.html" ) or
+ ( $local:isget and matches($exist:path, "^/[^/]+\.json$", "s") )
+) then
+
(: login :)
else if ( $exist:resource = 'login' ) then
- (
- login:set-user("wd", $cookiePath, $duration, false()),
- try {
- if (request:get-parameter('logout', '') = 'logout') then
- wdba:getAuth( , map {'res': 'logout'})
- else if (local:user-allowed()) then
- wdba:getAuth( , map {'auth': {request:get-attribute("wd.user")}})
- else (
- response:set-status-code(401),
- fail
- )
- } catch * {
- response:set-status-code(403),
- {$err:description}
- }
- )
+
+
+
+(: logout :)
+else if ( $exist:resource = 'logout' ) then
+
+
+
+
+
+(: REST API :)
+else if ( contains($exist:path, 'api/v2') ) then
+
+
+
+else if ( $exist:resource eq '' or $exist:resource eq 'index.html' ) then
+
+
+
(: admin pages :)
else if ( ends-with($exist:resource, ".html") and contains($exist:path, '/admin/') ) then
- { login:set-user("wd", $cookiePath, $duration, false()) }
+ { login:set-user("wd", substring-before(request:get-uri(), $exist:path), xs:dayTimeDuration("P2D"), false()) }
- { login:set-user("wd", $cookiePath, $duration, false()) }
@@ -80,13 +69,8 @@ else if ( ends-with($exist:resource, ".html") ) then
- { login:set-user("wd", $cookiePath, $duration, false()) }
-
-
-
-
else if ( contains($exist:path, "/$shared/") ) then
@@ -96,7 +80,6 @@ else if ( contains($exist:path, "/$shared/") ) then
else if ( ends-with($exist:path, ".xql") ) then
- { login:set-user("wd", $cookiePath, $duration, false()) }
diff --git a/edoc/data/documentation/project.xqm b/edoc/data/documentation/project.xqm
new file mode 100644
index 00000000..4b869cb3
--- /dev/null
+++ b/edoc/data/documentation/project.xqm
@@ -0,0 +1,5 @@
+xquery version "3.1";
+
+module namespace wdbPF = "https://github.com/dariok/wdbplus/projectFiles";
+
+declare namespace tei = "http://www.tei-c.org/ns/1.0";
\ No newline at end of file
diff --git a/edoc/data/documentation/resources/xsl/tei-common.xsl b/edoc/data/documentation/resources/xsl/tei-common.xsl
new file mode 100644
index 00000000..c2ae9bdb
--- /dev/null
+++ b/edoc/data/documentation/resources/xsl/tei-common.xsl
@@ -0,0 +1,7 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/edoc/data/documentation/resources/xsl/tei-transcript.xsl b/edoc/data/documentation/resources/xsl/tei-transcript.xsl
new file mode 100644
index 00000000..3c7883c4
--- /dev/null
+++ b/edoc/data/documentation/resources/xsl/tei-transcript.xsl
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/edoc/data/documentation/wdbmeta.xml b/edoc/data/documentation/wdbmeta.xml
new file mode 100644
index 00000000..e3f88a27
--- /dev/null
+++ b/edoc/data/documentation/wdbmeta.xml
@@ -0,0 +1,47 @@
+
+
+
+
+ wdb+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ docu
+
+
+
+
+
+ full text of transcribed sources
+
+
+
+
+
+
+ (no licence stated)
+
+
+
+
+
+ resources/xsl/tei-transcript.xsl
+
+
+
+
+
+
\ No newline at end of file
diff --git a/edoc/data/resources/blobs/.gitkeep b/edoc/data/resources/blobs/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/edoc/data/resources/css/.gitkeep b/edoc/data/resources/css/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/edoc/data/resources/html/.gitkeep b/edoc/data/resources/html/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/edoc/data/resources/images/.gitkeep b/edoc/data/resources/images/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/edoc/data/resources/js/.gitkeep b/edoc/data/resources/js/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/edoc/data/resources/xq/.gitkeep b/edoc/data/resources/xq/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/edoc/data/resources/xsl/tei-common.xsl b/edoc/data/resources/xsl/tei-common.xsl
new file mode 100644
index 00000000..c2ae9bdb
--- /dev/null
+++ b/edoc/data/resources/xsl/tei-common.xsl
@@ -0,0 +1,7 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/edoc/data/resources/xsl/tei-transcript.xsl b/edoc/data/resources/xsl/tei-transcript.xsl
new file mode 100644
index 00000000..3c7883c4
--- /dev/null
+++ b/edoc/data/resources/xsl/tei-transcript.xsl
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/edoc/data/wdbmeta.xml b/edoc/data/wdbmeta.xml
index e6f1825c..ca2cd1d0 100644
--- a/edoc/data/wdbmeta.xml
+++ b/edoc/data/wdbmeta.xml
@@ -2,7 +2,7 @@
-
+ wdb+ main project collection
@@ -22,8 +22,10 @@
-
-
-
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/edoc/doc/Dokumentation.xml b/edoc/doc/Dokumentation.xml
index 7a34a861..e073932a 100644
--- a/edoc/doc/Dokumentation.xml
+++ b/edoc/doc/Dokumentation.xml
@@ -61,7 +61,7 @@
Where to find the function
the files can be found in /edoc/modules/start.xqm
- /edoc/resources/start.xsl
+ /edoc/resources/xsl/start.xsl
The start.xqm
@@ -79,7 +79,7 @@
If you want to change it on a project-level: link to
- project/resource/startLeft.html and startRight.html; if you want to change it
+ {$project}/resource/html/startLeft.html and {$project}/resource/html/startRight.html; if you want to change it
globally, you can override the default behaviour by changing
edoc/data/instance.xqm
diff --git a/edoc/doc/outline-view.html b/edoc/doc/outline-view.html
index a4447d58..af600f75 100644
--- a/edoc/doc/outline-view.html
+++ b/edoc/doc/outline-view.html
@@ -40,7 +40,7 @@