@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 Guides to Modules

Summary: Splitting these up to re-use in Config as a stop gap.

Test Plan: Visit welcome, install, and quick start on guides app

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

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

+137 -130
+10 -6
src/__phutil_library_map__.php
··· 2639 2639 'PhabricatorGoogleAuthProvider' => 'applications/auth/provider/PhabricatorGoogleAuthProvider.php', 2640 2640 'PhabricatorGuideApplication' => 'applications/guides/application/PhabricatorGuideApplication.php', 2641 2641 'PhabricatorGuideController' => 'applications/guides/controller/PhabricatorGuideController.php', 2642 - 'PhabricatorGuideInstallController' => 'applications/guides/controller/PhabricatorGuideInstallController.php', 2642 + 'PhabricatorGuideInstallModule' => 'applications/guides/module/PhabricatorGuideInstallModule.php', 2643 2643 'PhabricatorGuideItemView' => 'applications/guides/view/PhabricatorGuideItemView.php', 2644 2644 'PhabricatorGuideListView' => 'applications/guides/view/PhabricatorGuideListView.php', 2645 - 'PhabricatorGuideQuickStartController' => 'applications/guides/controller/PhabricatorGuideQuickStartController.php', 2646 - 'PhabricatorGuideWelcomeController' => 'applications/guides/controller/PhabricatorGuideWelcomeController.php', 2645 + 'PhabricatorGuideModule' => 'applications/guides/module/PhabricatorGuideModule.php', 2646 + 'PhabricatorGuideModuleController' => 'applications/guides/controller/PhabricatorGuideModuleController.php', 2647 + 'PhabricatorGuideQuickStartModule' => 'applications/guides/module/PhabricatorGuideQuickStartModule.php', 2648 + 'PhabricatorGuideWelcomeModule' => 'applications/guides/module/PhabricatorGuideWelcomeModule.php', 2647 2649 'PhabricatorHTTPParameterTypeTableView' => 'applications/config/view/PhabricatorHTTPParameterTypeTableView.php', 2648 2650 'PhabricatorHandleList' => 'applications/phid/handle/pool/PhabricatorHandleList.php', 2649 2651 'PhabricatorHandleObjectSelectorDataView' => 'applications/phid/handle/view/PhabricatorHandleObjectSelectorDataView.php', ··· 7454 7456 'PhabricatorGoogleAuthProvider' => 'PhabricatorOAuth2AuthProvider', 7455 7457 'PhabricatorGuideApplication' => 'PhabricatorApplication', 7456 7458 'PhabricatorGuideController' => 'PhabricatorController', 7457 - 'PhabricatorGuideInstallController' => 'PhabricatorGuideController', 7459 + 'PhabricatorGuideInstallModule' => 'PhabricatorGuideModule', 7458 7460 'PhabricatorGuideItemView' => 'Phobject', 7459 7461 'PhabricatorGuideListView' => 'AphrontView', 7460 - 'PhabricatorGuideQuickStartController' => 'PhabricatorGuideController', 7461 - 'PhabricatorGuideWelcomeController' => 'PhabricatorGuideController', 7462 + 'PhabricatorGuideModule' => 'Phobject', 7463 + 'PhabricatorGuideModuleController' => 'PhabricatorGuideController', 7464 + 'PhabricatorGuideQuickStartModule' => 'PhabricatorGuideModule', 7465 + 'PhabricatorGuideWelcomeModule' => 'PhabricatorGuideModule', 7462 7466 'PhabricatorHTTPParameterTypeTableView' => 'AphrontView', 7463 7467 'PhabricatorHandleList' => array( 7464 7468 'Phobject',
+2 -5
src/applications/guides/application/PhabricatorGuideApplication.php
··· 29 29 public function getRoutes() { 30 30 return array( 31 31 '/guides/' => array( 32 - '' => 'PhabricatorGuideWelcomeController', 33 - 'install/' 34 - => 'PhabricatorGuideInstallController', 35 - 'quickstart/' 36 - => 'PhabricatorGuideQuickStartController', 32 + '' => 'PhabricatorGuideModuleController', 33 + '(?P<module>[^/]+)/' => 'PhabricatorGuideModuleController', 37 34 ), 38 35 ); 39 36 }
+5 -3
src/applications/guides/controller/PhabricatorGuideController.php
··· 7 7 $nav = new AphrontSideNavFilterView(); 8 8 $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 9 9 $nav->addLabel(pht('Guides')); 10 - $nav->addFilter('/', pht('Welcome')); 11 - $nav->addFilter('install/', pht('Installation Guide')); 12 - $nav->addFilter('quickstart/', pht('Quick Start Guide')); 10 + 11 + $modules = PhabricatorGuideModule::getAllModules(); 12 + foreach ($modules as $key => $module) { 13 + $nav->addFilter($key.'/', $module->getModuleName()); 14 + } 13 15 14 16 return $nav; 15 17 }
+13 -32
src/applications/guides/controller/PhabricatorGuideInstallController.php src/applications/guides/module/PhabricatorGuideInstallModule.php
··· 1 1 <?php 2 2 3 - final class PhabricatorGuideInstallController 4 - extends PhabricatorGuideController { 3 + final class PhabricatorGuideInstallModule extends PhabricatorGuideModule { 5 4 6 - public function shouldAllowPublic() { 7 - return false; 5 + public function getModuleKey() { 6 + return 'install'; 8 7 } 9 8 10 - public function handleRequest(AphrontRequest $request) { 11 - $viewer = $request->getViewer(); 9 + public function getModuleName() { 10 + return pht('Install Phabricator'); 11 + } 12 12 13 - $title = pht('Installation Guide'); 13 + public function getModulePosition() { 14 + return 20; 15 + } 14 16 15 - $nav = $this->buildSideNavView(); 16 - $nav->selectFilter('install/'); 17 + public function renderModuleStatus(AphrontRequest $request) { 18 + $viewer = $request->getViewer(); 17 19 18 - $header = id(new PHUIHeaderView()) 19 - ->setHeader($title) 20 - ->setProfileHeader(true); 21 - 22 - $crumbs = $this->buildApplicationCrumbs() 23 - ->addTextCrumb(pht('Installation')); 24 - 25 - $content = $this->getGuideContent($viewer); 26 - 27 - $view = id(new PHUICMSView()) 28 - ->setCrumbs($crumbs) 29 - ->setNavigation($nav) 30 - ->setHeader($header) 31 - ->setContent($content); 32 - 33 - return $this->newPage() 34 - ->setTitle($title) 35 - ->addClass('phui-cms-body') 36 - ->appendChild($view); 37 - 38 - } 39 - 40 - private function getGuideContent($viewer) { 41 20 $guide_items = new PhabricatorGuideListView(); 42 21 43 22 $title = pht('Resolve Setup Issues'); ··· 191 170 $guide_items->addItem($item); 192 171 193 172 return $guide_items; 173 + 194 174 } 175 + 195 176 }
+42
src/applications/guides/controller/PhabricatorGuideModuleController.php
··· 1 + <?php 2 + 3 + final class PhabricatorGuideModuleController 4 + extends PhabricatorGuideController { 5 + 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $this->getViewer(); 8 + $key = $request->getURIData('module'); 9 + 10 + if (!$key) { 11 + $key = 'welcome'; 12 + } 13 + $all_modules = PhabricatorGuideModule::getAllModules(); 14 + 15 + $nav = $this->buildSideNavView(); 16 + $nav->selectFilter($key.'/'); 17 + 18 + $module = $all_modules[$key]; 19 + $content = $module->renderModuleStatus($request); 20 + $title = $module->getModuleName(); 21 + 22 + $crumbs = $this->buildApplicationCrumbs(); 23 + $crumbs->addTextCrumb($title); 24 + $crumbs->setBorder(true); 25 + 26 + $header = id(new PHUIHeaderView()) 27 + ->setHeader($title) 28 + ->setProfileHeader(true); 29 + 30 + $view = id(new PHUICMSView()) 31 + ->setCrumbs($crumbs) 32 + ->setNavigation($nav) 33 + ->setHeader($header) 34 + ->setContent($content); 35 + 36 + return $this->newPage() 37 + ->setTitle($title) 38 + ->addClass('phui-cms-body') 39 + ->appendChild($view); 40 + } 41 + 42 + }
+13 -32
src/applications/guides/controller/PhabricatorGuideQuickStartController.php src/applications/guides/module/PhabricatorGuideQuickStartModule.php
··· 1 1 <?php 2 2 3 - final class PhabricatorGuideQuickStartController 4 - extends PhabricatorGuideController { 3 + final class PhabricatorGuideQuickStartModule extends PhabricatorGuideModule { 5 4 6 - public function shouldAllowPublic() { 7 - return false; 5 + public function getModuleKey() { 6 + return 'quickstart'; 8 7 } 9 8 10 - public function handleRequest(AphrontRequest $request) { 11 - $viewer = $request->getViewer(); 9 + public function getModuleName() { 10 + return pht('Quick Start'); 11 + } 12 12 13 - $title = pht('Quick Start Guide'); 13 + public function getModulePosition() { 14 + return 30; 15 + } 14 16 15 - $nav = $this->buildSideNavView(); 16 - $nav->selectFilter('quickstart/'); 17 + public function renderModuleStatus(AphrontRequest $request) { 18 + $viewer = $request->getViewer(); 17 19 18 - $header = id(new PHUIHeaderView()) 19 - ->setHeader($title) 20 - ->setProfileHeader(true); 21 - 22 - $crumbs = $this->buildApplicationCrumbs() 23 - ->addTextCrumb(pht('Quick Start')); 24 - 25 - $content = $this->getGuideContent($viewer); 26 - 27 - $view = id(new PHUICMSView()) 28 - ->setCrumbs($crumbs) 29 - ->setNavigation($nav) 30 - ->setHeader($header) 31 - ->setContent($content); 32 - 33 - return $this->newPage() 34 - ->setTitle($title) 35 - ->addClass('phui-cms-body') 36 - ->appendChild($view); 37 - 38 - } 39 - 40 - private function getGuideContent($viewer) { 41 20 $guide_items = new PhabricatorGuideListView(); 42 21 43 22 $title = pht('Configure Applications'); ··· 205 184 $guide_items->addItem($item); 206 185 207 186 return $guide_items; 187 + 208 188 } 189 + 209 190 }
-52
src/applications/guides/controller/PhabricatorGuideWelcomeController.php
··· 1 - <?php 2 - 3 - final class PhabricatorGuideWelcomeController 4 - extends PhabricatorGuideController { 5 - 6 - public function shouldAllowPublic() { 7 - return false; 8 - } 9 - 10 - public function handleRequest(AphrontRequest $request) { 11 - $viewer = $request->getViewer(); 12 - 13 - $title = pht('Welcome to Phabricator'); 14 - 15 - $nav = $this->buildSideNavView(); 16 - $nav->selectFilter('/'); 17 - 18 - $header = id(new PHUIHeaderView()) 19 - ->setHeader($title) 20 - ->setProfileHeader(true); 21 - 22 - $crumbs = $this->buildApplicationCrumbs() 23 - ->addTextCrumb(pht('Welcome')); 24 - 25 - $content = id(new PHUIDocumentViewPro()) 26 - ->appendChild($this->getGuideContent($viewer)); 27 - 28 - $view = id(new PHUICMSView()) 29 - ->setCrumbs($crumbs) 30 - ->setNavigation($nav) 31 - ->setHeader($header) 32 - ->setContent($content); 33 - 34 - return $this->newPage() 35 - ->setTitle($title) 36 - ->addClass('phui-cms-body') 37 - ->appendChild($view); 38 - 39 - } 40 - 41 - private function getGuideContent($viewer) { 42 - 43 - $content = pht( 44 - 'You have successfully installed Phabricator. These next guides will '. 45 - 'take you through configuration and new user orientation. '. 46 - 'These steps are optional, and you can go through them in any order. '. 47 - 'If you want to get back to this guide later on, you can find it in '. 48 - 'the **Config** application under **Welcome Guide**.'); 49 - 50 - return new PHUIRemarkupView($viewer, $content); 51 - } 52 - }
+18
src/applications/guides/module/PhabricatorGuideModule.php
··· 1 + <?php 2 + 3 + abstract class PhabricatorGuideModule extends Phobject { 4 + 5 + abstract public function getModuleKey(); 6 + abstract public function getModuleName(); 7 + abstract public function getModulePosition(); 8 + abstract public function renderModuleStatus(AphrontRequest $request); 9 + 10 + final public static function getAllModules() { 11 + return id(new PhutilClassMapQuery()) 12 + ->setAncestorClass(__CLASS__) 13 + ->setUniqueMethod('getModuleKey') 14 + ->setSortMethod('getModulePosition') 15 + ->execute(); 16 + } 17 + 18 + }
+34
src/applications/guides/module/PhabricatorGuideWelcomeModule.php
··· 1 + <?php 2 + 3 + final class PhabricatorGuideWelcomeModule extends PhabricatorGuideModule { 4 + 5 + public function getModuleKey() { 6 + return 'welcome'; 7 + } 8 + 9 + public function getModuleName() { 10 + return pht('Welcome'); 11 + } 12 + 13 + public function getModulePosition() { 14 + return 10; 15 + } 16 + 17 + public function renderModuleStatus(AphrontRequest $request) { 18 + $viewer = $request->getViewer(); 19 + 20 + $content = pht( 21 + 'You have successfully installed Phabricator. These next guides will '. 22 + 'take you through configuration and new user orientation. '. 23 + 'These steps are optional, and you can go through them in any order. '. 24 + 'If you want to get back to this guide later on, you can find it in '. 25 + 'the **Config** application under **Welcome Guide**.'); 26 + 27 + $content = new PHUIRemarkupView($viewer, $content); 28 + 29 + return id(new PHUIDocumentViewPro()) 30 + ->appendChild($content); 31 + 32 + } 33 + 34 + }