3 * Display a conversation in the browser
9 * @author Evan Prodromou <evan@status.net>
10 * @author Mikael Nordfeldth <mmn@hethane.se>
11 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
12 * @link http://status.net/
14 * StatusNet - the distributed open-source microblogging tool
15 * Copyright (C) 2009, StatusNet, Inc.
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU Affero General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Affero General Public License for more details.
27 * You should have received a copy of the GNU Affero General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 if (!defined('GNUSOCIAL')) { exit(1); }
34 * Conversation tree in the browser
36 * Will always try to show the entire conversation, since that's how our
37 * ConversationNoticeStream works.
41 * @author Evan Prodromou <evan@status.net>
42 * @author Mikael Nordfeldth <mmn@hethane.se>
43 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
44 * @link http://status.net/
46 class ConversationAction extends ManagedAction
55 * @param array $args Web and URL arguments
57 * @return boolean false if id not passed in
59 protected function prepare(array $args=array())
61 parent::prepare($args);
62 $convId = $this->int('id');
64 $this->conv = Conversation::getKV('id', $convId);
65 if (!$this->conv instanceof Conversation) {
66 throw new ClientException('Could not find specified conversation');
73 * Returns the page title
75 * @return string page title
79 // TRANS: Title for page with a conversion (multiple notices in context).
80 return _('Conversation');
86 * NoticeList extended classes do most heavy lifting. Plugins can override.
90 function showContent()
92 if (Event::handle('StartShowConversation', array($this, $this->conv, $this->scoped))) {
93 $notices = $this->conv->getNotices();
94 $nl = new FullThreadedNoticeList($notices, $this, $this->scoped);
97 Event::handle('EndShowConversation', array($this, $this->conv, $this->scoped));
100 function isReadOnly($args)
108 return array(new Feed(Feed::JSON,
109 common_local_url('apiconversation',
111 'id' => $this->conv->id,
113 // TRANS: Title for link to notice feed.
114 // TRANS: %s is a user nickname.
115 _('Conversation feed (Activity Streams JSON)')),
117 common_local_url('apiconversation',
119 'id' => $this->conv->id,
121 // TRANS: Title for link to notice feed.
122 // TRANS: %s is a user nickname.
123 _('Conversation feed (RSS 2.0)')),
125 common_local_url('apiconversation',
127 'id' => $this->conv->id,
128 'format' => 'atom')),
129 // TRANS: Title for link to notice feed.
130 // TRANS: %s is a user nickname.
131 _('Conversation feed (Atom)')));