minor changes to support forum mode

This commit is contained in:
friendica 2014-11-15 14:03:41 -08:00
parent 87cdfc1751
commit f299922df3
5 changed files with 4342 additions and 4346 deletions

View file

@ -64,8 +64,6 @@ class Item extends BaseObject {
public function get_template_data($alike, $dlike, $thread_level=1) { public function get_template_data($alike, $dlike, $thread_level=1) {
$t1 = dba_timer();
$result = array(); $result = array();
$a = $this->get_app(); $a = $this->get_app();
@ -228,15 +226,12 @@ class Item extends BaseObject {
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
$indent .= ' shiny'; $indent .= ' shiny';
$t2 = dba_timer();
localize_item($item); localize_item($item);
$t3 = dba_timer();
$body = prepare_body($item,true); $body = prepare_body($item,true);
$t4 = dba_timer(); $comment_count_txt = sprintf( tt('%d comment','%d comments',$total_children),$total_children );
$children = $this->get_children();
$tmp_item = array( $tmp_item = array(
'template' => $this->get_template(), 'template' => $this->get_template(),
@ -292,6 +287,8 @@ class Item extends BaseObject {
'drop' => $drop, 'drop' => $drop,
'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''), 'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''),
// end toolbar buttons // end toolbar buttons
'comment_count' => $total_children,
'comment_count_txt' => $comment_count_txt,
'like_count' => $like_count, 'like_count' => $like_count,
'like_list' => $like_list, 'like_list' => $like_list,
'like_list_part' => $like_list_part, 'like_list_part' => $like_list_part,
@ -311,15 +308,12 @@ class Item extends BaseObject {
'thread_level' => $thread_level 'thread_level' => $thread_level
); );
$t5 = dba_timer();
$arr = array('item' => $item, 'output' => $tmp_item); $arr = array('item' => $item, 'output' => $tmp_item);
call_hooks('display_item', $arr); call_hooks('display_item', $arr);
$result = $arr['output']; $result = $arr['output'];
$result['children'] = array(); $result['children'] = array();
$children = $this->get_children();
$nb_children = count($children); $nb_children = count($children);
if($nb_children > 0) { if($nb_children > 0) {
foreach($children as $child) { foreach($children as $child) {
@ -328,7 +322,7 @@ class Item extends BaseObject {
// Collapse // Collapse
if(($nb_children > 2) || ($thread_level > 1)) { if(($nb_children > 2) || ($thread_level > 1)) {
$result['children'][0]['comment_firstcollapsed'] = true; $result['children'][0]['comment_firstcollapsed'] = true;
$result['children'][0]['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children ); $result['children'][0]['num_comments'] = $comment_count_txt;
$result['children'][0]['hide_text'] = t('[+] show all'); $result['children'][0]['hide_text'] = t('[+] show all');
if($thread_level > 1) { if($thread_level > 1) {
$result['children'][$nb_children - 1]['comment_lastcollapsed'] = true; $result['children'][$nb_children - 1]['comment_lastcollapsed'] = true;
@ -350,14 +344,6 @@ class Item extends BaseObject {
$result['flatten'] = true; $result['flatten'] = true;
$result['threaded'] = false; $result['threaded'] = false;
} }
$t6 = dba_timer();
// profiler($t1,$t2,'t2');
// profiler($t2,$t3,'t3');
// profiler($t3,$t4,'t4');
// profiler($t4,$t5,'t5');
// profiler($t5,$t6,'t6');
// profiler($t1,$t6,'item total');
return $result; return $result;
} }

View file

@ -853,8 +853,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
profiler($t3,$t4,'conversation template'); profiler($t3,$t4,'conversation template');
} }
if($page_mode === 'preview') // if($page_mode === 'preview')
logger('preview: ' . $o); // logger('preview: ' . $o, LOGGER_DATA);
return $o; return $o;

View file

@ -43,10 +43,6 @@ function wall_upload_post(&$a) {
killme(); killme();
} }
$m = $ret['body'];
if($using_api) if($using_api)
return("\n\n" . $ret['body'] . "\n\n"); return("\n\n" . $ret['body'] . "\n\n");
else else

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
2014-11-13.858 2014-11-15.860