From c87d4630934e4d024d37166ede0d601f4431fa89 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 18 Aug 2015 19:55:22 -0700 Subject: [PATCH] Remove Calendar from Conpherence Summary: Ref T8834, cleanly removes "Calendar" widget from Conpherence. RIP. :( Test Plan: Bounce around Conpherence, no Calendar. grep for "calendar" in apps folder, css, js Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T8834 Differential Revision: https://secure.phabricator.com/D13934 --- resources/celerity/map.php | 4 +- .../ConpherenceWidgetConfigConstants.php | 11 - .../controller/ConpherenceController.php | 8 - .../ConpherenceWidgetController.php | 211 ------------------ .../application/conpherence/widget-pane.css | 154 ------------- 5 files changed, 2 insertions(+), 386 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index af179cf770..6b7b0e4194 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -51,7 +51,7 @@ return array( 'rsrc/css/application/conpherence/notification.css' => '6cdcc253', 'rsrc/css/application/conpherence/transaction.css' => '85d0974c', 'rsrc/css/application/conpherence/update.css' => 'faf6be09', - 'rsrc/css/application/conpherence/widget-pane.css' => '419fd50c', + 'rsrc/css/application/conpherence/widget-pane.css' => 'b0793769', 'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4', 'rsrc/css/application/countdown/timer.css' => 'e7544472', 'rsrc/css/application/daemon/bulk-job.css' => 'df9c1d4a', @@ -514,7 +514,7 @@ return array( 'conpherence-thread-manager' => '01774ab2', 'conpherence-transaction-css' => '85d0974c', 'conpherence-update-css' => 'faf6be09', - 'conpherence-widget-pane-css' => '419fd50c', + 'conpherence-widget-pane-css' => 'b0793769', 'differential-changeset-view-css' => 'b6b0d1bb', 'differential-core-view-css' => '7ac3cabc', 'differential-inline-comment-editor' => 'd4c87bf4', diff --git a/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php b/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php index e7983a7504..9de4420e75 100644 --- a/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php +++ b/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php @@ -36,17 +36,6 @@ final class ConpherenceWidgetConfigConstants extends ConpherenceConstants { 'deviceOnly' => false, 'hasCreate' => false, ), - 'widgets-calendar' => array( - 'name' => pht('Calendar'), - 'icon' => 'fa-calendar', - 'deviceOnly' => false, - 'hasCreate' => true, - 'createData' => array( - 'refreshFromResponse' => false, - 'action' => ConpherenceUpdateActions::ADD_STATUS, - 'customHref' => '/calendar/event/create/', - ), - ), 'widgets-settings' => array( 'name' => pht('Notifications'), 'icon' => 'fa-wrench', diff --git a/src/applications/conpherence/controller/ConpherenceController.php b/src/applications/conpherence/controller/ConpherenceController.php index 3317b0c092..8faae68546 100644 --- a/src/applications/conpherence/controller/ConpherenceController.php +++ b/src/applications/conpherence/controller/ConpherenceController.php @@ -27,14 +27,6 @@ abstract class ConpherenceController extends PhabricatorController { ->addSigil('conpherence-widget-adder') ->setMetadata(array('widget' => 'widgets-people'))); - $nav->addMenuItem( - id(new PHUIListItemView()) - ->setName(pht('New Calendar Item')) - ->setType(PHUIListItemView::TYPE_LINK) - ->setHref('/calendar/event/create/') - ->addSigil('conpherence-widget-adder') - ->setMetadata(array('widget' => 'widgets-calendar'))); - return $nav; } diff --git a/src/applications/conpherence/controller/ConpherenceWidgetController.php b/src/applications/conpherence/controller/ConpherenceWidgetController.php index 852ceb9e74..34fa20dee6 100644 --- a/src/applications/conpherence/controller/ConpherenceWidgetController.php +++ b/src/applications/conpherence/controller/ConpherenceWidgetController.php @@ -44,10 +44,6 @@ final class ConpherenceWidgetController extends ConpherenceController { case 'widgets-files': $content = $this->renderFileWidgetPaneContent(); break; - case 'widgets-calendar': - $widget = $this->renderCalendarWidgetPaneContent(); - $content = phutil_implode_html('', $widget); - break; case 'widgets-settings': $content = $this->renderSettingsWidgetPaneContent(); break; @@ -103,14 +99,6 @@ final class ConpherenceWidgetController extends ConpherenceController { 'style' => 'display: none;', ), $this->renderFileWidgetPaneContent()); - $widgets[] = phutil_tag( - 'div', - array( - 'class' => 'widgets-body', - 'id' => 'widgets-calendar', - 'style' => 'display: none;', - ), - $this->renderCalendarWidgetPaneContent()); $widgets[] = phutil_tag( 'div', array( @@ -227,205 +215,6 @@ final class ConpherenceWidgetController extends ConpherenceController { $layout); } - private function renderCalendarWidgetPaneContent() { - $user = $this->getRequest()->getUser(); - - $conpherence = $this->getConpherence(); - $participants = $conpherence->getParticipants(); - $widget_data = $conpherence->getWidgetData(); - - // TODO: This panel is built around an outdated notion of events and isn't - // invitee-aware. - - $statuses = $widget_data['events']; - $handles = $conpherence->getHandles(); - $content = array(); - $layout = id(new AphrontMultiColumnView()) - ->setFluidLayout(true); - $timestamps = CalendarTimeUtil::getCalendarWidgetTimestamps($user); - $today = $timestamps['today']; - $epoch_stamps = $timestamps['epoch_stamps']; - $one_day = 24 * 60 * 60; - $is_today = false; - $calendar_columns = 0; - $list_days = 0; - foreach ($epoch_stamps as $day) { - // build a header for the new day - if ($day->format('Ymd') == $today->format('Ymd')) { - $active_class = 'today'; - $is_today = true; - } else { - $active_class = ''; - $is_today = false; - } - - $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'); - - $epoch_start = $day->format('U'); - $next_day = clone $day; - $next_day->modify('+1 day'); - $epoch_end = $next_day->format('U'); - - $first_status_of_the_day = true; - $statuses_of_the_day = array(); - // keep looking through statuses where we last left off - foreach ($statuses as $status) { - if ($status->getDateFrom() >= $epoch_end) { - // This list is sorted, so we can stop looking. - break; - } - - if ($status->getDateFrom() < $epoch_end && - $status->getDateTo() > $epoch_start) { - $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); - - if (isset($handles[$status->getUserPHID()])) { - $secondary_info = pht( - '%s, %s', - $handles[$status->getUserPHID()]->getName(), - $epoch_range); - } else { - $secondary_info = $epoch_range; - } - - $content[] = phutil_tag( - 'div', - array( - 'class' => 'user-status '.$top_border, - ), - array( - phutil_tag( - 'div', - array( - 'class' => 'icon', - ), - ''), - phutil_tag( - 'div', - array( - 'class' => 'description', - ), - array( - $status->getName(), - phutil_tag( - 'div', - array( - 'class' => 'participant', - ), - $secondary_info), - )), - )); - } - $first_status_of_the_day = false; - } - } - - // we didn't get a status on this day so add a spacer - if ($first_status_of_the_day && $should_draw_list) { - $content[] = phutil_tag( - 'div', - array('class' => 'no-events pm'), - pht('No Events Scheduled.')); - } - if ($is_today || ($calendar_columns && $calendar_columns < 3)) { - $active_class = ''; - if ($is_today) { - $active_class = '-active'; - } - $inner_layout = array(); - foreach ($participants as $phid => $participant) { - $status = idx($statuses_of_the_day, $phid, false); - if ($status) { - $inner_layout[] = phutil_tag( - 'div', - array(), - ''); - } else { - $inner_layout[] = phutil_tag( - 'div', - array( - 'class' => 'present', - ), - ''); - } - } - $layout->addColumn( - phutil_tag( - 'div', - array( - 'class' => 'day-column'.$active_class, - ), - array( - phutil_tag( - 'div', - array( - 'class' => 'day-name', - ), - $day->format('D')), - phutil_tag( - 'div', - array( - 'class' => 'day-number', - ), - $day->format('j')), - $inner_layout, - ))); - $calendar_columns++; - } - } - - return array( - $layout, - $content, - ); - } - private function getWidgetURI() { $conpherence = $this->getConpherence(); return $this->getApplicationURI('update/'.$conpherence->getID().'/'); diff --git a/webroot/rsrc/css/application/conpherence/widget-pane.css b/webroot/rsrc/css/application/conpherence/widget-pane.css index 0038ead357..f4f3449dc3 100644 --- a/webroot/rsrc/css/application/conpherence/widget-pane.css +++ b/webroot/rsrc/css/application/conpherence/widget-pane.css @@ -158,160 +158,6 @@ margin: 8px 0px 0px 10%; } -/* calendar widget */ - -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view { - width: 240px; -} -.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 -.aphront-multi-column-column { - background: white; - border-right: 1px solid {$thinblueborder}; - 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 { - width: 20%; - margin-bottom: 0px; - float: left; - clear: none; -} - -.conpherence-widget-pane .no-events { - color: {$lightgreytext}; -} - -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view -.aphront-multi-column-column-last { - border-right: 0; -} -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view -.aphront-multi-column-column .day-column, -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view -.aphront-multi-column-column .day-column-active { - color: #bfbfbf; - background-color: white; - font-weight: bold; - padding: 0px 0px 10px 0px; -} -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view -.aphront-multi-column-column .day-column-active { - color: black; -} -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view -.aphront-multi-column-column .present , -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view -.aphront-multi-column-column .sporadic , -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view -.aphront-multi-column-column .away { - height: 10px; - margin: 5px 0px 5px 0px; - width: 100%; -} -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view -.aphront-multi-column-column .present { - background-color: white; -} -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view -.aphront-multi-column-column .sporadic { - background-color: rgb(222, 226, 232); -} -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view -.aphront-multi-column-column .away { - background-color: rgb(102, 204, 255); -} -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view - .day-name { - padding: 5px 0px 0px 0px; - font-size: {$smallerfontsize}; -} -.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view - .day-number { - font-size: {$biggestfontsize}; - padding: 0 0 5px 0; -} - -.conpherence-widget-pane #widgets-calendar .day-header { - overflow: hidden; - border-top: 1px solid {$thinblueborder}; - padding: 8px 8px 0px 8px; -} - -.conpherence-widget-pane #widgets-calendar .day-header.today .day-name, -.conpherence-widget-pane #widgets-calendar .day-header.today .day-date { - color: {$sky}; -} - -.conpherence-widget-pane #widgets-calendar .day-header .day-name { - float: left; - color: {$bluetext}; - font-weight: bold; - text-transform: uppercase; - font-size: {$smallestfontsize}; -} - -.conpherence-widget-pane #widgets-calendar .day-header .day-date { - float: right; - color: {$lightbluetext}; - font-size: {$smallestfontsize}; -} - -.conpherence-widget-pane #widgets-calendar .top-border { - border-top: 1px solid {$thinblueborder}; -} - -.conpherence-widget-pane #widgets-calendar .user-status { - padding: 10px 0px 10px 0px; - margin: 0px 0px 0px 10px; -} - -.conpherence-widget-pane #widgets-calendar .user-status .icon { - border-radius: 8px; - height: 8px; - width: 8px; - margin-top: 4px; - float: left; -} - -.conpherence-widget-pane #widgets-calendar .sporadic .icon { - background-color: {$orange}; -} - -.conpherence-widget-pane #widgets-calendar .away .icon { - background-color: {$red}; -} - -.conpherence-widget-pane #widgets-calendar .user-status .description { - width: 195px; - text-overflow: ellipsis; - margin: 0 0 0 16px; -} - -.conpherence-widget-pane #widgets-calendar .user-status .participant { - font-size: {$smallestfontsize}; - color: {$lightgreytext}; - padding-top: 2px; -} - -.device .conpherence-widget-pane #widgets-calendar .user-status .description, -.device .conpherence-widget-pane #widgets-calendar .user-status .participant { - /* we keep these short so no need to change the width */ -} - .conpherence-widget-pane .widget-icon { display: block; height: 14px;