diff --git a/modules/app.xqm b/modules/app.xqm index 2e5adfca6..4f4f6d1ac 100644 --- a/modules/app.xqm +++ b/modules/app.xqm @@ -260,6 +260,18 @@ declare } }; +declare + %templates:default("lang", "en") + function app:breadcrumb-var2($node as node(), $model as map(*), $lang as xs:string) as element() { + let $docID := $model('docID') + let $breadcrumb := $controller:projectNav[?docID=$docID]?title + return + element {node-name($node)} { + $node/@*, + lang:get-language-string($breadcrumb,$lang) + } +}; + declare %templates:wrap %templates:default("lang", "en") diff --git a/modules/controller.xqm b/modules/controller.xqm index 4aa31b60b..82050315e 100644 --- a/modules/controller.xqm +++ b/modules/controller.xqm @@ -22,6 +22,54 @@ import module namespace wdt="http://xquery.weber-gesamtausgabe.de/modules/wdt" a import module namespace gl="http://xquery.weber-gesamtausgabe.de/modules/gl" at "gl.xqm"; import module namespace functx="http://www.functx.com"; + + +declare variable $controller:projectNav := + map { + 'docID': 'A070001', + 'title': 'editorialGuidelines-text' + }, + map { + 'docID': 'A070002', + 'title': 'about' + }, + map { + 'docID': 'A070003', + 'title': 'bio' + }, + map { + 'docID': 'A070004', + 'title': 'faq' + }, + map { + 'docID': 'A070006', + 'title': 'projectDescription' + }, + map { + 'docID': 'A070009', + 'title': 'contact' + }, + map { + 'docID': 'A070010', + 'title': 'editorialGuidelines-music' + }, + map { + 'docID': 'A070011', + 'title': 'volContents' + }, + map { + 'docID': 'A070012', + 'title': 'apiDocumentation' + }, + map { + 'docID': 'A070013', + 'title': 'credits' + }, + map { + 'docID': 'A070090', + 'title': 'specialVolume' + }; + (:~ : HTML output. Forwards to a given template and takes care of ETag caching : @@ -192,17 +240,10 @@ declare function controller:dispatch-project($exist-vars as map(*)) as element(e let $request := request:get-uri() let $a := distinct-values($project-nav/@href[controller:encode-path-segments-for-uri(controller:resolve-link(.,$exist-vars)) = $request]/parent::*) return - switch($a) - case 'bibliography' case 'news' return controller:dispatch-register($exist-vars) + if($a = ('bibliography', 'news')) then controller:dispatch-register($exist-vars) (: Need to inject the corresponding IDs of special pages here :) - case 'projectDescription' return controller:forward-html('/templates/var.html', map:merge(($exist-vars, map:entry('docID', 'A070006'), map:entry('docType', 'var')))) - case 'editorialGuidelines-text' return controller:forward-html('/templates/var.html', map:merge(($exist-vars, map:entry('docID', 'A070001'), map:entry('docType', 'var')))) - case 'editorialGuidelines-music' return controller:forward-html('/templates/var.html', map:merge(($exist-vars, map:entry('docID', 'A070010'), map:entry('docType', 'var')))) - case 'contact' return controller:forward-html('/templates/var.html', map:merge(($exist-vars, map:entry('docID', 'A070009'), map:entry('docType', 'var')))) - case 'about' return controller:forward-html('/templates/var.html', map:merge(($exist-vars, map:entry('docID', 'A070002'), map:entry('docType', 'var')))) - case 'volContents' return controller:forward-html('/templates/var.html', map:merge(($exist-vars, map:entry('docID', 'A070011'), map:entry('docType', 'var')))) - case 'credits' return controller:forward-html('/templates/var.html', map:merge(($exist-vars, map:entry('docID', 'A070013'), map:entry('docType', 'var')))) - default return controller:error($exist-vars, 404) + else if($a = $controller:projectNav?title) then controller:forward-html('/templates/var.html', map:merge(($exist-vars, map:entry('docID', $controller:projectNav[?title=$a]?docID), map:entry('docType', 'var')))) + else controller:error($exist-vars, 404) }; (:~ @@ -215,8 +256,7 @@ declare function controller:dispatch-help($exist-vars as map(*)) as element(exis return switch($a) (: Need to inject the corresponding IDs of special pages here :) - case 'faq' return controller:forward-html('/templates/var.html', map:merge(($exist-vars, map:entry('docID', 'A070004'), map:entry('docType', 'var')))) - case 'apiDocumentation' return controller:forward-html('/templates/var.html', map:merge(($exist-vars, map:entry('docID', 'A070012'), map:entry('docType', 'var')))) + case 'faq' case 'apiDocumentation' return controller:forward-html('/templates/var.html', map:merge(($exist-vars, map:entry('docID', $controller:projectNav[?title=$a]?docID), map:entry('docType', 'var')))) default return controller:error($exist-vars, 404) }; diff --git a/templates/var.html b/templates/var.html index 797f3e450..3ded30f8a 100644 --- a/templates/var.html +++ b/templates/var.html @@ -16,10 +16,9 @@

CARL MARIA VON WEBER AN
diff --git a/testing/expected-results/var/Band%C3%BCbersicht.html b/testing/expected-results/var/Band%C3%BCbersicht.html index fccf6df11..f2fbddf7b 100644 --- a/testing/expected-results/var/Band%C3%BCbersicht.html +++ b/testing/expected-results/var/Band%C3%BCbersicht.html @@ -217,7 +217,7 @@

Übersicht über die einzelnen Serien und Bände

  • Home
  • Projekt
  • -
  • A070011
  • +
  • Bandübersicht
  • diff --git a/testing/expected-results/var/Editionsrichtlinien_Musik.html b/testing/expected-results/var/Editionsrichtlinien_Musik.html index 771e4d6cb..fe1d22357 100644 --- a/testing/expected-results/var/Editionsrichtlinien_Musik.html +++ b/testing/expected-results/var/Editionsrichtlinien_Musik.html @@ -219,7 +219,7 @@

    Editionsrichtlinien für die Notenbände

  • Home
  • Projekt
  • -
  • A070010
  • +
  • Editionsrichtlinien Musik
  • diff --git a/testing/expected-results/var/Editionsrichtlinien_Text.html b/testing/expected-results/var/Editionsrichtlinien_Text.html index cbed79c7f..767582681 100644 --- a/testing/expected-results/var/Editionsrichtlinien_Text.html +++ b/testing/expected-results/var/Editionsrichtlinien_Text.html @@ -219,7 +219,7 @@

    Editionsrichtlinien zur Ausgabe der Briefe, Tagebücher und Dokumente Webers
  • Home
  • Projekt
  • -
  • A070001
  • +
  • Editionsrichtlinien Text
  • diff --git a/testing/expected-results/var/FAQ.html b/testing/expected-results/var/FAQ.html index 0b68ebf8e..49c9f568b 100644 --- a/testing/expected-results/var/FAQ.html +++ b/testing/expected-results/var/FAQ.html @@ -216,7 +216,7 @@

    Frequently Asked Questions (FAQ)

  • Home
  • Hilfe
  • -
  • A070004
  • +
  • FAQ
  • diff --git a/testing/expected-results/var/Impressum.html b/testing/expected-results/var/Impressum.html index 1a5dfac64..775aa9cdf 100644 --- a/testing/expected-results/var/Impressum.html +++ b/testing/expected-results/var/Impressum.html @@ -217,7 +217,7 @@

    Impressum

  • Home
  • Projekt
  • -
  • A070002
  • +
  • Impressum
  • diff --git a/testing/expected-results/var/Kontakt.html b/testing/expected-results/var/Kontakt.html index 7ec9ddea2..97ab8e3d1 100644 --- a/testing/expected-results/var/Kontakt.html +++ b/testing/expected-results/var/Kontakt.html @@ -216,7 +216,7 @@

    Kontakt

  • Home
  • Projekt
  • -
  • A070009
  • +
  • Kontakt
  • diff --git a/testing/expected-results/var/Projektbeschreibung.html b/testing/expected-results/var/Projektbeschreibung.html index 0bb3de9bc..593008467 100644 --- a/testing/expected-results/var/Projektbeschreibung.html +++ b/testing/expected-results/var/Projektbeschreibung.html @@ -217,7 +217,7 @@

    Projektbeschreibung

  • Home
  • Projekt
  • -
  • A070006
  • +
  • Projektbeschreibung