From: Evan Prodromou Date: Wed, 9 Mar 2011 07:48:14 +0000 (-0500) Subject: make new event work, sort of X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=53e67b5ed5bb01e19fef02b98932e5d9d6e76160;p=quix0rs-gnu-social.git make new event work, sort of --- diff --git a/plugins/Event/EventPlugin.php b/plugins/Event/EventPlugin.php index d6d7e00fc1..f33de09d78 100644 --- a/plugins/Event/EventPlugin.php +++ b/plugins/Event/EventPlugin.php @@ -58,7 +58,7 @@ class EventPlugin extends MicroappPlugin { $schema = Schema::get(); - $schema->ensureTable('event', Happening::schemaDef()); + $schema->ensureTable('happening', Happening::schemaDef()); $schema->ensureTable('rsvp', RSVP::schemaDef()); return true; diff --git a/plugins/Event/eventform.php b/plugins/Event/eventform.php index 8347639b5b..8d108020a6 100644 --- a/plugins/Event/eventform.php +++ b/plugins/Event/eventform.php @@ -66,7 +66,7 @@ class EventForm extends Form function formClass() { - return 'form_settings ajax'; + return 'form_settings ajax-notice'; } /** diff --git a/plugins/Event/newevent.php b/plugins/Event/newevent.php index fe23e8825d..365e9c1434 100644 --- a/plugins/Event/newevent.php +++ b/plugins/Event/newevent.php @@ -146,12 +146,12 @@ class NeweventAction extends Action throw new ClientException(_('Event must have an end time.')); } - $saved = Event::saveNew($this->user->getProfile(), - $this->start_time, - $this->end_time, - $this->title, - $this->location, - $this->description); + $saved = Happening::saveNew($this->user->getProfile(), + $this->start_time, + $this->end_time, + $this->title, + $this->location, + $this->description); } catch (ClientException $ce) { $this->error = $ce->getMessage(); @@ -159,7 +159,21 @@ class NeweventAction extends Action return; } - + if ($this->boolean('ajax')) { + header('Content-Type: text/xml;charset=utf-8'); + $this->xw->startDocument('1.0', 'UTF-8'); + $this->elementStart('html'); + $this->elementStart('head'); + // TRANS: Page title after sending a notice. + $this->element('title', null, _('Event saved')); + $this->elementEnd('head'); + $this->elementStart('body'); + $this->showNotice($saved); + $this->elementEnd('body'); + $this->elementEnd('html'); + } else { + common_redirect($saved->bestUrl(), 303); + } } /** @@ -200,4 +214,20 @@ class NeweventAction extends Action return false; } } + + + /** + * Output a notice + * + * Used to generate the notice code for Ajax results. + * + * @param Notice $notice Notice that was saved + * + * @return void + */ + function showNotice($notice) + { + $nli = new NoticeListItem($notice, $this); + $nli->show(); + } }