aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-10 00:11:37 -0800
committerfriendica <info@friendica.com>2015-02-10 00:11:37 -0800
commit81e7b47b76e6cc72995e910190e4164d28ec5664 (patch)
tree5cc764df8547d529bf52c06ac30981332db47b3f
parentc69494524590b7ffa07fcab6780c603ded2cb720 (diff)
downloadvolse-hubzilla-81e7b47b76e6cc72995e910190e4164d28ec5664.tar.gz
volse-hubzilla-81e7b47b76e6cc72995e910190e4164d28ec5664.tar.bz2
volse-hubzilla-81e7b47b76e6cc72995e910190e4164d28ec5664.zip
more progress on event confirmations
-rwxr-xr-xboot.php3
-rw-r--r--include/ItemObject.php9
-rw-r--r--include/conversation.php31
-rwxr-xr-xmod/like.php22
-rwxr-xr-xview/tpl/conv_item.tpl25
5 files changed, 76 insertions, 14 deletions
diff --git a/boot.php b/boot.php
index 74e77caa1..81e1f6d76 100755
--- a/boot.php
+++ b/boot.php
@@ -485,6 +485,9 @@ define ( 'ACTIVITY_DISLIKE', NAMESPACE_ZOT . '/activity/dislike' );
define ( 'ACTIVITY_AGREE', NAMESPACE_ZOT . '/activity/agree' );
define ( 'ACTIVITY_DISAGREE', NAMESPACE_ZOT . '/activity/disagree' );
define ( 'ACTIVITY_ABSTAIN', NAMESPACE_ZOT . '/activity/abstain' );
+define ( 'ACTIVITY_ATTEND', NAMESPACE_ZOT . '/activity/attendyes' );
+define ( 'ACTIVITY_ATTENDNO', NAMESPACE_ZOT . '/activity/attendno' );
+define ( 'ACTIVITY_ATTENDMAYBE', NAMESPACE_ZOT . '/activity/attendmaybe' );
define ( 'ACTIVITY_OBJ_HEART', NAMESPACE_ZOT . '/activity/heart' );
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 8f1112f6a..3638b2ffb 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -134,16 +134,19 @@ class Item extends BaseObject {
$profile_name = $item['author']['xchan_name'];
$location = format_location($item);
-
+ $isevent = false;
+ $attend = null;
// process action responses - e.g. like/dislike/attend/agree/whatever
$response_verbs = array('like');
if(feature_enabled($conv->get_profile_owner(),'dislike'))
$response_verbs[] = 'dislike';
- if($item['resource_type'] === 'event') {
+ if($item['obj_type'] === ACTIVITY_OBJ_EVENT) {
$response_verbs[] = 'attendyes';
$response_verbs[] = 'attendno';
$response_verbs[] = 'attendmaybe';
+ $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);
if($consensus) {
@@ -275,6 +278,8 @@ class Item extends BaseObject {
'body' => $body,
'text' => strip_tags($body),
'id' => $this->get_id(),
+ 'isevent' => $isevent,
+ 'attend' => $attend,
'linktitle' => sprintf( t('View %s\'s profile - %s'), $profile_name, $item['author']['xchan_addr']),
'olinktitle' => sprintf( t('View %s\'s profile - %s'), $this->get_owner_name(), $item['owner']['xchan_addr']),
'llink' => $item['llink'],
diff --git a/include/conversation.php b/include/conversation.php
index 244c812ef..308b56586 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -402,7 +402,7 @@ function visible_activity($item) {
// likes (etc.) can apply to other things besides posts. Check if they are post children,
// in which case we handle them specially
- $hidden_activities = array(ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN);
+ $hidden_activities = array(ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE);
foreach($hidden_activities as $act) {
if((activity_match($item['verb'],$act)) && ($item['mid'] != $item['parent_mid'])) {
return false;
@@ -552,7 +552,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
$items = $cb['items'];
- $conv_responses = array(array('like'),array('dislike'),array('agree'),array('disagree'),array('abstain'));
+ $conv_responses = array(array('like'),array('dislike'),array('agree'),array('disagree'),array('abstain'),array('attendyes'),array('attendno'),array('attendmaybe'));
// array with html for each thread (parent+comments)
$threads = array();
@@ -784,10 +784,20 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
if(feature_enabled($profile_owner, 'dislike'))
like_puller($a, $item, $conv_responses, 'dislike');
+ if($item['obj_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');
+
if(! visible_activity($item)) {
continue;
}
@@ -998,13 +1008,28 @@ function like_puller($a, $item, &$arr, $mode) {
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:
return;
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);
if($item['author']['xchan_url'])
$url = chanlink_url($item['author']['xchan_url']);
diff --git a/mod/like.php b/mod/like.php
index b3afd910f..7c328367b 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -49,6 +49,18 @@ function like_content(&$a) {
case 'unabstain':
$activity = ACTIVITY_ABSTAIN;
break;
+ case 'attendyes':
+ case 'unattendyes':
+ $activity = ACTIVITY_ATTEND;
+ break;
+ case 'attendno':
+ case 'unattendno':
+ $activity = ACTIVITY_ATTENDNO;
+ break;
+ case 'attendmaybe':
+ case 'unattendmaybe':
+ $activity = ACTIVITY_ATTENDMAYBE;
+ break;
default:
return;
break;
@@ -300,6 +312,8 @@ function like_content(&$a) {
}
else {
$post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status'));
+ if($item['resource_type'] === 'event')
+ $post_type = t('event');
$links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $item['plink']));
$objtype = (($item['resource_type'] === 'photo') ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
@@ -354,8 +368,12 @@ function like_content(&$a) {
$bodyverb = t('%1$s doesn\'t agree with %2$s\'s %3$s');
if($verb === 'abstain')
$bodyverb = t('%1$s abstains from a decision on %2$s\'s %3$s');
-
-
+ if($verb === 'attendyes')
+ $bodyverb = t('%1$s is attending %2$s\'s %3$s');
+ if($verb === 'attendno')
+ $bodyverb = t('%1$s is not attending %2$s\'s %3$s');
+ if($verb === 'attendmaybe')
+ $bodyverb = t('%1$s may attend %2$s\'s %3$s');
if(! isset($bodyverb))
killme();
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index 95f6bb2b6..e5bbacf53 100755
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -56,13 +56,24 @@
<div class="wall-item-tools">
<div class="wall-item-tools-right btn-group pull-right">
{{if $item.like}}
- <button type="button" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'like'); return false">
- <i class="icon-thumbs-up-alt" title="{{$item.like.0}}"></i>
+ <button type="button" title="{{$item.like.0}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'like'); return false">
+ <i class="icon-thumbs-up-alt" ></i>
</button>
{{/if}}
{{if $item.dislike}}
- <button type="button" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'dislike'); return false">
- <i class="icon-thumbs-down-alt" title="{{$item.dislike.0}}"></i>
+ <button type="button" title="{{$item.dislike.0}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'dislike'); return false">
+ <i class="icon-thumbs-down-alt" ></i>
+ </button>
+ {{/if}}
+ {{if $item.isevent}}
+ <button type="button" title="{{$item.attend.0}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'attendyes'); return false;">
+ <i class="icon-plus" ></i>
+ </button>
+ <button type="button" title="{{$item.attend.1}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'attendno'); return false;">
+ <i class="icon-minus" ></i>
+ </button>
+ <button type="button" title="{{$item.attend.2}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'attendmaybe'); return false;">
+ <i class="icon-question" ></i>
</button>
{{/if}}
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" id="wall-item-menu-{{$item.id}}">
@@ -138,12 +149,12 @@
</div><!-- /.modal -->
{{/if}}
{{/foreach}}
-</div>
+ </div>
{{/if}}
-</div>
+ </div>
<div class="clear"></div>
-
+ </div>
<div class="wall-item-wrapper-end"></div>
<div class="wall-item-outside-wrapper-end {{$item.indent}}" ></div>
</div>