$this->user = common_current_user();
if (empty($this->user)) {
- // TRANS: Client exception thrown trying to create a Question while not logged in.
throw new ClientException(
+ // TRANS: Client exception thrown trying to create a Question while not logged in.
_m('You must be logged in to post a question.'),
403
);
function newQuestion()
{
if ($this->boolean('ajax')) {
- StatusNet::setApi(true);
+ GNUsocial::setApi(true);
}
try {
if (empty($this->title)) {
throw new ClientException(_m('Question must have a title.'));
}
+ // Notice options
+ $options = array();
+
+ // Does the heavy-lifting for getting "To:" information
+ ToSelector::fillOptions($this, $options);
+
$saved = QnA_Question::saveNew(
$this->user->getProfile(),
$this->title,
- $this->description
+ $this->description,
+ $options
);
} catch (ClientException $ce) {
$this->error = $ce->getMessage();
}
if ($this->boolean('ajax')) {
- header('Content-Type: text/xml;charset=utf-8');
- $this->xw->startDocument('1.0', 'UTF-8');
- $this->elementStart('html');
+ $this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
// TRANS: Page title after sending a notice.
$this->element('title', null, _m('Question posted'));
$this->elementStart('body');
$this->showNotice($saved);
$this->elementEnd('body');
- $this->elementEnd('html');
+ $this->endHTML();
} else {
- common_redirect($saved->bestUrl(), 303);
+ common_redirect($saved->getUrl(), 303);
}
}
*/
function showNotice($notice)
{
- class_exists('NoticeList'); // @fixme hack for autoloader
- $nli = new NoticeListItem($notice, $this);
+ $nli = new NoticeQuestionListItem($notice, $this);
$nli->show();
}
}
}
}
+
+class NoticeQuestionListItem extends NoticeListItem
+{
+ /**
+ * constructor
+ *
+ * Also initializes the profile attribute.
+ *
+ * @param Notice $notice The notice we'll display
+ */
+ function __construct($notice, $out=null)
+ {
+ parent::__construct($notice, $out);
+ }
+
+ function showEnd()
+ {
+ $this->out->element('ul', 'notices threaded-replies xoxo');
+ parent::showEnd();
+ }
+}