summaryrefslogtreecommitdiff
path: root/modules/tag
diff options
context:
space:
mode:
authormamouneyya <mamoun.diraneyya@gmail.com>2010-08-02 05:45:48 +0300
committermamouneyya <mamoun.diraneyya@gmail.com>2010-08-02 05:45:48 +0300
commit0a128bab0a788288c5291491a68bd1c9ab432825 (patch)
tree29e9887258865343dc1a6e6322a3933cf6527c61 /modules/tag
parent8e1ae7549362688dd38e053dd736ddc5fc6a4982 (diff)
parent9369fd55a36183b7dc1e4b42af46a8f649a66578 (diff)
Merge remote branch 'gallery3/master'
Diffstat (limited to 'modules/tag')
-rw-r--r--modules/tag/controllers/admin_tags.php13
-rw-r--r--modules/tag/controllers/tags.php6
-rw-r--r--modules/tag/helpers/tag_event.php15
3 files changed, 19 insertions, 15 deletions
diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php
index 9e875d14..0c82579b 100644
--- a/modules/tag/controllers/admin_tags.php
+++ b/modules/tag/controllers/admin_tags.php
@@ -57,11 +57,9 @@ class Admin_Tags_Controller extends Admin_Controller {
message::success(t("Deleted tag %tag_name", array("tag_name" => $name)));
log::success("tags", t("Deleted tag %tag_name", array("tag_name" => $name)));
- print json_encode(
- array("result" => "success",
- "location" => url::site("admin/tags")));
+ json::reply(array("result" => "success", "location" => url::site("admin/tags")));
} else {
- print json_encode(array("result" => "error", "form" => (string) $form));
+ print $form;
}
}
@@ -93,15 +91,14 @@ class Admin_Tags_Controller extends Admin_Controller {
$tag->name = $in_place_edit->value();
$tag->save();
- $message = t("Renamed tag %old_name to %new_name",
+ $message = t("Renamed tag <b>%old_name</b> to <b>%new_name</b>",
array("old_name" => $old_name, "new_name" => $tag->name));
message::success($message);
log::success("tags", $message);
- print json_encode(array("result" => "success",
- "location" => url::site("admin/tags")));
+ json::reply(array("result" => "success", "location" => url::site("admin/tags")));
} else {
- print json_encode(array("result" => "error", "form" => $in_place_edit->render()));
+ json::reply(array("result" => "error", "form" => (string)$in_place_edit->render()));
}
}
diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php
index f3d456d3..bc657644 100644
--- a/modules/tag/controllers/tags.php
+++ b/modules/tag/controllers/tags.php
@@ -67,11 +67,9 @@ class Tags_Controller extends Controller {
}
}
- print json_encode(
- array("result" => "success",
- "cloud" => (string)tag::cloud(30)));
+ json::reply(array("result" => "success", "cloud" => (string)tag::cloud(30)));
} else {
- print json_encode(array("result" => "error", "form" => (string) $form));
+ json::reply(array("result" => "error", "html" => (string)$form));
}
}
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index a790b930..0cc2170c 100644
--- a/modules/tag/helpers/tag_event.php
+++ b/modules/tag/helpers/tag_event.php
@@ -36,7 +36,8 @@ class tag_event_Core {
$tag = str_replace("\0", "", $tag);
foreach (explode(",", $tag) as $word) {
$word = trim($word);
- if (function_exists("mb_detect_encoding") && mb_detect_encoding($word) != "UTF-8") {
+ if (function_exists("mb_detect_encoding") &&
+ mb_detect_encoding($word, "ISO-8859-1, UTF-8") != "UTF-8") {
$word = utf8_encode($word);
}
$tags[$word] = 1;
@@ -67,8 +68,8 @@ class tag_event_Core {
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(
+ ->text("$('form input[name=tags]').ready(function() {
+ $('form input[name=tags]').autocomplete(
'$url', {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1});
});");
@@ -105,6 +106,10 @@ class tag_event_Core {
}
static function add_photos_form($album, $form) {
+ if (!isset($group->uploadify)) {
+ return;
+ }
+
$group = $form->add_photos;
$group->input("tags")
->label(t("Add tags to all uploaded files"))
@@ -124,6 +129,10 @@ class tag_event_Core {
}
static function add_photos_form_completed($album, $form) {
+ if (!isset($group->uploadify)) {
+ return;
+ }
+
foreach (explode(",", $form->add_photos->tags->value) as $tag_name) {
$tag_name = trim($tag_name);
if ($tag_name) {