diff --git a/app/templates/site.xml b/app/templates/site.xml index 346e1ba8c..6abce7c07 100644 --- a/app/templates/site.xml +++ b/app/templates/site.xml @@ -308,7 +308,7 @@
history@state.gov diff --git a/controller.xql b/controller.xql index 09c3766d1..3d7ed9477 100644 --- a/controller.xql +++ b/controller.xql @@ -201,17 +201,23 @@ else switch($path-parts[1]) local:render-page("historicaldocuments/frus-history/events/index.xml") case "documents" return if (empty($path-parts[4])) then - local:render-page("historicaldocuments/frus-history/documents/index.xml") + local:render-page("historicaldocuments/frus-history/documents/index.xml", map{ + "publication-id": "frus-history-documents" + }) else local:render-page("historicaldocuments/frus-history/documents/document.xml", map{ + "publication-id": "frus-history-documents", "document-id": $path-parts[4] }) case "research" return if (empty($path-parts[4])) then - local:render-page("historicaldocuments/frus-history/research/index.xml") + local:render-page("historicaldocuments/frus-history/research/index.xml", map{ + "publication-id": "frus-history-articles" + }) else local:render-page("historicaldocuments/frus-history/research/article.xml", map{ - "article-id": $path-parts[4] + "publication-id": "frus-history-articles", + "document-id": $path-parts[4] }) case "appendix-a" return local:render-page("historicaldocuments/frus-history/appendix-a.xml", map{ @@ -310,7 +316,7 @@ else switch($path-parts[1]) local:render-page("departmenthistory/timeline/section.xml", map { "publication-id": "timeline", "document-id": "timeline", - "section-id": $path-parts[3] + "section-id": "chapter_" || $path-parts[3] }) case "short-history" return if (empty($path-parts[3])) then diff --git a/modules/config.xqm b/modules/config.xqm index bc608fd6f..cf8c5c8dd 100644 --- a/modules/config.xqm +++ b/modules/config.xqm @@ -355,21 +355,23 @@ declare variable $config:PUBLICATIONS := ) } }, - "articles": map { + "frus-history-articles": map { "collection": $config:FRUS_HISTORY_ARTICLES_COL, "document-last-modified": function($document-id) { xmldb:last-modified($config:FRUS_HISTORY_ARTICLES_COL, $document-id || '.xml') }, "section-last-modified": function($document-id, $section-id) { xmldb:last-modified($config:FRUS_HISTORY_ARTICLES_COL, $document-id || '.xml') }, "document-created": function($document-id) { xmldb:created($config:FRUS_HISTORY_ARTICLES_COL, $document-id || '.xml') }, "section-created": function($document-id, $section-id) {xmldb:created($config:FRUS_HISTORY_ARTICLES_COL, $document-id || '.xml') }, "select-document": function($document-id) { doc($config:FRUS_HISTORY_ARTICLES_COL || '/' || $document-id || '.xml') }, - "select-section": function($document-id, $section-id) { doc($config:FRUS_HISTORY_ARTICLES_COL || '/' || $document-id || '.xml')//tei:body }, + "select-section": function($document-id, $section-id) { doc($config:FRUS_HISTORY_ARTICLES_COL || '/' || $document-id || '.xml')/id($section-id) }, + "next": frus-history:get-next-article#1, + "previous": frus-history:get-previous-article#1, "html-href": function($document-id, $section-id) { "$app/frus-history/" || string-join(($document-id, $section-id), '/') }, "odd": "frus.odd", "transform": function($xml, $parameters) { pm-frus:transform($xml, $parameters) }, "base-path": function($document-id, $section-id) { "frus150" }, "breadcrumb-title": function($parameters as map(*)) as xs:string? { - config:tei-short-breadcrumb-title($parameters?publication-id, $parameters?article-id) + config:tei-short-breadcrumb-title($parameters?publication-id, $parameters?document-id) } }, "about": map { @@ -523,7 +525,7 @@ declare variable $config:PUBLICATIONS := "document-created": function($document-id) { xmldb:created($config:ADMINISTRATIVE_TIMELINE_COL, $document-id || '.xml') }, "section-created": function($document-id, $section-id) {xmldb:created($config:ADMINISTRATIVE_TIMELINE_COL, $document-id || '.xml') }, "select-document": function($document-id) { doc($config:ADMINISTRATIVE_TIMELINE_COL || '/' || $document-id || '.xml') }, - "select-section": function($document-id, $section-id) { doc($config:ADMINISTRATIVE_TIMELINE_COL || '/' || $document-id || '.xml')/id('chapter_' || $section-id) }, + "select-section": function($document-id, $section-id) { doc($config:ADMINISTRATIVE_TIMELINE_COL || '/' || $document-id || '.xml')/id($section-id) }, "html-href": function($document-id, $section-id) { "$app/departmenthistory/" || string-join(($document-id, substring-after($section-id, 'chapter_')), '/') }, "url-fragment": function($div) { if (starts-with($div/@xml:id, 'chapter_')) then substring-after($div/@xml:id, 'chapter_') else $div/@xml:id/string() }, "odd": "frus.odd", diff --git a/modules/frus-history-html.xqm b/modules/frus-history-html.xqm index 6a541f26c..35c963072 100644 --- a/modules/frus-history-html.xqm +++ b/modules/frus-history-html.xqm @@ -225,6 +225,52 @@ declare function fhh:document-list($node, $model) { ) }; +declare function fhh:get-next-article($model) { + let $div := $model?data/ancestor-or-self::tei:TEI + let $documents := collection($fhh:FRUS_HISTORY_ARTICLES_COL)/tei:TEI + let $col := + for $doc in $documents + let $created := $doc//tei:publicationStmt/tei:date/@when + order by $created + return $doc + let $index := index-of($col, $div) + let $size := count($col) + let $data := + switch($index) + case $size return () + default return ($col[$index + 1]//tei:body)[1] + let $href := if ($data) then "$app/historicaldocuments/frus-history/research/" || substring-before(util:document-name($data), '.xml') else () + return + if ($data) then + map{ + "data": $data, + "href": $href + } + else () +}; + +declare function fhh:get-previous-article($model) { + let $div := $model?data/ancestor-or-self::tei:TEI + let $documents := collection($fhh:FRUS_HISTORY_ARTICLES_COL)/tei:TEI + let $col := + for $doc in $documents + let $created := $doc//tei:publicationStmt/tei:date/@when + order by $created + return $doc + let $index := index-of($col, $div) + let $data := + switch($index) + case 1 return () + default return ($col[$index - 1]//tei:body)[1] + let $href := if ($data) then "$app/historicaldocuments/frus-history/research/" || substring-before(util:document-name($data), '.xml') else () + return + if ($data) then + map{ + "data": $data, + "href": $href + } + else () +}; declare function fhh:get-next-doc($model) { let $div := $model?data/ancestor-or-self::tei:TEI let $documents := collection($fhh:FRUS_HISTORY_DOCUMENTS_COL)/tei:TEI @@ -339,41 +385,46 @@ declare function fhh:article-list-sidebar($node, $model, $article-id) { } }; -declare function fhh:article-breadcrumb($node, $model, $article-id) { - let $article := doc($fhh:FRUS_HISTORY_ARTICLES_COL || "/" || $article-id || ".xml") +declare function fhh:article-breadcrumb($node, $model, $document-id) { + let $article := doc($fhh:FRUS_HISTORY_ARTICLES_COL || "/" || $document-id || ".xml") let $title := $article//tei:title[@type='short'] return {$title/string()} }; -declare function fhh:article-title($node, $model, $article-id) { - let $article := doc($fhh:FRUS_HISTORY_ARTICLES_COL || "/" || $article-id || ".xml") +declare function fhh:article-title($node, $model, $document-id) { + let $article := doc($fhh:FRUS_HISTORY_ARTICLES_COL || "/" || $document-id || ".xml") return pages:process-content($model?odd, $article//tei:title[@type='complete']) }; -declare function fhh:article-author($node, $model, $article-id) { - let $article := doc($fhh:FRUS_HISTORY_ARTICLES_COL || "/" || $article-id || ".xml") +declare function fhh:article-author($node, $model, $document-id) { + let $article := doc($fhh:FRUS_HISTORY_ARTICLES_COL || "/" || $document-id || ".xml") let $author := $article//tei:author/text() let $affiliation := $article//tei:sponsor/text() let $date := $article//tei:publicationStmt/tei:date/text() return ( -