From 4ac3be445ebb041a503bbd2999f5d08dbc9a8578 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sat, 23 Jul 2011 17:00:38 +0000 Subject: Added a new module for annotating photos. --- .../views/admin_photoannotation.html.php | 30 +++++ .../views/admin_photoannotation_converter.html.php | 10 ++ .../admin_photoannotation_tagsmaintanance.html.php | 27 +++++ .../views/photoannotation_block.html.php | 17 +++ .../views/photoannotation_cloud.html.php | 9 ++ .../views/photoannotation_highlight_block.html.php | 135 +++++++++++++++++++++ .../views/photoannotation_user_search.html.php | 55 +++++++++ 7 files changed, 283 insertions(+) create mode 100644 modules/photoannotation/views/admin_photoannotation.html.php create mode 100644 modules/photoannotation/views/admin_photoannotation_converter.html.php create mode 100644 modules/photoannotation/views/admin_photoannotation_tagsmaintanance.html.php create mode 100644 modules/photoannotation/views/photoannotation_block.html.php create mode 100644 modules/photoannotation/views/photoannotation_cloud.html.php create mode 100644 modules/photoannotation/views/photoannotation_highlight_block.html.php create mode 100644 modules/photoannotation/views/photoannotation_user_search.html.php (limited to 'modules/photoannotation/views') diff --git a/modules/photoannotation/views/admin_photoannotation.html.php b/modules/photoannotation/views/admin_photoannotation.html.php new file mode 100644 index 00000000..8c059194 --- /dev/null +++ b/modules/photoannotation/views/admin_photoannotation.html.php @@ -0,0 +1,30 @@ + +
+

+

+

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.", 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/"))) ?>

+ +
+ diff --git a/modules/photoannotation/views/admin_photoannotation_converter.html.php b/modules/photoannotation/views/admin_photoannotation_converter.html.php new file mode 100644 index 00000000..4b8dfa1d --- /dev/null +++ b/modules/photoannotation/views/admin_photoannotation_converter.html.php @@ -0,0 +1,10 @@ + +
+

+

+



+ +
Back to photo annotation settings", array("url" => url::site("admin/photoannotation/"))) ?> +
Check for orphaned annotations", array("url" => url::site("admin/photoannotation/tagsmaintanance/"))) ?>

+ +
diff --git a/modules/photoannotation/views/admin_photoannotation_tagsmaintanance.html.php b/modules/photoannotation/views/admin_photoannotation_tagsmaintanance.html.php new file mode 100644 index 00000000..9e373780 --- /dev/null +++ b/modules/photoannotation/views/admin_photoannotation_tagsmaintanance.html.php @@ -0,0 +1,27 @@ + +
+

+

+

+

Back to photo annotation settings", array("url" => url::site("admin/photoannotation/"))) ?> +
Convert existing tag annotations to user annotations", array("url" => url::site("admin/photoannotation/converter/"))) ?>

+ +

+

$user_orphanes_deleted)) ?> +
$tag_orpanes_deleted)) ?> +
$item_orphanes_deleted)) ?> +

+ Back", array("url" => url::site("admin/photoannotation/"))) ?> + +

+

$user_orphanes_count)) ?> +
$tag_orpanes_count)) ?> +
$item_orphanes_count)) ?> +

+ + Back", array("url" => url::site("admin/photoannotation/"))) ?> + + Remove all", array("url" => url::site("admin/photoannotation/tagsmaintanance/true"))) ?> + + +
diff --git a/modules/photoannotation/views/photoannotation_block.html.php b/modules/photoannotation/views/photoannotation_block.html.php new file mode 100644 index 00000000..8861699a --- /dev/null +++ b/modules/photoannotation/views/photoannotation_block.html.php @@ -0,0 +1,17 @@ + + +
"> + +
+ \ No newline at end of file diff --git a/modules/photoannotation/views/photoannotation_cloud.html.php b/modules/photoannotation/views/photoannotation_cloud.html.php new file mode 100644 index 00000000..6f47b272 --- /dev/null +++ b/modules/photoannotation/views/photoannotation_cloud.html.php @@ -0,0 +1,9 @@ + + diff --git a/modules/photoannotation/views/photoannotation_highlight_block.html.php b/modules/photoannotation/views/photoannotation_highlight_block.html.php new file mode 100644 index 00000000..814bc600 --- /dev/null +++ b/modules/photoannotation/views/photoannotation_highlight_block.html.php @@ -0,0 +1,135 @@ +where("item_id", "=", $item->id) + ->find_all(); + $existingFaces = ORM::factory("items_face") + ->where("item_id", "=", $item->id) + ->find_all(); + $existingNotes = ORM::factory("items_note") + ->where("item_id", "=", $item->id) + ->find_all(); + $fullname = module::get_var("photoannotation", "fullname", false); + $showusers = module::get_var("photoannotation", "showusers", false); + $showfaces = module::get_var("photoannotation", "showfaces", false); + $shownotes = module::get_var("photoannotation", "shownotes", false); + if (locales::is_rtl()) { + $rtl_support = "image-annotate-rtl"; + } else { + $rtl_support = ""; + } + $tags_arraystring = ""; + $jscode = ""; + $legend_faces = ""; + $legend_notes = ""; + $legend_users = ""; + if (module::get_var("gallery", "active_site_theme") == "greydragon") { + $css_item_id = "#g-photo-id-". $item->id; + $css_a_class = ".g-sb-preview"; + } else { + $css_item_id = "#g-item-id-". $item->id; + $css_a_class = ".g-fullsize-link"; + } + // If it does, then insert some javascript and display an image map + // to show where the faces are at. + if ((count($existingFaces) > 0) || (count($existingNotes) > 0) || (count($existingUsers) > 0)) { + $jscode = "notes: [ "; + foreach ($existingUsers as $oneUser) { + $oneTag = ORM::factory("user", $oneUser->user_id); + if ($oneTag->loaded()) { + if ($fullname) { + $user_text = $oneTag->display_name(); + } else { + $user_text = $oneTag->name; + } + if ($showusers) { + $legend_users .= "id . "\">user_id) ."\">". html::clean($user_text) .", "; + } + $jscode .= "{ \"top\": ". $oneUser->y1 .",\n"; + $jscode .= "\"left\": ". $oneUser->x1 .",\n"; + $jscode .= "\"width\": ". ($oneUser->x2 - $oneUser->x1) .",\n"; + $jscode .= "\"height\": ". ($oneUser->y2 - $oneUser->y1) .",\n"; + $jscode .= "\"text\": \"". html::clean($user_text) ."\",\n"; + $jscode .= "\"internaltext\": \"". $oneTag->display_name() ." (". $oneTag->name .")\",\n"; + $jscode .= "\"description\": \"". html::clean($oneUser->description) ."\",\n"; + $jscode .= "\"noteid\": ". $oneUser->id .",\n"; + $jscode .= "\"notetype\": \"user\",\n"; + $jscode .= "\"editable\": true,\n"; + $jscode .= "\"url\": \"". user_profile::url($oneUser->user_id) ."\" },\n"; + } + } + if ($legend_users != "") { + $legend_users = trim($legend_users, ", "); + $legend_users = t("People on this photo: ") . $legend_users ."
"; + } + foreach ($existingFaces as $oneFace) { + $oneTag = ORM::factory("tag", $oneFace->tag_id); + if ($oneTag->loaded()) { + if ($showfaces) { + $legend_faces .= "id . "\">url() ."\">". html::clean($oneTag->name) .", "; + } + $jscode .= "{ \"top\": ". $oneFace->y1 .",\n"; + $jscode .= "\"left\": ". $oneFace->x1 .",\n"; + $jscode .= "\"width\": ". ($oneFace->x2 - $oneFace->x1) .",\n"; + $jscode .= "\"height\": ". ($oneFace->y2 - $oneFace->y1) .",\n"; + $jscode .= "\"text\": \"". html::clean($oneTag->name) ."\",\n"; + $jscode .= "\"description\": \"". html::clean($oneFace->description) ."\",\n"; + $jscode .= "\"noteid\": ". $oneFace->id .",\n"; + $jscode .= "\"notetype\": \"face\",\n"; + $jscode .= "\"editable\": true,\n"; + $jscode .= "\"url\": \"". $oneTag->url() ."\" },\n"; + } + } + if ($legend_faces != "") { + $legend_faces = trim($legend_faces, ", "); + $legend_faces = t("Faces on this photo: ") . $legend_faces ."
"; + } + foreach ($existingNotes as $oneNote) { + if ($shownotes) { + $legend_notes .= "id . "\">". html::clean($oneNote->title) .", "; + } + $jscode .= "{ \"top\": ". $oneNote->y1 .",\n"; + $jscode .= "\"left\": ". $oneNote->x1 .",\n"; + $jscode .= "\"width\": ". ($oneNote->x2 - $oneNote->x1) .",\n"; + $jscode .= "\"height\": ". ($oneNote->y2 - $oneNote->y1) .",\n"; + $jscode .= "\"text\": \"". html::clean($oneNote->title) ."\",\n"; + $jscode .= "\"description\": \"". html::clean($oneNote->description) ."\",\n"; + $jscode .= "\"noteid\": ". $oneNote->id .",\n"; + $jscode .= "\"notetype\": \"note\",\n"; + $jscode .= "\"editable\": false,\n"; + $jscode .= "\"url\": \"\" },\n"; + } + $jscode = trim($jscode, ",\n"); + $jscode .= " ],"; + if ($legend_notes != "") { + $legend_notes = trim($legend_notes, ", "); + $legend_notes = t("Notes on this photo: ") . $legend_notes ."
"; + } + } + $legend_display = $legend_users . $legend_faces . $legend_notes; + $labels_arraystring = "labels: [ '". t("Tag:") ."','". t("Note Title:") ."','". t("Description (optional)") ."','". t("Are you sure you want to delete this annotation?") ."','". t("or") ."','". t("Yes") ."','". t("No") ."','". t("Confirm deletion") ."','". t("Save") ."','". t("Cancel") ."','". t("Person:") ."','". t("No user selected") ."','". t("Select one of the following") ."' ],"; +?> + + + ". $legend_display ."" ?> + diff --git a/modules/photoannotation/views/photoannotation_user_search.html.php b/modules/photoannotation/views/photoannotation_user_search.html.php new file mode 100644 index 00000000..2182a324 --- /dev/null +++ b/modules/photoannotation/views/photoannotation_user_search.html.php @@ -0,0 +1,55 @@ + + +
"> +

+ + + + + id) ."\">" ?> +
+

" + alt="display_name()) ?>" + class="g-avatar" width="40" height="40" /> + name ?>

+
+ + + + + + + + + + + + + + + + +
display_name() ?>
id) ?>
id) ?>
+
+
+ + + + + +
-- cgit v1.2.3