X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FEvent%2FEventPlugin.php;h=a1dffea3b96b6befbe0207c08447ffafba66560b;hb=546a03b5eac5f172d543a889625e2f4de446e8b7;hp=98a7d895ed0db3f2a289c186c90b7edec2cb7d12;hpb=cb183359e23ae7a5cfb483fa06c6c4b7a8b05fff;p=quix0rs-gnu-social.git diff --git a/plugins/Event/EventPlugin.php b/plugins/Event/EventPlugin.php index 98a7d895ed..a1dffea3b9 100644 --- a/plugins/Event/EventPlugin.php +++ b/plugins/Event/EventPlugin.php @@ -44,7 +44,7 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ -class EventPlugin extends MicroappPlugin +class EventPlugin extends MicroAppPlugin { /** * Set up our tables (event and rsvp) @@ -64,42 +64,6 @@ class EventPlugin extends MicroappPlugin return true; } - /** - * Load related modules when needed - * - * @param string $cls Name of the class to be loaded - * - * @return boolean hook value; true means continue processing, false means stop. - */ - function onAutoload($cls) - { - $dir = dirname(__FILE__); - - switch ($cls) - { - case 'NeweventAction': - case 'NewrsvpAction': - case 'CancelrsvpAction': - case 'ShoweventAction': - case 'ShowrsvpAction': - include_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php'; - return false; - case 'EventListItem': - case 'RSVPListItem': - case 'EventForm': - case 'RSVPForm': - case 'CancelRSVPForm': - include_once $dir . '/'.strtolower($cls).'.php'; - break; - case 'Happening': - case 'RSVP': - include_once $dir . '/'.$cls.'.php'; - return false; - default: - return true; - } - } - /** * Map URLs to actions * @@ -121,13 +85,15 @@ class EventPlugin extends MicroappPlugin $m->connect('rsvp/:id', array('action' => 'showrsvp'), array('id' => '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')); + $m->connect('main/event/updatetimes', + array('action' => 'timelist')); return true; } - function onPluginVersion(&$versions) + function onPluginVersion(array &$versions) { $versions[] = array('name' => 'Event', - 'version' => STATUSNET_VERSION, + 'version' => GNUSOCIAL_VERSION, 'author' => 'Evan Prodromou', 'homepage' => 'http://status.net/wiki/Plugin:Event', 'description' => @@ -162,7 +128,7 @@ class EventPlugin extends MicroappPlugin * * @return Notice the resulting notice */ - function saveNoticeFromActivity($activity, $actor, $options=array()) + function saveNoticeFromActivity(Activity $activity, Profile $actor, array $options=array()) { if (count($activity->objects) != 1) { // TRANS: Exception thrown when there are too many activity objects. @@ -193,7 +159,7 @@ class EventPlugin extends MicroappPlugin case RSVP::POSITIVE: case RSVP::NEGATIVE: case RSVP::POSSIBLE: - $happening = Happening::staticGet('uri', $happeningObj->id); + $happening = Happening::getKV('uri', $happeningObj->id); if (empty($happening)) { // FIXME: save the event // TRANS: Exception thrown when trying to RSVP for an unknown event. @@ -216,7 +182,7 @@ class EventPlugin extends MicroappPlugin * * @return ActivityObject */ - function activityObjectFromNotice($notice) + function activityObjectFromNotice(Notice $notice) { $happening = null; @@ -250,7 +216,7 @@ class EventPlugin extends MicroappPlugin $obj->type = Happening::OBJECT_TYPE; $obj->title = $happening->title; $obj->summary = $happening->description; - $obj->link = $notice->bestUrl(); + $obj->link = $notice->getUrl(); // XXX: how to get this stuff into JSON?! @@ -277,12 +243,12 @@ class EventPlugin extends MicroappPlugin * * @return ActivityObject */ - function onEndNoticeAsActivity($notice, &$act) { - switch ($notice->object_type) { + protected function extendActivity(Notice $stored, Activity $act, Profile $scoped=null) { + switch ($stored->object_type) { case RSVP::POSITIVE: case RSVP::NEGATIVE: case RSVP::POSSIBLE: - $act->verb = $notice->object_type; + $act->verb = $stored->object_type; break; } return true; @@ -322,7 +288,7 @@ class EventPlugin extends MicroappPlugin * * @param Notice $notice */ - function deleteRelated($notice) + function deleteRelated(Notice $notice) { switch ($notice->object_type) { case Happening::OBJECT_TYPE: @@ -345,12 +311,12 @@ class EventPlugin extends MicroappPlugin function onEndShowScripts($action) { - $action->inlineScript('$(document).ready(function() { $("#event-startdate").datepicker(); $("#event-enddate").datepicker(); });'); + $action->script($this->path('js/event.js')); } function onEndShowStyles($action) { - $action->cssLink($this->path('event.css')); + $action->cssLink($this->path('css/event.css')); return true; }