summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2011-06-09 15:01:53 -0700
committerJesse Morgan <jesse@jesterpm.net ; true>2011-06-09 15:01:53 -0700
commit0b1deccfe6cbe7fca0a6abd03abb18cafca59c60 (patch)
tree826cba7d21edab13d3e75648f78a3b28f13a85c7
parent3ffd7a349728e4aff80a982bb16c5196e55795e3 (diff)
Added category options and descriptions.
-rw-r--r--design/database.sql16
-rw-r--r--htdocs/categories.php7
-rw-r--r--htdocs/css/main.css17
-rw-r--r--htdocs/new-post.php13
-rw-r--r--htdocs/src/Category.inc.php7
5 files changed, 45 insertions, 15 deletions
diff --git a/design/database.sql b/design/database.sql
index 475dac2..e26e271 100644
--- a/design/database.sql
+++ b/design/database.sql
@@ -27,6 +27,7 @@ CREATE TABLE category (
shortname VARCHAR(30) NOT NULL,
name VARCHAR(30) NOT NULL,
description VARCHAR(255) NOT NULL,
+ options SET('price') NOT NULL,
PRIMARY KEY(id)
);
@@ -46,6 +47,7 @@ CREATE TABLE post (
created DATETIME NOT NULL,
description TEXT NOT NULL,
location VARCHAR(100) NOT NULL,
+ price DECIMAL(10,2) NULL,
email VARCHAR(255) NOT NULL,
secretid VARCHAR(32) NOT NULL,
@@ -93,12 +95,14 @@ CREATE TABLE page (
);
-- The following creates some sample data
-INSERT INTO category (name, shortname) VALUES
- ('Give', 'give'),
- ('Needs', 'needs'),
- ('Jobs', 'jobs'),
- ('Housing', 'housing'),
- ('Events', 'events');
+INSERT INTO `category` (`shortname`, `name`, `description`, `options`)
+VALUES
+ ('free', 'Free Items', 'Do you have something of value someone could use and you want to give it away?', ''),
+ ('sale', 'For Sale', 'Do you have something you no longer need and want to sell it?', 'price'),
+ ('needs', 'Needs', 'Do you need something (furniture, job, housing, etc) that someone might be able to help with?', ''),
+ ('events', 'Events', 'Do you have an upcoming event (qualifying statement here?) you would like to announce?', 'price'),
+ ('jobs', 'Jobs', 'Do you have a job/position to fill and you''d like to tell people about?', 'price'),
+ ('housing', 'Housing', 'Do you have housing in the East Pierce County area you''d like to make people aware of?', 'price');
INSERT INTO source (name) VALUES ('Foursquare Church');
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 "<h2>Categories</h2>";
$cats = Category::getCategories();
- foreach ($cats as $short => $name) {
+ echo "<dl>";
+ foreach ($cats as $short => $cat) {
$url = $GLOBALS['CONFIG']['urlroot'] . "/categories/$short";
- echo "<p><a href=\"$url\">$name</a></p>";
+ echo "<dt><a href=\"$url\">". $cat->getName() ."</a></dt>";
+ echo "<dd>". $cat->getDescription() ."</dd>";
}
+ echo "</dl>";
}
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 "<p>Start by choosing a category from the list below</p>";
// List Categories
- foreach (Category::getCategories() as $short => $name) {
- echo "<p><a href=\"". $GLOBALS['CONFIG']['urlroot']
- . "/new-post.php?stage=tos&category=$short\">$name</a></p>";
+ $cats = Category::getCategories();
+ echo "<dl>";
+ foreach ($cats as $short => $cat) {
+ $url = $GLOBALS['CONFIG']['urlroot']
+ . "/new-post.php?stage=tos&category=$short";
+
+ echo "<dt><a href=\"$url\">". $cat->getName() ."</a></dt>";
+ echo "<dd>". $cat->getDescription() ."</dd>";
}
-
+ echo "</dl>";
}
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']);
+ }
}
?>