make new event work, sort of
This commit is contained in:
parent
ca36dfecf9
commit
53e67b5ed5
@ -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;
|
||||
|
@ -66,7 +66,7 @@ class EventForm extends Form
|
||||
|
||||
function formClass()
|
||||
{
|
||||
return 'form_settings ajax';
|
||||
return 'form_settings ajax-notice';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user