Commit b551beb6 authored by Marie Bisson's avatar Marie Bisson
Browse files

Merge branch 'dev' into mb/ead-corr-mineure

Récupération des développements de Jérôme
parents 53824c02 30c41331
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -5,3 +5,4 @@
/configuration/configuration.xml
.idea
.DS_Store
/plugins/**/.ignore
 No newline at end of file
+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
+1 −1
Original line number Diff line number Diff line
@@ -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,
+4 −3
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ class MaxTEI extends AbstractMax {
    }

    scrollToID(id) {
        this.scrollToElement($("#" + id.replace(".", "\\.")));
        this.scrollToElement($("#" + id.replaceAll(".", "\\.")));
    }

    scrollToElement(element, delay) {
@@ -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");
        };
+1 −1
Original line number Diff line number Diff line
@@ -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