Mercurial > hg > fapweb
changeset 512:998a09b332f1
Add plain text printable results visible for admins.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 08 Dec 2013 02:27:15 +0200 |
parents | 6fe66ea0e954 |
children | afdb381c71cb |
files | admajax.php msite.inc.php print.php results.inc.php |
diffstat | 4 files changed, 27 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/admajax.php Sun Dec 08 02:16:26 2013 +0200 +++ b/admajax.php Sun Dec 08 02:27:15 2013 +0200 @@ -885,6 +885,7 @@ stGetShowModeButton(SMODE_ROTATE, "Slide rotation", $showMode)."\n". stGetShowModeButton(SMODE_COMPO, "Compo mode", $showMode)."\n". "<a href=\"show.php\" target=\"_blank\">Open info window</a>\n". + "<a href=\"print.php?type=results\" target=\"_blank\">Printable results list</a>\n". "</div>\n". "<div id=\"ctrlSystemControls\">\n". stGetFormButtonInput("syscheck", "", "", "Perform system check", "performSystemCheck()")."\n".
--- a/msite.inc.php Sun Dec 08 02:16:26 2013 +0200 +++ b/msite.inc.php Sun Dec 08 02:27:15 2013 +0200 @@ -412,7 +412,7 @@ } -function stGetCompoResultsASCIIStr($showAuthors) +function stGetCompoResultsASCIIStr($showAuthors, $html) { if (($res = stExecSQL("SELECT * FROM compos WHERE visible<>0 ORDER BY name DESC")) === false) return ""; @@ -479,10 +479,19 @@ $prev = FALSE; $index = 0; - $out .= - "<pre>\n". - "<b> ".chentities($compo["name"])." </b>\n". - str_repeat("=", strlen($compo["name"]) + 2)."-- - .\n\n"; + if ($html) + { + $out .= + "<pre>\n". + "<b> ".chentities($compo["name"])." </b>\n". + str_repeat("=", strlen($compo["name"]) + 2)."-- - .\n\n"; + } + else + { + $out .= + " ".$compo["name"]."\n". + str_repeat("=", strlen($compo["name"]) + 2)."-- - .\n\n"; + } foreach (stExecSQL($sql) as $entry) { @@ -494,14 +503,17 @@ else $out .= " -''-"; + $name = stStrChop(stStrKludge($entry["name"]), 30); + $author = stStrChop($showAuthors ? stStrKludge($entry["author"]) : "-", 30); + $out .= sprintf(" %s by %s (%d pts)\n", - chentities(stStrChop(stStrKludge($entry["name"]), 30)), - chentities(stStrChop($showAuthors ? stStrKludge($entry["author"]) : "-", 30)), + $html ? chentities($name) : $name, + $html ? chentities($author) : $author, $entry["votesum"]); $prev = $entry["votesum"]; } - $out .= "\n\n</pre>\n"; + $out .= "\n\n".($html ? "</pre>\n" : ""); } }
--- a/print.php Sun Dec 08 02:16:26 2013 +0200 +++ b/print.php Sun Dec 08 02:27:15 2013 +0200 @@ -48,6 +48,11 @@ // switch (stGetRequestItem("type", "", TRUE)) { + case "results": + header("Content-Type: text/plain"); + echo stGetCompoResultsASCIIStr(TRUE, FALSE); + break; + case "emails": // // Generic e-mail data dump
--- a/results.inc.php Sun Dec 08 02:16:26 2013 +0200 +++ b/results.inc.php Sun Dec 08 02:27:15 2013 +0200 @@ -23,7 +23,7 @@ if ($showResults) - echo stGetCompoResultsASCIIStr($showAuthors); + echo stGetCompoResultsASCIIStr($showAuthors, TRUE); else { echo "<p>Sorry, no results available! Nothing to see here, move along.</p>";