Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15367886
D12779.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D12779.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -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',
@@ -777,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',
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
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 12, 9:39 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7383767
Default Alt Text
D12779.diff (5 KB)
Attached To
Mode
D12779: Calendar day view should start at 8am at the latest and hour of first event at the earliest.
Attached
Detach File
Event Timeline
Log In to Comment