Page MenuHomePhabricator

D12850.diff
No OneTemporary

D12850.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' => '3b4a65d8',
'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' => '3e42c803',
+ 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98',
'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' => '8345be98',
+ 'phui-calendar-day-css' => '3b4a65d8',
'phui-calendar-list-css' => 'c1d0ca59',
- 'phui-calendar-month-css' => '3150cfbf',
+ 'phui-calendar-month-css' => '3e42c803',
'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,9 @@
$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 = $status->getIsUserInvited($viewer->getPHID());
+
$event = new AphrontCalendarEventView();
$event->setEpochRange($status->getDateFrom(), $status->getDateTo());
$event->setIsAllDay($status->getIsAllDay());
@@ -388,7 +372,7 @@
$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);
$month_view->addEvent($event);
}
@@ -422,10 +406,13 @@
continue;
}
+ $viewer_is_invited = $status->getIsUserInvited($viewer->getPHID());
+
$event = new AphrontCalendarEventView();
$event->setEventID($status->getID());
$event->setEpochRange($status->getDateFrom(), $status->getDateTo());
$event->setIsAllDay($status->getIsAllDay());
+ $event->setViewerIsInvited($viewer_is_invited);
$event->setName($status->getName());
$event->setURI('/'.$status->getMonogram());
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -215,6 +215,16 @@
return $is_attending;
}
+ public function getIsUserInvited($phid) {
+ $uninvited_status = PhabricatorCalendarEventInvitee::STATUS_UNINVITED;
+ $declined_status = PhabricatorCalendarEventInvitee::STATUS_DECLINED;
+ $status = $this->getUserInviteStatus($phid);
+ if ($status == $uninvited_status || $status == $declined_status) {
+ return false;
+ }
+ return true;
+ }
+
/* -( Markup Interface )--------------------------------------------------- */
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
@@ -8,7 +8,7 @@
private $epochEnd;
private $description;
private $eventID;
- private $color;
+ private $viewerIsInvited;
private $uri;
private $isAllDay;
@@ -29,6 +29,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;
@@ -70,18 +78,6 @@
return $this->description;
}
- public function setColor($color) {
- $this->color = $color;
- return $this;
- }
- public function getColor() {
- if ($this->color) {
- return $this->color;
- } else {
- return CalendarColors::COLOR_SKY;
- }
- }
-
public function setIsAllDay($is_all_day) {
$this->isAllDay = $is_all_day;
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
@@ -391,10 +391,15 @@
}
private function drawAllDayEvent(AphrontCalendarEventView $event) {
+ $class = 'day-view-all-day';
+ if ($event->getViewerIsInvited()) {
+ $class = $class.' viewer-invited-day-event';
+ }
+
$name = phutil_tag(
'a',
array(
- 'class' => 'day-view-all-day',
+ 'class' => $class,
'href' => $event->getURI(),
),
$event->getName());
@@ -425,10 +430,16 @@
$width,
$top,
$height) {
+
+ $class = 'phui-calendar-day-event-link';
+ if ($event->getViewerIsInvited()) {
+ $class = $class.' viewer-invited-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
@@ -33,7 +33,6 @@
$singletons = array();
$allday = false;
foreach ($this->events as $event) {
- $color = $event->getColor();
$start_epoch = $event->getEpochStart();
if ($event->getIsAllDay()) {
@@ -65,7 +64,10 @@
),
$timelabel);
- $class = 'phui-calendar-list-item phui-calendar-'.$color;
+ $class = 'phui-calendar-list-item';
+ if ($event->getViewerIsInvited()) {
+ $class = $class.' phui-calendar-viewer-invited';
+ }
if ($event->getIsAllDay()) {
$class = $class.' all-day';
}
@@ -142,7 +144,7 @@
$description = pht('(%s)', $event->getName());
}
- $class = 'phui-calendar-item-link';
+ $class = 'phui-calendar-item';
$anchor = javelin_tag(
'a',
@@ -159,4 +161,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,9 @@
$uri = $event_list['uri'];
$count = $event_list['count'];
- $event_count_badge = $this->getEventCountBadge($count);
+ $viewer_is_invited = $list->getIsViewerInvitedOnList();
+
+ $event_count_badge = $this->getEventCountBadge($count, $viewer_is_invited);
$cell_day_secret_link = $this->getHiddenDayLink($uri);
$cell_data_div = phutil_tag(
@@ -252,13 +254,19 @@
$cell_div);
}
- private function getEventCountBadge($count) {
+ private function getEventCountBadge($count, $viewer_is_invited) {
+ $class = 'phui-calendar-month-count-badge';
+
+ if ($viewer_is_invited) {
+ $class = $class.' viewer-invited-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.viewer-invited-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.viewer-invited-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.viewer-invited-day-badge {
+ border-color: {$green};
+ color: {$green};
+}
+
table.phui-calendar-view a.phui-calendar-date-number {
color: {$lightgreytext};
padding: 0 4px;
@@ -116,12 +121,18 @@
.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-viewer-invited.all-day {
+ background-color: {$lightgreen};
+}
+
li.phui-calendar-list-item.all-day:first-child {
margin-top: 0;
}
@@ -155,7 +166,11 @@
}
li.phui-calendar-list-item.all-day .phui-calendar-list-title a{
- color: {$pink};
+ color: {$greytext};
+}
+
+li.phui-calendar-viewer-invited.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
@@ -2,6 +2,15 @@
* @provides phui-calendar-css
*/
+ .phui-calendar-list a {
+ color: {$lightgreytext};
+ }
+
+.phui-calendar-viewer-invited a {
+ color: {$green};
+ font-weight: bold;
+}
+
.phui-calendar-red a {
color: {$red};
}
@@ -34,6 +43,14 @@
color: {$violet};
}
+.phui-calendar-grey a {
+ color: {$lightgreytext};
+}
+
+.phui-calendar-bg-viewer-invited {
+ background-color: {$lightgreen};
+}
+
.phui-calendar-bg-red {
background-color: {$lightred};
}
@@ -47,7 +64,7 @@
}
.phui-calendar-bg-green {
- background-color: {$lightgreen}
+ background-color: {$lightgreen};
}
.phui-calendar-bg-blue {
@@ -66,6 +83,20 @@
background-color: {$lightviolet};
}
+.phui-calendar-bg-grey {
+ background-color: {$darkgreybackground};
+}
+
+.phui-calendar-list-dot {
+ background-color: {$lightgreytext};
+ border-color: {$lightgreytext};
+}
+
+.phui-calendar-viewer-invited .phui-calendar-list-dot {
+ background-color: {$green};
+ border-color: {$green};
+}
+
.phui-calendar-red .phui-calendar-list-dot {
background-color: {$red};
border-color: {$red};
@@ -105,3 +136,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
Tue, Nov 19, 5:38 AM (10 h, 20 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6727862
Default Alt Text
D12850.diff (13 KB)

Event Timeline