summaryrefslogtreecommitdiff
path: root/modules/tag/controllers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-09-16 19:53:07 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-09-16 19:53:07 -0700
commitb6306c7726552ab19c280057948fcecd5fc2388b (patch)
tree4d99ba67df8b93a2a94b4aa9889263562bb615c6 /modules/tag/controllers
parenteb8e23582f8c11062868811854417a8a8ec0122b (diff)
parent5490057480f17e5810cf8b9e558769ebd74d4b27 (diff)
Merge branch 'master' of git@github.com:gallery/gallery3 into talmdal_dev
Diffstat (limited to 'modules/tag/controllers')
-rw-r--r--modules/tag/controllers/admin_tags.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php
index 8b8dde21..3301566b 100644
--- a/modules/tag/controllers/admin_tags.php
+++ b/modules/tag/controllers/admin_tags.php
@@ -81,15 +81,20 @@ class Admin_Tags_Controller extends Admin_Controller {
kohana::show_404();
}
- $form = tag::get_rename_form($tag);
- $valid = $form->validate();
+ //Don't use a form as the form is dynamically created in the js
+ $post = new Validation($_POST);
+ $post->add_rules("name", "required", "length[1,64]");
+ $valid = $post->validate();
if ($valid) {
- $new_name = $form->rename_tag->inputs["name"]->value;
+ $new_name = $this->input->post("name");
$new_tag = ORM::factory("tag")->where("name", $new_name)->find();
if ($new_tag->loaded) {
- $form->rename_tag->inputs["name"]->add_error("in_use", 1);
+ $error_msg = "There is already a tag with that name";
$valid = false;
}
+ } else {
+ $error_msg = $post->errors();
+ $error_msg = $error_msg[0];
}
if ($valid) {
@@ -110,7 +115,7 @@ class Admin_Tags_Controller extends Admin_Controller {
} else {
print json_encode(
array("result" => "error",
- "form" => $form->__toString()));
+ "message" => $error_msg));
}
}
}