diff options
-rw-r--r-- | mod/photos.php | 26 | ||||
-rwxr-xr-x | view/tpl/photo_view.tpl | 8 |
2 files changed, 27 insertions, 7 deletions
diff --git a/mod/photos.php b/mod/photos.php index c299fe778..6798cb002 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -763,7 +763,7 @@ function photos_content(&$a) { /* Check again - this time without specifying permissions */ - $ph = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' + $ph = q("SELECT id FROM photo WHERE uid = %d AND resource_id = '%s' and ( photo_flags = %d or photo_flags = %d ) LIMIT 1", intval($owner_uid), @@ -875,6 +875,9 @@ function photos_content(&$a) { if($linked_items) { + xchan_query($linked_items); + $linked_items = fetch_post_tags($linked_items,true); + $link_item = $linked_items[0]; $r = q("select * from item where parent_mid = '%s' @@ -890,6 +893,21 @@ function photos_content(&$a) { $r = conv_sort($r,'commented'); } + + + $tags = array(); + if($link_item['term']) { + $cnt = 0; + foreach($link_item['term'] as $t) + $tags[$cnt] = array(0 => format_term_for_display($t)); + if($can_post && ($ph[0]['uid'] == $owner_uid)) { + $tags[$cnt][1] = 'tagrm?f=&item=' . $link_item['id']; + $tags[$cnt][2] = t('Remove'); + } + $cnt ++; + } + + if((local_user()) && (local_user() == $link_item['uid'])) { q("UPDATE `item` SET item_flags = (item_flags ^ %d) WHERE parent = %d and uid = %d and (item_flags & %d)", intval(ITEM_UNSEEN), @@ -925,7 +943,6 @@ function photos_content(&$a) { 'capt_label' => t('Caption'), 'caption' => $caption_e, 'tag_label' => t('Add a Tag'), - 'tags' => $link_item['tag'], 'permissions' => t('Permissions'), 'aclselect' => $aclselect_e, 'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'), @@ -1067,10 +1084,10 @@ function photos_content(&$a) { } $album_e = array($album_link,$ph[0]['album']); - $tags_e = $tags; $like_e = $like; $dislike_e = $dislike; + $photo_tpl = get_markup_template('photo_view.tpl'); $o .= replace_macros($photo_tpl, array( '$id' => $ph[0]['id'], @@ -1081,7 +1098,8 @@ function photos_content(&$a) { '$prevlink' => $prevlink, '$nextlink' => $nextlink, '$desc' => $ph[0]['description'], - '$tags' => $tags_e, + '$tag_hdr' => t('In This Photo:'), + '$tags' => $tags, '$edit' => $edit, '$likebuttons' => $likebuttons, '$like' => $like_e, diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl index 93e9abfa5..8c19d39d7 100755 --- a/view/tpl/photo_view.tpl +++ b/view/tpl/photo_view.tpl @@ -14,10 +14,12 @@ <div id="photo-photo-end"></div> <div id="photo-caption">{{$desc}}</div> {{if $tags}} -<div id="in-this-photo-text">{{$tags.0}}</div> -<div id="in-this-photo">{{$tags.1}}</div> +<div id="in-this-photo-text">{{$tag_hdr}}</div> +{{foreach $tags as $t}} +<div id="in-this-photo">{{$t.0}}</div> +{{if $edit}}<div id="tag-remove"><a href="{{$t.1}}">{{$t.2}}</a></div>{{/if}} +{{/foreach}} {{/if}} -{{if $tags.2}}<div id="tag-remove"><a href="{{$tags.2}}">{{$tags.3}}</a></div>{{/if}} {{if $edit}} <div id="photo-edit-edit-wrapper" class="fakelink" onclick="openClose('photo-edit-edit');">{{$edit.edit}}</div> |