1
0
Fork 0

fixes like/dislike for photos

This commit is contained in:
rabuzarus 2015-06-04 04:19:06 +02:00 committed by rabuzarus
parent f5c7006f30
commit 2ff67ef5ed
3 changed files with 19 additions and 6 deletions

View file

@ -1364,8 +1364,8 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
if(count($ret[$v]['list']) > MAX_LIKERS) { if(count($ret[$v]['list']) > MAX_LIKERS) {
$ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, 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-' 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 { else {
$ret[$v]['list_part'] = ''; $ret[$v]['list_part'] = '';
} }

View file

@ -1601,18 +1601,23 @@ function photos_content(&$a) {
$like = ''; $like = '';
$dislike = ''; $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'))
);
// display comments // display comments
if(count($r)) { if(count($r)) {
foreach($r as $item) { foreach($r as $item) {
like_puller($a,$item,$alike,'like'); builtin_activity_puller($item, $conv_responses);
like_puller($a,$item,$dlike,'dislike');
} }
$like = ((isset($alike[$link_item['id']])) ? format_like($alike[$link_item['id']],$alike[$link_item['id'] . '-l'],'like',$link_item['id']) : ''); $like = ((x($conv_responses['like'],$link_item['uri'])) ? format_like($conv_responses['like'][$link_item['uri']],$conv_responses['like'][$link_item['uri'] . '-l'],'like',$link_item['id']) : '');
$dislike = ((isset($dlike[$link_item['id']])) ? format_like($dlike[$link_item['id']],$dlike[$link_item['id'] . '-l'],'dislike',$link_item['id']) : ''); $dislike = ((x($conv_responses['dislike'],$link_item['uri'])) ? format_like($conv_responses['dislike'][$link_item['uri']],$conv_responses['dislike'][$link_item['uri'] . '-l'],'dislike',$link_item['id']) : '');
@ -1731,6 +1736,12 @@ function photos_content(&$a) {
$paginate = paginate($a); $paginate = paginate($a);
} }
$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'); $photo_tpl = get_markup_template('photo_view.tpl');
if($a->theme['template_engine'] === 'internal') { if($a->theme['template_engine'] === 'internal') {
@ -1760,6 +1771,7 @@ function photos_content(&$a) {
'$likebuttons' => $likebuttons, '$likebuttons' => $likebuttons,
'$like' => $like_e, '$like' => $like_e,
'$dislike' => $dikslike_e, '$dislike' => $dikslike_e,
'responses' => $responses,
'$comments' => $comments, '$comments' => $comments,
'$paginate' => $paginate, '$paginate' => $paginate,
)); ));

View file

@ -177,6 +177,7 @@ class Item extends BaseObject {
// process action responses - e.g. like/dislike/attend/agree/whatever // process action responses - e.g. like/dislike/attend/agree/whatever
$response_verbs = array('like'); $response_verbs = array('like');
if(feature_enabled($conv->get_profile_owner(),'dislike'))
$response_verbs[] = 'dislike'; $response_verbs[] = 'dislike';
if($item['object-type'] === ACTIVITY_OBJ_EVENT) { if($item['object-type'] === ACTIVITY_OBJ_EVENT) {
$response_verbs[] = 'attendyes'; $response_verbs[] = 'attendyes';