]> git.mxchange.org Git - friendica.git/commitdiff
port of the event attendance feature of red matrix with example implementation for...
authorrabuzarus <>
Wed, 30 Sep 2015 14:58:02 +0000 (16:58 +0200)
committerrabuzarus <>
Wed, 30 Sep 2015 14:58:02 +0000 (16:58 +0200)
12 files changed:
boot.php
include/conversation.php
include/features.php
mod/editpost.php
mod/item.php
mod/like.php
mod/photos.php
object/Item.php
view/templates/jot-header.tpl
view/templates/jot.tpl
view/theme/vier/style.css
view/theme/vier/templates/wall_thread.tpl

index e3469b55094070f3abdaa4ecb0775f14fed8b1e3..875e5369ed3f486fd4bf57670727eb037da7683b 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -270,9 +270,6 @@ define ( 'NAMESPACE_ATOM1',           'http://www.w3.org/2005/Atom' );
 
 define ( 'ACTIVITY_LIKE',        NAMESPACE_ACTIVITY_SCHEMA . 'like' );
 define ( 'ACTIVITY_DISLIKE',     NAMESPACE_DFRN            . '/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' );
index 0199bee5afa5ff154ef54bc179b1684bebc6995a..c4605cf5d112dc2abde53e87f6a8e823719e64e1 100644 (file)
@@ -344,7 +344,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, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE);
+       $hidden_activities = array(ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE);
        foreach($hidden_activities as $act) {
                if(activity_match($item['verb'],$act)) {
                        return false;
@@ -492,8 +492,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
        $hide_comments_tpl = get_markup_template('hide_comments.tpl');
 
        $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')), 
+               'like' => array('title' => t('Likes','title')), 'dislike' => array('title' => t('Dislikes','title')), 
                'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title'))
        );
 
@@ -930,15 +929,6 @@ function builtin_activity_puller($item, &$conv_responses) {
                        case 'dislike':
                                $verb = ACTIVITY_DISLIKE;
                                break;
-                       case 'agree':
-                               $verb = ACTIVITY_AGREE;
-                               break;
-                       case 'disagree':
-                               $verb = ACTIVITY_DISAGREE;
-                               break;
-                       case 'abstain':
-                               $verb = ACTIVITY_ABSTAIN;
-                               break;
                        case 'attendyes':
                                $verb = ACTIVITY_ATTEND;
                                break;
@@ -991,7 +981,7 @@ function builtin_activity_puller($item, &$conv_responses) {
 // 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', 'attendyes', 'attendno', 'attendmaybe', 'agree', 'disagree', 'abstain'
+// $type = one of 'like, 'dislike', 'attendyes', 'attendno', 'attendmaybe'
 // $id  = item id
 // returns formatted text
 
@@ -1038,15 +1028,6 @@ function format_like($cnt,$arr,$type,$id) {
                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) {
@@ -1103,8 +1084,6 @@ 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',
@@ -1182,9 +1161,6 @@ 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'],
@@ -1400,17 +1376,5 @@ function get_response_button_text($v,$count) {
                case 'attendmaybe':
                        return tt('Undecided','Undecided',$count,'noun');
                        break;
-               case 'agree':
-                       return tt('Agree','Agrees',$count,'noun');
-                       break;
-               case 'disagree':
-                       return tt('Disagree','Disagrees',$count,'noun');
-                       break;
-               case 'abstain':
-                       return tt('Abstain','Abstains',$count,'noun');
-                       break;
-               default:
-                       return '';
-                       break;
        }
 }
index b465fdbe039593eae657cf2666962fd1599912f7..cc26141ac3cf55402b25d7ef39bf5873d1b7ac38 100644 (file)
@@ -31,7 +31,6 @@ 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
index 4a3bdeddfec2106de9974f0ad5caed5e58b6dbcb..c1f23800a37e993f28551e69295fbae0b727e498 100644 (file)
@@ -123,10 +123,6 @@ function editpost_content(&$a) {
                '$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'],
index 3baf618ca8cb92fc3e8c5d44646688236a326a9b..91a94974e9a232cd0b7c1e2a55893fe0ee69c41b 100644 (file)
@@ -51,7 +51,6 @@ 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);
 
 
@@ -656,15 +655,6 @@ 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;
index 522fa8703939332e876be2b7ce3e0378acbce7b5..4f6d6cd6d776833b760203705ba2f543a1824743 100755 (executable)
@@ -26,18 +26,6 @@ function like_content(&$a) {
                case 'undislike':
                        $activity = ACTIVITY_DISLIKE;
                        break;
-               case 'agree':
-               case 'unagree':
-                       $activity = ACTIVITY_AGREE;
-                       break;
-               case 'disagree':
-               case 'undisagree':
-                       $activity = ACTIVITY_DISAGREE;
-                       break;
-               case 'abstain':
-               case 'unabstain':
-                       $activity = ACTIVITY_ABSTAIN;
-                       break;
                case 'attendyes':
                case 'unattendyes':
                        $activity = ACTIVITY_ATTEND;
@@ -134,14 +122,11 @@ function like_content(&$a) {
 
        $verbs = " '".dbesc($activity)."' ";
 
-       // event participation and consensus items are essentially radio toggles. If you make a subsequent choice,
+       // event participation 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
@@ -202,12 +187,6 @@ EOT;
                $bodyverb = t('%1$s likes %2$s\'s %3$s');
        if($verb === 'dislike')
                $bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
-       if($verb === 'agree')
-               $bodyverb = t('%1$s agrees with %2$s\'s %3$s');
-       if($verb === 'disagree')
-               $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')
index 2454f5d51834195f0a24aa750870459bbec020b6..ddfc1f345ac08ac65440e21fe9d266fef322ccc4 100644 (file)
@@ -1603,7 +1603,6 @@ function photos_content(&$a) {
 
                        $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'))
                        );
 
index 4cd0a22528e9d9fdf962287829ad740c50cf6371..283745d34d017edaf519810d52fd320b09321aef 100644 (file)
@@ -189,21 +189,6 @@ class Item extends BaseObject {
                        }
                }
 
-               // 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);
 
                foreach ($response_verbs as $value=>$verbs) {
@@ -322,7 +307,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"],$isevent,$consensus);
+                       unset($buttons["dislike"],$isevent);
                        $tagger = '';
                }
 
@@ -360,9 +345,6 @@ class Item extends BaseObject {
                        'guid' => urlencode($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'),
index 5095dc5d1a78c0d1d708093d45313690862626b7..cb841c314d5194cb610fc9eff36edf7c7c48b268 100644 (file)
@@ -333,17 +333,6 @@ 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();
index 5c60a5c09cf5936ad78dc3cba45af4c29bdaed24..dfc6b2710415fb94b44585e597ef4cedf053ff37 100644 (file)
                <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>
index 526402f2e317c3de6c8ba4208039322541736ff4..2fc68dbb05107261780bedd0510e43bb44c9be6e 100644 (file)
@@ -1348,14 +1348,12 @@ section.minimal {
   margin-bottom: 0.3em;
 }
 .wall-item-container .wall-item-actions-social, 
-.wall-item-container .wall-item-actions-isevent,
-.wall-item-container .wall-item-actions-canvote {
+.wall-item-container .wall-item-actions-isevent {
   float: left;
   margin-bottom: 1px;
 }
 .wall-item-container .wall-item-actions-social a, 
-.wall-item-container .wall-item-actions-isevent a, 
-.wall-item-container .wall-item-actions-canvote a{
+.wall-item-container .wall-item-actions-isevent a {
   float: left;
   margin-right: 1em;
   cursor: pointer;
@@ -1867,11 +1865,6 @@ 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;
index 05fbc14d00dbfcbaeaf51c6bd0c8fb5ed621050c..e6b0de84bd538b6000f3736eec7ba8c16e8d3830 100644 (file)
                        </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}}