]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/conversationreplies.php
Logic to have group joins turn into pending joins automatically when group is set...
[quix0rs-gnu-social.git] / actions / conversationreplies.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  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
11  * @link     http://status.net/
12  *
13  * StatusNet - the distributed open-source microblogging tool
14  * Copyright (C) 2009, StatusNet, Inc.
15  *
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.
20  *
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.
25  *
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/>.
28  */
29
30 if (!defined('STATUSNET') && !defined('LACONICA')) {
31     exit(1);
32 }
33
34 // XXX: not sure how to do paging yet,
35 // so set a 60-notice limit
36
37 require_once INSTALLDIR.'/lib/noticelist.php';
38
39 /**
40  * Conversation tree in the browser
41  *
42  * @category Action
43  * @package  StatusNet
44  * @author   Evan Prodromou <evan@status.net>
45  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
46  * @link     http://status.net/
47  */
48 class ConversationRepliesAction extends ConversationAction
49 {
50     function handle($args)
51     {
52         if ($this->boolean('ajax')) {
53             $this->showAjax();
54         } else {
55             parent::handle($args);
56         }
57     }
58
59     /**
60      * Show content.
61      *
62      * Display a hierarchical unordered list in the content area.
63      * Uses ConversationTree to do most of the heavy lifting.
64      *
65      * @return void
66      */
67     function showContent()
68     {
69         $notices = Notice::conversationStream($this->id, null, null);
70
71         $ct = new FullThreadedNoticeList($notices, $this);
72
73         $cnt = $ct->show();
74     }
75
76     function showAjax()
77     {
78         header('Content-Type: text/xml;charset=utf-8');
79         $this->xw->startDocument('1.0', 'UTF-8');
80         $this->elementStart('html');
81         $this->elementStart('head');
82         // TRANS: Title for conversation page.
83         $this->element('title', null, _m('TITLE','Notice'));
84         $this->elementEnd('head');
85         $this->elementStart('body');
86         $this->showContent();
87         $this->elementEnd('body');
88         $this->elementEnd('html');
89     }
90 }
91
92 class FullThreadedNoticeList extends ThreadedNoticeList
93 {
94     function newListItem($notice)
95     {
96         return new FullThreadedNoticeListItem($notice, $this->out);
97     }
98 }
99
100 class FullThreadedNoticeListItem extends ThreadedNoticeListItem
101 {
102     function initialItems()
103     {
104         return 1000; // @fixme
105     }
106 }