Aggiunte condizioni annidate nella GUI da query salvate
This commit is contained in:
parent
4fa1641734
commit
0fa822bead
|
@ -128,11 +128,11 @@ $(document).ready(function() {
|
|||
$('#cla' + tabID + '-tab').tab('show');
|
||||
break;
|
||||
case "andCond":
|
||||
addLogicCond("AND")
|
||||
addLogicCond("AND","#sortable0")
|
||||
refreshConnectWith();
|
||||
break;
|
||||
case "orCond":
|
||||
addLogicCond("OR")
|
||||
addLogicCond("OR","#sortable0")
|
||||
refreshConnectWith();
|
||||
break;
|
||||
default:
|
||||
|
@ -638,7 +638,7 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
// Funzione di creazione del LI delle condizioni logiche
|
||||
function addLogicCond(condtype){
|
||||
function addLogicCond(condtype,sortableNum){
|
||||
condListLen++;
|
||||
if (condtype == "AND") {
|
||||
var LItext = condLIpart1 + condListLen + condLIpart2and + condListLen + condLIpart3and + condListLen + condLIpart4;
|
||||
|
@ -648,7 +648,7 @@ $(document).ready(function() {
|
|||
if ($("#H-cla0")[0]) {
|
||||
$("#H-cla0")[0].remove();
|
||||
};
|
||||
$("#sortable0").append(LItext);
|
||||
$(sortableNum).append(LItext);
|
||||
$("#sortable" + condListLen).sortable();
|
||||
$("#sortable" + condListLen).sortable( "option", "appendTo", document.body );
|
||||
$("#sortable" + condListLen).sortable({
|
||||
|
@ -931,6 +931,7 @@ $(document).ready(function() {
|
|||
};
|
||||
|
||||
function makeUpGui(queryJson) {
|
||||
$("#risultatitesto").val(queryJson["LogicaGui"]);
|
||||
// 1. verifica json legit --> TO DO
|
||||
// 2. pulire interfaccia --> OK
|
||||
// 3. clausola0 --> OK
|
||||
|
@ -961,32 +962,39 @@ $(document).ready(function() {
|
|||
};
|
||||
// 4 e 5:
|
||||
guiLogicString = queryJson.LogicaGui;
|
||||
var clauCount = 0;
|
||||
var clau2Make = "";
|
||||
var treeLevel = [];
|
||||
var claParent = [];
|
||||
for (var i=0; i < guiLogicString.length; i++) {
|
||||
//console.log("- " + logicExpr[i]);
|
||||
switch (guiLogicString[i]) {
|
||||
case "(":
|
||||
//console.log("(");
|
||||
break;
|
||||
case ")":
|
||||
//console.log(")");
|
||||
treeLevel.pop();
|
||||
break;
|
||||
case "OR":
|
||||
addLogicCond("OR");
|
||||
addLogicCond("OR",treeLevel[treeLevel.length - 1]);
|
||||
treeLevel.push("#sortable" + condListLen);
|
||||
guiLogicString[i] = "#sortable" + condListLen;
|
||||
refreshConnectWith();
|
||||
break;
|
||||
case "AND":
|
||||
if (i > 1) {
|
||||
addLogicCond("AND");
|
||||
addLogicCond("AND",treeLevel[treeLevel.length - 1]);
|
||||
treeLevel.push("#sortable" + condListLen);
|
||||
refreshConnectWith();
|
||||
guiLogicString[i] = "#sortable" + condListLen;
|
||||
} else {
|
||||
guiLogicString[1] = "#sortable0";
|
||||
treeLevel.push("#sortable0");
|
||||
};
|
||||
break;
|
||||
default:
|
||||
clauCount++
|
||||
claParent.push(treeLevel[treeLevel.length - 1]);
|
||||
};
|
||||
};
|
||||
for (var i=1; i <= clauCount; i++) {
|
||||
//console.log(claParent);
|
||||
for (var i=1; i <= claParent.length; i++) {
|
||||
clau2Make = queryJson["Clausola" + i].TipoClausola;
|
||||
active = queryJson["Clausola" + i].Attiva
|
||||
switch (clau2Make) {
|
||||
|
@ -997,19 +1005,6 @@ $(document).ready(function() {
|
|||
$("#cla" + tabID + " .catgram").val(selectedValue);
|
||||
addCatgramSubcla("cla" + tabID,selectedValue);
|
||||
var ks = Object.keys(queryJson["Clausola" + i]);
|
||||
/* for (var j = 5; j < ks.length; j++) {
|
||||
switch ($("#cla" + i + ks[j])[0].type) {
|
||||
case "fieldset":
|
||||
var sval = queryJson["Clausola" + i][ks[j]]
|
||||
$("#cla" + tabID + sval.replace(/\s/g, '')).attr("checked",true);
|
||||
console.log(sval);
|
||||
break;
|
||||
case "select-one":
|
||||
$("#cla" + i + ks[j]).val([queryJson["Clausola" + i][ks[j]]])
|
||||
break;
|
||||
default:
|
||||
};
|
||||
}; */
|
||||
for (var j = 5; j < ks.length; j++) {
|
||||
var test="cla" + i + ks[j];
|
||||
var melement = document.getElementById(test);
|
||||
|
@ -1044,17 +1039,13 @@ $(document).ready(function() {
|
|||
case "Struttura":
|
||||
addStruCla(active);
|
||||
break;
|
||||
/* case "andCond":
|
||||
addLogicCond("AND");
|
||||
refreshConnectWith();
|
||||
break;
|
||||
case "orCond":
|
||||
addLogicCond("OR");
|
||||
refreshConnectWith();
|
||||
break; */
|
||||
default:
|
||||
};
|
||||
var ind = guiLogicString.indexOf("Clausola" + i);
|
||||
guiLogicString[ind] = "#cla" + tabID;
|
||||
};
|
||||
// 6:
|
||||
//console.log(guiLogicString);
|
||||
refreshTabList();
|
||||
refreshClaList();
|
||||
refreshSortables();
|
||||
|
|
Loading…
Reference in New Issue