From ee6da62511660cf5849fea1a39a3e94c1f2867c7 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Fri, 17 Feb 2012 17:26:45 -0800 Subject: Fixes #15. Added untagging. --- actions/photos/image/untag.php | 24 ++++++++++++++++++++++++ classes/TidypicsImage.php | 4 +++- languages/en.php | 11 +++++++---- start.php | 2 +- views/default/js/photos/tagging.php | 13 ++++++++----- views/default/photos/tagging/tag.php | 16 +++++++++++++++- 6 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 actions/photos/image/untag.php diff --git a/actions/photos/image/untag.php b/actions/photos/image/untag.php new file mode 100644 index 000000000..012f98930 --- /dev/null +++ b/actions/photos/image/untag.php @@ -0,0 +1,24 @@ +name != 'phototag') { + register_error(elgg_echo("tidypics:phototagging:delete:error")); + forward(REFERER); +} + +if (!$annotation->canEdit()) { + register_error(elgg_echo("tidypics:phototagging:delete:error")); + forward(REFERER); +} + +if ($annotation->delete()) { + system_message(elgg_echo("tidypics:phototagging:delete:success")); +} else { + system_message(elgg_echo("tidypics:phototagging:delete:error")); +} + +forward(REFERER); diff --git a/classes/TidypicsImage.php b/classes/TidypicsImage.php index b97a2b05e..a64743017 100644 --- a/classes/TidypicsImage.php +++ b/classes/TidypicsImage.php @@ -348,7 +348,9 @@ class TidypicsImage extends ElggFile { 'annotation_name' => 'phototag', )); foreach ($annotations as $annotation) { - $tags[] = unserialize($annotation->value); + $tag = unserialize($annotation->value); + $tag->annotation_id = $annotation->id; + $tags[] = $tag; } return $tags; diff --git a/languages/en.php b/languages/en.php index 69ba9d245..efae155b3 100644 --- a/languages/en.php +++ b/languages/en.php @@ -187,18 +187,21 @@ $english = array( // tagging 'tidypics:taginstruct' => 'Select the area that you want to tag or %s', - 'tidypics:deltag_title' => 'Select tags to delete', 'tidypics:finish_tagging' => 'Stop tagging', 'tidypics:tagthisphoto' => 'Tag this photo', - 'tidypics:deletetag' => 'Delete a photo tag', 'tidypics:actiontag' => 'Tag', - 'tidypics:actiondelete' => 'Delete', 'tidypics:actioncancel' => 'Cancel', 'tidypics:inthisphoto' => 'In this photo', 'tidypics:usertag' => "Photos tagged with user %s", 'tidypics:phototagging:success' => 'Photo tag was successfully added', 'tidypics:phototagging:error' => 'Unexpected error occurred during tagging', - 'tidypics:deletetag:success' => 'Selected tags were successfully deleted', + + 'tidypics:phototagging:delete:success' => 'Photo tag was removed.', + 'tidypics:phototagging:delete:error' => 'Unexpceted error occurred when removing photo tag.', + 'tidypics:phototagging:delete:confirm' => 'Remove this tag?', + + + 'tidypics:tag:subject' => "You have been tagged in a photo", 'tidypics:tag:body' => "You have been tagged in the photo %s by %s. diff --git a/start.php b/start.php index a2dc75ab1..6ef3af541 100644 --- a/start.php +++ b/start.php @@ -98,7 +98,7 @@ function tidypics_init() { //register_action("tidypics/ajax_upload", true, "$base_dir/ajax_upload.php"); //register_action("tidypics/ajax_upload_complete", true, "$base_dir/ajax_upload_complete.php"); elgg_register_action("photos/image/tag", "$base_dir/image/tag.php"); - //register_action("tidypics/deletetag", false, "$base_dir/deletetag.php"); + elgg_register_action("photos/image/untag", "$base_dir/image/untag.php"); elgg_register_action("photos/admin/settings", "$base_dir/admin/settings.php", 'admin'); elgg_register_action("photos/admin/create_thumbnails", "$base_dir/admin/create_thumbnails.php", 'admin'); diff --git a/views/default/js/photos/tagging.php b/views/default/js/photos/tagging.php index a3c7efc1c..f444aa44c 100644 --- a/views/default/js/photos/tagging.php +++ b/views/default/js/photos/tagging.php @@ -7,7 +7,7 @@ */ ?> - +//