Standardise URI for showing Areas in a City.
authorIain Patterson <me@iain.cx>
Wed, 1 May 2013 13:37:47 +0000 (09:37 -0400)
committerIain Patterson <me@iain.cx>
Wed, 1 May 2013 13:37:47 +0000 (09:37 -0400)
Other entities such as Contacts and Donations use URIs of the form
/contact/in/city/<name> to show entities associated with a particular City.
Areas, however, were using /area/in/<name>.  Change links and parameter
handling for consistency.

lib/area.php
lib/city.php

index 5785ed2..9670a86 100644 (file)
   /* /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);
index d4a4a6f..6143bd2 100644 (file)
@@ -18,7 +18,7 @@
     if (count($p)) {
       foreach ($p as $city) {
         echo "<br>\nCity: " . $city->getStrongLink(get_city_displayname($city));
-        printf(" <a class=\"small\" href=\"/area/in/%s/%d\">Areas</a>", urlencode($city->getName()), $city->getID());
+        printf(" <a class=\"small\" href=\"/area/in/city/%s/%d\">Areas</a>", urlencode($city->getName()), $city->getID());
         printf(" <a class=\"small\" href=\"/contact/in/city/%s/%d\">Contacts</a>", urlencode($city->getName()), $city->getId());
         printf(" <a class=\"small\" href=\"/donation/in/city/%s/%d\">Donations</a>", urlencode($city->getName()), $city->getId());
         printf(" <a class=\"small\" href=\"/order/in/city/%s/%d\">Orders</a>", urlencode($city->getName()), $city->getId());