Page MenuHomePhabricator

D8397.diff
No OneTemporary

D8397.diff

Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -1317,6 +1317,7 @@
'PhabricatorCalendarHoliday' => 'applications/calendar/storage/PhabricatorCalendarHoliday.php',
'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php',
'PhabricatorCalendarPHIDTypeEvent' => 'applications/calendar/phid/PhabricatorCalendarPHIDTypeEvent.php',
+ 'PhabricatorCalendarViewController' => 'applications/calendar/controller/PhabricatorCalendarViewController.php',
'PhabricatorCampfireProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php',
'PhabricatorChangeParserTestCase' => 'applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php',
'PhabricatorChangesetResponse' => 'infrastructure/diff/PhabricatorChangesetResponse.php',
@@ -4032,6 +4033,7 @@
'PhabricatorCalendarHoliday' => 'PhabricatorCalendarDAO',
'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase',
'PhabricatorCalendarPHIDTypeEvent' => 'PhabricatorPHIDType',
+ 'PhabricatorCalendarViewController' => 'PhabricatorCalendarController',
'PhabricatorCampfireProtocolAdapter' => 'PhabricatorBotBaseStreamingProtocolAdapter',
'PhabricatorChangeParserTestCase' => 'PhabricatorWorkingCopyTestCase',
'PhabricatorChangesetResponse' => 'AphrontProxyResponse',
Index: src/applications/calendar/application/PhabricatorApplicationCalendar.php
===================================================================
--- src/applications/calendar/application/PhabricatorApplicationCalendar.php
+++ src/applications/calendar/application/PhabricatorApplicationCalendar.php
@@ -35,7 +35,8 @@
public function getRoutes() {
return array(
'/calendar/' => array(
- '' => 'PhabricatorCalendarBrowseController',
+ '' => 'PhabricatorCalendarViewController',
+ 'all/' => 'PhabricatorCalendarBrowseController',
'event/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' =>
'PhabricatorCalendarEventListController',
Index: src/applications/calendar/controller/PhabricatorCalendarBrowseController.php
===================================================================
--- src/applications/calendar/controller/PhabricatorCalendarBrowseController.php
+++ src/applications/calendar/controller/PhabricatorCalendarBrowseController.php
@@ -73,14 +73,14 @@
$date = new DateTime("{$year}-{$month}-01");
$crumbs = $this->buildApplicationCrumbs();
+ $crumbs->addTextCrumb(pht('All Events'));
$crumbs->addTextCrumb($date->format('F Y'));
$nav = $this->buildSideNavView();
- $nav->selectFilter('/');
+ $nav->selectFilter('all/');
$nav->appendChild(
array(
$crumbs,
- $this->getNoticeView(),
$month_view,
));
@@ -92,25 +92,4 @@
));
}
- private function getNoticeView() {
- $request = $this->getRequest();
- $view = null;
-
- if ($request->getExists('created')) {
- $view = id(new AphrontErrorView())
- ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
- ->setTitle(pht('Successfully created your status.'));
- } else if ($request->getExists('updated')) {
- $view = id(new AphrontErrorView())
- ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
- ->setTitle(pht('Successfully updated your status.'));
- } else if ($request->getExists('deleted')) {
- $view = id(new AphrontErrorView())
- ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
- ->setTitle(pht('Successfully deleted your status.'));
- }
-
- return $view;
- }
-
}
Index: src/applications/calendar/controller/PhabricatorCalendarController.php
===================================================================
--- src/applications/calendar/controller/PhabricatorCalendarController.php
+++ src/applications/calendar/controller/PhabricatorCalendarController.php
@@ -8,7 +8,8 @@
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$nav->addLabel(pht('Calendar'));
- $nav->addFilter('/', pht('View All'));
+ $nav->addFilter('/', pht('My Events'));
+ $nav->addFilter('all/', pht('View All'));
$nav->addFilter('event/create/', pht('Create Event'));
if ($status && $status->getID()) {
Index: src/applications/calendar/controller/PhabricatorCalendarViewController.php
===================================================================
--- src/applications/calendar/controller/PhabricatorCalendarViewController.php
+++ src/applications/calendar/controller/PhabricatorCalendarViewController.php
@@ -1,12 +1,13 @@
<?php
-final class PhabricatorCalendarBrowseController
+final class PhabricatorCalendarViewController
extends PhabricatorCalendarController {
public function processRequest() {
+ $user = $this->getRequest()->getUser();
+
$now = time();
$request = $this->getRequest();
- $user = $request->getUser();
$year_d = phabricator_format_local_time($now, $user, 'Y');
$year = $request->getInt('year', $year_d);
$month_d = phabricator_format_local_time($now, $user, 'm');
@@ -21,6 +22,7 @@
$statuses = id(new PhabricatorCalendarEventQuery())
->setViewer($user)
+ ->withInvitedPHIDs(array($user->getPHID()))
->withDateRange(
strtotime("{$year}-{$month}-01"),
strtotime("{$year}-{$month}-01 next month"))
@@ -39,40 +41,19 @@
$phids = mpull($statuses, 'getUserPHID');
$handles = $this->loadViewerHandles($phids);
- /* 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) {
$event = new AphrontCalendarEventView();
$event->setEpochRange($status->getDateFrom(), $status->getDateTo());
-
- $name_text = $handles[$status->getUserPHID()]->getName();
- $status_text = $status->getHumanStatus();
$event->setUserPHID($status->getUserPHID());
- $event->setDescription(pht('%s (%s)', $name_text, $status_text));
- $event->setName($status_text);
+ $event->setName($status->getHumanStatus());
+ $event->setDescription($status->getDescription());
$event->setEventID($status->getID());
- $event->setColor($eventcolor[$status->getUserPHID()]);
$month_view->addEvent($event);
}
$date = new DateTime("{$year}-{$month}-01");
$crumbs = $this->buildApplicationCrumbs();
+ $crumbs->addTextCrumb(pht('My Events'));
$crumbs->addTextCrumb($date->format('F Y'));
$nav = $this->buildSideNavView();

File Metadata

Mime Type
text/plain
Expires
Sun, May 12, 3:08 AM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6287686
Default Alt Text
D8397.diff (6 KB)

Event Timeline