diff options
author | Jozef Selesi <jozefs@users.sourceforge.net> | 2008-11-19 00:12:25 +0000 |
---|---|---|
committer | Jozef Selesi <jozefs@users.sourceforge.net> | 2008-11-19 00:12:25 +0000 |
commit | b2772f5a050351129a64b966b127e39cf76c80b5 (patch) | |
tree | a0a7704bdd944d45b09a8959ab3c60c91f31bab1 /core | |
parent | 1992343c2e1f2df892f39f971ae629edc59c33d0 (diff) |
* Renamed the album, item and photo controllers to albums, items and photos in order to follow the convention that controllers that refer to a collection of resources have plural names.
* Added a bug workaround to routes.php
Diffstat (limited to 'core')
-rw-r--r-- | core/config/routes.php | 5 | ||||
-rw-r--r-- | core/controllers/albums.php (renamed from core/controllers/album.php) | 2 | ||||
-rw-r--r-- | core/controllers/items.php (renamed from core/controllers/item.php) | 8 | ||||
-rw-r--r-- | core/controllers/photos.php (renamed from core/controllers/photo.php) | 2 | ||||
-rw-r--r-- | core/views/welcome.html.php | 8 |
5 files changed, 15 insertions, 10 deletions
diff --git a/core/config/routes.php b/core/config/routes.php index 120e6900..4da97654 100644 --- a/core/config/routes.php +++ b/core/config/routes.php @@ -18,6 +18,11 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +// FIXME Temporary workaround to show the welcome page at /welcome. +// The problem is that we're routing all requests to /{controllername} to Rest_Controller, +// even requests to controllers that do not implement Rest_Controller. +$config['^welcome$'] = 'welcome'; + // REST configuration // Any resource requests (eg: album/1 or comment/3) get dispatched to the REST // dispatcher, and the abstract REST_Controller is not directly routable. diff --git a/core/controllers/album.php b/core/controllers/albums.php index 82652d88..ead738d9 100644 --- a/core/controllers/album.php +++ b/core/controllers/albums.php @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class Album_Controller extends Item_Controller { +class Albums_Controller extends Items_Controller { /** * @see Rest_Controller::_show($resource, $output_format) diff --git a/core/controllers/item.php b/core/controllers/items.php index f5c5f9c9..6c202b30 100644 --- a/core/controllers/item.php +++ b/core/controllers/items.php @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class Item_Controller extends REST_Controller { +class Items_Controller extends REST_Controller { protected $resource_type = "item"; /** @@ -45,7 +45,7 @@ class Item_Controller extends REST_Controller { // Redirect to the more specific resource type, since it will render // differently. We could also just delegate here, but it feels more appropriate // to have a single canonical resource mapping. - return url::redirect("{$item->type}/$item->id"); + return url::redirect("{$item->type}s}/$item->id"); } public function _update($item) { @@ -90,7 +90,7 @@ class Item_Controller extends REST_Controller { $this->input->post("title", $this->input->post("name")), $this->input->post("description"), $owner_id); - url::redirect("{$new_item->type}/{$new_item->id}"); + url::redirect("{$new_item->type}s/{$new_item->id}"); } break; } @@ -103,7 +103,7 @@ class Item_Controller extends REST_Controller { if ($parent->id) { $item->delete(); } - url::redirect("{$parent->type}/{$parent->id}"); + url::redirect("{$parent->type}s/{$parent->id}"); } public function _create($item) { diff --git a/core/controllers/photo.php b/core/controllers/photos.php index d6d37f98..a5b75b79 100644 --- a/core/controllers/photo.php +++ b/core/controllers/photos.php @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class Photo_Controller extends Item_Controller { +class Photos_Controller extends Items_Controller { /** * @see Rest_Controller::_show($resource, $output_format) diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php index cc85475c..a015fc92 100644 --- a/core/views/welcome.html.php +++ b/core/views/welcome.html.php @@ -164,7 +164,7 @@ <div id="actions" class="activity"> <p> - <?= html::anchor("album/1", "Browse Gallery") ?> + <?= html::anchor("albums/1", "Browse Gallery") ?> <i>(<?= $album_count ?> albums, <?= $photo_count ?> photos)</i> </p> <p> @@ -183,7 +183,7 @@ </p> <fieldset> <legend>Photos</legend> - <form method="post" action="<?= url::site("album/1") ?>" enctype="multipart/form-data"> + <form method="post" action="<?= url::site("albums/1") ?>" enctype="multipart/form-data"> <input type="submit" value="upload"/> <input id="photo_upload" name="file[]" type="file"/> <input type="hidden" name="type" value="photo"/> @@ -192,7 +192,7 @@ </fieldset> <fieldset> <legend>Albums</legend> - <form method="post" action="<?= url::site("album/1") ?>"> + <form method="post" action="<?= url::site("albums/1") ?>"> <input type="submit" value="create"/> <input type="text" name="name"/> <input type="hidden" name="type" value="album"/> @@ -210,7 +210,7 @@ </li> <? if ($deepest_photo): ?> <li> - <?= html::anchor("photo/{$deepest_photo->id}", "Deepest photo") ?> + <?= html::anchor("photos/{$deepest_photo->id}", "Deepest photo") ?> <i>(<?= $deepest_photo->level ?> levels deep)</i> </li> <? endif ?> |