]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/conversation.php
[CORE][UI][ROUTER] Added view action, which inlines images and videos but downloads...
[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')) {
32     exit(1);
33 }
34
35 /**
36  * Conversation tree in the browser
37  *
38  * Will always try to show the entire conversation, since that's how our
39  * ConversationNoticeStream works.
40  *
41  * @category Action
42  * @package  StatusNet
43  * @author   Evan Prodromou <evan@status.net>
44  * @author   Mikael Nordfeldth <mmn@hethane.se>
45  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
46  * @link     http://status.net/
47  */
48 class ConversationAction extends ManagedAction
49 {
50     protected $redirectAfterLogin = true;
51     
52     public $conv        = null;
53     public $page        = null;
54     public $notices     = null;
55
56     protected function doPreparation()
57     {
58         $this->conv = Conversation::getByID($this->int('id'));
59     }
60
61     /**
62      * Returns the page title
63      *
64      * @return string page title
65      */
66     public function title()
67     {
68         // TRANS: Title for page with a conversion (multiple notices in context).
69         return _('Conversation');
70     }
71
72     /**
73      * Show content.
74      *
75      * NoticeList extended classes do most heavy lifting. Plugins can override.
76      *
77      * @return void
78      */
79     public function showContent()
80     {
81         if (Event::handle('StartShowConversation', [$this, $this->conv, $this->scoped])) {
82             $notices = $this->conv->getNotices($this->scoped);
83             $nl = new FullThreadedNoticeList($notices, $this, $this->scoped);
84             $cnt = $nl->show();
85         }
86         Event::handle('EndShowConversation', [$this, $this->conv, $this->scoped]);
87     }
88
89     public function isReadOnly($args)
90     {
91         return true;
92     }
93     
94     public function getFeeds()
95     {
96         return [
97             new Feed(Feed::JSON,
98                      common_local_url('apiconversation',
99                                       ['id' => $this->conv->getID(),
100                                        'format' => 'as']),
101                      // TRANS: Title for link to notice feed.
102                      // TRANS: %s is a user nickname.
103                      _('Conversation feed (Activity Streams JSON)')
104             ),
105             new Feed(Feed::RSS2,
106                      common_local_url('apiconversation',
107                                       ['id' => $this->conv->getID(),
108                                        'format' => 'rss']),
109                      // TRANS: Title for link to notice feed.
110                      // TRANS: %s is a user nickname.
111                      _('Conversation feed (RSS 2.0)')
112             ),
113             new Feed(Feed::ATOM,
114                      common_local_url('apiconversation',
115                                       ['id' => $this->conv->getID(),
116                                        'format' => 'atom']),
117                      // TRANS: Title for link to notice feed.
118                      // TRANS: %s is a user nickname.
119                      _('Conversation feed (Atom)')
120             )
121         ];
122     }
123 }