Loading plugins/index/index.xqm +8 −6 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ 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.util = 'pddn/max/util' at '../../rxq/util.xqm'; import module namespace max.i18n = 'pddn/max/i18n' at '../../rxq/i18n.xqm'; declare variable $max.plugin.index:PLUGIN_ID := "index"; Loading @@ -19,7 +20,8 @@ declare %output:encoding("UTF-8") %rest:path("/{$project}/index/{$type}.html") function max.plugin.index:index($project,$type){ let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/index_'||$type||'.frag.html' let $projectLang := max.i18n:getLang($project) let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/'||$projectLang||'/index_'||$type||'.frag.html' return if(file:exists($indexFilePath)) then Loading @@ -27,17 +29,17 @@ function max.plugin.index:index($project,$type){ let $content := <div id='content'>{$content}</div> (:~ let $content := <div id='content'>{doc($indexFilePath)}</div>~:) return max.html:render($project, 'index', $content) else max.plugin.index:generateIndex($project,$type) else max.plugin.index:generateIndex($project,$type,$projectLang) }; declare function max.plugin.index:generateIndex($project,$type){ let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/index_'||$type||'.frag.html' declare function max.plugin.index:generateIndex($project,$type,$lang){ let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/'||$lang||'/index_'||$type||'.frag.html' let $custXQ := file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$project||"/xq/index_"||$type||".xq" let $custXSL := file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$project||"/ui/xsl/index_"||$type||".xsl" let $HTMLIndex := if (file:exists($custXQ) and file:exists($custXSL)) then max.plugin.index:loadIndex($project,$type,$custXQ,$custXSL) then max.plugin.index:loadIndex($project,$type,$custXQ,$custXSL,$lang) else "error" let $res := switch ($HTMLIndex) Loading @@ -50,7 +52,7 @@ return if (file:exists($indexFilePath)) then max.plugin.index:index($project,$ty else $res }; declare function max.plugin.index:loadIndex($edition,$type,$xq,$xsl) { declare function max.plugin.index:loadIndex($edition,$type,$xq,$xsl,$lang) { let $dbPath := max.config:getProjectDBPath($edition) let $projectIndex := if($type='typesdocs') then <index type="typesdocs">{ Loading Loading
plugins/index/index.xqm +8 −6 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ 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.util = 'pddn/max/util' at '../../rxq/util.xqm'; import module namespace max.i18n = 'pddn/max/i18n' at '../../rxq/i18n.xqm'; declare variable $max.plugin.index:PLUGIN_ID := "index"; Loading @@ -19,7 +20,8 @@ declare %output:encoding("UTF-8") %rest:path("/{$project}/index/{$type}.html") function max.plugin.index:index($project,$type){ let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/index_'||$type||'.frag.html' let $projectLang := max.i18n:getLang($project) let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/'||$projectLang||'/index_'||$type||'.frag.html' return if(file:exists($indexFilePath)) then Loading @@ -27,17 +29,17 @@ function max.plugin.index:index($project,$type){ let $content := <div id='content'>{$content}</div> (:~ let $content := <div id='content'>{doc($indexFilePath)}</div>~:) return max.html:render($project, 'index', $content) else max.plugin.index:generateIndex($project,$type) else max.plugin.index:generateIndex($project,$type,$projectLang) }; declare function max.plugin.index:generateIndex($project,$type){ let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/index_'||$type||'.frag.html' declare function max.plugin.index:generateIndex($project,$type,$lang){ let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/'||$lang||'/index_'||$type||'.frag.html' let $custXQ := file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$project||"/xq/index_"||$type||".xq" let $custXSL := file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$project||"/ui/xsl/index_"||$type||".xsl" let $HTMLIndex := if (file:exists($custXQ) and file:exists($custXSL)) then max.plugin.index:loadIndex($project,$type,$custXQ,$custXSL) then max.plugin.index:loadIndex($project,$type,$custXQ,$custXSL,$lang) else "error" let $res := switch ($HTMLIndex) Loading @@ -50,7 +52,7 @@ return if (file:exists($indexFilePath)) then max.plugin.index:index($project,$ty else $res }; declare function max.plugin.index:loadIndex($edition,$type,$xq,$xsl) { declare function max.plugin.index:loadIndex($edition,$type,$xq,$xsl,$lang) { let $dbPath := max.config:getProjectDBPath($edition) let $projectIndex := if($type='typesdocs') then <index type="typesdocs">{ Loading