gestioneEstrazioniElenco.jsp 8.32 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
<%@ include file="/project/include.jsp" %>

<script type="text/javascript" src="${j:getResourceUrlOfModule('threads', 'js/threads.js')}">
</script>

<script type="text/javascript">
	var runningIdMonitor = '${dto_monitor_id}';
	var runningIdThread = '${dto_thread_id}';
	
	if (runningIdThread) {
		registerOnDocumentLoad(function() {	
			// C' un thread che mi risponde
			var threadMonitor = new ThreadMonitor(runningIdThread, 5000);
			threadMonitor.showState = function(state) {
				if (state == THREAD_STOP || state == THREAD_EXCEPTION) {
					splitRow(state);
				} 
			}
			threadMonitor.start();					
		});
	}
	
	function splitRow(state) {
		if (state == THREAD_STOP) {
			jsLoadMap('it.cedaf.icare.estrazioni.control.action.ThreadInfoAfterRunningExecutor', 'idMonitor=' + runningIdMonitor, 'showThreadInfo', JS_ASYNC, NO_LOADING);		
		} else {
			document.getElementById('running_gif').src = juiceGetResource('shell', 'img/messages/error-small.gif');
			document.getElementById('running_idDelete').style.display = 'block';
						
			document.getElementById('running_gif').onclick = function() { viewLogException('', runningIdMonitor); };
		}
	}	
	
	function showThreadInfo(map) {
		document.getElementById('running_gif').src = juiceGetResource('shell', 'img/misc/check_small.gif');
		document.getElementById('running_idDataFine').innerHTML = '&nbsp;' + map.get('dataFine') + '&nbsp;';
		document.getElementById('running_idDescription').innerHTML = '&nbsp;' + map.get('fileName') + ' (' + map.get('fileSize') + ')&nbsp;';
		document.getElementById('running_idDownload').style.display = 'block';
		document.getElementById('running_idDelete').style.display = 'block';
	}
		
	function downloadEstrazione(idMonitor) {
		juiceDownload('it.cedaf.icare.estrazioni.etc.EstrazioniFileContentProvider',  'idMonitor='+idMonitor);
	}
	
	function deleteEstrazione(idMonitor) {
		if (confirm("Procedere nell'eliminazione dell'estrazione selezionata?")){	
			var event = "estrazioni.deleteEstrazione?idMonitor=" + idMonitor;
			juiceChangeLocation(event);
		}
	}	
	
	function showError(idMonitor) {
		var error = jsLoadString('it.cedaf.icare.estrazioni.control.action.MostraErroreExecutor', '&idMonitor=' + idMonitor);
		alert('Errore:\n' + error);
	}

	function eliminaSelezionati() {
		var idMonitors = '';
		var checkboxes = document.getElementsByName('estrazioni_ids');
		for (var i=0; i<checkboxes.length; i++) {
			if (checkboxes[i].checked) {
				if (idMonitors != '') idMonitors += ',';
				idMonitors += checkboxes[i].value;
			}
		}
		if (idMonitors == '') {
			alert('Nessuna estrazione selezionata');
			return;
		} 
		if (confirm("Procedere nell'eliminazione delle estrazioni selezionate?")) {	
			var event = "estrazioni.deleteEstrazione?idMonitor=" + idMonitors;
			juiceChangeLocation(event);
		}
	}	

	function selezionaTutto() {
		var checkboxes = document.getElementsByName('estrazioni_ids');
		for (var i=0; i<checkboxes.length; i++) {
			checkboxes[i].checked = true;
		}
	}

	function invertiSelezione() {
		var checkboxes = document.getElementsByName('estrazioni_ids');
		for (var i=0; i<checkboxes.length; i++) {
			checkboxes[i].checked = !checkboxes[i].checked;
		}
	}

	function annullaSelezione() {
		var checkboxes = document.getElementsByName('estrazioni_ids');
		for (var i=0; i<checkboxes.length; i++) {
			checkboxes[i].checked = false;
		}
	}
	
	function viewLogException(dataInizio, idMonitor) {
	
		var result = jsLoadString('it.cedaf.icare.commons.model.datamanagement.LogExceptionFromEstrazioneInitializer');
		if (result == 'OK') {
			buiOpenNewDataManagement('commons.logException', 'init=it.cedaf.icare.commons.model.datamanagement.LogExceptionFromEstrazioneInitializer&dataInizio=' + dataInizio + '&idMonitor=' + idMonitor);
		}
	}
	
</script>

<j:tile name="estrazioni.gestioneEstrazioniHeader" />

<div style="text-align: right; padding-top: 4px; padding-bottom: 8px; padding-right: 4px;">
<shell:button id="selezionaTutto" href="javascript:selezionaTutto()" text="${j:bundle('LBL_estrazioni_elenco_selezioneTutto')}" title="${j:bundle('LBL_estrazioni_elenco_selezioneTutto_TOOLTIP')}" />
&nbsp;&nbsp;
<shell:button id="invertiSelezione" href="javascript:invertiSelezione()" text="${j:bundle('LBL_estrazioni_elenco_selezioneInverti')}" title="${j:bundle('LBL_estrazioni_elenco_selezioneInverti_TOOLTIP')}" />
&nbsp;&nbsp;
<shell:button id="annullaSelezione" href="javascript:annullaSelezione()" text="${j:bundle('LBL_estrazioni_elenco_selezioneAnnulla')}" title="${j:bundle('LBL_estrazioni_elenco_selezioneAnnulla_TOOLTIP')}" />
&nbsp;&nbsp;
<shell:button id="eliminaSelezionati" href="javascript:eliminaSelezionati()" text="${j:bundle('LBL_estrazioni_elenco_selezioneElimina')}" title="${j:bundle('LBL_estrazioni_elenco_selezioneElimina_TOOLTIP')}"  img="commons.docdelete" />
</div>

<table class="static-grid-table" width="100%">
	<tr>
		<td class="static-grid-column-title" style="text-align: center">&nbsp;</td>
   		<td class="static-grid-column-title" style="text-align: center; width:13%">${j:bundle('LBL_estrazioni_elencoGrid_dataInizio')}</td>
   		<td class="static-grid-column-title" style="text-align: center; width:13%">${j:bundle('LBL_estrazioni_elencoGrid_dataFine')}</td>
   		<td class="static-grid-column-title" style="text-align: center; width:20%">${j:bundle('LBL_estrazioni_elencoGrid_titolo')}</td>
   		<td class="static-grid-column-title" style="text-align: center; width:40%">${j:bundle('LBL_estrazioni_elencoGrid_file')}</td>
   		<td class="static-grid-column-title" style="text-align: center; width:9%">&nbsp;</td>
   		<td class="static-grid-column-title" style="text-align: center; width:5%">&nbsp;</td>
   	</tr>
	<c:forEach var="estrazione" items="${dto_estrazioni_attive}">
		<c:choose>
   				<c:when test="${estrazione.running}">
   					<c:set var="running_idDataFine" value="id=running_idDataFine" />
   					<c:set var="running_idDescription" value="id=running_idDescription" />
   					<c:set var="running_idDownload" value="id=running_idDownload" />
   					<c:set var="running_styleDownload" value="display: none;" />
   					<c:set var="running_idDelete" value="id=running_idDelete" />
   					<c:set var="running_styleDelete" value="display: none;" />
   				</c:when>
   				<c:otherwise>
   					<c:set var="running_idDataFine" value="" />
   					<c:set var="running_idDescription" value="" />
   					<c:set var="running_idDownload" value="" />
   					<c:set var="running_styleDownload" value="" />
   					<c:set var="running_idDelete" value="" />
   					<c:set var="running_styleDelete" value="" />
   				</c:otherwise>  
   		</c:choose>
		<tr>
			<td class="static-grid-td" style="white-space: nowrap">
				<c:choose>
   				<c:when test="${estrazione.stopped}"><img src="${j:getResourceUrlOfModule('shell', 'img/misc/check_small.gif')}"></c:when>
   				<c:when test="${estrazione.error}"><img src="${j:getResourceUrlOfModule('shell', 'img/messages/error-small.gif')}" onclick="javascript:viewLogException('${estrazione.dataInizio}', '')"></c:when>
   				<c:when test="${estrazione.running}"><img id="running_gif" src="${j:getResourceUrlOfModule('estrazioni', 'img/running.gif')}"></c:when>  
   				</c:choose>
   			</td>
			<td class="static-grid-td" style="white-space: nowrap">&nbsp;${estrazione.dataInizio}&nbsp;</td>
			<td ${running_idDataFine} class="static-grid-td" style="white-space: nowrap">&nbsp;${estrazione.dataFine}&nbsp;</td>
			<td class="static-grid-td" style="white-space: nowrap">&nbsp;${estrazione.description}&nbsp;</td>
			<td ${running_idDescription} class="static-grid-td" style="white-space: nowrap">&nbsp;<c:if test="${!empty estrazione.fileName}">${estrazione.fileName} (${estrazione.fileSize})</c:if>&nbsp;</td>
			<td class="static-grid-td" style="white-space: nowrap; text-align: center">
				<c:choose>
   				<c:when test="${estrazione.stopped || estrazione.running}">
   					<span ${running_idDownload} style="${running_styleDownload}"><shell:button href="javascript:downloadEstrazione(${estrazione.id});" text="Download" title="Esegue il download del file ${estrazione.fileName}" img="documentiallegati.download"/></span>
   				</c:when>
   				<c:when test="${estrazione.error}">&nbsp;</c:when>	 
   				</c:choose>
   			</td>
			<td class="static-grid-td" style="white-space: nowrap; text-align: center">
				<span ${running_idDelete} style="${running_styleDelete}"><input name="estrazioni_ids" type="checkbox" value="${estrazione.id}" /></span>
			</td>
		</tr>
	</c:forEach>		
</table>