diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c542e3508..1ad948b70 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -9,7 +9,7 @@ Refs # ## Types of changes - + - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to change) diff --git a/add/data/xqm/util.xqm b/add/data/xqm/util.xqm index 49e466099..8e6e6fef4 100644 --- a/add/data/xqm/util.xqm +++ b/add/data/xqm/util.xqm @@ -129,23 +129,19 @@ declare function eutil:getLocalizedTitle($node as node(), $lang as xs:string?) a ('[No title found!]') }; + (:~ : Returns a document : : @param $uri The URIs of the documents to process : @return The document :) -declare function eutil:getDoc($uri) { - - if(starts-with($uri, 'textgrid:')) then( - let $session := request:get-cookie-value('edirom_online_textgrid_sessionId') - return - doc('http://textgridlab.org/1.0/tgcrud/rest/' || $uri || '/data?sessionId=' || $session) - - ) else ( - doc($uri) - ) - +declare function eutil:getDoc($uri as xs:string?) as document-node()? { + if(empty($uri) or ($uri eq "")) + then util:log("warn", "No document URI provided") + else if(doc-available($uri)) + then doc($uri) + else util:log("warn", "Unable to load document at " || $uri) }; (:~ @@ -268,7 +264,7 @@ declare function eutil:getLanguageString($key as xs:string, $values as xs:string declare function eutil:getLanguageString($key as xs:string, $values as xs:string*, $lang as xs:string) as xs:string { let $base := system:get-module-load-path() - let $file := doc(concat($base, '/../locale/edirom-lang-', $lang, '.xml')) + let $file := eutil:getDoc(concat($base, '/../locale/edirom-lang-', $lang, '.xml')) let $string := $file//entry[@key = $key]/string(@value) let $string := functx:replace-multi($string, for $i in (0 to (count($values) - 1)) return concat('\{',$i,'\}'), $values) diff --git a/app/controller/LinkController.js b/app/controller/LinkController.js index 794818d98..89bd15874 100644 --- a/app/controller/LinkController.js +++ b/app/controller/LinkController.js @@ -76,7 +76,7 @@ Ext.define('EdiromOnline.controller.LinkController', { }else if(singleUri.match(/^edirom:\/\//)) { this.parseEdiromLink(singleUri); - }else if(singleUri.match(/^xmldb:exist:\/\//) || singleUri.match(/^textgrid:/)) { + }else if(singleUri.match(/^xmldb:exist:\/\//)) { if(config['useExisting']) { var win = existingWindows.findBy(function(win) { diff --git a/build.xml b/build.xml index 16eb84b61..b3941eb43 100755 --- a/build.xml +++ b/build.xml @@ -4,7 +4,7 @@ - + diff --git a/testing/XQSuite/eutil-tests.xqm b/testing/XQSuite/eutil-tests.xqm index ec944e5a4..45ea161f7 100644 --- a/testing/XQSuite/eutil-tests.xqm +++ b/testing/XQSuite/eutil-tests.xqm @@ -38,3 +38,14 @@ declare function eut:test-getLocalizedTitle($node as element(), $lang as xs:string?) as xs:string { eutil:getLocalizedTitle($node, $lang) }; + +declare + %test:arg("uri") %test:assertEmpty + %test:arg("uri", "") %test:assertEmpty + %test:args("foo") %test:assertEmpty + %test:args("https://edirom.de") %test:assertXPath("/html") + %test:args("xmldb:exist://db/apps/Edirom-Online/data/locale/edirom-lang-de.xml") %test:assertXPath("/langFile") + %test:args("/db/apps/Edirom-Online/data/locale/edirom-lang-de.xml") %test:assertXPath("/langFile") + function eut:test-getDoc($uri as xs:string?) as document-node()? { + eutil:getDoc($uri) +};