Commit 0fa57f5c authored by Orderic-Vital Pain's avatar Orderic-Vital Pain Committed by Jerome Chauveau
Browse files

Ajouté un focus pour le retour à l’index dans le plugin correspondant + chemin...

parent 0124c478
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ xquery version "3.0";
module namespace max.plugin.index = 'pddn/max/plugin/index'; 
import module namespace max.config = 'pddn/max/config' at '../../rxq/config.xqm';
import module namespace max.html = 'pddn/max/html' at '../../rxq/html.xqm';
import module namespace max = 'pddn/max' at '../../max.xq';
import module namespace max.util = 'pddn/max/util' at '../../rxq/util.xqm';
import module namespace max.i18n = 'pddn/max/i18n' at '../../rxq/i18n.xqm';

@@ -19,8 +20,9 @@ declare
%output:html-version("5.0")
%output:indent("no")
%output:encoding("UTF-8")
%rest:query-param("focus", "{$focus}")
%rest:path("/{$project}/index/{$type}.html")
function max.plugin.index:index($project,$type){
function max.plugin.index:index($project,$type, $focus as xs:string?){
	let $projectLang := max.i18n:getLang($project)
	let $indexFilePath := file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/'||$projectLang||'/index/index_'||$type||'.frag.html'
	return
@@ -28,7 +30,10 @@ function max.plugin.index:index($project,$type){
		then 
			let $content := fetch:xml($indexFilePath, map {'chop' : false()})
			let $content := <div id='content'>{$content}</div> 
			return max.html:render($project, 'index/'||$type, $content) 
			let $html := max.html:render($project, 'index/'||$type, $content)
			return if($focus)
				then(max.util:addHTMLClass($html, $focus, 'target'))
				else($html)
		else max.plugin.index:generateIndex($project,$type,$projectLang)
};

@@ -51,7 +56,7 @@ declare function max.plugin.index:generateIndex($project,$type,$lang){
           
	return
		if (file:exists($indexFilePath))
		then max.plugin.index:index($project,$type)
		then max.plugin.index:index($project,$type, ())
		else $res
};

+1 −1
Original line number Diff line number Diff line
@@ -272,7 +272,7 @@ declare function max.util:getDocumentTitleTOCXSL($projectId) {
 Returns project's nav bar xsl
:)
declare function max.util:getNavigationBarXSL($projectId) {
    let $xsltFile := file:parent(file:parent(static-base-uri())) || "editions/" || $projectId || "/ui/xsl/tei/" || $max.cons:NAV_BAR_XSL_FILEPATH
    let $xsltFile := file:parent(file:parent(static-base-uri())) || "editions/" || $projectId || "ui/xsl/"|| max.config:getXMLFormat($projectId) ||'/'|| $max.cons:NAV_BAR_XSL_FILEPATH
    return if(file:exists($xsltFile))
    then $xsltFile
    else file:parent(file:parent(static-base-uri())) || "ui/xsl/"|| max.config:getXMLFormat($projectId) ||'/'|| $max.cons:NAV_BAR_XSL_FILEPATH