]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/DirectMessage/lib/inboxmessagelist.php
Merged
[quix0rs-gnu-social.git] / plugins / DirectMessage / lib / inboxmessagelist.php
1 <?php
2
3 if (!defined('GNUSOCIAL')) { exit(1); }
4
5 class InboxMessageList extends MessageList
6 {
7 <<<<<<< .merge_file_NIw5Kk
8     function newItem($message)
9 =======
10     var $page = null;
11
12     function prepare(array $args=array())
13     {
14         parent::prepare($args);
15
16         $nickname   = common_canonical_nickname($this->arg('nickname'));
17         $this->user = User::getKV('nickname', $nickname);
18         $this->page = $this->trimmed('page');
19
20         if (!$this->page) {
21             $this->page = 1;
22         }
23
24         common_set_returnto($this->selfUrl());
25
26         return true;
27     }
28
29     /**
30      * output page based on arguments
31      *
32      * @param array $args HTTP arguments (from $_REQUEST)
33      *
34      * @return void
35      */
36     function handle(array $args=array())
37     {
38         parent::handle($args);
39
40         if (!$this->user) {
41             // TRANS: Client error displayed when trying to access a mailbox without providing a user.
42             $this->clientError(_('No such user.'), 404);
43         }
44
45         $cur = common_current_user();
46
47         if (!$cur || $cur->id != $this->user->id) {
48             // TRANS: Client error displayed when trying to access a mailbox that is not of the logged in user.
49             $this->clientError(_('Only the user can read their own mailboxes.'), 403);
50         }
51
52         $this->showPage();
53     }
54
55     function showNoticeForm()
56     {
57         $message_form = new MessageForm($this);
58         $message_form->show();
59     }
60
61     function showContent()
62     {
63         $message = $this->getMessages();
64
65         if ($message) {
66
67             $ml = $this->getMessageList($message);
68
69             $cnt = $ml->show();
70
71             $this->pagination($this->page > 1,
72                               $cnt > MESSAGES_PER_PAGE,
73                               $this->page,
74                               $this->trimmed('action'),
75                               array('nickname' => $this->user->nickname));
76         } else {
77             $this->element('p',
78                            'guide',
79                            // TRANS: Message displayed when there are no private messages in the inbox of a user.
80                            _('You have no private messages. '.
81                              'You can send private message to engage other users in conversation. '.
82                              'People can send you messages for your eyes only.'));
83         }
84     }
85
86     function getMessages()
87     {
88         return null;
89     }
90
91     function getMessageList($message)
92     {
93         return null;
94     }
95
96     /**
97      * Show the page notice
98      *
99      * Shows instructions for the page
100      *
101      * @return void
102      */
103     function showPageNotice()
104     {
105         $instr  = $this->getInstructions();
106         $output = common_markup_to_html($instr);
107
108         $this->elementStart('div', 'instructions');
109         $this->raw($output);
110         $this->elementEnd('div');
111     }
112
113     /**
114      * Mailbox actions are read only
115      *
116      * @param array $args other arguments
117      *
118      * @return boolean
119      */
120     function isReadOnly(array $args=array())
121     {
122          return true;
123     }
124
125     function showObjectNav()
126 >>>>>>> .merge_file_WapUGk
127     {
128         return new InboxMessageListItem($this->out, $message);
129     }
130 }