diff --git a/plugins/Event/EventPlugin.php b/plugins/Event/EventPlugin.php index c1c8ec77c3..c49103be77 100644 --- a/plugins/Event/EventPlugin.php +++ b/plugins/Event/EventPlugin.php @@ -311,7 +311,7 @@ class EventPlugin extends MicroappPlugin function onEndShowScripts($action) { - $action->script($this->path('event.js')); + $action->script($this->path('js/event.js')); } function onEndShowStyles($action) diff --git a/plugins/Event/classes/Happening.php b/plugins/Event/classes/Happening.php index 2b097e9077..3a094ece6c 100644 --- a/plugins/Event/classes/Happening.php +++ b/plugins/Event/classes/Happening.php @@ -149,16 +149,17 @@ class Happening extends Managed_DataObject $location, $description); - // TRANS: Rendered event description. %1$s is a title, %2$s is start time, %3$s is start time, + // TRANS: Rendered microformats2 tagged event description. + // TRANS: %1$s is a title, %2$s is start time, %3$s is start time, // TRANS: %4$s is end time, %5$s is end time, %6$s is location, %7$s is description. // TRANS: Class names should not be translated. - $rendered = sprintf(_m(''. - '%1$s '. - '%3$s - '. - '%5$s '. - '(%6$s): '. - '%7$s '. - ''), + $rendered = sprintf(_m('
'. + '

%1$s

'. + ' - '. + ' '. + '(%6$s): '. + '
%7$s
'. + '
'), htmlspecialchars($title), htmlspecialchars(common_date_iso8601($ev->start_time)), htmlspecialchars(common_exact_date($ev->start_time)), @@ -187,6 +188,20 @@ class Happening extends Managed_DataObject return $saved; } + /** + * Returns the profile's canonical url, not necessarily a uri/unique id + * + * @return string $url + */ + public function getUrl() + { + if (empty($this->url) || + !filter_var($this->url, FILTER_VALIDATE_URL)) { + throw new InvalidUrlException($this->url); + } + return $this->url; + } + function getNotice() { return Notice::getKV('uri', $this->uri); diff --git a/plugins/Event/css/event.css b/plugins/Event/css/event.css index 37561c397d..e50201a447 100644 --- a/plugins/Event/css/event.css +++ b/plugins/Event/css/event.css @@ -6,8 +6,6 @@ .event-notice-count { float: right; } .event-info { float: left; } .event-title { margin-left: 0px; } -#content .event .h-entry { margin-left: 0px; } -#content .event .e-content { margin-left: 0px; } .ui-autocomplete { max-height: 100px; overflow-y: auto; @@ -37,7 +35,7 @@ li.rsvp-list .entities li .u-photo { float: none !important; } -.notice .vevent div { +.notice .h-event div { margin-bottom: 8px; } @@ -94,7 +92,7 @@ li.rsvp-list .entities li .u-photo { background: linear-gradient(top, #fb6104 0%,#fc8035 100%); } -#wrap .vevent form.processing input.submit { +#wrap .h-event form.processing input.submit { text-indent: 0; background: #ff9d63; } diff --git a/plugins/Event/event.js b/plugins/Event/js/event.js similarity index 100% rename from plugins/Event/event.js rename to plugins/Event/js/event.js diff --git a/plugins/Event/lib/eventlistitem.php b/plugins/Event/lib/eventlistitem.php index 54f069233f..cd28ce86e3 100644 --- a/plugins/Event/lib/eventlistitem.php +++ b/plugins/Event/lib/eventlistitem.php @@ -66,16 +66,14 @@ class EventListItem extends NoticeListItemAdapter return; } - $out->elementStart('div', 'vevent event e-content'); // VEVENT IN + // e-content since we're part of a h-entry + $out->elementStart('div', 'h-event e-content'); // VEVENT IN - $out->elementStart('h3', 'summary'); // VEVENT/H3 IN + $out->elementStart('h3', 'p-summary p-name'); // VEVENT/H3 IN - if (!empty($event->url)) { - $out->element('a', - array('href' => $event->url, - 'class' => 'event-title entry-title summary'), - $event->title); - } else { + try { + $out->element('a', array('href' => $event->getUrl()), $event->title); + } catch (InvalidUrlException $e) { $out->text($event->title); } @@ -114,19 +112,15 @@ class EventListItem extends NoticeListItemAdapter // TRANS: Field label for event description. $out->element('strong', null, _m('Time:')); - $out->element('abbr', array('class' => 'dtstart', - 'title' => common_date_iso8601($event->start_time)), + $out->element('time', array('class' => 'dt-start', + 'datetime' => common_date_iso8601($event->start_time)), $startDateStr . ' ' . $startTimeStr); $out->text(' – '); - if ($startDateStr == $endDateStr) { - $out->element('span', array('class' => 'dtend', - 'title' => common_date_iso8601($event->end_time)), - $endTimeStr); - } else { - $out->element('span', array('class' => 'dtend', - 'title' => common_date_iso8601($event->end_time)), - $endDateStr . ' ' . $endTimeStr); - } + $out->element('time', array('class' => 'dt-end', + 'datetime' => common_date_iso8601($event->end_time)), + $startDateStr == $endDateStr + ? "$endDatestr $endTimeStr" + : $endTimeStr); $out->elementEnd('div'); // VEVENT/EVENT-TIMES OUT @@ -134,7 +128,7 @@ class EventListItem extends NoticeListItemAdapter $out->elementStart('div', 'event-location'); // TRANS: Field label for event description. $out->element('strong', null, _m('Location:')); - $out->element('span', 'location', $event->location); + $out->element('span', 'p-location', $event->location); $out->elementEnd('div'); } @@ -142,22 +136,21 @@ class EventListItem extends NoticeListItemAdapter $out->elementStart('div', 'event-description'); // TRANS: Field label for event description. $out->element('strong', null, _m('Description:')); - $out->element('span', 'description', $event->description); + $out->element('div', 'p-description', $event->description); $out->elementEnd('div'); } $rsvps = $event->getRSVPs(); $out->elementStart('div', 'event-rsvps'); - // TRANS: Field label for event description. - $out->text(_('Attending:')); + // TRANS: Field label for event description. + $out->element('strong', null, _m('Attending:')); $out->elementStart('ul', 'attending-list'); foreach ($rsvps as $verb => $responses) { $out->elementStart('li', 'rsvp-list'); - switch ($verb) - { + switch ($verb) { case RSVP::POSITIVE: $out->text(_('Yes:')); break; @@ -173,9 +166,7 @@ class EventListItem extends NoticeListItemAdapter $ids[] = $response->profile_id; } $ids = array_slice($ids, 0, ProfileMiniList::MAX_PROFILES + 1); - $profiles = Profile::pivotGet('id', $ids); - $profile = new ArrayWrapper(array_values($profiles)); - $minilist = new ProfileMiniList($profile, $out); + $minilist = new ProfileMiniList(Profile::multiGet('id', $ids), $out); $minilist->show(); $out->elementEnd('li');