Commit cdbbab58 authored by Guillaume Porte's avatar Guillaume Porte 😶
Browse files

fonctions d'appel pour la création des métadonnées et des données à faire...

fonctions d'appel pour la création des métadonnées et des données à faire passer au template (paramétrées dans edition_config_inc.xml)
parent 22ca327c
Loading
Loading
Loading
Loading
+46
Changes for rxq/config.xqm: 46 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ module namespace max.config = 'pddn/max/config';
import module namespace rest = "http://exquery.org/ns/restxq";
import module namespace max.cons = 'pddn/max/cons' at 'cons.xqm';
import module namespace max.util = 'pddn/max/util' at 'util.xqm';
import module namespace max.hht = 'pddn/max/hht' at 'hht.xqm';

(: CONFIGURATION file path. :)
declare variable $max.config:CONFIGURATION_FILE := "../configuration/configuration.xml";
@@ -255,3 +256,48 @@ declare function max.config:getTextOptionsFragment($project){
  string(doc($max.config:CONFIGURATION_FILE)//edition[@xml:id=$project]/textOptions/htmlFragment/@file)
};


(: get project data from config file :)
declare function max.config:getProjectData($project){
  map:merge(
      for $data in doc($max.config:CONFIGURATION_FILE)//edition[@xml:id=$project]/projectData/data
      return
        map{$data/@key : data($data)}
  )  
};

(: get default html head tags :)
declare function max.config:getHtmlHeadTags(
  $project as xs:string +, $pageType as xs:string +, $pageName as xs:string *){
      max.config:getHtmlHeadTags($project, $pageType, $pageName, '' )
};

(: get default html head tags :)
declare function max.config:getHtmlHeadTags(
  $project as xs:string +, $pageType as xs:string +, $pageName as xs:string *, $id as xs:string *){

  try{ 

    let $defaultHtmlHeadTags := doc($max.config:DEFAULT_HTML_HEAD_TAGS)//defaultHtmlHeadTags
 
    return
      try{
        switch($pageType)
        case 'default'
          return max.hht:getHtmlHeadTags_Page($project, 'base', $pageName, $defaultHtmlHeadTags)
        case 'html'
          return max.hht:getHtmlHeadTags_HTML($project, 'base', $pageName, $defaultHtmlHeadTags)
        case 'xml'
          return max.hht:getHtmlHeadTags_XML($project, $pageType, $pageName, $id, $defaultHtmlHeadTags)
        default return
          map{"error" : "Le type doit être 'default', 'html' ou 'xml'"}
      }
      catch *{
          map{"error" : "Une erreur est survenue."}
      }
    }
    catch *{}
};