X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=lib%2Farea.php;h=51f57d39ad9d38ad4abdec426be6196a4d13ed0f;hb=6bd4ad3daf2cc870d96a3fed9ea9caf6798d2b78;hp=5785ed2947c0e2a7b006c1784af801a5eb94078c;hpb=6fdbfe32798452ec1c0fdbda57edabb892518409;p=readifood.git diff --git a/lib/area.php b/lib/area.php index 5785ed2..51f57d3 100644 --- a/lib/area.php +++ b/lib/area.php @@ -9,7 +9,7 @@ } else if ($_POST['city_id']) { /* XXX: city_id is actually a string $city_name/$city_id */ - header(sprintf("Location: http%s://%s/%s/in/%s", ($_SERVER['HTTPS']) ? "s" : "", $_SERVER['HTTP_HOST'], $module, $_POST['city_id'])); + header(sprintf("Location: http%s://%s/%s/in/city/%s", ($_SERVER['HTTPS']) ? "s" : "", $_SERVER['HTTP_HOST'], $module, $_POST['city_id'])); exit; } else if ($_POST['update_area']) { @@ -27,10 +27,12 @@ if (count($areas)) { foreach ($areas as $area) { - echo "
\nArea: " . $area->getStrongLink(); - printf(" Contacts", urlencode($area->getName()), $area->getId()); - printf(" Donations", urlencode($area->getName()), $area->getId()); - printf(" Orders", urlencode($area->getName()), $area->getId()); + echo "
\nArea: " . $area->getStrongLink() . "\n"; + $n = urlencode($area->getName()); + $i = $area->getId(); + echo " " . get_small_link("Contacts", "/contact/in/area/%s/%d", $n, $i); + echo " " . get_small_link("Donations", "/donation/in/area/%s/%d", $n, $i); + echo " " . get_small_link("Orders", "/order/in/area/%s/%d", $n, $i); if (check_admin(1)) { echo " " . $area->getDeleteLink(); } @@ -51,7 +53,7 @@ return; } - echo "
\n"; + form("noprint standout"); echo "

Show areas in\n"; echo "\n"; echo "\n"; - echo "

\n"; + end_form(); } function show_new_area_form($city_id = null) { @@ -72,7 +74,7 @@ return; } - echo "
\n"; + form("noprint standout"); echo "

Add a new area \n"; echo "in \n"; echo "\n"; - echo "

\n"; + end_form(); } function add_area($name, $city_id) { @@ -209,11 +211,13 @@ $area = get_area_by_name($name); if (! $area) return; - echo "
\n"; + form(); echo "

Area: " . $area->getName() . ""; - printf(" Contacts", urlencode($area->getName()), $area->getId()); - printf(" Donations", urlencode($area->getName()), $area->getId()); - printf(" Orders", urlencode($area->getName()), $area->getId()); + $n = $area->getName(); + $i = $area->getId(); + echo " " . get_small_link("Contacts", "/contact/in/area/%s/%d", $n, $i); + echo " " . get_small_link("Donations", "/donation/in/area/%s/%d", $n, $i); + echo " " . get_small_link("Orders", "/order/in/area/%s/%d", $n, $i); if (check_admin(1)) { echo " " . $area->getDeleteLink(); } @@ -230,15 +234,17 @@ echo "\n"; } echo "

\n"; - echo "
\n"; + end_form(); } /* /area/in/Cambridge/1 */ if (count($parameters)) { if ($parameters[0] == "in") { - $city_id = $parameters[2]; - show_areas(0, 10, $parameters[1], $city_id); - show_new_area_form($city_id); + if ($parameters[1] == "city") { + $city_id = $parameters[3]; + show_areas(0, 10, $parameters[2], $city_id); + show_new_area_form($city_id); + } } } list($name, $id, $args) = parse_parameters($parameters);