# HG changeset patch # User Matti Hamalainen # Date 1380947382 -10800 # Node ID cba0b944da79300818155dc4f91fdc9213e21edf # Parent 7bdf89601ba0fc9a380ec999098063dc5a926a1a Start combining "users" with "attendees". diff -r 7bdf89601ba0 -r cba0b944da79 admin.inc.php --- a/admin.inc.php Sat Oct 05 06:55:58 2013 +0300 +++ b/admin.inc.php Sat Oct 05 07:29:42 2013 +0300 @@ -258,12 +258,6 @@ } -function refreshUsers() -{ - refreshItems("nusers", "users", "Users list"); -} - - function addNews() { var args = makePostArgs({"title":1,"text":1,"author":1}, "nn", ""); @@ -294,12 +288,27 @@ function updateAttendee(id) { - var args = makePostArgs({"oneliner":0,"email":0}, "at", id); + var args = makePostArgs({"oneliner":0,"email":0,"active":3}, "at", id); sendPOSTRequest("action=update&type=attendees&id="+id+"&"+args); } +function updateAttendee2(id) +{ + var elem = document.getElementById("atactive"+id); + if (elem && !elem.checked) + { + if (confirm("Are you sure you want deactivate vote ID #"+id+"?")) + updateAttendee(id); + else + setTimeout("refreshAttendees();", 50); + } + else + updateAttendee(id); +} + + function addCompo() { var args = makePostArgs({"name":1, "description":1}, "nc", ""); @@ -336,33 +345,6 @@ } -function updateVoter(id) -{ - var args = makePostArgs({"active":3, "name":0}, "vo", id); - - var msuccess = function(txt) - { - setTimeout("refreshUsers();", 50); - } - - sendPOSTRequest("action=update&type=user&id="+id+"&"+args, msuccess); -} - - -function updateVoter2(id) -{ - var elem = document.getElementById("voactive"+id); - if (elem && !elem.checked) - { - if (confirm("Are you sure you want deactivate vote ID #"+id+"?")) - updateVoter(id); - else - setTimeout("refreshUsers();", 50); - } - else - updateVoter(id); -} - var registeredTabs = Object(); @@ -478,15 +460,6 @@ -
-

- Key entries can only be generated via the shell-utility 'keygen'. -

-
-
- - - diff -r 7bdf89601ba0 -r cba0b944da79 ajax.php --- a/ajax.php Sat Oct 05 06:55:58 2013 +0300 +++ b/ajax.php Sat Oct 05 07:29:42 2013 +0300 @@ -178,9 +178,6 @@ "\n"; } break; - - case "users": - $sql = "SELECT * FROM users ORDER BY id ASC"; } if (isset($sql) && ($res = execSQLCond($sql, "")) !== FALSE) @@ -210,6 +207,8 @@ " Oneliner\n". " E-mail\n". " Actions\n". + " User key\n". + " Active\n". " \n"; $row = 0; foreach ($res as $item) @@ -235,37 +234,6 @@ "
\n"; } } - else - if ($type == "users") - { - echo - "\n". - " \n". - " \n". - " \n". - " \n". - " \n". - " \n"; - $row = 0; - foreach ($res as $item) - { - $id = $item["id"]; - $prefix = "vo"; - echo - " \n". - " \n". - " \n". - " \n". - " \n". - " \n". - " \n"; - $row++; - } - echo "
#User keyNameActive
".sprintf("%04d", $id)."".chentities($item["key"])."".stGetFormTextInput(40, 64, "name", $id, $prefix, $item["name"], - "onBlur=\"updateVoter(".$id.")\" autocomplete=\"off\"")."".stGetFormCheckBoxInput("active", $id, $prefix, $item["active"], "", - "onClick=\"updateVoter2(".$id.")\"")."
\n"; - } } break; @@ -315,13 +283,15 @@ case "update": if ($type == "attendees" && stChkRequestItem("id") && - stChkRequestItem("email") && stChkRequestItem("oneliner")) + stChkRequestItem("email") && stChkRequestItem("oneliner") && + stChkRequestItem("active")) { $sql = stPrepareSQLUpdate("attendees", "WHERE id=".intval(stGetRequestItem("id")), array( "email" => "S", "oneliner" => "S", + "active" => "B", )); execSQLCond($sql, "OK, attendee updated."); @@ -358,19 +328,6 @@ execSQLCond($sql, "OK, compo updated."); } else - if ($type == "user" && stChkRequestItem("id") && - stChkRequestItem("name") && stChkRequestItem("active")) - { - $sql = stPrepareSQLUpdate("users", - "WHERE id=".intval(stGetRequestItem("id")), - array( - "name" => "S", - "active" => "B", - )); - - execSQLCond($sql, "OK, user updated."); - } - else if ($type == "entry" && stChkRequestItem("id") && stChkRequestItem("name") && stChkRequestItem("author") && stChkRequestItem("compo_id")) diff -r 7bdf89601ba0 -r cba0b944da79 msite.inc.php --- a/msite.inc.php Sat Oct 05 06:55:58 2013 +0300 +++ b/msite.inc.php Sat Oct 05 07:29:42 2013 +0300 @@ -397,10 +397,15 @@ { echo stGetTDEditTextItem($edit, 20, 40, "email", $id, $prefix, $item["email"], "autocomplete=\"off\""). + "". "". "". - ""; + "". + + " ".chentities($item["key"])."\n". + " ".stGetFormCheckBoxInput("active", $id, $prefix, $item["active"], "", + "onClick=\"updateAttendee2(".$id.")\"")."\n"; } echo "\n";