* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class NewPollAction extends Action
{
protected $user = null;
*
* @return string Action title
*/
-
function title()
{
- return _('New poll');
+ // TRANS: Title for poll page.
+ return _m('New poll');
}
/**
*
* @return boolean true
*/
-
function prepare($argarray)
{
parent::prepare($argarray);
$this->user = common_current_user();
if (empty($this->user)) {
- throw new ClientException(_("Must be logged in to post a poll."),
+ // TRANS: Client exception thrown trying to create a poll while not logged in.
+ throw new ClientException(_m('You must be logged in to post a poll.'),
403);
}
*
* @return void
*/
-
function handle($argarray=null)
{
parent::handle($argarray);
*
* @return void
*/
-
function newPoll()
{
if ($this->boolean('ajax')) {
}
try {
if (empty($this->question)) {
- throw new ClientException(_('Poll must have a question.'));
+ // TRANS: Client exception thrown trying to create a poll without a question.
+ throw new ClientException(_m('Poll must have a question.'));
}
if (count($this->options) < 2) {
- throw new ClientException(_('Poll must have at least two options.'));
+ // TRANS: Client exception thrown trying to create a poll with fewer than two options.
+ throw new ClientException(_m('Poll must have at least two options.'));
}
+ // Notice options; distinct from choices for the poll
+
+ $options = array();
+
+ // Does the heavy-lifting for getting "To:" information
+
+ ToSelector::fillOptions($this, $options);
$saved = Poll::saveNew($this->user->getProfile(),
- $this->question,
- $this->options);
+ $this->question,
+ $this->options,
+ $options);
} catch (ClientException $ce) {
$this->error = $ce->getMessage();
$this->elementStart('html');
$this->elementStart('head');
// TRANS: Page title after sending a notice.
- $this->element('title', null, _('Notice posted'));
+ $this->element('title', null, _m('Notice posted'));
$this->elementEnd('head');
$this->elementStart('body');
$this->showNotice($saved);
*
* @return void
*/
-
function showContent()
{
if (!empty($this->error)) {
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||