Page MenuHomePhabricator

D12779.id30721.diff
No OneTemporary

D12779.id30721.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -7,7 +7,7 @@
*/
return array(
'names' => array(
- 'core.pkg.css' => 'ca3f6a60',
+ 'core.pkg.css' => 'a821cfc9',
'core.pkg.js' => '919c56b5',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => 'bb338e4b',
@@ -120,7 +120,7 @@
'rsrc/css/layout/phabricator-hovercard-view.css' => '44394670',
'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c',
'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894',
- 'rsrc/css/phui/calendar/phui-calendar-day.css' => '75b8cc4a',
+ 'rsrc/css/phui/calendar/phui-calendar-day.css' => '49037167',
'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59',
'rsrc/css/phui/calendar/phui-calendar-month.css' => 'a92e47d2',
'rsrc/css/phui/calendar/phui-calendar.css' => '8675968e',
@@ -133,7 +133,7 @@
'rsrc/css/phui/phui-document.css' => '94d5dcd8',
'rsrc/css/phui/phui-feed-story.css' => 'c9f3a0b5',
'rsrc/css/phui/phui-fontkit.css' => 'dd8ddf27',
- 'rsrc/css/phui/phui-form-view.css' => '17eace76',
+ 'rsrc/css/phui/phui-form-view.css' => '94ae3032',
'rsrc/css/phui/phui-form.css' => 'f535f938',
'rsrc/css/phui/phui-header-view.css' => 'da4586b1',
'rsrc/css/phui/phui-icon.css' => 'bc766998',
@@ -346,6 +346,7 @@
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974',
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
+ 'rsrc/js/application/calendar/event-all-day.js' => 'ca5fa62a',
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '9e507b59',
'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a',
@@ -585,6 +586,7 @@
'javelin-behavior-doorkeeper-tag' => 'e5822781',
'javelin-behavior-durable-column' => '657c2b50',
'javelin-behavior-error-log' => '6882e80a',
+ 'javelin-behavior-event-all-day' => 'ca5fa62a',
'javelin-behavior-fancy-datepicker' => '5c0f680f',
'javelin-behavior-global-drag-and-drop' => 'c8e57404',
'javelin-behavior-herald-rule-editor' => '7ebaeed3',
@@ -775,7 +777,7 @@
'phui-box-css' => '7b3a2eed',
'phui-button-css' => 'de610129',
'phui-calendar-css' => '8675968e',
- 'phui-calendar-day-css' => '75b8cc4a',
+ 'phui-calendar-day-css' => '49037167',
'phui-calendar-list-css' => 'c1d0ca59',
'phui-calendar-month-css' => 'a92e47d2',
'phui-crumbs-view-css' => '594d719e',
@@ -784,7 +786,7 @@
'phui-font-icon-base-css' => '3dad2ae3',
'phui-fontkit-css' => 'dd8ddf27',
'phui-form-css' => 'f535f938',
- 'phui-form-view-css' => '17eace76',
+ 'phui-form-view-css' => '94ae3032',
'phui-header-view-css' => 'da4586b1',
'phui-icon-view-css' => 'bc766998',
'phui-image-mask-css' => '5a8b09c8',
diff --git a/src/view/phui/calendar/PHUICalendarDayView.php b/src/view/phui/calendar/PHUICalendarDayView.php
--- a/src/view/phui/calendar/PHUICalendarDayView.php
+++ b/src/view/phui/calendar/PHUICalendarDayView.php
@@ -35,30 +35,32 @@
$hours = $this->getHoursOfDay();
$hourly_events = array();
- $rows = array();
+
+ $first_event_hour = null;
$all_day_events = $this->getAllDayEvents();
+ $today_all_day_events = array();
+
+ $day_start = $this->getDateTime();
+ $day_end = id(clone $day_start)->modify('+1 day');
+
+ $day_start = $day_start->format('U');
+ $day_end = $day_end->format('U');
+
+ foreach ($all_day_events as $all_day_event) {
+ $all_day_start = $all_day_event->getEpochStart();
+ $all_day_end = $all_day_event->getEpochEnd();
+
+ if ($all_day_start < $day_end && $all_day_end > $day_start) {
+ $today_all_day_events[] = $all_day_event;
+ }
+ }
- // sort events into buckets by their start time
- // pretend no events overlap
foreach ($hours as $hour) {
$current_hour_events = array();
$hour_start = $hour->format('U');
$hour_end = id(clone $hour)->modify('+1 hour')->format('U');
- if ($hour == $this->getDateTime()) {
- foreach ($all_day_events as $all_day_event) {
- $all_day_start = $all_day_event->getEpochStart();
- $all_day_end = $all_day_event->getEpochEnd();
- $day_end = id(clone $hour)->modify('+1 day')->format('U') - 1;
-
- if ($all_day_start < $day_end && $all_day_end > $hour_start) {
-
- $current_hour_events[] = $all_day_event;
- $this->todayEvents[] = $all_day_event;
- }
- }
- }
foreach ($this->events as $event) {
if ($event->getIsAllDay()) {
continue;
@@ -81,6 +83,10 @@
* 100;
$height = min(2400, $height);
+ if ($first_event_hour === null) {
+ $first_event_hour = $hour;
+ }
+
$hourly_events[$event->getEventID()] = array(
'hour' => $hour,
'event' => $event,
@@ -99,8 +105,17 @@
$hourly_events);
}
- // actually construct table
+ $rows = array();
+
foreach ($hours as $hour) {
+ $early_hours = array(8);
+ if ($first_event_hour) {
+ $early_hours[] = $first_event_hour->format('G');
+ }
+ if ($hour->format('G') < min($early_hours)) {
+ continue;
+ }
+
$drawn_hourly_events = array();
$cell_time = phutil_tag(
'td',
@@ -109,6 +124,7 @@
foreach ($hourly_events as $hourly_event) {
if ($hourly_event['hour'] == $hour) {
+
$drawn_hourly_events[] = $this->drawEvent(
$hourly_event['event'],
$hourly_event['offset'],
@@ -133,16 +149,20 @@
$table = phutil_tag(
'table',
array('class' => 'phui-calendar-day-view'),
- array(
- '',
- $rows,
- ));
+ $rows);
+
+ $all_day_event_box = new PHUIBoxView();
+ foreach ($today_all_day_events as $all_day_event) {
+ $all_day_event_box->appendChild(
+ $this->drawAllDayEvent($all_day_event));
+ }
$header = $this->renderDayViewHeader();
$sidebar = $this->renderSidebar();
$table_box = id(new PHUIObjectBoxView())
->setHeader($header)
+ ->appendChild($all_day_event_box)
->appendChild($table)
->setFlush(true);
@@ -170,7 +190,6 @@
}
$all_day_events = array_values(msort($all_day_events, 'getEpochStart'));
-
return $all_day_events;
}
@@ -325,6 +344,35 @@
return $hourly_events;
}
+ private function drawAllDayEvent(AphrontCalendarEventView $event) {
+ $name = phutil_tag(
+ 'a',
+ array(
+ 'class' => 'all-day',
+ 'href' => $event->getURI(),
+ ),
+ $event->getName());
+
+ $all_day_label = phutil_tag(
+ 'span',
+ array(
+ 'class' => 'phui-calendar-all-day-label',
+ ),
+ pht('All Day'));
+
+ $div = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'phui-calendar-day-event',
+ ),
+ array(
+ $all_day_label,
+ $name,
+ ));
+
+ return $div;
+ }
+
private function drawEvent(
AphrontCalendarEventView $event,
$offset,
diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-day.css b/webroot/rsrc/css/phui/calendar/phui-calendar-day.css
--- a/webroot/rsrc/css/phui/calendar/phui-calendar-day.css
+++ b/webroot/rsrc/css/phui/calendar/phui-calendar-day.css
@@ -48,3 +48,25 @@
text-decoration: none;
color: {$greytext};
}
+
+.all-day {
+ border: 1px solid {$blueborder};
+ height: 12px;
+ margin: 0;
+ display: block;
+ padding: 8px;
+ background-color: {$bluebackground};
+ text-decoration: none;
+ color: {$greytext};
+}
+
+.phui-calendar-day-event + .phui-calendar-day-event .all-day {
+ border-top-style: none;
+ border-top-width: 0;
+}
+
+.phui-calendar-all-day-label {
+ color: {$greytext};
+ float: right;
+ margin: 8px 8px 0 0;
+}

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 15, 7:26 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7702301
Default Alt Text
D12779.id30721.diff (7 KB)

Event Timeline