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 @@ -289,6 +289,7 @@ 'ConpherenceCreateThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php', 'ConpherenceDAO' => 'applications/conpherence/storage/ConpherenceDAO.php', 'ConpherenceDurableColumnView' => 'applications/conpherence/view/ConpherenceDurableColumnView.php', + 'ConpherenceEditEngine' => 'applications/conpherence/editor/ConpherenceEditEngine.php', 'ConpherenceEditor' => 'applications/conpherence/editor/ConpherenceEditor.php', 'ConpherenceFormDragAndDropUploadControl' => 'applications/conpherence/view/ConpherenceFormDragAndDropUploadControl.php', 'ConpherenceFulltextQuery' => 'applications/conpherence/query/ConpherenceFulltextQuery.php', @@ -307,6 +308,7 @@ 'ConpherenceQueryThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php', 'ConpherenceQueryTransactionConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php', 'ConpherenceReplyHandler' => 'applications/conpherence/mail/ConpherenceReplyHandler.php', + 'ConpherenceRoomEditController' => 'applications/conpherence/controller/ConpherenceRoomEditController.php', 'ConpherenceRoomListController' => 'applications/conpherence/controller/ConpherenceRoomListController.php', 'ConpherenceRoomPictureController' => 'applications/conpherence/controller/ConpherenceRoomPictureController.php', 'ConpherenceRoomTestCase' => 'applications/conpherence/__tests__/ConpherenceRoomTestCase.php', @@ -4765,6 +4767,7 @@ 'ConpherenceCreateThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod', 'ConpherenceDAO' => 'PhabricatorLiskDAO', 'ConpherenceDurableColumnView' => 'AphrontTagView', + 'ConpherenceEditEngine' => 'PhabricatorEditEngine', 'ConpherenceEditor' => 'PhabricatorApplicationTransactionEditor', 'ConpherenceFormDragAndDropUploadControl' => 'AphrontFormControl', 'ConpherenceFulltextQuery' => 'PhabricatorOffsetPagedQuery', @@ -4783,6 +4786,7 @@ 'ConpherenceQueryThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod', 'ConpherenceQueryTransactionConduitAPIMethod' => 'ConpherenceConduitAPIMethod', 'ConpherenceReplyHandler' => 'PhabricatorMailReplyHandler', + 'ConpherenceRoomEditController' => 'ConpherenceController', 'ConpherenceRoomListController' => 'ConpherenceController', 'ConpherenceRoomPictureController' => 'ConpherenceController', 'ConpherenceRoomTestCase' => 'ConpherenceTestCase', diff --git a/src/applications/conpherence/application/PhabricatorConpherenceApplication.php b/src/applications/conpherence/application/PhabricatorConpherenceApplication.php --- a/src/applications/conpherence/application/PhabricatorConpherenceApplication.php +++ b/src/applications/conpherence/application/PhabricatorConpherenceApplication.php @@ -45,6 +45,8 @@ => 'ConpherenceColumnViewController', 'new/' => 'ConpherenceNewRoomController', + $this->getEditRoutePattern('edit/') + => 'ConpherenceRoomEditController', 'picture/(?P[1-9]\d*)/' => 'ConpherenceRoomPictureController', 'search/(?:query/(?P[^/]+)/)?' diff --git a/src/applications/conpherence/controller/ConpherenceRoomEditController.php b/src/applications/conpherence/controller/ConpherenceRoomEditController.php new file mode 100644 --- /dev/null +++ b/src/applications/conpherence/controller/ConpherenceRoomEditController.php @@ -0,0 +1,11 @@ +setController($this) + ->buildResponse(); + } +} diff --git a/src/applications/conpherence/editor/ConpherenceEditEngine.php b/src/applications/conpherence/editor/ConpherenceEditEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/conpherence/editor/ConpherenceEditEngine.php @@ -0,0 +1,101 @@ +getViewer()); + } + + protected function newObjectQuery() { + return new ConpherenceThreadQuery(); + } + + protected function getObjectCreateTitleText($object) { + return pht('Create New Room'); + } + + protected function getObjectEditTitleText($object) { + return pht('Edit Room: %s', $object->getTitle()); + } + + protected function getObjectEditShortText($object) { + return $object->getTitle(); + } + + protected function getObjectCreateShortText() { + return pht('Create Room'); + } + + protected function getObjectName() { + return pht('Room'); + } + + protected function getObjectCreateCancelURI($object) { + return $this->getApplication()->getApplicationURI('/'); + } + + protected function getEditorURI() { + return $this->getApplication()->getApplicationURI('edit/'); + } + + protected function getObjectViewURI($object) { + return $object->getURI(); + } + + protected function buildCustomEditFields($object) { + + return array( + id(new PhabricatorTextEditField()) + ->setKey('name') + ->setLabel(pht('Name')) + ->setDescription(pht('Room name.')) + ->setConduitTypeDescription(pht('New Room name.')) + ->setTransactionType(ConpherenceTransaction::TYPE_TITLE) + ->setValue($object->getTitle()), + + id(new PhabricatorTextEditField()) + ->setKey('topic') + ->setLabel(pht('Topic')) + ->setDescription(pht('Room topic.')) + ->setConduitTypeDescription(pht('New Room topic.')) + ->setTransactionType(ConpherenceTransaction::TYPE_TOPIC) + ->setValue($object->getTopic()), + + id(new PhabricatorUsersEditField()) + ->setKey('participants') + ->setValue($object->getParticipants()) + ->setDescription(pht('Room participants.')) + ->setConduitTypeDescription(pht('New Room participants.')) + ->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS) + ->setLabel(pht('Other Participants')), + + id(new PhabricatorRemarkupEditField()) + ->setKey('message') + ->setLabel(pht('First Message')) + ->setDescription(pht('First Room message.')) + ->setConduitTypeDescription(pht('New Room first message.')) + ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT), + + ); + } + +} diff --git a/src/applications/conpherence/storage/ConpherenceThread.php b/src/applications/conpherence/storage/ConpherenceThread.php --- a/src/applications/conpherence/storage/ConpherenceThread.php +++ b/src/applications/conpherence/storage/ConpherenceThread.php @@ -73,6 +73,10 @@ return parent::save(); } + public function getURI() { + return '/'.$this->getMonogram(); + } + public function getMonogram() { return 'Z'.$this->getID(); }