Commit 6bbc535d authored by Alexandre Morin's avatar Alexandre Morin

Merge branch 'Support/2.5.X' into 'master'

Support/2.5.x

See merge request !379
parents 9d9fdd31 35873253
Pipeline #5674 passed with stage
in 8 minutes and 38 seconds
......@@ -2,7 +2,14 @@
## Version 2.5.2
- `Fixed` Correctif concernant les demandes de restitution d'archives.
- `Fixed` Rétablissement des demandes de restitution d'archives.
- `Fixed` Les valeurs par défaut des paramètres de fonction dans JavaScript ont été retirées pour compatibilité à Internet Explorer 11.
- `Fixed` Les tableaux s'initialisent correctement lorsqu'un nombre important d'entrées doit être affiché.
- `Fixed` Rétablissement de la navigation entre archives liées.
### Thesaurus
- `Added` Ajout de la possiblité d'utiliser des fichiers CSV ou SKOS personnalisés comme référentiels de thesaurus (fonctionnalité de l'extension *archives publiques*).
## Version 2.5.1
......
......@@ -37,12 +37,13 @@ class Document extends \dependency\xml\Document
------------------------------------------------------------------------- */
protected $layout;
protected $classes;
protected $plugins;
public $plugins;
protected $headers;
protected $layoutData;
public $XPath;
public $translator;
public $dateTimeFormatter;
public $pluginsParameters = [];
/**
* -- document --
* <html>
......@@ -402,15 +403,9 @@ class Document extends \dependency\xml\Document
*/
public function addPlugins($node = null)
{
//var_dump("addPlugins($node->nodeType)");
$elements = $this->XPath->query("descendant-or-self::*[@class]", $node);
foreach ($elements as $element) {
foreach (explode(' ', $element->getAttribute('class')) as $htmlClass) {
if (isset($this->plugins[$htmlClass])) {
$pluginClass = $this->plugins[$htmlClass];
$element->plugin[$htmlClass] = new $pluginClass($element);
}
}
$element->addPlugins();
}
}
......@@ -420,19 +415,9 @@ class Document extends \dependency\xml\Document
*/
public function savePlugins($node = null)
{
$parameters = [];
$elements = $this->XPath->query("descendant-or-self::*[@class]", $node);
foreach ($elements as $element) {
foreach ($element->plugin as $name => $plugin) {
if (method_exists($plugin, 'saveHtml')) {
$plugin->saveHtml();
}
if (!isset($parameters[$name]) && method_exists($plugin, 'saveParameters')) {
$parameters[$name]=$plugin;
$plugin->saveParameters();
}
}
$element->savePlugins();
}
}
......
......@@ -24,7 +24,7 @@ class Element
/* -------------------------------------------------------------------------
- Properties
------------------------------------------------------------------------- */
public $plugin = array();
protected $plugin;
/* -------------------------------------------------------------------------
- Methods
------------------------------------------------------------------------- */
......@@ -99,4 +99,71 @@ class Element
{
return implode(" ", $array);
}
}
\ No newline at end of file
/**
* Returns the requested property
*
* @param string $name
*
* @return mixed
*/
public function __get($name)
{
if ($name == 'plugin' && empty($this->plugin)) {
$this->plugin = new PluginContainer($this);
}
return $this->{$name};
}
/**
* Add plugins
*/
public function addPlugins()
{
foreach (explode(' ', $this->getAttribute('class')) as $htmlClass) {
if (isset($this->ownerDocument->plugins[$htmlClass])) {
if (!isset($this->plugin)) {
$this->plugin = new PluginContainer($this);
}
$this->plugin->add($htmlClass);
}
}
}
/**
* Translate plugins
*/
public function translatePlugins()
{
if (!isset($this->plugin)) {
return;
}
foreach ($this->plugin as $name => $plugin) {
if (method_exists($plugin, 'translate')) {
$plugin->translate();
}
}
}
/**
* Save plugins
*/
public function savePlugins()
{
if (!isset($this->plugin)) {
return;
}
foreach ($this->plugin as $name => $plugin) {
if (method_exists($plugin, 'saveHtml')) {
$plugin->saveHtml();
}
if (method_exists($plugin, 'saveParameters')) {
$plugin->saveParameters();
}
}
}
}
......@@ -253,11 +253,7 @@ trait LocalisationTrait
{
$elements = $this->XPath->query("descendant-or-self::*[@class]", $node);
foreach ($elements as $element) {
foreach ($element->plugin as $name => $plugin) {
if (method_exists($plugin, 'translate')) {
$plugin->translate();
}
}
$element->translatePlugins();
}
}
......
<?php
/*
* Copyright (C) 2019 Maarch
*
* This file is part of dependency html.
*
* Dependency html is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Dependency html is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with dependency html. If not, see <http://www.gnu.org/licenses/>.
*/
namespace dependency\html;
/**
* Element plugins container
*
* @package Dependency\Html
* @author Cyril VAZQUEZ <cyril.vazquez@maarch.org>
**/
class PluginContainer extends \ArrayObject
{
/**
* The owner element of the container
*
* @var DOMElement
*/
protected $element;
/**
* Constructs a new container
* @param DOMElement $element
*/
public function __construct($element)
{
$this->element = $element;
}
/**
* Returns the requested plugin or instancites a new one
*
* @param string $name
*
* @return object
*/
public function offsetGet($name)
{
if (!isset($this[$name]) && isset($this->element->ownerDocument->plugins[$name])) {
$this->add($name);
}
return parent::offsetGet($name);
}
/**
* Adds a plugin from a class
*
* @param string $name
*/
public function add($name)
{
$pluginClass = $this->element->ownerDocument->plugins[$name];
$plugin = new $pluginClass($this->element);
$this[$name] = $plugin;
}
}
......@@ -405,6 +405,36 @@ class archive
$archive->descriptionObject = $archive->descriptionObject[0];
}
$thesaurusNames = [
"corpname",
"famname",
"geogname",
"name",
"occupation",
"persname",
"subject",
"genreform",
"function"
];
$thesaurusList = new \stdClass();
// Set default thesaurus
$thesaurusList->subject = "T1";
$thesaurusList->genreform = "T3";
$thesaurusList->function = "T2";
$conf = \laabs::Configuration()['recordsManagement'];
if (isset($conf['refDirectory']) || is_dir($conf['refDirectory'])) {
$refDirectory = $conf['refDirectory'];
foreach ($thesaurusNames as $thesaurusName) {
if (glob($conf['refDirectory'].'/'.$thesaurusName.'.*')) {
$thesaurusList->$thesaurusName = $thesaurusName;
}
}
}
$this->view->setSource('thesaurus', $thesaurusList);
$this->view->setSource('languageCodes', $languageCodes);
$this->view->setSource("archive", $archive);
......
......@@ -84,9 +84,11 @@
FilePlanLevelToggle = {
load: function (isWithoutProfile = true) {
load: function (isWithoutProfile) {
if (isWithoutProfile === undefined) {
isWithoutProfile = true;
}
if(isWithoutProfile == true) {
if($('#fileplanLevelDiv').is(":hidden")) {
$('#fileplanLevelDiv').show();
}
......@@ -120,7 +122,7 @@
};
$('#app_maarchRM_main').ready(function () {
$("#managementMetadataForm").find("[name=retentionStartDate]").data("datepicker").setDate(new Date());
//$("#managementMetadataForm").find("[name=retentionStartDate]").data("datepicker").setDate(new Date());
});
$("#archiveForm").keypress(function(e) {
......@@ -337,7 +339,12 @@
retentionRuleText = retentionRuleText.replace(/%2\$s/g, numeric+' '+unit);
$('#retentionRuleText').text(retentionRuleText);
},
syncSerialize : function(action = "add") {
syncSerialize : function(action) {
// to inititate default value and avoid bug on IE 11
if (action === undefined)
{
action = "add";
}
var form = $('#archiveForm, #managementMetadataForm');
var inputs = form.find('.archiveInput');
var archive = {
......
......@@ -321,7 +321,7 @@
},
editMetadata: function() {
var archiveInformation=$('#archiveInformation');
var archiveInformation = $('#archiveInformation');
$('#editMetadata').prop('disabled',true);
$('#saveMetadata').show();
$('#cancelMetadataEdition').show();
......
......@@ -277,7 +277,7 @@
})
},
checkRights: function (archivalProfiles, withoutProfile, fileplanLevel){
checkRights: function (archivalProfiles, withoutProfile, fileplanLevel) {
var button = this.selected.closest('.archive').find('.addChildrenArchive');
var archiveStatus = button.closest('.archive').find('.status').text();
if (archiveStatus == 'disposed' || fileplanLevel == 'item' || (!archivalProfiles.length && withoutProfile !== 1)) {
......
......@@ -781,7 +781,14 @@ input:invalid {
itemList.append(previous);
},
addCustomField : function(source = "", target = $("#customFields")) {
addCustomField : function(source, target) {
// to inititate default value and avoid bug on IE 11
if (source === undefined) {
source = "";
}
if (target === undefined) {
target = $("#customFields");
}
var formGroup = $('<div class="form-group" />');
var label = $('<div class="col-md-3"/>');
var name = $('<input type="text" class="form-control input-sm name" />');
......
......@@ -255,7 +255,15 @@
$("#folderToolbarSearch").data("orgregnumber", orgRegNumber).data("folderid", folderId);
},
buildResultList: function(archives, options = null, showArchivePath = false) {
buildResultList: function(archives, options, showArchivePath) {
// to inititate default value and avoid bug on IE 11
if (options === undefined) {
options = null;
}
if (showArchivePath === undefined) {
showArchivePath = false;
}
trigger("clearDetail.recordsManagement");
this.showArchivePath = showArchivePath;
......
......@@ -55,7 +55,21 @@
var SearchTab = {
run : function (orgRegNumber = null, folderId = null, title = null, profiles = null) {
run : function (orgRegNumber, folderId, titre, profiles) {
// to inititate default value and avoid bug on IE 11
if (orgRegNumber === undefined) {
orgRegNumber = null;
}
if (folderId = undefined) {
folderId = null;
}
if (title = undefined) {
title = null;
}
if (profiles = undefined) {
profiles = null;
}
var uniqId = new Date().getUTCMilliseconds();
this.tabCreation(uniqId, title);
......
......@@ -208,7 +208,11 @@
return userAccesses
},
removeFromList: function(li, removeFromSelect = true) {
removeFromList: function(li, removeFromSelect) {
// to inititate default value and avoid bug on IE 11
if (removeFromSelect === undefined) {
removeFromSelect = true;
}
if (removeFromSelect) {
$('#profileReference').val('').find('option[value="'+li.data('json').archivalProfileReference+'"]').removeClass('hide');
}
......
......@@ -41,7 +41,7 @@ $("#archiveList").on('click', ".viewDocument", function() {
});
// view the archive description
$('#archiveList').on('click', '.viewArchive', function () {
$('#archiveList tr').on('click', '.viewArchive', function () {
archiveInfoModal.load($(this).closest('tr').attr('id'));
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment