diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-11-20 19:41:45 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-11-20 19:41:45 -0800 |
commit | 5e9bbbe490e40da103e0a7960312ab1c814dafa3 (patch) | |
tree | 641678d13204c4817edf5058a34b154becc5376f /modules/gallery/controllers/simple_uploader.php | |
parent | 144c2fb61ee30e1168a6afe3b0332485d748d608 (diff) |
Convert the Simple Uploader form over to Forge, and use the event
model to let the Tags module modify it. This brings it inline with
our other module-extensible form based interactions.
Diffstat (limited to 'modules/gallery/controllers/simple_uploader.php')
-rw-r--r-- | modules/gallery/controllers/simple_uploader.php | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php index c6d7fc83..255d5df2 100644 --- a/modules/gallery/controllers/simple_uploader.php +++ b/modules/gallery/controllers/simple_uploader.php @@ -26,9 +26,7 @@ class Simple_Uploader_Controller extends Controller { $item = $item->parent(); } - $v = new View("simple_uploader.html"); - $v->item = $item; - print $v; + print self::get_add_form($item); } public function start() { @@ -67,9 +65,11 @@ class Simple_Uploader_Controller extends Controller { html::anchor("photos/$item->id", t("view photo"))); } - $tags = $this->input->post("tags"); - if (!(empty($tags))) { - module::event("add_tags_to_item", $item, $tags); + // We currently have no way of showing errors if validation fails, so only call our event + // handlers if validation passes. + $form = self::get_add_form($album); + if ($form->validate()) { + module::event("add_photos_form_completed", $item, $form); } } catch (Exception $e) { Kohana::log("alert", $e->__toString()); @@ -95,4 +95,17 @@ class Simple_Uploader_Controller extends Controller { print json_encode(array("result" => "success")); } + public function get_add_form($album) { + $form = new Forge("simple_uploader/finish", "", "post", array("id" => "g-add-photos-form")); + $group = $form->group("add_photos") + ->label(t("Add photos to %album_title", array("album_title" => html::purify($album->title)))); + $group->uploadify("uploadify")->album($album); + + $group = $form->group("actions"); + $group->uploadify_buttons(""); + + module::event("add_photos_form", $album, $form); + + return $form; + } } |