Petite modification dans le client Scrutari
This commit is contained in:
parent
8debdd2696
commit
764ea3a040
@ -54,8 +54,8 @@ Scrutari.Lav.init = function (client) {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
client.initForms();
|
client.initForms();
|
||||||
client.initButtons(Scrutari.Lav.actionHandler);
|
client.initButtons();
|
||||||
client.initChangeListeners(Scrutari.Lav.changeHandler);
|
client.initChangeListeners();
|
||||||
client.checkInitialQuery();
|
client.checkInitialQuery();
|
||||||
|
|
||||||
function _initLav() {
|
function _initLav() {
|
||||||
@ -134,7 +134,7 @@ Scrutari.Lav.newResultProcess = function (client, scrutariResult, searchOrigin)
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Personnalisation des actions sur les boutons, passée à client.initButtons()
|
* Actions propres au client
|
||||||
*/
|
*/
|
||||||
Scrutari.Lav.actionHandler = function (client, button, action, target) {
|
Scrutari.Lav.actionHandler = function (client, button, action, target) {
|
||||||
switch(action) {
|
switch(action) {
|
||||||
@ -148,7 +148,7 @@ Scrutari.Lav.actionHandler = function (client, button, action, target) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Personnalisation des écouteurs actions sur les boutons, passée à client.initButtons()
|
* Personnalisation des écouteurs actions sur les boutons
|
||||||
*/
|
*/
|
||||||
Scrutari.Lav.changeHandler = function (client, element, name) {
|
Scrutari.Lav.changeHandler = function (client, element, name) {
|
||||||
switch(name) {
|
switch(name) {
|
||||||
@ -182,47 +182,6 @@ Scrutari.Lav.changeHandler = function (client, element, name) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Objet définissant les points d'entrée (hook) particuliers, transmis à la configuration
|
|
||||||
*/
|
|
||||||
Scrutari.Lav.HOOKS = {
|
|
||||||
completeFiche : function (scrutariResult, fiche, categoryName) { //Extrait le numéro du titre
|
|
||||||
let start = fiche.mtitre[0];
|
|
||||||
let numero = "";
|
|
||||||
if (start.startsWith("#")) {
|
|
||||||
let idx = start.indexOf("-");
|
|
||||||
if (idx > 0) {
|
|
||||||
numero = start.substring(0, idx).trim();
|
|
||||||
fiche.mtitre[0] = start.substring(idx + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fiche._numero = numero;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Objet centralisant les fonctions surchargées du client
|
|
||||||
*/
|
|
||||||
Scrutari.Lav.FUNCTIONS = {
|
|
||||||
uiInit: function (client) {
|
|
||||||
Scrutari.Lav.init(client);
|
|
||||||
},
|
|
||||||
ignoreElement: null,
|
|
||||||
isFilterEnable: null,
|
|
||||||
mainsearchResultCallback: function (client, scrutariResult) {
|
|
||||||
$("#scrutari_lav_sequence").html(Scrutari.Lav.formatSearchSequence(client, scrutariResult));
|
|
||||||
},
|
|
||||||
mainsearchErrorCallback: null,
|
|
||||||
subsearchResultCallback: null,
|
|
||||||
subsearchErrorCallback: null,
|
|
||||||
initFilterByQuery: null,
|
|
||||||
newResultProcess: function (client, scrutariResult, searchOrigin) {
|
|
||||||
return Scrutari.Lav.newResultProcess(client, scrutariResult, searchOrigin);
|
|
||||||
},
|
|
||||||
startLoading: null,
|
|
||||||
endLoading: null
|
|
||||||
};
|
|
||||||
|
|
||||||
Scrutari.Lav.getConfigOptions = function () {
|
Scrutari.Lav.getConfigOptions = function () {
|
||||||
return {
|
return {
|
||||||
paginationLength: Scrutari.Lav.PAGINATION_LENGTH,
|
paginationLength: Scrutari.Lav.PAGINATION_LENGTH,
|
||||||
@ -237,7 +196,36 @@ Scrutari.Lav.getInitOptions = function () {
|
|||||||
ficheBodyList: "fiche_mtitre,fiche_msoustitre,libreavous_start_ul,fiche_primaryattributearray,fiche_mcomplementarray,fiche_secondaryattributearray,fiche_motclearray,fiche_bythesaurusarray,libreavous_end_ul", //Ajout de libreavous_start_ul et libreavous_end_ul, retrait de fiche_year,
|
ficheBodyList: "fiche_mtitre,fiche_msoustitre,libreavous_start_ul,fiche_primaryattributearray,fiche_mcomplementarray,fiche_secondaryattributearray,fiche_motclearray,fiche_bythesaurusarray,libreavous_end_ul", //Ajout de libreavous_start_ul et libreavous_end_ul, retrait de fiche_year,
|
||||||
historyAtLast: true,
|
historyAtLast: true,
|
||||||
ignoreList: "area-title,area-stats,modal-*", //Utilisé en mode développement
|
ignoreList: "area-title,area-stats,modal-*", //Utilisé en mode développement
|
||||||
hooks: Scrutari.Lav.HOOKS,
|
hooks: {
|
||||||
functions: Scrutari.Lav.FUNCTIONS
|
completeFiche : function (scrutariResult, fiche, categoryName) { //Extrait le numéro du titre
|
||||||
|
let start = fiche.mtitre[0];
|
||||||
|
let numero = "";
|
||||||
|
if (start.startsWith("#")) {
|
||||||
|
let idx = start.indexOf("-");
|
||||||
|
if (idx > 0) {
|
||||||
|
numero = start.substring(0, idx).trim();
|
||||||
|
fiche.mtitre[0] = start.substring(idx + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fiche._numero = numero;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
functions: {
|
||||||
|
uiInit: Scrutari.Lav.init,
|
||||||
|
ignoreElement: null,
|
||||||
|
isFilterEnable: null,
|
||||||
|
mainsearchResultCallback: function (client, scrutariResult) {
|
||||||
|
$("#scrutari_lav_sequence").html(Scrutari.Lav.formatSearchSequence(client, scrutariResult));
|
||||||
|
},
|
||||||
|
mainsearchErrorCallback: null,
|
||||||
|
subsearchResultCallback: null,
|
||||||
|
subsearchErrorCallback: null,
|
||||||
|
initFilterByQuery: null,
|
||||||
|
newResultProcess: Scrutari.Lav.newResultProcess,
|
||||||
|
startLoading: null,
|
||||||
|
endLoading: null,
|
||||||
|
actionHandler: Scrutari.Lav.actionHandler,
|
||||||
|
changeHandler: Scrutari.Lav.changeHandler
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* version: 4209 */
|
/* version: r4220 */
|
||||||
var Scrutari = {};
|
var Scrutari = {};
|
||||||
Scrutari.log = function (msg) {
|
Scrutari.log = function (msg) {
|
||||||
if ((console) && (console.log)) {
|
if ((console) && (console.log)) {
|
||||||
@ -2081,7 +2081,9 @@ Scrutari.Client = function (scrutariConfig, clientId) {
|
|||||||
modalAction: Scrutari.DefaultUi.modalAction,
|
modalAction: Scrutari.DefaultUi.modalAction,
|
||||||
newResultProcess: Scrutari.DefaultUi.newResultProcess,
|
newResultProcess: Scrutari.DefaultUi.newResultProcess,
|
||||||
startLoading: Scrutari.DefaultUi.startLoading,
|
startLoading: Scrutari.DefaultUi.startLoading,
|
||||||
endLoading: Scrutari.DefaultUi.endLoading
|
endLoading: Scrutari.DefaultUi.endLoading,
|
||||||
|
actionHandler: Scrutari.DefaultUi.actionHandler,
|
||||||
|
changeHandler: Scrutari.DefaultUi.changeHandler
|
||||||
};
|
};
|
||||||
this.cssClasses = {
|
this.cssClasses = {
|
||||||
disabled: "scrutari-Disabled",
|
disabled: "scrutari-Disabled",
|
||||||
@ -2423,12 +2425,15 @@ Scrutari.Client.prototype.initForms = function () {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Scrutari.Client.prototype.initButtons = function (actionHandler) {
|
Scrutari.Client.prototype.initButtons = function () {
|
||||||
var client = this;
|
var client = this;
|
||||||
if (!actionHandler) {
|
|
||||||
actionHandler = _noneHandler;
|
|
||||||
}
|
|
||||||
$("#" + client.clientId).on("click", Scrutari.toCssQuery({scrutariButton: true}), function () {
|
$("#" + client.clientId).on("click", Scrutari.toCssQuery({scrutariButton: true}), function () {
|
||||||
|
let actionHandler;
|
||||||
|
if (client.functions.actionHandler) {
|
||||||
|
actionHandler = client.functions.actionHandler;
|
||||||
|
} else {
|
||||||
|
actionHandler = _noneHandler;
|
||||||
|
}
|
||||||
let button = this;
|
let button = this;
|
||||||
let action = this.dataset.scrutariButton;
|
let action = this.dataset.scrutariButton;
|
||||||
let target = this.dataset.scrutariTarget;
|
let target = this.dataset.scrutariTarget;
|
||||||
@ -2490,12 +2495,15 @@ Scrutari.Client.prototype.initButtons = function (actionHandler) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Scrutari.Client.prototype.initChangeListeners = function (changeHandler) {
|
Scrutari.Client.prototype.initChangeListeners = function () {
|
||||||
var client = this;
|
var client = this;
|
||||||
if (!changeHandler) {
|
|
||||||
changeHandler = _noneHandler;
|
|
||||||
}
|
|
||||||
$("#" + client.clientId).on("input", "input", function () {
|
$("#" + client.clientId).on("input", "input", function () {
|
||||||
|
let changeHandler;
|
||||||
|
if (client.functions.changeHandler) {
|
||||||
|
changeHandler = client.functions.changeHandler;
|
||||||
|
} else {
|
||||||
|
changeHandler = _noneHandler;
|
||||||
|
}
|
||||||
let element = this;
|
let element = this;
|
||||||
let name = this.name;
|
let name = this.name;
|
||||||
if (name) {
|
if (name) {
|
||||||
@ -3002,7 +3010,6 @@ Scrutari.Process.prototype.updateLinks = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
Scrutari.Process.prototype.addPaginations = function ($paginationBlock) {
|
Scrutari.Process.prototype.addPaginations = function ($paginationBlock) {
|
||||||
Scrutari.log("original");
|
|
||||||
if (this.scrutariResult.getFicheGroupType() === 'category') {
|
if (this.scrutariResult.getFicheGroupType() === 'category') {
|
||||||
this.addCategoryPaginations($paginationBlock);
|
this.addCategoryPaginations($paginationBlock);
|
||||||
} else {
|
} else {
|
||||||
@ -3061,8 +3068,8 @@ Scrutari.DefaultUi.init = function (client) {
|
|||||||
var scrutariMeta = client.scrutariMeta;
|
var scrutariMeta = client.scrutariMeta;
|
||||||
$("#" + client.clientId).html(client.compileStructure("main"));
|
$("#" + client.clientId).html(client.compileStructure("main"));
|
||||||
client.initForms();
|
client.initForms();
|
||||||
client.initButtons(Scrutari.DefaultUi.actionHandler);
|
client.initButtons();
|
||||||
client.initChangeListeners(Scrutari.DefaultUi.changeHandler);
|
client.initChangeListeners();
|
||||||
Scrutari.DefaultUi.initMainTitle(client);
|
Scrutari.DefaultUi.initMainTitle(client);
|
||||||
client.$count('stats-global', 'update', scrutariMeta.getGlobalFicheCount());
|
client.$count('stats-global', 'update', scrutariMeta.getGlobalFicheCount());
|
||||||
client.$hidden('init', 'show');
|
client.$hidden('init', 'show');
|
||||||
|
Loading…
Reference in New Issue
Block a user