From 3e6ba7acc3291f2268cbe9c9bef0a492b557babb Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 4 Oct 2009 00:27:22 -0600 Subject: Renamed most, if not all css selectors from gName to g-name. Moved a few shared images from wind to lib. Deleted unused images in the admin_wind. This will likely break a few ajax features. --- modules/recaptcha/helpers/recaptcha.php | 2 +- modules/recaptcha/helpers/recaptcha_event.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/recaptcha/helpers') diff --git a/modules/recaptcha/helpers/recaptcha.php b/modules/recaptcha/helpers/recaptcha.php index bead6156..789bae85 100644 --- a/modules/recaptcha/helpers/recaptcha.php +++ b/modules/recaptcha/helpers/recaptcha.php @@ -19,7 +19,7 @@ */ class recaptcha_Core { static function get_configure_form() { - $form = new Forge("admin/recaptcha", "", "post", array("id" => "gConfigureRecaptchaForm")); + $form = new Forge("admin/recaptcha", "", "post", array("id" => "g-configure-recaptcha-form")); $group = $form->group("configure_recaptcha") ->label(t("Configure reCAPTCHA")); $group->input("public_key") diff --git a/modules/recaptcha/helpers/recaptcha_event.php b/modules/recaptcha/helpers/recaptcha_event.php index d23a0c74..feedced4 100644 --- a/modules/recaptcha/helpers/recaptcha_event.php +++ b/modules/recaptcha/helpers/recaptcha_event.php @@ -20,7 +20,7 @@ class recaptcha_event_Core { static function comment_add_form($form) { if (module::get_var("recaptcha", "public_key")) { - $form->add_comment->recaptcha("recaptcha")->label("")->id("gRecaptcha"); + $form->add_comment->recaptcha("recaptcha")->label("")->id("g-recaptcha"); } } -- cgit v1.2.3 From bfafef95e8090b66f3322f73e532056b10ca116a Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 29 Oct 2009 09:21:07 -0700 Subject: Generalize the adding of the recaptcha form by changing the name of the event to recaptch_add. This prevents us from having to keep modifying the recaptch module anytime we add a form that requires recaptcha. --- modules/comment/helpers/comment.php | 2 +- modules/recaptcha/helpers/recaptcha_event.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/recaptcha/helpers') diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index 35685d8c..37b11206 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -72,7 +72,7 @@ class comment_Core { $group->input("url") ->label(t("Website (hidden)"))->id("g-url"); $group->textarea("text")->label(t("Comment")) ->id("g-text"); $group->hidden("item_id")->value($item->id); - module::event("comment_add_form", $form); + module::event("recaptcha_add", $form); $group->submit("")->value(t("Add"))->class("ui-state-default ui-corner-all"); $active = identity::active_user(); diff --git a/modules/recaptcha/helpers/recaptcha_event.php b/modules/recaptcha/helpers/recaptcha_event.php index feedced4..6e885656 100644 --- a/modules/recaptcha/helpers/recaptcha_event.php +++ b/modules/recaptcha/helpers/recaptcha_event.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class recaptcha_event_Core { - static function comment_add_form($form) { + static function recaptcha_add($form) { if (module::get_var("recaptcha", "public_key")) { $form->add_comment->recaptcha("recaptcha")->label("")->id("g-recaptcha"); } -- cgit v1.2.3 From e45ea9359d6cb603be0bc28376d92883aa8d7c7e Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 29 Oct 2009 09:27:44 -0700 Subject: Cleanup typo and change what is passwed into the event. pass the group that the recaptch element should be attached to instead of the whole form. This allows the recaptch event to have no knowledge of the containing form. --- modules/comment/helpers/comment.php | 2 +- modules/recaptcha/helpers/recaptcha_event.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/recaptcha/helpers') diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index 37b11206..2b651118 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -72,7 +72,7 @@ class comment_Core { $group->input("url") ->label(t("Website (hidden)"))->id("g-url"); $group->textarea("text")->label(t("Comment")) ->id("g-text"); $group->hidden("item_id")->value($item->id); - module::event("recaptcha_add", $form); + module::event("recaptcha_add", $group); $group->submit("")->value(t("Add"))->class("ui-state-default ui-corner-all"); $active = identity::active_user(); diff --git a/modules/recaptcha/helpers/recaptcha_event.php b/modules/recaptcha/helpers/recaptcha_event.php index 6e885656..d3e5bca6 100644 --- a/modules/recaptcha/helpers/recaptcha_event.php +++ b/modules/recaptcha/helpers/recaptcha_event.php @@ -20,7 +20,7 @@ class recaptcha_event_Core { static function recaptcha_add($form) { if (module::get_var("recaptcha", "public_key")) { - $form->add_comment->recaptcha("recaptcha")->label("")->id("g-recaptcha"); + $form->recaptcha("recaptcha")->label("")->id("g-recaptcha"); } } -- cgit v1.2.3 From 488b67014b44baf8bb19deaf7c77e87a95be220b Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sat, 31 Oct 2009 16:25:25 -0700 Subject: Revert "Cleanup typo and change what is passwed into the event. pass the group that the recaptch element should be attached to instead of the whole form. This allows the recaptch event to have no knowledge of the containing form." Revert "Generalize the adding of the recaptcha form by changing the name of the event to recaptch_add. This prevents us from having to keep modifying the recaptch module anytime we add a form that requires recaptcha." This reverts commits e45ea9359d6cb603be0bc28376d92883aa8d7c7e and bfafef95e8090b66f3322f73e532056b10ca116a. --- modules/comment/helpers/comment.php | 2 +- modules/recaptcha/helpers/recaptcha_event.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/recaptcha/helpers') diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index 2b651118..35685d8c 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -72,7 +72,7 @@ class comment_Core { $group->input("url") ->label(t("Website (hidden)"))->id("g-url"); $group->textarea("text")->label(t("Comment")) ->id("g-text"); $group->hidden("item_id")->value($item->id); - module::event("recaptcha_add", $group); + module::event("comment_add_form", $form); $group->submit("")->value(t("Add"))->class("ui-state-default ui-corner-all"); $active = identity::active_user(); diff --git a/modules/recaptcha/helpers/recaptcha_event.php b/modules/recaptcha/helpers/recaptcha_event.php index d3e5bca6..feedced4 100644 --- a/modules/recaptcha/helpers/recaptcha_event.php +++ b/modules/recaptcha/helpers/recaptcha_event.php @@ -18,9 +18,9 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class recaptcha_event_Core { - static function recaptcha_add($form) { + static function comment_add_form($form) { if (module::get_var("recaptcha", "public_key")) { - $form->recaptcha("recaptcha")->label("")->id("g-recaptcha"); + $form->add_comment->recaptcha("recaptcha")->label("")->id("g-recaptcha"); } } -- cgit v1.2.3 From 809e738536b6639bb42ecae8eb1e183543fed93c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 1 Nov 2009 13:14:11 -0800 Subject: Try an new approach to extending forms. Create an extend_form event. For the first attempt replace the comment_add_form and item_add_form events. --- modules/comment/helpers/comment.php | 6 +++++- modules/gallery/helpers/album.php | 4 +++- modules/gallery/helpers/movie.php | 5 +++-- modules/gallery/helpers/photo.php | 4 +++- modules/recaptcha/config/recaptcha.php | 24 ++++++++++++++++++++++++ modules/recaptcha/helpers/recaptcha_event.php | 10 +++++++--- modules/tag/helpers/tag_event.php | 18 +++++++++++------- 7 files changed, 56 insertions(+), 15 deletions(-) create mode 100644 modules/recaptcha/config/recaptcha.php (limited to 'modules/recaptcha/helpers') diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index 35685d8c..e2772707 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -72,7 +72,11 @@ class comment_Core { $group->input("url") ->label(t("Website (hidden)"))->id("g-url"); $group->textarea("text")->label(t("Comment")) ->id("g-text"); $group->hidden("item_id")->value($item->id); - module::event("comment_add_form", $form); + + $extend_form = (object)array("data" => $item, "form" => $form, "id" => "g-comment-form", + "append_to" => $group); + module::event("extend_form", $extend_form); + $group->submit("")->value(t("Add"))->class("ui-state-default ui-corner-all"); $active = identity::active_user(); diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php index 72a79a75..c9c6e2c9 100644 --- a/modules/gallery/helpers/album.php +++ b/modules/gallery/helpers/album.php @@ -154,7 +154,9 @@ class album_Core { "DESC" => t("Descending"))) ->selected($parent->sort_order); - module::event("item_edit_form", $parent, $form); + $extend_form = (object)array("data" => $parent, "form" => $form, "id" => "g-edit-album-form", + "append_to" => $group); + module::event("extend_form", $extend_form); $group = $form->group("buttons")->label(""); $group->hidden("type")->value("album"); diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index e84e8ea6..9e663d1f 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -151,7 +151,9 @@ class movie_Core { "not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores")); - module::event("item_edit_form", $movie, $form); + $extend_form = (object)array("data" => $parent, "form" => $form, "id" => "g-edit-movie-form", + "append_to" => $group); + module::event("extend_form", $extend_form); $group = $form->group("buttons")->label(""); $group->submit("")->value(t("Modify")); @@ -159,7 +161,6 @@ class movie_Core { return $form; } - static function getmoviesize($filename) { $ffmpeg = self::find_ffmpeg(); if (empty($ffmpeg)) { diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php index 01cf5278..f5e1e1dc 100644 --- a/modules/gallery/helpers/photo.php +++ b/modules/gallery/helpers/photo.php @@ -179,7 +179,9 @@ class photo_Core { "not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores")); - module::event("item_edit_form", $photo, $form); + $extend_form = (object)array("data" => $photo, "form" => $form, "id" => "g-edit-photo-form", + "append_to" => $group); + module::event("extend_form", $extend_form); $group = $form->group("buttons")->label(""); $group->submit("")->value(t("Modify")); diff --git a/modules/recaptcha/config/recaptcha.php b/modules/recaptcha/config/recaptcha.php new file mode 100644 index 00000000..04827673 --- /dev/null +++ b/modules/recaptcha/config/recaptcha.php @@ -0,0 +1,24 @@ +add_comment->recaptcha("recaptcha")->label("")->id("g-recaptcha"); + static function extend_form($event_data) { + // @todo put into an admin interface + $config = Kohana::config("recaptcha"); + if (module::get_var("recaptcha", "public_key") && + in_array($event_data->id, $config["recaptcha"])) { + $input = empty($event_data->append_to) ? $event_data->form : $event_data->append_to; + $input->recaptcha("recaptcha")->label("")->id("g-recaptcha"); } } diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index 57986e40..cc134766 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -64,16 +64,20 @@ class tag_event_Core { tag::compact(); } - static function item_edit_form($item, $form) { - $url = url::site("tags/autocomplete"); - $form->script("") - ->text("$('form input[id=tags]').ready(function() { + static function extend_form($event_data) { + if (in_array($event_data->id, + array("g-edit-album-form", "g-edit-movie-form", "g-edit-photo-form"))) { + $url = url::site("tags/autocomplete"); + $event_data->form->script("") + ->text("$('form input[id=tags]').ready(function() { $('form input[id=tags]').autocomplete( '$url', {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1}); });"); - $tag_value = implode(", ", tag::item_tags($item)); - $form->edit_item->input("tags")->label(t("Tags (comma separated)")) - ->value($tag_value); + $tag_value = implode(", ", tag::item_tags($event_data->data)); + $input = empty($event_data->append_to) ? $event_data->form : $event_data->append_to; + $input->input("tags")->label(t("Tags (comma separated)")) + ->value($tag_value); + } } static function item_edit_form_completed($item, $form) { -- cgit v1.2.3 From 192b11724ef315ebaabb3088a0daba1450fd7df0 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 2 Nov 2009 13:45:40 -0800 Subject: Add a recaptcha_theme file so we can actually include the recaptcha.css file so the recaptcha doesn't looking... interesting. --- modules/recaptcha/helpers/recaptcha_theme.php | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 modules/recaptcha/helpers/recaptcha_theme.php (limited to 'modules/recaptcha/helpers') diff --git a/modules/recaptcha/helpers/recaptcha_theme.php b/modules/recaptcha/helpers/recaptcha_theme.php new file mode 100644 index 00000000..fd1f563c --- /dev/null +++ b/modules/recaptcha/helpers/recaptcha_theme.php @@ -0,0 +1,28 @@ +css("recaptcha.css"); + } + + static function admin_head($theme) { + $theme->css("recaptcha.css"); + } +} \ No newline at end of file -- cgit v1.2.3 From 9a33f96e31ba41d78ab24eb9420d74578c7fbbcf Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 3 Nov 2009 14:44:53 -0800 Subject: Add a register_add_form event handler to recaptcha to add the recaptcha to the bottom of the user registration form in the register module. --- modules/recaptcha/helpers/recaptcha_event.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules/recaptcha/helpers') diff --git a/modules/recaptcha/helpers/recaptcha_event.php b/modules/recaptcha/helpers/recaptcha_event.php index feedced4..e7ded3ab 100644 --- a/modules/recaptcha/helpers/recaptcha_event.php +++ b/modules/recaptcha/helpers/recaptcha_event.php @@ -24,6 +24,12 @@ class recaptcha_event_Core { } } + static function register_add_form($form) { + if (module::get_var("recaptcha", "public_key")) { + $form->register_user->recaptcha("recaptcha")->label("")->id("g-recaptcha"); + } + } + static function admin_menu($menu, $theme) { $menu->get("settings_menu") ->append(Menu::factory("link") -- cgit v1.2.3 From 26f8240e3478802a505f6f5355741d30130c65c5 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 9 Nov 2009 11:52:43 -0800 Subject: Revert "Try an new approach to extending forms. Create an extend_form event. For the first attempt replace the comment_add_form and item_add_form events." This reverts commit 809e738536b6639bb42ecae8eb1e183543fed93c. --- modules/comment/helpers/comment.php | 6 +----- modules/gallery/helpers/album.php | 4 +--- modules/gallery/helpers/movie.php | 5 ++--- modules/gallery/helpers/photo.php | 4 +--- modules/recaptcha/config/recaptcha.php | 24 ------------------------ modules/recaptcha/helpers/recaptcha_event.php | 10 +++------- modules/tag/helpers/tag_event.php | 18 +++++++----------- 7 files changed, 15 insertions(+), 56 deletions(-) delete mode 100644 modules/recaptcha/config/recaptcha.php (limited to 'modules/recaptcha/helpers') diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index e2772707..35685d8c 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -72,11 +72,7 @@ class comment_Core { $group->input("url") ->label(t("Website (hidden)"))->id("g-url"); $group->textarea("text")->label(t("Comment")) ->id("g-text"); $group->hidden("item_id")->value($item->id); - - $extend_form = (object)array("data" => $item, "form" => $form, "id" => "g-comment-form", - "append_to" => $group); - module::event("extend_form", $extend_form); - + module::event("comment_add_form", $form); $group->submit("")->value(t("Add"))->class("ui-state-default ui-corner-all"); $active = identity::active_user(); diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php index c9c6e2c9..72a79a75 100644 --- a/modules/gallery/helpers/album.php +++ b/modules/gallery/helpers/album.php @@ -154,9 +154,7 @@ class album_Core { "DESC" => t("Descending"))) ->selected($parent->sort_order); - $extend_form = (object)array("data" => $parent, "form" => $form, "id" => "g-edit-album-form", - "append_to" => $group); - module::event("extend_form", $extend_form); + module::event("item_edit_form", $parent, $form); $group = $form->group("buttons")->label(""); $group->hidden("type")->value("album"); diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index 9e663d1f..e84e8ea6 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -151,9 +151,7 @@ class movie_Core { "not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores")); - $extend_form = (object)array("data" => $parent, "form" => $form, "id" => "g-edit-movie-form", - "append_to" => $group); - module::event("extend_form", $extend_form); + module::event("item_edit_form", $movie, $form); $group = $form->group("buttons")->label(""); $group->submit("")->value(t("Modify")); @@ -161,6 +159,7 @@ class movie_Core { return $form; } + static function getmoviesize($filename) { $ffmpeg = self::find_ffmpeg(); if (empty($ffmpeg)) { diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php index f5e1e1dc..01cf5278 100644 --- a/modules/gallery/helpers/photo.php +++ b/modules/gallery/helpers/photo.php @@ -179,9 +179,7 @@ class photo_Core { "not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores")); - $extend_form = (object)array("data" => $photo, "form" => $form, "id" => "g-edit-photo-form", - "append_to" => $group); - module::event("extend_form", $extend_form); + module::event("item_edit_form", $photo, $form); $group = $form->group("buttons")->label(""); $group->submit("")->value(t("Modify")); diff --git a/modules/recaptcha/config/recaptcha.php b/modules/recaptcha/config/recaptcha.php deleted file mode 100644 index 04827673..00000000 --- a/modules/recaptcha/config/recaptcha.php +++ /dev/null @@ -1,24 +0,0 @@ -id, $config["recaptcha"])) { - $input = empty($event_data->append_to) ? $event_data->form : $event_data->append_to; - $input->recaptcha("recaptcha")->label("")->id("g-recaptcha"); + static function comment_add_form($form) { + if (module::get_var("recaptcha", "public_key")) { + $form->add_comment->recaptcha("recaptcha")->label("")->id("g-recaptcha"); } } diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index cc134766..57986e40 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -64,20 +64,16 @@ class tag_event_Core { tag::compact(); } - static function extend_form($event_data) { - if (in_array($event_data->id, - array("g-edit-album-form", "g-edit-movie-form", "g-edit-photo-form"))) { - $url = url::site("tags/autocomplete"); - $event_data->form->script("") - ->text("$('form input[id=tags]').ready(function() { + static function item_edit_form($item, $form) { + $url = url::site("tags/autocomplete"); + $form->script("") + ->text("$('form input[id=tags]').ready(function() { $('form input[id=tags]').autocomplete( '$url', {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1}); });"); - $tag_value = implode(", ", tag::item_tags($event_data->data)); - $input = empty($event_data->append_to) ? $event_data->form : $event_data->append_to; - $input->input("tags")->label(t("Tags (comma separated)")) - ->value($tag_value); - } + $tag_value = implode(", ", tag::item_tags($item)); + $form->edit_item->input("tags")->label(t("Tags (comma separated)")) + ->value($tag_value); } static function item_edit_form_completed($item, $form) { -- cgit v1.2.3