Commit 57070a19 authored by dje's avatar dje
Browse files

un peu de propre/renommage de fonctions

parent 44e89b06
Loading
Loading
Loading
Loading
+7 −64
Changes for max.xq: 7 added lines, 64 removed lines.
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ declare
%output:method("html")
%output:indent("no")
%rest:path("/{$project}/{$routeDoc=[^plugins].*\.xml}/{$id}")
function max:htmlFragmentWithNavigationBar($project, $routeDoc, $id){
function max:fragmentToHTMLPage($project, $routeDoc, $id){

    let $dbPath := max.config:getProjectDBPath($project)
    
@@ -141,10 +141,9 @@ declare
%output:method("html")
%output:indent("no")
%rest:path("/{$project}/{$routeDoc=[^plugins].*\.xml}/{$id}/target/{$targetId}/{$search}")
function max:htmlFragmentAndTargetSearchWithNavigationBar($project, $routeDoc, $id, $targetId, $search){
function max:HighlightedSearchToHTMLPage($project, $routeDoc, $id, $targetId, $search){
   
    
    copy $c := max:htmlFragmentWithNavigationBar($project, $routeDoc, $id)
    copy $c := max:fragmentToHTMLPage($project, $routeDoc, $id)
    modify (
      replace value of node $c/descendant-or-self::*[@*:id=$targetId]/@*:id with "target"
    )
@@ -161,7 +160,7 @@ declare
%output:method("html")
%output:indent("no")
%rest:path("/{$project}/{$routeDoc=[^plugins].*\.xml}/focus/{$idFocus}")
function max:htmlFragmentTargetIdWithNavigationBar($project, $routeDoc, $idFocus){
function max:focusOnIdToHTML($project, $routeDoc, $idFocus){
    copy $c := max:getFullDocument($project, $routeDoc)
    modify (
      replace value of node $c//*[@*:id=$idFocus]/@*:id with "scrollfocus"
@@ -177,8 +176,8 @@ declare
%output:method("html")
%output:indent("no")
%rest:path("/{$project}/{$routeDoc=[^plugins].*\.xml}/focus/{$idPart}/{$idFocus}")
function max:htmlFragmentTargetPartAndIdWithNavigationBar($project, $routeDoc,$idPart, $idFocus){
  copy $c := max:htmlFragmentWithNavigationBar($project, $routeDoc, $idPart)
function max:focusOnPartAndIdToHTMLPage($project, $routeDoc,$idPart, $idFocus){
  copy $c := max:fragmentToHTMLPage($project, $routeDoc, $idPart)
    modify (
      replace value of node $c//*[@*:id=$idFocus]/@*:id with "scrollfocus"
    )
@@ -265,65 +264,9 @@ function max:getFullDocument($project, $doc){
  
  let $xmlDoc := (doc(max.config:getProjectDBPath($project) || "/" || $doc)/*)[1]
  return

     max.html:render($project,"", <div id='text'>{max:transformEditionFragment($project, $xmlDoc, $doc)}</div>) 
(:
  catch *{
      max.html:wrapInHTML($project,"", $xmlDoc,"")
  }
:)  
};



 
(: declare
%rest:GET
%output:method("html")
%rest:path("/editions/about")
function max:about(){
  let $editions := max.config:getEditions()
  let $details := <ul>{
    for $ed in $editions
      let $id := string($ed/@xml:id)
      let $plugins := max.config:getPluginNameList($id)
      let $url :=  $id || "/accueil"
      return <li>
                {$id}
                <ul>
                  <li>Accès: <a href='{$url}'>Home page</a></li>
                  <li>Grammaire XML: {string($ed/@env)}</li>
                  <li>Plugins: {
                    if($plugins)
                     then xquery:invoke(request:uri() || "/../"||$id||"/" || "/checkplugins")
                     else " - "
                  }
                  </li>
                  <li>Parcours/Routes: {
                    let $type := string($ed/routeList/@type)
                    return
                    switch ($type)
                      case $max.cons:XQUERY_ROUTE_TYPE
                        return 'todo'
                      case $max.cons:CONFIG_LIST_ROUTE_TYPE
                        return string-join($ed//route/@label,', ')
                      case $max.cons:HTML_FILE_ROUTE_TYPE
                        return 'todo3'
                      default
                        return 'Par défaut (liste des documents XML de la DB)'
                  }</li>
                </ul>
              </li>
    }
    </ul>
  
  return max.html:renderTemplate(doc("ui/templates/about.html"),
                                  map{
                                    'nbEditions':count($editions),
                                    'details': $details

                                }) 
}; :)
};


declare function max:transformEditionFragment($project, $xml, $route){
+3 −2
Changes for rxq/html.xqm: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -48,14 +48,15 @@ declare function max.html:render(
                                  }) 
        }
      catch err:FODC0002{
                    max.html:renderTemplate(doc("../ui/templates/default.html"),
        <html>Bad configuration for <b>{$projectId}</b> - Please check yout configuration file</html> 
                    (: max.html:renderTemplate(doc("../ui/templates/default.html"),
                                    map{
                                      'projectId':$projectId,
                                      'menu': $menu,
                                      'head': $head,
                                      'content' : $wrapped,
                                      'jsImports': $jsImports                                
                                  })  
                                  }) :)  
       } 
    };