rest of the consensus porting work and integration into friendica
Credits to Mike Macgirvin for the code
This commit is contained in:
parent
0077494396
commit
f5c7006f30
10 changed files with 285 additions and 149 deletions
|
@ -491,7 +491,11 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
$cmnt_tpl = get_markup_template('comment_item.tpl');
|
||||
$hide_comments_tpl = get_markup_template('hide_comments.tpl');
|
||||
|
||||
$conv_responses = array(array('like'),array('dislike'),array('agree'),array('disagree'),array('abstain'),array('attendyes'),array('attendno'),array('attendmaybe'));
|
||||
$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'))
|
||||
);
|
||||
|
||||
// array with html for each thread (parent+comments)
|
||||
$threads = array();
|
||||
|
@ -740,19 +744,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
|
||||
|
||||
// Can we put this after the visibility check?
|
||||
like_puller($a, $item, $conv_responses, 'like');
|
||||
like_puller($a, $item, $conv_responses, 'dislike');
|
||||
|
||||
// if($item['object-type'] === ACTIVITY_OBJ_EVENT) {
|
||||
like_puller($a, $item, $conv_responses, 'attendyes');
|
||||
like_puller($a, $item, $conv_responses, 'attendno');
|
||||
like_puller($a, $item, $conv_responses, 'attendmaybe');
|
||||
logger('responses: ' . print_r($conv_responses,true));
|
||||
|
||||
|
||||
like_puller($a, $item, $conv_responses, 'agree');
|
||||
like_puller($a, $item, $conv_responses, 'disagree');
|
||||
like_puller($a, $item, $conv_responses, 'abstain');
|
||||
builtin_activity_puller($item, $conv_responses);
|
||||
|
||||
// Only add what is visible
|
||||
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
|
||||
|
@ -916,42 +908,44 @@ function item_photo_menu($item){
|
|||
return $o;
|
||||
}}
|
||||
|
||||
if(! function_exists('like_puller')) {
|
||||
function like_puller($a,$item,&$arr,$mode) {
|
||||
|
||||
/**
|
||||
* @brief Checks item to see if it is one of the builtin activities (like/dislike, event attendance, consensus items, etc.)
|
||||
* Increments the count of each matching activity and adds a link to the author as needed.
|
||||
*
|
||||
* @param array $a (not used)
|
||||
* @param array $item
|
||||
* @param array &$conv_responses (already created with builtin activity structure)
|
||||
* @return void
|
||||
*/
|
||||
if(! function_exists(builtin_activity_puller)) {
|
||||
function builtin_activity_puller($item, &$conv_responses) {
|
||||
foreach($conv_responses as $mode => $v) {
|
||||
$url = '';
|
||||
$sparkle = '';
|
||||
|
||||
switch($mode) {
|
||||
case 'like':
|
||||
case 'unlike':
|
||||
$verb = ACTIVITY_LIKE;
|
||||
break;
|
||||
case 'dislike':
|
||||
case 'undislike':
|
||||
$verb = ACTIVITY_DISLIKE;
|
||||
break;
|
||||
case 'agree':
|
||||
case 'unagree':
|
||||
$verb = ACTIVITY_AGREE;
|
||||
break;
|
||||
case 'disagree':
|
||||
case 'undisagree':
|
||||
$verb = ACTIVITY_DISAGREE;
|
||||
break;
|
||||
case 'abstain':
|
||||
case 'unabstain':
|
||||
$verb = ACTIVITY_ABSTAIN;
|
||||
break;
|
||||
case 'attendyes':
|
||||
case 'unattendyes':
|
||||
$verb = ACTIVITY_ATTEND;
|
||||
break;
|
||||
case 'attendno':
|
||||
case 'unattendno':
|
||||
$verb = ACTIVITY_ATTENDNO;
|
||||
break;
|
||||
case 'attendmaybe':
|
||||
case 'unattendmaybe':
|
||||
$verb = ACTIVITY_ATTENDMAYBE;
|
||||
break;
|
||||
default:
|
||||
|
@ -959,64 +953,57 @@ function like_puller($a,$item,&$arr,$mode) {
|
|||
break;
|
||||
}
|
||||
|
||||
logger('verb: ' . $verb);
|
||||
if($verb === ACTIVITY_ATTENDNO)
|
||||
logger('item: ' . $item['verb']);
|
||||
|
||||
if((activity_match($item['verb'], $verb)) && ($item['id'] != $item['parent'])) {
|
||||
logger('match:' . $verb);
|
||||
$url = $item['author-link'];
|
||||
if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === NETWORK_DFRN) && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
|
||||
$url = $a->get_baseurl(true) . '/redir/' . $item['contact-id'];
|
||||
$url = z_root(true) . '/redir/' . $item['contact-id'];
|
||||
$sparkle = ' class="sparkle" ';
|
||||
}
|
||||
else
|
||||
$url = zrl($url);
|
||||
|
||||
$url = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
|
||||
|
||||
if(! $item['thr-parent'])
|
||||
$item['thr-parent'] = $item['parent-uri'];
|
||||
|
||||
if(! ((isset($arr[$mode][$item['thr-parent'] . '-l'])) && (is_array($arr[$mode][$item['thr-parent'] . '-l']))))
|
||||
$arr[$mode][$item['thr-parent'] . '-l'] = array();
|
||||
if(! isset($arr[$mode][$item['thr-parent']]))
|
||||
$arr[$mode][$item['thr-parent']] = 1;
|
||||
else
|
||||
$arr[$mode][$item['thr-parent']] ++;
|
||||
if(! ((isset($conv_responses[$mode][$item['thr-parent'] . '-l']))
|
||||
&& (is_array($conv_responses[$mode][$item['thr-parent'] . '-l']))))
|
||||
$conv_responses[$mode][$item['thr-parent'] . '-l'] = array();
|
||||
|
||||
$arr[$mode][$item['thr-parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
|
||||
}
|
||||
// only list each unique author once
|
||||
if(in_array($url,$conv_responses[$mode][$item['thr-parent'] . '-l']))
|
||||
continue;
|
||||
|
||||
if(! isset($conv_responses[$mode][$item['thr-parent']]))
|
||||
$conv_responses[$mode][$item['thr-parent']] = 1;
|
||||
else
|
||||
$conv_responses[$mode][$item['thr-parent']] ++;
|
||||
|
||||
$conv_responses[$mode][$item['thr-parent'] . '-l'][] = $url;
|
||||
|
||||
// there can only be one activity verb per item so if we found anything, we can stop looking
|
||||
return;
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
// Format the like/dislike text for a profile item
|
||||
// $cnt = number of people who like/dislike the item
|
||||
// Format the vote text for a profile item
|
||||
// $cnt = number of people who vote the item
|
||||
// $arr = array of pre-linked names of likers/dislikers
|
||||
// $type = one of 'like, 'dislike'
|
||||
// $type = one of 'like, 'dislike', 'attendyes', 'attendno', 'attendmaybe', 'agree', 'disagree', 'abstain'
|
||||
// $id = item id
|
||||
// returns formatted text
|
||||
|
||||
if(! function_exists('format_like')) {
|
||||
function format_like($cnt,$arr,$type,$id) {
|
||||
$o = '';
|
||||
if($cnt == 1)
|
||||
$o .= (($type === 'like') ? sprintf( t('%s likes this.'), $arr[0]) : sprintf( t('%s doesn\'t like this.'), $arr[0])) . EOL ;
|
||||
else {
|
||||
$spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\"";
|
||||
switch($type) {
|
||||
case 'like':
|
||||
$phrase = sprintf( t('<span %1$s>%2$d people</span> like this'), $spanatts, $cnt);
|
||||
break;
|
||||
case 'dislike':
|
||||
$phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t like this'), $spanatts, $cnt);
|
||||
break;
|
||||
}
|
||||
$phrase .= EOL ;
|
||||
$o .= replace_macros(get_markup_template('voting_fakelink.tpl'), array(
|
||||
'$phrase' => $phrase,
|
||||
'$type' => $type,
|
||||
'$id' => $id
|
||||
));
|
||||
$expanded = '';
|
||||
|
||||
if($cnt == 1)
|
||||
$likers = $arr[0];
|
||||
|
||||
else {
|
||||
$total = count($arr);
|
||||
if($total >= MAX_LIKERS)
|
||||
$arr = array_slice($arr, 0, MAX_LIKERS - 1);
|
||||
|
@ -1029,9 +1016,76 @@ function format_like($cnt,$arr,$type,$id) {
|
|||
$str = implode(', ', $arr);
|
||||
$str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS );
|
||||
}
|
||||
$str = (($type === 'like') ? sprintf( t('%s like this.'), $str) : sprintf( t('%s don\'t like this.'), $str));
|
||||
$o .= "\t" . '<div class="wall-item-' . $type . '-expanded" id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
|
||||
|
||||
$likers = $str;
|
||||
}
|
||||
|
||||
// Phrase if there is only one liker. In other cases it will be uses for the expanded
|
||||
// list which show all likers
|
||||
switch($type) {
|
||||
case 'like' :
|
||||
$phrase = sprintf( t('%s likes this.'), $likers);
|
||||
break;
|
||||
case 'dislike' :
|
||||
$phrase = sprintf( t('%s doesn\'t like this.'), $likers);
|
||||
break;
|
||||
case 'attendyes' :
|
||||
$phrase = sprintf( t('%s attends.'), $likers);
|
||||
break;
|
||||
case 'attendno' :
|
||||
$phrase = sprintf( t('%s doesn\'t attend.'), $likers);
|
||||
break;
|
||||
case 'attendmaybe' :
|
||||
$phrase = sprintf( t('%s attends maybe.'), $likers);
|
||||
break;
|
||||
case 'agree' :
|
||||
$phrase = sprintf( t('%s agrees.'), $likers);
|
||||
break;
|
||||
case 'disagree' :
|
||||
$phrase = sprintf( t('%s doesn\'t agree.'), $likers);
|
||||
break;
|
||||
case 'abstain' :
|
||||
$phrase = sprintf( t('%s abstains.'), $likers);
|
||||
break;
|
||||
}
|
||||
|
||||
if($cnt > 1) {
|
||||
$spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\"";
|
||||
$expanded .= "\t" . '<div class="wall-item-' . $type . '-expanded" id="' . $type . 'list-' . $id . '" style="display: none;" >' . $phrase . EOL . '</div>';
|
||||
switch($type) {
|
||||
case 'like':
|
||||
$phrase = sprintf( t('<span %1$s>%2$d people</span> like this'), $spanatts, $cnt);
|
||||
break;
|
||||
case 'dislike':
|
||||
$phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t like this'), $spanatts, $cnt);
|
||||
break;
|
||||
case 'attendyes':
|
||||
$phrase = sprintf( t('<span %1$s>%2$d people</span> attend'), $spanatts, $cnt);
|
||||
break;
|
||||
case 'attendno':
|
||||
$phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t attend'), $spanatts, $cnt);
|
||||
break;
|
||||
case 'attendmaybe':
|
||||
$phrase = sprintf( t('<span %1$s>%2$d people</span> anttend maybe'), $spanatts, $cnt);
|
||||
case 'agree':
|
||||
$phrase = sprintf( t('<span %1$s>%2$d people</span> agree'), $spanatts, $cnt);
|
||||
break;
|
||||
case 'disagree':
|
||||
$phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t agree'), $spanatts, $cnt);
|
||||
break;
|
||||
case 'abstain':
|
||||
$phrase = sprintf( t('<span %1$s>%2$d people</span> abstains'), $spanatts, $cnt);
|
||||
}
|
||||
}
|
||||
|
||||
$phrase .= EOL ;
|
||||
$o .= replace_macros(get_markup_template('voting_fakelink.tpl'), array(
|
||||
'$phrase' => $phrase,
|
||||
'$type' => $type,
|
||||
'$id' => $id
|
||||
));
|
||||
$o .= $expanded;
|
||||
|
||||
return $o;
|
||||
}}
|
||||
|
||||
|
@ -1049,6 +1103,8 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
|||
if( local_user() && feature_enabled(local_user(),'richtext') )
|
||||
$plaintext = false;
|
||||
|
||||
$voting = feature_enabled(local_user(),'consensus_tools');
|
||||
|
||||
$tpl = get_markup_template('jot-header.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($tpl, array(
|
||||
'$newpost' => 'true',
|
||||
|
@ -1126,6 +1182,9 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
|||
'$shortsetloc' => t('set location'),
|
||||
'$noloc' => t('Clear browser location'),
|
||||
'$shortnoloc' => t('clear location'),
|
||||
'$voting' => t('Toggle voting'),
|
||||
'$feature_voting' => $voting,
|
||||
'$consensus' => 0,
|
||||
'$title' => $x['title'],
|
||||
'$placeholdertitle' => t('Set title'),
|
||||
'$category' => $x['category'],
|
||||
|
@ -1311,10 +1370,19 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
|
|||
$ret[$v]['list_part'] = '';
|
||||
}
|
||||
$ret[$v]['button'] = get_response_button_text($v,$ret[$v]['count']);
|
||||
$ret[$v]['title'] = $conv_responses[$v]['title'];
|
||||
}
|
||||
$ret['count'] = count($ret);
|
||||
|
||||
$count = 0;
|
||||
foreach($ret as $key) {
|
||||
if ($key['count'] == true)
|
||||
$count++;
|
||||
}
|
||||
$ret['count'] = $count;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function get_response_button_text($v,$count) {
|
||||
switch($v) {
|
||||
case 'like':
|
||||
|
@ -1335,7 +1403,7 @@ function get_response_button_text($v,$count) {
|
|||
case 'agree':
|
||||
return tt('Agree','Agrees',$count,'noun');
|
||||
break;
|
||||
case 'agree':
|
||||
case 'disagree':
|
||||
return tt('Disagree','Disagrees',$count,'noun');
|
||||
break;
|
||||
case 'abstain':
|
||||
|
|
|
@ -31,6 +31,7 @@ function get_features() {
|
|||
array('richtext', t('Richtext Editor'), t('Enable richtext editor')),
|
||||
array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')),
|
||||
array('aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a fourm page is selected/deselected in ACL window.')),
|
||||
array('consensus_tools', t('Enable voting tools'), t('Provide a class of post which others can vote on'),false),
|
||||
),
|
||||
|
||||
// Network sidebar widgets
|
||||
|
|
|
@ -102,6 +102,7 @@ function editpost_content(&$a) {
|
|||
|
||||
//$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
|
||||
|
||||
$voting = feature_enabled(local_user(),'consensus_tools');
|
||||
|
||||
$o .= replace_macros($tpl,array(
|
||||
'$return_path' => $_SESSION['return_url'],
|
||||
|
@ -121,6 +122,11 @@ function editpost_content(&$a) {
|
|||
'$shortsetloc' => t('set location'),
|
||||
'$noloc' => t('Clear browser location'),
|
||||
'$shortnoloc' => t('clear location'),
|
||||
'$voting' => t('Toggle voting'),
|
||||
'$feature_voting' => $voting,
|
||||
|
||||
// we need a solution for the red flags to make consensus work
|
||||
'$consensus' => (($itm[0]['item_flags'] & ITEM_CONSENSUS) ? 1 : 0),
|
||||
'$wait' => t('Please wait'),
|
||||
'$permset' => t('Permission settings'),
|
||||
'$ptyp' => $itm[0]['type'],
|
||||
|
|
10
mod/item.php
10
mod/item.php
|
@ -51,6 +51,7 @@ function item_post(&$a) {
|
|||
$message_id = ((x($_REQUEST,'message_id') && $api_source) ? strip_tags($_REQUEST['message_id']) : '');
|
||||
|
||||
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
|
||||
$consensus = intval($_REQUEST['consensus']);
|
||||
$preview = ((x($_REQUEST,'preview')) ? intval($_REQUEST['preview']) : 0);
|
||||
|
||||
|
||||
|
@ -655,6 +656,15 @@ function item_post(&$a) {
|
|||
if(!$thr_parent)
|
||||
$thr_parent = $uri;
|
||||
|
||||
|
||||
/* *
|
||||
* to make consensus work, red requests the consensus flag from boot.php
|
||||
* this have to be inserted into the lower $datarray
|
||||
*
|
||||
* if($consensus)
|
||||
* $item_flags |= ITEM_CONSENSUS;
|
||||
*/
|
||||
|
||||
$datarray = array();
|
||||
$datarray['uid'] = $profile_uid;
|
||||
$datarray['type'] = $post_type;
|
||||
|
|
14
mod/like.php
14
mod/like.php
|
@ -132,11 +132,21 @@ function like_content(&$a) {
|
|||
// See if we've been passed a return path to redirect to
|
||||
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
|
||||
|
||||
$verbs = " '".dbesc($activity)."' ";
|
||||
|
||||
$r = q("SELECT `id`, `guid` FROM `item` WHERE `verb` = '%s' AND `deleted` = 0
|
||||
// event participation and consensus items are essentially radio toggles. If you make a subsequent choice,
|
||||
// we need to eradicate your first choice.
|
||||
if($activity === ACTIVITY_ATTEND || $activity === ACTIVITY_ATTENDNO || $activity === ACTIVITY_ATTENDMAYBE) {
|
||||
$verbs = " '" . dbesc(ACTIVITY_ATTEND) . "','" . dbesc(ACTIVITY_ATTENDNO) . "','" . dbesc(ACTIVITY_ATTENDMAYBE) . "' ";
|
||||
}
|
||||
if($activity === ACTIVITY_AGREE || $activity === ACTIVITY_DISAGREE || $activity === ACTIVITY_ABSTAIN) {
|
||||
$verbs = " '" . dbesc(ACTIVITY_AGREE) . "','" . dbesc(ACTIVITY_DISAGREE) . "','" . dbesc(ACTIVITY_ABSTAIN) . "' ";
|
||||
}
|
||||
|
||||
$r = q("SELECT `id`, `guid` FROM `item` WHERE `verb` IN ( $verbs ) AND `deleted` = 0
|
||||
AND `contact-id` = %d AND `uid` = %d
|
||||
AND (`parent` = '%s' OR `parent-uri` = '%s' OR `thr-parent` = '%s') LIMIT 1",
|
||||
dbesc($activity), intval($contact['id']), intval($owner_uid),
|
||||
intval($contact['id']), intval($owner_uid),
|
||||
dbesc($item_id), dbesc($item_id), dbesc($item['uri'])
|
||||
);
|
||||
|
||||
|
|
|
@ -175,7 +175,6 @@ class Item extends BaseObject {
|
|||
}
|
||||
}*/
|
||||
|
||||
|
||||
// process action responses - e.g. like/dislike/attend/agree/whatever
|
||||
$response_verbs = array('like');
|
||||
$response_verbs[] = 'dislike';
|
||||
|
@ -183,43 +182,33 @@ class Item extends BaseObject {
|
|||
$response_verbs[] = 'attendyes';
|
||||
$response_verbs[] = 'attendno';
|
||||
$response_verbs[] = 'attendmaybe';
|
||||
if($conv->is_writable()) {
|
||||
$isevent = true;
|
||||
$attend = array( t('I will attend'), t('I will not attend'), t('I might attend'));
|
||||
}
|
||||
$consensus = (($item['item_flags'] & ITEM_CONSENSUS)? true : false);
|
||||
}
|
||||
|
||||
// red part for consensus
|
||||
// we need a solution in friendica for missing item_flags
|
||||
// to test $consensus with friendica set $consensus = true
|
||||
// $consensus = (($item['item_flags'] & ITEM_CONSENSUS)? true : false);
|
||||
$consensus = false;
|
||||
|
||||
if($consensus) {
|
||||
$response_verbs[] = 'agree';
|
||||
$response_verbs[] = 'disagree';
|
||||
$response_verbs[] = 'abstain';
|
||||
if($conv->is_writable()) {
|
||||
$conlabels = array( t('I agree'), t('I disagree'), t('I abstain'));
|
||||
$canvote = true;
|
||||
}
|
||||
}
|
||||
$responses = get_responses($conv_responses,$response_verbs,$this,$item);
|
||||
|
||||
// like_button_label from red -> needs to be removed
|
||||
//$like_button_label = tt('Like','Likes',$like_count,'noun');
|
||||
foreach ($response_verbs as $value=>$verbs) {
|
||||
$responses[$verbs][output] = ((x($conv_responses[$verbs],$item['uri'])) ? format_like($conv_responses[$verbs][$item['uri']],$conv_responses[$verbs][$item['uri'] . '-l'],$verbs,$item['uri']) : '');
|
||||
|
||||
// another part from red - it is here for compatility - maybe removed later
|
||||
$like_count = ((x($conv_responses['like'],$item['uri'])) ? $conv_responses['like'][$item['uri']] : '');
|
||||
$like_list = ((x($conv_responses['like'],$item['uri'])) ? $conv_responses['like'][$item['uri'] . '-l'] : '');
|
||||
if (count($like_list) > MAX_LIKERS) {
|
||||
$like_list_part = array_slice($like_list, 0, MAX_LIKERS);
|
||||
array_push($like_list_part, '<a href="#" data-toggle="modal" data-target="#likeModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>');
|
||||
} else {
|
||||
$like_list_part = '';
|
||||
}
|
||||
$like_button_label = tt('Like','Likes',$like_count,'noun');
|
||||
$dislike_count = ((x($conv_responses['dislike'],$item['uri'])) ? $conv_responses['dislike'][$item['uri']] : '');
|
||||
$dislike_list = ((x($conv_responses['dislike'],$item['uri'])) ? $conv_responses['dislike'][$item['uri'] . '-l'] : '');
|
||||
$dislike_button_label = tt('Dislike','Dislikes',$dislike_count,'noun');
|
||||
if (count($dislike_list) > MAX_LIKERS) {
|
||||
$dislike_list_part = array_slice($dislike_list, 0, MAX_LIKERS);
|
||||
array_push($dislike_list_part, '<a href="#" data-toggle="modal" data-target="#dislikeModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>');
|
||||
} else {
|
||||
$dislike_list_part = '';
|
||||
}
|
||||
|
||||
$like = ((x($conv_responses['like'],$item['uri'])) ? format_like($conv_responses['like'][$item['uri']],$conv_responses['like'][$item['uri'] . '-l'],'like',$item['uri']) : '');
|
||||
$dislike = ((x($conv_responses['dislike'],$item['uri'])) ? format_like($conv_responses['dislike'][$item['uri']],$conv_responses['dislike'][$item['uri'] . '-l'],'dislike',$item['uri']) : '');
|
||||
$like = ((x($conv_responses['like'],$item['uri'])) ? format_like($conv_responses['like'][$item['uri']],$conv_responses['like'][$item['uri'] . '-l'],'like',$item['uri']) : '');
|
||||
|
||||
/*
|
||||
* We should avoid doing this all the time, but it depends on the conversation mode
|
||||
|
@ -332,7 +321,7 @@ class Item extends BaseObject {
|
|||
|
||||
// Disable features that aren't available in several networks
|
||||
if (($item["item_network"] != NETWORK_DFRN) AND isset($buttons["dislike"])) {
|
||||
unset($buttons["dislike"]);
|
||||
unset($buttons["dislike"],$isevent,$consensus);
|
||||
$tagger = '';
|
||||
}
|
||||
|
||||
|
@ -370,6 +359,9 @@ class Item extends BaseObject {
|
|||
'guid' => $item['guid'],
|
||||
'isevent' => $isevent,
|
||||
'attend' => $attend,
|
||||
'consensus' => $consensus,
|
||||
'conlabels' => $conlabels,
|
||||
'canvote' => $canvote,
|
||||
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
|
||||
'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
|
||||
'to' => t('to'),
|
||||
|
@ -403,8 +395,8 @@ class Item extends BaseObject {
|
|||
'filer' => ((feature_enabled($conv->get_profile_owner(),'filing')) ? $filer : ''),
|
||||
'drop' => $drop,
|
||||
'vote' => $buttons,
|
||||
'like' => $like,
|
||||
'dislike' => $dislike,
|
||||
'like' => $responses['like']['output'],
|
||||
'dislike' => $responses['dislike']['output'],
|
||||
'responses' => $responses,
|
||||
'switchcomment' => t('Comment'),
|
||||
'comment' => $this->get_comment_box($indent),
|
||||
|
|
|
@ -333,6 +333,17 @@ function enableOnUser(){
|
|||
|
||||
}
|
||||
|
||||
function toggleVoting() {
|
||||
if($('#jot-consensus').val() > 0) {
|
||||
$('#jot-consensus').val(0);
|
||||
$('#profile-voting').removeClass('icon-check').addClass('icon-check-empty');
|
||||
}
|
||||
else {
|
||||
$('#jot-consensus').val(1);
|
||||
$('#profile-voting').removeClass('icon-check-empty').addClass('icon-check');
|
||||
}
|
||||
}
|
||||
|
||||
function jotClearLocation() {
|
||||
$('#jot-coord').val('');
|
||||
$('#profile-nolocation-wrapper').hide();
|
||||
|
|
|
@ -54,6 +54,12 @@
|
|||
<a id="profile-nolocation" class="icon noglobe" title="{{$noloc|escape:'html'}}" onclick="jotClearLocation();return false;"></a>
|
||||
</div>
|
||||
|
||||
{{if $feature_voting}}
|
||||
<div id="profile-voting-wrapper" style="display: {{$visitor}};" >
|
||||
<a id="profile-voting" class="icon icon-check-empty" title="{{$voting|escape:'html'}}" onclick="toggleVoting();return false;"></a>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div id="profile-jot-perms" class="profile-jot-perms" style="display: {{$pvisit}};" >
|
||||
<a href="#profile-jot-acl-wrapper" id="jot-perms-icon" class="icon {{$lockstate}}" title="{{$permset|escape:'html'}}" ></a>{{$bang}}
|
||||
</div>
|
||||
|
|
|
@ -1347,11 +1347,15 @@ section.minimal {
|
|||
width: 100%;
|
||||
margin-bottom: 0.3em;
|
||||
}
|
||||
.wall-item-container .wall-item-actions-social {
|
||||
.wall-item-container .wall-item-actions-social,
|
||||
.wall-item-container .wall-item-actions-isevent,
|
||||
.wall-item-container .wall-item-actions-canvote {
|
||||
float: left;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
.wall-item-container .wall-item-actions-social a {
|
||||
.wall-item-container .wall-item-actions-social a,
|
||||
.wall-item-container .wall-item-actions-isevent a,
|
||||
.wall-item-container .wall-item-actions-canvote a{
|
||||
float: left;
|
||||
margin-right: 1em;
|
||||
cursor: pointer;
|
||||
|
@ -1863,6 +1867,11 @@ section.minimal {
|
|||
margin-left: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#profile-voting-wrapper {
|
||||
float: left;
|
||||
margin-left: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#profile-smiley-wrapper {
|
||||
float: left;
|
||||
margin-left: 15px;
|
||||
|
|
|
@ -118,7 +118,26 @@
|
|||
<a role="button" id="filer-{{$item.id}}" onclick="itemFiler({{$item.id}}); return false;" class="filer-item filer-icon" title="{{$item.filer}}"><i class="icon-folder-close icon-large"><span class="sr-only">{{$item.filer}}</span></i></a>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<div class="wall-item-location">{{$item.location}} {{$item.postopts}}</div>
|
||||
|
||||
{{if $item.isevent}}
|
||||
<div class="clear"></div>
|
||||
<div class="wall-item-actions-isevent">
|
||||
<a href="#" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="dolike({{$item.id}},'attendyes'); return false;"><i class="icon-ok icon-large"></i></a>
|
||||
<a href="#" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="dolike({{$item.id}},'attendno'); return false;"><i class="icon-remove icon-large"></i></a>
|
||||
<a href="#" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="dolike({{$item.id}},'attendmaybe'); return false;"><i class="icon-question icon-large"></i></a>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if $item.canvote}}<!--Consensus isn't implemented at this time. It's just for testing. -->
|
||||
<div class="clear"></div>
|
||||
<div class="wall-item-actions-canvote">
|
||||
<a href="#" id="attendyes-{{$item.id}}" title="{{$item.conlabels.0}}" onclick="dolike({{$item.id}},'agree'); return false;"><i class="icon-ok icon-large"></i></a>
|
||||
<a href="#" id="attendno-{{$item.id}}" title="{{$item.conlabels.1}}" onclick="dolike({{$item.id}},'disagree'); return false;"><i class="icon-remove icon-large"></i></a>
|
||||
<a href="#" id="attendmaybe-{{$item.id}}" title="{{$item.conlabels.2}}" onclick="dolike({{$item.id}},'abstain'); return false;"><i class="icon-question icon-large"></i></a>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="wall-item-actions-tools">
|
||||
|
||||
{{if $item.drop.pagedrop}}
|
||||
|
@ -137,8 +156,12 @@
|
|||
<div class="wall-item-bottom">
|
||||
<div class="wall-item-links">
|
||||
</div>
|
||||
<div class="wall-item-like" id="wall-item-like-{{$item.id}}">{{$item.like}}</div>
|
||||
<div class="wall-item-dislike" id="wall-item-dislike-{{$item.id}}">{{$item.dislike}}</div>
|
||||
{{if $item.responses}}
|
||||
{{foreach $item.responses as $verb=>$response}}
|
||||
<div class="wall-item-{{$verb}}" id="wall-item-{{$verb}}-{{$item.id}}">{{$response.output}}</div>
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
|
||||
{{if $item.threaded}}{{if $item.comment}}
|
||||
|
|
Loading…
Reference in a new issue