3 * Display a conversation in the browser
9 * @author Evan Prodromou <evan@controlyourself.ca>
10 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
11 * @link http://laconi.ca/
13 * Laconica - a distributed open-source microblogging tool
14 * Copyright (C) 2008, Controlez-Vous, Inc.
16 * This program is free software: you can redistribute it and/or modify
17 * it under the terms of the GNU Affero General Public License as published by
18 * the Free Software Foundation, either version 3 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU Affero General Public License for more details.
26 * You should have received a copy of the GNU Affero General Public License
27 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 if (!defined('LACONICA')) {
34 require_once(INSTALLDIR.'/lib/noticelist.php');
37 * Conversation tree in the browser
41 * @author Evan Prodromou <evan@controlyourself.ca>
42 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
43 * @link http://laconi.ca/
45 class ConversationAction extends Action
53 * @param array $args Web and URL arguments
55 * @return boolean false if id not passed in
58 function prepare($args)
60 parent::prepare($args);
61 $this->id = $this->trimmed('id');
62 if (empty($this->id)) {
65 $this->page = $this->trimmed('page');
66 if (empty($this->page)) {
72 function handle($args)
74 parent::handle($args);
80 return _("Conversation");
83 function showContent()
85 // FIXME this needs to be a tree, not a list
87 $qry = 'SELECT * FROM notice WHERE conversation = %s ';
89 $offset = ($this->page-1)*NOTICES_PER_PAGE;
90 $limit = NOTICES_PER_PAGE + 1;
92 $txt = sprintf($qry, $this->id);
94 $notices = Notice::getStream($txt,
95 'notice:conversation:'.$this->id,
98 $nl = new NoticeList($notices, $this);
102 $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
103 $this->page, 'conversation', array('id' => $this->id));