mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-17 04:15:15 +02:00
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
|
@ -93,15 +93,16 @@ function editpost_content(&$a) {
|
|||
$jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
|
||||
. t("Post to Email") . '</div>';
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
call_hooks('jot_tool', $jotplugins);
|
||||
//call_hooks('jot_networks', $jotnets);
|
||||
|
||||
|
||||
//$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
|
||||
|
||||
//$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'])
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue