3 * StatusNet, the distributed open-source microblogging tool
5 * common superclass for direct messages inbox and outbox
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Evan Prodromou <evan@status.net>
25 * @copyright 2008 StatusNet, Inc.
26 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
27 * @link http://status.net/
30 if (!defined('STATUSNET') && !defined('LACONICA')) {
35 * common superclass for direct messages inbox and outbox
39 * @author Evan Prodromou <evan@status.net>
40 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
41 * @link http://status.net/
45 class MailboxAction extends Action
49 function prepare($args)
51 parent::prepare($args);
53 $nickname = common_canonical_nickname($this->arg('nickname'));
54 $this->user = User::getKV('nickname', $nickname);
55 $this->page = $this->trimmed('page');
61 common_set_returnto($this->selfUrl());
67 * output page based on arguments
69 * @param array $args HTTP arguments (from $_REQUEST)
73 function handle($args)
75 parent::handle($args);
78 // TRANS: Client error displayed when trying to access a mailbox without providing a user.
79 $this->clientError(_('No such user.'), 404);
83 $cur = common_current_user();
85 if (!$cur || $cur->id != $this->user->id) {
86 // TRANS: Client error displayed when trying to access a mailbox that is not of the logged in user.
87 $this->clientError(_('Only the user can read their own mailboxes.'),
95 function showNoticeForm()
97 $message_form = new MessageForm($this);
98 $message_form->show();
101 function showContent()
103 $message = $this->getMessages();
107 $ml = $this->getMessageList($message);
111 $this->pagination($this->page > 1,
112 $cnt > MESSAGES_PER_PAGE,
114 $this->trimmed('action'),
115 array('nickname' => $this->user->nickname));
119 // TRANS: Message displayed when there are no private messages in the inbox of a user.
120 _('You have no private messages. '.
121 'You can send private message to engage other users in conversation. '.
122 'People can send you messages for your eyes only.'));
126 function getMessages()
131 function getMessageList($message)
137 * Show the page notice
139 * Shows instructions for the page
143 function showPageNotice()
145 $instr = $this->getInstructions();
146 $output = common_markup_to_html($instr);
148 $this->elementStart('div', 'instructions');
150 $this->elementEnd('div');
154 * Mailbox actions are read only
156 * @param array $args other arguments
160 function isReadOnly($args)
165 function showObjectNav()
167 $mm = new MailboxMenu($this);