migiorie grafiche

This commit is contained in:
nicola 2022-10-09 15:52:05 +02:00
parent 628b1aa225
commit 3d5ba64760
2 changed files with 1420 additions and 1316 deletions

File diff suppressed because it is too large Load Diff

View File

@ -487,8 +487,8 @@ $(document).ready(function() {
//element.find('.listacondizioni').append(dlclass);
let virgola = tuttiFiltri.lastIndexOf(',');
tuttiFiltri = tuttiFiltri.substring(0, virgola);
let txtAreaFiltri = '<textarea id = ' + 'textarea-'+filterconditions+
' readonly style="resize:none" class="bg-washed-blue bn" rows="2" cols="20" name="usrtxt" wrap="hard">' +
let txtAreaFiltri = '<textarea id = ' + 'textarea-' + filterconditions +
' readonly style="resize:none" class="bg-washed-blue bn" rows="2" cols="20" name="usrtxt" wrap="hard">' +
tuttiFiltri + "</textarea>"
ddclass.append(txtAreaFiltri);
dlclass.append(dtclass);
@ -514,9 +514,9 @@ $(document).ready(function() {
filtro['tipoClausola'] = tipoClausola
// checkedField = $('input[name=oggetto]:checked', '#filterform').val();
//
// filtro['lemma_forma'] = checkedField
// checkedField = $('input[name=oggetto]:checked', '#filterform').val();
//
// filtro['lemma_forma'] = checkedField
condizioniFiltro['filtro-' + filterconditions] = filtro
@ -547,10 +547,10 @@ $(document).ready(function() {
jQuery(document).delegate('#grammarbutton', 'click', function(e) {
var size = Object.keys(condizioniFiltro).length;
if (size == 0){
if (size == 0) {
var clausola = $("#searchValue").val()
clausola = clausola.trim();
if (clausola == "" || clausola == ' '){
if (clausola == "" || clausola == ' ') {
return false
}
@ -559,21 +559,21 @@ $(document).ready(function() {
condizioniFiltro['filtro-1'] = filtro;
}
spquery=buildSQ(condizioniFiltro)
spquery = buildSQ(condizioniFiltro)
queryFields = [];
for (var i in spquery.variables) {
for (var i in spquery.variables) {
queryFields.push(spquery.variables[i].variable.value);
}
execMySparqlQuery (new sparqlGenerator().stringify(spquery));
execMySparqlQuery(new sparqlGenerator().stringify(spquery));
return true
}
)
async function execMySparqlQuery (spQuery){
async function execMySparqlQuery(spQuery) {
$("#loader").show();
alert (new sparqlGenerator().stringify(spQuery));
bindingsStream = await myEngine.queryBindings(spQuery, { sources: [ { type: 'sparql', value: sparqlEndpoint }, ], });
alert(new sparqlGenerator().stringify(spQuery));
bindingsStream = await myEngine.queryBindings(spQuery, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
$("#sparqlquery").val(spQuery);
$("#copiaQuery").prop("disabled", false);
@ -596,7 +596,7 @@ $(document).ready(function() {
bindingsStream.on('data', (binding) => {
//console.log(binding.toString()); // Quick way to print bindings for testing
//console.log(binding.has('sub')); // Will be true
resultTablePart4 = '<tr><th scope="row" class="text-muted">' + rowNum++ + '</th>';
resultTablePart4 = '<tr><th scope="row" class="text-muted">' + rowNum++ + '</th>';
for (var i = 0; i < queryFields.length; i++) {
resultTablePart4 = resultTablePart4 + '<td class="text-muted">' + binding.get(queryFields[i]).value + "</td>";
};
@ -613,19 +613,19 @@ $(document).ready(function() {
$("#resultsId1").append(resultTable);
$("#risultatitesto").append("]");
$("#copiaTesto").prop("disabled", false);
$('#resultTable').DataTable( {
$('#resultTable').DataTable({
colReorder: true,
language: {
url: 'dataTables.it-IT.json'
},
//dom: 'Blfrtip',
dom: "<'row'<'col-sm-12 col-md-6'l><'col-sm-6 col-md-3'f><'col-sm-6 col-md-3 text-right'B>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
buttons: [ 'copy', 'excel', 'print' ]
});
setTimeout(function(){
language: {
url: 'dataTables.it-IT.json'
},
//dom: 'Blfrtip',
dom: "<'row'<'col-sm-12 col-md-6'l><'col-sm-6 col-md-3'f><'col-sm-6 col-md-3 text-right'B>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
buttons: ['copy', 'excel', 'print']
});
setTimeout(function() {
buttonDiv = $("#resultsId1").find(".buttons-copy");
$('<label class="input-group-text"><ion-icon name="copy"></ion-icon></label>').insertBefore(buttonDiv);
},300);
$('<label class="input-group-text"><ion-icon name="copy"></ion-icon></label>').insertBefore(buttonDiv);
}, 300);
});
}
function AggiornaFiltro(filtroId) {
@ -666,7 +666,7 @@ $(document).ready(function() {
let filterNum = filtroId.substring(7);
$('#textarea-'+ filterNum).val(tuttiFiltri);
$('#textarea-' + filterNum).val(tuttiFiltri);
@ -692,56 +692,56 @@ $(document).ready(function() {
return true;
}
/**
/**
Il Filtro "scritto" viene eliminato
Il Filtro "scritto" viene eliminato
*/
*/
jQuery(document).delegate('a.delete-written-filter', 'click', function(e) {
jQuery(document).delegate('a.delete-written-filter', 'click', function(e) {
e.preventDefault();
var didConfirm = confirm("Sei sicuro di voler cancellare il filtro?");
if (didConfirm == true) {
e.preventDefault();
var didConfirm = confirm("Sei sicuro di voler cancellare il filtro?");
if (didConfirm == true) {
var targetDiv = jQuery(this).attr('target'); // nome filtro
var targetDiv = jQuery(this).attr('target'); // nome filtro
rmel = jQuery('#' + targetDiv)
rmeldetail = jQuery('#' + targetDiv)
jQuery(rmel).remove();
jQuery(rmeldetail).remove();
// se c'è un solo filtro, mi assicuro che non sia visibile il dropbox and/or
size = jQuery('#filtri >div').length
rmel = jQuery('#' + targetDiv)
rmeldetail = jQuery('#' + targetDiv)
jQuery(rmel).remove();
jQuery(rmeldetail).remove();
// se c'è un solo filtro, mi assicuro che non sia visibile il dropbox and/or
size = jQuery('#filtri >div').length
//nasconde la condizione logica dal primo della lista dei filtri
if (size > 0) {
var filtriscr = jQuery('#filtri >div');
filtriscr.first().find('.andorconditions').attr('style', 'display:none');
} else { // eliminato l'ultimo filtro
jQuery('#filtri').attr('style', "display:none;")
//nasconde la condizione logica dal primo della lista dei filtri
if (size > 0) {
var filtriscr = jQuery('#filtri >div');
filtriscr.first().find('.andorconditions').attr('style', 'display:none');
} else { // eliminato l'ultimo filtro
jQuery('#filtri').attr('style', "display:none;")
}
delete condizioniFiltro[targetDiv];
return true;
} else {
return false;
}
delete condizioniFiltro[targetDiv];
return true;
} else {
return false;
}
});
});
/**
/**
Il Filtro "scritto" viene editato
Il Filtro "scritto" viene editato
*/
*/
jQuery(document).delegate('a.edit-written-filter', 'click', function(e) {
jQuery(document).delegate('a.edit-written-filter', 'click', function(e) {
e.preventDefault();
if (clausolaVisibile)
return true;
e.preventDefault();
if (clausolaVisibile)
return true;
var thisfilter = jQuery(this).attr('target');
tempfiltro = condizioniFiltro[thisfilter]
@ -766,139 +766,150 @@ jQuery(document).delegate('a.edit-written-filter', 'click', function(e) {
}
return true;
/*} else {
return false;
}*/
});
return true;
/*} else {
return false;
}*/
});
/**
*
* Visualizza Categoria Grammaticale
*/
/**
*
* Visualizza Categoria Grammaticale
*/
function showCategoriaGrammaticale(valoriFiltro = {}, filtroTarget = '') {
function showCategoriaGrammaticale(valoriFiltro = {}, filtroTarget = '') {
var content = jQuery('#categoriagrammaticale >div'),
size = jQuery('#condizioni >div').length + 1,
element = null,
element = content.clone();
var content = jQuery('#categoriagrammaticale >div'),
size = jQuery('#condizioni >div').length + 1,
element = null,
element = content.clone();
$(":radio").prop("checked", false);
checkedField = $('input[name=lemma_forma]:checked', '#filterform').val();
var radios = $(":radio");
//$(":radio").prop("checked", false);
$(":checkbox").prop("checked", false);
//
// for (radio in radios) {
// if (radios[radio].val == checkedField) {
// radios[radio].checked = true;
// }
// }
element.attr('id', 'cg-' + size);
element.find('.remove-filter').attr('target', 'cg-' + size);
element.find('.set-filter').attr('targetfilter', 'cg-' + size);
element.appendTo('#condizioni');
element.attr('id', 'cg-' + size);
element.find('.remove-filter').attr('target', 'cg-' + size);
element.find('.set-filter').attr('targetfilter', 'cg-' + size);
element.appendTo('#condizioni');
if (!jQuery.isEmptyObject(valoriFiltro)) { // sto facendo la modfica di un filtro
$("#types").val(valoriFiltro['categoria']).trigger("change");
var keys = Object.keys(valoriFiltro)//condizioniFiltro)
for (key in keys) {
myname = keys[key]
myname = myname.replaceAll('%20', ' ')
myval = valoriFiltro[keys[key]]
var edelement = $("[name='" + myname + "'");
var edeltype = edelement.attr('type')
//alert(edeltype)
if (edeltype !== undefined & (edeltype == 'radio' | edeltype == 'checkbox')) {
$('[value="' + myval + '"]').prop('checked', true);
}
else {
$("[name='" + myname + "'").val(myval)
}
if (!jQuery.isEmptyObject(valoriFiltro)) { // sto facendo la modfica di un filtro
$("#types").val(valoriFiltro['categoria']).trigger("change");
var keys = Object.keys(valoriFiltro)//condizioniFiltro)
for (key in keys) {
myname = keys[key]
myname = myname.replaceAll('%20', ' ')
myval = valoriFiltro[keys[key]]
var edelement = $("[name='" + myname + "'");
var edeltype = edelement.attr('type')
//alert(edeltype)
if (edeltype !== undefined & (edeltype == 'radio' | edeltype == 'checkbox')) {
$('[value="' + myval + '"]').prop('checked', true);
}
else {
$("[name='" + myname + "'").val(myval)
}
element.find('.update-filter').attr('targetfilter', filtroTarget);
element.find(".set-filter").attr('style', 'display:none')
element.find(".update-filter").attr('style', 'display:compact')
}
element.find('.update-filter').attr('targetfilter', filtroTarget);
element.find(".set-filter").attr('style', 'display:none')
element.find(".update-filter").attr('style', 'display:compact')
}
else { //sto creando una clausola grammaticale nuova, definisco il valore di default
$("#types").val("verbovolgare").trigger("change");
}
valoriFiltro = {}
element.find('.sn').html(size);
grammarconditions = grammarconditions + 1
if (size == 1)
jQuery('#grammarbutton').attr('style', "display:block;")
}
/**
Visualizza Clausola Sintattica
*/
function showClausolaSintattica(valoriFiltro = {}, filtroTarget = '') {
var content = jQuery('#tiposintattico >div'),
size = jQuery('#condizioni >div').length + 1,
element = null,
element = content.clone();
element.attr('id', 'ts-' + size);
element.find('.remove-filter').attr('target', 'ts-' + size);
element.find('.set-filter').attr('targetfilter', 'ts-' + size);
element.appendTo('#condizioni');
if (!jQuery.isEmptyObject(valoriFiltro)) { // sto facendo l'edit di un filtro
$("#types").val(valoriFiltro['categoria']).trigger("change");
var keys = Object.keys(valoriFiltro)//condizioniFiltro)
for (key in keys) {
myname = keys[key]
myval = valoriFiltro[keys[key]]
var edelement = $("[name='" + myname + "'");
var edeltype = edelement.attr('type')
//alert(edeltype)
if (edeltype !== undefined & (edeltype == 'radio' | edeltype == 'checkbox')) {
$('[value="' + myval + '"]').prop('checked', true);
}
else {
$("[name='" + myname + "'").val(myval)
}
else { //sto creando una clausola grammaticale nuova, definisco il valore di default
$("#types").val("verbovolgare").trigger("change");
}
valoriFiltro = {}
element.find('.sn').html(size);
grammarconditions = grammarconditions + 1
if (size == 1)
jQuery('#grammarbutton').attr('style', "display:block;")
}
element.find('.sn').html(size);
sintconditions = sintconditions + 1
if (size == 1)
jQuery('#grammarbutton').attr('style', "display:block;")
}
/**
Visualizza Clausola Sintattica
*/
function showClausolaSintattica(valoriFiltro = {}, filtroTarget = '') {
jQuery(document).delegate('a.add-details', 'click', function(e) {
e.preventDefault();
var content = jQuery('#tiposintattico >div'),
size = jQuery('#condizioni >div').length + 1,
element = null,
element = content.clone();
element.attr('id', 'ts-' + size);
var targetDiv = jQuery(this).attr('target');
element.find('.remove-filter').attr('target', 'ts-' + size);
element.find('.set-filter').attr('targetfilter', 'ts-' + size);
element.appendTo('#condizioni');
if (!jQuery.isEmptyObject(valoriFiltro)) { // sto facendo l'edit di un filtro
rmel = jQuery('#' + targetDiv)
var curstyle = rmel.attr('view')
$("#types").val(valoriFiltro['categoria']).trigger("change");
var keys = Object.keys(valoriFiltro)//condizioniFiltro)
for (key in keys) {
myname = keys[key]
myval = valoriFiltro[keys[key]]
var edelement = $("[name='" + myname + "'");
var edeltype = edelement.attr('type')
//alert(edeltype)
if (edeltype !== undefined & (edeltype == 'radio' | edeltype == 'checkbox')) {
$('[value="' + myval + '"]').prop('checked', true);
}
else {
$("[name='" + myname + "'").val(myval)
}
if (curstyle !== undefined && curstyle === 'y') {
rmel.children().attr('style', 'display:none');
rmel.attr('view', 'n')
}
else {
rmel.attr('view', 'y')
rmel.children().attr('style', 'display:block');
}
}
element.find('.sn').html(size);
sintconditions = sintconditions + 1
if (size == 1)
jQuery('#grammarbutton').attr('style', "display:block;")
}
return true;
});
jQuery(document).delegate('a.add-details', 'click', function(e) {
e.preventDefault();
var targetDiv = jQuery(this).attr('target');
rmel = jQuery('#' + targetDiv)
var curstyle = rmel.attr('view')
if (curstyle !== undefined && curstyle === 'y') {
rmel.children().attr('style', 'display:none');
rmel.attr('view', 'n')
}
else {
rmel.attr('view', 'y')
rmel.children().attr('style', 'display:block');
}
return true;
});
});