Page MenuHomePhabricator

D16478.id39647.diff
No OneTemporary

D16478.id39647.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2639,11 +2639,13 @@
'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 @@
'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
--- a/src/applications/guides/application/PhabricatorGuideApplication.php
+++ b/src/applications/guides/application/PhabricatorGuideApplication.php
@@ -29,11 +29,8 @@
public function getRoutes() {
return array(
'/guides/' => array(
- '' => 'PhabricatorGuideWelcomeController',
- 'install/'
- => 'PhabricatorGuideInstallController',
- 'quickstart/'
- => 'PhabricatorGuideQuickStartController',
+ '' => 'PhabricatorGuideModuleController',
+ '(?P<module>[^/]+)/' => 'PhabricatorGuideModuleController',
),
);
}
diff --git a/src/applications/guides/controller/PhabricatorGuideController.php b/src/applications/guides/controller/PhabricatorGuideController.php
--- a/src/applications/guides/controller/PhabricatorGuideController.php
+++ b/src/applications/guides/controller/PhabricatorGuideController.php
@@ -7,9 +7,11 @@
$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
--- /dev/null
+++ b/src/applications/guides/controller/PhabricatorGuideModuleController.php
@@ -0,0 +1,42 @@
+<?php
+
+final class PhabricatorGuideModuleController
+ extends PhabricatorGuideController {
+
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->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
--- a/src/applications/guides/controller/PhabricatorGuideWelcomeController.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-final class PhabricatorGuideWelcomeController
- extends PhabricatorGuideController {
-
- public function shouldAllowPublic() {
- return false;
- }
-
- public function handleRequest(AphrontRequest $request) {
- $viewer = $request->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
rename from src/applications/guides/controller/PhabricatorGuideInstallController.php
rename to src/applications/guides/module/PhabricatorGuideInstallModule.php
--- a/src/applications/guides/controller/PhabricatorGuideInstallController.php
+++ b/src/applications/guides/module/PhabricatorGuideInstallModule.php
@@ -1,43 +1,22 @@
<?php
-final class PhabricatorGuideInstallController
- extends PhabricatorGuideController {
+final class PhabricatorGuideInstallModule extends PhabricatorGuideModule {
- public function shouldAllowPublic() {
- return false;
+ public function getModuleKey() {
+ return 'install';
}
- public function handleRequest(AphrontRequest $request) {
- $viewer = $request->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);
+ public function getModuleName() {
+ return pht('Install Phabricator');
+ }
+ public function getModulePosition() {
+ return 20;
}
- private function getGuideContent($viewer) {
+ public function renderModuleStatus(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+
$guide_items = new PhabricatorGuideListView();
$title = pht('Resolve Setup Issues');
@@ -191,5 +170,7 @@
$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
--- /dev/null
+++ b/src/applications/guides/module/PhabricatorGuideModule.php
@@ -0,0 +1,18 @@
+<?php
+
+abstract class PhabricatorGuideModule extends Phobject {
+
+ abstract public function getModuleKey();
+ abstract public function getModuleName();
+ abstract public function getModulePosition();
+ abstract public function renderModuleStatus(AphrontRequest $request);
+
+ final public static function getAllModules() {
+ return id(new PhutilClassMapQuery())
+ ->setAncestorClass(__CLASS__)
+ ->setUniqueMethod('getModuleKey')
+ ->setSortMethod('getModulePosition')
+ ->execute();
+ }
+
+}
diff --git a/src/applications/guides/controller/PhabricatorGuideQuickStartController.php b/src/applications/guides/module/PhabricatorGuideQuickStartModule.php
rename from src/applications/guides/controller/PhabricatorGuideQuickStartController.php
rename to src/applications/guides/module/PhabricatorGuideQuickStartModule.php
--- a/src/applications/guides/controller/PhabricatorGuideQuickStartController.php
+++ b/src/applications/guides/module/PhabricatorGuideQuickStartModule.php
@@ -1,43 +1,22 @@
<?php
-final class PhabricatorGuideQuickStartController
- extends PhabricatorGuideController {
+final class PhabricatorGuideQuickStartModule extends PhabricatorGuideModule {
- public function shouldAllowPublic() {
- return false;
+ public function getModuleKey() {
+ return 'quickstart';
}
- public function handleRequest(AphrontRequest $request) {
- $viewer = $request->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);
+ public function getModuleName() {
+ return pht('Quick Start');
+ }
+ public function getModulePosition() {
+ return 30;
}
- private function getGuideContent($viewer) {
+ public function renderModuleStatus(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+
$guide_items = new PhabricatorGuideListView();
$title = pht('Configure Applications');
@@ -205,5 +184,7 @@
$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
--- /dev/null
+++ b/src/applications/guides/module/PhabricatorGuideWelcomeModule.php
@@ -0,0 +1,34 @@
+<?php
+
+final class PhabricatorGuideWelcomeModule extends PhabricatorGuideModule {
+
+ public function getModuleKey() {
+ return 'welcome';
+ }
+
+ public function getModuleName() {
+ return pht('Welcome');
+ }
+
+ public function getModulePosition() {
+ return 10;
+ }
+
+ public function renderModuleStatus(AphrontRequest $request) {
+ $viewer = $request->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);
+
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 12, 7:37 PM (5 d, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6750947
Default Alt Text
D16478.id39647.diff (13 KB)

Event Timeline