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

Convert every two-column application except Maniphest to curtain views

Summary: Moves over everything except Maniphest, which has some special behavior.

Test Plan:
- Viewed a badge.
- Viewed a calendar event.
- Viewed a countdown.
- Viewed a Fund initiative.
- Viewed a Herald rule.
- Viewed a macro.
- Viewed an application.
- Viewed an owners package.
- Viewed a credential.
- Viewed a Ponder question.
- Viewed a poll.

Reviewers: chad

Reviewed By: chad

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

+184 -373
+19 -35
src/applications/badges/controller/PhabricatorBadgesViewController.php
··· 43 43 ->setStatus($status_icon, $status_color, $status_name) 44 44 ->setHeaderIcon('fa-trophy'); 45 45 46 - $properties = $this->buildPropertyListView($badge); 47 - $actions = $this->buildActionListView($badge); 46 + $curtain = $this->buildCurtain($badge); 48 47 $details = $this->buildDetailsView($badge); 49 48 50 49 $timeline = $this->buildTransactionTimeline( ··· 64 63 65 64 $view = id(new PHUITwoColumnView()) 66 65 ->setHeader($header) 66 + ->setCurtain($curtain) 67 67 ->setMainColumn(array( 68 68 $recipient_list, 69 69 $timeline, 70 70 $add_comment, 71 71 )) 72 - ->setPropertyList($properties) 73 - ->setActionList($actions) 74 72 ->addPropertySection(pht('BADGE DETAILS'), $details); 75 73 76 74 return $this->newPage() 77 75 ->setTitle($title) 78 76 ->setCrumbs($crumbs) 79 77 ->setPageObjectPHIDs(array($badge->getPHID())) 80 - ->appendChild( 81 - array( 82 - $view, 83 - )); 84 - } 85 - 86 - private function buildPropertyListView( 87 - PhabricatorBadgesBadge $badge) { 88 - $viewer = $this->getViewer(); 89 - 90 - $view = id(new PHUIPropertyListView()) 91 - ->setUser($viewer) 92 - ->setObject($badge); 93 - 94 - $view->invokeWillRenderEvent(); 95 - 96 - return $view; 78 + ->appendChild($view); 97 79 } 98 80 99 81 private function buildDetailsView( ··· 137 119 return $view; 138 120 } 139 121 140 - private function buildActionListView(PhabricatorBadgesBadge $badge) { 122 + private function buildCurtain(PhabricatorBadgesBadge $badge) { 141 123 $viewer = $this->getViewer(); 142 - $id = $badge->getID(); 143 124 144 125 $can_edit = PhabricatorPolicyFilter::hasCapability( 145 126 $viewer, 146 127 $badge, 147 128 PhabricatorPolicyCapability::CAN_EDIT); 148 129 149 - $view = id(new PhabricatorActionListView()) 150 - ->setUser($viewer) 151 - ->setObject($badge); 130 + $id = $badge->getID(); 131 + $edit_uri = $this->getApplicationURI("/edit/{$id}/"); 132 + $archive_uri = $this->getApplicationURI("/archive/{$id}/"); 133 + $award_uri = $this->getApplicationURI("/recipients/{$id}/"); 152 134 153 - $view->addAction( 135 + $curtain = $this->newCurtainView($badge); 136 + 137 + $curtain->addAction( 154 138 id(new PhabricatorActionView()) 155 139 ->setName(pht('Edit Badge')) 156 140 ->setIcon('fa-pencil') 157 141 ->setDisabled(!$can_edit) 158 - ->setHref($this->getApplicationURI("/edit/{$id}/"))); 142 + ->setHref($edit_uri)); 159 143 160 144 if ($badge->isArchived()) { 161 - $view->addAction( 145 + $curtain->addAction( 162 146 id(new PhabricatorActionView()) 163 147 ->setName(pht('Activate Badge')) 164 148 ->setIcon('fa-check') 165 149 ->setDisabled(!$can_edit) 166 150 ->setWorkflow($can_edit) 167 - ->setHref($this->getApplicationURI("/archive/{$id}/"))); 151 + ->setHref($archive_uri)); 168 152 } else { 169 - $view->addAction( 153 + $curtain->addAction( 170 154 id(new PhabricatorActionView()) 171 155 ->setName(pht('Archive Badge')) 172 156 ->setIcon('fa-ban') 173 157 ->setDisabled(!$can_edit) 174 158 ->setWorkflow($can_edit) 175 - ->setHref($this->getApplicationURI("/archive/{$id}/"))); 159 + ->setHref($archive_uri)); 176 160 } 177 161 178 - $view->addAction( 162 + $curtain->addAction( 179 163 id(new PhabricatorActionView()) 180 164 ->setName('Add Recipients') 181 165 ->setIcon('fa-users') 182 166 ->setDisabled(!$can_edit) 183 167 ->setWorkflow(true) 184 - ->setHref($this->getApplicationURI("/recipients/{$id}/"))); 168 + ->setHref($award_uri)); 185 169 186 - return $view; 170 + return $curtain; 187 171 } 188 172 189 173 private function buildCommentForm(PhabricatorBadgesBadge $badge) {
+8 -2
src/applications/base/controller/PhabricatorController.php
··· 475 475 $viewer = $this->getViewer(); 476 476 477 477 $action_list = id(new PhabricatorActionListView()) 478 - ->setViewer($viewer) 479 - ->setObject($object); 478 + ->setViewer($viewer); 479 + 480 + // NOTE: Applications (objects of class PhabricatorApplication) can't 481 + // currently be set here, although they don't need any of the extensions 482 + // anyway. This should probably work differently than it does, though. 483 + if ($object instanceof PhabricatorLiskDAO) { 484 + $action_list->setObject($object); 485 + } 480 486 481 487 $curtain = id(new PHUICurtainView()) 482 488 ->setViewer($viewer)
+12 -29
src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
··· 63 63 } 64 64 65 65 $header = $this->buildHeaderView($event); 66 - $actions = $this->buildActionView($event); 67 - $properties = $this->buildPropertyListView($event); 66 + $curtain = $this->buildCurtain($event); 68 67 $details = $this->buildPropertySection($event); 69 68 $description = $this->buildDescriptionView($event); 70 69 ··· 91 90 $view = id(new PHUITwoColumnView()) 92 91 ->setHeader($header) 93 92 ->setMainColumn($timeline) 94 - ->setPropertyList($properties) 93 + ->setCurtain($curtain) 95 94 ->addPropertySection(pht('DETAILS'), $details) 96 - ->addPropertySection(pht('DESCRIPTION'), $description) 97 - ->setActionList($actions); 95 + ->addPropertySection(pht('DESCRIPTION'), $description); 98 96 99 97 return $this->newPage() 100 98 ->setTitle($page_title) ··· 148 146 return $header; 149 147 } 150 148 151 - private function buildActionView(PhabricatorCalendarEvent $event) { 149 + private function buildCurtain(PhabricatorCalendarEvent $event) { 152 150 $viewer = $this->getRequest()->getUser(); 153 151 $id = $event->getID(); 154 152 $is_cancelled = $event->getIsCancelled(); 155 153 $is_attending = $event->getIsUserAttending($viewer->getPHID()); 156 154 157 - $actions = id(new PhabricatorActionListView()) 158 - ->setUser($viewer) 159 - ->setObject($event); 160 - 161 155 $can_edit = PhabricatorPolicyFilter::hasCapability( 162 156 $viewer, 163 157 $event, ··· 177 171 $edit_label = pht('Edit'); 178 172 $edit_uri = "event/edit/{$id}/"; 179 173 } 174 + 175 + $curtain = $this->newCurtainView($event); 180 176 181 177 if ($edit_label && $edit_uri) { 182 - $actions->addAction( 178 + $curtain->addAction( 183 179 id(new PhabricatorActionView()) 184 180 ->setName($edit_label) 185 181 ->setIcon('fa-pencil') ··· 189 185 } 190 186 191 187 if ($is_attending) { 192 - $actions->addAction( 188 + $curtain->addAction( 193 189 id(new PhabricatorActionView()) 194 190 ->setName(pht('Decline Event')) 195 191 ->setIcon('fa-user-times') 196 192 ->setHref($this->getApplicationURI("event/join/{$id}/")) 197 193 ->setWorkflow(true)); 198 194 } else { 199 - $actions->addAction( 195 + $curtain->addAction( 200 196 id(new PhabricatorActionView()) 201 197 ->setName(pht('Join Event')) 202 198 ->setIcon('fa-user-plus') ··· 230 226 } 231 227 232 228 if ($is_cancelled) { 233 - $actions->addAction( 229 + $curtain->addAction( 234 230 id(new PhabricatorActionView()) 235 231 ->setName($reinstate_label) 236 232 ->setIcon('fa-plus') ··· 238 234 ->setDisabled($cancel_disabled) 239 235 ->setWorkflow(true)); 240 236 } else { 241 - $actions->addAction( 237 + $curtain->addAction( 242 238 id(new PhabricatorActionView()) 243 239 ->setName($cancel_label) 244 240 ->setIcon('fa-times') ··· 247 243 ->setWorkflow(true)); 248 244 } 249 245 250 - return $actions; 251 - } 252 - 253 - private function buildPropertyListView( 254 - PhabricatorCalendarEvent $event) { 255 - $viewer = $this->getViewer(); 256 - 257 - $properties = id(new PHUIPropertyListView()) 258 - ->setUser($viewer) 259 - ->setObject($event); 260 - 261 - $properties->invokeWillRenderEvent(); 262 - 263 - return $properties; 246 + return $curtain; 264 247 } 265 248 266 249 private function buildPropertySection(
+11 -29
src/applications/countdown/controller/PhabricatorCountdownViewController.php
··· 49 49 ->setStatus($icon, $color, $status) 50 50 ->setHeaderIcon('fa-rocket'); 51 51 52 - $actions = $this->buildActionListView($countdown); 53 - $properties = $this->buildPropertyListView($countdown); 52 + $curtain = $this->buildCurtain($countdown); 54 53 $subheader = $this->buildSubheaderView($countdown); 55 54 56 55 $timeline = $this->buildTransactionTimeline( ··· 67 66 $view = id(new PHUITwoColumnView()) 68 67 ->setHeader($header) 69 68 ->setSubheader($subheader) 70 - ->setMainColumn($content) 71 - ->setPropertyList($properties) 72 - ->setActionList($actions); 69 + ->setCurtain($curtain) 70 + ->setMainColumn($content); 73 71 74 72 return $this->newPage() 75 73 ->setTitle($title) ··· 78 76 array( 79 77 $countdown->getPHID(), 80 78 )) 81 - ->appendChild( 82 - array( 83 - $view, 84 - )); 79 + ->appendChild($view); 85 80 } 86 81 87 - private function buildActionListView(PhabricatorCountdown $countdown) { 88 - $request = $this->getRequest(); 89 - $viewer = $request->getUser(); 82 + private function buildCurtain(PhabricatorCountdown $countdown) { 83 + $viewer = $this->getViewer(); 90 84 91 85 $id = $countdown->getID(); 92 86 93 - $view = id(new PhabricatorActionListView()) 94 - ->setObject($countdown) 95 - ->setUser($viewer); 96 - 97 87 $can_edit = PhabricatorPolicyFilter::hasCapability( 98 88 $viewer, 99 89 $countdown, 100 90 PhabricatorPolicyCapability::CAN_EDIT); 101 91 102 - $view->addAction( 92 + $curtain = $this->newCurtainView($countdown); 93 + 94 + $curtain->addAction( 103 95 id(new PhabricatorActionView()) 104 96 ->setIcon('fa-pencil') 105 97 ->setName(pht('Edit Countdown')) ··· 107 99 ->setDisabled(!$can_edit) 108 100 ->setWorkflow(!$can_edit)); 109 101 110 - $view->addAction( 102 + $curtain->addAction( 111 103 id(new PhabricatorActionView()) 112 104 ->setIcon('fa-times') 113 105 ->setName(pht('Delete Countdown')) ··· 115 107 ->setDisabled(!$can_edit) 116 108 ->setWorkflow(true)); 117 109 118 - return $view; 119 - } 120 - 121 - private function buildPropertyListView( 122 - PhabricatorCountdown $countdown) { 123 - $viewer = $this->getViewer(); 124 - $view = id(new PHUIPropertyListView()) 125 - ->setUser($viewer) 126 - ->setObject($countdown); 127 - $view->invokeWillRenderEvent(); 128 - return $view; 110 + return $curtain; 129 111 } 130 112 131 113 private function buildSubheaderView(
+13 -31
src/applications/fund/controller/FundInitiativeViewController.php
··· 46 46 ->setStatus($status_icon, $status_color, $status_name) 47 47 ->setHeaderIcon('fa-heart'); 48 48 49 - $properties = $this->buildPropertyListView($initiative); 50 - $actions = $this->buildActionListView($initiative); 49 + $curtain = $this->buildCurtain($initiative); 51 50 $details = $this->buildPropertySectionView($initiative); 52 51 53 52 $timeline = $this->buildTransactionTimeline( ··· 57 56 58 57 $view = id(new PHUITwoColumnView()) 59 58 ->setHeader($header) 59 + ->setCurtain($curtain) 60 60 ->setMainColumn($timeline) 61 - ->setPropertyList($properties) 62 - ->addPropertySection(pht('DETAILS'), $details) 63 - ->setActionList($actions); 61 + ->addPropertySection(pht('DETAILS'), $details); 64 62 65 63 return $this->newPage() 66 64 ->setTitle($title) 67 65 ->setCrumbs($crumbs) 68 66 ->setPageObjectPHIDs(array($initiative->getPHID())) 69 - ->appendChild( 70 - array( 71 - $view, 72 - )); 73 - } 74 - 75 - private function buildPropertyListView(FundInitiative $initiative) { 76 - $viewer = $this->getRequest()->getUser(); 77 - 78 - $view = id(new PHUIPropertyListView()) 79 - ->setUser($viewer) 80 - ->setObject($initiative); 81 - 82 - $view->invokeWillRenderEvent(); 83 - 84 - return $view; 67 + ->appendChild($view); 85 68 } 86 69 87 70 private function buildPropertySectionView(FundInitiative $initiative) { ··· 124 107 return $view; 125 108 } 126 109 127 - private function buildActionListView(FundInitiative $initiative) { 128 - $viewer = $this->getRequest()->getUser(); 110 + private function buildCurtain(FundInitiative $initiative) { 111 + $viewer = $this->getViewer(); 112 + 129 113 $id = $initiative->getID(); 130 114 131 115 $can_edit = PhabricatorPolicyFilter::hasCapability( ··· 133 117 $initiative, 134 118 PhabricatorPolicyCapability::CAN_EDIT); 135 119 136 - $view = id(new PhabricatorActionListView()) 137 - ->setUser($viewer) 138 - ->setObject($initiative); 120 + $curtain = $this->newCurtainView($initiative); 139 121 140 - $view->addAction( 122 + $curtain->addAction( 141 123 id(new PhabricatorActionView()) 142 124 ->setName(pht('Edit Initiative')) 143 125 ->setIcon('fa-pencil') ··· 153 135 $close_icon = 'fa-times'; 154 136 } 155 137 156 - $view->addAction( 138 + $curtain->addAction( 157 139 id(new PhabricatorActionView()) 158 140 ->setName($close_name) 159 141 ->setIcon($close_icon) ··· 161 143 ->setWorkflow(true) 162 144 ->setHref($this->getApplicationURI("/close/{$id}/"))); 163 145 164 - $view->addAction( 146 + $curtain->addAction( 165 147 id(new PhabricatorActionView()) 166 148 ->setName(pht('Back Initiative')) 167 149 ->setIcon('fa-money') ··· 169 151 ->setWorkflow(true) 170 152 ->setHref($this->getApplicationURI("/back/{$id}/"))); 171 153 172 - $view->addAction( 154 + $curtain->addAction( 173 155 id(new PhabricatorActionView()) 174 156 ->setName(pht('View Backers')) 175 157 ->setIcon('fa-bank') 176 158 ->setHref($this->getApplicationURI("/backers/{$id}/"))); 177 159 178 - return $view; 160 + return $curtain; 179 161 } 180 162 181 163 }
+13 -36
src/applications/herald/controller/HeraldRuleViewController.php
··· 33 33 pht('Active')); 34 34 } 35 35 36 - $actions = $this->buildActionView($rule); 37 - $properties = $this->buildPropertyView($rule); 36 + $curtain = $this->buildCurtain($rule); 38 37 $details = $this->buildPropertySectionView($rule); 39 38 $description = $this->buildDescriptionView($rule); 40 39 ··· 43 42 $crumbs = $this->buildApplicationCrumbs(); 44 43 $crumbs->addTextCrumb("H{$id}"); 45 44 $crumbs->setBorder(true); 46 - 47 - $object_box = id(new PHUIObjectBoxView()) 48 - ->setHeader($header) 49 - ->addPropertyList($properties); 50 45 51 46 $timeline = $this->buildTransactionTimeline( 52 47 $rule, ··· 57 52 58 53 $view = id(new PHUITwoColumnView()) 59 54 ->setHeader($header) 55 + ->setCurtain($curtain) 60 56 ->setMainColumn($timeline) 61 57 ->addPropertySection(pht('DETAILS'), $details) 62 - ->addPropertySection(pht('DESCRIPTION'), $description) 63 - ->setPropertyList($properties) 64 - ->setActionList($actions); 58 + ->addPropertySection(pht('DESCRIPTION'), $description); 65 59 66 60 return $this->newPage() 67 61 ->setTitle($title) 68 62 ->setCrumbs($crumbs) 69 - ->appendChild( 70 - array( 71 - $view, 72 - )); 63 + ->appendChild($view); 73 64 } 74 65 75 - private function buildActionView(HeraldRule $rule) { 76 - $viewer = $this->getRequest()->getUser(); 66 + private function buildCurtain(HeraldRule $rule) { 67 + $viewer = $this->getViewer(); 68 + 77 69 $id = $rule->getID(); 78 70 79 - $view = id(new PhabricatorActionListView()) 80 - ->setUser($viewer) 81 - ->setObject($rule); 82 - 83 71 $can_edit = PhabricatorPolicyFilter::hasCapability( 84 72 $viewer, 85 73 $rule, 86 74 PhabricatorPolicyCapability::CAN_EDIT); 87 75 88 - $view->addAction( 76 + $curtain = $this->newCurtainView($rule); 77 + 78 + $curtain->addAction( 89 79 id(new PhabricatorActionView()) 90 80 ->setName(pht('Edit Rule')) 91 81 ->setHref($this->getApplicationURI("edit/{$id}/")) ··· 103 93 $disable_name = pht('Archive Rule'); 104 94 } 105 95 106 - $view->addAction( 96 + $curtain->addAction( 107 97 id(new PhabricatorActionView()) 108 98 ->setName(pht('Disable Rule')) 109 99 ->setHref($this->getApplicationURI($disable_uri)) ··· 112 102 ->setDisabled(!$can_edit) 113 103 ->setWorkflow(true)); 114 104 115 - return $view; 116 - } 117 - 118 - private function buildPropertyView( 119 - HeraldRule $rule) { 120 - 121 - $viewer = $this->getRequest()->getUser(); 122 - $view = id(new PHUIPropertyListView()) 123 - ->setUser($viewer) 124 - ->setObject($rule); 125 - 126 - $view->invokeWillRenderEvent(); 127 - 128 - return $view; 105 + return $curtain; 129 106 } 130 107 131 - private function buildPropertySectionView( 108 + private function buildPropertySectionView( 132 109 HeraldRule $rule) { 133 110 134 111 $viewer = $this->getRequest()->getUser();
+12 -32
src/applications/macro/controller/PhabricatorMacroViewController.php
··· 23 23 $title_short = pht('Macro "%s"', $macro->getName()); 24 24 $title_long = pht('Image Macro "%s"', $macro->getName()); 25 25 26 - $actions = $this->buildActionView($macro); 26 + $curtain = $this->buildCurtain($macro); 27 27 $subheader = $this->buildSubheaderView($macro); 28 - $properties = $this->buildPropertyView($macro); 29 28 $file = $this->buildFileView($macro); 30 29 $details = $this->buildPropertySectionView($macro); 31 30 ··· 68 67 $view = id(new PHUITwoColumnView()) 69 68 ->setHeader($header) 70 69 ->setSubheader($subheader) 70 + ->setCurtain($curtain) 71 71 ->setMainColumn(array( 72 72 $timeline, 73 73 $add_comment_form, 74 74 )) 75 75 ->addPropertySection(pht('MACRO'), $file) 76 - ->addPropertySection(pht('DETAILS'), $details) 77 - ->setPropertyList($properties) 78 - ->setActionList($actions); 76 + ->addPropertySection(pht('DETAILS'), $details); 79 77 80 78 return $this->newPage() 81 79 ->setTitle($title_short) 82 80 ->setCrumbs($crumbs) 83 81 ->setPageObjectPHIDs(array($macro->getPHID())) 84 - ->appendChild( 85 - array( 86 - $view, 87 - )); 82 + ->appendChild($view); 88 83 } 89 84 90 - private function buildActionView( 85 + private function buildCurtain( 91 86 PhabricatorFileImageMacro $macro) { 92 87 $can_manage = $this->hasApplicationCapability( 93 88 PhabricatorMacroManageCapability::CAPABILITY); 94 89 95 - $request = $this->getRequest(); 96 - $view = id(new PhabricatorActionListView()) 97 - ->setUser($request->getUser()) 98 - ->setObject($macro) 99 - ->addAction( 90 + $curtain = $this->newCurtainView($macro); 91 + 92 + $curtain->addAction( 100 93 id(new PhabricatorActionView()) 101 94 ->setName(pht('Edit Macro')) 102 95 ->setHref($this->getApplicationURI('/edit/'.$macro->getID().'/')) ··· 104 97 ->setWorkflow(!$can_manage) 105 98 ->setIcon('fa-pencil')); 106 99 107 - $view->addAction( 100 + $curtain->addAction( 108 101 id(new PhabricatorActionView()) 109 102 ->setName(pht('Edit Audio')) 110 103 ->setHref($this->getApplicationURI('/audio/'.$macro->getID().'/')) ··· 113 106 ->setIcon('fa-music')); 114 107 115 108 if ($macro->getIsDisabled()) { 116 - $view->addAction( 109 + $curtain->addAction( 117 110 id(new PhabricatorActionView()) 118 111 ->setName(pht('Activate Macro')) 119 112 ->setHref($this->getApplicationURI('/disable/'.$macro->getID().'/')) ··· 121 114 ->setDisabled(!$can_manage) 122 115 ->setIcon('fa-check')); 123 116 } else { 124 - $view->addAction( 117 + $curtain->addAction( 125 118 id(new PhabricatorActionView()) 126 119 ->setName(pht('Archive Macro')) 127 120 ->setHref($this->getApplicationURI('/disable/'.$macro->getID().'/')) ··· 130 123 ->setIcon('fa-ban')); 131 124 } 132 125 133 - return $view; 126 + return $curtain; 134 127 } 135 128 136 129 private function buildSubheaderView( ··· 204 197 return $view; 205 198 } 206 199 return null; 207 - } 208 - 209 - private function buildPropertyView( 210 - PhabricatorFileImageMacro $macro) { 211 - $viewer = $this->getViewer(); 212 - 213 - $view = id(new PHUIPropertyListView()) 214 - ->setUser($this->getRequest()->getUser()) 215 - ->setObject($macro); 216 - 217 - $view->invokeWillRenderEvent(); 218 - 219 - return $view; 220 200 } 221 201 222 202 }
+24 -26
src/applications/meta/controller/PhabricatorApplicationDetailViewController.php
··· 38 38 $header->setStatus('fa-ban', 'dark', pht('Uninstalled')); 39 39 } 40 40 41 - $actions = $this->buildActionView($viewer, $selected); 41 + $curtain = $this->buildCurtain($selected); 42 42 $details = $this->buildPropertySectionView($selected); 43 43 $policies = $this->buildPolicyView($selected); 44 44 ··· 58 58 59 59 $view = id(new PHUITwoColumnView()) 60 60 ->setHeader($header) 61 + ->setCurtain($curtain) 61 62 ->setMainColumn(array( 62 63 $policies, 63 64 $panels, 64 65 )) 65 - ->addPropertySection(pht('DETAILS'), $details) 66 - ->setActionList($actions); 66 + ->addPropertySection(pht('DETAILS'), $details); 67 67 68 68 return $this->newPage() 69 69 ->setTitle($title) ··· 147 147 148 148 } 149 149 150 - private function buildActionView( 151 - PhabricatorUser $user, 152 - PhabricatorApplication $selected) { 153 - 154 - $view = id(new PhabricatorActionListView()) 155 - ->setUser($user); 150 + private function buildCurtain(PhabricatorApplication $application) { 151 + $viewer = $this->getViewer(); 156 152 157 153 $can_edit = PhabricatorPolicyFilter::hasCapability( 158 - $user, 159 - $selected, 154 + $viewer, 155 + $application, 160 156 PhabricatorPolicyCapability::CAN_EDIT); 161 157 162 - $edit_uri = $this->getApplicationURI('edit/'.get_class($selected).'/'); 158 + $key = get_class($application); 159 + $edit_uri = $this->getApplicationURI("edit/{$key}/"); 160 + $install_uri = $this->getApplicationURI("{$key}/install/"); 161 + $uninstall_uri = $this->getApplicationURI("{$key}/uninstall/"); 163 162 164 - $view->addAction( 163 + $curtain = $this->newCurtainView($application); 164 + 165 + $curtain->addAction( 165 166 id(new PhabricatorActionView()) 166 167 ->setName(pht('Edit Policies')) 167 168 ->setIcon('fa-pencil') ··· 169 170 ->setWorkflow(!$can_edit) 170 171 ->setHref($edit_uri)); 171 172 172 - if ($selected->canUninstall()) { 173 - if ($selected->isInstalled()) { 174 - $view->addAction( 173 + if ($application->canUninstall()) { 174 + if ($application->isInstalled()) { 175 + $curtain->addAction( 175 176 id(new PhabricatorActionView()) 176 177 ->setName(pht('Uninstall')) 177 178 ->setIcon('fa-times') 178 179 ->setDisabled(!$can_edit) 179 180 ->setWorkflow(true) 180 - ->setHref( 181 - $this->getApplicationURI(get_class($selected).'/uninstall/'))); 181 + ->setHref($uninstall_uri)); 182 182 } else { 183 183 $action = id(new PhabricatorActionView()) 184 184 ->setName(pht('Install')) 185 185 ->setIcon('fa-plus') 186 186 ->setDisabled(!$can_edit) 187 187 ->setWorkflow(true) 188 - ->setHref( 189 - $this->getApplicationURI(get_class($selected).'/install/')); 188 + ->setHref($install_uri); 190 189 191 190 $prototypes_enabled = PhabricatorEnv::getEnvConfig( 192 191 'phabricator.show-prototypes'); 193 - if ($selected->isPrototype() && !$prototypes_enabled) { 192 + if ($application->isPrototype() && !$prototypes_enabled) { 194 193 $action->setDisabled(true); 195 194 } 196 195 197 - $view->addAction($action); 196 + $curtain->addAction($action); 198 197 } 199 198 } else { 200 - $view->addAction( 199 + $curtain->addAction( 201 200 id(new PhabricatorActionView()) 202 201 ->setName(pht('Uninstall')) 203 202 ->setIcon('fa-times') 204 203 ->setWorkflow(true) 205 204 ->setDisabled(true) 206 - ->setHref( 207 - $this->getApplicationURI(get_class($selected).'/uninstall/'))); 205 + ->setHref($uninstall_uri)); 208 206 } 209 207 210 - return $view; 208 + return $curtain; 211 209 } 212 210 213 211 }
+35 -55
src/applications/owners/controller/PhabricatorOwnersDetailController.php
··· 43 43 ->setViewer($viewer) 44 44 ->readFieldsFromStorage($package); 45 45 46 - $actions = $this->buildPackageActionView($package); 47 - $properties = $this->buildPackagePropertyView($package, $field_list); 46 + $curtain = $this->buildCurtain($package); 48 47 $details = $this->buildPackageDetailView($package, $field_list); 49 48 50 49 if ($package->isArchived()) { ··· 155 154 156 155 $view = id(new PHUITwoColumnView()) 157 156 ->setHeader($header) 157 + ->setCurtain($curtain) 158 158 ->setMainColumn(array( 159 159 $this->renderPathsTable($paths, $repositories), 160 160 $commit_panels, 161 161 $timeline, 162 162 )) 163 - ->addPropertySection(pht('Details'), $details) 164 - ->setPropertyList($properties) 165 - ->setActionList($actions); 163 + ->addPropertySection(pht('Details'), $details); 166 164 167 165 return $this->newPage() 168 166 ->setTitle($package->getName()) 169 167 ->setCrumbs($crumbs) 170 - ->appendChild( 171 - array( 172 - $view, 173 - )); 174 - } 175 - 176 - private function buildPackagePropertyView( 177 - PhabricatorOwnersPackage $package, 178 - PhabricatorCustomFieldList $field_list) { 179 - 180 - $viewer = $this->getViewer(); 181 - $view = id(new PHUIPropertyListView()) 182 - ->setUser($viewer) 183 - ->setObject($package); 184 - $view->invokeWillRenderEvent(); 185 - 186 - return $view; 168 + ->appendChild($view); 187 169 } 188 170 189 171 private function buildPackageDetailView( ··· 224 206 return $view; 225 207 } 226 208 227 - private function buildPackageActionView(PhabricatorOwnersPackage $package) { 209 + private function buildCurtain(PhabricatorOwnersPackage $package) { 228 210 $viewer = $this->getViewer(); 229 211 230 212 $can_edit = PhabricatorPolicyFilter::hasCapability( ··· 236 218 $edit_uri = $this->getApplicationURI("/edit/{$id}/"); 237 219 $paths_uri = $this->getApplicationURI("/paths/{$id}/"); 238 220 239 - $action_list = id(new PhabricatorActionListView()) 240 - ->setUser($viewer) 241 - ->setObject($package); 221 + $curtain = $this->newCurtainView($package); 242 222 243 - $action_list->addAction( 244 - id(new PhabricatorActionView()) 245 - ->setName(pht('Edit Package')) 246 - ->setIcon('fa-pencil') 247 - ->setDisabled(!$can_edit) 248 - ->setWorkflow(!$can_edit) 249 - ->setHref($edit_uri)); 223 + $curtain->addAction( 224 + id(new PhabricatorActionView()) 225 + ->setName(pht('Edit Package')) 226 + ->setIcon('fa-pencil') 227 + ->setDisabled(!$can_edit) 228 + ->setWorkflow(!$can_edit) 229 + ->setHref($edit_uri)); 250 230 251 231 if ($package->isArchived()) { 252 - $action_list->addAction( 253 - id(new PhabricatorActionView()) 254 - ->setName(pht('Activate Package')) 255 - ->setIcon('fa-check') 256 - ->setDisabled(!$can_edit) 257 - ->setWorkflow($can_edit) 258 - ->setHref($this->getApplicationURI("/archive/{$id}/"))); 232 + $curtain->addAction( 233 + id(new PhabricatorActionView()) 234 + ->setName(pht('Activate Package')) 235 + ->setIcon('fa-check') 236 + ->setDisabled(!$can_edit) 237 + ->setWorkflow($can_edit) 238 + ->setHref($this->getApplicationURI("/archive/{$id}/"))); 259 239 } else { 260 - $action_list->addAction( 261 - id(new PhabricatorActionView()) 262 - ->setName(pht('Archive Package')) 263 - ->setIcon('fa-ban') 264 - ->setDisabled(!$can_edit) 265 - ->setWorkflow($can_edit) 266 - ->setHref($this->getApplicationURI("/archive/{$id}/"))); 240 + $curtain->addAction( 241 + id(new PhabricatorActionView()) 242 + ->setName(pht('Archive Package')) 243 + ->setIcon('fa-ban') 244 + ->setDisabled(!$can_edit) 245 + ->setWorkflow($can_edit) 246 + ->setHref($this->getApplicationURI("/archive/{$id}/"))); 267 247 } 268 248 269 - $action_list->addAction( 270 - id(new PhabricatorActionView()) 271 - ->setName(pht('Edit Paths')) 272 - ->setIcon('fa-folder-open') 273 - ->setDisabled(!$can_edit) 274 - ->setWorkflow(!$can_edit) 275 - ->setHref($paths_uri)); 249 + $curtain->addAction( 250 + id(new PhabricatorActionView()) 251 + ->setName(pht('Edit Paths')) 252 + ->setIcon('fa-folder-open') 253 + ->setDisabled(!$can_edit) 254 + ->setWorkflow(!$can_edit) 255 + ->setHref($paths_uri)); 276 256 277 - return $action_list; 257 + return $curtain; 278 258 } 279 259 280 260 private function renderPathsTable(array $paths, array $repositories) {
+15 -36
src/applications/passphrase/controller/PassphraseCredentialViewController.php
··· 31 31 $crumbs->setBorder(true); 32 32 33 33 $header = $this->buildHeaderView($credential); 34 - $actions = $this->buildActionView($credential, $type); 35 - $properties = $this->buildPropertyView($credential, $type); 34 + $curtain = $this->buildCurtain($credential, $type); 36 35 $subheader = $this->buildSubheaderView($credential); 37 36 $content = $this->buildPropertySectionView($credential, $type); 38 37 39 38 $view = id(new PHUITwoColumnView()) 40 39 ->setHeader($header) 41 40 ->setSubheader($subheader) 41 + ->setCurtain($curtain) 42 42 ->setMainColumn($timeline) 43 - ->addPropertySection(pht('PROPERTIES'), $content) 44 - ->setPropertyList($properties) 45 - ->setActionList($actions); 43 + ->addPropertySection(pht('PROPERTIES'), $content); 46 44 47 45 return $this->newPage() 48 46 ->setTitle($title) 49 47 ->setCrumbs($crumbs) 50 - ->appendChild( 51 - array( 52 - $view, 53 - )); 48 + ->appendChild($view); 54 49 } 55 50 56 51 private function buildHeaderView(PassphraseCredential $credential) { ··· 98 93 ->setContent($content); 99 94 } 100 95 101 - private function buildActionView( 96 + private function buildCurtain( 102 97 PassphraseCredential $credential, 103 98 PassphraseCredentialType $type) { 104 - $viewer = $this->getRequest()->getUser(); 99 + $viewer = $this->getViewer(); 105 100 106 101 $id = $credential->getID(); 107 102 ··· 123 118 $credential_conduit_icon = 'fa-wrench'; 124 119 } 125 120 126 - $actions = id(new PhabricatorActionListView()) 127 - ->setObject($credential) 128 - ->setUser($viewer); 129 - 130 121 $can_edit = PhabricatorPolicyFilter::hasCapability( 131 122 $viewer, 132 123 $credential, 133 124 PhabricatorPolicyCapability::CAN_EDIT); 134 125 135 - $actions->addAction( 126 + $curtain = $this->newCurtainView($credential); 127 + 128 + $curtain->addAction( 136 129 id(new PhabricatorActionView()) 137 130 ->setName(pht('Edit Credential')) 138 131 ->setIcon('fa-pencil') ··· 141 134 ->setWorkflow(!$can_edit)); 142 135 143 136 if (!$credential->getIsDestroyed()) { 144 - $actions->addAction( 137 + $curtain->addAction( 145 138 id(new PhabricatorActionView()) 146 139 ->setName(pht('Destroy Credential')) 147 140 ->setIcon('fa-times') ··· 149 142 ->setDisabled(!$can_edit) 150 143 ->setWorkflow(true)); 151 144 152 - $actions->addAction( 145 + $curtain->addAction( 153 146 id(new PhabricatorActionView()) 154 147 ->setName(pht('Show Secret')) 155 148 ->setIcon('fa-eye') ··· 158 151 ->setWorkflow(true)); 159 152 160 153 if ($type->hasPublicKey()) { 161 - $actions->addAction( 154 + $curtain->addAction( 162 155 id(new PhabricatorActionView()) 163 156 ->setName(pht('Show Public Key')) 164 157 ->setIcon('fa-download') ··· 167 160 ->setWorkflow(true)); 168 161 } 169 162 170 - $actions->addAction( 163 + $curtain->addAction( 171 164 id(new PhabricatorActionView()) 172 165 ->setName($credential_conduit_text) 173 166 ->setIcon($credential_conduit_icon) ··· 175 168 ->setDisabled(!$can_edit) 176 169 ->setWorkflow(true)); 177 170 178 - $actions->addAction( 171 + $curtain->addAction( 179 172 id(new PhabricatorActionView()) 180 173 ->setName($credential_lock_text) 181 174 ->setIcon($credential_lock_icon) ··· 184 177 ->setWorkflow(true)); 185 178 } 186 179 187 - 188 - return $actions; 180 + return $curtain; 189 181 } 190 182 191 183 private function buildPropertySectionView( ··· 233 225 new PHUIRemarkupView($viewer, $description)); 234 226 } 235 227 236 - return $properties; 237 - } 238 - 239 - private function buildPropertyView( 240 - PassphraseCredential $credential, 241 - PassphraseCredentialType $type) { 242 - $viewer = $this->getRequest()->getUser(); 243 - 244 - $properties = id(new PHUIPropertyListView()) 245 - ->setUser($viewer) 246 - ->setObject($credential); 247 - 248 - $properties->invokeWillRenderEvent(); 249 228 return $properties; 250 229 } 251 230
+11 -32
src/applications/ponder/controller/PonderQuestionViewController.php
··· 43 43 $header->setStatus($icon, 'dark', $text); 44 44 } 45 45 46 - $properties = $this->buildPropertyListView($question); 47 - $actions = $this->buildActionListView($question); 46 + $curtain = $this->buildCurtain($question); 48 47 $details = $this->buildPropertySectionView($question); 49 48 50 49 $can_edit = PhabricatorPolicyFilter::hasCapability( ··· 118 117 $ponder_view = id(new PHUITwoColumnView()) 119 118 ->setHeader($header) 120 119 ->setSubheader($subheader) 120 + ->setCurtain($curtain) 121 121 ->setMainColumn($ponder_content) 122 - ->setPropertyList($properties) 123 122 ->addPropertySection(pht('DETAILS'), $details) 124 - ->setActionList($actions) 125 123 ->addClass('ponder-question-view'); 126 124 127 125 $page_objects = array_merge( 128 - array($question->getPHID()), 129 - mpull($question->getAnswers(), 'getPHID')); 126 + array($question->getPHID()), 127 + mpull($question->getAnswers(), 'getPHID')); 130 128 131 129 return $this->newPage() 132 130 ->setTitle('Q'.$question->getID().' '.$question->getTitle()) 133 131 ->setCrumbs($crumbs) 134 132 ->setPageObjectPHIDs($page_objects) 135 - ->appendChild( 136 - array( 137 - $ponder_view, 138 - )); 133 + ->appendChild($ponder_view); 139 134 } 140 135 141 - private function buildActionListView(PonderQuestion $question) { 136 + private function buildCurtain(PonderQuestion $question) { 142 137 $viewer = $this->getViewer(); 143 - $request = $this->getRequest(); 144 138 $id = $question->getID(); 145 139 146 140 $can_edit = PhabricatorPolicyFilter::hasCapability( ··· 148 142 $question, 149 143 PhabricatorPolicyCapability::CAN_EDIT); 150 144 151 - $view = id(new PhabricatorActionListView()) 152 - ->setUser($viewer) 153 - ->setObject($question); 145 + $curtain = $this->newCurtainView($question); 154 146 155 147 if ($question->getStatus() == PonderQuestionStatus::STATUS_OPEN) { 156 148 $name = pht('Close Question'); ··· 160 152 $icon = 'fa-square-o'; 161 153 } 162 154 163 - $view->addAction( 155 + $curtain->addAction( 164 156 id(new PhabricatorActionView()) 165 157 ->setIcon('fa-pencil') 166 158 ->setName(pht('Edit Question')) ··· 168 160 ->setDisabled(!$can_edit) 169 161 ->setWorkflow(!$can_edit)); 170 162 171 - $view->addAction( 163 + $curtain->addAction( 172 164 id(new PhabricatorActionView()) 173 165 ->setName($name) 174 166 ->setIcon($icon) ··· 176 168 ->setDisabled(!$can_edit) 177 169 ->setHref($this->getApplicationURI("/question/status/{$id}/"))); 178 170 179 - $view->addAction( 171 + $curtain->addAction( 180 172 id(new PhabricatorActionView()) 181 173 ->setIcon('fa-list') 182 174 ->setName(pht('View History')) 183 175 ->setHref($this->getApplicationURI("/question/history/{$id}/"))); 184 176 185 - return $view; 186 - } 187 - 188 - private function buildPropertyListView( 189 - PonderQuestion $question) { 190 - 191 - $viewer = $this->getViewer(); 192 - $view = id(new PHUIPropertyListView()) 193 - ->setUser($viewer) 194 - ->setObject($question); 195 - 196 - $view->invokeWillRenderEvent(); 197 - 198 - return $view; 177 + return $curtain; 199 178 } 200 179 201 180 private function buildSubheaderView(
+11 -30
src/applications/slowvote/controller/PhabricatorSlowvotePollController.php
··· 46 46 ->setPolicyObject($poll) 47 47 ->setHeaderIcon('fa-bar-chart'); 48 48 49 - $actions = $this->buildActionView($poll); 50 - $properties = $this->buildPropertyView($poll); 49 + $curtain = $this->buildCurtain($poll); 51 50 $subheader = $this->buildSubheaderView($poll); 52 51 53 52 $crumbs = $this->buildApplicationCrumbs(); ··· 68 67 $view = id(new PHUITwoColumnView()) 69 68 ->setHeader($header) 70 69 ->setSubheader($subheader) 71 - ->setMainColumn($poll_content) 72 - ->setPropertyList($properties) 73 - ->setActionList($actions); 70 + ->setCurtain($curtain) 71 + ->setMainColumn($poll_content); 74 72 75 73 return $this->newPage() 76 74 ->setTitle('V'.$poll->getID().' '.$poll->getQuestion()) 77 75 ->setCrumbs($crumbs) 78 76 ->setPageObjectPHIDs(array($poll->getPHID())) 79 - ->appendChild( 80 - array( 81 - $view, 82 - )); 77 + ->appendChild($view); 83 78 } 84 79 85 - private function buildActionView(PhabricatorSlowvotePoll $poll) { 86 - $viewer = $this->getRequest()->getUser(); 87 - 88 - $view = id(new PhabricatorActionListView()) 89 - ->setUser($viewer) 90 - ->setObject($poll); 80 + private function buildCurtain(PhabricatorSlowvotePoll $poll) { 81 + $viewer = $this->getViewer(); 91 82 92 83 $can_edit = PhabricatorPolicyFilter::hasCapability( 93 84 $viewer, 94 85 $poll, 95 86 PhabricatorPolicyCapability::CAN_EDIT); 96 87 88 + $curtain = $this->newCurtainView($poll); 89 + 97 90 $is_closed = $poll->getIsClosed(); 98 91 $close_poll_text = $is_closed ? pht('Reopen Poll') : pht('Close Poll'); 99 92 $close_poll_icon = $is_closed ? 'fa-play-circle-o' : 'fa-ban'; 100 93 101 - $view->addAction( 94 + $curtain->addAction( 102 95 id(new PhabricatorActionView()) 103 96 ->setName(pht('Edit Poll')) 104 97 ->setIcon('fa-pencil') ··· 106 99 ->setDisabled(!$can_edit) 107 100 ->setWorkflow(!$can_edit)); 108 101 109 - $view->addAction( 102 + $curtain->addAction( 110 103 id(new PhabricatorActionView()) 111 104 ->setName($close_poll_text) 112 105 ->setIcon($close_poll_icon) ··· 114 107 ->setDisabled(!$can_edit) 115 108 ->setWorkflow(true)); 116 109 117 - return $view; 118 - } 119 - 120 - private function buildPropertyView( 121 - PhabricatorSlowvotePoll $poll) { 122 - 123 - $viewer = $this->getRequest()->getUser(); 124 - $view = id(new PHUIPropertyListView()) 125 - ->setUser($viewer) 126 - ->setObject($poll); 127 - $view->invokeWillRenderEvent(); 128 - 129 - return $view; 110 + return $curtain; 130 111 } 131 112 132 113 private function buildSubheaderView(