Commit d0965f34 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

ajout de max.config:getResourceFile pour accès aux surcharges des éditions ou...

ajout de max.config:getResourceFile pour accès aux surcharges des éditions ou aux fichiers du core par défaut
parent fe06ac0c
Loading
Loading
Loading
Loading
+14 −15
Original line number Diff line number Diff line
@@ -154,26 +154,29 @@ declare function max.config:getXMLFormat($project as xs:string){
  string(doc($max.config:CONFIGURATION_FILE)//edition[@xml:id=$project]/@env)
};


(:
    Returns resource file path from the edition folder if exists, from the max default one if not.
:)
declare function max.config:getResourceFile($projectId, $path){
    let $editionFile := file:parent(file:parent(static-base-uri())) || "editions/" || $projectId || "/" || $path
    return
        if(file:exists($editionFile))
            then $editionFile
        else file:parent(file:parent(static-base-uri())) || $path
};
(:
 Returns project's menu xsl
:)
declare function max.config:getProjectMenuXSL($projectId) {
    let $xsltFile := file:parent(file:parent(static-base-uri())) || "editions/" || $projectId || "/ui/xsl/menu.xsl"
    return if(file:exists($xsltFile))
           then $xsltFile
           else file:parent(file:parent(static-base-uri())) || "ui/xsl/menu.xsl"

    max.config:getResourceFile($projectId, $max.cons:MENU_XSL_FILEPATH )
};

(:
 Returns project's TOC xsl
:)
declare function max.config:getProjectTOCXSL($projectId) {
    let $xsltFile := file:parent(file:parent(static-base-uri())) || "editions/" || $projectId || "/ui/xsl/" || $max.cons:TOC_XSL_FILEPATH
    return if(file:exists($xsltFile))
    then $xsltFile
    else file:parent(file:parent(static-base-uri())) || "ui/xsl/" || $max.cons:TOC_XSL_FILEPATH

    max.config:getResourceFile($projectId, "/ui/xsl/" || $max.cons:TOC_XSL_FILEPATH)
};


@@ -181,11 +184,7 @@ declare function max.config:getProjectTOCXSL($projectId) {
 Returns project's TOC xsl
:)
declare function max.config:getDocumentTitleTOCXSL($projectId) {
    let $xsltFile := file:parent(file:parent(static-base-uri())) || "editions/" || $projectId || "/ui/xsl/" || $max.cons:DOCUMENT_TITLE_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:DOCUMENT_TITLE_XSL_FILEPATH

    max.config:getResourceFile($projectId, "/ui/xsl/" || $max.cons:DOCUMENT_TITLE_XSL_FILEPATH)
};

(:
+3 −0
Original line number Diff line number Diff line
@@ -22,6 +22,9 @@ declare variable $max.cons:MENU_FILE := "menu.xml";
(: plugins' folder. :)
declare variable $max.cons:PLUGIN_FOLDER_NAME := "plugins";

(: menu XSL. :)
declare variable $max.cons:MENU_XSL_FILEPATH := "ui/xsl/menu.xsl";

(: project toc query :)
declare variable $max.cons:TOC_QUERY_FILEPATH := "xq/toc.xq";