# HG changeset patch # User Matti Hamalainen # Date 1448001518 -7200 # Node ID 2e1a9b56467446485dc7ddcdf6889823d2b9bb1e # Parent df54d73bc5a0295acad4cdda53ade94a1fc71bf6 Add votekey information blurb. diff -r df54d73bc5a0 -r 2e1a9b564674 admajax.php --- a/admajax.php Fri Nov 20 07:54:48 2015 +0200 +++ b/admajax.php Fri Nov 20 08:38:38 2015 +0200 @@ -392,6 +392,14 @@ } +function stGetVoteKeyInfo() +{ + $nkeys = stFetchSQLColumn("SELECT COUNT(*) FROM votekeys WHERE active=1"); + $totalKeys = stFetchSQLColumn("SELECT COUNT(*) FROM votekeys"); + return "Info: ".$nkeys." of ".$totalKeys." votekeys are activated."; +} + + function stGetVoteKeyItemData($id, $item, $prefix) { global $setVoteKeyMode, $setVoteKeyLen; @@ -1370,6 +1378,10 @@ stError("No such attendee ID!"); break; + case "votekeyinfo": + echo stGetVoteKeyInfo(); + break; + case "votekey": case "votekeyclass": switch ($setVoteKeyMode) @@ -1426,6 +1438,7 @@ "\n". "
\n". "Show printable key list\n". + "
".stGetVoteKeyInfo()."
\n". "
\n"; switch ($setVoteKeyMode) diff -r df54d73bc5a0 -r 2e1a9b564674 admin.js --- a/admin.js Fri Nov 20 07:54:48 2015 +0200 +++ b/admin.js Fri Nov 20 08:38:38 2015 +0200 @@ -536,6 +536,12 @@ // // Votekey management // +function voteKeyInfoRefresh() +{ + jsRefreshItems("vkeyInfo", "votekey", "info"); +} + + function voteKeyRefresh(id) { var msuccess2 = function(txt) @@ -543,6 +549,7 @@ var nitem = document.getElementById("vkey"+id); if (nitem) nitem.className = txt; + voteKeyInfoRefresh(); } var msuccess1 = function(txt) @@ -550,6 +557,7 @@ var nitem = document.getElementById("vkey"+id); if (nitem) nitem.innerHTML = txt; + voteKeyInfoRefresh(); } jsSendPOSTRequest("action=get&type=votekey&id="+id, msuccess1); @@ -562,6 +570,7 @@ var msuccess = function(txt) { voteKeyRefresh(id); + voteKeyInfoRefresh(); } jsSendPOSTRequest("action=votekey&type="+type+"&id="+id+"&"+args, msuccess);