Commit a1593835 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

Merge branch 'dev'

parents 48ec3a1c e4b21fc0
{
"directory": "ui/js/lib"
}
\ No newline at end of file
......@@ -2,4 +2,6 @@
/node_modules
/ui/js/lib
/editions/*
/configuration/configuration.xml
\ No newline at end of file
/configuration/configuration.xml
.idea
.DS_Store
\ No newline at end of file
FROM basex/basexhttp:latest
MAINTAINER Certic-Pdn TEAM <contact.certic@unicaen.fr>
COPY . /srv/BaseXWeb
\ No newline at end of file
COPY max.xq /srv/basex/webapp
COPY rxq /srv/basex/webapp/rxq
COPY configuration /srv/basex/webapp/configuration
COPY editions /srv/basex/webapp/editions
COPY plugins /srv/basex/webapp/plugins
COPY ui /srv/basex/webapp/ui
COPY node_modules/bootstrap/dist/js/bootstrap.bundle.min.js /srv/basex/webapp/ui/lib
COPY node_modules/bootstrap/dist/css/bootstrap.min.css /srv/basex/webapp/ui/lib
COPY node_modules/bootstrap/dist/js/bootstrap.min.js /srv/basex/webapp/ui/lib
COPY node_modules/jquery/dist/jquery.min.js /srv/basex/webapp/ui/lib
COPY node_modules/popper.js/dist/popper.min.js /srv/basex/webapp/ui/lib
{
"name": "max",
"description": "Moteur d'Affichage XML",
"main": "",
"moduleType": [],
"license": "MIT",
"homepage": "",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"MathJax": "~2.5.3",
"jquery": "~2.1.4",
"jstree": "~3.2.1",
"jquery-ui": "~1.11.4",
"openseadragon": "~2.1.0"
},
"devDependencies": {
"jquery": "~2.1.4",
"MathJax": "~2.5.3",
"jstree": "~3.2.1",
"less": "~2.5.3",
"jQuery.dotdotdot": "~1.7.4",
"bootstrap": "~3.3.6"
}
}
var gulp = require('gulp'),
rename = require('gulp-rename'),// Renommage des fichiers
less = require('gulp-less'),// Conversion LESS en CSS
uglify = require('gulp-uglify'), //Minification/Obfuscation des JS
gutil = require('gulp-util');
//COMPILATION DES FICHIERS LESS
gulp.task('compile-less', function () {
gulp.src('./ui/css/*.less') // path to your file
.pipe(less().on('error', function(err) {
console.log(err);
}))
.pipe(gulp.dest('./ui/css/'));
});
gulp.task('compile-less-addons', function () {
gulp.src('./plugins/**/*.less') // path to your file
.pipe(less().on('error', function(err) {
console.log(err);
}))
.pipe(gulp.dest('./plugins'));
});
//MINIFICATION DES FICHIER JS
gulp.task('js-uglify', function()
{
return gulp.src('./ui/js/src/*.js') // Prend en entrée les fichiers *.js
.pipe(rename(function(path){
// Il y a différentes méthodes pour renommer les fichiers
// Voir ici pour plus d'infos : https://www.npmjs.org/package/gulp-rename
path.basename = path.basename.replace(".src", ".min");
}))
.pipe(uglify())
.pipe(gulp.dest('./ui/js/dist/'));
});
gulp.task('js-uglify-addons', function()
{
return gulp.src(//todo: auto list uiAddons and plugins js files...
[
'./plugins/correction/*.js',
'./plugins/equations/*.js',
'./plugins/pager/*.js',
'./plugins/search/*.js',
'./plugins/apparat_critique/*.js',
'./plugins/img_viewer/*.js',
'./plugins/breadcrumb/*.js',
])
.pipe(rename(function(path){
// Il y a différentes méthodes pour renommer les fichiers
// Voir ici pour plus d'infos : https://www.npmjs.org/package/gulp-rename
console.log("Minification de " + path.basename +".js")
path.basename = path.basename.replace(".src", ".min");
}))
.pipe(uglify().on('error',gutil.log))
.pipe(gulp.dest('./ui/js/dist/'));
});
gulp.task('watch', function(){
gulp.watch('./ui/js/src/*.js', ['js-uglify']);
gulp.watch('./ui/uiAddons/**/*.js', ['js-uglify-addons']);
gulp.watch('./plugins/**/*.js', ['js-uglify-addons']);
gulp.watch('./plugins/**/*.less', ['compile-less-addons']);
gulp.watch('./ui/css/*.less', ['compile-less']);
});
//building task
gulp.task('build',['compile-less', 'compile-less-addons', 'js-uglify','js-uglify-addons']);
gulp.task('default', ['watch']);
This diff is collapsed.
{
"name": "MaX",
"version": "0.0.0",
"description": "",
"main": "gulpfile.js",
"version": "1.0.0",
"description": "Moteur d'Affichage XML / XML renderer engine",
"main": "max.js",
"repository": "git@git.unicaen.fr:pdn-certic/MaX.git",
"author": "JC / Certic / DSI / Unicaen",
"license": "CECILL",
"private": true,
"scripts": {},
"dependencies": {
"fs": "0.0.2",
"gulp-util": "^3.0.7",
"babel-polyfill": "^6.26.0",
"bootstrap": "^4.3.1",
"child_process": "^1.0.2",
"fs": "0.0.1-security",
"install": "^0.12.1",
"jquery": "^3.3.1",
"mathjax": "^2.7.7",
"openseadragon": "^2.4.1",
"popper.js": "^1.14.7",
"readline": "^1.3.0",
"xmldom": "^0.1.21"
},
"devDependencies": {
"gulp": "^3.9.0",
"gulp-less": "^3.0.5",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.5.1",
"jstree": "^3.2.1",
"less": "^2.5.3",
"mathjax": "^2.5.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": ""
"xmldom": "^0.1.31"
}
}
.am{
color:black;
display:none;
}
.ex{
color:black;
}
\ No newline at end of file
import {Plugin} from '../../core/ui/js/Plugin.js';
const EX_CLASS = "ex";
const AM_CLASS = "am";
class AbreviationPlugin extends Plugin{
constructor(name) {
super(name);
}
run(){
console.log("Plugin abréviation running")
var checkAttr = "";
if(localStorage.
getItem(MAX_LOCAL_STORAGE_PREFIX + EX_CLASS) === MAX_VISIBLE_PROPERTY_STRING)
{
checkAttr = "checked='checked' ";
//updates visibility
this.on();
}
else{
//updates visibility
this.off();
}
$("#options-list").append("<li><a><input id='toggle_ex' type='checkbox' "
+checkAttr
+" name='toggle_ex'>Développer les abréviations</a></li>");
let self = this;
$('#toggle_ex').change(function(){
self.setExVisible()
})
}
setExVisible(){
if($('#toggle_ex').is(":checked"))
{
this.on();
localStorage.setItem(MAX_LOCAL_STORAGE_PREFIX + EX_CLASS, MAX_VISIBLE_PROPERTY_STRING);
}
else{
this.off();
localStorage.removeItem(MAX_LOCAL_STORAGE_PREFIX + EX_CLASS);
}
}
/*ex visibles*/
on(){
$("." + AM_CLASS).hide();
$("." + EX_CLASS).show();
}
/*corr hidden (sic visibles)*/
off(){
$("." + AM_CLASS).show();
$("." + EX_CLASS).hide();
}
}
MAX.addPlugin(new AbreviationPlugin('Abreviation'));
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tei="http://www.tei-c.org/ns/1.0"
exclude-result-prefixes="tei xsl">
<xsl:template match="//tei:choice">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="//tei:am | //tei:ex">
<span>
<xsl:attribute name="class">
<xsl:value-of select="local-name(.)"/>
</xsl:attribute>
<xsl:apply-templates/>
</span>
</xsl:template>
<xsl:template match="//tei:abbr">
<span class="am">
<xsl:apply-templates/>
</span>
</xsl:template>
<xsl:template match="//tei:expan">
<span class="ex">
<xsl:apply-templates/>
</span>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
.add{
color:#1b9044;
}
.add[title] {
cursor:default;
}
.del{
text-decoration:line-through;
}
import {Plugin} from '../../core/ui/js/Plugin.js';
const ADD_CLASS = "add";
const DEL_CLASS = "del";
class AjoutPlugin extends Plugin{
constructor(name) {
super(name);
}
run(){
console.log("Plugin ajout running")
var checkAttr = "";
if(localStorage.
getItem(MAX_LOCAL_STORAGE_PREFIX + ADD_CLASS) === MAX_VISIBLE_PROPERTY_STRING)
{
checkAttr = "checked='checked' ";
//updates visibility
this.on();
}
else{
//updates visibility
this.off();
}
$("#options-list").append("<li><a><input id='toggle_add' type='checkbox' "
+checkAttr
+" name='toggle_add'>Afficher les interventions</a></li>");
let self = this;
$('#toggle_add').change(function(){
self.setExVisible()
})
}
setExVisible(){
if($('#toggle_add').is(":checked"))
{
this.on();
localStorage.setItem(MAX_LOCAL_STORAGE_PREFIX + ADD_CLASS, MAX_VISIBLE_PROPERTY_STRING);
}
else{
this.off();
localStorage.removeItem(MAX_LOCAL_STORAGE_PREFIX + ADD_CLASS);
}
}
/* la balise add est mise en vert et la balise del est affichée */
on(){
$("." + ADD_CLASS).css("color","green");
$("." + DEL_CLASS).show();
$("." + DEL_CLASS).css("color","initial");
}
/* la balise add est affichée mais la balise del est masquée */
off(){
$("." + ADD_CLASS).css("color","inherit");
$("." + DEL_CLASS).hide();
}
}
MAX.addPlugin(new AjoutPlugin('Ajout'));
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
For conditions of distribution and use, see the accompanying legal.txt file.
-->
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tei="http://www.tei-c.org/ns/1.0"
exclude-result-prefixes="tei xsl">
<xsl:template match="//tei:subst"><xsl:apply-templates/></xsl:template>
<xsl:template match="//tei:del | //tei:add">
<span>
<xsl:attribute name="class">
<xsl:value-of select="local-name(.)"/>
</xsl:attribute><xsl:apply-templates/>
</span>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
var moduleApparat = new Object();
const PLUGIN_NAME="apparat";
import {Plugin} from '../../core/ui/js/Plugin.js';
const PLUGIN_NAME='apparat';
class ApparatPlugin extends Plugin{
constructor(name) {
super(name);
//this.lacunaryWitnesses = new Array();
}
var lacunaryWitnesses = new Array();
run(){
//si le fragment courant ne contient pas d'apparat
if(!this.docWithApparat())
return;
moduleApparat['onTextChange'] = function() {
//sinon
console.log(MAX.getProjectID())
var route = (window.location.href.split("/" + MAX.getProjectID() +"/")[1]).split(".xml")[0] + ".xml";
var witnessQueryURL =
MAX.getPluginsBaseURL() + "/" + PLUGIN_NAME + "/"+route;
$.get(witnessQueryURL, function(data){
$('#options-list').append(data);
$('#txt_options').show();
});
if(MAX.getFragmentID() !== ""){
//récupération des témoins intégralement lacunaire sur le fragment courant
$.get(MAX.getPluginsBaseURL() + "/" + PLUGIN_NAME + "/lacunarywit/" + route+"/"+MAX.getFragmentID(),
function(data){
})
}
this.showWitness("lem");
this.witnessTooltiping();
}
//si le fragment courant ne contient pas d'apparat
if(!docWithApparat())
return;
//sinon
var route = (window.location.href.split("/" + MAX.getProjectID() +"/")[1]).split(".xml")[0] + ".xml";
var witnessQueryURL =
MAX.getPluginsBaseURL() + "/" + PLUGIN_NAME + "/"+route;
$.get(witnessQueryURL, function(data){
$('#options-list').append(data);
$('#txt_options').show();
});
if(MAX.getFragmentId() !== ""){
//récupération des témoins intégralement lacunaire sur le fragment courant
$.get(MAX.getPluginsBaseURL() + "/" + PLUGIN_NAME + "/lacunarywit/" + route+"/"+MAX.getFragmentId(),
function(data){
})
}
showWitness("lem");
witnessTooltiping();
};
showWitness(witnessClass){
$(".apparat").hide();
$("."+witnessClass).show();
this.hideLacunas(witnessClass);
}
MAX.addModule(moduleApparat);
function showWitness(witnessClass){
$(".apparat").hide();
$("."+witnessClass).show();
hideLacunas(witnessClass);
}
witnessTooltiping(){
$('[data-witnesses]').each(function(){
var wlist = $(this).attr("data-witnesses").replace(" ",", ");
$(this).attr("title", wlist);
$(this).tooltip(
{
html:true, // allows html content
content: "<div><em>Témoins:</em> "+wlist+"</div>"
}
);
});
function witnessTooltiping(){
$('[data-witnesses]').each(function(){
var wlist = $(this).attr("data-witnesses").replace(" ",", ");
$(this).attr("title", wlist);
$(this).tooltip(
{
html:true, // allows html content
content: "<div><em>Témoins:</em> "+wlist+"</div>"
}
);
});
}
}
function hideLacunas(witId){
hideLacunas(witId){
/*masque les lacunas à partir des lacunaStarts
- cherche la lacuneEnd correspondante
- Si la lacunaEnd n'existe pas (elle se trouve dans un autre fragment),
l'intégralité du texte suivant est masqué
*/
var self = this;
$('.lacunaStart').each(function(){
if($(this).attr('data-lacuna-wit').indexOf('\#'+witId)>-1){
//on echappe les . et # de l'id cible de la lacunaEnd correspondante
var searchedId = "#" + $(this).attr('data-lacuna-synch').replace(/([#.])/g,'\\$1')
var endElement = $(searchedId)
console.log('traitement de la lacuna '+ $(this).attr('id'));
endElement = endElement.size() === 0 ? $('#bas_de_page') : endElement
var eltsBetween = $(getElementsBetweenTree(($(this))[0], endElement[0]))
console.log("Nombre d'éléments à masquer (lacune "+$(this).attr('id')+")"+eltsBetween.size());
endElement = endElement.length === 0 ? $('#bas_de_page') : endElement
var eltsBetween = $(self.getElementsBetweenTree(($(this))[0], endElement[0]))
console.log("Nombre d'éléments à masquer (lacune "+$(this).attr('id')+")"+eltsBetween.length);
eltsBetween.each(function(){
$(this).wrap("<span class='generated_lacuna'></span>")
})
......@@ -76,12 +80,10 @@ function hideLacunas(witId){
des fragments qui précédent et suivent le fragment courant:
nécessite une requête sur la DB pour accedéer aux autres noeuds XML*/
}
/****************************************/
function getElementsBetweenTree(start, end) {
var ancestor= getCommonAncestor(start, end);
}
getElementsBetweenTree(start, end) {
var ancestor= this.getCommonAncestor(start, end);
var before= [];
while (start.parentNode!==ancestor) {
......@@ -105,21 +107,25 @@ function getElementsBetweenTree(start, end) {
return before.concat(after);
}
// Get the innermost element that is an ancestor of two nodes.
//
function getCommonAncestor(a, b) {
var parents= $(a).parents().andSelf();
while (b) {
var ix= parents.index(b);
if (ix!==-1)
return b;
b= b.parentNode;
}
return null;
}
/****************************************/
// Get the innermost element that is an ancestor of two nodes.
//
getCommonAncestor(a, b) {
var parents= $(a).parents().addBack();
while (b) {
var ix= parents.index(b);
if (ix!==-1)
return b;
b= b.parentNode;
}
return null;
}
docWithApparat(){
return ($(".apparat").length + $(".lacunaStart").length + $(".lacunaEnd").length) > 0
}
function docWithApparat(){
return ($(".apparat").size() + $(".lacunaStart").size() + $(".lacunaEnd").size()) > 0
}
\ No newline at end of file
}
let apparat = new ApparatPlugin('Apparat')
window.apparat = apparat;
MAX.addPlugin(apparat);
\ No newline at end of file
......@@ -11,14 +11,14 @@ Route witnesses list
declare
%rest:GET
%output:method("html")
%rest:path("/editions/{$project}/doc/{$route=.*\.xml}/getwitnesses")
%rest:path("/{$project}/doc/{$route=.*\.xml}/getwitnesses")
function max.plugin.apparat_critique:getRouteWitnesses($project, $route){
<ul>
{ (:todo: removes bootstrap classes (should be only added in html way):)
for $w in doc(max.config:getProjectDBPath($project) || "/" || $route)//*:listWit//*:witness[@xml:id]
let $idAsText := string($w/@xml:id)
return <li class="witness_item">
<input onchange='showWitness("{$idAsText}")'
<input onchange='apparat.showWitness("{$idAsText}")'
type='radio'
name='witnesses'
class='witness'
......@@ -34,13 +34,13 @@ Route witnesses list as html
declare
%rest:GET
%output:method("html")
%rest:path("/editions/{$project}/plugins/apparat/{$route=.*\.xml}")
%rest:path("/{$project}/plugins/apparat/{$route=.*\.xml}")
function max.plugin.apparat_critique:getRouteWitnessesAsHTML($project, $route)
{