summaryrefslogtreecommitdiff
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
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.
-rw-r--r--core/helpers/album.php4
-rw-r--r--core/helpers/core_block.php3
-rw-r--r--core/helpers/photo.php4
-rw-r--r--core/helpers/theme.php2
-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
-rw-r--r--themes/default/css/screen.css8
13 files changed, 33 insertions, 29 deletions
diff --git a/core/helpers/album.php b/core/helpers/album.php
index 223a057d..5fd64442 100644
--- a/core/helpers/album.php
+++ b/core/helpers/album.php
@@ -64,7 +64,7 @@ class album_Core {
}
static function get_add_form($parent) {
- $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddAlbumForm"));
+ $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAdd_Album_Form"));
$group = $form->group("add_album")->label(t("Add Album to %album_title", array("album_title" => $parent->title)));
$group->input("name")->label(t("Name"));
$group->input("title")->label(t("Title"));
@@ -76,7 +76,7 @@ class album_Core {
}
static function get_edit_form($parent) {
- $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEditAlbumForm"));
+ $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEdit_Album_Form"));
$form->hidden("_method")->value("put");
$group = $form->group("edit_album")->label(t("Edit Album"));
if ($parent->id != 1) {
diff --git a/core/helpers/core_block.php b/core/helpers/core_block.php
index af08c2c2..1645133c 100644
--- a/core/helpers/core_block.php
+++ b/core/helpers/core_block.php
@@ -83,7 +83,8 @@ class core_block_Core {
}
static function get_add_block_form() {
- $form = new Forge("admin/dashboard/add_block", "", "post");
+ $form = new Forge("admin/dashboard/add_block", "", "post",
+ array("id" => "gAdd_Dashboard_Block_Form"));
$group = $form->group("add_block")->label(t("Add Block"));
$group->dropdown("id")->label("Available Blocks")->options(block_manager::get_available());
$group->submit("center")->value(t("Add to center"));
diff --git a/core/helpers/photo.php b/core/helpers/photo.php
index a2958aec..2b653481 100644
--- a/core/helpers/photo.php
+++ b/core/helpers/photo.php
@@ -96,7 +96,7 @@ class photo_Core {
}
static function get_add_form($parent) {
- $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddPhotoForm"));
+ $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAdd_Photo_Form"));
$group = $form->group("add_photo")->label(t("Add Photo to %album_title", array("album_title" =>$parent->title)));
$group->input("name")->label(t("Name"));
$group->input("title")->label(t("Title"));
@@ -109,7 +109,7 @@ class photo_Core {
}
static function get_edit_form($photo) {
- $form = new Forge("photos/$photo->id", "", "post", array("id" => "gEditPhotoForm"));
+ $form = new Forge("photos/$photo->id", "", "post", array("id" => "gEdit_Photo_Form"));
$form->hidden("_method")->value("put");
$group = $form->group("edit_photo")->label(t("Edit Photo"));
$group->input("name")->label(t("Name"))->value($photo->name);
diff --git a/core/helpers/theme.php b/core/helpers/theme.php
index a2766028..40acf195 100644
--- a/core/helpers/theme.php
+++ b/core/helpers/theme.php
@@ -39,7 +39,7 @@ class theme_Core {
}
static function get_edit_form_admin() {
- $form = new Forge("admin/themedetails/save/", "", null, array("id" =>"gThemeDetailsForm"));
+ $form = new Forge("admin/themedetails/save/", "", null, array("id" =>"gTheme_Details_Form"));
$group = $form->group("edit_theme");
$group->input("page_size")->label(t("Items per page"))->id("gPageSize")->
rules('required|valid_digit')->
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;
diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css
index e535fdab..ae58d3e1 100644
--- a/themes/default/css/screen.css
+++ b/themes/default/css/screen.css
@@ -359,18 +359,18 @@ form p.gError {
/* Inline layout (forms, lists) ~~~~~~~~~~ */
#gHeader #gSearchForm li,
-#gSidebar #gAddTagForm li {
+#gSidebar #gAdd_Tag_Form li {
float: left;
padding: .4em .5em;
}
#gHeader #gSearchForm label,
-#gSidebar #gAddTagForm label {
+#gSidebar #gAdd_Tag_Form label {
display: none;
}
#gHeader #gSearchForm input[type="text"],
-#gSidebar #gAddTagForm input[type="text"] {
+#gSidebar #gAdd_Tag_Form input[type="text"] {
width: 10em;
}
@@ -752,7 +752,7 @@ form p.gError {
width: 100%;
}
-#gDialog #gLoginForm {
+#gDialog #gLogin_Form {
width: 300px;
}