Commit fac1df9f authored by Arnaud Daret's avatar Arnaud Daret Committed by Jerome Chauveau
Browse files

Quelques corrections mineures

parent 8ff1f456
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -82,10 +82,10 @@ function max:page($project, $page){
                        let $content := max.html:getHTMLFragment($project, $page)

                        let $contentWithFooter :=
                            <div>
                            <main>
                                {$content}
                                {max.html:getFooter($project)}
                            </div>
                            </main>

                        return max.html:render($project, $page, $contentWithFooter, ())
                    }
@@ -239,7 +239,7 @@ function max:checkPlugin($project){
                </ul>
            let $report :=
                <div id='pluginsReport'>
                    <div>Installed plugin(s): {string($plugins)}</div>
                    <div>Installed plugin(s): {string-join($plugins,', ')}</div>
                    {$reports}
                </div>
            return $report
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ Vous pouvez nous contacter via [contact.certic@unicaen.fr](mailto:contact.certic
## Installation

```bash
$ cd tools && ./max.sh --init
$ cd tools && ./max.sh -i
# change dir to your basex app folder
$ cd </path/to/basex>/webapp
# create a symlink on your MaX instance
@@ -129,7 +129,7 @@ L'entrée home pointera vers l'URL **http://{...}/myedition/accueil** et contien

#### Modification de la mise en forme du menu

Le menu HTML est le résultat de la transformation du fichiers **myedition/menu.xml** par la feuille XSL par défaut placée dans **MAX/ui/menu.xsl**.
Le menu HTML est le résultat de la transformation du fichiers **myedition/menu.xml** par la feuille XSL par défaut placée dans **MAX/ui/xsl/menu.xsl**.

Une feuille de transformation placée dans **myedition/ui/xsl/menu.xsl** remplacera celle par défaut. 3 paramètres sont disponibles dans cette XSL :

+8 −3
Original line number Diff line number Diff line
@@ -13,8 +13,10 @@ function max.file:projectUIFile(
  $filePath as xs:string){

    let $path := file:parent(file:parent(static-base-uri())) || "/editions/" || $project || "/ui/"  || $filePath
    return max.util:rawFile($path)

    return if (file:exists($path))
    then
         max.util:rawFile($path)
    else ()
};

(:
@@ -25,7 +27,10 @@ declare
function max.file:UIFile(
  $filePath as xs:string){
    let $path := file:parent(file:parent(static-base-uri())) || "/ui/"  || $filePath
    return max.util:rawFile($path)
    return if (file:exists($path))
    then
         max.util:rawFile($path)
    else ()
};

(:
+43 −53
Original line number Diff line number Diff line
window.MAX_LOCAL_STORAGE_PREFIX = "MaXLS.";
window.MAX_VISIBLE_PROPERTY_STRING = "visible";
window.NOTE_TO_TXT_CLASS = ".note_to_text";

const console = window.console;

class Max {
    constructor(pid, baseURL, pluginsURL, fid) {
        this.projectID = pid;
        this.baseURL = baseURL;
        this.pluginsBaseURL = pluginsURL;
    this.plugins = new Array();
        this.plugins = [];
        this.fragmentID = fid;
    }

    run() {
    if(this.isInFragmentContext())
    {     
        if (this.isInFragmentContext()) {

            if (this.isWithNotes()) {
                //ajout d'une colonne de notes + placement
@@ -31,22 +30,23 @@ class Max {
            if ($("#bas_de_page .footnote").length > 0)
                $("#bas_de_page").show();
        }
    if($("#scrollfocus").length == 1){
       this.scrollToID("scrollfocus")
        if ($("#scrollfocus").length === 1) {
            this.scrollToID("scrollfocus");
        }

    }

    getProjectID() {
        return this.projectID;
    }

    getFragmentID() {
        return this.fragmentID;
  };
    }

    addPlugin(p) {
        this.plugins.push(p);
    console.log(p.getName() + " plugin was added")
        console.log(p.getName() + " plugin was added");
    }

    getBaseURL() {
@@ -63,59 +63,53 @@ class Max {
    }

    scrollToElement(element, delay) {
      var offset = $('#topbar').length == 1 ? $('#topbar').height() 
        + ($('#breadcrumb').length ==1  ? $('#breadcrumb').height() : 0) + 10 : 0;
        let offset = $('#topbar').length === 1 ? $('#topbar').height()
            + ($('#breadcrumb').length === 1 ? $('#breadcrumb').height() : 0) + 10 : 0;
        if (element.offset() != null)
            $('html, body').animate({
                scrollTop: element.offset().top - offset
            }, delay);
  }; 
  
    }

    textOptions() {
        //shows option's button if needed
      if($("#options-list li").length > 0)
      {
        if ($("#options-list li").length > 0) {
            $("#txt_options").show();
        }

        //checkbox options (load from localstorage)
        $(".visibility_toggle").each(function () {
        var optionName = $(this).data('option');
        if(localStorage.
              getItem(MAX_LOCAL_STORAGE_PREFIX + optionName) === MAX_VISIBLE_PROPERTY_STRING) 
          {    
            let optionName = $(this).data('option');
            if (localStorage.getItem(window.MAX_LOCAL_STORAGE_PREFIX + optionName) === window.MAX_VISIBLE_PROPERTY_STRING) {
                $(this).attr("checked", "checked");
                //updates visibility
                $("." + optionName).show();
          }
          else{
            } else {
                $(this).removeAttr("checked");
                //updates visibility
                $("." + optionName).hide();
            }

      })
        });
    }

  
    manageMarginNotes() {
      var mainContainer = $("#main-max-container");
      var leftBloc = mainContainer.children(":first");
        let mainContainer = $("#main-max-container");
        let leftBloc = mainContainer.children(":first");
        leftBloc.addClass("row");
        $("#text").addClass("col-sm-8");
        leftBloc.append("<div id='margin_notes' class='col-sm-2'></div>");

      var previousNote = null;
        let previousNote = null;
        $(".manchette_droite").each(function () {
            //stocke le top original avant de déplacer la note
        var originalTop = $(this).position().top;
            let originalTop = $(this).position().top;
            //déplacement de la note dans la colonne prévue
            $(this).appendTo("#margin_notes");
            //mise à jour top (+anti-chevauchement)
        var newTop = originalTop;
            let newTop = originalTop;
            if (previousNote != null && previousNote.position() != null) {
           var bottomPrevious = previousNote.position().top + previousNote.height();
                let bottomPrevious = previousNote.position().top + previousNote.height();
                if (bottomPrevious + 5 > newTop) {
                    newTop = bottomPrevious + 5;
                }
@@ -130,11 +124,11 @@ class Max {
      Branchements 'onClick' notes de bas de page
    */
    bindNotesClick() {
    var me = this;
    $(NOTE_TO_TXT_CLASS).click(function(event){
        let _this = this;
        $(window.NOTE_TO_TXT_CLASS).click(function (event) {
            event.preventDefault();
        var target = $(this).attr("href").replace('#','');
        me.scrollToID(target);
            let target = $(this).attr("href").replace('#', '');
            _this.scrollToID(target);
        });
    }

@@ -142,37 +136,35 @@ class Max {
    bindNavigationTool() {
        //local function : find next or previous nav link
        let nextOrPrevious = function (step) {
       var current = $("#navigation-tool").find('button').attr("id").replace("selected-","");//remove 'selected' prefix
            let current = $("#navigation-tool").find('button').attr("id").replace("selected-", "");//remove 'selected' prefix
            let links = $('#dropdown-navigation').find('li');
            let position = links.index(document.getElementById(current));
            let nextOrPrevious = links.get(position + step);
            window.location.href = $(nextOrPrevious).find('a').attr("href");
    }
        };

        if ($('#nav_previous').length) {
            $('#nav_previous').click(
        function(evt){
                function () {
                    nextOrPrevious(-1);
                });
        }
        if ($('#nav_next').length) {
            $('#nav_next').click(
        function(evt){
                function () {
                    nextOrPrevious(1);
                });
        }
    }


  
    bindTooltips() {
        try {
            $('[data-toggle="tooltip"]').each(function () {
                var noteNumber = $(this).attr('id').substr(5);
                let noteNumber = $(this).attr('id').substr(5);
                //clones bottom page note
                var noteContent = $("#wrap_bdp_" + noteNumber).clone();
                let noteContent = $("#wrap_bdp_" + noteNumber).clone();
                //removes note call (</a>)
                noteContent.find(NOTE_TO_TXT_CLASS).remove();
                noteContent.find(window.NOTE_TO_TXT_CLASS).remove();
                //tooltip mapping
                $(this).tooltip(
                    {
@@ -185,13 +177,14 @@ class Max {
                    }
                );
            });
        } catch (e) {
            console.log('tooltips error ' + e);
        }
          catch(e){ console.log('tooltips error ' + e)}
    }

    runPlugins() {
        for (let i = 0; i < this.plugins.length; i++)
       this.plugins[i].run()
            this.plugins[i].run();
    }

    /*
@@ -199,10 +192,9 @@ class Max {
     d'un fragment (présence d'un élement identifié 'text')
   */
    isInFragmentContext() {
    return $("#text").length > 0
        return $("#text").length > 0;
    }

  
    isWithNotes() {
        return $(".note").length > 0;
    }
@@ -214,15 +206,13 @@ class Max {

        if ($('#toggle_' + className).prop("checked")) {
            $("." + className).show();
      localStorage.setItem(MAX_LOCAL_STORAGE_PREFIX + className, MAX_VISIBLE_PROPERTY_STRING);
    }
    else{
            localStorage.setItem(window.MAX_LOCAL_STORAGE_PREFIX + className, window.MAX_VISIBLE_PROPERTY_STRING);
        } else {
            $("." + className).hide();
      localStorage.removeItem(MAX_LOCAL_STORAGE_PREFIX + className);
            localStorage.removeItem(window.MAX_LOCAL_STORAGE_PREFIX + className);
        }
    }

  
    toString() {
        return this.projectID + "s MaX";
    }
@@ -230,8 +220,8 @@ class Max {

window.MAX = new Max(projectId, baseURI, pluginsBaseURI, fragmentId);


$(document).ready(function () {
  MAX.run()
})
    "use strict";
    window.MAX.run();
});
+1 −1
Original line number Diff line number Diff line
class Plugin {
  constructor(name) {
    this.name = name;
    console.log('Plugin '+ name + ' built !')
    window.console.log('Plugin '+ name + ' built !')
  }

  getName(){
Loading