diff --git a/index_5.1.html b/index_5.1.html
index 9041daa..84eec78 100644
--- a/index_5.1.html
+++ b/index_5.1.html
@@ -1947,7 +1947,7 @@
-
@@ -2008,7 +2008,7 @@
+ style="z-index: 90" id="removeRifxR3Rx">
diff --git a/js/script_5.1.js b/js/script_5.1.js
index e1f042b..1503100 100644
--- a/js/script_5.1.js
+++ b/js/script_5.1.js
@@ -408,6 +408,7 @@ $(document).ready(function() {
$(tabPanelId).attr("data-claActive", 0);
$(this).closest('li').find('.clatext').fadeTo( "slow", 0.6 );
}
+ refreshClaList();
refreshSortables();
});
@@ -1003,17 +1004,34 @@ $(document).ready(function() {
queryJson.Clausola0.contesto = JSON.stringify(window.context0);
queryJson.unitaRicerca = $("#unitaRicerca")[0].options[$("#unitaRicerca")[0].selectedIndex].value;
var claLiArray = $("#sortable0").find(".claLI");
+ var countActCla = 0;
+ var buttonID = "";
if ($(claLiArray).length) {
if ($("#li-cla0")[0]) {
- $("#li-cla0")[0].remove();
+ $("#li-cla0")[0].remove();
};
$(claLiArray).each(function(){
var claIdNum = $(this).attr('id').substr(6);
+ if ($(this).find(".claAct").prop('checked')) {
+ countActCla++;
+ }
updateClaListItem(claIdNum, "#sortable0");
});
if ($(claLiArray).length == 1) {
var remCla = claLiArray.find(".removeCla");
remCla.addClass("disabled");
+ var actCla = claLiArray.find(".claAct");
+ actCla.prop('disabled', true);
+ } else {
+ if ( countActCla == 1 ) {
+ claLiArray.find(".claAct").each(function(){
+ if ($(this).prop('checked')) {
+ $(this).prop('disabled', true);
+ buttonID = "removeCla" + $(this).attr('id').substr(9);
+ $('#'+buttonID).addClass("disabled");
+ }
+ });
+ }
};
} else {
if (claListLen == 0 && condListLen == 0) {
@@ -1026,16 +1044,32 @@ $(document).ready(function() {
var rifLiArray = $("#sortableRif0").find(".rifLI");
if ($(rifLiArray).length) {
+ countActCla = 0;
if ($("#li-rif0")[0]) {
$("#li-rif0")[0].remove();
};
$(rifLiArray).each(function(){
var rifIdNum = $(this).attr('id').substr(6);
+ if ($(this).find(".claAct").prop('checked')) {
+ countActCla++;
+ }
updateRifListItem(rifIdNum, "#sortableRif0");
});
if ($(rifLiArray).length == 1) {
var remCla = rifLiArray.find(".removeCla");
remCla.addClass("disabled");
+ var actCla = rifLiArray.find(".claAct");
+ actCla.prop('disabled', true);
+ } else {
+ if ( countActCla == 1 ) {
+ rifLiArray.find(".claAct").each(function(){
+ if ($(this).prop('checked')) {
+ $(this).prop('disabled', true);
+ buttonID = "removeRif" + $(this).attr('id').substr(9);
+ $('#'+buttonID).addClass("disabled");
+ }
+ });
+ }
};
} else {
if (rifLiArray == 0 && condListRifLen == 0) {
@@ -1076,33 +1110,38 @@ $(document).ready(function() {
checkInsert = ' checked="checked"';
};
var remCla = $("#" + rifListItemId).find(".removeCla");
- if (remCla.hasClass("disabled")){
- remCla.removeClass("disabled");
+ if (remCla.hasClass("disabled")) {
+ remCla.removeClass("disabled");
}
- rifSubParList.each(function(){
- var claSubParType = $(this)[0].type;
- if (claSubParType == "select-one") {
- if (!($(this).prop("disabled"))) {
- rifText = rifText + $(this)[0].title + ': ' + $(this)[0].options[$(this)[0].selectedIndex].text + '; ';
- };
- jsonTextToParse = jsonTextToParse + ', "' + $(this)[0].id.replace(rifIdNum,"") + '": "' + $(this)[0].options[$(this)[0].selectedIndex].value + '"';
- if ($(this)[0].id.startsWith("Tipo_Riferimento")) {
- if ($(this)[0][3].selected) {
- $('#Tipo_Citazione'+rifIdNum)[0].removeAttribute("style");
- $('#Tipo_Citazione'+rifIdNum).prop('disabled', false);
- } else {
- $('#Tipo_Citazione'+rifIdNum)[0].selectedIndex = 0;
- $('#Tipo_Citazione'+rifIdNum)[0].setAttribute("style", "opacity: 0.6;");
- $('#Tipo_Citazione'+rifIdNum).prop('disabled', true);
- }
- };
+ var actCla = $("#" + rifListItemId).find(".claAct");
+ if (actCla.attr('disabled')) {
+ actCla.prop('disabled', false);
+ }
+
+ rifSubParList.each(function() {
+ var claSubParType = $(this)[0].type;
+ if (claSubParType == "select-one") {
+ if (!($(this).prop("disabled"))) {
+ rifText = rifText + $(this)[0].title + ': ' + $(this)[0].options[$(this)[0].selectedIndex].text + '; ';
};
- if (claSubParType == "text" && $(this)[0].value) {
- rifText = rifText + $(this)[0].name + ': "' + $(this)[0].value + '"; ';
- jsonTextToParse = jsonTextToParse + ', "' + $(this)[0].id.replace(rifIdNum,"") + '": "' + $(this)[0].value + '"';
+ jsonTextToParse = jsonTextToParse + ', "' + $(this)[0].id.replace(rifIdNum, "") + '": "' + $(this)[0].options[$(this)[0].selectedIndex].value + '"';
+ if ($(this)[0].id.startsWith("Tipo_Riferimento")) {
+ if ($(this)[0][3].selected) {
+ $('#Tipo_Citazione' + rifIdNum)[0].removeAttribute("style");
+ $('#Tipo_Citazione' + rifIdNum).prop('disabled', false);
+ } else {
+ $('#Tipo_Citazione' + rifIdNum)[0].selectedIndex = 0;
+ $('#Tipo_Citazione' + rifIdNum)[0].setAttribute("style", "opacity: 0.6;");
+ $('#Tipo_Citazione' + rifIdNum).prop('disabled', true);
+ }
};
- });
- jsonTextToParse = jsonTextToParse.replace('{, ','{') + '}'
+ };
+ if (claSubParType == "text" && $(this)[0].value) {
+ rifText = rifText + $(this)[0].name + ': "' + $(this)[0].value + '"; ';
+ jsonTextToParse = jsonTextToParse + ', "' + $(this)[0].id.replace(rifIdNum, "") + '": "' + $(this)[0].value + '"';
+ };
+ });
+ jsonTextToParse = jsonTextToParse.replace('{, ', '{') + '}'
if ($("#" + rifListItemId)[0]) {
$("#" + rifListItemId + " .clatext").replaceWith('' + rifText + '
Contesto: ' + contextText + '');
} else {
@@ -1130,6 +1169,11 @@ $(document).ready(function() {
if (remCla.hasClass("disabled")){
remCla.removeClass("disabled");
}
+ var actCla = $("#" + claListItemId).find(".claAct");
+ if (actCla.attr('disabled')) {
+ actCla.prop('disabled', false);
+ }
+
switch (claType) {
case "Clausola":
var l_f = $("form #lemma_forma" + claIdNum)[0].options[$("form #lemma_forma" + claIdNum)[0].selectedIndex].value;