3 * StatusNet, the distributed open-source microblogging tool
5 * Form for posting a notice from within the Facebook App.
7 * This is a stripped down version of the normal NoticeForm (sans
8 * location stuff and media upload stuff). I'm not sure we can share the
9 * location (from FB) and they don't allow posting multipart form data
10 * to Facebook canvas pages, so that won't work anyway. --Zach
14 * LICENCE: This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Affero General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Affero General Public License for more details.
24 * You should have received a copy of the GNU Affero General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 * @author Evan Prodromou <evan@status.net>
30 * @author Sarven Capadisli <csarven@status.net>
31 * @author Zach Copley <zach@status.net>
32 * @copyright 2009 StatusNet, Inc.
33 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
34 * @link http://status.net/
37 if (!defined('STATUSNET') && !defined('LACONICA')) {
41 require_once INSTALLDIR . '/lib/form.php';
44 * Form for posting a notice from within the Facebook app
48 * @author Evan Prodromou <evan@status.net>
49 * @author Sarven Capadisli <csarven@status.net>
50 * @author Zach Copey <zach@status.net>
51 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
52 * @link http://status.net/
57 class FacebookNoticeForm extends Form
60 * Current action, used for returning to this page.
66 * Pre-filled content of the form
78 * The notice being replied to
81 var $inreplyto = null;
86 * @param HTMLOutputter $out output channel
87 * @param string $action action to return to, if any
88 * @param string $content content to pre-fill
91 function __construct($out=null, $action=null, $content=null, $post_action=null, $user=null, $inreplyto=null)
93 parent::__construct($out);
95 $this->action = $action;
96 $this->post_action = $post_action;
97 $this->content = $content;
98 $this->inreplyto = $inreplyto;
103 $this->user = common_current_user();
106 // Note: Facebook doesn't allow multipart/form-data posting to
107 // canvas pages, so don't try to set it--no file uploads, at
108 // least not this way. It can be done using multiple servers
109 // and iFrames, but it's a pretty hacky process.
115 * @return string ID of the form
120 return 'form_notice';
126 * @return string class of the form
131 return 'form_notice';
137 * @return string URL of the action
142 return $this->post_action;
150 function formLegend()
152 $this->out->element('legend', null, _('Send a notice'));
163 if (Event::handle('StartShowNoticeFormData', array($this))) {
164 $this->out->element('label', array('for' => 'notice_data-text'),
165 sprintf(_('What\'s up, %s?'), $this->user->nickname));
166 // XXX: vary by defined max size
167 $this->out->element('textarea', array('id' => 'notice_data-text',
170 'name' => 'status_textarea'),
171 ($this->content) ? $this->content : '');
173 $contentLimit = Notice::maxContent();
175 if ($contentLimit > 0) {
176 $this->out->elementStart('dl', 'form_note');
177 $this->out->element('dt', null, _('Available characters'));
178 $this->out->element('dd', array('id' => 'notice_text-count'),
180 $this->out->elementEnd('dl');
184 $this->out->hidden('notice_return-to', $this->action, 'returnto');
186 $this->out->hidden('notice_in-reply-to', $this->inreplyto, 'inreplyto');
188 Event::handle('StartShowNoticeFormData', array($this));
198 function formActions()
200 $this->out->element('input', array('id' => 'notice_action-submit',
202 'name' => 'status_submit',
204 'value' => _('Send')));