Mercurial > hg > fapweb
diff admajax.php @ 305:b96c41bd9dd6
More work on admin backend.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 26 Nov 2013 06:43:43 +0200 |
parents | 828fc30e3c94 |
children | 3cfd95758377 |
line wrap: on
line diff
--- a/admajax.php Tue Nov 26 06:27:06 2013 +0200 +++ b/admajax.php Tue Nov 26 06:43:43 2013 +0200 @@ -153,6 +153,7 @@ stReloadSettings(); +$voteKeyMode = stGetSetting("voteKeyMode"); $type = stGetRequestItem("type", ""); switch (stGetRequestItem("action", "")) { @@ -284,14 +285,13 @@ } // List of votekeys - $vmode = stGetSetting("voteKeyMode"); echo - "<div class=\"info\"><b>Voting mode: ".$voteModeData[$vmode][0]."</b>. ".$voteModeData[$vmode][1]."</div>\n". + "<div class=\"info\"><b>Voting mode: ".$voteModeData[$voteKeyMode][0]."</b>. ".$voteModeData[$voteKeyMode][1]."</div>\n". "<div class=\"tabHeadersSub\">\n". "<a href=\"print.php?type=votekeys\" target=\"_blank\">Show printable key list</a>\n". "</div>\n"; - switch ($vmode) + switch ($voteKeyMode) { case VOTE_FREELY: case VOTE_ACTIVATE: @@ -311,7 +311,7 @@ $item["id"], str_repeat(" ", $keyLen - strlen($item["key"])).$item["key"]); - if ($vmode == VOTE_ACTIVATE) + if ($voteKeyMode == VOTE_ACTIVATE) { echo stGetFormCheckBoxInput("active", $item["id"], "", $item["active"], "", "class=\"keyactive\" onClick=\"voteKeyActivated(".$item["id"].")\"", "xx")."\n"; @@ -508,7 +508,8 @@ $sql = stPrepareSQL("DELETE FROM attendees WHERE id=%d", $id); stExecSQLCond($sql, "OK, attendee ".$id." deleted."); - if ($attn["key_id"] != 0) + // If assigned votekey mode, delete the key and votes as well + if ($voteKeyMode == VOTE_ASSIGN && $attn["key_id"] != 0) { $sql = stPrepareSQL("DELETE FROM votekeys WHERE id=%d", $attn["key_id"]); stExecSQLCond($sql, "OK, attendee ".$id." votekey deleted."); @@ -531,6 +532,12 @@ stExecSQLCond($sql, "OK, entry ".$id." votes deleted."); } } + else + if ($type == "votekeys") + { + $sql = stPrepareSQL("DELETE FROM votekeys"); + stExecSQLCond($sql, "OK, all votekeys purged"); + } break; case "add":