summaryrefslogtreecommitdiff
path: root/modules/tag/controllers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-11-25 09:08:33 -0800
committerTim Almdal <tnalmdal@shaw.ca>2009-11-25 09:08:33 -0800
commit454a96f48fbfbf5764cf586c02539e2d01b56101 (patch)
tree37f0b70e3eada21ec109ea14da9d23a581c91955 /modules/tag/controllers
parent4c3b9e363ab1501bf3169d92f5606abf464c2d5e (diff)
Refactor the tags to remove the REST_Controller. Partial fix for ticket #917
Diffstat (limited to 'modules/tag/controllers')
-rw-r--r--modules/tag/controllers/tags.php24
1 files changed, 7 insertions, 17 deletions
diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php
index 52001719..9f9e45d9 100644
--- a/modules/tag/controllers/tags.php
+++ b/modules/tag/controllers/tags.php
@@ -17,10 +17,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
-class Tags_Controller extends REST_Controller {
- protected $resource_type = "tag";
-
- public function _show($tag) {
+class Tags_Controller extends Controller {
+ public function show($tag_id) {
+ $tag = ORM::factory("tag", $tag_id);
$page_size = module::get_var("gallery", "page_size", 9);
$page = (int) $this->input->get("page", "1");
$children_count = $tag->items_count();
@@ -47,15 +46,15 @@ class Tags_Controller extends REST_Controller {
print $template;
}
- public function _index() {
+ public function index() {
// Far from perfection, but at least require view permission for the root album
$album = ORM::factory("item", 1);
access::required("view", $album);
print tag::cloud(30);
}
- public function _create($tag) {
- $item = ORM::factory("item", $this->input->post("item_id"));
+ public function create($item_id) {
+ $item = ORM::factory("item", $item_id);
access::required("view", $item);
access::required("edit", $item);
@@ -70,8 +69,7 @@ class Tags_Controller extends REST_Controller {
print json_encode(
array("result" => "success",
- "resource" => url::site("tags/{$tag->id}"),
- "form" => tag::get_add_form($item)->__toString()));
+ "cloud" => tag::cloud(30)->__toString()));
} else {
print json_encode(
array("result" => "error",
@@ -79,14 +77,6 @@ class Tags_Controller extends REST_Controller {
}
}
- public function _form_add($item_id) {
- $item = ORM::factory("item", $item_id);
- access::required("view", $item);
- access::required("edit", $item);
-
- return tag::get_add_form($item);
- }
-
public function autocomplete() {
$tags = array();
$tag_parts = preg_split("#,#", $this->input->get("q"));