Page MenuHomePhabricator

D12850.id30916.diff
No OneTemporary

D12850.id30916.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -120,10 +120,10 @@
'rsrc/css/layout/phabricator-hovercard-view.css' => 'dd9121a9',
'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' => '38891735',
+ 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c5449cca',
'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59',
- 'rsrc/css/phui/calendar/phui-calendar-month.css' => '3150cfbf',
- 'rsrc/css/phui/calendar/phui-calendar.css' => '8675968e',
+ 'rsrc/css/phui/calendar/phui-calendar-month.css' => '234c5752',
+ 'rsrc/css/phui/calendar/phui-calendar.css' => '00b3c6ee',
'rsrc/css/phui/phui-action-header-view.css' => '89c497e7',
'rsrc/css/phui/phui-action-list.css' => '4f4d09f2',
'rsrc/css/phui/phui-action-panel.css' => '3ee9afd5',
@@ -760,10 +760,10 @@
'phui-action-panel-css' => '3ee9afd5',
'phui-box-css' => '7b3a2eed',
'phui-button-css' => 'de610129',
- 'phui-calendar-css' => '8675968e',
- 'phui-calendar-day-css' => '38891735',
+ 'phui-calendar-css' => '00b3c6ee',
+ 'phui-calendar-day-css' => 'c5449cca',
'phui-calendar-list-css' => 'c1d0ca59',
- 'phui-calendar-month-css' => '3150cfbf',
+ 'phui-calendar-month-css' => '234c5752',
'phui-crumbs-view-css' => '594d719e',
'phui-document-view-css' => '94d5dcd8',
'phui-feed-story-css' => 'c9f3a0b5',
diff --git a/src/applications/calendar/constants/CalendarColors.php b/src/applications/calendar/constants/CalendarColors.php
--- a/src/applications/calendar/constants/CalendarColors.php
+++ b/src/applications/calendar/constants/CalendarColors.php
@@ -10,6 +10,7 @@
const COLOR_SKY = 'sky';
const COLOR_INDIGO = 'indigo';
const COLOR_VIOLET = 'violet';
+ const COLOR_GREY = 'grey';
public static function getColors() {
return array(
@@ -21,6 +22,7 @@
self::COLOR_INDIGO,
self::COLOR_RED,
self::COLOR_YELLOW,
+ self::COLOR_GREY,
);
}
diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
--- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
+++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
@@ -359,25 +359,10 @@
$phids = mpull($statuses, 'getUserPHID');
- /* Assign Colors */
- $unique = array_unique($phids);
- $allblue = false;
- $calcolors = CalendarColors::getColors();
- if (count($unique) > count($calcolors)) {
- $allblue = true;
- }
- $i = 0;
- $eventcolor = array();
- foreach ($unique as $phid) {
- if ($allblue) {
- $eventcolor[$phid] = CalendarColors::COLOR_SKY;
- } else {
- $eventcolor[$phid] = $calcolors[$i];
- }
- $i++;
- }
-
foreach ($statuses as $status) {
+ $viewer_is_invited = $this->getViewerIsInvited($status);
+ $event_color = $this->getEventColor($viewer_is_invited);
+
$event = new AphrontCalendarEventView();
$event->setEpochRange($status->getDateFrom(), $status->getDateTo());
$event->setIsAllDay($status->getIsAllDay());
@@ -388,7 +373,8 @@
$event->setDescription(pht('%s (%s)', $name_text, $status_text));
$event->setName($status_text);
$event->setEventID($status->getID());
- $event->setColor($eventcolor[$status->getUserPHID()]);
+ $event->setViewerIsInvited($viewer_is_invited);
+ $event->setColor($event_color);
$month_view->addEvent($event);
}
@@ -422,10 +408,15 @@
continue;
}
+ $viewer_is_invited = $this->getViewerIsInvited($status);
+ $event_color = $this->getEventColor($viewer_is_invited);
+
$event = new AphrontCalendarEventView();
$event->setEventID($status->getID());
$event->setEpochRange($status->getDateFrom(), $status->getDateTo());
$event->setIsAllDay($status->getIsAllDay());
+ $event->setViewerIsInvited($viewer_is_invited);
+ $event->setColor($event_color);
$event->setName($status->getName());
$event->setURI('/'.$status->getMonogram());
@@ -514,4 +505,29 @@
return false;
}
+
+ private function getViewerIsInvited($event) {
+ $viewer = $this->requireViewer();
+ $invitees = $event->getInvitees();
+
+ foreach ($invitees as $invitee) {
+ $invitee_phid = $invitee->getinviteePHID();
+ $invitee_status = $invitee->getStatus();
+ if ($invitee_phid == $viewer->getPHID() &&
+ $invitee_status != PhabricatorCalendarEventInvitee::STATUS_UNINVITED &&
+ $invitee_status != PhabricatorCalendarEventInvitee::STATUS_DECLINED) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private function getEventColor($viewer_is_invited) {
+ if ($viewer_is_invited) {
+ return CalendarColors::COLOR_GREEN;
+ } else {
+ return CalendarColors::COLOR_GREY;
+ }
+ }
}
diff --git a/src/applications/calendar/view/AphrontCalendarEventView.php b/src/applications/calendar/view/AphrontCalendarEventView.php
--- a/src/applications/calendar/view/AphrontCalendarEventView.php
+++ b/src/applications/calendar/view/AphrontCalendarEventView.php
@@ -9,6 +9,7 @@
private $description;
private $eventID;
private $color;
+ private $viewerIsInvited;
private $uri;
private $isAllDay;
@@ -29,6 +30,14 @@
return $this->eventID;
}
+ public function setViewerIsInvited($viewer_is_invited) {
+ $this->viewerIsInvited = $viewer_is_invited;
+ return $this;
+ }
+ public function getViewerIsInvited() {
+ return $this->viewerIsInvited;
+ }
+
public function setUserPHID($user_phid) {
$this->userPHID = $user_phid;
return $this;
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
@@ -109,6 +109,7 @@
'width' => '100%',
'top' => $top.'%',
'height' => $height.'%',
+ 'color' => $event->getColor(),
);
}
}
@@ -145,7 +146,8 @@
$hourly_event['offset'],
$hourly_event['width'],
$hourly_event['top'],
- $hourly_event['height']);
+ $hourly_event['height'],
+ $hourly_event['color']);
}
}
$cell_event = phutil_tag(
@@ -391,10 +393,15 @@
}
private function drawAllDayEvent(AphrontCalendarEventView $event) {
+ $class = 'day-view-all-day';
+ if ($event->getColor()) {
+ $class = $class.' '.$event->getColor().'-day-event';
+ }
+
$name = phutil_tag(
'a',
array(
- 'class' => 'day-view-all-day',
+ 'class' => $class,
'href' => $event->getURI(),
),
$event->getName());
@@ -424,11 +431,18 @@
$offset,
$width,
$top,
- $height) {
+ $height,
+ $background_color) {
+
+ $class = 'phui-calendar-day-event-link';
+ if ($background_color) {
+ $class = $class.' '.$background_color.'-day-event';
+ }
+
$name = phutil_tag(
'a',
array(
- 'class' => 'phui-calendar-day-event-link',
+ 'class' => $class,
'href' => $event->getURI(),
),
$event->getName());
diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php
--- a/src/view/phui/calendar/PHUICalendarListView.php
+++ b/src/view/phui/calendar/PHUICalendarListView.php
@@ -159,4 +159,13 @@
return $anchor;
}
+
+ public function getIsViewerInvitedOnList() {
+ foreach ($this->events as $event) {
+ if ($event->getViewerIsInvited()) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php
--- a/src/view/phui/calendar/PHUICalendarMonthView.php
+++ b/src/view/phui/calendar/PHUICalendarMonthView.php
@@ -178,7 +178,11 @@
$uri = $event_list['uri'];
$count = $event_list['count'];
- $event_count_badge = $this->getEventCountBadge($count);
+ $viewer_is_invited = $list->getIsViewerInvitedOnList();
+
+ $color = $viewer_is_invited ? CalendarColors::COLOR_GREEN : null;
+
+ $event_count_badge = $this->getEventCountBadge($count, $color);
$cell_day_secret_link = $this->getHiddenDayLink($uri);
$cell_data_div = phutil_tag(
@@ -252,13 +256,19 @@
$cell_div);
}
- private function getEventCountBadge($count) {
+ private function getEventCountBadge($count, $color) {
+ $class = 'phui-calendar-month-count-badge';
+
+ if ($color) {
+ $class = $class.' '.$color.'-day-badge';
+ }
+
$event_count = null;
if ($count > 0) {
$event_count = phutil_tag(
'div',
array(
- 'class' => 'phui-calendar-month-count-badge',
+ 'class' => $class,
),
$count);
}
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
@@ -37,8 +37,8 @@
.phui-calendar-day-event-link {
padding: 8px;
- border: 1px solid {$blueborder};
- background-color: {$bluebackground};
+ border: 1px solid {$greyborder};
+ background-color: {$darkgreybackground};
margin: 0 4px;
position: absolute;
left: 0;
@@ -49,17 +49,29 @@
color: {$greytext};
}
+.phui-calendar-day-event-link.green-day-event {
+ border-color: {$green};
+ background-color: {$lightgreen};
+ color: {$green};
+}
+
.day-view-all-day {
- border: 1px solid {$blueborder};
+ border: 1px solid {$greyborder};
height: 12px;
margin: 0;
display: block;
padding: 8px;
- background-color: {$bluebackground};
+ background-color: {$darkgreybackground};
text-decoration: none;
color: {$greytext};
}
+.day-view-all-day.green-day-event {
+ border-color: {$green};
+ background-color: {$lightgreen};
+ color: {$green};
+}
+
.phui-calendar-day-event + .phui-calendar-day-event .day-view-all-day {
border-top-style: none;
border-top-width: 0;
diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css
--- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css
+++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css
@@ -73,6 +73,11 @@
margin: 0 auto;
}
+.phui-calendar-month-count-badge.green-day-badge {
+ border-color: {$green};
+ color: {$green};
+}
+
table.phui-calendar-view a.phui-calendar-date-number {
color: {$lightgreytext};
padding: 0 4px;
@@ -116,12 +121,16 @@
.phui-calendar-view .phui-calendar-list li.phui-calendar-list-item.all-day {
margin: 0;
- padding: 4px 8px;
- background-color: {$lightpink};
+ padding: 4px 4px 0px 4px;
+ background-color: {$darkgreybackground};
display: block;
float: none;
}
+.phui-calendar-view .phui-calendar-list li.phui-calendar-green.all-day {
+ background-color: {$lightgreen};
+}
+
li.phui-calendar-list-item.all-day:first-child {
margin-top: 0;
}
@@ -155,7 +164,11 @@
}
li.phui-calendar-list-item.all-day .phui-calendar-list-title a{
- color: {$pink};
+ color: {$greytext};
+}
+
+li.phui-calendar-green.all-day .phui-calendar-list-title a{
+ color: {$green};
}
.phui-calendar-view .phui-calendar-list-time {
diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar.css b/webroot/rsrc/css/phui/calendar/phui-calendar.css
--- a/webroot/rsrc/css/phui/calendar/phui-calendar.css
+++ b/webroot/rsrc/css/phui/calendar/phui-calendar.css
@@ -34,6 +34,10 @@
color: {$violet};
}
+.phui-calendar-grey a {
+ color: {$lightgreytext};
+}
+
.phui-calendar-bg-red {
background-color: {$lightred};
}
@@ -66,6 +70,10 @@
background-color: {$lightviolet};
}
+.phui-calendar-bg-grey {
+ background-color: {$darkgreybackground};
+}
+
.phui-calendar-red .phui-calendar-list-dot {
background-color: {$red};
border-color: {$red};
@@ -105,3 +113,8 @@
background-color: {$violet};
border-color: {$violet};
}
+
+.phui-calendar-grey .phui-calendar-list-dot {
+ background-color: {$lightgreytext};
+ border-color: {$lightgreytext};
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 7, 10:28 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6758267
Default Alt Text
D12850.id30916.diff (12 KB)

Event Timeline