diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-04-03 16:12:33 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-04-03 16:12:33 -0400 |
commit | fa3ca0548f12a7a8f7774cfa918cba426be45f96 (patch) | |
tree | 0908ecae3dbfe2782f8c1bced923f8bb4b032569 /actions/conversation.php | |
parent | 68ae2821982728290d6c3d12657ea5ff567cd602 (diff) |
fix output of conversation
Diffstat (limited to 'actions/conversation.php')
-rw-r--r-- | actions/conversation.php | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/actions/conversation.php b/actions/conversation.php index 0c22fe123..05cfb76e3 100644 --- a/actions/conversation.php +++ b/actions/conversation.php @@ -31,6 +31,8 @@ if (!defined('LACONICA')) { exit(1); } +require_once(INSTALLDIR.'/lib/noticelist.php'); + /** * Conversation tree in the browser * @@ -43,7 +45,6 @@ if (!defined('LACONICA')) { class ConversationAction extends Action { var $id = null; - var $notices = null; var $page = null; /** @@ -58,10 +59,9 @@ class ConversationAction extends Action { parent::prepare($args); $this->id = $this->trimmed('id'); - if (!$this->id) { + if (empty($this->id)) { return false; } - $this->notices = $this->getNotices(); $this->page = $this->trimmed('page'); if (empty($this->page)) { $this->page = 1; @@ -69,36 +69,9 @@ class ConversationAction extends Action return true; } - /** - * Get notices - * - * @param integer $limit max number of notices to return - * - * @return array notices - */ - - function getNotices($limit=0) - { - $qry = 'SELECT notice.*, '. - 'FROM notice WHERE conversation = %d '. - 'ORDER BY created '; - - $offset = 0; - $limit = NOTICES_PER_PAGE + 1; - - if (common_config('db', 'type') == 'pgsql') { - $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; - } else { - $qry .= ' LIMIT ' . $offset . ', ' . $limit; - } - - return Notice::getStream(sprintf($qry, $this->id), - 'notice:conversation:'.$this->id, - $offset, $limit); - } - function handle($args) { + parent::handle($args); $this->showPage(); } @@ -111,7 +84,18 @@ class ConversationAction extends Action { // FIXME this needs to be a tree, not a list - $nl = new NoticeList($this->notices, $this); + $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); + + $nl = new NoticeList($notices, $this); $cnt = $nl->show(); |