summaryrefslogtreecommitdiff
path: root/actions/conversation.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/conversation.php')
-rw-r--r--actions/conversation.php55
1 files changed, 24 insertions, 31 deletions
diff --git a/actions/conversation.php b/actions/conversation.php
index 0d7cb9a87..79197da2d 100644
--- a/actions/conversation.php
+++ b/actions/conversation.php
@@ -63,6 +63,7 @@ class ConversationAction extends Action
if (empty($this->id)) {
return false;
}
+ $this->id = $this->id+0;
$this->page = $this->trimmed('page');
if (empty($this->page)) {
$this->page = 1;
@@ -106,27 +107,12 @@ class ConversationAction extends Action
function showContent()
{
- // FIXME this needs to be a tree, not a list
-
- $qry = 'SELECT * FROM notice WHERE conversation = %s ';
-
- $offset = ($this->page-1) * NOTICES_PER_PAGE;
- $limit = NOTICES_PER_PAGE + 1;
-
- $txt = sprintf($qry, $this->id);
-
- $notices = Notice::getStream($txt,
- 'notice:conversation:'.$this->id,
- $offset, $limit);
+ $notices = Notice::conversationStream($this->id);
$ct = new ConversationTree($notices, $this);
$cnt = $ct->show();
-
- $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
- $this->page, 'conversation', array('id' => $this->id));
}
-
}
/**
@@ -156,6 +142,25 @@ class ConversationTree extends NoticeList
{
$cnt = 0;
+ $this->_buildTree();
+
+ $this->out->elementStart('div', array('id' =>'notices_primary'));
+ $this->out->element('h2', null, _('Notices'));
+ $this->out->elementStart('ol', array('class' => 'notices xoxo'));
+
+ if (array_key_exists('root', $this->tree)) {
+ $rootid = $this->tree['root'][0];
+ $this->showNoticePlus($rootid);
+ }
+
+ $this->out->elementEnd('ol');
+ $this->out->elementEnd('div');
+
+ return $cnt;
+ }
+
+ function _buildTree()
+ {
$this->tree = array();
$this->table = array();
@@ -176,20 +181,6 @@ class ConversationTree extends NoticeList
$this->tree[$notice->reply_to] = array($notice->id);
}
}
-
- $this->out->elementStart('div', array('id' =>'notices_primary'));
- $this->out->element('h2', null, _('Notices'));
- $this->out->elementStart('ol', array('class' => 'notices xoxo'));
-
- if (array_key_exists('root', $this->tree)) {
- $rootid = $this->tree['root'][0];
- $this->showNoticePlus($rootid);
- }
-
- $this->out->elementEnd('ol');
- $this->out->elementEnd('div');
-
- return $cnt;
}
/**
@@ -207,7 +198,7 @@ class ConversationTree extends NoticeList
// We take responsibility for doing the li
$this->out->elementStart('li', array('class' => 'hentry notice',
- 'id' => 'notice-' . $this->notice->id));
+ 'id' => 'notice-' . $id));
$item = $this->newListItem($notice);
$item->show();
@@ -217,6 +208,8 @@ class ConversationTree extends NoticeList
$this->out->elementStart('ol', array('class' => 'notices'));
+ sort($children);
+
foreach ($children as $child) {
$this->showNoticePlus($child);
}