diff --git a/add/data/xql/getRendering.xql b/add/data/xql/getRendering.xql deleted file mode 100644 index 2f2ab4c7e..000000000 --- a/add/data/xql/getRendering.xql +++ /dev/null @@ -1,73 +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 mei = "http://www.music-encoding.org/ns/mei"; -declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; -declare namespace request = "http://exist-db.org/xquery/request"; -declare namespace system = "http://exist-db.org/xquery/system"; -declare namespace transform = "http://exist-db.org/xquery/transform"; -declare namespace xmldb = "http://exist-db.org/xquery/xmldb"; - -(: OPTION DECLARATIONS ===================================================== :) - -declare option output:media-type "text/html"; -declare option output:method "xhtml"; -declare option output:indent "yes"; -declare option output:omit-xml-declaration "yes"; - -(: QUERY BODY ============================================================== :) - -let $uri := request:get-parameter('uri', '') -let $movementId := request:get-parameter('movementId', '') -let $stripStaves := request:get-parameter('stripStaves', '') -let $showStaff := request:get-parameter('showStaff', '') -let $firstMeasure := request:get-parameter('firstMeasure', '') -let $lastMeasure := request:get-parameter('lastMeasure', '') - - -let $docUri := - if (contains($uri, '#')) then - (substring-before($uri, '#')) - else - ($uri) - -let $doc := doc($docUri) - -return - - let $base := concat('file:', system:get-module-load-path(), '/../xslt/svgRend3/') - (:let $base := concat('xmldb:exist:///','db/functions/svgRend/'):) - - let $mdiv2show := $movementId - let $outputStep := 'svg' - - let $svg := transform:transform($doc, concat($base, 'mei2svg.xsl'), - - - - - - - - - - ) - - (:let $svg := transform:transform($svg, concat($base, 'svgCleaner.xsl'),):) - - (:let $mdiv := transform:transform($doc, concat($base, 'reduceToMdiv.xsl'), ) - - let $addedIDs := transform:transform($mdiv, concat($base, 'preprocessor/add-ids.xsl'), ) - let $canonicalized := transform:transform($addedIDs, concat($base, 'preprocessor/canonicalize.xsl'), ) - let $addedDurs := transform:transform($canonicalized, concat($base, 'preprocessor/addDurations.xsl'), ) - let $synced := transform:transform($addedDurs, concat($base, 'preprocessor/addSynchronicity.xsl'), ) - let $musx := transform:transform($synced, concat($base, 'mei2musx/mei2musx.xsl'), ) - let $svg := transform:transform($musx, concat($base, 'musx2svg/musx2svg.xsl'), ):) - - - return - $svg diff --git a/add/data/xqm/util.xqm b/add/data/xqm/util.xqm index 8381b3710..a8fb2e7d9 100644 --- a/add/data/xqm/util.xqm +++ b/add/data/xqm/util.xqm @@ -91,7 +91,7 @@ declare function eutil:getLocalizedName($node, $lang) { if($node/edirom:names) then ($name) else - ($name => string-join(' ') => normalize-space()) + (eutil:joinAndNormalize($name)) }; @@ -107,26 +107,26 @@ declare function eutil:getLocalizedTitle($node as node(), $lang as xs:string?) a let $namespace := eutil:getNamespace($node) let $titleMEI := - if ($lang != '' and $lang = $node/mei:title/@xml:lang and not($node/mei:title/mei:titlePart)) then - ($node/mei:title[@xml:lang = $lang]//text() => string-join() => normalize-space()) - else if ($lang != '' and $lang = $node/mei:title/@xml:lang and $node/mei:title/mei:titlePart) then - ($node/mei:title[@xml:lang = $lang]/mei:titlePart[1]//text() => string-join() => normalize-space()) + if ($lang != '' and $lang = $node/mei:title[mei:titlePart]/@xml:lang) then + (eutil:joinAndNormalize($node/mei:title[@xml:lang = $lang]/mei:titlePart, '. ')) + else if ($lang != '' and $lang = $node/mei:title[not(mei:titlePart)]/@xml:lang) then + (eutil:joinAndNormalize($node/mei:title[@xml:lang = $lang])) else - (($node//mei:title)[1]//text() => string-join() => normalize-space()) + (eutil:joinAndNormalize(($node//mei:title)[1])) let $titleTEI := if ($lang != '' and $lang = $node/tei:title/@xml:lang) then - $node/tei:title[@xml:lang = $lang]/text() + eutil:joinAndNormalize($node/tei:title[@xml:lang = $lang]) else - $node/tei:title[1]/text() + eutil:joinAndNormalize($node/tei:title[1]) return - if ($namespace = 'mei') then + if ($namespace = 'mei' and $titleMEI != '') then ($titleMEI) - else if ($namespace = 'tei') then + else if ($namespace = 'tei' and $titleTEI != '') then ($titleTEI) else - ('unknown') + ('[No title found!]') }; (:~ @@ -240,7 +240,7 @@ declare function eutil:getPartLabel($measureOrPerfRes as node(), $type as xs:str upper-case($i) return - normalize-space(string-join(($label, $numbering),' ')) + eutil:joinAndNormalize(($label, $numbering)) }; @@ -398,3 +398,24 @@ declare function eutil:request-lang-preferred-iso639() as xs:string { "en" }; + +(:~ + : Returns one joined and normalized string + : + : @param $strings The string(s) to be processed + : @return The string (joined with whitespace and normalized space) + :) +declare function eutil:joinAndNormalize($strings as xs:string*) as xs:string { + $strings => string-join(' ') => normalize-space() +}; + +(:~ + : Returns one joined and normalized string + : + : @param $strings The string(s) to be processed + : @param $separator One ore more characters as separators for joining the string + : @return The string (joined and normalized space) + :) +declare function eutil:joinAndNormalize($strings as xs:string*, $separator as xs:string) as xs:string { + $strings => string-join($separator) => normalize-space() +}; \ No newline at end of file diff --git a/app/Application.js b/app/Application.js index f28a016e4..76fd97764 100644 --- a/app/Application.js +++ b/app/Application.js @@ -182,7 +182,9 @@ Ext.define('EdiromOnline.Application', { openStartDocuments: function() { var me = this; - var uris = me.getController('PreferenceController').getPreference('start_documents_uri'); - window.loadLink(uris); + var uris = me.getController('PreferenceController').getPreference('start_documents_uri', true); + if(uris){ + window.loadLink(uris); + } } }); diff --git a/app/controller/PreferenceController.js b/app/controller/PreferenceController.js index c4e5d86a9..7a7288b91 100644 --- a/app/controller/PreferenceController.js +++ b/app/controller/PreferenceController.js @@ -64,6 +64,7 @@ Ext.define('EdiromOnline.controller.PreferenceController', { getPreference: function(key, lax) { var me = this; + // if key does not exist but lax is true, return null if(!me.preferences[key] && lax) return null; @@ -86,7 +87,7 @@ Ext.define('EdiromOnline.controller.PreferenceController', { key: key, level: 'warn' //warn, error, fatal }); - + return null; }