Mercurial > hg > fapweb
changeset 265:d1f99f239046
Cleanup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 24 Nov 2013 04:02:25 +0200 |
parents | fb9bf61c9918 |
children | c535c5a8a36d |
files | admajax.php |
diffstat | 1 files changed, 90 insertions(+), 124 deletions(-) [+] |
line wrap: on
line diff
--- a/admajax.php Sun Nov 24 03:12:57 2013 +0200 +++ b/admajax.php Sun Nov 24 04:02:25 2013 +0200 @@ -188,7 +188,25 @@ switch ($type) { case "news": + echo + "<form method=\"post\" action=\"\" onsubmit=\"return addNews()\">\n". + " ".stGetFormTextInput(40, SET_LEN_NEWS_TITLE, "", "nntitle", "", "")."<br />\n". + " ".stGetFormTextArea(5, 60, "", "nntext", "", "")."<br />\n". + " ".stGetFormTextInput(20, SET_LEN_NEWS_AUTHOR, "", "nnauthor", "", "orgaz")."\n". + " ".stGetFormSubmitInput("nnadd", "Add post")."\n". + " ".stGetFormButtonInput("", "", "", "Clear", "this.form.reset()")."\n". + "</form>\n". + "<hr />\n"; + $sql = "SELECT * FROM news ORDER BY utime DESC"; + foreach (stExecSQL($sql) as $item) + { + echo + "<div id=\"news".$item["id"]."\">\n". + stGetNewsItemData($item["id"], $item, "ne"). + "</div>\n". + "<hr />\n"; + } break; case "newsitem": @@ -198,7 +216,46 @@ break; case "attendees": + // For adding a new one + $prefix = "ne"; + echo + "<table>\n". + " <tr>\n". + " <th>Name</th>\n". + " <th>Groups</th>\n". + " <th>Oneliner</th>\n". + " <th>E-mail</th>\n". + " <th>Actions</th>\n". + " </tr>\n". + " <tr>\n". + " <td>".stGetFormTextInput(20, SET_LEN_USERNAME, "name", "x", $prefix, "")."</td>\n". + " <td>".stGetFormTextInput(20, SET_LEN_GROUPS, "groups", "x", $prefix, "")."</td>\n". + " <td>".stGetFormTextInput(30, SET_LEN_ONELINER, "oneliner", "x", $prefix, "")."</td>\n". + " <td>".stGetFormTextInput(20, SET_LEN_EMAIL, "email", "x", $prefix, "")."</td>\n". + " <td>".stGetFormButtonInput("add", "", $prefix, " Add new ", "addAttendee()")."</td>\n". + " </tr>\n". + "</table>\n". + "<hr />\n"; + + // List of attendees + echo + "<table class=\"attendees\">\n". + " <tr>\n". + " <th class=\"name\">Name</th>\n". + " <th class=\"groups\">Groups</th>\n". + " <th class=\"regtime\">Registered</th>\n". + " <th class=\"oneliner\">Oneliner</th>\n". + " <th class=\"email\">E-mail</th>\n". + " <th>Actions</th>\n". + " </tr>\n"; + $sql = "SELECT * FROM attendees ORDER BY regtime DESC"; + $row = 0; + foreach (stExecSQL($sql) as $item) + stPrintAttendee($item, $row++, TRUE, TRUE, FALSE); + + echo + "</table>\n"; break; case "attendee": @@ -222,10 +279,42 @@ break; } $sql = "SELECT * FROM votekeys ".$sqlJoins."ORDER BY votekeys.id ASC"; + + // List of votekeys + echo + "<p><a href=\"print.php\">Printable key list</a></p>\n". + "<table class=\"attendees\">\n". + " <tr>\n". + " <th class=\"name\">Name</th>\n". + " <th class=\"groups\">Groups</th>\n". + " <th class=\"email\">E-mail</th>\n". + " <th class=\"\">Key</th>\n". + " </tr>\n"; + $row = 0; + + echo + "</table>\n"; break; case "compos": + echo + "<form method=\"post\" action=\"\" onsubmit=\"return addCompo()\">\n". + " ".stGetFormTextInput(64, SET_LEN_COMPO_NAME, "", "ncname", "", "")."<br />\n". + " ".stGetFormTextArea(5, 60, "", "ncdescription", "", "")."<br />\n". + " ".stGetFormSubmitInput("nccompo", "Add compo")."\n". + " ".stGetFormButtonInput("", "", "", "Clear", "this.form.reset()")."\n". + "</form>\n". + "<hr />\n"; + $sql = "SELECT * FROM compos ORDER BY id DESC"; + foreach (stExecSQL($sql) as $item) + { + echo + "<div id=\"compo".$item["id"]."\">\n". + stGetCompoData($item["id"], $item, "co"). + "</div>\n". + "<hr />\n"; + } break; case "compo": @@ -311,7 +400,7 @@ if (($compo = stFetchSQL("SELECT * FROM compos WHERE id=".$id)) !== false) { echo - "<h1>#".$id." - ".chentities($compo["name"])."</h1>\n". + "<h1 style=\"margin-bottom: 0px;\">#".$id." - ".chentities($compo["name"])."</h1>\n". "<form>\n". " <table class=\"misc\">\n". " <tr>\n". @@ -346,129 +435,6 @@ } break; } - - // - // Perform query if we need to, output results - // - if (isset($sql) && ($res = stExecSQLCond($sql)) !== FALSE) - { - if ($type == "news") - { - echo - "<form method=\"post\" action=\"\" onsubmit=\"return addNews()\">\n". - " ".stGetFormTextInput(40, SET_LEN_NEWS_TITLE, "", "nntitle", "", "")."<br />\n". - " ".stGetFormTextArea(5, 60, "", "nntext", "", "")."<br />\n". - " ".stGetFormTextInput(20, SET_LEN_NEWS_AUTHOR, "", "nnauthor", "", "orgaz")."\n". - " ".stGetFormSubmitInput("nnadd", "Add post")."\n". - " ".stGetFormButtonInput("", "", "", "Clear", "this.form.reset()")."\n". - "</form>\n". - "<hr />\n"; - - foreach ($res as $item) - { - echo - "<div id=\"news".$item["id"]."\">\n". - stGetNewsItemData($item["id"], $item, "ne"). - "</div>\n". - "<hr />\n"; - } - } - else - if ($type == "attendees") - { - // For adding a new one - $prefix = "ne"; - echo - "<table>\n". - " <tr>\n". - " <th>Name</th>\n". - " <th>Groups</th>\n". - " <th>Oneliner</th>\n". - " <th>E-mail</th>\n". - " <th>Actions</th>\n". - " </tr>\n". - " <tr>\n". - " <td>".stGetFormTextInput(20, SET_LEN_USERNAME, "name", "x", $prefix, "")."</td>\n". - " <td>".stGetFormTextInput(20, SET_LEN_GROUPS, "groups", "x", $prefix, "")."</td>\n". - " <td>".stGetFormTextInput(30, SET_LEN_ONELINER, "oneliner", "x", $prefix, "")."</td>\n". - " <td>".stGetFormTextInput(20, SET_LEN_EMAIL, "email", "x", $prefix, "")."</td>\n". - " <td>".stGetFormButtonInput("add", "", $prefix, " Add new ", "addAttendee()")."</td>\n". - " </tr>\n". - "</table>\n". - "<hr />\n"; - - // List of attendees - echo - "<table class=\"attendees\">\n". - " <tr>\n". - " <th class=\"name\">Name</th>\n". - " <th class=\"groups\">Groups</th>\n". - " <th class=\"regtime\">Registered</th>\n". - " <th class=\"oneliner\">Oneliner</th>\n". - " <th class=\"email\">E-mail</th>\n". - " <th>Actions</th>\n". - " </tr>\n"; - - $row = 0; - foreach ($res as $item) - { - stPrintAttendee($item, $row++, TRUE, TRUE, FALSE); - } - - echo - "</table>\n"; - } - else - if ($type == "voters") - { - switch (stGetSetting("voteKeyMode")) - { - case VOTE_FREELY: - break; - - case VOTE_ACTIVATE: - break; - - case VOTE_ASSIGN: - break; - } - // List of votekeys - echo - "<p><a href=\"print.php\">Printable key list</a></p>\n". - "<table class=\"attendees\">\n". - " <tr>\n". - " <th class=\"name\">Name</th>\n". - " <th class=\"groups\">Groups</th>\n". - " <th class=\"email\">E-mail</th>\n". - " <th class=\"\">Key</th>\n". - " </tr>\n"; - $row = 0; - - echo - "</table>\n"; - } - else - if ($type == "compos") - { - echo - "<form method=\"post\" action=\"\" onsubmit=\"return addCompo()\">\n". - " ".stGetFormTextInput(64, SET_LEN_COMPO_NAME, "", "ncname", "", "")."<br />\n". - " ".stGetFormTextArea(5, 60, "", "ncdescription", "", "")."<br />\n". - " ".stGetFormSubmitInput("nccompo", "Add compo")."\n". - " ".stGetFormButtonInput("", "", "", "Clear", "this.form.reset()")."\n". - "</form>\n". - "<hr />\n"; - - foreach ($res as $item) - { - echo - "<div id=\"compo".$item["id"]."\">\n". - stGetCompoData($item["id"], $item, "co"). - "</div>\n". - "<hr />\n"; - } - } - } break; case "delete":