diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 0712bb72da..81ca752943 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2639,11 +2639,13 @@ phutil_register_library_map(array( 'PhabricatorGoogleAuthProvider' => 'applications/auth/provider/PhabricatorGoogleAuthProvider.php', 'PhabricatorGuideApplication' => 'applications/guides/application/PhabricatorGuideApplication.php', 'PhabricatorGuideController' => 'applications/guides/controller/PhabricatorGuideController.php', - 'PhabricatorGuideInstallController' => 'applications/guides/controller/PhabricatorGuideInstallController.php', + 'PhabricatorGuideInstallModule' => 'applications/guides/module/PhabricatorGuideInstallModule.php', 'PhabricatorGuideItemView' => 'applications/guides/view/PhabricatorGuideItemView.php', 'PhabricatorGuideListView' => 'applications/guides/view/PhabricatorGuideListView.php', - 'PhabricatorGuideQuickStartController' => 'applications/guides/controller/PhabricatorGuideQuickStartController.php', - 'PhabricatorGuideWelcomeController' => 'applications/guides/controller/PhabricatorGuideWelcomeController.php', + 'PhabricatorGuideModule' => 'applications/guides/module/PhabricatorGuideModule.php', + 'PhabricatorGuideModuleController' => 'applications/guides/controller/PhabricatorGuideModuleController.php', + 'PhabricatorGuideQuickStartModule' => 'applications/guides/module/PhabricatorGuideQuickStartModule.php', + 'PhabricatorGuideWelcomeModule' => 'applications/guides/module/PhabricatorGuideWelcomeModule.php', 'PhabricatorHTTPParameterTypeTableView' => 'applications/config/view/PhabricatorHTTPParameterTypeTableView.php', 'PhabricatorHandleList' => 'applications/phid/handle/pool/PhabricatorHandleList.php', 'PhabricatorHandleObjectSelectorDataView' => 'applications/phid/handle/view/PhabricatorHandleObjectSelectorDataView.php', @@ -7454,11 +7456,13 @@ phutil_register_library_map(array( 'PhabricatorGoogleAuthProvider' => 'PhabricatorOAuth2AuthProvider', 'PhabricatorGuideApplication' => 'PhabricatorApplication', 'PhabricatorGuideController' => 'PhabricatorController', - 'PhabricatorGuideInstallController' => 'PhabricatorGuideController', + 'PhabricatorGuideInstallModule' => 'PhabricatorGuideModule', 'PhabricatorGuideItemView' => 'Phobject', 'PhabricatorGuideListView' => 'AphrontView', - 'PhabricatorGuideQuickStartController' => 'PhabricatorGuideController', - 'PhabricatorGuideWelcomeController' => 'PhabricatorGuideController', + 'PhabricatorGuideModule' => 'Phobject', + 'PhabricatorGuideModuleController' => 'PhabricatorGuideController', + 'PhabricatorGuideQuickStartModule' => 'PhabricatorGuideModule', + 'PhabricatorGuideWelcomeModule' => 'PhabricatorGuideModule', 'PhabricatorHTTPParameterTypeTableView' => 'AphrontView', 'PhabricatorHandleList' => array( 'Phobject', diff --git a/src/applications/guides/application/PhabricatorGuideApplication.php b/src/applications/guides/application/PhabricatorGuideApplication.php index 66f678489a..f60b66bfb2 100644 --- a/src/applications/guides/application/PhabricatorGuideApplication.php +++ b/src/applications/guides/application/PhabricatorGuideApplication.php @@ -29,11 +29,8 @@ final class PhabricatorGuideApplication extends PhabricatorApplication { public function getRoutes() { return array( '/guides/' => array( - '' => 'PhabricatorGuideWelcomeController', - 'install/' - => 'PhabricatorGuideInstallController', - 'quickstart/' - => 'PhabricatorGuideQuickStartController', + '' => 'PhabricatorGuideModuleController', + '(?P[^/]+)/' => 'PhabricatorGuideModuleController', ), ); } diff --git a/src/applications/guides/controller/PhabricatorGuideController.php b/src/applications/guides/controller/PhabricatorGuideController.php index 5aac89ba00..e7584cea00 100644 --- a/src/applications/guides/controller/PhabricatorGuideController.php +++ b/src/applications/guides/controller/PhabricatorGuideController.php @@ -7,9 +7,11 @@ abstract class PhabricatorGuideController extends PhabricatorController { $nav = new AphrontSideNavFilterView(); $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); $nav->addLabel(pht('Guides')); - $nav->addFilter('/', pht('Welcome')); - $nav->addFilter('install/', pht('Installation Guide')); - $nav->addFilter('quickstart/', pht('Quick Start Guide')); + + $modules = PhabricatorGuideModule::getAllModules(); + foreach ($modules as $key => $module) { + $nav->addFilter($key.'/', $module->getModuleName()); + } return $nav; } diff --git a/src/applications/guides/controller/PhabricatorGuideModuleController.php b/src/applications/guides/controller/PhabricatorGuideModuleController.php new file mode 100644 index 0000000000..c971195e60 --- /dev/null +++ b/src/applications/guides/controller/PhabricatorGuideModuleController.php @@ -0,0 +1,42 @@ +getViewer(); + $key = $request->getURIData('module'); + + if (!$key) { + $key = 'welcome'; + } + $all_modules = PhabricatorGuideModule::getAllModules(); + + $nav = $this->buildSideNavView(); + $nav->selectFilter($key.'/'); + + $module = $all_modules[$key]; + $content = $module->renderModuleStatus($request); + $title = $module->getModuleName(); + + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb($title); + $crumbs->setBorder(true); + + $header = id(new PHUIHeaderView()) + ->setHeader($title) + ->setProfileHeader(true); + + $view = id(new PHUICMSView()) + ->setCrumbs($crumbs) + ->setNavigation($nav) + ->setHeader($header) + ->setContent($content); + + return $this->newPage() + ->setTitle($title) + ->addClass('phui-cms-body') + ->appendChild($view); + } + +} diff --git a/src/applications/guides/controller/PhabricatorGuideWelcomeController.php b/src/applications/guides/controller/PhabricatorGuideWelcomeController.php deleted file mode 100644 index e5453c8c76..0000000000 --- a/src/applications/guides/controller/PhabricatorGuideWelcomeController.php +++ /dev/null @@ -1,52 +0,0 @@ -getViewer(); - - $title = pht('Welcome to Phabricator'); - - $nav = $this->buildSideNavView(); - $nav->selectFilter('/'); - - $header = id(new PHUIHeaderView()) - ->setHeader($title) - ->setProfileHeader(true); - - $crumbs = $this->buildApplicationCrumbs() - ->addTextCrumb(pht('Welcome')); - - $content = id(new PHUIDocumentViewPro()) - ->appendChild($this->getGuideContent($viewer)); - - $view = id(new PHUICMSView()) - ->setCrumbs($crumbs) - ->setNavigation($nav) - ->setHeader($header) - ->setContent($content); - - return $this->newPage() - ->setTitle($title) - ->addClass('phui-cms-body') - ->appendChild($view); - - } - - private function getGuideContent($viewer) { - - $content = pht( - 'You have successfully installed Phabricator. These next guides will '. - 'take you through configuration and new user orientation. '. - 'These steps are optional, and you can go through them in any order. '. - 'If you want to get back to this guide later on, you can find it in '. - 'the **Config** application under **Welcome Guide**.'); - - return new PHUIRemarkupView($viewer, $content); - } -} diff --git a/src/applications/guides/controller/PhabricatorGuideInstallController.php b/src/applications/guides/module/PhabricatorGuideInstallModule.php similarity index 84% rename from src/applications/guides/controller/PhabricatorGuideInstallController.php rename to src/applications/guides/module/PhabricatorGuideInstallModule.php index f72cb51a67..819cbf363e 100644 --- a/src/applications/guides/controller/PhabricatorGuideInstallController.php +++ b/src/applications/guides/module/PhabricatorGuideInstallModule.php @@ -1,43 +1,22 @@ getViewer(); - $title = pht('Installation Guide'); - - $nav = $this->buildSideNavView(); - $nav->selectFilter('install/'); - - $header = id(new PHUIHeaderView()) - ->setHeader($title) - ->setProfileHeader(true); - - $crumbs = $this->buildApplicationCrumbs() - ->addTextCrumb(pht('Installation')); - - $content = $this->getGuideContent($viewer); - - $view = id(new PHUICMSView()) - ->setCrumbs($crumbs) - ->setNavigation($nav) - ->setHeader($header) - ->setContent($content); - - return $this->newPage() - ->setTitle($title) - ->addClass('phui-cms-body') - ->appendChild($view); - - } - - private function getGuideContent($viewer) { $guide_items = new PhabricatorGuideListView(); $title = pht('Resolve Setup Issues'); @@ -191,5 +170,7 @@ final class PhabricatorGuideInstallController $guide_items->addItem($item); return $guide_items; + } + } diff --git a/src/applications/guides/module/PhabricatorGuideModule.php b/src/applications/guides/module/PhabricatorGuideModule.php new file mode 100644 index 0000000000..5ae7b6bf16 --- /dev/null +++ b/src/applications/guides/module/PhabricatorGuideModule.php @@ -0,0 +1,18 @@ +setAncestorClass(__CLASS__) + ->setUniqueMethod('getModuleKey') + ->setSortMethod('getModulePosition') + ->execute(); + } + +} diff --git a/src/applications/guides/controller/PhabricatorGuideQuickStartController.php b/src/applications/guides/module/PhabricatorGuideQuickStartModule.php similarity index 84% rename from src/applications/guides/controller/PhabricatorGuideQuickStartController.php rename to src/applications/guides/module/PhabricatorGuideQuickStartModule.php index 128556b7ae..64ee4d8534 100644 --- a/src/applications/guides/controller/PhabricatorGuideQuickStartController.php +++ b/src/applications/guides/module/PhabricatorGuideQuickStartModule.php @@ -1,43 +1,22 @@ getViewer(); - $title = pht('Quick Start Guide'); - - $nav = $this->buildSideNavView(); - $nav->selectFilter('quickstart/'); - - $header = id(new PHUIHeaderView()) - ->setHeader($title) - ->setProfileHeader(true); - - $crumbs = $this->buildApplicationCrumbs() - ->addTextCrumb(pht('Quick Start')); - - $content = $this->getGuideContent($viewer); - - $view = id(new PHUICMSView()) - ->setCrumbs($crumbs) - ->setNavigation($nav) - ->setHeader($header) - ->setContent($content); - - return $this->newPage() - ->setTitle($title) - ->addClass('phui-cms-body') - ->appendChild($view); - - } - - private function getGuideContent($viewer) { $guide_items = new PhabricatorGuideListView(); $title = pht('Configure Applications'); @@ -205,5 +184,7 @@ final class PhabricatorGuideQuickStartController $guide_items->addItem($item); return $guide_items; + } + } diff --git a/src/applications/guides/module/PhabricatorGuideWelcomeModule.php b/src/applications/guides/module/PhabricatorGuideWelcomeModule.php new file mode 100644 index 0000000000..2b2bb80184 --- /dev/null +++ b/src/applications/guides/module/PhabricatorGuideWelcomeModule.php @@ -0,0 +1,34 @@ +getViewer(); + + $content = pht( + 'You have successfully installed Phabricator. These next guides will '. + 'take you through configuration and new user orientation. '. + 'These steps are optional, and you can go through them in any order. '. + 'If you want to get back to this guide later on, you can find it in '. + 'the **Config** application under **Welcome Guide**.'); + + $content = new PHUIRemarkupView($viewer, $content); + + return id(new PHUIDocumentViewPro()) + ->appendChild($content); + + } + +}