/* 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( "

Nessuna Versione precedente all'attuale

") } }, 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(/</g, "<").replace(/>/g, ">").replace(/"/g, "\""); version_container.find('.item_' + item + " .item_value").html("" + item_value + "") } } } 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); } }); }); }, } */ if($('.cont_maps').length){ $('.cont_maps ul li').click(function(){ var map = mapItMap.getInstance(); setTimeout(function(){ map.updateSize(); if(map.layers.length > 0) map.layers[0].redraw(); }, 100); }); }