From 55d9bc4986cd685331ff7b283bfcc7a14d91750b Mon Sep 17 00:00:00 2001 From: hukoeth Date: Sun, 5 Sep 2010 22:27:38 +0200 Subject: [PATCH] Version 4 beta 1: - Implemented user notification (I need testers for this since for some reason my server is not sending mails with PHPs mail-function so I couldn't test) - Users can decide if they want to receive notifications by editing their profile - Admin can decide if notifications is switched on by default for new users and users who have not saved this setting - Guest user is now hidden when adding an annotation - Added admin option allowing to convert a user annotation to a tag or note annotation when deleting a user - Added admin option to remove orphaned annotations - Fixed borders not showing when hovering over an annotation area when having borders switched off on photo hover - Fixed issue on user page where sometime only one photo would be shown x-times - Fixed pagination on user profile pages --- .../controllers/admin_photoannotation.php | 188 ++++++++++++++++++ .../controllers/photoannotation.php | 42 +++- .../helpers/photoannotation.php | 91 --------- .../helpers/photoannotation_event.php | 187 ++++++++++++++++- .../helpers/photoannotation_installer.php | 19 ++ .../helpers/photoannotation_theme.php | 9 +- .../models/photoannotation_notification.php | 21 ++ modules/photoannotation/module.info | 2 +- .../views/admin_photoannotation.html.php | 10 +- .../admin_photoannotation_converter.html.php | 10 + ...n_photoannotation_tagsmaintanance.html.php | 27 +++ .../photoannotation_highlight_block.html.php | 66 +++--- 12 files changed, 537 insertions(+), 135 deletions(-) delete mode 100644 modules/photoannotation/helpers/photoannotation.php create mode 100644 modules/photoannotation/models/photoannotation_notification.php create mode 100644 modules/photoannotation/views/admin_photoannotation_converter.html.php create mode 100644 modules/photoannotation/views/admin_photoannotation_tagsmaintanance.html.php diff --git a/modules/photoannotation/controllers/admin_photoannotation.php b/modules/photoannotation/controllers/admin_photoannotation.php index 347c90de..80afecdf 100644 --- a/modules/photoannotation/controllers/admin_photoannotation.php +++ b/modules/photoannotation/controllers/admin_photoannotation.php @@ -21,6 +21,70 @@ class Admin_Photoannotation_Controller extends Admin_Controller { public function index() { print $this->_get_view(); } + + public function converter() { + print $this->_get_converter_view(); + } + + public function tagsmaintanance($delete) { + print $this->_get_tagsmaintanance_view($delete); + } + + public function converthandler() { + access::verify_csrf(); + $form = $this->_get_converter_form(); + if ($form->validate()) { + //Load the source tag + $sourcetag = ORM::factory("tag", $form->sourcetag->value); + if (!$sourcetag->loaded()) { + message::error(t("The specified tag could not be found")); + url::redirect("admin/photoannotation/converter"); + } + //Load the target user + $targetuser = ORM::factory("user", $form->targetuser->value); + if (!$targetuser->loaded()) { + message::error(t("The specified user could not be found")); + url::redirect("admin/photoannotation/converter"); + } + //Load all existing tag annotations + $tag_annotations = ORM::factory("items_face")->where("tag_id", "=", $sourcetag->id)->find_all(); + + foreach ($tag_annotations as $tag_annotation) { + //Check if there are already user annotations of the target user on photo + $user_annotations = ORM::factory("items_user") + ->where("item_id", "=", $tag_annotation->item_id) + ->where("user_id", "=", $targetuser->id) + ->find_all(); + if (count($user_annotations) > 1) { + //If there are more than one existing annotations, delete all and create a new one + foreach ($user_annotations as $user_annotation) { + $user_annotation->delete(); + } + $target_annotation = ORM::factory("items_user"); + } elseif (count($user_annotations) == 1) { + //If there is only one existing annotation, load it and update it + $target_annotation = ORM::factory("items_user", $user_annotations[0]->id); + } else { + //If there are no existing annotations create one + $target_annotation = ORM::factory("items_user"); + } + //Save values from tag annotation to user annotation and save it + $target_annotation->user_id = $targetuser->id; + $target_annotation->item_id = $tag_annotation->item_id; + $target_annotation->x1 = $tag_annotation->x1; + $target_annotation->y1 = $tag_annotation->y1; + $target_annotation->x2 = $tag_annotation->x2; + $target_annotation->y2 = $tag_annotation->y2; + $target_annotation->description = $tag_annotation->description; + $target_annotation->save(); + //Delete the old annotation + $tag_annotation->delete(); + } + message::success(t("%count tag annotations (%tagname) have been converted to user annotations (%username)", array("count" => count($tag_annotations), "tagname" => $sourcetag->name, "username" => $targetuser->display_name()))); + url::redirect("admin/photoannotation/converter"); + } + print $this->_get_converter_view($form); + } public function handler() { access::verify_csrf(); @@ -47,6 +111,12 @@ class Admin_Photoannotation_Controller extends Admin_Controller { "photoannotation", "shownotes", $form->legendsettings->shownotes->value, true); module::set_var( "photoannotation", "fullname", $form->legendsettings->fullname->value, true); + module::set_var( + "photoannotation", "nonotifications", $form->notifications->nonotifications->value, true); + module::set_var( + "photoannotation", "notificationoptout", $form->notifications->notificationoptout->value, true); + module::set_var( + "photoannotation", "onuserdelete", $form->onuserdelete->onuserdelete->value); message::success(t("Your settings have been saved.")); url::redirect("admin/photoannotation"); } @@ -55,11 +125,120 @@ class Admin_Photoannotation_Controller extends Admin_Controller { private function _get_view($form=null) { $v = new Admin_View("admin.html"); + $v->page_title = t("Photo annotation"); $v->content = new View("admin_photoannotation.html"); $v->content->form = empty($form) ? $this->_get_form() : $form; return $v; } + private function _get_converter_view($form=null) { + $v = new Admin_View("admin.html"); + $v->page_title = t("Photo annotation converter"); + $v->content = new View("admin_photoannotation_converter.html"); + $v->content->form = empty($form) ? $this->_get_converter_form() : $form; + return $v; + } + + private function _get_tagsmaintanance_view($delete = false) { + $tag_orpanes_count = 0; + $user_orphanes_count = 0; + $item_orphanes_count = 0; + $tag_orpanes_deleted = 0; + $user_orphanes_deleted = 0; + $item_orphanes_deleted = 0; + //check all tag annotations + $tag_annotations = ORM::factory("items_face")->find_all(); + foreach ($tag_annotations as $tag_annotation) { + $check_tag = ORM::factory("tag")->where("id", "=", $tag_annotation->tag_id)->find(); + if (!$check_tag->loaded()) { + if ($delete) { + $tag_annotation->delete(); + $tag_orpanes_deleted++; + } else { + $tag_orpanes_count++; + } + } else { + $check_item = ORM::factory("item")->where("id", "=", $tag_annotation->item_id)->find(); + if (!$check_item->loaded()) { + if ($delete) { + $tag_annotation->delete(); + $item_orpanes_deleted++; + } else { + $item_orpanes_count++; + } + } + } + } + //check all user annotations + $user_annotations = ORM::factory("items_user")->find_all(); + foreach ($user_annotations as $user_annotation) { + $check_user = ORM::factory("user")->where("id", "=", $user_annotation->user_id)->find(); + if (!$check_user->loaded()) { + if ($delete) { + $user_annotation->delete(); + $user_orpanes_deleted++; + } else { + $user_orphanes_count++; + } + } else { + $check_item = ORM::factory("item")->where("id", "=", $user_annotation->item_id)->find(); + if (!$check_item->loaded()) { + if ($delete) { + $user_annotation->delete(); + $item_orpanes_deleted++; + } else { + $item_orpanes_count++; + } + } + } + } + + //check all user annotations + $note_annotations = ORM::factory("items_note")->find_all(); + foreach ($note_annotations as $note_annotation) { + $check_item = ORM::factory("item")->where("id", "=", $note_annotation->item_id)->find(); + if (!$check_item->loaded()) { + if ($delete) { + $note_annotation->delete(); + $item_orpanes_deleted++; + } else { + $item_orpanes_count++; + } + } + } + $v = new Admin_View("admin.html"); + $v->page_title = t("Photo annotation tags maintanance"); + $v->content = new View("admin_photoannotation_tagsmaintanance.html"); + $v->content->tag_orpanes_count = $tag_orpanes_count; + $v->content->user_orphanes_count = $user_orphanes_count; + $v->content->item_orphanes_count = $item_orphanes_count; + $v->content->tag_orpanes_deleted = $tag_orpanes_deleted; + $v->content->user_orphanes_deleted = $user_orphanes_deleted; + $v->content->item_orphanes_deleted = $item_orphanes_deleted; + $v->content->dodeletion = $delete; + return $v; + } + + private function _get_converter_form() { + //get all tags + $tags = ORM::factory("tag")->order_by("name", "ASC")->find_all(); + foreach ($tags as $tag) { + $tag_array[$tag->id] = $tag->name; + } + //get all users + $users = ORM::factory("user")->order_by("name", "ASC")->find_all(); + foreach ($users as $user) { + $user_array[$user->id] = $user->display_name(); + } + $form = new Forge("admin/photoannotation/converthandler", "", "post", array("id" => "g-admin-form")); + $form->dropdown("sourcetag")->label(t("Select tag")) + ->options($tag_array); + $form->dropdown("targetuser")->label(t("Select user")) + ->options($user_array); + $form->submit("submit")->value(t("Convert")); + return $form; + } + private function _get_form() { $form = new Forge("admin/photoannotation/handler", "", "post", array("id" => "g-admin-form")); $group = $form->group("hoverphoto")->label(t("Hovering over the photo")); @@ -89,6 +268,15 @@ class Admin_Photoannotation_Controller extends Admin_Controller { ->checked(module::get_var("photoannotation", "shownotes", false)); $group->checkbox("fullname")->label(t("Show full name of a user instead of the username on annotations (username will be dispayed for users without a full name).")) ->checked(module::get_var("photoannotation", "fullname", false)); + $group = $form->group("notifications")->label(t("Notification settings")); + $group->checkbox("nonotifications")->label(t("Disable user notifications.")) + ->checked(module::get_var("photoannotation", "nonotifications", false)); + $group->checkbox("notificationoptout")->label(t("Notify users by default (only applies to new users and user who have not saved their profile after installing this module).")) + ->checked(module::get_var("photoannotation", "notificationoptout", false)); + $group = $form->group("onuserdelete")->label(t("Auto conversion settings")); + $group->dropdown("onuserdelete")->label(t("When deleting a user do the following with all annotations associated with this user")) + ->options(array("0" => t("Delete annotation"), "1" => t("Convert to tag annotation"), "2" => t("Convert to note annotation"))) + ->selected(module::get_var("photoannotation", "onuserdelete", "0")); $form->submit("submit")->value(t("Save")); return $form; } diff --git a/modules/photoannotation/controllers/photoannotation.php b/modules/photoannotation/controllers/photoannotation.php index 3718d7bb..ab8fbf20 100644 --- a/modules/photoannotation/controllers/photoannotation.php +++ b/modules/photoannotation/controllers/photoannotation.php @@ -173,10 +173,37 @@ class photoannotation_Controller extends Controller { $item_old_user->delete(); } $item_user = ORM::factory("items_user"); - } elseif (count($item_old_users) > 0) { + } elseif (count($item_old_users) == 1) { $item_user = ORM::factory("items_user", $item_old_users[0]->id); } else { $item_user = ORM::factory("items_user"); + if (!module::get_var("photoannotation", "nonotifications", false)) { + $notification_settings = ORM::factory("photoannotation_notification")->where("user_id", "=", $user_id)->find(); + if (!$notification_settings->loaded()) { + $notify = module::get_var("photoannotation", "notificationoptout", false); + $notification_settings = ORM::factory("photoannotation_notification"); + $notification_settings->user_id = $user_id; + $notification_settings->newtag = $notify; + $notification_settings->comment = $notify; + $notification_settings->save(); + } + if ($notification_settings->newtag) { + $user_recipient = ORM::factory("user")->where("id", "=", $user_id)->find(); + if ($user_recipient->email != "") { + $recipient = $user_recipient->email; + $subject = t("Somebody has tagged a photo of you"); + $item_notify = ORM::factory("item")->where("id", "=", $item_id)->find(); + $body = t("Please visit the gallery to view the photo.", array("url" => $item_notify->resize_url(true))); + Sendmail::factory() + ->to($recipient) + ->subject($subject) + ->header("Mime-Version", "1.0") + ->header("Content-type", "text/html; charset=utf-8") + ->message($body) + ->send(); + } + } + } } $item_user->user_id = $user_id; $item_user->item_id = $item_id; @@ -223,4 +250,17 @@ class photoannotation_Controller extends Controller { $item_note->description = $description; $item_note->save(); } + + private function _send_tag_created($user_id, $item_id) { + $recipient = ORM::factory("user", $user_id); + if ($recipient->email) { + Sendmail::factory() + ->to($recipient->email) + ->subject($t("Someone has tagged a photo with you on it")) + ->header("Mime-Version", "1.0") + ->header("Content-Type", "text/html; charset=UTF-8") + ->message($text) + ->send(); + } + } } diff --git a/modules/photoannotation/helpers/photoannotation.php b/modules/photoannotation/helpers/photoannotation.php deleted file mode 100644 index 24b26404..00000000 --- a/modules/photoannotation/helpers/photoannotation.php +++ /dev/null @@ -1,91 +0,0 @@ -item_id = $item->id; - $newnote->x1 = $x1; - $newnote->y1 = $y1; - $newnote->x2 = $x2; - $newnote->y2 = $y2; - $newnote->title = $tag_title; - $newnote->description = $description; - $newnote->save(); - } catch (Exception $e) { - Kohana_Log::add("error", "Error adding note annotation.\n" . - $e->getMessage() . "\n" . $e->getTraceAsString()); - } - } elseif ( $bTag && !empty($tag_title) ) { - try { - //we are adding a tag - //first find the tag - $tag = ORM::factory("tag")->where("name", "=", $tag_title)->find(); - //tag was not found - if (!$tag->loaded()) { - $tag->name = $tag_title; - $tag->count = 0; - } - - $tag->add($item); - $tag->count++; - $tag->save(); - //check if the tag is attached to the item - // if the tag isn't attached, attach it - //check if the face is already tagged - $existingFace = ORM::factory("items_face") - ->where("tag_id", "=", $tag->id) - ->where("item_id", "=", $item->id) - ->find_all(); - - if (count($existingFace) == 0) { - // Save the new face to the database. - $newface = ORM::factory("items_face"); - $newface->tag_id = $tag->id; - $newface->item_id = $item->id; - $newface->x1 = $x1; - $newface->y1 = $y1; - $newface->x2 = $x2; - $newface->y2 = $y2; - $newface->description = $description; - $newface->save(); - } else { - // Update the coordinates of an existing face. - $updatedFace = ORM::factory("items_face", $existingFace[0]->id); - $updatedFace->x1 = $x1; - $updatedFace->y1 = $y1; - $updatedFace->x2 = $x2; - $updatedFace->y2 = $y2; - $updatedFace->description = $description; - $updatedFace->save(); - } - } catch (Exception $e) { - Kohana_Log::add("error", "Error adding note annotation.\n" . - $e->getMessage() . "\n" . $e->getTraceAsString()); - } - } else { - throw new exception("@todo MISSING_TAG_OR_DESCRIPTION"); - } - } -} -?> - diff --git a/modules/photoannotation/helpers/photoannotation_event.php b/modules/photoannotation/helpers/photoannotation_event.php index ca5c5daf..a88a9ba9 100644 --- a/modules/photoannotation/helpers/photoannotation_event.php +++ b/modules/photoannotation/helpers/photoannotation_event.php @@ -89,8 +89,70 @@ class photoannotation_event_Core { ->where("user_id", "=", $old->id) ->find_all(); if (count($existingFaces) > 0) { + $onuserdelete = module::get_var("photoannotation", "onuserdelete", "0"); + if (module::get_var("photoannotation", "fullname", false)) { + $new_tag_name = $old->display_name(); + } else { + $new_tag_name = $old->name; + } + switch ($onuserdelete) { + case "1": + //convert to tag + $tag = ORM::factory("tag")->where("name", "=", $new_tag_name)->find(); + if (!$tag->loaded()) { + $tag->name = $new_tag_name; + $tag->count = 0; + } + foreach ($existingFaces as $existingFace) { + $item = ORM::factory("item")->where("id", "=", $existingFace->item_id)->find(); + $tag->add($item); + $tag->count++; + $tag->save(); + $new_items_tag = ORM::factory("items_face"); + $new_items_tag->item_id = $existingFace->item_id; + $new_items_tag->tag_id = $tag->id; + $new_items_tag->x1 = $existingFace->x1; + $new_items_tag->y1 = $existingFace->y1; + $new_items_tag->x2 = $existingFace->x2; + $new_items_tag->y2 = $existingFace->y2; + $new_items_tag->description = $existingFace->description; + $new_items_tag->save(); + } + break; + case "2": + //convert to note + foreach ($existingFaces as $existingFace) { + $item = ORM::factory("item")->where("id", "=", $existingFace->item_id)->find(); + $new_items_tag = ORM::factory("items_note"); + $new_items_tag->item_id = $existingFace->item_id; + $new_items_tag->title = $new_tag_name; + $new_items_tag->x1 = $existingFace->x1; + $new_items_tag->y1 = $existingFace->y1; + $new_items_tag->x2 = $existingFace->x2; + $new_items_tag->y2 = $existingFace->y2; + $new_items_tag->description = $existingFace->description; + $new_items_tag->save(); + } + } db::build()->delete("items_users")->where("user_id", "=", $old->id)->execute(); } + // Delete notification settings + $notification_settings = ORM::factory("photoannotation_notification") + ->where("user_id", "=", $old->id) + ->find(); + if ($notification_settings->loaded()) { + $notification_settings->delete(); + } + } + + static function user_created($user) { + // Write notification settings + $notify = module::get_var("photoannotation", "notificationoptout", false); + $notification_settings = ORM::factory("photoannotation_notification"); + $notification_settings->user_id = $user->id; + $notification_settings->newtag = $notify; + $notification_settings->comment = $notify; + $notification_settings->save(); } static function admin_menu($menu, $theme) { @@ -102,7 +164,7 @@ class photoannotation_event_Core { } static function show_user_profile($data) { - $view = new View("dynamic.html"); + $view = new Theme_View("dynamic.html", "collection", "userprofiles"); //load thumbs $item_users = ORM::factory("items_user")->where("user_id", "=", $data->user->id)->find_all(); $children_count = count($item_users); @@ -110,7 +172,7 @@ class photoannotation_event_Core { $item_thumb = ORM::factory("item") ->viewable() ->where("type", "!=", "album") - ->where("id", ">=", $item_user->item_id) + ->where("id", "=", $item_user->item_id) ->find(); $item_thumbs[] = $item_thumb; } @@ -118,13 +180,23 @@ class photoannotation_event_Core { $page = (int) Input::instance()->get("page", "1"); $offset = ($page-1) * $page_size; $max_pages = max(ceil($children_count / $page_size), 1); - + // Make sure that the page references a valid offset if ($page < 1) { url::redirect($album->abs_url()); } else if ($page > $max_pages) { url::redirect($album->abs_url("page=$max_pages")); } + if ($page < $max_pages) { + $next_page_url = url::site("user_profile/show/". $data->user->id ."?page=". ($page + 1)); + $view->set_global("next_page_url", $next_page_url); + $view->set_global("first_page_url", url::site("user_profile/show/". $data->user->id ."?page=". $max_pages)); + } + + if ($page > 1) { + $view->set_global("previous_page_url", url::site("user_profile/show/". $data->user->id ."?page=". ($page - 1))); + $view->set_global("first_page_url", url::site("user_profile/show/". $data->user->id ."?page=1")); + } $view->set_global("page", $page); $view->set_global("max_pages", $max_pages); $view->set_global("page_size", $page_size); @@ -136,6 +208,111 @@ class photoannotation_event_Core { $data->content[] = (object)array("title" => t("Photos"), "view" => $view); } } - - + + static function user_edit_form($user, $form) { + // Allow users to modify notification settings. + if (!module::get_var("photoannotation", "nonotifications", false)) { + $notification_settings = ORM::factory("photoannotation_notification")->where("user_id", "=", $user->id)->find(); + if (!$notification_settings->loaded()) { + $notify = module::get_var("photoannotation", "notificationoptout", false); + $notification_settings = ORM::factory("photoannotation_notification"); + $notification_settings->user_id = $user->id; + $notification_settings->newtag = $notify; + $notification_settings->comment = $notify; + $notification_settings->save(); + } + $user_notification = $form->edit_user->group("edit_notification")->label("Tag notifications"); + $user_notification->checkbox("photoannotation_newtag")->label(t("Notify me when a tag is added to a photo with me")) + ->checked($notification_settings->newtag); + $user_notification->checkbox("photoannotation_comment")->label(t("Notify me if someone comments on a photo with me on it")) + ->checked($notification_settings->comment); + } + } + + static function user_edit_form_completed($user, $form) { + // Save notification settings. + if (!module::get_var("photoannotation", "nonotifications", false)) { + $notification_settings = ORM::factory("photoannotation_notification")->where("user_id", "=", $user->id)->find(); + if (!$notification_settings->loaded()) { + $notification_settings->user_id = $user->id; + } + $notification_settings->newtag = $form->edit_user->edit_notification->photoannotation_newtag->value; + $notification_settings->comment = $form->edit_user->edit_notification->photoannotation_comment->value; + $notification_settings->save(); + } + } + + static function comment_created($comment) { + //@todo: clean this up + $comment = ORM::factory("comment")->where("id", "=", "52")->find(); + if (!module::get_var("photoannotation", "nonotifications", false)) { + $item_users = ORM::factory("items_user")->where("item_id", "=", $comment->item_id)->find_all(); + if (count($item_users) > 0) { + foreach ($item_users as $item_user) { + $notification_settings = ORM::factory("photoannotation_notification")->where("user_id", "=", $item_user-user_id)->find(); + if (!$notification_settings->loaded()) { + $notify = module::get_var("photoannotation", "notificationoptout", false); + $notification_settings = ORM::factory("photoannotation_notification"); + $notification_settings->user_id = $item_user-user_id; + $notification_settings->newtag = $notify; + $notification_settings->comment = $notify; + $notification_settings->save(); + } + if ($notification_settings->newtag) { + $user_recipient = ORM::factory("user")->where("id", "=", $item_user-user_id)->find(); + if ($user_recipient->email != "") { + $recipient = $user_recipient->email; + $subject = t("Somebody has commented on a photo of you"); + $item_notify = ORM::factory("item")->where("id", "=", $comment->item_id)->find(); + $body = t("Please visit the gallery to view the photo.", array("url" => $item_notify->resize_url(true))); + Sendmail::factory() + ->to($recipient) + ->subject($subject) + ->header("Mime-Version", "1.0") + ->header("Content-type", "text/html; charset=utf-8") + ->message($body) + ->send(); + } + } + } + } + } + } + + static function comment_updated($comment) { + //@todo: clean this up + $comment = ORM::factory("comment")->where("id", "=", "52")->find(); + if (!module::get_var("photoannotation", "nonotifications", false)) { + $item_users = ORM::factory("items_user")->where("item_id", "=", $comment->item_id)->find_all(); + if (count($item_users) > 0) { + foreach ($item_users as $item_user) { + $notification_settings = ORM::factory("photoannotation_notification")->where("user_id", "=", $item_user-user_id)->find(); + if (!$notification_settings->loaded()) { + $notify = module::get_var("photoannotation", "notificationoptout", false); + $notification_settings = ORM::factory("photoannotation_notification"); + $notification_settings->user_id = $item_user-user_id; + $notification_settings->newtag = $notify; + $notification_settings->comment = $notify; + $notification_settings->save(); + } + if ($notification_settings->newtag) { + $user_recipient = ORM::factory("user")->where("id", "=", $item_user-user_id)->find(); + if ($user_recipient->email != "") { + $recipient = $user_recipient->email; + $subject = t("Somebody has updated a commented on a photo of you"); + $item_notify = ORM::factory("item")->where("id", "=", $comment->item_id)->find(); + $body = t("Please visit the gallery to view the photo.", array("url" => $item_notify->resize_url(true))); + Sendmail::factory() + ->to($recipient) + ->subject($subject) + ->header("Mime-Version", "1.0") + ->header("Content-type", "text/html; charset=utf-8") + ->message($body) + ->send(); + } + } + } + } + } + } } diff --git a/modules/photoannotation/helpers/photoannotation_installer.php b/modules/photoannotation/helpers/photoannotation_installer.php index dd7a73c9..799e1341 100644 --- a/modules/photoannotation/helpers/photoannotation_installer.php +++ b/modules/photoannotation/helpers/photoannotation_installer.php @@ -56,6 +56,14 @@ class photoannotation_installer { `description` varchar(2048) default NULL, PRIMARY KEY (`id`)) DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE IF NOT EXISTS {photoannotation_notifications} ( + `id` int(9) NOT NULL auto_increment, + `user_id` int(9) NOT NULL unique, + `newtag` int(2) default NULL, + `comment` int(2) default NULL, + PRIMARY KEY (`id`)) + DEFAULT CHARSET=utf8;"); // Set the module's version number. module::set_version("photoannotation", 3); @@ -80,6 +88,16 @@ class photoannotation_installer { DEFAULT CHARSET=utf8;"); module::set_version("photoannotation", $version = 3); } + if ($version == 3) { + $db->query("CREATE TABLE IF NOT EXISTS {photoannotation_notifications} ( + `id` int(9) NOT NULL auto_increment, + `user_id` int(9) NOT NULL unique, + `newtag` int(2) default NULL, + `comment` int(2) default NULL, + PRIMARY KEY (`id`)) + DEFAULT CHARSET=utf8;"); + module::set_version("photoannotation", $version = 4); + } } static function deactivate() { @@ -94,6 +112,7 @@ class photoannotation_installer { $db->query("DROP TABLE IF EXISTS {items_faces};"); $db->query("DROP TABLE IF EXISTS {items_notes};"); $db->query("DROP TABLE IF EXISTS {items_users};"); + $db->query("DROP TABLE IF EXISTS {photoannotation_notifications};"); module::delete("photoannotation"); } } diff --git a/modules/photoannotation/helpers/photoannotation_theme.php b/modules/photoannotation/helpers/photoannotation_theme.php index 844fab8d..dcc5daa3 100644 --- a/modules/photoannotation/helpers/photoannotation_theme.php +++ b/modules/photoannotation/helpers/photoannotation_theme.php @@ -33,6 +33,11 @@ class photoannotation_theme_Core { $v .= ".photoannotation-edit-button {\n border:1px solid ". $bordercolor ." !important;\n }"; + if ($noborder) { + $border_thickness = "2px"; + } else { + $border_thickness = "1px"; + } if (!$noborder || !$noeditablehover || !$nohover) { if (!$noborder) { $v .= ".image-annotate-area {\n @@ -45,13 +50,13 @@ class photoannotation_theme_Core { if (!$noclickablehover) { $clickablehovercolor = "#". module::get_var("photoannotation", "clickablehovercolor", "00AD00"); $v .= ".image-annotate-area-editable-hover div {\n - border-color: ". $clickablehovercolor ." !important;\n + border: ". $border_thickness ." solid ". $clickablehovercolor ." !important;\n }\n"; } if (!$nohover) { $hovercolor = "#". module::get_var("photoannotation", "hovercolor", "990000"); $v .= ".image-annotate-area-hover div {\n - border-color: ". $hovercolor ." !important;\n + border: ". $border_thickness ." solid ". $hovercolor ." !important;\n }\n"; } } diff --git a/modules/photoannotation/models/photoannotation_notification.php b/modules/photoannotation/models/photoannotation_notification.php new file mode 100644 index 00000000..6cb6912a --- /dev/null +++ b/modules/photoannotation/models/photoannotation_notification.php @@ -0,0 +1,21 @@ +
-

+

-

TagFaces module by rWatcher.
+

TagFaces module by rWatcher.
This means that notes and faces that you create in either one will be shown and are editable by the other module as well. If you added users to an annotation area though they will only be displayed with the Photo Annotation module.
- You cannot have both active at the same time.

- If you decide to show annotations below the photo but they are displayed below the comments section (or any other data), - please download and install the Module order module.") ?>

+ You cannot have both active at the same time.", array("tagfaces" => "http://codex.gallery2.org/Gallery3:Modules:tagfaces")) ?> +

Convert existing tag annotations to user annotations", array("url" => url::site("admin/photoannotation/converter/"))) ?> +
Check for orphaned annotations", array("url" => url::site("admin/photoannotation/tagsmaintanance/"))) ?>