function onEndShowScripts($action)
{
- $action->script($this->path('event.js'));
+ $action->script($this->path('js/event.js'));
}
function onEndShowStyles($action)
$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('<span class="vevent">'.
- '<span class="summary">%1$s</span> '.
- '<abbr class="dtstart" title="%2$s">%3$s</a> - '.
- '<abbr class="dtend" title="%4$s">%5$s</a> '.
- '(<span class="location">%6$s</span>): '.
- '<span class="description">%7$s</span> '.
- '</span>'),
+ $rendered = sprintf(_m('<div class="h-event">'.
+ '<p class="p-name p-summary">%1$s</p> '.
+ '<time class="dt-start" datetime="%2$s">%3$s</time> - '.
+ '<time class="dt-end" datetime="%4$s">%5$s</time> '.
+ '(<span class="p-location">%6$s</span>): '.
+ '<div class="p-description">%7$s</div> '.
+ '</div>'),
htmlspecialchars($title),
htmlspecialchars(common_date_iso8601($ev->start_time)),
htmlspecialchars(common_exact_date($ev->start_time)),
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);
.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;
float: none !important;
}
-.notice .vevent div {
+.notice .h-event div {
margin-bottom: 8px;
}
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;
}
+++ /dev/null
-$(document).ready(function() {
-
- // get current time from server
- var today = new Date($('now').val());
-
- $("#event-startdate").datepicker({
- // Don't let the user set a start date < before today
- minDate: today,
- onClose: onStartDateSelected
- });
-
- $("#event-enddate").datepicker({
- minDate: today,
- onClose: onEndDateSelected
- });
-
- $("#event-starttime").change(function(e) {
- var tz = $("#tz").val();
-
- var startDate = $("#event-startdate").val();
- var startTime = $("#event-starttime option:selected").val().replace(/(pm|am)/, ' $1');
- var startStr = startDate + ' ' + startTime + ' ' + tz;
-
- var endDate = $("#event-enddate").val();
- var endTime = $("#event-endtime option:selected").val();
- var endStr = endDate + ' ' + endTime.replace(/(pm|am)/, ' $1') + ' ' + tz;
-
- // just need to compare hours
- var start = new Date(startStr);
- var end = new Date(endStr);
-
- updateTimes(startStr, (startDate === endDate), function (data) {
- var times = [];
- $.each(data, function(key, val) {
- times.push('<option value="' + key + '">' + val + '</option>');
- });
- $("#event-endtime").html(times.join(''));
-
- if (start > end) {
- $("#event-endtime").val(startTime).attr("selected", "selected");
- } else {
- $("#event-endtime").val(endTime).attr("selected", "selected");
- }
- });
-
- });
-
- $("#event-endtime").change(function(e) {
- var HOUR = 60 * 60 * 1000;
- var tz = $("#tz").val();
- var startDate = $("#event-startdate").val();
- var endDate = $("#event-enddate").val();
- var starttime = $("#event-starttime option:selected").val();
- var endtime = $("#event-endtime option:selected").val();
- var endtimeText = $("#event-endtime option:selected").text();
-
- // If the end time is in the next day then update the start date
- if (startDate === endDate) {
- var startstr = startDate + ' ' + starttime.replace(/(pm|am)/, ' $1') + ' ' + tz;
- var start = new Date(startstr);
- var matches = endtimeText.match(/\(.*\)/);
- var hours;
- if (matches) {
- hours = matches[0].substr(1).split(' ')[0]; // get x from (x hours)
- if (hours) {
- if (hours == 30) {
- hours = .5; // special case: x == 30 from (30 mins)
- }
- var end = new Date(start.getTime() + (hours * HOUR));
- if (end.getDate() > start.getDate()) {
- $("#event-enddate").datepicker('setDate', end);
- var endstr = endDate + ' 12:00 am ' + tz;
- updateTimes(endstr, false, function(data) {
- var times = [];
- $.each(data, function(key, val) {
- times.push('<option value="' + key + '">' + val + '</option>');
- });
- $("#event-endtime").html(times.join(''));
-
- if (start > end) {
- $("#event-endtime").val(starttime).attr("selected", "selected");
- } else {
- $("#event-endtime").val(endtime).attr("selected", "selected");
- }
- });
- }
- }
- }
- }
- });
-
- function onStartDateSelected(dateText, inst) {
- var tz = $("#tz").val();
- var startTime = $("#event-starttime option:selected").val();
- var startDateTime = new Date(dateText + ' ' + startTime.replace(/(pm|am)/, ' $1') + ' ' + tz);
-
- // When we update the start date and time, we need to update the end date and time
- // to make sure they are equal or in the future
- $("#event-enddate").datepicker('option', 'minDate', startDateTime);
-
- recalculateTimes();
- }
-
- function onEndDateSelected(dateText, inst) {
- recalculateTimes();
- }
-
- function recalculateTimes(showDuration) {
- var tz = $("#tz").val();
-
- var startDate = $("#event-startdate").val();
- var startTime = $("#event-starttime option:selected").val();
- var startStr = startDate + ' ' + startTime.replace(/(pm|am)/, ' $1') + ' ' + tz;
- var startDateTime = new Date(startStr);
-
- var endDate = $("#event-enddate").val();
- var endTime = $("#event-endtime option:selected").val();
- var endDateTime = new Date(endDate + ' ' + endTime.replace(/(pm|am)/, ' $1') + ' ' + tz);
- var showDuration = true;
-
- if (endDateTime.getDate() !== startDateTime.getDate()) {
- starStr = endDate + ' 12:00 am ' + tz;
- showDuration = false;
- }
-
- updateTimes(startStr, showDuration, function(data) {
- var times = [];
- $.each(data, function(key, val) {
- times.push('<option value="' + key + '">' + val + '</option>');
- });
- $("#event-endtime").html(times.join(''));
- if (startDateTime > endDateTime) {
- $("#event-endtime").val(startTime).attr("selected", "selected");
- } else {
- $("#event-endtime").val(endTime).attr("selected", "selected");
- }
- });
- }
-
- function updateTimes(start, duration, onSuccess) {
- $.getJSON($('#timelist_action_url').val(), {start: start, ajax: true, duration: duration}, onSuccess);
- }
-
-});
--- /dev/null
+$(document).ready(function() {
+
+ // get current time from server
+ var today = new Date($('now').val());
+
+ $("#event-startdate").datepicker({
+ // Don't let the user set a start date < before today
+ minDate: today,
+ onClose: onStartDateSelected
+ });
+
+ $("#event-enddate").datepicker({
+ minDate: today,
+ onClose: onEndDateSelected
+ });
+
+ $("#event-starttime").change(function(e) {
+ var tz = $("#tz").val();
+
+ var startDate = $("#event-startdate").val();
+ var startTime = $("#event-starttime option:selected").val().replace(/(pm|am)/, ' $1');
+ var startStr = startDate + ' ' + startTime + ' ' + tz;
+
+ var endDate = $("#event-enddate").val();
+ var endTime = $("#event-endtime option:selected").val();
+ var endStr = endDate + ' ' + endTime.replace(/(pm|am)/, ' $1') + ' ' + tz;
+
+ // just need to compare hours
+ var start = new Date(startStr);
+ var end = new Date(endStr);
+
+ updateTimes(startStr, (startDate === endDate), function (data) {
+ var times = [];
+ $.each(data, function(key, val) {
+ times.push('<option value="' + key + '">' + val + '</option>');
+ });
+ $("#event-endtime").html(times.join(''));
+
+ if (start > end) {
+ $("#event-endtime").val(startTime).attr("selected", "selected");
+ } else {
+ $("#event-endtime").val(endTime).attr("selected", "selected");
+ }
+ });
+
+ });
+
+ $("#event-endtime").change(function(e) {
+ var HOUR = 60 * 60 * 1000;
+ var tz = $("#tz").val();
+ var startDate = $("#event-startdate").val();
+ var endDate = $("#event-enddate").val();
+ var starttime = $("#event-starttime option:selected").val();
+ var endtime = $("#event-endtime option:selected").val();
+ var endtimeText = $("#event-endtime option:selected").text();
+
+ // If the end time is in the next day then update the start date
+ if (startDate === endDate) {
+ var startstr = startDate + ' ' + starttime.replace(/(pm|am)/, ' $1') + ' ' + tz;
+ var start = new Date(startstr);
+ var matches = endtimeText.match(/\(.*\)/);
+ var hours;
+ if (matches) {
+ hours = matches[0].substr(1).split(' ')[0]; // get x from (x hours)
+ if (hours) {
+ if (hours == 30) {
+ hours = .5; // special case: x == 30 from (30 mins)
+ }
+ var end = new Date(start.getTime() + (hours * HOUR));
+ if (end.getDate() > start.getDate()) {
+ $("#event-enddate").datepicker('setDate', end);
+ var endstr = endDate + ' 12:00 am ' + tz;
+ updateTimes(endstr, false, function(data) {
+ var times = [];
+ $.each(data, function(key, val) {
+ times.push('<option value="' + key + '">' + val + '</option>');
+ });
+ $("#event-endtime").html(times.join(''));
+
+ if (start > end) {
+ $("#event-endtime").val(starttime).attr("selected", "selected");
+ } else {
+ $("#event-endtime").val(endtime).attr("selected", "selected");
+ }
+ });
+ }
+ }
+ }
+ }
+ });
+
+ function onStartDateSelected(dateText, inst) {
+ var tz = $("#tz").val();
+ var startTime = $("#event-starttime option:selected").val();
+ var startDateTime = new Date(dateText + ' ' + startTime.replace(/(pm|am)/, ' $1') + ' ' + tz);
+
+ // When we update the start date and time, we need to update the end date and time
+ // to make sure they are equal or in the future
+ $("#event-enddate").datepicker('option', 'minDate', startDateTime);
+
+ recalculateTimes();
+ }
+
+ function onEndDateSelected(dateText, inst) {
+ recalculateTimes();
+ }
+
+ function recalculateTimes(showDuration) {
+ var tz = $("#tz").val();
+
+ var startDate = $("#event-startdate").val();
+ var startTime = $("#event-starttime option:selected").val();
+ var startStr = startDate + ' ' + startTime.replace(/(pm|am)/, ' $1') + ' ' + tz;
+ var startDateTime = new Date(startStr);
+
+ var endDate = $("#event-enddate").val();
+ var endTime = $("#event-endtime option:selected").val();
+ var endDateTime = new Date(endDate + ' ' + endTime.replace(/(pm|am)/, ' $1') + ' ' + tz);
+ var showDuration = true;
+
+ if (endDateTime.getDate() !== startDateTime.getDate()) {
+ starStr = endDate + ' 12:00 am ' + tz;
+ showDuration = false;
+ }
+
+ updateTimes(startStr, showDuration, function(data) {
+ var times = [];
+ $.each(data, function(key, val) {
+ times.push('<option value="' + key + '">' + val + '</option>');
+ });
+ $("#event-endtime").html(times.join(''));
+ if (startDateTime > endDateTime) {
+ $("#event-endtime").val(startTime).attr("selected", "selected");
+ } else {
+ $("#event-endtime").val(endTime).attr("selected", "selected");
+ }
+ });
+ }
+
+ function updateTimes(start, duration, onSuccess) {
+ $.getJSON($('#timelist_action_url').val(), {start: start, ajax: true, duration: duration}, onSuccess);
+ }
+
+});
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);
}
// 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
$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');
}
$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;
$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');