Loading plugins/pager/pager.css +11 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,8 @@ color: #000000; } .curPageLink { background: #ff8822; /* background: #ff8822;*/ background: #ddd; text-decoration: none; padding: 2px; } Loading @@ -24,6 +25,7 @@ #pagerNav { width: 50%; margin: auto; font-size:1.5em; } #lastPage, #firstPage { Loading @@ -34,3 +36,11 @@ #firstPage:visited { color: #000000; } .max-doc-title { overflow:visible; } #pagerBlocks h2.subpart { text-align:left; } plugins/pager/pager.js +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 plugins/pager/pager.xqm +9 −5 Original line number Diff line number Diff line Loading @@ -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()] Loading @@ -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), Loading @@ -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) Loading @@ -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 Loading Loading @@ -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:) Loading @@ -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) Loading Loading
plugins/pager/pager.css +11 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,8 @@ color: #000000; } .curPageLink { background: #ff8822; /* background: #ff8822;*/ background: #ddd; text-decoration: none; padding: 2px; } Loading @@ -24,6 +25,7 @@ #pagerNav { width: 50%; margin: auto; font-size:1.5em; } #lastPage, #firstPage { Loading @@ -34,3 +36,11 @@ #firstPage:visited { color: #000000; } .max-doc-title { overflow:visible; } #pagerBlocks h2.subpart { text-align:left; }
plugins/pager/pager.js +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
plugins/pager/pager.xqm +9 −5 Original line number Diff line number Diff line Loading @@ -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()] Loading @@ -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), Loading @@ -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) Loading @@ -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 Loading Loading @@ -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:) Loading @@ -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) Loading