From 0b1deccfe6cbe7fca0a6abd03abb18cafca59c60 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Thu, 9 Jun 2011 15:01:53 -0700 Subject: Added category options and descriptions. --- htdocs/categories.php | 7 +++++-- htdocs/css/main.css | 17 +++++++++++++++-- htdocs/new-post.php | 13 +++++++++---- htdocs/src/Category.inc.php | 7 ++++++- 4 files changed, 35 insertions(+), 9 deletions(-) (limited to 'htdocs') diff --git a/htdocs/categories.php b/htdocs/categories.php index e4c1f37..a3e8ba2 100644 --- a/htdocs/categories.php +++ b/htdocs/categories.php @@ -36,10 +36,13 @@ function listCategories() { echo "

Categories

"; $cats = Category::getCategories(); - foreach ($cats as $short => $name) { + echo "
"; + foreach ($cats as $short => $cat) { $url = $GLOBALS['CONFIG']['urlroot'] . "/categories/$short"; - echo "

$name

"; + echo "
". $cat->getName() ."
"; + echo "
". $cat->getDescription() ."
"; } + echo "
"; } function displayEvents($category) { diff --git a/htdocs/css/main.css b/htdocs/css/main.css index be823b3..3e306ce 100644 --- a/htdocs/css/main.css +++ b/htdocs/css/main.css @@ -22,7 +22,7 @@ body { margin: 0 1.5em 0 1.5em; } -.bigbutton { +.bigbutton, .bigbutton:visited { background: url('../images/bigbutton.png') repeat-x center top; color: white; padding: 0.3em 1em 0.3em 1em; @@ -30,7 +30,7 @@ body { border-radius: 5px; } -.smallbutton { +.smallbutton, .smallbutton:visited { background: url('../images/smallbutton.png') repeat-x center top; color: white; padding: 0.3em 1em 0.3em 1em; @@ -86,6 +86,19 @@ body { } +dt { + margin-top: 1.5em; + margin-bottom: 0.25em; + text-transform: uppercase; + font-weight: bold; + font-size: larger; +} + +a, a:visited { + text-decoration: none; + color: blue; +} + .post { margin-bottom: 2em; } diff --git a/htdocs/new-post.php b/htdocs/new-post.php index 8573bce..961cdda 100644 --- a/htdocs/new-post.php +++ b/htdocs/new-post.php @@ -81,11 +81,16 @@ function handle_category() { echo "

Start by choosing a category from the list below

"; // List Categories - foreach (Category::getCategories() as $short => $name) { - echo "

$name

"; + $cats = Category::getCategories(); + echo "
"; + foreach ($cats as $short => $cat) { + $url = $GLOBALS['CONFIG']['urlroot'] + . "/new-post.php?stage=tos&category=$short"; + + echo "
". $cat->getName() ."
"; + echo "
". $cat->getDescription() ."
"; } - + echo "
"; } function finish_category() { diff --git a/htdocs/src/Category.inc.php b/htdocs/src/Category.inc.php index edc0303..fdcd210 100644 --- a/htdocs/src/Category.inc.php +++ b/htdocs/src/Category.inc.php @@ -27,7 +27,8 @@ class Category { $result = array(); foreach ($rows as $row) { - $result[$row['shortname']] = $row['name']; + $cat = new Category($row); + $result[$row['shortname']] = $cat; } return $result; @@ -80,6 +81,10 @@ class Category { public function getShortname() { return htmlspecialchars($this->info['shortname']); } + + public function getDescription() { + return htmlspecialchars($this->info['description']); + } } ?> -- cgit v1.2.3