Page MenuHomePhabricator

D16235.diff
No OneTemporary

D16235.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2019,11 +2019,13 @@
'PhabricatorCalendarApplication' => 'applications/calendar/application/PhabricatorCalendarApplication.php',
'PhabricatorCalendarController' => 'applications/calendar/controller/PhabricatorCalendarController.php',
'PhabricatorCalendarDAO' => 'applications/calendar/storage/PhabricatorCalendarDAO.php',
+ 'PhabricatorCalendarEditEngine' => 'applications/calendar/editor/PhabricatorCalendarEditEngine.php',
'PhabricatorCalendarEvent' => 'applications/calendar/storage/PhabricatorCalendarEvent.php',
'PhabricatorCalendarEventCancelController' => 'applications/calendar/controller/PhabricatorCalendarEventCancelController.php',
'PhabricatorCalendarEventCommentController' => 'applications/calendar/controller/PhabricatorCalendarEventCommentController.php',
'PhabricatorCalendarEventDragController' => 'applications/calendar/controller/PhabricatorCalendarEventDragController.php',
'PhabricatorCalendarEventEditController' => 'applications/calendar/controller/PhabricatorCalendarEventEditController.php',
+ 'PhabricatorCalendarEventEditProController' => 'applications/calendar/controller/PhabricatorCalendarEventEditProController.php',
'PhabricatorCalendarEventEditor' => 'applications/calendar/editor/PhabricatorCalendarEventEditor.php',
'PhabricatorCalendarEventEmailCommand' => 'applications/calendar/command/PhabricatorCalendarEventEmailCommand.php',
'PhabricatorCalendarEventFulltextEngine' => 'applications/calendar/search/PhabricatorCalendarEventFulltextEngine.php',
@@ -6615,6 +6617,7 @@
'PhabricatorCalendarApplication' => 'PhabricatorApplication',
'PhabricatorCalendarController' => 'PhabricatorController',
'PhabricatorCalendarDAO' => 'PhabricatorLiskDAO',
+ 'PhabricatorCalendarEditEngine' => 'PhabricatorEditEngine',
'PhabricatorCalendarEvent' => array(
'PhabricatorCalendarDAO',
'PhabricatorPolicyInterface',
@@ -6633,6 +6636,7 @@
'PhabricatorCalendarEventCommentController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventDragController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController',
+ 'PhabricatorCalendarEventEditProController' => 'ManiphestController',
'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand',
'PhabricatorCalendarEventFulltextEngine' => 'PhabricatorFulltextEngine',
diff --git a/src/applications/calendar/application/PhabricatorCalendarApplication.php b/src/applications/calendar/application/PhabricatorCalendarApplication.php
--- a/src/applications/calendar/application/PhabricatorCalendarApplication.php
+++ b/src/applications/calendar/application/PhabricatorCalendarApplication.php
@@ -47,6 +47,8 @@
'(?P<month>\d+)/)?(?:(?P<day>\d+)/)?)?'
=> 'PhabricatorCalendarEventListController',
'event/' => array(
+ $this->getEditRoutePattern('editpro/')
+ => 'PhabricatorCalendarEventEditProController',
'create/'
=> 'PhabricatorCalendarEventEditController',
'edit/(?P<id>[1-9]\d*)/(?:(?P<sequence>\d+)/)?'
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditProController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditProController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditProController.php
@@ -0,0 +1,12 @@
+<?php
+
+final class PhabricatorCalendarEventEditProController
+ extends ManiphestController {
+
+ public function handleRequest(AphrontRequest $request) {
+ return id(new PhabricatorCalendarEditEngine())
+ ->setController($this)
+ ->buildResponse();
+ }
+
+}
diff --git a/src/applications/calendar/editor/PhabricatorCalendarEditEngine.php b/src/applications/calendar/editor/PhabricatorCalendarEditEngine.php
new file mode 100644
--- /dev/null
+++ b/src/applications/calendar/editor/PhabricatorCalendarEditEngine.php
@@ -0,0 +1,74 @@
+<?php
+
+final class PhabricatorCalendarEditEngine
+ extends PhabricatorEditEngine {
+
+ const ENGINECONST = 'calendar.event';
+
+ public function getEngineName() {
+ return pht('Calendar Events');
+ }
+
+ public function getSummaryHeader() {
+ return pht('Configure Calendar Event Forms');
+ }
+
+ public function getSummaryText() {
+ return pht('Configure how users create and edit events.');
+ }
+
+ public function getEngineApplicationClass() {
+ return 'PhabricatorCalendarApplication';
+ }
+
+ protected function newEditableObject() {
+ return PhabricatorCalendarEvent::initializeNewCalendarEvent(
+ $this->getViewer(),
+ $mode = null);
+ }
+
+ protected function newObjectQuery() {
+ return new PhabricatorCalendarEventQuery();
+ }
+
+ protected function getObjectCreateTitleText($object) {
+ return pht('Create New Event');
+ }
+
+ protected function getObjectEditTitleText($object) {
+ return pht('Edit Event: %s', $object->getName());
+ }
+
+ protected function getObjectEditShortText($object) {
+ return $object->getMonogram();
+ }
+
+ protected function getObjectCreateShortText() {
+ return pht('Create Event');
+ }
+
+ protected function getObjectName() {
+ return pht('Event');
+ }
+
+ protected function getObjectViewURI($object) {
+ return $object->getURI();
+ }
+
+ protected function buildCustomEditFields($object) {
+ $fields = array(
+ id(new PhabricatorTextEditField())
+ ->setKey('name')
+ ->setLabel(pht('Name'))
+ ->setDescription(pht('Name of the event.'))
+ ->setConduitDescription(pht('Rename the event.'))
+ ->setConduitTypeDescription(pht('New event name.'))
+ ->setTransactionType(PhabricatorCalendarEventTransaction::TYPE_NAME)
+ ->setIsRequired(true)
+ ->setValue($object->getName()),
+ );
+
+ return $fields;
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 17, 7:05 PM (6 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7376941
Default Alt Text
D16235.diff (6 KB)

Event Timeline