@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.

Initial cut of CalendarEditEngine

Summary:
Ref T9275. This builds a Calendar EditEngine which only edits "name".

I'll add more fields, Conduit, etc., and move to modular transactions in future changes.

Test Plan: Used `editpro/` URI manually to edit the name of an event.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9275

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

+92
+4
src/__phutil_library_map__.php
··· 2019 2019 'PhabricatorCalendarApplication' => 'applications/calendar/application/PhabricatorCalendarApplication.php', 2020 2020 'PhabricatorCalendarController' => 'applications/calendar/controller/PhabricatorCalendarController.php', 2021 2021 'PhabricatorCalendarDAO' => 'applications/calendar/storage/PhabricatorCalendarDAO.php', 2022 + 'PhabricatorCalendarEditEngine' => 'applications/calendar/editor/PhabricatorCalendarEditEngine.php', 2022 2023 'PhabricatorCalendarEvent' => 'applications/calendar/storage/PhabricatorCalendarEvent.php', 2023 2024 'PhabricatorCalendarEventCancelController' => 'applications/calendar/controller/PhabricatorCalendarEventCancelController.php', 2024 2025 'PhabricatorCalendarEventCommentController' => 'applications/calendar/controller/PhabricatorCalendarEventCommentController.php', 2025 2026 'PhabricatorCalendarEventDragController' => 'applications/calendar/controller/PhabricatorCalendarEventDragController.php', 2026 2027 'PhabricatorCalendarEventEditController' => 'applications/calendar/controller/PhabricatorCalendarEventEditController.php', 2028 + 'PhabricatorCalendarEventEditProController' => 'applications/calendar/controller/PhabricatorCalendarEventEditProController.php', 2027 2029 'PhabricatorCalendarEventEditor' => 'applications/calendar/editor/PhabricatorCalendarEventEditor.php', 2028 2030 'PhabricatorCalendarEventEmailCommand' => 'applications/calendar/command/PhabricatorCalendarEventEmailCommand.php', 2029 2031 'PhabricatorCalendarEventFulltextEngine' => 'applications/calendar/search/PhabricatorCalendarEventFulltextEngine.php', ··· 6615 6617 'PhabricatorCalendarApplication' => 'PhabricatorApplication', 6616 6618 'PhabricatorCalendarController' => 'PhabricatorController', 6617 6619 'PhabricatorCalendarDAO' => 'PhabricatorLiskDAO', 6620 + 'PhabricatorCalendarEditEngine' => 'PhabricatorEditEngine', 6618 6621 'PhabricatorCalendarEvent' => array( 6619 6622 'PhabricatorCalendarDAO', 6620 6623 'PhabricatorPolicyInterface', ··· 6633 6636 'PhabricatorCalendarEventCommentController' => 'PhabricatorCalendarController', 6634 6637 'PhabricatorCalendarEventDragController' => 'PhabricatorCalendarController', 6635 6638 'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController', 6639 + 'PhabricatorCalendarEventEditProController' => 'ManiphestController', 6636 6640 'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor', 6637 6641 'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand', 6638 6642 'PhabricatorCalendarEventFulltextEngine' => 'PhabricatorFulltextEngine',
+2
src/applications/calendar/application/PhabricatorCalendarApplication.php
··· 47 47 '(?P<month>\d+)/)?(?:(?P<day>\d+)/)?)?' 48 48 => 'PhabricatorCalendarEventListController', 49 49 'event/' => array( 50 + $this->getEditRoutePattern('editpro/') 51 + => 'PhabricatorCalendarEventEditProController', 50 52 'create/' 51 53 => 'PhabricatorCalendarEventEditController', 52 54 'edit/(?P<id>[1-9]\d*)/(?:(?P<sequence>\d+)/)?'
+12
src/applications/calendar/controller/PhabricatorCalendarEventEditProController.php
··· 1 + <?php 2 + 3 + final class PhabricatorCalendarEventEditProController 4 + extends ManiphestController { 5 + 6 + public function handleRequest(AphrontRequest $request) { 7 + return id(new PhabricatorCalendarEditEngine()) 8 + ->setController($this) 9 + ->buildResponse(); 10 + } 11 + 12 + }
+74
src/applications/calendar/editor/PhabricatorCalendarEditEngine.php
··· 1 + <?php 2 + 3 + final class PhabricatorCalendarEditEngine 4 + extends PhabricatorEditEngine { 5 + 6 + const ENGINECONST = 'calendar.event'; 7 + 8 + public function getEngineName() { 9 + return pht('Calendar Events'); 10 + } 11 + 12 + public function getSummaryHeader() { 13 + return pht('Configure Calendar Event Forms'); 14 + } 15 + 16 + public function getSummaryText() { 17 + return pht('Configure how users create and edit events.'); 18 + } 19 + 20 + public function getEngineApplicationClass() { 21 + return 'PhabricatorCalendarApplication'; 22 + } 23 + 24 + protected function newEditableObject() { 25 + return PhabricatorCalendarEvent::initializeNewCalendarEvent( 26 + $this->getViewer(), 27 + $mode = null); 28 + } 29 + 30 + protected function newObjectQuery() { 31 + return new PhabricatorCalendarEventQuery(); 32 + } 33 + 34 + protected function getObjectCreateTitleText($object) { 35 + return pht('Create New Event'); 36 + } 37 + 38 + protected function getObjectEditTitleText($object) { 39 + return pht('Edit Event: %s', $object->getName()); 40 + } 41 + 42 + protected function getObjectEditShortText($object) { 43 + return $object->getMonogram(); 44 + } 45 + 46 + protected function getObjectCreateShortText() { 47 + return pht('Create Event'); 48 + } 49 + 50 + protected function getObjectName() { 51 + return pht('Event'); 52 + } 53 + 54 + protected function getObjectViewURI($object) { 55 + return $object->getURI(); 56 + } 57 + 58 + protected function buildCustomEditFields($object) { 59 + $fields = array( 60 + id(new PhabricatorTextEditField()) 61 + ->setKey('name') 62 + ->setLabel(pht('Name')) 63 + ->setDescription(pht('Name of the event.')) 64 + ->setConduitDescription(pht('Rename the event.')) 65 + ->setConduitTypeDescription(pht('New event name.')) 66 + ->setTransactionType(PhabricatorCalendarEventTransaction::TYPE_NAME) 67 + ->setIsRequired(true) 68 + ->setValue($object->getName()), 69 + ); 70 + 71 + return $fields; 72 + } 73 + 74 + }