summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-07-24 14:18:15 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-07-24 14:18:15 -0700
commit078c77a62b623322956457bfd7bfbdaf56203b00 (patch)
tree941a39067f101b4773a642572f24575ffc43db3e /modules/gallery/helpers
parentfa1d32e6466d8c6ffe77d163e2da9c71688a3c61 (diff)
Add tag autocomplete to the album and photo edit pop up dialogs.
This required putting a wrapper view around the forms and passing this view as the parameter to the item_edit_form event. The view contains a $script variable that the modules can add script to be included in the form html when rendered as part of the ajax response.
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/album.php14
-rw-r--r--modules/gallery/helpers/photo.php14
2 files changed, 16 insertions, 12 deletions
diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php
index 5f10bd02..0263e0e1 100644
--- a/modules/gallery/helpers/album.php
+++ b/modules/gallery/helpers/album.php
@@ -94,9 +94,11 @@ class album_Core {
}
static function get_edit_form($parent) {
- $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEditAlbumForm"));
- $form->hidden("_method")->value("put");
- $group = $form->group("edit_item")->label(t("Edit Album"));
+ $view = new View("item_edit.html");
+ $view->script = array();
+ $view->form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEditAlbumForm"));
+ $view->form->hidden("_method")->value("put");
+ $group = $view->form->group("edit_item")->label(t("Edit Album"));
$group->input("title")->label(t("Title"))->value($parent->title);
$group->textarea("description")->label(t("Description"))->value($parent->description);
@@ -127,11 +129,11 @@ class album_Core {
"DESC" => t("Descending")))
->selected($parent->sort_order);
- module::event("item_edit_form", $parent, $form);
+ module::event("item_edit_form", $parent, $view);
$group->hidden("type")->value("album");
$group->submit("")->value(t("Modify"));
- $form->add_rules_from(ORM::factory("item"));
- return $form;
+ $view->form->add_rules_from(ORM::factory("item"));
+ return $view;
}
}
diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php
index 5cf37de1..299195e9 100644
--- a/modules/gallery/helpers/photo.php
+++ b/modules/gallery/helpers/photo.php
@@ -135,9 +135,11 @@ class photo_Core {
}
static function get_edit_form($photo) {
- $form = new Forge("photos/$photo->id", "", "post", array("id" => "gEditPhotoForm"));
- $form->hidden("_method")->value("put");
- $group = $form->group("edit_item")->label(t("Edit Photo"));
+ $view = new View("item_edit.html");
+ $view->script = array();
+ $view->form = new Forge("photos/$photo->id", "", "post", array("id" => "gEditPhotoForm"));
+ $view->form->hidden("_method")->value("put");
+ $group = $view->form->group("edit_item")->label(t("Edit Photo"));
$group->input("title")->label(t("Title"))->value($photo->title);
$group->textarea("description")->label(t("Description"))->value($photo->description);
$group->input("filename")->label(t("Filename"))->value($photo->name)
@@ -147,11 +149,11 @@ class photo_Core {
->callback("item::validate_no_trailing_period")
->error_messages("no_trailing_period", t("The photo name can't end in \".\""));
- module::event("item_edit_form", $photo, $form);
+ module::event("item_edit_form", $photo, $view);
$group->submit("")->value(t("Modify"));
- $form->add_rules_from(ORM::factory("item"));
- return $form;
+ $view->form->add_rules_from(ORM::factory("item"));
+ return $view;
}
/**