diff options
-rw-r--r-- | include/ItemObject.php | 4 | ||||
-rw-r--r-- | include/conversation.php | 2 | ||||
-rw-r--r-- | mod/photos.php | 24 | ||||
-rwxr-xr-x | view/tpl/photo_view.tpl | 89 |
4 files changed, 52 insertions, 67 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php index 136e08eb7..1785d55e7 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -168,10 +168,6 @@ class Item extends BaseObject { $responses = get_responses($conv_responses,$response_verbs,$this,$item); - - - $like_button_label = tt('Like','Likes',$like_count,'noun'); - $like_count = ((x($conv_responses['like'],$item['mid'])) ? $conv_responses['like'][$item['mid']] : ''); $like_list = ((x($conv_responses['like'],$item['mid'])) ? $conv_responses['like'][$item['mid'] . '-l'] : ''); if (count($like_list) > MAX_LIKERS) { diff --git a/include/conversation.php b/include/conversation.php index 17822d0d5..8bc42b34b 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1664,7 +1664,7 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) { if(count($ret[$v]['list']) > MAX_LIKERS) { $ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS); array_push($ret[$v]['list_part'], '<a href="#" data-toggle="modal" data-target="#' . $v . 'Modal-' - . $ob->get_id() . '"><b>' . t('View all') . '</b></a>'); + . (($ob) ? $ob->get_id() : $item['id']) . '"><b>' . t('View all') . '</b></a>'); } else { $ret[$v]['list_part'] = ''; diff --git a/mod/photos.php b/mod/photos.php index 8ac6ed3d7..297790f6e 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -974,13 +974,21 @@ function photos_content(&$a) { $like = ''; $dislike = ''; + $conv_responses = array( + 'like' => array('title' => t('Likes','title')),'dislike' => array('title' => t('Dislikes','title')), + 'agree' => array('title' => t('Agree','title')),'disagree' => array('title' => t('Disagree','title')), 'abstain' => array('title' => t('Abstain','title')), + 'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title')) + ); + + + if($r) { -// foreach($r as $item) { -// like_puller($a,$item,$alike,'like'); -// like_puller($a,$item,$dlike,'dislike'); -// } + foreach($r as $item) { + builtin_activity_puller($item, $conv_responses); + } + $like_count = ((x($alike,$link_item['mid'])) ? $alike[$link_item['mid']] : ''); $like_list = ((x($alike,$link_item['mid'])) ? $alike[$link_item['mid'] . '-l'] : ''); @@ -1084,6 +1092,13 @@ function photos_content(&$a) { $dislike_e = $dislike; + $response_verbs = array('like'); + if(feature_enabled($owner_uid,'dislike')) + $response_verbs[] = 'dislike'; + + + $responses = get_responses($conv_responses,$response_verbs,'',$link_item); + $photo_tpl = get_markup_template('photo_view.tpl'); $o .= replace_macros($photo_tpl, array( '$id' => $link_item['id'], //$ph[0]['id'], @@ -1098,6 +1113,7 @@ function photos_content(&$a) { '$unknown' => t('Unknown'), '$tag_hdr' => t('In This Photo:'), '$tags' => $tags, + 'responses' => $responses, '$edit' => $edit, '$likebuttons' => $likebuttons, '$like' => $like_e, diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl index 45a7cd7e5..3ece68876 100755 --- a/view/tpl/photo_view.tpl +++ b/view/tpl/photo_view.tpl @@ -95,70 +95,43 @@ {{/if}} <div class="photo-item-tools"> - {{if $like_count || $dislike_count}} - <div class="photo-item-tools-left pull-left"> - <div class="{{if $like_count && $dislike_count}}btn-group{{/if}}"> - {{if $like_count}} - <div class="btn-group"> - <button type="button" class="btn btn-default btn-sm wall-item-like dropdown-toggle" data-toggle="dropdown" id="wall-item-like-{{$id}}">{{$like_count}} {{$like_button_label}}</button> - {{if $like_list_part}} - <ul class="dropdown-menu" role="menu" aria-labelledby="wall-item-like-{{$id}}">{{foreach $like_list_part as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul> - {{else}} - <ul class="dropdown-menu" role="menu" aria-labelledby="wall-item-like-{{$id}}">{{foreach $like_list as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul> - {{/if}} - </div> + + {{if $responses.count }} + <div class="photo-item-tools-left pull-left"> + <div class="{{if $responses.count > 1}}btn-group{{/if}}"> + {{foreach $responses as $verb=>$response}} + {{if $response.count}} + <div class="btn-group"> + <button type="button" class="btn btn-default btn-sm wall-item-like dropdown-toggle" data-toggle="dropdown" id="wall-item-{{$verb}}-{{$id}}">{{$response.count}} {{$response.button}}</button> + {{if $response.list_part}} + <ul class="dropdown-menu" role="menu" aria-labelledby="wall-item-{{$verb}}-{{$id}}">{{foreach $response.list_part as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul> + {{else}} + <ul class="dropdown-menu" role="menu" aria-labelledby="wall-item-{{$verb}}-{{$id}}">{{foreach $response.list as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul> {{/if}} - {{if $dislike_count}} - <div class="btn-group"> - <button type="button" class="btn btn-default btn-sm wall-item-dislike dropdown-toggle" data-toggle="dropdown" id="wall-item-dislike-{{$id}}">{{$dislike_count}} {{$dislike_button_label}}</button> - {{if $dislike_list_part}} - <ul class="dropdown-menu" role="menu" aria-labelledby="wall-item-dislike-{{$id}}">{{foreach $dislike_list_part as $disliker}}<li role="presentation">{{$disliker}}</li>{{/foreach}}</ul> - {{else}} - <ul class="dropdown-menu" role="menu" aria-labelledby="wall-item-dislike-{{$id}}">{{foreach $dislike_list as $disliker}}<li role="presentation">{{$disliker}}</li>{{/foreach}}</ul> - {{/if}} - </div> + {{if $response.list_part}} + <div class="modal" id="{{$verb}}Modal-{{$id}}"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h4 class="modal-title">{{$response.title}}</h4> + </div> + <div class="modal-body"> + <ul>{{foreach $response.list as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul> + </div> + <div class="modal-footer clear"> + <button type="button" class="btn btn-default" data-dismiss="modal">{{$modal_dismiss}}</button> + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> + </div><!-- /.modal --> {{/if}} </div> - {{if $like_list_part}} - <div class="modal" id="likeModal-{{$id}}"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> - <h4 class="modal-title">{{$like_modal_title}}</h4> - </div> - <div class="modal-body"> - <ul>{{foreach $like_list as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul> - </div> - <div class="modal-footer clear"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{$modal_dismiss}}</button> - </div> - </div><!-- /.modal-content --> - </div><!-- /.modal-dialog --> - </div><!-- /.modal --> - {{/if}} - {{if $dislike_list_part}} - <div class="modal" id="dislikeModal-{{$id}}"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> - <h4 class="modal-title">{{$dislike_modal_title}}</h4> - </div> - <div class="modal-body"> - <ul>{{foreach $dislike_list as $disliker}}<li role="presentation">{{$disliker}}</li>{{/foreach}}</ul> - </div> - <div class="modal-footer clear"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{$modal_dismiss}}</button> - </div> - </div><!-- /.modal-content --> - </div><!-- /.modal-dialog --> - </div><!-- /.modal --> {{/if}} - </div> + {{/foreach}} </div> {{/if}} - + </div> {{if $likebuttons}} <div class="photo-item-tools-right btn-group pull-right"> <button type="button" class="btn btn-default btn-sm" onclick="dolike({{$id}},'like'); return false"> |