Differential D13982 Diff 33726 src/applications/legalpad/controller/LegalpadDocumentSignController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/legalpad/controller/LegalpadDocumentSignController.php
| Show First 20 Lines • Show All 228 Lines • ▼ Show 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
| $manage_uri = $this->getApplicationURI('view/'.$document->getID().'/'); | $manage_uri = $this->getApplicationURI('view/'.$document->getID().'/'); | ||||
| $can_edit = PhabricatorPolicyFilter::hasCapability( | $can_edit = PhabricatorPolicyFilter::hasCapability( | ||||
| $viewer, | $viewer, | ||||
| $document, | $document, | ||||
| PhabricatorPolicyCapability::CAN_EDIT); | PhabricatorPolicyCapability::CAN_EDIT); | ||||
| // Use the last content update as the modified date. We don't want to | |||||
| // show that a document like a TOS was "updated" by an incidental change | |||||
| // to a field like the preamble or privacy settings which does not acutally | |||||
| // affect the content of the agreement. | |||||
| $content_updated = $document_body->getDateCreated(); | |||||
| // NOTE: We're avoiding `setPolicyObject()` here so we don't pick up | |||||
| // extra UI elements that are unnecessary and clutter the signature page. | |||||
| // These details are available on the "Manage" page. | |||||
| $header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
| ->setHeader($title) | ->setHeader($title) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setPolicyObject($document) | ->setEpoch($content_updated) | ||||
| ->setEpoch($document->getDateModified()) | |||||
| ->addActionLink( | ->addActionLink( | ||||
| id(new PHUIButtonView()) | id(new PHUIButtonView()) | ||||
| ->setTag('a') | ->setTag('a') | ||||
| ->setIcon( | ->setIcon( | ||||
| id(new PHUIIconView()) | id(new PHUIIconView()) | ||||
| ->setIconFont('fa-pencil')) | ->setIconFont('fa-pencil')) | ||||
| ->setText(pht('Manage Document')) | ->setText(pht('Manage Document')) | ||||
| ->setHref($manage_uri) | ->setHref($manage_uri) | ||||
| ->setDisabled(!$can_edit) | ->setDisabled(!$can_edit) | ||||
| ->setWorkflow(!$can_edit)); | ->setWorkflow(!$can_edit)); | ||||
| $preamble_box = null; | $preamble_box = null; | ||||
| if (strlen($document->getPreamble())) { | if (strlen($document->getPreamble())) { | ||||
| $preamble_text = PhabricatorMarkupEngine::renderOneObject( | $preamble_text = PhabricatorMarkupEngine::renderOneObject( | ||||
| id(new PhabricatorMarkupOneOff())->setContent( | id(new PhabricatorMarkupOneOff())->setContent( | ||||
| $document->getPreamble()), | $document->getPreamble()), | ||||
| 'default', | 'default', | ||||
| $viewer); | $viewer); | ||||
| // NOTE: We're avoiding `setObject()` here so we don't pick up extra UI | |||||
| // elements like "Subscribers". This information is available on the | |||||
| // "Manage" page, but just clutters up the "Signature" page. | |||||
| $preamble = id(new PHUIPropertyListView()) | $preamble = id(new PHUIPropertyListView()) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setObject($document) | |||||
| ->addSectionHeader(pht('Preamble')) | ->addSectionHeader(pht('Preamble')) | ||||
| ->addTextContent($preamble_text); | ->addTextContent($preamble_text); | ||||
| $preamble_box = new PHUIPropertyGroupView(); | $preamble_box = new PHUIPropertyGroupView(); | ||||
| $preamble_box->addPropertyList($preamble); | $preamble_box->addPropertyList($preamble); | ||||
| } | } | ||||
| $content = id(new PHUIDocumentView()) | $content = id(new PHUIDocumentView()) | ||||
| ->addClass('legalpad') | ->addClass('legalpad') | ||||
| ->setHeader($header) | ->setHeader($header) | ||||
| ->appendChild( | ->appendChild( | ||||
| array( | array( | ||||
| $signed_status, | $signed_status, | ||||
| ▲ Show 20 Lines • Show All 417 Lines • Show Last 20 Lines | |||||