Mercurial > hg > batmud > maputils
changeset 1148:52550f58cee5
Move alphabetic table printing code to a function in common routines.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 21 Jul 2011 20:35:38 +0300 |
parents | 9721717e30c6 |
children | f6a7922425fd |
files | www/common.inc.php www/info.php www/loc.php |
diffstat | 3 files changed, 21 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/www/common.inc.php Thu Jul 21 20:32:53 2011 +0300 +++ b/www/common.inc.php Thu Jul 21 20:35:38 2011 +0300 @@ -303,4 +303,18 @@ return $wizInfo; } +function printExtraBoxAlphaList($table) +{ + echo "<div id=\"extrabox\">\n". + " <div style=\"font-size: 12pt; padding: 5pt;\">\n"; + + foreach ($table as $alpha => $locs) { + $letter = strtoupper($alpha); + echo " <a href=\"#".$letter."\">".$letter."</a> \n"; + } + + echo "\n </div>\n". + "</div>\n"; +} + ?> \ No newline at end of file
--- a/www/info.php Thu Jul 21 20:32:53 2011 +0300 +++ b/www/info.php Thu Jul 21 20:35:38 2011 +0300 @@ -80,7 +80,8 @@ if (count($data) > 0) { usort($data, "wizardSort"); - echo "<h3><a name=\"".$alpha."\"></a>".$alpha."</h3>\n"; + $letter = strtoupper($alpha); + echo "<h3><a name=\"".$letter."\"></a>".$letter."</h3>\n"; echo "<table class=\"loc\">\n"; $n = 0; @@ -117,13 +118,7 @@ /* Print out the alpha link index */ - echo "<div id=\"extrabox\">\n". - " <div style=\"font-size: 12pt; padding: 5pt;\">\n"; - foreach ($alphaTable as $alpha => $alphaLocs) { - echo " <a href=\"#".$alpha."\">".$alpha."</a> \n"; - } - echo "\n </div>\n". - "</div>\n"; + printExtraBoxAlphaList($alphaTable); } else { echo "<p><b>No wizards known!</b></p>\n"; }
--- a/www/loc.php Thu Jul 21 20:32:53 2011 +0300 +++ b/www/loc.php Thu Jul 21 20:35:38 2011 +0300 @@ -2,7 +2,6 @@ require "config.inc.php"; require "common.inc.php"; - // Wizard info box special formatting tags $specTags = array( "b" => "<b>", @@ -232,10 +231,11 @@ $maxRow = 6; foreach ($alphaTable as $alpha => $alphaLocs) { if (count($alphaLocs) <= 0) continue; + $letter = strtoupper($alpha); asort($alphaLocs); - - echo "<h3><a name=\"".$alpha."\"></a>".$alpha."</h3>\n". + + echo "<h3><a name=\"".$letter."\"></a>".$letter."</h3>\n". "<table class=\"loc\" width=\"95%\">\n"; $n = 0; @@ -350,13 +350,7 @@ /* Print out the alpha link index */ - echo "<div id=\"extrabox\">\n". - " <div style=\"font-size: 12pt; padding: 5pt;\">\n"; - foreach ($alphaTable as $alpha => $alphaLocs) { - echo " <a href=\"#".$alpha."\">".$alpha."</a> \n"; - } - echo "\n </div>\n". - "</div>\n"; + printExtraBoxAlphaList($alphaTable); } else { echo "<p><b>No locations known!</b></p>\n"; echo "</div>\n";