]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
cleaned up the tagging code
authorCash Costello <cash.costello@gmail.com>
Thu, 18 Jun 2009 01:27:35 +0000 (01:27 +0000)
committerCash Costello <cash.costello@gmail.com>
Thu, 18 Jun 2009 01:27:35 +0000 (01:27 +0000)
views/default/object/image.php
views/default/tidypics/tagging.php

index b7e19d8c0056454f95943e61e47975da4576e183..d86f3ca462c5c97d88f55ae31d1988635c5a5262 100644 (file)
@@ -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,
index fdf40b3a5b59e38f9098eb7fdbfbbab17d0f15d2..fcb0b8d4e291c0e0138a091e3bc1edc651cbd04e 100644 (file)
@@ -5,7 +5,7 @@
        $file_guid = $vars['file_guid'];\r
        $viewer = $vars['viewer'];\r
        $owner = $vars['owner'];\r
-       $tag_texts = $vars['text'];\r
+\r
        \r
        if ($photo_tags) { \r
 ?>\r
@@ -13,8 +13,8 @@
        <h3><?php echo elgg_echo('tidypics:inthisphoto') ?></h3>\r
        <ul>\r
 <?php\r
-               foreach ($links as $tag_link) {\r
-                       echo "<li><a class='phototag-links' id='taglink{$tag_link[0]}' href='#'>{$tag_link[1]}</a></li>";\r
+               foreach ($links as $id=>$link) {\r
+                       echo "<li><a class='phototag-links' id='taglink{$id}' href='{$link[1]}'>{$link[0]}</a></li>";\r
                }\r
 ?>\r
        </ul>\r
@@ -59,9 +59,9 @@
        if ($photo_tags) {\r
                echo elgg_echo('tidypics:deltag_title') . '<br />';\r
                $content = "<input type='hidden' name='image_guid' value='{$file_guid}' />";\r
-               foreach ($tag_texts as $id => $text) {\r
+               foreach ($links as $id => $text) {\r
                        $name = "tags[{$id}]";\r
-                       $content .= elgg_view("input/checkboxes", array('options' => array($text => $text), 'internalname' => $name, 'value' => '' ));\r
+                       $content .= elgg_view("input/checkboxes", array('options' => array($text[0] => $text[0]), 'internalname' => $name, 'value' => '' ));\r
                }\r
                $content .= "<fieldset><button class='submit_button' type='submit'>" . elgg_echo('tidypics:actiondelete') . "</button></fieldset>";\r
 \r