diff options
Diffstat (limited to 'modules/photoannotation/views')
7 files changed, 283 insertions, 0 deletions
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 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="g-admin-photoannotation"> + <h1><?= t("Photo annotation administration") ?></h1> + <h3><?= t("Notes:") ?></h3> + <p><?= t("This module is partially compatible with the <a href=\"%url\">TagFaces module</a> by rWatcher.<br /> + 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.<br /> + You cannot have both active at the same time.", array("tagfaces" => "http://codex.gallery2.org/Gallery3:Modules:tagfaces")) ?> + <br /><br /><?= t("<a href=\"%url\">Convert existing tag annotations to user annotations</a>", array("url" => url::site("admin/photoannotation/converter/"))) ?> + <br /><?= t("<a href=\"%url\">Check for orphaned annotations</a>", array("url" => url::site("admin/photoannotation/tagsmaintanance/"))) ?></p> + <?= $form ?> +</div> +<script type="text/javascript"> + $("input[name='bordercolor'], input[name='clickablehovercolor'], input[name='hovercolor']").ColorPicker({ + onSubmit: function(hsb, hex, rgb, el) { + $(el).val(hex); + $(el).ColorPickerHide(); + }, + onBeforeShow: function () { + $(this).ColorPickerSetColor(this.value); + } + }) + .bind('keyup', function(){ + $(this).ColorPickerSetColor(this.value); + }); + <? if (!module::is_active("comment")): ?> + $(document).ready(function(){ + $("input[name='newcommentsubject'], input[name='updatedcommentsubject'], textarea[name='newcommentbody'], textarea[name='updatedcommentbody']").attr("disabled", true); + }); + <? endif ?> +</script> 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 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="g-admin-photoannotation"> + <h1><?= t("Photo annotation converter") ?></h1> + <h3><?= t("Notes:") ?></h3> + <p><?= t("Here you can convert existing annotations with tags associated with them to annotations with users.") ?><br /><br /> + <?= t("Please be aware that if a photo has already the same user associated with an annotation this annotation will be updated instead of a new one being created. If a photo has more than one annotation associated with the specified tag only one area will be converted and all other annotations with this tag will be removed.") ?> + <br /><?= t("<a href=\"%url\">Back to photo annotation settings</a>", array("url" => url::site("admin/photoannotation/"))) ?> + <br /><?= t("<a href=\"%url\">Check for orphaned annotations</a>", array("url" => url::site("admin/photoannotation/tagsmaintanance/"))) ?></p> + <?= $form ?> +</div> 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 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="g-admin-photoannotation"> + <h1><?= t("Photo annotation tags maintanance") ?></h1> + <h3><?= t("Notes:") ?></h3> + <p><?= t("When deleting a tag this might leave orphaned tag annotations.") ?> + <br /><br /><?= t("<a href=\"%url\">Back to photo annotation settings</a>", array("url" => url::site("admin/photoannotation/"))) ?> + <br /><?= t("<a href=\"%url\">Convert existing tag annotations to user annotations</a>", array("url" => url::site("admin/photoannotation/converter/"))) ?></p> + <? if ($dodeletion): ?> + <h3><?= t("Maintanance results") ?></h3> + <p><?= t("%user_orphanes_deleted annotations without a user have been deleted.", array("user_orphanes_deleted" => $user_orphanes_deleted)) ?> + <br><?= t("%tag_orpanes_deleted annotations without a tag have been deleted.", array("tag_orpanes_deleted" => $tag_orpanes_deleted)) ?> + <br><?= t("%item_orphanes_deleted annotations without a photo have been deleted.", array("item_orphanes_deleted" => $item_orphanes_deleted)) ?> + </p> + <?= t("<a href=\"%url\" class=\"submit ui-state-default ui-corner-all\" style=\"padding: 5px;\">Back</a>", array("url" => url::site("admin/photoannotation/"))) ?> + <? else: ?> + <h3><?= t("Orphaned annotations") ?></h3> + <p><?= t("%user_orphanes_count annotations without a user found.", array("user_orphanes_count" => $user_orphanes_count)) ?> + <br><?= t("%tag_orpanes_count annotations without a tag found.", array("tag_orpanes_count" => $tag_orpanes_count)) ?> + <br><?= t("%item_orphanes_count annotations without a photo found.", array("item_orphanes_count" => $item_orphanes_count)) ?> + </p> + <? if ($user_orphanes_count == 0 && $tag_orpanes_count == 0 && $item_orphanes_count == 0): ?> + <?= t("<a href=\"%url\" class=\"submit ui-state-default ui-corner-all\" style=\"padding: 5px;\">Back</a>", array("url" => url::site("admin/photoannotation/"))) ?> + <? else: ?> + <?= t("<a href=\"%url\" class=\"submit ui-state-default ui-corner-all\" style=\"padding: 5px;\">Remove all</a>", array("url" => url::site("admin/photoannotation/tagsmaintanance/true"))) ?> + <? endif ?> + <? endif ?> +</div> 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 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + $("#g-user-cloud-form").ready(function() { + var url = $("#g-user-cloud").attr("ref") + "/autocomplete"; + $("#g-user-cloud-form input:text").autocomplete( + url, { + max: 30, + multiple: false, + cacheLength: 1 + } + ); + }); +</script> +<div id="g-user-cloud" ref="<?= url::site("photoannotation") ?>"> + <?= $cloud ?> +</div> +<?= $form ?>
\ 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 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<ul> + <? foreach ($users as $user): ?> + <li class="size<?=(int)(($user->size / $max_count) * 7) ?>"> + <span><?= $user->size ?> photos are tagged with </span> + <a href="<?= $user->url ?>"><?= html::clean($user->name) ?></a> + </li> + <? endforeach ?> +</ul> 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 @@ +<?php defined("SYSPATH") or die("No direct script access."); + // Check and see if the current photo has any faces or notes associated with it. + $existingUsers = ORM::factory("items_user") + ->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 .= "<span id=\"photoannotation-legend-user-". $oneUser->id . "\"><a href=\"". user_profile::url($oneUser->user_id) ."\">". html::clean($user_text) ."</a></span>, "; + } + $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 ."<br />"; + } + foreach ($existingFaces as $oneFace) { + $oneTag = ORM::factory("tag", $oneFace->tag_id); + if ($oneTag->loaded()) { + if ($showfaces) { + $legend_faces .= "<span id=\"photoannotation-legend-face-". $oneFace->id . "\"><a href=\"". $oneTag->url() ."\">". html::clean($oneTag->name) ."</a></span>, "; + } + $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 ."<br />"; + } + foreach ($existingNotes as $oneNote) { + if ($shownotes) { + $legend_notes .= "<span id=\"photoannotation-legend-note-". $oneNote->id . "\">". html::clean($oneNote->title) ."</span>, "; + } + $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 ."<br />"; + } + } + $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") ."' ],"; +?> +<script type="text/javascript"> + $(document).ready(function() { + $("<?= $css_item_id ?>").annotateImage({ + <? if ((access::can("view", $item)) && (access::can("edit", $item))): ?> + editable: true, + <? else: ?> + editable: false, + <? endif ?> + saveUrl: '<?= url::site("photoannotation/save/". $item->id) ?>', + deleteUrl: '<?= url::site("photoannotation/delete/". $item->id) ?>', + tags: '<?= url::site("tags/autocomplete") ?>', + <?= $labels_arraystring ?> + <?= $jscode ?> + users: '<?= url::site("photoannotation/autocomplete") ?>', + rtlsupport: '<?= $rtl_support ?>', + useAjax: false, + cssaclass: '<?= $css_a_class ?>', + csrf: '<?= $csrf ?>' + }); + }); + </script> + <? if ($legend_display != ""): ?> + <?= "<div style=\"text-align: center\">". $legend_display ."</div>" ?> + <? endif ?> 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 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + $("#g-user-search-form").ready(function() { + var url = $("#g-user-search-results").attr("ref") + "/autocomplete"; + $("#g-user-search-form input:text").autocomplete( + url, { + max: 30, + multiple: false, + cacheLength: 1 + } + ); + }); +</script> +<div id="g-user-search-results" ref="<?= url::site("photoannotation") ?>"> + <h1><?= t("Search results") ?></h1> + <?= $search_form ?> + <? if (count($users)): ?> + <div class="g-message photoannotation-user-search"> + <?= t("%count people found for <b>%term</b>", array("count" => $count, "term" => $q)) ?> + </div> + <? foreach ($users as $user): ?> + <? $profile_link = "<a href=\"". user_profile::url($user->id) ."\">" ?> + <div class="g-block"> + <h2><img src="<?= $user->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>" + alt="<?= html::clean_attribute($user->display_name()) ?>" + class="g-avatar" width="40" height="40" /> + <?= $profile_link . $user->name ?></a></h2> + <div> + <table class="g-message"> + <tbody> + <tr> + <th style="width: 20%"><?= t("Full name") ?></th> + <td><?= $user->display_name() ?></td> + </tr> + <tr> + <th style="width: 20%"><?= t("Tagged photos") ?></th> + <td colspan="2"><?= photoannotation::annotation_count($user->id) ?></td> + </tr> + <? if (module::is_active("comment")): ?> + <tr> + <th style="width: 20%"><?= t("Comments") ?></th> + <td colspan="2"><?= photoannotation::comment_count($user->id) ?></td> + </tr> + <? endif ?> + </tbody></table> + </div> + </div> + <? endforeach ?> + <?= $paginator ?> + <? else: ?> + <div class="photoannotation-user-search"> + <?= t("No users found for <b>%term</b>", array("term" => $q)) ?> + </div> + <? endif; ?> +</div> |