Skip to content

Commit

Permalink
Merge branch 'develop' into ftr/PartsInGoToMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
feuerbart authored Dec 16, 2024
2 parents 4d3e072 + ae50cb9 commit f2161d6
Show file tree
Hide file tree
Showing 11 changed files with 827 additions and 1,957 deletions.
1 change: 0 additions & 1 deletion add/controller.xql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ return
(: forward index.html to index.xql :)
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="index.xql">
<set-header name="Set-Cookie" value="edirom-language={$langVal}" />
<add-parameter name="lang" value="{$langVal}"/>
</forward>
</dispatch>
Expand Down
14 changes: 7 additions & 7 deletions add/data/locale/edirom-lang-de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
<entry key="view.desktop.TaskBar_Desktop" value="Desktop {0}"/>
<entry key="view.desktop.TaskBar_searchWin" value="Öffne Suchfenster"/>
<entry key="view.desktop.TaskBar_Sort_grid" value="Im Raster anordnen"/>
<entry key="view.desktop.TaskBar_Sort_vertical" value="Übereinander anordnen"/>
<entry key="view.desktop.TaskBar_Sort_horizontal" value="Nebeneinander anordnen"/>
<entry key="view.desktop.TaskBar_Sort_vertical" value="Nebeneinander anordnen"/>
<entry key="view.desktop.TaskBar_Sort_horizontal" value="Übereinander anordnen"/>
<entry key="view.desktop.TopBar_homeBtnLabel" value="Edirom Online"/>
<entry key="view.window.AnnotationView_Title" value="Anmerkungen"/>
<entry key="view.window.AnnotationView_No" value="Nr."/>
Expand Down Expand Up @@ -138,14 +138,14 @@

<!-- naming gui elements -->
<entry key="view.desktop.Desktop" value="Desktop"/>
<entry key="view.desktop.TopBar" value="Symbolleiste"/>
<entry key="view.desktop.TopBar" value="Toolbar"/>
<entry key="view.desktop.TopBar_searchField" value="Suchfeld"/>
<entry key="view.desktop.TopBar_homeBtn" value="{key=view.desktop.TaskBar_home} Button"/>
<entry key="view.desktop.TaskBar" value="Task-Leiste"/>
<entry key="view.desktop.TaskBar" value="Taskbar"/>
<entry key="view.desktop.TaskBar_btnDesktop" value="Button der Task-Leiste"/>
<entry key="view.window.TopBar" value="Symbolleiste im Fenster"/>
<entry key="view.window.BottomBar" value="Task-Leiste im Fenster"/>
<entry key="view.navigator.Navigator" value="Navigator"/>
<entry key="view.window.TopBar" value="Fenster-Toolbar"/>
<entry key="view.window.BottomBar" value="Fenster-Taskleiste"/>
<entry key="view.navigator.Navigator" value="Inhaltsübersicht"/>
<entry key="global_appName" value="Edirom Online"/>
<entry key="clickAndHoldDragging" value="dragging"/>
<entry key="drag-and-drop" value="Drag-and-Drop"/>
Expand Down
2 changes: 1 addition & 1 deletion add/data/locale/edirom-lang-en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
<entry key="view.desktop.TaskBar_btnDesktop" value="Taskbar"/>
<entry key="view.window.TopBar" value="Window toolbar"/>
<entry key="view.window.BottomBar" value="Window taskbar"/>
<entry key="view.navigator.Navigator" value="Navigator"/>
<entry key="view.navigator.Navigator" value="Content overview"/>
<entry key="global_appName" value="Edirom Online"/>
<entry key="clickAndHoldDragging" value="dragging"/>
<entry key="drag-and-drop" value="drag-and-drop"/>
Expand Down
9 changes: 6 additions & 3 deletions add/data/xql/getAnnotationsInText.xql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare namespace request = "http://exist-db.org/xquery/request";
declare namespace xlink = "http://www.w3.org/1999/xlink";
declare namespace xmldb = "http://exist-db.org/xquery/xmldb";
import module namespace eutil = "http://www.edirom.de/xquery/eutil" at "../xqm/eutil.xqm";


(: OPTION DECLARATIONS ===================================================== :)

Expand All @@ -29,10 +31,10 @@ declare option output:media-type "application/json";
@param $elems The elements to check (most likely measures and zones)
@returns A sequence of annotation elements
:)
declare function local:findAnnotations($uri as xs:string) as element(mei:annot)* {
declare function local:findAnnotations($uri as xs:string, $edition as xs:string) as element(mei:annot)* {

(: TODO: check if annotations hold URIs or IDRefs :)
collection('/db/contents')//mei:annot[matches(@plist, $uri)]
edition:collection($edition)//mei:annot[matches(@plist, $uri)]
};

declare function local:getAnnotations($uriSharp as xs:string, $annotations as element()*) as array(*)* {
Expand Down Expand Up @@ -65,9 +67,10 @@ declare function local:getAnnotations($uriSharp as xs:string, $annotations as el
}
};

let $edition := request:get-parameter('edition', '')
let $uri := request:get-parameter('uri', '')
let $uriSharp := concat($uri, '#')
let $annotations := local:findAnnotations($uri)
let $annotations := local:findAnnotations($uri,$edition)

return
local:getAnnotations($uriSharp, $annotations)
7 changes: 5 additions & 2 deletions add/data/xql/getHelp.xql
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ declare option output:omit-xml-declaration "yes";

let $lang := request:get-parameter('lang', 'en')
let $idPrefix := request:get-parameter('idPrefix', '')
let $contextPath := request:get-context-path()

let $base := replace(system:get-module-load-path(), 'embedded-eXist-server', '') (:TODO:)

let $doc := doc(concat('../../help/help_', $lang, '.xml'))
let $contextPath := if(starts-with(document-uri($doc), '/db'))
then substring-after(document-uri($doc), '/db')
else document-uri($doc)
let $contextPath := substring-before($contextPath, concat('help/help_', $lang, '.xml'))
let $contextPath := request:get-context-path() || $contextPath

let $xsl := doc('../xslt/edirom_langReplacement.xsl')
let $doc :=
Expand All @@ -43,7 +47,6 @@ let $doc :=
<param name="base" value="{concat($base, '/../xslt/')}"/>
<param name="lang" value="{$lang}"/>
<param name="tocDepth" value="1"/>
<param name="graphicsPrefix" value="help/"/>
<param name="contextPath" value="{$contextPath}"/>
(: == passing empty value for docUri (XSLT expects xs:anyURI, but ExtJS view does not provide value) -> github#480 == :)
<param name="docUri" value="''"/>
Expand Down
2 changes: 1 addition & 1 deletion add/data/xql/getLinkTarget.xql
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ declare function local:getViews($type as xs:string, $docUri as xs:string, $doc a
declare function local:getWindowTitle($doc as node()+, $type as xs:string) as xs:string {

(: Work :)
if (exists($doc//mei:mei) and exists($doc//mei:workDesc/mei:work) and not(exists($doc//mei:perfMedium))) then
if (exists($doc//mei:mei) and exists($doc//(mei:workDesc|mei:workList)/mei:work) and not(exists($doc//mei:perfMedium))) then
(eutil:getLocalizedTitle(($doc//mei:work)[1]/mei:titleStmt[1], $lang))
else if (exists($doc/root()/mei:work)) then
(eutil:getLocalizedTitle($doc/root()/mei:work, $lang))
Expand Down
30 changes: 17 additions & 13 deletions add/data/xqm/eutil.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,22 @@ declare function eutil:getLanguageString($key as xs:string, $values as xs:string
: @param $edition The current edition URI
: @return The preference value
:)
declare function eutil:getPreference($key as xs:string, $edition as xs:string?) as xs:string {
declare function eutil:getPreference($key as xs:string, $edition as xs:string?) as xs:string? {

let $preferencesFile :=
(: Try to load a custom preferences file :)
let $prefFileCustom :=
try { doc(edition:getPreferencesURI($edition)) }
catch * { util:log-system-out('Failed to load preferences') }

catch * { util:log-system-out('Failed to load the custom preferences file') }
return
$preferencesFile//entry[@key = $key]/@value => string()

(: If there is a value for the key in the custom preferences file :)
if($prefFileCustom//entry/@key = $key) then
$prefFileCustom//entry[@key = $key]/@value => string()
(: If not, take the value for the key in the default preferences file :)
else
try { doc($edition:default-prefs-location)//entry[@key = $key]/@value => string() }
(: If the key is not in the default file, then there should be an error :)
catch * { util:log-system-out(concat('Failed to find the key `', $key, '` in default preferences file')) }
};

(:~
Expand All @@ -299,16 +306,13 @@ declare function eutil:getPreference($key as xs:string, $edition as xs:string?)
: @return The language key
:)
declare function eutil:getLanguage($edition as xs:string?) as xs:string {

if (request:get-parameter("lang", "") != "") then
request:get-parameter("lang", "")

else if(request:get-cookie-names() = 'edirom-language') then
request:get-cookie-value('edirom-language')

else
else if(eutil:getPreference('application_language', edition:findEdition($edition))) then
eutil:getPreference('application_language', edition:findEdition($edition))

else
'de'
};

(:~
Expand Down
Loading

0 comments on commit f2161d6

Please sign in to comment.