changeset 19:1e258de5511d

Add confirmation for deactivation of vote keys.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 06 Dec 2012 18:26:39 +0200
parents 2b490ac5b128
children 02ff0c29df8a
files admin.inc.php ajax.php
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/admin.inc.php	Thu Dec 06 18:26:25 2012 +0200
+++ b/admin.inc.php	Thu Dec 06 18:26:39 2012 +0200
@@ -363,6 +363,20 @@
 }
 
 
+function updateVoter2(id)
+{
+  var elem = document.getElementById("voenabled"+id);
+  if (elem && !elem.checked)
+  {
+    if (confirm("Are you sure you want deactivate vote ID #"+id+"?"))
+      updateVoter(id);
+    else
+      setTimeout("refreshVoters();", 50);
+  }
+  else
+    updateVoter(id);
+}
+
 var registeredTabs = Object();
 
 
--- a/ajax.php	Thu Dec 06 18:26:25 2012 +0200
+++ b/ajax.php	Thu Dec 06 18:26:39 2012 +0200
@@ -261,7 +261,7 @@
           "  <td class=\"vname\">".stGetFormTextInput(40, 64, "name", $id, $prefix, $item["name"],
           "onBlur=\"updateVoter(".$id.")\" autocomplete=\"off\"")."</td>\n".
           "  <td class=\"vactive\">".stGetFormCheckBoxInput("enabled", $id, $prefix, $item["enabled"], "",
-          "onClick=\"updateVoter(".$id.")\"")."</td>\n".
+          "onClick=\"updateVoter2(".$id.")\"")."</td>\n".
           " </tr>\n";
           $row++;
         }