aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/ItemObject.php4
-rw-r--r--include/conversation.php5
-rw-r--r--include/features.php1
-rwxr-xr-xinclude/items.php4
-rw-r--r--mod/editpost.php6
-rw-r--r--mod/item.php5
-rwxr-xr-xview/tpl/conv_item.tpl13
-rwxr-xr-xview/tpl/conv_list.tpl12
-rwxr-xr-xview/tpl/jot-header.tpl10
-rwxr-xr-xview/tpl/jot.tpl6
10 files changed, 63 insertions, 3 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 3638b2ffb..7f5ee83a3 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -148,11 +148,13 @@ class Item extends BaseObject {
$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) {
$response_verbs[] = 'agree';
$response_verbs[] = 'disagree';
$response_verbs[] = 'abstain';
+ $conlabels = array( t('I agree'), t('I disagree'), t('I abstain'));
}
$responses = get_responses($conv_responses,$response_verbs,$this,$item);
@@ -280,6 +282,8 @@ class Item extends BaseObject {
'id' => $this->get_id(),
'isevent' => $isevent,
'attend' => $attend,
+ 'consensus' => $consensus,
+ 'conlabels' => $conlabels,
'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 4da6636fa..2c89249cb 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1085,6 +1085,8 @@ function status_editor($a,$x,$popup=false) {
// if(feature_enabled(local_channel(),'richtext'))
// $plaintext = false;
+ $voting = feature_enabled(local_channel(),'consensus_tools');
+
$mimeselect = '';
if(array_key_exists('mimetype',$x) && $x['mimetype']) {
if($x['mimetype'] != 'text/bbcode')
@@ -1176,6 +1178,9 @@ function status_editor($a,$x,$popup=false) {
'$shortaudio' => t('audio link'),
'$setloc' => t('Set your location'),
'$shortsetloc' => t('set location'),
+ '$voting' => t('Toggle voting'),
+ '$feature_voting' => $voting,
+ '$consensus' => 0,
'$noloc' => ((get_pconfig($x['profile_uid'],'system','use_browser_location')) ? t('Clear browser location') : ''),
'$shortnoloc' => t('clear location'),
'$title' => ((x($x,'title')) ? htmlspecialchars($x['title'], ENT_COMPAT,'UTF-8') : ''),
diff --git a/include/features.php b/include/features.php
index 6b4bc34c6..fc14858a8 100644
--- a/include/features.php
+++ b/include/features.php
@@ -60,6 +60,7 @@ function get_features() {
array('large_photos', t('Large Photos'), t('Include large (640px) photo thumbnails in posts. If not enabled, use small (320px) photo thumbnails'),false),
array('channel_sources', t('Channel Sources'), t('Automatically import channel content from other channels or feeds'),false),
array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key'),false),
+ array('consensus_tools', t('Enable voting tools'), t('Provide a class of post which others can vote on'),false),
array('adult_photo_flagging', t('Flag Adult Photos'), t('Provide photo edit option to hide adult photos from default album view'),false),
),
diff --git a/include/items.php b/include/items.php
index 0b2106572..2207635b6 100755
--- a/include/items.php
+++ b/include/items.php
@@ -843,9 +843,9 @@ function get_item_elements($x) {
if(array_key_exists('flags',$x) && in_array('deleted',$x['flags']))
- $arr['item_restrict'] = ITEM_DELETED;
+ $arr['item_restrict'] |= ITEM_DELETED;
if(array_key_exists('flags',$x) && in_array('hidden',$x['flags']))
- $arr['item_restrict'] = ITEM_HIDDEN;
+ $arr['item_restrict'] |= ITEM_HIDDEN;
// Here's the deal - the site might be down or whatever but if there's a new person you've never
// seen before sending stuff to your stream, we MUST be able to look them up and import their data from their
diff --git a/mod/editpost.php b/mod/editpost.php
index 1d9855c95..bdd3be450 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -74,7 +74,8 @@ function editpost_content(&$a) {
$channel = $a->get_channel();
//$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
-
+
+ $voting = feature_enabled(local_channel(),'consensus_tools');
$category = '';
$catsenabled = ((feature_enabled(local_channel(),'categories')) ? 'categories' : '');
@@ -118,6 +119,9 @@ function editpost_content(&$a) {
'$audio' => t('Insert Vorbis [.ogg] audio'),
'$setloc' => t('Set your location'),
'$noloc' => t('Clear browser location'),
+ '$voting' => t('Toggle voting'),
+ '$feature_voting' => $voting,
+ '$consensus' => (($itm[0]['item_flags'] & ITEM_CONSENSUS) ? 1 : 0),
'$wait' => t('Please wait'),
'$permset' => t('Permission settings'),
'$ptyp' => $itm[0]['type'],
diff --git a/mod/item.php b/mod/item.php
index 6ae02b510..ef0491895 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -59,6 +59,8 @@ function item_post(&$a) {
$api_source = ((x($_REQUEST,'api_source') && $_REQUEST['api_source']) ? true : false);
+ $consensus = intval($_REQUEST['consensus']);
+
// 'origin' (if non-zero) indicates that this network is where the message originated,
// for the purpose of relaying comments to other conversation members.
// If using the API from a device (leaf node) you must set origin to 1 (default) or leave unset.
@@ -683,6 +685,9 @@ function item_post(&$a) {
$item_flags = $item_flags | ITEM_THREAD_TOP;
}
+ if($consensus)
+ $item_flags |= ITEM_CONSENSUS;
+
if ((! $plink) && ($item_flags & ITEM_THREAD_TOP)) {
$plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid;
}
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index df20eadbb..a902e5bda 100755
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -76,6 +76,19 @@
<i class="icon-question" ></i>
</button>
{{/if}}
+
+ {{if $item.consensus}}
+ <button type="button" title="{{$item.conlabels.0}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'agree'); return false;">
+ <i class="icon-check" ></i>
+ </button>
+ <button type="button" title="{{$item.conlabels.1}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'disagree'); return false;">
+ <i class="icon-check-empty" ></i>
+ </button>
+ <button type="button" title="{{$item.conlabels.2}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'abstain'); 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}}">
<i class="icon-caret-down"></i>
</button>
diff --git a/view/tpl/conv_list.tpl b/view/tpl/conv_list.tpl
index ad086ee0a..8d454f1eb 100755
--- a/view/tpl/conv_list.tpl
+++ b/view/tpl/conv_list.tpl
@@ -78,6 +78,18 @@
</button>
{{/if}}
+ {{if $item.consensus}}
+ <button type="button" title="{{$item.conlabels.0}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'agree'); return false;">
+ <i class="icon-plus" ></i>
+ </button>
+ <button type="button" title="{{$item.conlabels.1}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'disagree'); return false;">
+ <i class="icon-minus" ></i>
+ </button>
+ <button type="button" title="{{$item.conlabels.2}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'abstain'); 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}}">
<i class="icon-caret-down"></i>
</button>
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index 678d16a71..8daf2ddb7 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -309,6 +309,16 @@ function enableOnUser(){
timer = setTimeout(NavUpdate,1000);
}
+ 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('');
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index 00ef77d93..f32dba095 100755
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -11,6 +11,7 @@
<input type="hidden" name="post_id" value="{{$post_id}}" />
<input type="hidden" name="webpage" value="{{$webpage}}" />
<input type="hidden" name="preview" id="jot-preview" value="0" />
+ <input type="hidden" id="jot-consensus" name="consensus" value="{{if $consensus}}{{$consensus}}{{else}}0{{/if}}" />
{{if $showacl}}{{$acl}}{{/if}}
{{$mimeselect}}
{{$layoutselect}}
@@ -77,6 +78,11 @@
<i id="profile-encrypt" class="icon-key jot-icons"></i>
</button>
{{/if}}
+ {{if $feature_voting}}
+ <button id="profile-voting-wrapper" class="btn btn-default btn-sm" title="{{$voting}}" onclick="toggleVoting();return false;">
+ <i id="profile-voting" class="icon-check-empty jot-icons"></i>
+ </button>
+ {{/if}}
</div>
</div>
<div id="profile-rotator-wrapper">