# HG changeset patch # User Matti Hamalainen # Date 1380951819 -10800 # Node ID 71256605546b419dedc65967846dbdc3129528b8 # Parent cba0b944da79300818155dc4f91fdc9213e21edf More work on admin interface. diff -r cba0b944da79 -r 71256605546b admin.inc.php --- a/admin.inc.php Sat Oct 05 07:29:42 2013 +0300 +++ b/admin.inc.php Sat Oct 05 08:43:39 2013 +0300 @@ -290,7 +290,12 @@ { var args = makePostArgs({"oneliner":0,"email":0,"active":3}, "at", id); - sendPOSTRequest("action=update&type=attendees&id="+id+"&"+args); + var msuccess = function(txt) + { + setTimeout("refreshAttendees();", 50); + } + + sendPOSTRequest("action=update&type=attendees&id="+id+"&"+args, msuccess); } diff -r cba0b944da79 -r 71256605546b ajax.php --- a/ajax.php Sat Oct 05 07:29:42 2013 +0300 +++ b/ajax.php Sat Oct 05 08:43:39 2013 +0300 @@ -66,6 +66,9 @@ switch ($action) { case "dump": + // + // Perform generic data dump + // if (($res = execSQLCond( "SELECT * FROM attendees WHERE email NOT NULL AND email != '' ORDER BY regtime DESC", "Dump OK.")) !== FALSE) @@ -89,6 +92,9 @@ break; case "get": + // + // Get specific data + // switch ($type) { case "news": @@ -201,9 +207,7 @@ echo "\n". " \n". - " \n". - " \n". - " \n". + " \n". " \n". " \n". " \n". @@ -238,26 +242,47 @@ break; case "delete": + // + // Delete entry + // if (stChkRequestItem("id")) { $id = intval(stGetRequestItem("id")); if ($type == "news") + { $sql = stPrepareSQL("DELETE FROM news WHERE id=%d AND persist=0", $id); + execSQLCond($sql, "OK, news item ".$id." deleted."); + } else if ($type == "attendees") + { + // Attendees require some more work $sql = stPrepareSQL("DELETE FROM attendees WHERE id=%d", $id); + execSQLCond($sql, "OK, attendee ".$id." deleted."); + + $sql = stPrepareSQL("DELETE FROM votes WHERE voter_id=%d", $id); + execSQLCond($sql, "OK, attendee ".$id." votes deleted."); + } else if ($type == "entries") + { + // .. as do compo entries $sql = stPrepareSQL("DELETE FROM entries WHERE id=%d", $id); + execSQLCond($sql, "OK, entry ".$id." deleted."); - execSQLCond($sql, "OK, ".$type." item ".$id." deleted."); + $sql = stPrepareSQL("DELETE FROM votes WHERE entry_id=%d", $id); + execSQLCond($sql, "OK, entry ".$id." votes deleted."); + } } else setStatus(901, "No ID specified."); break; case "add": + // + // Add new entry + // if ($type == "news" && stChkRequestItem("text") && stChkRequestItem("author") && stChkRequestItem("title")) { @@ -278,10 +303,24 @@ execSQLCond($sql, "OK, compo added."); } else + if ($type == "attendees" && stChkRequestItem("name") && + stChkRequestItem("groups") && stChkRequestItem("email") && + stChkRequestItem("oneliner")) + { + $sql = stPrepareSQL( + "INSERT INTO attendees (regtime,name,groups,oneliner,email) VALUES (%d,%S,%S,%S,%S)", + time(), "name", "groups", "oneliner", "email"); + + execSQLCond($sql, "OK, attendee added."); + } + else setStatus(902, "No data."); break; case "update": + // + // Update existing entry + // if ($type == "attendees" && stChkRequestItem("id") && stChkRequestItem("email") && stChkRequestItem("oneliner") && stChkRequestItem("active")) diff -r cba0b944da79 -r 71256605546b fap.css --- a/fap.css Sat Oct 05 07:29:42 2013 +0300 +++ b/fap.css Sat Oct 05 08:43:39 2013 +0300 @@ -356,8 +356,12 @@ width: 25%; } -table.users tr.vactive td { - background: rgba(255,0,0,0.5); +table.attendees th.rname { + width: 15%; +} + +tr.vactive td.vkey, tr.vactive td.vactive { + background: rgba(0,255,0,0.7); } div.votectrl { diff -r cba0b944da79 -r 71256605546b msite.inc.php --- a/msite.inc.php Sat Oct 05 07:29:42 2013 +0300 +++ b/msite.inc.php Sat Oct 05 08:43:39 2013 +0300 @@ -387,10 +387,23 @@ $id = $item["id"]; $prefix = "at"; echo " ". - "". + " "; + + if ($edit) + { + echo + stGetTDEditTextItem(FALSE, 20, 40, "name", $id, $prefix, $item["name"]." / ".$item["groups"]); + } + else + { + echo stGetTDEditTextItem(FALSE, 20, 40, "name", $id, $prefix, $item["name"]). stGetTDEditTextItem(FALSE, 20, 40, "groups", $id, $prefix, $item["groups"]). - "". + ""; + } + + echo stGetTDEditTextItem($edit, 30, 64, "oneliner", $id, $prefix, $item["oneliner"], "autocomplete=\"off\""); if ($edit)
NameGroup(s)RegisteredNameOnelinerE-mailActions
".date("d M Y / H:i", $item["regtime"])."".date("d M Y / H:i", $item["regtime"])."