aboutsummaryrefslogtreecommitdiff
path: root/views/default/js/photos
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2012-01-02 12:45:16 -0500
committercash <cash.costello@gmail.com>2012-01-02 12:45:16 -0500
commit20ab73de5248b3418bbbad27850e3d3e093c473c (patch)
treecf15a58ad857fbaa4f9b2521c5a7d17ed619f303 /views/default/js/photos
parent86535f77d6b32a2c8a403609ded299a76c73bba0 (diff)
downloadelgg-20ab73de5248b3418bbbad27850e3d3e093c473c.tar.gz
elgg-20ab73de5248b3418bbbad27850e3d3e093c473c.tar.bz2
added photo tagging - but not displaying or deleting tags yet
Diffstat (limited to 'views/default/js/photos')
-rw-r--r--views/default/js/photos/tagging.php73
1 files changed, 73 insertions, 0 deletions
diff --git a/views/default/js/photos/tagging.php b/views/default/js/photos/tagging.php
new file mode 100644
index 000000000..f831200e7
--- /dev/null
+++ b/views/default/js/photos/tagging.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * Photo tagging JavaScript
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+?>
+
+elgg.provide('elgg.tidypics.tagging');
+
+elgg.tidypics.tagging.init = function() {
+ $('[rel=photo-tagging]').click(elgg.tidypics.tagging.start);
+
+ $('#tidypics-tagging-quit').click(elgg.tidypics.tagging.stop);
+}
+
+/**
+ * Start a tagging session
+ */
+elgg.tidypics.tagging.start = function(event) {
+
+ $('.tidypics-photo').imgAreaSelect({
+ disable : false,
+ hide : false,
+ classPrefix : 'tidypics-tagging',
+ onSelectEnd : elgg.tidypics.tagging.startSelect,
+ onSelectStart: function() {
+ $('#tidypics-tagging-select').hide();
+ }
+ });
+
+ $('.tidypics-photo').css({"cursor" : "crosshair"});
+
+ $('#tidypics-tagging-help').toggle();
+
+ event.preventDefault();
+}
+
+/**
+ * Stop tagging
+ *
+ * A tagging session could be completed or the user could have quit.
+ */
+elgg.tidypics.tagging.stop = function(event) {
+ $('#tidypics-tagging-help').toggle();
+ $('#tidypics-tagging-select').hide();
+
+ $('.tidypics-photo').imgAreaSelect({hide: true, disable: true});
+ $('.tidypics-photo').css({"cursor" : "pointer"});
+
+ event.preventDefault();
+}
+
+/**
+ * Start the selection stage of tagging
+ */
+elgg.tidypics.tagging.startSelect = function(img, selection) {
+
+ var coords = '"x1":"' + selection.x1 + '",';
+ coords += '"y1":"' + selection.y1 + '",';
+ coords += '"width":"' + selection.width + '",';
+ coords += '"height":"' + selection.height + '"';
+ $("input[name=coordinates]").val(coords);
+
+ $('#tidypics-tagging-select').show().css({
+ 'top' : selection.y2 + 10,
+ 'left' : selection.x2
+ });
+}
+
+elgg.register_hook_handler('init', 'system', elgg.tidypics.tagging.init);