Commit 19bf0ee5 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

Merge branch 'ag/pager' into 'dev'

mise à jour du pager

See merge request pdn-certic/MaX!37
parents d4143ebe a20f30d9
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -6,7 +6,8 @@
  color: #000000;
}
.curPageLink {
  background: #ff8822;
/*  background: #ff8822;*/
background: #ddd;
  text-decoration: none;
  padding: 2px;
}
@@ -24,6 +25,7 @@
#pagerNav {
  width: 50%;
  margin: auto;
  font-size:1.5em;
}
#lastPage,
#firstPage {
@@ -34,3 +36,11 @@
#firstPage:visited {
  color: #000000;
}

.max-doc-title {
overflow:visible;
}

#pagerBlocks h2.subpart {
text-align:left;
}
+11 −4
Original line number Diff line number Diff line
var pager = new Object();
pager['onTextChange'] = function() {
import {Plugin} from '../../core/ui/js/Plugin.js';

class PagerPlugin extends Plugin{
  constructor(name) {
    super(name);
  }

  run(){
  if($("#routeList").length){
     //changes each route list link target in order to use pager's functions
      $("#routeEntries a").each(function(){
      $(this).attr("href", $(this).attr("href").replace("parcours/","") + "/page/1");      
    })  
  }
};
}
}

MAX.addModule(pager);
 No newline at end of file
MAX.addPlugin(new PagerPlugin('Pager'));
 No newline at end of file
+9 −5
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ declare
%rest:GET
%output:method("html")
%output:indent("no")
%rest:path("/editions/{$project}/{$route=.*\.xml}/page/{$n}")
%rest:path("/{$project}/{$route=.*\.xml}/page/{$n}")
function max.plugin.pager:paginate($project as xs:string, $route as xs:string, $n as xs:integer){
   let $routeDoc := if(starts-with($route,'doc/'))
                    then tokenize($route, 'doc/')[last()]
@@ -27,6 +27,9 @@ function max.plugin.pager:paginate($project as xs:string, $route as xs:string, $
          max.plugin.pager:paginateNodes($project, $routeDoc, $n, $dbName)
   let $xml :=  $xmlAndNavlinks[1]
   let $navLinks :=  $xmlAndNavlinks[2]  
   let $title:= max.util:getDocTitle($dbName, $route, max.config:getXMLFormat($project))
   let $xsl := max.config:getDocumentTitleTOCXSL($project)
   let $transformedTitle := xslt:transform($title,$xsl)

   let $xsltDoc := max.util:buildXSLTDoc(
                                     max.config:getDefaultTextXSL($project),
@@ -36,7 +39,8 @@ function max.plugin.pager:paginate($project as xs:string, $route as xs:string, $
   let $html := xslt:transform($xml, $xsltDoc, $xsltParams)    
   (:return max.config:getXSLTAddons($project, $route):)
   let $res := <div id='pagerBlocks'>
               <h4>{$navLinks}</h4>
                 <h2 class="subpart titreVolume">{$transformedTitle}</h2>
               {$navLinks}
               {$html}
         </div>     
   return max.html:render($project, $route, $res)
@@ -46,7 +50,7 @@ function max.plugin.pager:paginate($project as xs:string, $route as xs:string, $
declare
%rest:GET
%output:method("html")
%rest:path("/editions/{$project}/{$route=.*\.xml}/page/{$n}/{$id}")
%rest:path("/{$project}/{$route=.*\.xml}/page/{$n}/{$id}")
function max.plugin.pager:paginateWithTarget($project as xs:string, $route as xs:string, $n as xs:integer, $id){
  let $html := max.plugin.pager:paginate($project, $route, $n)
  return copy $c := $html
@@ -144,7 +148,7 @@ declare function max.plugin.pager:getPageForID($project, $id){
declare
%rest:GET
%output:method("html")
%rest:path("editions/{$project}/{$routeDoc=.*\.xml}/{$id}/page")
%rest:path("/{$project}/{$routeDoc=.*\.xml}/{$id}/page")
function max.plugin.pager:getFragmentPage($project,$routeDoc,$id){
   let $context := max.config:getProjectDBPath($project)
   (:gets plugin's parameters from config file:)     
@@ -166,7 +170,7 @@ declare function max.plugin.pager:getBackToTxtURL($project,$routeDoc,$id){
declare
%rest:GET
%output:method("html")
%rest:path("editions/{$project}/pager/report")
%rest:path("/{$project}/pager/report")
function max.plugin.pager:check($project){
  let $pluginConfig := max.config:getPluginByName($project, $max.plugin.pager:PLUGIN_ID)