summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-01-24 17:26:47 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-01-24 17:26:47 +0000
commitcbff78daa8a642e1800916f92e43202857c3b677 (patch)
tree1cb8302d4da07fbb384d44d94644088c718c6339 /modules
parenteed57674f99621e5354a13543067e9556eb9c6d0 (diff)
Supply a form id on all forms. This id can be used by modules other
than the originating module to provide additional functionality to the form.
Diffstat (limited to 'modules')
-rw-r--r--modules/akismet/helpers/akismet.php2
-rw-r--r--modules/comment/helpers/comment.php5
-rw-r--r--modules/recaptcha/helpers/recaptcha.php2
-rw-r--r--modules/tag/helpers/tag.php9
-rw-r--r--modules/user/controllers/login.php2
-rw-r--r--modules/user/helpers/group.php7
-rw-r--r--modules/user/helpers/user.php8
-rw-r--r--modules/watermark/helpers/watermark.php6
8 files changed, 22 insertions, 19 deletions
diff --git a/modules/akismet/helpers/akismet.php b/modules/akismet/helpers/akismet.php
index d46556de..67be802f 100644
--- a/modules/akismet/helpers/akismet.php
+++ b/modules/akismet/helpers/akismet.php
@@ -21,7 +21,7 @@ class akismet_Core {
public static $test_mode = TEST_MODE;
static function get_configure_form() {
- $form = new Forge("admin/akismet", "", "post");
+ $form = new Forge("admin/akismet", "", "post", array("id" => "gConfigure_Akismet_Form"));
$group = $form->group("configure_akismet")->label(t("Configure Akismet"));
$group->input("api_key")->label(t("API Key"))->value(module::get_var("akismet", "api_key"));
$group->api_key->error_messages("invalid", t("The API key you provided is invalid."));
diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php
index 3fbf05e1..a3ad2a6a 100644
--- a/modules/comment/helpers/comment.php
+++ b/modules/comment/helpers/comment.php
@@ -70,7 +70,7 @@ class comment_Core {
}
static function get_add_form($item) {
- $form = new Forge("comments", "", "post");
+ $form = new Forge("comments", "", "post", array("id" => "gAdd_Comment_Form"));
$group = $form->group("add_comment")->label(t("Add comment"));
$group->input("name") ->label(t("Name")) ->id("gAuthor");
$group->input("email") ->label(t("Email (hidden)")) ->id("gEmail");
@@ -93,7 +93,8 @@ class comment_Core {
}
static function get_edit_form($comment) {
- $form = new Forge("comments/{$comment->id}?_method=put", "", "post");
+ $form = new Forge("comments/{$comment->id}?_method=put", "", "post",
+ array("id" => "gEdit_Comment_Form"));
$group = $form->group("edit_comment")->label(t("Edit comment"));
$group->input("name") ->label(t("Author")) ->id("gAuthor");
$group->input("email") ->label(t("Email (hidden)")) ->id("gEmail");
diff --git a/modules/recaptcha/helpers/recaptcha.php b/modules/recaptcha/helpers/recaptcha.php
index 69361e23..eea000b1 100644
--- a/modules/recaptcha/helpers/recaptcha.php
+++ b/modules/recaptcha/helpers/recaptcha.php
@@ -31,7 +31,7 @@ class recaptcha_Core {
private $options = array();
static function get_configure_form() {
- $form = new Forge("admin/recaptcha", "", "post");
+ $form = new Forge("admin/recaptcha", "", "post", array("id" => "gConfigure_Recaptcha_Form"));
$group = $form->group("configure_recaptcha")
->label(t("Configure Recaptcha"));
$group->hidden("orig_public_key")
diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php
index 7dec6809..faed5c51 100644
--- a/modules/tag/helpers/tag.php
+++ b/modules/tag/helpers/tag.php
@@ -76,7 +76,7 @@ class tag_Core {
}
static function get_add_form($item) {
- $form = new Forge("tags", "", "post", array("id" => "gAddTagForm"));
+ $form = new Forge("tags", "", "post", array("id" => "gAdd_Tag_Form"));
$group = $form->group("add_tag")->label(t("Add Tag"));
$group->input("name")->label(t("Add tag"));
$group->hidden("item_id")->value($item->id);
@@ -86,7 +86,7 @@ class tag_Core {
}
static function get_rename_form($tag) {
- $form = new Forge("admin/tags/rename/$tag->id", "", "post", array("id" => "gRenameTagForm"));
+ $form = new Forge("admin/tags/rename/$tag->id", "", "post", array("id" => "gRename_Tag_Form"));
$group = $form->group("rename_tag")->label(t("Rename Tag"));
$group->input("name")->label(t("Tag name"))->value($tag->name);
$group->inputs["name"]->error_messages("in_use", t("There is already a tag with that name"));
@@ -96,8 +96,9 @@ class tag_Core {
}
static function get_delete_form($tag) {
- $form = new Forge("admin/tags/delete/$tag->id", "", "post", array("id" => "gDeleteTagForm"));
- $group = $form->group("delete_tag")->label(t("Really delete tag %tag_name?", array("tag_name" => $tag->name)));
+ $form = new Forge("admin/tags/delete/$tag->id", "", "post", array("id" => "gDelete_Tag_Form"));
+ $group = $form->group("delete_tag")
+ ->label(t("Really delete tag %tag_name?", array("tag_name" => $tag->name)));
$group->submit("")->value(t("Delete Tag"));
$form->add_rules_from(ORM::factory("tag"));
return $form;
diff --git a/modules/user/controllers/login.php b/modules/user/controllers/login.php
index c9a32546..a6dc5fad 100644
--- a/modules/user/controllers/login.php
+++ b/modules/user/controllers/login.php
@@ -53,7 +53,7 @@ class Login_Controller extends Controller {
}
private function _login_form() {
- $form = new Forge(url::current(true), "", "post", array("id" => "gLoginForm"));
+ $form = new Forge(url::current(true), "", "post", array("id" => "gLogin_Form"));
$group = $form->group("login")->label(t("Login"));
$group->input("name")->label(t("Name"))->id("gName")->class(null);
$group->password("password")->label(t("Password"))->id("gPassword")->class(null);
diff --git a/modules/user/helpers/group.php b/modules/user/helpers/group.php
index b49b6888..d9191fc9 100644
--- a/modules/user/helpers/group.php
+++ b/modules/user/helpers/group.php
@@ -62,7 +62,7 @@ class group_Core {
}
static function get_edit_form_admin($group) {
- $form = new Forge("admin/groups/edit/$group->id");
+ $form = new Forge("admin/groups/edit/$group->id", "", "post", array("id" => "gEdit_Group_Form"));
$form_group = $form->group("edit_group")->label(t("Edit Group"));
$form_group->input("name")->label(t("Name"))->id("gName")->value($group->name);
$form_group->inputs["name"]->error_messages(
@@ -73,7 +73,7 @@ class group_Core {
}
static function get_add_form_admin() {
- $form = new Forge("admin/groups/add");
+ $form = new Forge("admin/groups/add", "", "post", array("id" => "gAdd_Group_Form"));
$form_group = $form->group("add_group")->label(t("Add Group"));
$form_group->input("name")->label(t("Name"))->id("gName");
$form_group->inputs["name"]->error_messages(
@@ -85,7 +85,8 @@ class group_Core {
}
static function get_delete_form_admin($group) {
- $form = new Forge("admin/groups/delete/$group->id", "", "post");
+ $form = new Forge("admin/groups/delete/$group->id", "", "post",
+ array("id" => "gDelete_Group_Form"));
$form_group = $form->group("delete_group")->label(
t("Are you sure you want to delete group %group_name?", array("group_name" => $group->name)));
$form_group->submit("")->value(t("Delete"));
diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php
index 0a023159..10d0cd4d 100644
--- a/modules/user/helpers/user.php
+++ b/modules/user/helpers/user.php
@@ -25,7 +25,7 @@
*/
class user_Core {
static function get_edit_form($user, $action = NULL) {
- $form = new Forge("users/$user->id?_method=put", "", "post", array("id" => "gUserForm"));
+ $form = new Forge("users/$user->id?_method=put", "", "post", array("id" => "gUser_Form"));
$group = $form->group("edit_user")->label(t("Edit User"));
$group->input("name")->label(t("Name"))->id("gName")->value($user->name);
$group->input("full_name")->label(t("Full Name"))->id("gFullName")->value($user->full_name);
@@ -38,7 +38,7 @@ class user_Core {
}
static function get_edit_form_admin($user) {
- $form = new Forge("admin/users/edit/$user->id");
+ $form = new Forge("admin/users/edit/$user->id", "", "post", array("id" => "gEdit_User_Form"));
$group = $form->group("edit_user")->label(t("Edit User"));
$group->input("name")->label(t("Name"))->id("gName")->value($user->name);
$group->inputs["name"]->error_messages(
@@ -53,7 +53,7 @@ class user_Core {
}
static function get_add_form_admin() {
- $form = new Forge("admin/users/add");
+ $form = new Forge("admin/users/add", "", "post", array("id" => "gAdd_User_Form"));
$group = $form->group("add_user")->label(t("Add User"));
$group->input("name")->label(t("Name"))->id("gName");
$group->inputs["name"]->error_messages(
@@ -69,7 +69,7 @@ class user_Core {
}
static function get_delete_form_admin($user) {
- $form = new Forge("admin/users/delete/$user->id", "", "post");
+ $form = new Forge("admin/users/delete/$user->id", "", "post", array("id" => "gDelete_User_Form"));
$group = $form->group("delete_user")->label(
t("Are you sure you want to delete user %name?", array("name" => $user->name)));
$group->submit("")->value(t("Delete user %name", array("name" => $user->name)));
diff --git a/modules/watermark/helpers/watermark.php b/modules/watermark/helpers/watermark.php
index 2a32147d..bcc3f8cf 100644
--- a/modules/watermark/helpers/watermark.php
+++ b/modules/watermark/helpers/watermark.php
@@ -23,7 +23,7 @@ class watermark_Core {
$range[$i] = $i;
}
- $form = new Forge("admin/watermarks/add", "", "post");
+ $form = new Forge("admin/watermarks/add", "", "post", array("id" => "gAdd_Watermark_Form"));
$group = $form->group("add_watermark")->label(t("Upload Watermark"));
$group->upload("file")->label(t("Watermark"))->rules("allow[jpg,png,gif]|size[1MB]|required");
$group->dropdown("position")->label(t("Watermark Position"))
@@ -41,7 +41,7 @@ class watermark_Core {
$range[$i] = $i;
}
- $form = new Forge("admin/watermarks/edit", "", "post");
+ $form = new Forge("admin/watermarks/edit", "", "post", array("id" => "gEdit_Watermark_Form"));
$group = $form->group("edit_watermark")->label(t("Edit Watermark"));
$group->dropdown("position")->label(t("Watermark Position"))
->options(self::positions())
@@ -54,7 +54,7 @@ class watermark_Core {
}
static function get_delete_form() {
- $form = new Forge("admin/watermarks/delete", "", "post");
+ $form = new Forge("admin/watermarks/delete", "", "post", array("id" => "gDelete_Watermark_Form"));
$group = $form->group("delete_watermark")->label(t("Really delete Watermark?"));
$group->submit("")->value(t("Delete"));
return $form;