sito per le richieste......
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

103 righe
3.3 KiB

/*
var versionamento = {
changes : [],
init : function(idPratica, lastVersion, currentVersion) {
var scope = this;
this.loadJsonVersion(idPratica, lastVersion, true);
if (currentVersion > 0) {
this.loadJsonVersion(idPratica, currentVersion, false);
setTimeout(function() {
scope.getChanges(idPratica, currentVersion);
}, 300)
} else {
$('#_1_WAR_portosboportlet_version_number .version_body').html(
"<p class=\"text-center version_item\">Nessuna Versione precedente all'attuale</p>")
}
},
sliderChange : function(idPratica, currentVersion) {
var scope = this;
this.loadJsonVersion(idPratica, currentVersion, false);
setTimeout(function() {
scope.getChanges(idPratica, currentVersion);
}, 300)
},
loadJsonVersion : function(idPratica, versionNumber, last) {
var scope = this;
Liferay.Service('/portos-bo-portlet.dettpratica/get-json-version', {
intPraticaId : idPratica,
version : versionNumber
}, function(obj) {
var item = last ? "_1_WAR_portosboportlet_version_last" : "_1_WAR_portosboportlet_version_number";
scope.updateHTML(JSON.parse(obj), item, last ? false : versionNumber);
});
},
getChanges : function(idPratica, versionNumber) {
var scope = this;
Liferay.Service('/portos-bo-portlet.dettpratica/call-for-changes',
{
intPraticaId : idPratica,
version : versionNumber
},
function(obj) {
var arr = JSON.parse(obj);
$("#_1_WAR_portosboportlet_version_number .version_item").removeClass("background-red")
$("#_1_WAR_portosboportlet_version_last .version_item").removeClass("background-green")
for (index in arr) {
var key = arr[index];
var left = $("#_1_WAR_portosboportlet_version_number .item_" + key), right = $("#_1_WAR_portosboportlet_version_last .item_"
+ key);
left.addClass("background-red")
right.addClass("background-green")
var heights = [ left, right ].map(function(item) {
return $(item).outerHeight();
});
left.css('height', Math.max.apply(null, heights));
right.css('height', Math.max.apply(null, heights));
}
}
);
},
updateHTML : function(obj, containerId, versionNumber) {
var scope = this;
var version_container = $('#' + containerId);
if (versionNumber) {
version_container.find(".number").html(versionNumber);
}
for (item in obj) {
var item_value = obj[item].replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&#034;/g, "\"");
version_container.find('.item_' + item + " .item_value").html("<strong>" + item_value + "</strong>")
}
}
}
var sliderVersion = {
init : function(val, idPratica) {
var initialValue = val;
var min = 1;
var maxValue = (val - 1) > 0 ? val - 1 : 0;
versionamento.init(idPratica, val, maxValue);
$("#label-slider").text(maxValue);
if (maxValue <= 1) {
$("#label-slider").css("margin-left", '0');
}
$(function() {
$("#slider").slider({
value : val,
min : 1,
max : maxValue,
step : 1,
slide : function(event, ui) {
$("#label-slider").text(ui.value);
if (maxValue == 0) {
$("#label-slider").css("margin-left", '0');
} else {
$("#label-slider").css("margin-left", (ui.value - min) / (maxValue - min) * 100 + '%');
}
$("#label-slider").css("left", "-15px");
versionamento.sliderChange(idPratica, ui.value);
}
});
});
},
}
*/