From 3d5ba64760f337ab418547264aea73a12a56693c Mon Sep 17 00:00:00 2001 From: nicola Date: Sun, 9 Oct 2022 15:52:05 +0200 Subject: [PATCH] migiorie grafiche --- index_work_Nik.html | 2327 ++++++++++++++++++++++--------------------- js/guimanagerNik.js | 409 ++++---- 2 files changed, 1420 insertions(+), 1316 deletions(-) diff --git a/index_work_Nik.html b/index_work_Nik.html index 7c9925c..e8eb865 100644 --- a/index_work_Nik.html +++ b/index_work_Nik.html @@ -8,23 +8,30 @@ - - - - - + + + + + - - - - - - - + + + + + + + - + @@ -32,7 +39,8 @@ - + - - - - - - + + + + + + + diff --git a/js/guimanagerNik.js b/js/guimanagerNik.js index c94d709..e66a9aa 100644 --- a/js/guimanagerNik.js +++ b/js/guimanagerNik.js @@ -9,11 +9,11 @@ $(document).ready(function() { filterconditions = 0 let filterToEdit = ""; - + const myEngine = new Comunica.QueryEngine(); - + var queryFields = []; // Contiene le intestazioni di colonna della tabella dei risultati - + const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query"; const sparqlGenerator = sparqljs.Generator; @@ -487,8 +487,8 @@ $(document).ready(function() { //element.find('.listacondizioni').append(dlclass); let virgola = tuttiFiltri.lastIndexOf(','); tuttiFiltri = tuttiFiltri.substring(0, virgola); - let txtAreaFiltri = '" ddclass.append(txtAreaFiltri); dlclass.append(dtclass); @@ -513,11 +513,11 @@ $(document).ready(function() { //aggiungo il filtro a quelli esistenti nel json 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 @@ -543,37 +543,37 @@ $(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 } - + filtro = {}; filtro['query'] = clausola 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 = '' + rowNum++ + ''; + resultTablePart4 = '' + rowNum++ + ''; for (var i = 0; i < queryFields.length; i++) { resultTablePart4 = resultTablePart4 + '' + binding.get(queryFields[i]).value + ""; }; @@ -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"); - $('').insertBefore(buttonDiv); - },300); + $('').insertBefore(buttonDiv); + }, 300); }); } function AggiornaFiltro(filtroId) { @@ -661,23 +661,23 @@ $(document).ready(function() { } let virgola = tuttiFiltri.lastIndexOf(','); tuttiFiltri = tuttiFiltri.substring(0, virgola); - + let filterNum = filtroId.substring(7); - - - $('#textarea-'+ filterNum).val(tuttiFiltri); - + $('#textarea-' + filterNum).val(tuttiFiltri); + + + if (filterNum != 1) { element.find('.andorconditions').attr('style', 'display.none'); } - - + + // rimuovo la finestra filtro - + rmel = jQuery('#' + "cg-2") rmeldetail = jQuery('#' + 'dettaglio_' + "cg-2") jQuery(rmel).remove(); @@ -692,57 +692,57 @@ $(document).ready(function() { return true; } -/** - - Il Filtro "scritto" viene eliminato - - */ - -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) { - - 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 - - //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; - } -}); - - - - -/** - - Il Filtro "scritto" viene editato - - */ - -jQuery(document).delegate('a.edit-written-filter', 'click', function(e) { - - e.preventDefault(); - if (clausolaVisibile) - return true; + /** + Il Filtro "scritto" viene eliminato + + */ + + 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) { + + 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 + + //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; + } + }); + + + + + /** + + Il Filtro "scritto" viene editato + + */ + + jQuery(document).delegate('a.edit-written-filter', 'click', function(e) { + + e.preventDefault(); + if (clausolaVisibile) + return true; + var thisfilter = jQuery(this).attr('target'); tempfiltro = condizioniFiltro[thisfilter] tempfiltro['target'] = 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; -}); + }); }); \ No newline at end of file