diff --git a/include/conversation.php b/include/conversation.php index 263c820ff4..ebe582f4ce 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -140,6 +140,11 @@ function conversation(&$a, $items, $mode, $update) { $alike = array(); $dlike = array(); + + // array with html for each thread (parent+comments) + $treads = array(); + $treadsid = -1; + if(count($items)) { if($mode === 'network-new' || $mode === 'search' || $mode === 'community') { @@ -150,6 +155,7 @@ function conversation(&$a, $items, $mode, $update) { $tpl = get_markup_template('search_item.tpl'); foreach($items as $item) { + $treadsid++; $comment = ''; $owner_url = ''; @@ -191,21 +197,30 @@ function conversation(&$a, $items, $mode, $update) { $location = '' . $coord . ''; } - $drop = ''; localize_item($item); if($mode === 'network-new') - $t = "#TODO:drop#"; //$droptpl; + $dropping = true; else - $t = "#TODO:fakedrop#"; //$fakedrop; + $dropping = false; - $drop = replace_macros($t,array('$id' => $item['id'])); - $lock = '
'; - $star = ''; + + $drop = array( + 'dropping' => $dropping, + 'select' => t('Select'), + 'delete' => t('Delete'), + ); + + $star = false; + $isstarred = "unstarred"; + + $lock = false; + $likebuttons = false; + $shareable = false; $body = prepare_body($item,true); - $o .= replace_macros($tpl,array( + $treads[$treadsid] .= replace_macros($tpl,array( '$id' => $item['item_id'], '$linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])), '$profile_url' => $profile_link, @@ -217,332 +232,335 @@ function conversation(&$a, $items, $mode, $update) { '$title' => template_escape($item['title']), '$body' => template_escape($body), '$ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])), + '$lock' => $lock, '$location' => template_escape($location), '$indent' => '', + '$owner_name' => template_escape($owner_name), '$owner_url' => $owner_url, '$owner_photo' => $owner_photo, - '$owner_name' => template_escape($owner_name), + '$plink' => get_plink($item), + '$edpost' => false, + '$isstarred' => $isstarred, '$star' => $star, '$drop' => $drop, - '$conv' => '' . t('View in context') . '' + '$vote' => $likebuttons, + '$like' => '', + '$dislike' => '', + '$comment' => '', + '$conv' => array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context')), + '$wait' => t('Please wait'), )); } - return $o; } + else + { + // Normal View + // Figure out how many comments each parent has + // (Comments all have gravity of 6) + // Store the result in the $comments array - - // Normal View - - - // Figure out how many comments each parent has - // (Comments all have gravity of 6) - // Store the result in the $comments array - - $comments = array(); - foreach($items as $item) { - if((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) { - if(! x($comments,$item['parent'])) - $comments[$item['parent']] = 1; - else - $comments[$item['parent']] += 1; + $comments = array(); + foreach($items as $item) { + if((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) { + if(! x($comments,$item['parent'])) + $comments[$item['parent']] = 1; + else + $comments[$item['parent']] += 1; + } } - } - // map all the like/dislike activities for each parent item - // Store these in the $alike and $dlike arrays + // map all the like/dislike activities for each parent item + // Store these in the $alike and $dlike arrays - foreach($items as $item) { - like_puller($a,$item,$alike,'like'); - like_puller($a,$item,$dlike,'dislike'); - } + foreach($items as $item) { + like_puller($a,$item,$alike,'like'); + like_puller($a,$item,$dlike,'dislike'); + } - $comments_collapsed = false; - $blowhard = 0; - $blowhard_count = 0; + $comments_collapsed = false; + $blowhard = 0; + $blowhard_count = 0; - // array with html for each thread (parent+comments) - $treads = array(); - $treadsid = -1; - foreach($items as $item) { + foreach($items as $item) { - $comment = ''; - $template = $tpl; - $commentww = ''; - $sparkle = ''; - $owner_url = $owner_photo = $owner_name = ''; + $comment = ''; + $template = $tpl; + $commentww = ''; + $sparkle = ''; + $owner_url = $owner_photo = $owner_name = ''; - // We've already parsed out like/dislike for special treatment. We can ignore them now + // We've already parsed out like/dislike for special treatment. We can ignore them now - if(((activity_match($item['verb'],ACTIVITY_LIKE)) - || (activity_match($item['verb'],ACTIVITY_DISLIKE))) - && ($item['id'] != $item['parent'])) - continue; + if(((activity_match($item['verb'],ACTIVITY_LIKE)) + || (activity_match($item['verb'],ACTIVITY_DISLIKE))) + && ($item['id'] != $item['parent'])) + continue; - $toplevelpost = (($item['id'] == $item['parent']) ? true : false); - $toplevelprivate = false; + $toplevelpost = (($item['id'] == $item['parent']) ? true : false); + $toplevelprivate = false; - // Take care of author collapsing and comment collapsing - // If a single author has more than 3 consecutive top-level posts, squash the remaining ones. - // If there are more than two comments, squash all but the last 2. - - if($toplevelpost) { - $toplevelprivate = (($toplevelpost && $item['private']) ? true : false); - $item_writeable = (($item['writable'] || $item['self']) ? true : false); + // Take care of author collapsing and comment collapsing + // If a single author has more than 3 consecutive top-level posts, squash the remaining ones. + // If there are more than two comments, squash all but the last 2. + + if($toplevelpost) { + $toplevelprivate = (($toplevelpost && $item['private']) ? true : false); + $item_writeable = (($item['writable'] || $item['self']) ? true : false); - /*if($blowhard == $item['cid'] && (! $item['self']) && ($mode != 'profile') && ($mode != 'notes')) { - $blowhard_count ++; - if($blowhard_count == 3) { - $o .= '