Page MenuHomePhabricator

D8416.diff
No OneTemporary

D8416.diff

Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -642,11 +642,11 @@
'DivinerFileAtomizer' => 'applications/diviner/atomizer/DivinerFileAtomizer.php',
'DivinerFindController' => 'applications/diviner/controller/DivinerFindController.php',
'DivinerGenerateWorkflow' => 'applications/diviner/workflow/DivinerGenerateWorkflow.php',
- 'DivinerLegacyController' => 'applications/diviner/controller/DivinerLegacyController.php',
'DivinerLiveAtom' => 'applications/diviner/storage/DivinerLiveAtom.php',
'DivinerLiveBook' => 'applications/diviner/storage/DivinerLiveBook.php',
'DivinerLivePublisher' => 'applications/diviner/publisher/DivinerLivePublisher.php',
'DivinerLiveSymbol' => 'applications/diviner/storage/DivinerLiveSymbol.php',
+ 'DivinerMainController' => 'applications/diviner/controller/DivinerMainController.php',
'DivinerPHIDTypeAtom' => 'applications/diviner/phid/DivinerPHIDTypeAtom.php',
'DivinerPHIDTypeBook' => 'applications/diviner/phid/DivinerPHIDTypeBook.php',
'DivinerPHPAtomizer' => 'applications/diviner/atomizer/DivinerPHPAtomizer.php',
@@ -3207,7 +3207,6 @@
'DivinerFileAtomizer' => 'DivinerAtomizer',
'DivinerFindController' => 'DivinerController',
'DivinerGenerateWorkflow' => 'DivinerWorkflow',
- 'DivinerLegacyController' => 'DivinerController',
'DivinerLiveAtom' => 'DivinerDAO',
'DivinerLiveBook' =>
array(
@@ -3221,6 +3220,7 @@
1 => 'PhabricatorPolicyInterface',
2 => 'PhabricatorMarkupInterface',
),
+ 'DivinerMainController' => 'DivinerController',
'DivinerPHIDTypeAtom' => 'PhabricatorPHIDType',
'DivinerPHIDTypeBook' => 'PhabricatorPHIDType',
'DivinerPHPAtomizer' => 'DivinerAtomizer',
Index: src/applications/diviner/application/PhabricatorApplicationDiviner.php
===================================================================
--- src/applications/diviner/application/PhabricatorApplicationDiviner.php
+++ src/applications/diviner/application/PhabricatorApplicationDiviner.php
@@ -21,11 +21,10 @@
public function getRoutes() {
return array(
'/diviner/' => array(
- '' => 'DivinerLegacyController',
+ '' => 'DivinerMainController',
'query/((?<key>[^/]+)/)?' => 'DivinerAtomListController',
'find/' => 'DivinerFindController',
),
- '/docs/(?P<keyword>[^/]+)/' => 'DivinerJumpController',
'/book/(?P<book>[^/]+)/' => 'DivinerBookController',
'/book/'.
'(?P<book>[^/]+)/'.
Index: src/applications/diviner/controller/DivinerLegacyController.php
===================================================================
--- src/applications/diviner/controller/DivinerLegacyController.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-final class DivinerLegacyController extends DivinerController {
-
- public function processRequest() {
-
- // TODO: Temporary implementation until Diviner is up and running inside
- // Phabricator.
-
- $links = array(
- 'http://www.phabricator.com/docs/phabricator/' => array(
- 'name' => 'Phabricator Ducks',
- 'flavor' => 'Oops, that should say "Docs".',
- ),
- 'http://www.phabricator.com/docs/arcanist/' => array(
- 'name' => 'Arcanist Docs',
- 'flavor' => 'Words have never been so finely crafted.',
- ),
- 'http://www.phabricator.com/docs/libphutil/' => array(
- 'name' => 'libphutil Docs',
- 'flavor' => 'Soothing prose; seductive poetry.',
- ),
- 'http://www.phabricator.com/docs/javelin/' => array(
- 'name' => 'Javelin Docs',
- 'flavor' => 'O, what noble scribe hath penned these words?',
- ),
- );
-
- $request = $this->getRequest();
- $viewer = $request->getUser();
-
- $list = id(new PHUIObjectItemListView())
- ->setUser($viewer)
- ->setPlain(true);
-
- foreach ($links as $href => $link) {
- $item = id(new PHUIObjectItemView())
- ->setHref($href)
- ->setHeader($link['name'])
- ->addAttribute($link['flavor']);
-
- $list->addItem($item);
- }
-
- $crumbs = $this->buildApplicationCrumbs();
- $crumbs->addTextCrumb(pht('Documentation'));
-
- $header = id(new PHUIHeaderView())
- ->setHeader(pht('Documentation'));
-
- $document = new PHUIDocumentView();
- $document->setHeader($header);
- $document->appendChild($list);
-
- return $this->buildApplicationPage(
- array(
- $crumbs,
- $document,
- ),
- array(
- 'title' => pht('Documentation'),
- 'device' => true,
- ));
- }
-}
Index: src/applications/diviner/controller/DivinerMainController.php
===================================================================
--- /dev/null
+++ src/applications/diviner/controller/DivinerMainController.php
@@ -0,0 +1,85 @@
+<?php
+
+final class DivinerMainController extends DivinerController {
+
+ public function processRequest() {
+ $request = $this->getRequest();
+ $viewer = $request->getUser();
+
+ $books = id(new DivinerBookQuery())
+ ->setViewer($viewer)
+ ->execute();
+
+ $crumbs = $this->buildApplicationCrumbs();
+ $crumbs->addTextCrumb(pht('Books'));
+
+ $search_icon = id(new PHUIIconView())
+ ->setSpriteIcon('search')
+ ->setSpriteSheet(PHUIIconView::SPRITE_ICONS);
+
+ $query_button = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setHref($this->getApplicationURI('query/'))
+ ->setText(pht('Advanced Search'))
+ ->setIcon($search_icon);
+
+ $header = id(new PHUIHeaderView())
+ ->setHeader(pht('Documentation Books'))
+ ->addActionLink($query_button);
+
+ $document = new PHUIDocumentView();
+ $document->setHeader($header);
+
+ if ($books) {
+ $list = id(new PHUIObjectItemListView())
+ ->setUser($viewer)
+ ->setPlain(true);
+
+ $books = msort($books, 'getTitle');
+ foreach ($books as $book) {
+ $item = id(new PHUIObjectItemView())
+ ->setHref('/book/'.$book->getName().'/')
+ ->setHeader($book->getTitle())
+ ->addAttribute($book->getPreface());
+
+ $list->addItem($item);
+ }
+
+ $document->appendChild($list);
+ } else {
+ $text = pht(
+ "(NOTE) **Looking for Phabricator documentation?** If you're looking ".
+ "for help and information about Phabricator, you can ".
+ "[[ https://secure.phabricator.com/diviner/ | browse the public ".
+ "Phabricator documentation ]] on the live site.\n\n".
+ "Diviner is the documentation generator used to build the Phabricator ".
+ "documentation.\n\n".
+ "You haven't generated any Diviner documentation books yet, so ".
+ "there's nothing to show here. If you'd like to generate your own ".
+ "local copy of the Phabricator documentation and have it appear ".
+ "here, run this command:\n\n".
+ " phabricator/ $ ./bin/diviner generate\n\n".
+ "Right now, Diviner isn't very useful for generating documentation ".
+ "for projects other than Phabricator. If you're interested in using ".
+ "it in your own projects, leave feedback for us on ".
+ "[[ https://secure.phabricator.com/T4558 | T4558 ]].");
+
+ $text = PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent($text),
+ 'default',
+ $viewer);
+
+ $document->appendChild($text);
+ }
+
+ return $this->buildApplicationPage(
+ array(
+ $crumbs,
+ $document,
+ ),
+ array(
+ 'title' => pht('Documentation Books'),
+ 'device' => true,
+ ));
+ }
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 5:09 PM (21 h, 18 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6756256
Default Alt Text
D8416.diff (7 KB)

Event Timeline