commit 4b5c5da989254603c00328740d7b8041362be61d
Author: Romuald <devnull@localhost>
Date:   Mon Jun 13 14:29:43 2011 +0200

    On ne se base plus sur la couleur pour décider de l'action (add ou del).

diff --git a/index.php b/index.php
index 6e6a560..59338fd 100644
--- a/index.php
+++ b/index.php
@@ -76,7 +76,7 @@
 			$conges[$nom][] = $str_date.($demi_jour ? " $demi_jour" : "");
 			setConges('datas', $nom, $conges);
 		}
-	} elseif ($_POST['action'] == 'delete') {
+	} elseif ($_POST['action'] == 'del') {
 		if ($conges[$nom] && in_array($str_date, $conges[$nom])) {
 			$key = array_search($str_date, $conges[$nom]);
 			unset($conges[$nom][$key]);
@@ -126,14 +126,8 @@
 	<meta name="copyright" content="Tous droits réservés - All Rights Reserved" />
 	<meta name="author" content="Romuald DELAVERGNE">
 	<script language=JavaScript>
-		function updateConges(jour, nom, str_date) {
-			if (jour.style.backgroundColor == 'white') {
-				//jour.style.backgroundColor='lightblue';
-				document.forms["update"].action.value = 'add';
-			} else {
-				//jour.style.backgroundColor='white';
-				document.forms["update"].action.value = 'delete';
-			}
+		function updateConges(jour, nom, str_date, action) {
+			document.forms["update"].action.value = action;
 			document.forms["update"].nom.value = nom;
 			document.forms["update"].str_date.value = str_date;
 			document.forms["update"].submit();
@@ -202,7 +196,7 @@
 				} else if (isset($conges[$nom]) && in_array($str_date, $conges[$nom])) {
 					$color = "blue";
 					$day = "congé";
-					$libOnClick = " onClick=\"updateConges(this, '$nom', '$str_date')\"";
+					$libOnClick = " onClick=\"updateConges(this, '$nom', '$str_date', 'del')\"";
 				} else if (isset($conges[$nom]) && in_array("$str_date AM", $conges[$nom]) && in_array("$str_date PM", $conges[$nom])) {
 					$color = "blue";
 					$day = "congé AP";
@@ -214,20 +208,20 @@
 					$day = "congé PM";
 				} else {
 					$color = "white";
-					$libOnClick = " onClick=\"updateConges(this, '$nom', '$str_date')\"";
+					$libOnClick = " onClick=\"updateConges(this, '$nom', '$str_date', 'add')\"";
 				}
 ?>
 <?php
 				if ($day == "congé AM") {
 ?>
-			<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> AM')">&nbsp;</td>
-			<td style="cursor: pointer; background-color: white" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> PM')">&nbsp;</td>
+			<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> AM', 'del')">&nbsp;</td>
+			<td style="cursor: pointer; background-color: white" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> PM', 'add')">&nbsp;</td>
 <?php 	} elseif ($day == "congé PM") { ?>
-			<td style="cursor: pointer; background-color: white" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> AM')">&nbsp;</td>
-			<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> PM')">&nbsp;</td>
+			<td style="cursor: pointer; background-color: white" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> AM', 'add')">&nbsp;</td>
+			<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> PM', 'del')">&nbsp;</td>
 <?php 	} elseif ($day == "congé AP") { ?>
-			<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> AM')">&nbsp;</td>
-			<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> PM')">&nbsp;</td>
+			<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> AM', 'del')">&nbsp;</td>
+			<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> PM', 'del')">&nbsp;</td>
 <?php 	} else {?>
 			<td colspan="2" style="cursor: pointer; background-color: <?=$color?>"<?=$libOnClick?><?=$libTitle?>>&nbsp;</td>
 <?php 	} ?>
