]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/conversation.php
84178982e61e01b6a32725e5931338c3e5195ca7
[quix0rs-gnu-social.git] / actions / conversation.php
1 <?php
2 /**
3  * Display a conversation in the browser
4  *
5  * PHP version 5
6  *
7  * @category Action
8  * @package  StatusNet
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/
13  *
14  * StatusNet - the distributed open-source microblogging tool
15  * Copyright (C) 2009, StatusNet, Inc.
16  *
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.
21  *
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.
26  *
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/>.
29  */
30
31 if (!defined('GNUSOCIAL')) { exit(1); }
32
33 /**
34  * Conversation tree in the browser
35  *
36  * Will always try to show the entire conversation, since that's how our
37  * ConversationNoticeStream works.
38  *
39  * @category Action
40  * @package  StatusNet
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/
45  */
46 class ConversationAction extends ManagedAction
47 {
48     var $conv        = null;
49     var $page        = null;
50     var $notices     = null;
51
52     protected function doPreparation()
53     {
54         $this->conv = Conversation::getByID($this->int('id'));
55     }
56
57     /**
58      * Returns the page title
59      *
60      * @return string page title
61      */
62     function title()
63     {
64         // TRANS: Title for page with a conversion (multiple notices in context).
65         return _('Conversation');
66     }
67
68     /**
69      * Show content.
70      *
71      * NoticeList extended classes do most heavy lifting. Plugins can override.
72      *
73      * @return void
74      */
75     function showContent()
76     {
77         if (Event::handle('StartShowConversation', array($this, $this->conv, $this->scoped))) {
78             $notices = $this->conv->getNotices($this->scoped);
79             $nl = new FullThreadedNoticeList($notices, $this, $this->scoped);
80             $cnt = $nl->show();
81         }
82         Event::handle('EndShowConversation', array($this, $this->conv, $this->scoped));
83     }
84
85     function isReadOnly($args)
86     {
87         return true;
88     }
89     
90     function getFeeds()
91     {
92         
93         return array(new Feed(Feed::JSON,
94                               common_local_url('apiconversation',
95                                                array(
96                                                     'id' => $this->conv->getID(),
97                                                     'format' => 'as')),
98                               // TRANS: Title for link to notice feed.
99                               // TRANS: %s is a user nickname.
100                               _('Conversation feed (Activity Streams JSON)')),
101                      new Feed(Feed::RSS2,
102                               common_local_url('apiconversation',
103                                                array(
104                                                     'id' => $this->conv->getID(),
105                                                     'format' => 'rss')),
106                               // TRANS: Title for link to notice feed.
107                               // TRANS: %s is a user nickname.
108                               _('Conversation feed (RSS 2.0)')),
109                      new Feed(Feed::ATOM,
110                               common_local_url('apiconversation',
111                                                array(
112                                                     'id' => $this->conv->getID(),
113                                                     'format' => 'atom')),
114                               // TRANS: Title for link to notice feed.
115                               // TRANS: %s is a user nickname.
116                               _('Conversation feed (Atom)')));
117     }
118 }
119