Index: trunk/admin/modules/Elezioni/ele_voti.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_voti.php	(revision 197)
+++ trunk/admin/modules/Elezioni/ele_voti.php	(revision 199)
@@ -40,4 +40,5 @@
 if (isset($param['prev_sez'])) $prev_sez=intval($param['prev_sez']); else $prev_sez='';
 if (isset($param['id_gruppo'])) $id_gruppo=intval($param['id_gruppo']); else $id_gruppo='';
+if (isset($param['update'])) $update=intval($param['update']); else $update='';
 include("modules/Elezioni/funzionidata.php");
 include("modules/Elezioni/ele.php");
@@ -455,5 +456,19 @@
    		if ($ops == 1) {
      			votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av);
-   		}
+   		}else{
+############# Controllo flag per cancellazione consultazione
+	echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n" 
+     ."//-->\n"; 
+     echo "function del_dati() {\n"; 
+     echo "if (document.getElementById('pwd3').checked==false) {\n"; 
+     echo "document.getElementById('update').value=\""._OK."\" \n"; 
+     echo "document.getElementById('do').value=\"0\" \n"; 
+     echo "}else{\n"; 
+     echo "document.getElementById('update').value=\""._DELETE."\" \n"; 
+     echo "document.getElementById('do').value=\"1\" \n"; 
+     echo "} \n"; 
+     echo "} \n"; 
+     echo "</script>\n"; 
+		}
 	/*
    		if ($ops == 2) {
@@ -597,5 +612,6 @@
 		."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"
 		."<input type=\"hidden\" name=\"tabella\" value=\"$tab\">"
-		."<input type=\"hidden\" name=\"id_lista\" value=\"$id_lista\">\n";
+		."<input type=\"hidden\" name=\"id_lista\" value=\"$id_lista\">\n"
+		."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">\n";
 		echo "<table class=\"table-menu\" style=\"width: 90%; color: black\">";
 		echo "<tr><td bgcolor=\"$bgcolor1\" align=\"left\" width=\"32\">";
@@ -696,6 +712,12 @@
 
 	}
-		echo "<tr><td></td><td></td><td align=\"center\"><input type=\"submit\" name=\"update\" value=\" "._OK. "\"></td>";
-		echo "</tr></table></form></tr></table>";
+		echo "<tr>";
+		echo "<td></td><td></td>";
+		echo "<td align=\"center\"><input type=\"submit\" id=\"update\" name=\"update\" value=\""._OK."\"></td>";
+		echo "</tr></table></form></tr>";
+		if(chisei()>=64){
+			echo "<td></td><td> <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_dati()\">"._DELETE."</td>";
+		}
+		echo "</table>";
 		echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"
 		."document.sezioni.voti1.focus()\n"
@@ -716,5 +738,5 @@
 
 function rec_voti() {
-	global $prefix, $dbi,$aid,$id_cons,$ops,$genere,$votog,$fileout,$id_comune,$limite;
+	global $prefix, $dbi,$aid,$id_cons,$ops,$genere,$votog,$fileout,$id_comune,$limite,$update;
 	$sqlcomu="select id_fascia from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";
 	$res = mysql_query($sqlcomu);
@@ -735,4 +757,5 @@
 	$tab = $arg[5];
 	$id_lista = intval($arg[6]);
+	$do= intval($arg[7]);
 	if ($tab=="_ele_voti_candidati") {
 		$condizione="id_cand";
@@ -742,5 +765,11 @@
 	if ((($genere==3) OR ($genere==5)) and !$id_lista and !$votog and ($fascia>$limite)) $y = (count($arg)-4);
 	else $y=count($arg);
-	for($i=7,$y--;$i< $y;$i++) {
+	if($do==1) {
+			mysql_query("delete from ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
+			mysql_query("delete from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
+			mysql_query("update  ".$prefix."_ele_sezioni set validi_lista='',contestati_lista='',voti_nulli_lista='',solo_gruppo='' where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
+	
+	}else{
+	for($i=8,$y--;$i< $y;$i++) {
 		$voti = intval($arg[$i++]);
 		$id_cand = intval($arg[$i]);
@@ -788,5 +817,5 @@
 	   }	
 	}
-
+	}
 	
 //	$ops = $arg[$argc];
@@ -1182,11 +1211,12 @@
 	echo "<td></td></tr></table>";
 	if ($validi+$nulli+$bianchi+$contestati+$votinulli>0 or $genere==0) {
-    echo "<form name=\"sezioni\" action=\"admin.php\">";
+    echo "<table class=\"table-menu\" style=\"width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" action=\"admin.php\">";
    	echo "<input type=\"hidden\" name=\"op\" value=\"rec_voti_gruppi\">"
     ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
     ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
     ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
-     ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">";
-	echo "<br><br> <table  class=\"table-menu\" style=\"width: 60%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"
+    ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"
+    ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">";
+	echo "<br><br> <table  class=\"table-menu\" style=\"width: 100%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"
 	."<td width=\"3%\"><b>"._NUM."</b></td>"
     ."<td width=\"50%\"><b>"._GRUPPO."</b></td>";
@@ -1265,7 +1295,12 @@
 	}
 
-   echo "<tr><td></td><td></td><td align=\"center\"><input type=\"submit\" name=\"update\" value=\" "._OK. "\"></td>";
-
-    echo "</tr></table></form><br><br> ";
+   echo "<tr><td></td><td></td><td align=\"center\"><input type=\"submit\" name=\"update\" id=\"update\" value=\" "._OK. "\"></td>";
+
+    echo "</tr></table></form></td></tr>";
+		if(chisei()>=64){
+			echo "<tr><td><input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_dati()\">"._DELETE."";
+		}
+
+	echo "</td></tr></table>";
 	}
     if ($genere!=0){
@@ -1295,5 +1330,14 @@
 $id_circ = intval($arg[3]);
 $id_sede = intval($arg[4]);
-$y=count($arg)-1;
+$do = intval($arg[5]);
+$y=count($arg)-1; 
+	if($do==1) {
+			mysql_query("delete from ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
+			mysql_query("delete from ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
+			mysql_query("delete from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
+			mysql_query("update  ".$prefix."_ele_sezioni set validi_lista='',contestati_lista='',voti_nulli_lista='',solo_gruppo='',solo_lista='' where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
+	
+	}else{
+
 if ($genere==0) {
 	$tab="_ele_voti_ref";
@@ -1306,5 +1350,5 @@
 }
 
-for($i=5;$i< $y;) {
+for($i=6;$i< $y;) {
 	$id_gruppo = intval($arg[$i++]);
 	$testval=0;
@@ -1367,4 +1411,5 @@
 
 }
+}
 //$ops = $arg[$argc];
 if ($fileout) fclose($fp);
