forked from GNUsocial/gnu-social
Merge branch 'master' into 'nightly'
make events federate See merge request !33
This commit is contained in:
commit
3154302b53
@ -46,6 +46,9 @@ if (!defined('STATUSNET')) {
|
|||||||
*/
|
*/
|
||||||
class EventPlugin extends MicroAppPlugin
|
class EventPlugin extends MicroAppPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var $oldSaveNew = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up our tables (event and rsvp)
|
* Set up our tables (event and rsvp)
|
||||||
*
|
*
|
||||||
@ -142,18 +145,44 @@ class EventPlugin extends MicroAppPlugin
|
|||||||
throw new Exception(_m('Wrong type for object.'));
|
throw new Exception(_m('Wrong type for object.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dtstart = $happeningObj->element->getElementsByTagName('dtstart');
|
||||||
|
if($dtstart->length == 0) {
|
||||||
|
// TRANS: Exception thrown when has no start date
|
||||||
|
throw new Exception(_m('No start date for event.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$dtend = $happeningObj->element->getElementsByTagName('dtend');
|
||||||
|
if($dtend->length == 0) {
|
||||||
|
// TRANS: Exception thrown when has no end date
|
||||||
|
throw new Exception(_m('No end date for event.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// location is optional
|
||||||
|
$location = null;
|
||||||
|
$location_object = $happeningObj->element->getElementsByTagName('location');
|
||||||
|
if($location_object->length > 0) {
|
||||||
|
$location = $location_object->item(0)->nodeValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// url is optional
|
||||||
|
$url = null;
|
||||||
|
$url_object = $happeningObj->element->getElementsByTagName('url');
|
||||||
|
if($url_object->length > 0) {
|
||||||
|
$url = $url_object->item(0)->nodeValue;
|
||||||
|
}
|
||||||
|
|
||||||
$notice = null;
|
$notice = null;
|
||||||
|
|
||||||
switch ($activity->verb) {
|
switch ($activity->verb) {
|
||||||
case ActivityVerb::POST:
|
case ActivityVerb::POST:
|
||||||
// FIXME: get startTime, endTime, location and URL
|
// FIXME: get startTime, endTime, location and URL
|
||||||
$notice = Happening::saveNew($actor,
|
$notice = Happening::saveNew($actor,
|
||||||
$start_time,
|
$dtstart->item(0)->nodeValue,
|
||||||
$end_time,
|
$dtend->item(0)->nodeValue,
|
||||||
$happeningObj->title,
|
$happeningObj->title,
|
||||||
null,
|
$location,
|
||||||
$happeningObj->summary,
|
$happeningObj->summary,
|
||||||
null,
|
$url,
|
||||||
$options);
|
$options);
|
||||||
break;
|
break;
|
||||||
case RSVP::POSITIVE:
|
case RSVP::POSITIVE:
|
||||||
@ -228,8 +257,8 @@ class EventPlugin extends MicroAppPlugin
|
|||||||
array('xmlns' => 'urn:ietf:params:xml:ns:xcal'),
|
array('xmlns' => 'urn:ietf:params:xml:ns:xcal'),
|
||||||
common_date_iso8601($happening->end_time));
|
common_date_iso8601($happening->end_time));
|
||||||
|
|
||||||
// FIXME: add location
|
$obj->extra[] = array('location', false, $happening->location);
|
||||||
// FIXME: add URL
|
$obj->extra[] = array('url', false, $happening->url);
|
||||||
|
|
||||||
// XXX: probably need other stuff here
|
// XXX: probably need other stuff here
|
||||||
|
|
||||||
|
@ -220,8 +220,8 @@ class NeweventAction extends Action
|
|||||||
$profile = $this->user->getProfile();
|
$profile = $this->user->getProfile();
|
||||||
|
|
||||||
$saved = Happening::saveNew($profile,
|
$saved = Happening::saveNew($profile,
|
||||||
$this->startTime,
|
common_sql_date($this->startTime),
|
||||||
$this->endTime,
|
common_sql_date($this->endTime),
|
||||||
$this->title,
|
$this->title,
|
||||||
$this->location,
|
$this->location,
|
||||||
$this->description,
|
$this->description,
|
||||||
|
@ -116,8 +116,8 @@ class Happening extends Managed_DataObject
|
|||||||
|
|
||||||
$ev->id = UUID::gen();
|
$ev->id = UUID::gen();
|
||||||
$ev->profile_id = $profile->id;
|
$ev->profile_id = $profile->id;
|
||||||
$ev->start_time = common_sql_date($start_time);
|
$ev->start_time = $start_time;
|
||||||
$ev->end_time = common_sql_date($end_time);
|
$ev->end_time = $end_time;
|
||||||
$ev->title = $title;
|
$ev->title = $title;
|
||||||
$ev->location = $location;
|
$ev->location = $location;
|
||||||
$ev->description = $description;
|
$ev->description = $description;
|
||||||
|
Loading…
Reference in New Issue
Block a user