Modificato html e modo di generare i LI del pannello, corretti bugs

This commit is contained in:
Luca Trupiano 2022-12-07 19:02:56 +01:00
parent d54f716913
commit 089f721787
2 changed files with 1209 additions and 1920 deletions

File diff suppressed because it is too large Load Diff

View File

@ -86,7 +86,7 @@ $(document).ready(function() {
handle: ".handle" handle: ".handle"
}); });
// Inizializza selectable0 e definisce le funzioni // Inizializza selectableS e definisce le funzioni
$("#selectableS").selectable({ $("#selectableS").selectable({
filter: "td", filter: "td",
//appendTo: "#someElem", //appendTo: "#someElem",
@ -105,7 +105,7 @@ $(document).ready(function() {
} }
}); });
// Inizializza selectable e definisce le funzioni // Inizializza selectable0 e definisce le funzioni
$("#selectable0").selectable({ $("#selectable0").selectable({
filter: "td", filter: "td",
//appendTo: "#someElem", //appendTo: "#someElem",
@ -268,10 +268,11 @@ $(document).ready(function() {
} }
const sparqlGenerator = sparqljs.Generator; const sparqlGenerator = sparqljs.Generator;
jsonQuery = buildSQ(queryJson); jsonQuery = buildSQ(queryJson);
queryFields = []; //queryFields = [];
for (var i in jsonQuery.variables) { //for (var i in jsonQuery.variables) {
queryFields.push(jsonQuery.variables[i].variable.value); // queryFields.push(jsonQuery.variables[i].variable.value);
} //}
console.log(jsonQuery);
execQuery = new sparqlGenerator().stringify(jsonQuery); execQuery = new sparqlGenerator().stringify(jsonQuery);
executeQuery(); executeQuery();
return false; return false;
@ -459,13 +460,13 @@ $(document).ready(function() {
var condLIplaceholderText2 = 'Trascina qui almeno 2 clausole o condizioni'; var condLIplaceholderText2 = 'Trascina qui almeno 2 clausole o condizioni';
var condLIplaceholderText1d = 'Trascina qui almeno 1 clausola o condizione, oppure attiva le clausole inattive'; var condLIplaceholderText1d = 'Trascina qui almeno 1 clausola o condizione, oppure attiva le clausole inattive';
var condLIplaceholderText2d = 'Trascina qui almeno 2 clausole o condizioni, oppure attiva le clausole inattive'; var condLIplaceholderText2d = 'Trascina qui almeno 2 clausole o condizioni, oppure attiva le clausole inattive';
var condLIplaceholderPart1 = '<li id="placeholderSort'; var condLIplaceholderPart1 = '<li id="placeholderSort';
var condLIplaceholderPart2 = '" class="mx-0 my-1 p-1 pl-3 list-group-item align-items-center border text-muted small bg-light ui-state-disabled ui-state-disabled-opacity-06">'; var condLIplaceholderPart2 = '" class="mx-0 my-1 p-1 pl-3 list-group-item align-items-center border text-muted small bg-light ui-state-disabled ui-state-disabled-opacity-06">';
var condLIpart1 = '<li id="cond'; var condLIpart1 = '<li id="cond';
var condLIpart2and = '" class="condLIand mx-0 my-1 p-1 list-group-item align-items-center border text-muted bg-lida10"><ul id="sortable'; var condLIpart2and = '" class="condLI-AND mx-0 my-1 p-1 list-group-item align-items-center border text-muted bg-lida10"><ul id="sortable';
var condLIpart3and = '" class="handle list-group ui-sortable"><div class="row ml-1 pr-2 justify-content-between"><div class=" pb-1 small font-weight-bold text-muted">AND</div>' + iconCloseCond + '</div>' + condLIplaceholderPart1; var condLIpart3and = '" class="handle list-group ui-sortable"><div class="row ml-1 pr-2 justify-content-between"><div class=" pb-1 small font-weight-bold text-muted">AND</div>' + iconCloseCond + '</div>' + condLIplaceholderPart1;
var condLIpart2or = '" class="condLIor mx-0 my-1 p-1 list-group-item align-items-center border text-muted bg-lida11"><ul id="sortable'; var condLIpart2or = '" class="condLI-OR mx-0 my-1 p-1 list-group-item align-items-center border text-muted bg-lida11"><ul id="sortable';
var condLIpart3or = '" class="handle list-group ui-sortable"><div class="row ml-1 pr-2 justify-content-between"><div class=" pb-1 small font-weight-bold text-muted">OR</div>' + iconCloseCond + '</div>' + condLIplaceholderPart1; var condLIpart3or = '" class="handle list-group ui-sortable"><div class="row ml-1 pr-2 justify-content-between"><div class=" pb-1 small font-weight-bold text-muted">OR</div>' + iconCloseCond + '</div>' + condLIplaceholderPart1;
var condLIpart4 = condLIplaceholderPart2 + condLIplaceholderText2 + '</li></ul></li>'; var condLIpart4 = condLIplaceholderPart2 + condLIplaceholderText2 + '</li></ul></li>';
@ -559,7 +560,6 @@ $(document).ready(function() {
// Funzione di creazione del tab delle clausole grammaticali // Funzione di creazione del tab delle clausole grammaticali
function addGramCla(active,tabID){ function addGramCla(active,tabID){
claListLen++;
if (active > 0) { if (active > 0) {
var checkInsert = ' checked="checked"'; var checkInsert = ' checked="checked"';
} else { } else {
@ -688,7 +688,6 @@ $(document).ready(function() {
// Funzione di creazione del tab delle clausole sintattiche // Funzione di creazione del tab delle clausole sintattiche
function addSyntCla(active,tabID){ function addSyntCla(active,tabID){
claListLen++;
if (active > 0) { if (active > 0) {
var checkInsert = ' checked="checked"'; var checkInsert = ' checked="checked"';
} else { } else {
@ -710,7 +709,6 @@ $(document).ready(function() {
// Funzione di creazione del tab delle clausole metafore // Funzione di creazione del tab delle clausole metafore
function addMetaCla(active,tabID){ function addMetaCla(active,tabID){
claListLen++;
var checkInsert = ' disabled'; var checkInsert = ' disabled';
//if (active > 0) { //if (active > 0) {
// var checkInsert = '" checked="checked"'; // var checkInsert = '" checked="checked"';
@ -725,15 +723,19 @@ $(document).ready(function() {
// Funzione di creazione del LI delle condizioni logiche // Funzione di creazione del LI delle condizioni logiche
function addLogicCond(condtype,sortableId){ function addLogicCond(condtype,sortableId){
condListLen++; condListLen++;
var cloneLI = document.getElementById("condxX4Xx").cloneNode(true);
cloneLI.removeAttribute("style");
cloneLI = cloneLI.outerHTML.replace(/xX4Xx/g, condListLen)
cloneLI = cloneLI.replace(/xX5Xx/g, condtype)
if (condtype == "AND") { if (condtype == "AND") {
var LItext = condLIpart1 + condListLen + condLIpart2and + condListLen + condLIpart3and + condListLen + condLIpart4; cloneLI = cloneLI.replace(/xX6Xx/g, "light")
} else { } else {
var LItext = condLIpart1 + condListLen + condLIpart2or + condListLen + condLIpart3or + condListLen + condLIpart4; cloneLI = cloneLI.replace(/xX6Xx/g, "lida11")
} }
if ($("#li-cla0")[0]) { if ($("#li-cla0")[0]) {
$("#li-cla0")[0].remove(); $("#li-cla0")[0].remove();
}; };
$(sortableId).append(LItext); $(sortableId).append($(cloneLI)[0]);
$("#sortable" + condListLen).sortable(); $("#sortable" + condListLen).sortable();
$("#sortable" + condListLen).sortable( "option", "appendTo", document.body ); $("#sortable" + condListLen).sortable( "option", "appendTo", document.body );
$("#sortable" + condListLen).sortable({ $("#sortable" + condListLen).sortable({
@ -748,11 +750,12 @@ $(document).ready(function() {
// Funzione di creazione del LI di una clausola nella lista sortable // Funzione di creazione del LI di una clausola nella lista sortable
function addLIitem(sortableId,tabID,claText,checkInsert){ function addLIitem(sortableId,tabID,claText,checkInsert){
var cloneLI = document.getElementById("li-cla_xX1Xx_").cloneNode(true); claListLen++;
var cloneLI = document.getElementById("li-claxX1Xx").cloneNode(true);
cloneLI.removeAttribute("style"); cloneLI.removeAttribute("style");
cloneLI = cloneLI.outerHTML.replace(/_xX1Xx_/g, tabID) cloneLI = cloneLI.outerHTML.replace(/xX1Xx/g, tabID)
cloneLI = cloneLI.replace(/_xX2Xx_/g, claText) cloneLI = cloneLI.replace(/xX2Xx/g, claText)
cloneLI = cloneLI.replace(/_xX3Xx_"/g, tabID + '" ' + checkInsert) cloneLI = cloneLI.replace(/xX3Xx"/g, tabID + '" ' + checkInsert)
$(sortableId).append($(cloneLI)[0]); $(sortableId).append($(cloneLI)[0]);
}; };
@ -871,7 +874,7 @@ $(document).ready(function() {
$(this).find('.clatext').css({ opacity: 0.6 }); $(this).find('.clatext').css({ opacity: 0.6 });
}; };
}); });
$(".ui-sortable:not(:first)").each(function() { $("#cla-TabContent .ui-sortable:not(:first)").each(function() {
var sortableID = $(this)[0].id; var sortableID = $(this)[0].id;
var placeholderID = "#placeholderSort" + sortableID.slice(-1); var placeholderID = "#placeholderSort" + sortableID.slice(-1);
var iconSpan = $(this).find(".iconClClass")[0]; var iconSpan = $(this).find(".iconClClass")[0];
@ -967,14 +970,14 @@ $(document).ready(function() {
var items = $(sortableList).children("li"); var items = $(sortableList).children("li");
var itemsText = []; var itemsText = [];
$(items).each(function() { $(items).each(function() {
if ($(this).hasClass("condLIand")) { if ($(this).hasClass("condLI-AND")) {
var andID = "#" + $(this).children("ul").attr("id"); var andID = "#" + $(this).children("ul").attr("id");
var andText = parseCond(andID, "AND", forGui); var andText = parseCond(andID, "AND", forGui);
if (andText.length){ if (andText.length){
itemsText.push(andText); itemsText.push(andText);
}; };
}; };
if ($(this).hasClass("condLIor")) { if ($(this).hasClass("condLI-OR")) {
var orID = "#" + $(this).children("ul").attr("id"); var orID = "#" + $(this).children("ul").attr("id");
var orText = parseCond(orID, "OR", forGui); var orText = parseCond(orID, "OR", forGui);
if (orText.length){ if (orText.length){