Loading .gitignore +2 −1 Original line number Diff line number Diff line Loading @@ -5,3 +5,4 @@ /configuration/configuration.xml .idea .DS_Store /plugins/**/.ignore No newline at end of file plugins/sources_export/sources_export.xqm 0 → 100644 +43 −0 Original line number Diff line number Diff line xquery version "3.0"; module namespace max.plugin.sources_export = 'pddn/max/plugin/sources_export'; import module namespace max.config = 'pddn/max/config' at '../../rxq/config.xqm'; declare %rest:GET %output:media-type("application/octet-stream") %rest:path("/{$project}/{$archive}.zip") function max.plugin.sources_export:export($project, $archive){ if($project != $archive) then fn:error(xs:QName("err:sources_export"), "Archive does not exist : '" || $archive||".zip'") else let $db := max.config:getProjectDBPath($project) let $zipName := $project||'.zip' let $tmpDir := file:create-temp-dir('max-export',$project) let $dest := $tmpDir ||'/'||$zipName return ( db:export($db, $tmpDir), max.plugin.sources_export:makeZip($project,$tmpDir, $dest), (<rest:response> <http:response status="200"> <http:header name="content-type" value="application/octet-stream"/> <http:header name="Content-Disposition" value="attachment; filename={$zipName}"/> </http:response> </rest:response>, file:read-binary($dest) ), file:delete($tmpDir,true()) ) }; declare %private function max.plugin.sources_export:makeZip($project,$directory, $dest){ let $files := file:list($directory, true(), '*.xml') let $zip := archive:create($files, for $file in $files return file:read-binary($directory || $file) ) return file:write-binary($dest, $zip) }; No newline at end of file rxq/html.xqm +1 −1 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ declare function max.html:getFooter($project){ declare function max.html:getNavbarForDocument($project, $doc, $selectedId){ let $xml := max.toc:getDocumentTOC($project, $doc) (:max.route:getRouteNavigationEntriesAsHTML($project, $routeId):) let $hasTarget := $xml//ul//li[@id=$selectedId] let $hasTarget := $xml//ul//li[@data-target=$selectedId] return if (count($xml//ul/li) > 1 and $hasTarget) then xslt:transform($xml, Loading ui/js/MaxTEI.js +4 −3 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class MaxTEI extends AbstractMax { } scrollToID(id) { this.scrollToElement($("#" + id.replace(".", "\\."))); this.scrollToElement($("#" + id.replaceAll(".", "\\."))); } scrollToElement(element, delay) { Loading Loading @@ -109,9 +109,10 @@ class MaxTEI extends AbstractMax { bindNavigationTool() { //local function : find next or previous nav link let nextOrPrevious = function (step) { let current = $("#navigation-tool").find('button').attr("id").replace("selected-", "");//remove 'selected' prefix let current = $("#navigation-tool").find('button').attr("data-target").replace("selected-", "");//remove 'selected' prefix let links = $('#dropdown-navigation').find('li'); let position = links.index(document.getElementById(current)); let position = links.index(document.querySelector('li[data-target='+current+']')); console.log(position); let nextOrPrevious = links.get(position + step); window.location.href = $(nextOrPrevious).find('a').attr("href"); }; Loading ui/xsl/tei/document_toc.xsl +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ <xsl:template match="tei:li"> <li> <xsl:attribute name="id"> <xsl:attribute name="data-target"> <xsl:value-of select="@id"/> </xsl:attribute> <xsl:apply-templates/> Loading Loading
.gitignore +2 −1 Original line number Diff line number Diff line Loading @@ -5,3 +5,4 @@ /configuration/configuration.xml .idea .DS_Store /plugins/**/.ignore No newline at end of file
plugins/sources_export/sources_export.xqm 0 → 100644 +43 −0 Original line number Diff line number Diff line xquery version "3.0"; module namespace max.plugin.sources_export = 'pddn/max/plugin/sources_export'; import module namespace max.config = 'pddn/max/config' at '../../rxq/config.xqm'; declare %rest:GET %output:media-type("application/octet-stream") %rest:path("/{$project}/{$archive}.zip") function max.plugin.sources_export:export($project, $archive){ if($project != $archive) then fn:error(xs:QName("err:sources_export"), "Archive does not exist : '" || $archive||".zip'") else let $db := max.config:getProjectDBPath($project) let $zipName := $project||'.zip' let $tmpDir := file:create-temp-dir('max-export',$project) let $dest := $tmpDir ||'/'||$zipName return ( db:export($db, $tmpDir), max.plugin.sources_export:makeZip($project,$tmpDir, $dest), (<rest:response> <http:response status="200"> <http:header name="content-type" value="application/octet-stream"/> <http:header name="Content-Disposition" value="attachment; filename={$zipName}"/> </http:response> </rest:response>, file:read-binary($dest) ), file:delete($tmpDir,true()) ) }; declare %private function max.plugin.sources_export:makeZip($project,$directory, $dest){ let $files := file:list($directory, true(), '*.xml') let $zip := archive:create($files, for $file in $files return file:read-binary($directory || $file) ) return file:write-binary($dest, $zip) }; No newline at end of file
rxq/html.xqm +1 −1 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ declare function max.html:getFooter($project){ declare function max.html:getNavbarForDocument($project, $doc, $selectedId){ let $xml := max.toc:getDocumentTOC($project, $doc) (:max.route:getRouteNavigationEntriesAsHTML($project, $routeId):) let $hasTarget := $xml//ul//li[@id=$selectedId] let $hasTarget := $xml//ul//li[@data-target=$selectedId] return if (count($xml//ul/li) > 1 and $hasTarget) then xslt:transform($xml, Loading
ui/js/MaxTEI.js +4 −3 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class MaxTEI extends AbstractMax { } scrollToID(id) { this.scrollToElement($("#" + id.replace(".", "\\."))); this.scrollToElement($("#" + id.replaceAll(".", "\\."))); } scrollToElement(element, delay) { Loading Loading @@ -109,9 +109,10 @@ class MaxTEI extends AbstractMax { bindNavigationTool() { //local function : find next or previous nav link let nextOrPrevious = function (step) { let current = $("#navigation-tool").find('button').attr("id").replace("selected-", "");//remove 'selected' prefix let current = $("#navigation-tool").find('button').attr("data-target").replace("selected-", "");//remove 'selected' prefix let links = $('#dropdown-navigation').find('li'); let position = links.index(document.getElementById(current)); let position = links.index(document.querySelector('li[data-target='+current+']')); console.log(position); let nextOrPrevious = links.get(position + step); window.location.href = $(nextOrPrevious).find('a').attr("href"); }; Loading
ui/xsl/tei/document_toc.xsl +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ <xsl:template match="tei:li"> <li> <xsl:attribute name="id"> <xsl:attribute name="data-target"> <xsl:value-of select="@id"/> </xsl:attribute> <xsl:apply-templates/> Loading