diff --git a/index_Luk_Q.html b/index_Luk_Q.html index db82c8d..69501c2 100644 --- a/index_Luk_Q.html +++ b/index_Luk_Q.html @@ -59,6 +59,7 @@
+
@@ -69,52 +70,16 @@ - -
+
-
- +
- - +
- +
@@ -124,6 +89,43 @@
+ + +
diff --git a/js/script_Luk_Q.js b/js/script_Luk_Q.js index 7d2ad92..b39760a 100644 --- a/js/script_Luk_Q.js +++ b/js/script_Luk_Q.js @@ -188,7 +188,7 @@ $(document).ready(function() { var reader = new FileReader(); reader.onload = function(data){ queryJson = JSON.parse(data.target.result) - $("#sparqlquery").val(data.target.result); + //$("#sparqlquery").val(data.target.result); makeUpGui(queryJson); }; if (file) {reader.readAsText(file);} @@ -223,12 +223,13 @@ $(document).ready(function() { // Evento: click sul checkbox di Ricerca avanzata $('#cla-TabContent').on('click', '#advanSW', function() { - console.log($(this).prop('checked')); - console.log($("#cla-TabContent")); if ($(this).prop('checked')) { $("#cla-Advanced").attr('style', "display: block;"); + queryJson.QueryAvanzata = "1"; } else { $("#cla-Advanced").attr('style', "display: none;"); + queryJson.QueryAvanzata = "0"; + //resetAdvGui(); } }); @@ -424,7 +425,7 @@ $(document).ready(function() { var guiLogicString = ``; var execQuery = ``; var queryFields = []; // Contiene le intestazioni di colonna della tabella dei risultati - var queryJson = JSON.parse('{"EsprLogica":"","LogicaGui":""}'); + var queryJson = JSON.parse('{"EsprLogica":"", "LogicaGui":"", "QueryAvanzata": "0"}'); queryJson.LiDaVersion = "1.0"; queryJson.Clausola0 = JSON.parse('{"queryText": "", "lemma_forma": "lemma", "TipoClausola": "0", "Attiva": "0"}'); @@ -501,7 +502,7 @@ $(document).ready(function() { // se non cambio l'id della select react non rileva l'evento onchange: $('#cla' + tabID + " #grammtypes").attr("id","grammtypes" + tabID); claListLen++; - $('#tab-list').append($('')); + $('#tab-list').append($('')); } // Funzione di creazione delle subclausole grammaticali basate sul valore scelto @@ -619,15 +620,15 @@ $(document).ready(function() { clone.removeAttribute("style"); $('#cla-TabContent').append(clone); claListLen++; - $('#tab-list').append($('')); + $('#tab-list').append($('')); } // Funzione di creazione del tab delle clausole metafore function addMetaCla(active){ tabID++; - $('#cla-TabContent').append($('
' + iconCheckAndClose + '
Clausola Metafore - non ancora implementata
')); + $('#cla-TabContent').append($('
' + iconCheckAndClose + '
Clausola Metafore - non ancora implementata
')); claListLen++; - $('#tab-list').append($('')); + $('#tab-list').append($('')); } // Funzione di creazione del tab delle clausole dialoghi @@ -680,13 +681,13 @@ $(document).ready(function() { var claType = $(this).find('a').attr("data-claType"); switch (claType) { case "Grammaticale": - textClassType = "text-lida8"; + textClassType = "text-lida9"; break; case "Sintattico": - textClassType = "text-lida9"; + textClassType = "text-lida3"; break; case "Metafore": - textClassType = "text-lida3"; + textClassType = "text-lida5"; break; case "Dialoghi": textClassType = "text-lida4"; @@ -787,7 +788,6 @@ $(document).ready(function() { $(sortableNum).append(LItext); }; queryJson["Clausola" + len] = JSON.parse(jsonTextToParse + '}'); - } // Funzione di refresh dei placeholders e attivazione/disattivazione bottoni nelle liste sortable @@ -871,7 +871,7 @@ $(document).ready(function() { }); logicExprString = parseCond("#sortable0", "AND", 0); guiLogicString = parseCond("#sortable0", "AND", 1); - $("#sparqlquery").val(logicExprString); + //$("#sparqlquery").val(logicExprString); queryJson.EsprLogica = logicExprString.split(' '); queryJson.LogicaGui = guiLogicString.split(' '); }; @@ -890,21 +890,21 @@ $(document).ready(function() { }; // Funzione di parsing delle clausole e delle condizioni logiche - function parseCond(sortableList, condType, gui){ + function parseCond(sortableList, condType, forGui){ var condText = ""; var items = $(sortableList).children("li"); var itemsText = []; $(items).each(function() { if ($(this).hasClass("condLIand")) { var andID = "#" + $(this).children("ul").attr("id"); - var andText = parseCond(andID, "AND", gui); + var andText = parseCond(andID, "AND", forGui); if (andText.length){ itemsText.push(andText); }; }; if ($(this).hasClass("condLIor")) { var orID = "#" + $(this).children("ul").attr("id"); - var orText = parseCond(orID, "OR", gui); + var orText = parseCond(orID, "OR", forGui); if (orText.length){ itemsText.push(orText); }; @@ -912,7 +912,7 @@ $(document).ready(function() { if ($(this).hasClass("claLI")) { var claText = $(this).find(".clatext").text(); var claNum = "Clausola" + claText.substr(0,claText.indexOf('.')); - if (gui || ($(this).find("input")[0].checked == true)){ + if (forGui || ($(this).find("input")[0].checked == true)){ itemsText.push(claNum); }; }; @@ -922,7 +922,7 @@ $(document).ready(function() { case 0: break; case 1: - if (gui) { + if (forGui) { condText = "( " + condType + " " + itemsText[0] + " )"; } else { condText += itemsText[0]; @@ -951,21 +951,16 @@ $(document).ready(function() { //$("#risultatitesto").val(queryJson["LogicaGui"]); // 1. verifica json legit --> TO DO // ------------------- - // Pulizia interfaccia: - var tabsContent=$("#cla-TabContent").find(".tab-pane:not(:first)"); - var tabs=$("#tab-list li:not(:first)"); - if ($(tabsContent).length) { - $(tabsContent).each(function(){ - $(this).remove(); - }); - $(tabs).each(function(){ - $(this).remove(); - }); + // Pulizia ricerca avanzata: + resetAdvGui(); + // Imposta checkbox: + if (queryJson["QueryAvanzata"] == 1) { + $("#cla-Advanced").attr('style', "display: block;"); + $("#advanSW").prop("checked", true); + } else { + $("#cla-Advanced").attr('style', "display: none;"); + $("#advanSW").prop("checked", false); }; - claListLen = 0; - condListLen = 0; - tabID = 0; - $('#sortable0').html(emptyClaList); // Rigenerazione Clausola0: if (queryJson["Clausola0"].Attiva) { $("#cla0 #lemma_forma").val(queryJson["Clausola0"].lemma_forma); @@ -1000,7 +995,7 @@ $(document).ready(function() { claParent.push([guiLogicString[i].replace("Clausola", ""), treeLevel[treeLevel.length - 1]]); }; }; - $(claParent).each(function(){ // rigenero le clausole nei tab + $(claParent).each(function(){ // rigenero le clausole nei tab PRIMA, per poter POI ricostruire la lista nel tab principale var itm = $(this)[0] if (itm != "OR" && itm != "AND") { clau2Make = queryJson["Clausola" + itm].TipoClausola; @@ -1060,6 +1055,24 @@ $(document).ready(function() { }; }); }; + + function resetAdvGui() { + var tabsContent=$("#cla-TabContent").find(".tab-pane:not(:first)"); + var tabs=$("#tab-list li:not(:first)"); + if ($(tabsContent).length) { + $(tabsContent).each(function(){ + $(this).remove(); + }); + $(tabs).each(function(){ + $(this).remove(); + }); + }; + claListLen = 0; + condListLen = 0; + tabID = 0; + $('#sortable0').html(emptyClaList); + }; + });