@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Calendar day view should start at 8am at the latest and hour of first event at the earliest.

Summary: Closes T8114, Calendar day view should start at 8am at the latest and hour of first event at the earliest.

Test Plan: Open day view on day with all day event and event at 5am, all day events should all be stacked at the top of the day view table, and day should start at 5am.

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8114

Differential Revision: https://secure.phabricator.com/D12779

+94 -24
+2 -2
resources/celerity/map.php
··· 120 120 'rsrc/css/layout/phabricator-hovercard-view.css' => '44394670', 121 121 'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c', 122 122 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 123 - 'rsrc/css/phui/calendar/phui-calendar-day.css' => '75b8cc4a', 123 + 'rsrc/css/phui/calendar/phui-calendar-day.css' => '49037167', 124 124 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59', 125 125 'rsrc/css/phui/calendar/phui-calendar-month.css' => 'a92e47d2', 126 126 'rsrc/css/phui/calendar/phui-calendar.css' => '8675968e', ··· 777 777 'phui-box-css' => '7b3a2eed', 778 778 'phui-button-css' => 'de610129', 779 779 'phui-calendar-css' => '8675968e', 780 - 'phui-calendar-day-css' => '75b8cc4a', 780 + 'phui-calendar-day-css' => '49037167', 781 781 'phui-calendar-list-css' => 'c1d0ca59', 782 782 'phui-calendar-month-css' => 'a92e47d2', 783 783 'phui-crumbs-view-css' => '594d719e',
+70 -22
src/view/phui/calendar/PHUICalendarDayView.php
··· 35 35 36 36 $hours = $this->getHoursOfDay(); 37 37 $hourly_events = array(); 38 - $rows = array(); 38 + 39 + $first_event_hour = null; 39 40 40 41 $all_day_events = $this->getAllDayEvents(); 42 + $today_all_day_events = array(); 41 43 42 - // sort events into buckets by their start time 43 - // pretend no events overlap 44 + $day_start = $this->getDateTime(); 45 + $day_end = id(clone $day_start)->modify('+1 day'); 46 + 47 + $day_start = $day_start->format('U'); 48 + $day_end = $day_end->format('U'); 49 + 50 + foreach ($all_day_events as $all_day_event) { 51 + $all_day_start = $all_day_event->getEpochStart(); 52 + $all_day_end = $all_day_event->getEpochEnd(); 53 + 54 + if ($all_day_start < $day_end && $all_day_end > $day_start) { 55 + $today_all_day_events[] = $all_day_event; 56 + } 57 + } 58 + 44 59 foreach ($hours as $hour) { 45 60 $current_hour_events = array(); 46 61 $hour_start = $hour->format('U'); 47 62 $hour_end = id(clone $hour)->modify('+1 hour')->format('U'); 48 63 49 - if ($hour == $this->getDateTime()) { 50 - foreach ($all_day_events as $all_day_event) { 51 - $all_day_start = $all_day_event->getEpochStart(); 52 - $all_day_end = $all_day_event->getEpochEnd(); 53 - $day_end = id(clone $hour)->modify('+1 day')->format('U') - 1; 54 - 55 - if ($all_day_start < $day_end && $all_day_end > $hour_start) { 56 - 57 - $current_hour_events[] = $all_day_event; 58 - $this->todayEvents[] = $all_day_event; 59 - } 60 - } 61 - } 62 64 foreach ($this->events as $event) { 63 65 if ($event->getIsAllDay()) { 64 66 continue; ··· 81 83 * 100; 82 84 $height = min(2400, $height); 83 85 86 + if ($first_event_hour === null) { 87 + $first_event_hour = $hour; 88 + } 89 + 84 90 $hourly_events[$event->getEventID()] = array( 85 91 'hour' => $hour, 86 92 'event' => $event, ··· 99 105 $hourly_events); 100 106 } 101 107 102 - // actually construct table 108 + $rows = array(); 109 + 103 110 foreach ($hours as $hour) { 111 + $early_hours = array(8); 112 + if ($first_event_hour) { 113 + $early_hours[] = $first_event_hour->format('G'); 114 + } 115 + if ($hour->format('G') < min($early_hours)) { 116 + continue; 117 + } 118 + 104 119 $drawn_hourly_events = array(); 105 120 $cell_time = phutil_tag( 106 121 'td', ··· 109 124 110 125 foreach ($hourly_events as $hourly_event) { 111 126 if ($hourly_event['hour'] == $hour) { 127 + 112 128 $drawn_hourly_events[] = $this->drawEvent( 113 129 $hourly_event['event'], 114 130 $hourly_event['offset'], ··· 133 149 $table = phutil_tag( 134 150 'table', 135 151 array('class' => 'phui-calendar-day-view'), 136 - array( 137 - '', 138 - $rows, 139 - )); 152 + $rows); 153 + 154 + $all_day_event_box = new PHUIBoxView(); 155 + foreach ($today_all_day_events as $all_day_event) { 156 + $all_day_event_box->appendChild( 157 + $this->drawAllDayEvent($all_day_event)); 158 + } 140 159 141 160 $header = $this->renderDayViewHeader(); 142 161 $sidebar = $this->renderSidebar(); 143 162 144 163 $table_box = id(new PHUIObjectBoxView()) 145 164 ->setHeader($header) 165 + ->appendChild($all_day_event_box) 146 166 ->appendChild($table) 147 167 ->setFlush(true); 148 168 ··· 170 190 } 171 191 172 192 $all_day_events = array_values(msort($all_day_events, 'getEpochStart')); 173 - 174 193 return $all_day_events; 175 194 } 176 195 ··· 323 342 } 324 343 325 344 return $hourly_events; 345 + } 346 + 347 + private function drawAllDayEvent(AphrontCalendarEventView $event) { 348 + $name = phutil_tag( 349 + 'a', 350 + array( 351 + 'class' => 'all-day', 352 + 'href' => $event->getURI(), 353 + ), 354 + $event->getName()); 355 + 356 + $all_day_label = phutil_tag( 357 + 'span', 358 + array( 359 + 'class' => 'phui-calendar-all-day-label', 360 + ), 361 + pht('All Day')); 362 + 363 + $div = phutil_tag( 364 + 'div', 365 + array( 366 + 'class' => 'phui-calendar-day-event', 367 + ), 368 + array( 369 + $all_day_label, 370 + $name, 371 + )); 372 + 373 + return $div; 326 374 } 327 375 328 376 private function drawEvent(
+22
webroot/rsrc/css/phui/calendar/phui-calendar-day.css
··· 48 48 text-decoration: none; 49 49 color: {$greytext}; 50 50 } 51 + 52 + .all-day { 53 + border: 1px solid {$blueborder}; 54 + height: 12px; 55 + margin: 0; 56 + display: block; 57 + padding: 8px; 58 + background-color: {$bluebackground}; 59 + text-decoration: none; 60 + color: {$greytext}; 61 + } 62 + 63 + .phui-calendar-day-event + .phui-calendar-day-event .all-day { 64 + border-top-style: none; 65 + border-top-width: 0; 66 + } 67 + 68 + .phui-calendar-all-day-label { 69 + color: {$greytext}; 70 + float: right; 71 + margin: 8px 8px 0 0; 72 + }