diff --git a/src/applications/conpherence/controller/ConpherenceWidgetController.php b/src/applications/conpherence/controller/ConpherenceWidgetController.php index 123df65de7..86ef133029 100644 --- a/src/applications/conpherence/controller/ConpherenceWidgetController.php +++ b/src/applications/conpherence/controller/ConpherenceWidgetController.php @@ -204,33 +204,42 @@ final class ConpherenceWidgetController extends $today = $timestamps['today']; $epoch_stamps = $timestamps['epoch_stamps']; $one_day = 24 * 60 * 60; - foreach ($epoch_stamps as $time => $day) { + $is_today = false; + $calendar_columns = 0; + $list_days = 0; + foreach ($epoch_stamps as $day) { // build a header for the new day - if ($day->format('w') == $today->format('w')) { - $active_class = 'today'; + if ($day->format('Ymd') == $today->format('Ymd')) { + $active_class = 'today'; + $is_today = true; } else { - $active_class = ''; + $active_class = ''; + $is_today = false; } - $content[] = phutil_tag( - 'div', - array( - 'class' => 'day-header '.$active_class - ), - array( - phutil_tag( - 'div', - array( - 'class' => 'day-name' - ), - $day->format('l')), - phutil_tag( - 'div', - array( - 'class' => 'day-date' - ), - $day->format('m/d/y')) - )); + $should_draw_list = $list_days < 7; + $list_days++; + + if ($should_draw_list) { + $content[] = phutil_tag( + 'div', + array( + 'class' => 'day-header '.$active_class + ), + array( + phutil_tag( + 'div', + array( + 'class' => 'day-name' + ), + $day->format('l')), + phutil_tag( + 'div', + array( + 'class' => 'day-date' + ), + $day->format('m/d/y')))); + } $week_day_number = $day->format('w'); @@ -251,81 +260,73 @@ final class ConpherenceWidgetController extends if ($status->getDateFrom() < $epoch_end && $status->getDateTo() > $epoch_start) { - if (!$first_status_of_the_day) { + $statuses_of_the_day[$status->getUserPHID()] = $status; + if ($should_draw_list) { + $top_border = ''; + if (!$first_status_of_the_day) { + $top_border = ' top-border'; + } + $timespan = $status->getDateTo() - $status->getDateFrom(); + if ($timespan > $one_day) { + $time_str = 'm/d'; + } else { + $time_str = 'h:i A'; + } + $epoch_range = + phabricator_format_local_time( + $status->getDateFrom(), + $user, + $time_str) . + ' - ' . + phabricator_format_local_time( + $status->getDateTo(), + $user, + $time_str); + + $secondary_info = pht('%s, %s', + $handles[$status->getUserPHID()]->getName(), $epoch_range); + $content[] = phutil_tag( 'div', array( - 'class' => 'divider' + 'class' => 'user-status '.$status->getTextStatus().$top_border, ), - ''); + array( + phutil_tag( + 'div', + array( + 'class' => 'icon', + ), + ''), + phutil_tag( + 'div', + array( + 'class' => 'description' + ), + array( + $status->getTerseSummary($user), + phutil_tag( + 'div', + array( + 'class' => 'participant' + ), + $secondary_info))))); } - $statuses_of_the_day[$status->getUserPHID()] = $status; - $timespan = $status->getDateTo() - $status->getDateFrom(); - if ($timespan > $one_day) { - $time_str = 'm/d'; - } else { - $time_str = 'h:i A'; - } - $epoch_range = phabricator_format_local_time( - $status->getDateFrom(), - $user, - $time_str) . ' - ' . phabricator_format_local_time( - $status->getDateTo(), - $user, - $time_str); - - $secondary_info = pht('%s, %s', - $handles[$status->getUserPHID()]->getName(), $epoch_range); - - $content[] = phutil_tag( - 'div', - array( - 'class' => 'pm user-status '.$status->getTextStatus(), - ), - array( - phutil_tag( - 'div', - array( - 'class' => 'icon', - ), - ''), - phutil_tag( - 'div', - array( - 'class' => 'description' - ), - array( - $status->getTerseSummary($user), - phutil_tag( - 'div', - array( - 'class' => 'participant' - ), - $secondary_info))) - )); $first_status_of_the_day = false; - } else { - $content[] = phutil_tag( - 'div', - array('class' => 'no-events pmt pml'), - pht('No Events Scheduled.')); } } // we didn't get a status on this day so add a spacer - if ($first_status_of_the_day) { + if ($first_status_of_the_day && $should_draw_list) { $content[] = phutil_tag( 'div', - array( - 'class' => 'spacer' - ), - ''); + array('class' => 'no-events pm'), + pht('No Events Scheduled.')); } - if ($week_day_number > 0 && $week_day_number < 6) { - if ($week_day_number == $today->format('w')) { + if ($is_today || ($calendar_columns && $calendar_columns < 3)) { + $active_class = ''; + if ($day->format('Ymd') == $today->format('Ymd')) { $active_class = '-active'; - } else { - $active_class = ''; } $inner_layout = array(); foreach ($participants as $phid => $participant) { @@ -366,7 +367,8 @@ final class ConpherenceWidgetController extends ), $day->format('j')), $inner_layout - ))); + ))); + $calendar_columns++; } } @@ -381,15 +383,14 @@ final class ConpherenceWidgetController extends $user = $this->getRequest()->getUser(); $timezone = new DateTimeZone($user->getTimezoneIdentifier()); - $today = id(new DateTime('today', $timezone)); + $first_day = new DateTime('last sunday', $timezone); $timestamps = array(); - for ($day = 0; $day < 3; $day++) { - $timestamp = clone $today; + for ($day = 0; $day < 8; $day++) { + $timestamp = clone $first_day; $timestamps[] = $timestamp->modify(sprintf('+%d days', $day)); } - return array( - 'today' => $today, + 'today' => new DateTime('today', $timezone), 'epoch_stamps' => $timestamps ); } @@ -399,4 +400,4 @@ final class ConpherenceWidgetController extends return $this->getApplicationURI('update/'.$conpherence->getID().'/'); } -} + } diff --git a/src/applications/conpherence/query/ConpherenceThreadQuery.php b/src/applications/conpherence/query/ConpherenceThreadQuery.php index 1de9d4a86d..33b6f84260 100644 --- a/src/applications/conpherence/query/ConpherenceThreadQuery.php +++ b/src/applications/conpherence/query/ConpherenceThreadQuery.php @@ -217,13 +217,15 @@ final class ConpherenceThreadQuery $file_phids = array_mergev($file_phids); // statuses of everyone currently in the conpherence - // for a rolling three day window + // we show sunday -> saturday in a list *AND* a window + // of today -> +2 days. If its saturday we need + // +2 days. $start_epoch = phabricator_format_local_time( - strtotime('today', strtotime('tomorrow')), + strtotime('last sunday', strtotime('tomorrow')), $this->getViewer(), 'U'); $end_epoch = phabricator_format_local_time( - strtotime('+3 days', strtotime('tomorrow')), + strtotime('last sunday +8 days', strtotime('tomorrow')), $this->getViewer(), 'U'); $statuses = id(new PhabricatorUserStatus()) diff --git a/webroot/rsrc/css/application/conpherence/widget-pane.css b/webroot/rsrc/css/application/conpherence/widget-pane.css index 0c8c2afd31..d7479c76d4 100644 --- a/webroot/rsrc/css/application/conpherence/widget-pane.css +++ b/webroot/rsrc/css/application/conpherence/widget-pane.css @@ -140,8 +140,12 @@ .conpherence-widget-pane #widgets-calendar .aphront-multi-column-view { width: 240px; } -.device .conpherence-widget-pane #widgets-calendar .aphront-multi-column-view { - margin: 2px 0px 0px 0px; +.device-phone .conpherence-widget-pane #widgets-calendar +.aphront-multi-column-view { + display: none; +} +.device-tablet .conpherence-widget-pane #widgets-calendar +.aphront-multi-column-view { width: 100%; } .conpherence-widget-pane #widgets-calendar .aphront-multi-column-view @@ -150,6 +154,11 @@ border-right: 1px solid #bfbfbf; text-align: center; } +.device-phone .conpherence-widget-pane #widgets-calendar +.aphront-multi-column-view .aphront-multi-column-column { + border-right: 0; +} + .device-phone .conpherence-widget-pane #widgets-calendar .aphront-multi-column-fluid .aphront-multi-column-5-up .aphront-multi-column-column-outer { @@ -248,22 +257,13 @@ font-size: 11px; } -.conpherence-widget-pane #widgets-calendar .divider { - float: left; - clear: both; - width: 220px; +.conpherence-widget-pane #widgets-calendar .top-border { + border-top: 1px solid #E7E7E7; +} + +.conpherence-widget-pane #widgets-calendar .user-status { + padding: 10px 0px 10px 0px; margin: 0px 0px 0px 10px; - border: 1px dashed #bfbfbf; -} -.conpherence-widget-pane #widgets-calendar .divider { - width: 96%; - margin: 0px 0px 0px 2%; -} -.conpherence-widget-pane #widgets-calendar .spacer { - float: left; - clear: both; - height: 10px; - width: 100%; } .conpherence-widget-pane #widgets-calendar .user-status .icon { @@ -284,9 +284,8 @@ .conpherence-widget-pane #widgets-calendar .user-status .description { width: 195px; - float: left; text-overflow: ellipsis; - margin: 0 0 10px 10px; + margin: 0 0 0px 20px; } .conpherence-widget-pane #widgets-calendar .user-status .participant {