diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-05-17 19:20:18 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-05-17 19:20:18 +0000 |
commit | d253222f742b74b8fd232fa39c81c6f39e9d6b9a (patch) | |
tree | 5aad00a856ad1ed15e6ced12eb5b3028fcf9a998 | |
parent | 82aa80bd54908ec2934f45d1f270de568adc1c97 (diff) | |
download | elgg-d253222f742b74b8fd232fa39c81c6f39e9d6b9a.tar.gz elgg-d253222f742b74b8fd232fa39c81c6f39e9d6b9a.tar.bz2 |
moved tagging from image.php to a view - make sure to refresh view cache when updating to this version
-rw-r--r-- | views/default/js/tagging.php (renamed from views/default/js/tidypics.php) | 0 | ||||
-rw-r--r-- | views/default/object/image.php | 80 | ||||
-rw-r--r-- | views/default/tidypics/tagging.php | 57 |
3 files changed, 80 insertions, 57 deletions
diff --git a/views/default/js/tidypics.php b/views/default/js/tagging.php index 323c2bf57..323c2bf57 100644 --- a/views/default/js/tidypics.php +++ b/views/default/js/tagging.php diff --git a/views/default/object/image.php b/views/default/object/image.php index aceac958b..0da55f795 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -16,7 +16,8 @@ $mime = $file->mimetype; -// photo tags +///////////////////////////////////////////////////// +// get photo tags from database $photo_tag_links = array(); $photo_tags_json = "\"\""; $photo_tags = get_annotations($file_guid,'object','image','phototag'); @@ -49,7 +50,13 @@ if ($photo_tags) { $photo_tags_json .= ']'; } - if (get_context() == "search") { //if this is the search view + +///////////////////////////////////////////////////// +// +// search view of an image +// +///////////////////////////////////////////////////// + if (get_context() == "search") { if (get_input('search_viewtype') == "gallery") { ?> @@ -72,9 +79,12 @@ if ($photo_tags) { } } else { +//////////////////////////////////////////////// +// +// simple gallery view - when is this called? +// +//////////////////////////////////////////////// if (!$vars['full']) { - -//simple gallery view ?> <div class="tidypics_album_images"> <a href="<?php echo $file->getURL();?>"><img src="<?php echo $vars['url'];?>mod/tidypics/thumbnail.php?file_guid=<?php echo $file_guid;?>&size=small" border="0" alt="thumbnail"/></a> @@ -108,8 +118,8 @@ if ($photo_tags) { if($view->owner_guid == $the_viewer && $the_viewer != 0) $my_views++; } + // Build back and next links - $back = ''; $next = ''; @@ -150,7 +160,7 @@ if ($photo_tags) { <?php echo autop($desc); ?> </div> <div id="tidypics_image_nav"> - <?php echo $back . " " . $next; ?> + <?php echo $back . " " . $next; ?> </div> <div id="tidypics_image_wrapper"> <?php echo '<img id="tidypics_image"' . ' src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $file_guid . '&size=large" alt="' . $title . '"/>'; ?> @@ -167,18 +177,13 @@ if ($photo_tags) { ?> </ul> </div> -<?php if ($photo_tags) { ?> - <div id="tidypics_phototags_list"> - <h3><?php echo elgg_echo('tidypics:inthisphoto') ?></h3> - <ul> -<?php - foreach ($photo_tag_links as $tag_link) { - echo "<li><a class='phototag-links' id='taglink{$tag_link[0]}' href='#'>{$tag_link[1]}</a></li>"; - } +<?php + echo elgg_view('tidypics/tagging', array( 'photo_tags' => $photo_tags, + 'links' => $photo_tag_links, + 'photo_tags_json' => $photo_tags_json, + 'file_guid' => $file_guid, ) ); + ?> - </ul> - </div> -<?php } ?> <div id="tidypics_info"> <?php if (!is_null($tags)) { ?> @@ -198,47 +203,8 @@ if ($photo_tags) { echo elgg_view_comments($file); echo '</div>'; // content wrapper -?> -<div id='tagging_instructions'> - <div id='tag_instruct_text'><?php echo elgg_echo('tidypics:taginstruct'); ?></div> - <div id='tag_instruct_button_div'><button class='submit_button' id='tag_instruct_button' onclick='stopTagging()'><?php echo elgg_echo('tidypics:finish_tagging'); ?></button></div> -</div> - -<div id="tag_menu"> -<?php - - $viewer = get_loggedin_user(); - if($viewer) { - $friends = get_entities_from_relationship('friend', $viewer->getGUID(), false, 'user', '', 0); - - $content = "<input type='hidden' name='image_guid' value='{$file_guid}' />"; - $content .= "<input type='hidden' name='coordinates' id='coordinates' value='' />"; - $content .= "<input type='hidden' name='user_id' id='user_id' value='' />"; - $content .= "<input type='hidden' name='word' id='word' value='' />"; - - $content .= "<ul id='phototagging-menu'>"; - $content .= "<li><a href='javascript:void(0)' onClick='selectUser({$viewer->getGUID()},\"{$viewer->name}\")'> {$viewer->name} (" . elgg_echo('me') . ")</a></li>"; - - if ($friends) { - foreach($friends as $friend) { - $content .= "<li><a href='javascript:void(0)' onClick='selectUser({$friend->getGUID()}, \"{$friend->name}\")'>{$friend->name}</a></li>"; - } - } - } - $content .= "</ul>"; - - $content .= "<fieldset><button class='submit_button' type='submit'>" . elgg_echo('tidypics:actiontag') . "</button></fieldset>"; - - echo elgg_view('input/form', array('internalid' => 'quicksearch', 'internalname' => 'form-phototagging', 'class' => 'quicksearch', 'action' => "{$vars['url']}action/tidypics/addtag", 'body' => $content)); - -?> -</div> - -<?php - - echo elgg_view('js/tidypics', array('photo_tags_json' => $photo_tags_json,) ); - } // // end of individual image display + } // end of individual image display } diff --git a/views/default/tidypics/tagging.php b/views/default/tidypics/tagging.php new file mode 100644 index 000000000..a97285016 --- /dev/null +++ b/views/default/tidypics/tagging.php @@ -0,0 +1,57 @@ +<?php
+ $photo_tags = $vars['photo_tags'];
+ $links = $vars['links'];
+ $photo_tags_json = $vars['photo_tags_json'];
+ $file_guid = $vars['file_guid'];
+
+ if ($photo_tags) {
+?>
+<div id="tidypics_phototags_list">
+ <h3><?php echo elgg_echo('tidypics:inthisphoto') ?></h3>
+ <ul>
+<?php
+ foreach ($links as $tag_link) {
+ echo "<li><a class='phototag-links' id='taglink{$tag_link[0]}' href='#'>{$tag_link[1]}</a></li>";
+ }
+?>
+ </ul>
+</div>
+<?php
+ }
+?>
+<div id='tagging_instructions'>
+ <div id='tag_instruct_text'><?php echo elgg_echo('tidypics:taginstruct'); ?></div>
+ <div id='tag_instruct_button_div'><button class='submit_button' id='tag_instruct_button' onclick='stopTagging()'><?php echo elgg_echo('tidypics:finish_tagging'); ?></button></div>
+</div>
+<div id="tag_menu">
+<?php
+
+ $viewer = get_loggedin_user();
+ if($viewer) {
+ $friends = get_entities_from_relationship('friend', $viewer->getGUID(), false, 'user', '', 0);
+
+ $content = "<input type='hidden' name='image_guid' value='{$file_guid}' />";
+ $content .= "<input type='hidden' name='coordinates' id='coordinates' value='' />";
+ $content .= "<input type='hidden' name='user_id' id='user_id' value='' />";
+ $content .= "<input type='hidden' name='word' id='word' value='' />";
+
+ $content .= "<ul id='phototagging-menu'>";
+ $content .= "<li><a href='javascript:void(0)' onClick='selectUser({$viewer->getGUID()},\"{$viewer->name}\")'> {$viewer->name} (" . elgg_echo('me') . ")</a></li>";
+
+ if ($friends) {
+ foreach($friends as $friend) {
+ $content .= "<li><a href='javascript:void(0)' onClick='selectUser({$friend->getGUID()}, \"{$friend->name}\")'>{$friend->name}</a></li>";
+ }
+ }
+ }
+ $content .= "</ul>";
+
+ $content .= "<fieldset><button class='submit_button' type='submit'>" . elgg_echo('tidypics:actiontag') . "</button></fieldset>";
+
+ echo elgg_view('input/form', array('internalid' => 'quicksearch', 'internalname' => 'form-phototagging', 'class' => 'quicksearch', 'action' => "{$vars['url']}action/tidypics/addtag", 'body' => $content));
+
+?>
+</div>
+<?php
+ echo elgg_view('js/tagging', array('photo_tags_json' => $photo_tags_json,) );
+?>
\ No newline at end of file |