From 5b8a7460d026d91f5c2411673f3b02be2b0e724d Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Thu, 18 Jun 2009 01:27:35 +0000 Subject: cleaned up the tagging code --- views/default/object/image.php | 9 +++++---- views/default/tidypics/tagging.php | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'views') diff --git a/views/default/object/image.php b/views/default/object/image.php index b7e19d8c0..d86f3ca46 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -20,7 +20,6 @@ ///////////////////////////////////////////////////// // get photo tags from database -$photo_tag_links = array(); $photo_tags_json = "\"\""; $photo_tags = get_annotations($file_guid,'object','image','phototag'); @@ -31,12 +30,15 @@ if ($photo_tags) { $phototag_text = $photo_tag->value; + $phototag_link = $vars['url'] . "word"; if ($photo_tag->type === 'user') { $user = get_entity($photo_tag->value); if ($user) $phototag_text = $user->name; else $phototag_text = "unknown user"; + + $phototag_link = $vars['url'] . "user"; } // hack to handle format of Pedro Prez's tags - ugh @@ -46,8 +48,8 @@ if ($photo_tags) { } else $photo_tags_json .= '{' . $photo_tag->coords . ',"text":"' . $phototag_text . '","id":"' . $p->id . '"},'; - $photo_tag_links[] = array($p->id, $phototag_text); // gave up on associative array for now - $photo_tag_texts[$p->id] = $phototag_text; + // prepare variable arrays for tagging view + $photo_tag_links[$p->id] = array($phototag_text, $phototag_link); } $photo_tags_json = rtrim($photo_tags_json,','); $photo_tags_json .= ']'; @@ -203,7 +205,6 @@ if ($photo_tags) { if (get_plugin_setting('tagging', 'tidypics') != "disabled") { echo elgg_view('tidypics/tagging', array( 'photo_tags' => $photo_tags, 'links' => $photo_tag_links, - 'text' => $photo_tag_texts, 'photo_tags_json' => $photo_tags_json, 'file_guid' => $file_guid, 'viewer' => $viewer, diff --git a/views/default/tidypics/tagging.php b/views/default/tidypics/tagging.php index fdf40b3a5..fcb0b8d4e 100644 --- a/views/default/tidypics/tagging.php +++ b/views/default/tidypics/tagging.php @@ -5,7 +5,7 @@ $file_guid = $vars['file_guid']; $viewer = $vars['viewer']; $owner = $vars['owner']; - $tag_texts = $vars['text']; + if ($photo_tags) { ?> @@ -13,8 +13,8 @@

@@ -59,9 +59,9 @@ if ($photo_tags) { echo elgg_echo('tidypics:deltag_title') . '
'; $content = ""; - foreach ($tag_texts as $id => $text) { + foreach ($links as $id => $text) { $name = "tags[{$id}]"; - $content .= elgg_view("input/checkboxes", array('options' => array($text => $text), 'internalname' => $name, 'value' => '' )); + $content .= elgg_view("input/checkboxes", array('options' => array($text[0] => $text[0]), 'internalname' => $name, 'value' => '' )); } $content .= "
"; -- cgit v1.2.3