Differential D14640 Diff 35446 src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
| Show All 14 Lines | class PhabricatorApplicationTransactionCommentView extends AphrontView { | ||||
| private $statusID; | private $statusID; | ||||
| private $commentID; | private $commentID; | ||||
| private $draft; | private $draft; | ||||
| private $requestURI; | private $requestURI; | ||||
| private $showPreview = true; | private $showPreview = true; | ||||
| private $objectPHID; | private $objectPHID; | ||||
| private $headerText; | private $headerText; | ||||
| private $currentVersion; | |||||
| private $versionedDraft; | |||||
| public function setObjectPHID($object_phid) { | public function setObjectPHID($object_phid) { | ||||
| $this->objectPHID = $object_phid; | $this->objectPHID = $object_phid; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getObjectPHID() { | public function getObjectPHID() { | ||||
| return $this->objectPHID; | return $this->objectPHID; | ||||
| } | } | ||||
| Show All 10 Lines | class PhabricatorApplicationTransactionCommentView extends AphrontView { | ||||
| public function setRequestURI(PhutilURI $request_uri) { | public function setRequestURI(PhutilURI $request_uri) { | ||||
| $this->requestURI = $request_uri; | $this->requestURI = $request_uri; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getRequestURI() { | public function getRequestURI() { | ||||
| return $this->requestURI; | return $this->requestURI; | ||||
| } | } | ||||
| public function setCurrentVersion($current_version) { | |||||
| $this->currentVersion = $current_version; | |||||
| return $this; | |||||
| } | |||||
| public function getCurrentVersion() { | |||||
| return $this->currentVersion; | |||||
| } | |||||
| public function setVersionedDraft( | |||||
| PhabricatorVersionedDraft $versioned_draft) { | |||||
| $this->versionedDraft = $versioned_draft; | |||||
| return $this; | |||||
| } | |||||
| public function getVersionedDraft() { | |||||
| return $this->versionedDraft; | |||||
| } | |||||
| public function setDraft(PhabricatorDraft $draft) { | public function setDraft(PhabricatorDraft $draft) { | ||||
| $this->draft = $draft; | $this->draft = $draft; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getDraft() { | public function getDraft() { | ||||
| return $this->draft; | return $this->draft; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | private function renderCommentPanel() { | ||||
| $draft_comment = ''; | $draft_comment = ''; | ||||
| $draft_key = null; | $draft_key = null; | ||||
| if ($this->getDraft()) { | if ($this->getDraft()) { | ||||
| $draft_comment = $this->getDraft()->getDraft(); | $draft_comment = $this->getDraft()->getDraft(); | ||||
| $draft_key = $this->getDraft()->getDraftKey(); | $draft_key = $this->getDraft()->getDraftKey(); | ||||
| } | } | ||||
| $versioned_draft = $this->getVersionedDraft(); | |||||
| if ($versioned_draft) { | |||||
| $draft_comment = $versioned_draft->getProperty('temporary.comment', ''); | |||||
| } | |||||
| if (!$this->getObjectPHID()) { | if (!$this->getObjectPHID()) { | ||||
| throw new PhutilInvalidStateException('setObjectPHID', 'render'); | throw new PhutilInvalidStateException('setObjectPHID', 'render'); | ||||
| } | } | ||||
| $version_key = PhabricatorVersionedDraft::KEY_VERSION; | |||||
| $version_value = $this->getCurrentVersion(); | |||||
| return id(new AphrontFormView()) | return id(new AphrontFormView()) | ||||
| ->setUser($this->getUser()) | ->setUser($this->getUser()) | ||||
| ->addSigil('transaction-append') | ->addSigil('transaction-append') | ||||
| ->setWorkflow(true) | ->setWorkflow(true) | ||||
| ->setMetadata( | ->setMetadata( | ||||
| array( | array( | ||||
| 'objectPHID' => $this->getObjectPHID(), | 'objectPHID' => $this->getObjectPHID(), | ||||
| )) | )) | ||||
| ->setAction($this->getAction()) | ->setAction($this->getAction()) | ||||
| ->setID($this->getFormID()) | ->setID($this->getFormID()) | ||||
| ->addHiddenInput('__draft__', $draft_key) | ->addHiddenInput('__draft__', $draft_key) | ||||
| ->addHiddenInput($version_key, $version_value) | |||||
| ->appendChild( | ->appendChild( | ||||
| id(new PhabricatorRemarkupControl()) | id(new PhabricatorRemarkupControl()) | ||||
| ->setID($this->getCommentID()) | ->setID($this->getCommentID()) | ||||
| ->setName('comment') | ->setName('comment') | ||||
| ->setLabel(pht('Comment')) | ->setLabel(pht('Comment')) | ||||
| ->setUser($this->getUser()) | ->setUser($this->getUser()) | ||||
| ->setValue($draft_comment)) | ->setValue($draft_comment)) | ||||
| ->appendChild( | ->appendChild( | ||||
| ▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines | |||||