Mercurial > hg > fapweb
changeset 61:e85ed35585fc
Work on attendee editing, etc.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 05 Oct 2013 12:33:59 +0300 |
parents | 4e09327ed4d0 |
children | 101cde58b267 |
files | admin.inc.php ajax.php |
diffstat | 2 files changed, 52 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/admin.inc.php Sat Oct 05 11:36:30 2013 +0300 +++ b/admin.inc.php Sat Oct 05 12:33:59 2013 +0300 @@ -267,9 +267,9 @@ setTimeout("refreshNews();", 50); } - sendPOSTRequest( - "action=add&type=news&"+args, - msuccess); + if (args != "") + sendPOSTRequest("action=add&type=news&"+args, msuccess); + return false; } @@ -280,6 +280,22 @@ } +function addAttendee() +{ + var args = makePostArgs({"name":1,"groups":0,"oneliner":0,"email":0}, "ne", "x"); + + var msuccess = function(txt) + { + setTimeout("refreshAttendees();", 50); + } + + if (args != "") + sendPOSTRequest("action=add&type=attendees&"+args, msuccess); + + return false; +} + + function deleteAttendee(id) { deleteItem(id, "attendee", "attendees", "refreshAttendees();", "attendee"); @@ -295,7 +311,8 @@ setTimeout("refreshAttendees();", 50); } - sendPOSTRequest("action=update&type=attendees&id="+id+"&"+args, msuccess); + if (args != "") + sendPOSTRequest("action=update&type=attendees&id="+id+"&"+args, msuccess); } @@ -323,7 +340,8 @@ setTimeout("refreshCompos();", 50); } - sendPOSTRequest("action=add&type=compo&"+args, msuccess); + if (args != "") + sendPOSTRequest("action=add&type=compo&"+args, msuccess); return false; } @@ -332,7 +350,8 @@ { var args = makePostArgs({"name":1, "description":1, "visible":3, "voting":3, "showAuthors":3}, "co", id); - sendPOSTRequest("action=update&type=compo&id="+id+"&"+args); + if (args != "") + sendPOSTRequest("action=update&type=compo&id="+id+"&"+args); } @@ -345,7 +364,8 @@ setTimeout("refreshEntries();", 50); } - sendPOSTRequest("action=add&type=entry&compo_id="+id+"&"+args, msuccess); + if (args != "") + sendPOSTRequest("action=add&type=entry&compo_id="+id+"&"+args, msuccess); return false; } @@ -359,7 +379,8 @@ setTimeout("refreshEntries();", 50); } - sendPOSTRequest("action=update&type=entry&id="+id+"&"+args, msuccess); + if (args != "") + sendPOSTRequest("action=update&type=entry&id="+id+"&"+args, msuccess); }
--- a/ajax.php Sat Oct 05 11:36:30 2013 +0300 +++ b/ajax.php Sat Oct 05 12:33:59 2013 +0300 @@ -232,13 +232,33 @@ " <th class=\"oneliner\">Oneliner</th>\n". " <th class=\"email\">E-mail</th>\n". " <th>Actions</th>\n". - " <th class=\"vkey\">User key</th>\n". + " <th class=\"vkey\">Vote key</th>\n". " <th class=\"vactive\">Active</th>\n". " </tr>\n"; $row = 0; foreach ($res as $item) stPrintAttendee($item, $row++, TRUE); - echo "</table>\n"; + + $prefix = "ne"; + echo + "</table>\n". + "<hr />\n". + "<table>\n". + " <tr>\n". + " <th>Name</th>\n". + " <th>Groups</th>\n". + " <th>E-mail</th>\n". + " <th>Oneliner</th>\n". + " <th>Actions</th>\n". + " </tr>\n". + " <tr>\n". + " <td>".stGetFormTextInput(20, 64, "name", "x", $prefix, "")."</td>\n". + " <td>".stGetFormTextInput(20, 64, "groups", "x", $prefix, "")."</td>\n". + " <td>".stGetFormTextInput(20, 64, "email", "x", $prefix, "")."</td>\n". + " <td>".stGetFormTextInput(30, 64, "oneliner", "x", $prefix, "")."</td>\n". + " <td>".stGetFormButtonInput("add", "", $prefix, " Add new ", "addAttendee()")."</td>\n". + " </tr>\n". + "</table>\n"; } else if ($type == "compos") @@ -340,7 +360,7 @@ stChkRequestItem("author") && stChkRequestItem("compo_id")) { $sql = stPrepareSQL( - "INSERT INTO entries (name,author,compo_id) VALUES (%S,%Q,%D)", + "INSERT INTO entries (name,author,compo_id,filename) VALUES (%S,%S,%D,%S)", "name", "author", "compo_id", "filename"); execSQLCond($sql, "OK, entry added.");