diff --git a/add/data/xql/checkTextGridLogin.xql b/add/data/xql/checkTextGridLogin.xql deleted file mode 100644 index 3352e9da..00000000 --- a/add/data/xql/checkTextGridLogin.xql +++ /dev/null @@ -1,22 +0,0 @@ -xquery version "3.1"; - -(: - : Copyright: For LICENSE-Details please refer to the LICENSE file in the root directory of this repository. - :) - -(: IMPORTS ================================================================= :) - -import module namespace httpclient = "http://exist-db.org/xquery/httpclient"; - -(: NAMESPACE DECLARATIONS ================================================== :) - -declare namespace html = "http://www.w3.org/1999/xhtml"; - -(: QUERY BODY ============================================================== :) - -let $sessionId := request:get-parameter('sessionId', '') -let $test := httpclient:head(xs:anyURI('http://textgridlab.org/1.0/tgcrud/rest/textgrid:208dw/data?sessionId=' || $sessionId), false(), ()) -let $status := $test/root()/httpclient:response/string(@statusCode) -let $status := response:set-status-code(xs:int($status)) -return - $status diff --git a/add/data/xql/getAnnotationParticipants.xql b/add/data/xql/getAnnotationParticipants.xql deleted file mode 100644 index c67f7c35..00000000 --- a/add/data/xql/getAnnotationParticipants.xql +++ /dev/null @@ -1,42 +0,0 @@ -xquery version "3.1"; - -(: - : Copyright: For LICENSE-Details please refer to the LICENSE file in the root directory of this repository. - :) - -(:~ - Returns a list of participants of a specific annotation. - - @author Daniel Röwenstrunk -:) - -(: NAMESPACE DECLARATIONS ================================================== :) - -declare namespace request = "http://exist-db.org/xquery/request"; -declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; - -(: OPTION DECLARATIONS ===================================================== :) - -declare option output:method "text"; -declare option output:media-type "text/html"; - -let $uri := request:get-parameter('uri', '') -let $docUri := substring-before($uri, '#') -let $internalId := substring-after($uri, '#') -let $doc := doc($docUri) -let $annot := $doc/id($internalId) -let $participants := $annot/string(@plist) - -let $map := map { - 'success': true(), - 'participants': $participants -} - -let $options := -map { - 'method': 'json', - 'media-type': 'text/plain' -} - -return - serialize($map, $options) diff --git a/add/data/xql/getAnnotationsInRendering.xql b/add/data/xql/getAnnotationsInRendering.xql deleted file mode 100644 index 24e38c3c..00000000 --- a/add/data/xql/getAnnotationsInRendering.xql +++ /dev/null @@ -1,68 +0,0 @@ -xquery version "3.1"; -(: - : For LICENSE-Details please refer to the LICENSE file in the root directory of this repository. - :) - -(:~ - Returns a JSON sequence with all anotations on a specific page. - - @author Daniel Röwenstrunk -:) - -(: IMPORTS ================================================================= :) - -import module namespace functx = "http://www.functx.com"; -import module namespace eutil = "http://www.edirom.de/xquery/util" at "../xqm/util.xqm"; - -(: NAMESPACE DECLARATIONS ================================================== :) - -declare namespace mei = "http://www.music-encoding.org/ns/mei"; -declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; -declare namespace xlink = "http://www.w3.org/1999/xlink"; -declare namespace request = "http://exist-db.org/xquery/request"; - -(: OPTION DECLARATIONS ===================================================== :) - -declare option output:media-type "text/plain"; -declare option output:method "text"; - -declare function local:getAnnotations($edition as xs:string, $edition_path as xs:string, $uri as xs:string, $elemIds as xs:string*) as xs:string* { - - for $measureId in $elemIds - let $uriPlusId := concat($uri, '#', $measureId) - (: TODO update XPath e.g., parent::node() at the end or similar :) - let $annots := collection($edition_path)//mei:annot/@plist[tokenize(string(.), '\s+') = $uriPlusId]/.. - - return - for $annotation in $annots - let $id := $annotation/string(@xml:id) - let $uri := concat('xmldb:exist://', document-uri($annotation/root()), '#', $id) - let $prio := $annotation/mei:ptr[@type = "priority"]/replace(@target, '#', '') - let $cat := $annotation/mei:ptr[@type = "categories"]/replace(@target, '#', '') - - return (:TODO map instead of concat :) - concat(' - {', - '"id": "', $id, '", ', - '"measureId": "', $measureId, '", ', - '"fn": "loadLink(\"', $uri, '\")", ', - '"uri": "', $uri, '", ', - '"priority": "', $prio, '", ', - '"categories": "', $cat, '"', - '}' - ) -}; - - -let $edition := request:get-parameter('edition', '') -let $uri := request:get-parameter('uri', '') -let $measureIds := request:get-parameter('measureIds', '') -let $edition_path := eutil:getPreference('edition_path', $edition) -let $annots := local:getAnnotations($edition, $edition_path, $uri, tokenize($measureIds, ',')) - -return - concat( - '[', - string-join($annots, ','), - ']' - ) diff --git a/add/data/xql/loginToTextGrid.xql b/add/data/xql/loginToTextGrid.xql deleted file mode 100644 index 2f388a10..00000000 --- a/add/data/xql/loginToTextGrid.xql +++ /dev/null @@ -1,30 +0,0 @@ -xquery version "3.1"; -(: - : For LICENSE-Details please refer to the LICENSE file in the root directory of this repository. - :) - -(: NAMESPACE DECLARATIONS ================================================== :) - -declare namespace html = "http://www.w3.org/1999/xhtml"; - -(: QUERY BODY ============================================================== :) - -let $loginname := request:get-parameter('loginname', '') -let $password := request:get-parameter('password', '') -let $authZinstance := request:get-parameter('authZinstance', 'textgrid-ws3.sub.uni-goettingen.de') - -let $login := httpclient:get(xs:anyURI('https://textgridlab.org/1.0/WebAuthN/TextGrid-WebAuth.php?authZinstance=' || $authZinstance || '&loginname=' || $loginname || '&password=' || $password), -false(), ()) - -return - if ($login//html:meta[@name = 'remote_principal']) then ( - let $userName := $login//html:meta[@name = 'remote_principal']/string(@content) - let $sessionId := $login//html:meta[@name = 'rbac_sessionid']/string(@content) - let $cookie := response:set-cookie('edirom_online_textgrid_username', $userName, (), false(), '.freischuetz-digital.de', '/') - let $cookie := response:set-cookie('edirom_online_textgrid_sessionId', $sessionId, (), false(), '.freischuetz-digital.de', '/') - return - '{success: true, msg: "Login successful", user: "' || $userName || '"}' - - ) else ( - '{success: false, msg: "Login failed"}' - )