@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Give Calendar events a more modern view/detail page

Summary: Ref T4375. Very basic, but gives us a more standard place to put edit/delete operations.

Test Plan: {F108765}

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4375

Differential Revision: https://secure.phabricator.com/D8149

+114 -12
+2
src/__phutil_library_map__.php
··· 1268 1268 'PhabricatorCalendarEventOverlapException' => 'applications/calendar/exception/PhabricatorCalendarEventOverlapException.php', 1269 1269 'PhabricatorCalendarEventQuery' => 'applications/calendar/query/PhabricatorCalendarEventQuery.php', 1270 1270 'PhabricatorCalendarEventSearchEngine' => 'applications/calendar/query/PhabricatorCalendarEventSearchEngine.php', 1271 + 'PhabricatorCalendarEventViewController' => 'applications/calendar/controller/PhabricatorCalendarEventViewController.php', 1271 1272 'PhabricatorCalendarHoliday' => 'applications/calendar/storage/PhabricatorCalendarHoliday.php', 1272 1273 'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php', 1273 1274 'PhabricatorCampfireProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php', ··· 3916 3917 'PhabricatorCalendarEventOverlapException' => 'Exception', 3917 3918 'PhabricatorCalendarEventQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 3918 3919 'PhabricatorCalendarEventSearchEngine' => 'PhabricatorApplicationSearchEngine', 3920 + 'PhabricatorCalendarEventViewController' => 'PhabricatorDashboardController', 3919 3921 'PhabricatorCalendarHoliday' => 'PhabricatorCalendarDAO', 3920 3922 'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase', 3921 3923 'PhabricatorCampfireProtocolAdapter' => 'PhabricatorBotBaseStreamingProtocolAdapter',
+2
src/applications/calendar/application/PhabricatorApplicationCalendar.php
··· 45 45 'PhabricatorCalendarEventEditController', 46 46 'delete/(?P<id>[1-9]\d*)/' => 47 47 'PhabricatorCalendarEventDeleteController', 48 + 'view/(?P<id>[1-9]\d*)/' => 49 + 'PhabricatorCalendarEventViewController', 48 50 ), 49 51 ), 50 52 );
+1 -2
src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
··· 156 156 $submit->addCancelButton($this->getApplicationURI()); 157 157 } else { 158 158 $submit->addCancelButton( 159 - $this->getApplicationURI('event/delete/'.$status->getID().'/'), 160 - pht('Delete Event')); 159 + $this->getApplicationURI('event/view/'.$status->getID().'/')); 161 160 } 162 161 163 162 if ($request->isAjax()) {
+107
src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
··· 1 + <?php 2 + 3 + final class PhabricatorCalendarEventViewController 4 + extends PhabricatorDashboardController { 5 + 6 + private $id; 7 + 8 + public function willProcessRequest(array $data) { 9 + $this->id = $data['id']; 10 + } 11 + 12 + public function processRequest() { 13 + $request = $this->getRequest(); 14 + $viewer = $request->getUser(); 15 + 16 + $event = id(new PhabricatorCalendarEventQuery()) 17 + ->setViewer($viewer) 18 + ->withIDs(array($this->id)) 19 + ->executeOne(); 20 + if (!$event) { 21 + return new Aphront404Response(); 22 + } 23 + 24 + $title = pht('Event %d', $event->getID()); 25 + $crumbs = $this->buildApplicationCrumbs(); 26 + $crumbs->addTextCrumb($title); 27 + 28 + $header = $this->buildHeaderView($event); 29 + $actions = $this->buildActionView($event); 30 + $properties = $this->buildPropertyView($event); 31 + 32 + $properties->setActionList($actions); 33 + $box = id(new PHUIObjectBoxView()) 34 + ->setHeader($header) 35 + ->addPropertyList($properties); 36 + 37 + return $this->buildApplicationPage( 38 + array( 39 + $crumbs, 40 + $box, 41 + ), 42 + array( 43 + 'title' => $title, 44 + 'device' => true, 45 + )); 46 + } 47 + 48 + private function buildHeaderView(PhabricatorCalendarEvent $event) { 49 + $viewer = $this->getRequest()->getUser(); 50 + 51 + return id(new PHUIHeaderView()) 52 + ->setUser($viewer) 53 + ->setHeader($event->getTerseSummary($viewer)) 54 + ->setPolicyObject($event); 55 + } 56 + 57 + private function buildActionView(PhabricatorCalendarEvent $event) { 58 + $viewer = $this->getRequest()->getUser(); 59 + $id = $event->getID(); 60 + 61 + $actions = id(new PhabricatorActionListView()) 62 + ->setObjectURI($this->getApplicationURI('event/'.$id.'/')) 63 + ->setUser($viewer); 64 + 65 + $can_edit = PhabricatorPolicyFilter::hasCapability( 66 + $viewer, 67 + $event, 68 + PhabricatorPolicyCapability::CAN_EDIT); 69 + 70 + $actions->addAction( 71 + id(new PhabricatorActionView()) 72 + ->setName(pht('Edit Event')) 73 + ->setIcon('edit') 74 + ->setHref($this->getApplicationURI("event/edit/{$id}/")) 75 + ->setDisabled(!$can_edit) 76 + ->setWorkflow(!$can_edit)); 77 + 78 + $actions->addAction( 79 + id(new PhabricatorActionView()) 80 + ->setName(pht('Cancel Event')) 81 + ->setIcon('delete') 82 + ->setHref($this->getApplicationURI("event/delete/{$id}/")) 83 + ->setDisabled(!$can_edit) 84 + ->setWorkflow(true)); 85 + 86 + return $actions; 87 + } 88 + 89 + private function buildPropertyView(PhabricatorCalendarEvent $event) { 90 + $viewer = $this->getRequest()->getUser(); 91 + 92 + $properties = id(new PHUIPropertyListView()) 93 + ->setUser($viewer) 94 + ->setObject($event); 95 + 96 + $properties->addProperty( 97 + pht('Starts'), 98 + phabricator_datetime($event->getDateFrom(), $viewer)); 99 + 100 + $properties->addProperty( 101 + pht('Ends'), 102 + phabricator_datetime($event->getDateTo(), $viewer)); 103 + 104 + return $properties; 105 + } 106 + 107 + }
+2 -10
src/applications/calendar/view/AphrontCalendarMonthView.php
··· 301 301 $info .= "\n\n".$event->getDescription(); 302 302 } 303 303 304 - if ($user->getPHID() == $event->getUserPHID()) { 305 - $tag = 'a'; 306 - $href = '/calendar/event/edit/'.$event->getEventID().'/'; 307 - } else { 308 - $tag = 'div'; 309 - $href = null; 310 - } 311 - 312 304 $text_div = javelin_tag( 313 - $tag, 305 + 'a', 314 306 array( 315 307 'sigil' => 'has-tooltip', 316 308 'meta' => array( ··· 318 310 'size' => 240, 319 311 ), 320 312 'class' => 'aphront-calendar-event-text', 321 - 'href' => $href, 313 + 'href' => '/calendar/event/view/'.$event->getEventID().'/', 322 314 ), 323 315 phutil_utf8_shorten($event->getName(), 32)); 324 316