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

Add an optional preamble to Legalpad documents

Summary:
Fixes T5532. Allow documents to have a preamble in the header which can be used to explain who should sign a document and why.

Particularly, I plan to use this to navigate the corporate vs individual stuff more sensibly.

Test Plan: {F174228}

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T5532

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

+57 -5
+2 -2
resources/celerity/map.php
··· 126 126 'rsrc/css/phui/phui-button.css' => 'c7412aa1', 127 127 'rsrc/css/phui/phui-document.css' => 'a5615198', 128 128 'rsrc/css/phui/phui-feed-story.css' => 'e2c9bc83', 129 - 'rsrc/css/phui/phui-fontkit.css' => '5d40a16b', 129 + 'rsrc/css/phui/phui-fontkit.css' => 'abeb59f0', 130 130 'rsrc/css/phui/phui-form-view.css' => 'ebac1b1d', 131 131 'rsrc/css/phui/phui-form.css' => 'b78ec020', 132 132 'rsrc/css/phui/phui-header-view.css' => '39594ac0', ··· 772 772 'phui-document-view-css' => 'a5615198', 773 773 'phui-feed-story-css' => 'e2c9bc83', 774 774 'phui-font-icon-base-css' => 'eb84f033', 775 - 'phui-fontkit-css' => '5d40a16b', 775 + 'phui-fontkit-css' => 'abeb59f0', 776 776 'phui-form-css' => 'b78ec020', 777 777 'phui-form-view-css' => 'ebac1b1d', 778 778 'phui-header-view-css' => '39594ac0',
+2
resources/sql/autopatches/20140704.legalpreamble.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_legalpad.legalpad_document 2 + ADD preamble LONGTEXT NOT NULL COLLATE utf8_general_ci;
+1
src/applications/legalpad/constants/LegalpadTransactionType.php
··· 5 5 const TYPE_TITLE = 'title'; 6 6 const TYPE_TEXT = 'text'; 7 7 const TYPE_SIGNATURE_TYPE = 'legalpad:signature-type'; 8 + const TYPE_PREAMBLE = 'legalpad:premable'; 8 9 9 10 }
+15 -1
src/applications/legalpad/controller/LegalpadDocumentEditController.php
··· 47 47 $title = $document->getDocumentBody()->getTitle(); 48 48 $text = $document->getDocumentBody()->getText(); 49 49 $v_signature_type = $document->getSignatureType(); 50 + $v_preamble = $document->getPreamble(); 50 51 51 52 $errors = array(); 52 53 $can_view = null; ··· 91 92 ->setNewValue($v_signature_type); 92 93 } 93 94 95 + $v_preamble = $request->getStr('preamble'); 96 + $xactions[] = id(new LegalpadTransaction()) 97 + ->setTransactionType(LegalpadTransactionType::TYPE_PREAMBLE) 98 + ->setNewValue($v_preamble); 99 + 94 100 if (!$errors) { 95 101 $editor = id(new LegalpadDocumentEditor()) 96 102 ->setContentSourceFromRequest($request) ··· 137 143 $form 138 144 ->appendChild( 139 145 id(new PhabricatorRemarkupControl()) 146 + ->setID('preamble') 147 + ->setLabel(pht('Preamble')) 148 + ->setValue($v_preamble) 149 + ->setName('preamble') 150 + ->setCaption( 151 + pht('Optional help text for users signing this document.'))) 152 + ->appendChild( 153 + id(new PhabricatorRemarkupControl()) 140 154 ->setID('document-text') 141 - ->setLabel(pht('Text')) 155 + ->setLabel(pht('Document Body')) 142 156 ->setError($e_text) 143 157 ->setValue($text) 144 158 ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
+14
src/applications/legalpad/controller/LegalpadDocumentSignController.php
··· 227 227 ->setDisabled(!$can_edit) 228 228 ->setWorkflow(!$can_edit)); 229 229 230 + $preamble = null; 231 + if (strlen($document->getPreamble())) { 232 + $preamble_text = PhabricatorMarkupEngine::renderOneObject( 233 + id(new PhabricatorMarkupOneOff())->setContent( 234 + $document->getPreamble()), 235 + 'default', 236 + $viewer); 237 + 238 + $preamble = id(new PHUIPropertyListView()) 239 + ->addSectionHeader(pht('Preamble')) 240 + ->addTextContent($preamble_text); 241 + } 242 + 230 243 $content = id(new PHUIDocumentView()) 231 244 ->addClass('legalpad') 232 245 ->setHeader($header) ··· 234 247 ->appendChild( 235 248 array( 236 249 $signed_status, 250 + $preamble, 237 251 $document_markup, 238 252 )); 239 253
+9
src/applications/legalpad/editor/LegalpadDocumentEditor.php
··· 26 26 $types[] = LegalpadTransactionType::TYPE_TITLE; 27 27 $types[] = LegalpadTransactionType::TYPE_TEXT; 28 28 $types[] = LegalpadTransactionType::TYPE_SIGNATURE_TYPE; 29 + $types[] = LegalpadTransactionType::TYPE_PREAMBLE; 29 30 30 31 return $types; 31 32 } ··· 41 42 return $object->getDocumentBody()->getText(); 42 43 case LegalpadTransactionType::TYPE_SIGNATURE_TYPE: 43 44 return $object->getSignatureType(); 45 + case LegalpadTransactionType::TYPE_PREAMBLE: 46 + return $object->getPreamble(); 44 47 } 45 48 } 46 49 ··· 52 55 case LegalpadTransactionType::TYPE_TITLE: 53 56 case LegalpadTransactionType::TYPE_TEXT: 54 57 case LegalpadTransactionType::TYPE_SIGNATURE_TYPE: 58 + case LegalpadTransactionType::TYPE_PREAMBLE: 55 59 return $xaction->getNewValue(); 56 60 } 57 61 } ··· 75 79 case LegalpadTransactionType::TYPE_SIGNATURE_TYPE: 76 80 $object->setSignatureType($xaction->getNewValue()); 77 81 break; 82 + case LegalpadTransactionType::TYPE_PREAMBLE: 83 + $object->setPreamble($xaction->getNewValue()); 84 + break; 78 85 } 79 86 } 80 87 ··· 126 133 case LegalpadTransactionType::TYPE_TITLE: 127 134 case LegalpadTransactionType::TYPE_TEXT: 128 135 case LegalpadTransactionType::TYPE_SIGNATURE_TYPE: 136 + case LegalpadTransactionType::TYPE_PREAMBLE: 129 137 return $v; 130 138 } 131 139 ··· 169 177 switch ($xaction->getTransactionType()) { 170 178 case LegalpadTransactionType::TYPE_TEXT: 171 179 case LegalpadTransactionType::TYPE_TITLE: 180 + case LegalpadTransactionType::TYPE_PREAMBLE: 172 181 return true; 173 182 } 174 183
+2
src/applications/legalpad/storage/LegalpadDocument.php
··· 17 17 protected $editPolicy; 18 18 protected $mailKey; 19 19 protected $signatureType; 20 + protected $preamble; 20 21 21 22 const SIGNATURE_TYPE_INDIVIDUAL = 'user'; 22 23 const SIGNATURE_TYPE_CORPORATION = 'corp'; ··· 42 43 ->setRecentContributorPHIDs(array()) 43 44 ->attachSignatures(array()) 44 45 ->setSignatureType(self::SIGNATURE_TYPE_INDIVIDUAL) 46 + ->setPreamble('') 45 47 ->setViewPolicy($view_policy) 46 48 ->setEditPolicy($edit_policy); 47 49 }
+7 -2
src/applications/legalpad/storage/LegalpadTransaction.php
··· 28 28 case LegalpadTransactionType::TYPE_TITLE: 29 29 case LegalpadTransactionType::TYPE_TEXT: 30 30 return ($old === null); 31 + case LegalpadTransactionType::TYPE_SIGNATURE_TYPE: 32 + return true; 31 33 } 32 34 33 35 return parent::shouldHide(); ··· 47 49 $this->renderHandleLink($author_phid), 48 50 $old, 49 51 $new); 50 - break; 51 52 case LegalpadTransactionType::TYPE_TEXT: 52 53 return pht( 53 54 "%s updated the document's text.", 54 55 $this->renderHandleLink($author_phid)); 55 - break; 56 + case LegalpadTransactionType::TYPE_PREAMBLE: 57 + return pht( 58 + '%s updated the preamble.', 59 + $this->renderHandleLink($author_phid)); 56 60 } 57 61 58 62 return parent::getTitle(); ··· 62 66 switch ($this->getTransactionType()) { 63 67 case LegalpadTransactionType::TYPE_TITLE: 64 68 case LegalpadTransactionType::TYPE_TEXT: 69 + case LegalpadTransactionType::TYPE_PREAMBLE: 65 70 return true; 66 71 } 67 72 return parent::hasChangeDetails();
+5
webroot/rsrc/css/phui/phui-fontkit.css
··· 34 34 background: {$lightgreybackground}; 35 35 } 36 36 37 + .phui-font-source-sans .phui-property-list-text-content { 38 + background: {$lightgreybackground}; 39 + padding: 0; 40 + } 41 + 37 42 .phui-font-source-sans .phui-property-list-container { 38 43 padding-bottom: 6px; 39 44 }