public function processRequest()
 {
     $classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->loadObjects();
     $classes = msort($classes, 'getName');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
     foreach ($classes as $class => $obj) {
         $name = $obj->getName();
         $nav->addFilter($class, $name);
     }
     $selected = $nav->selectFilter($this->class, head_key($classes));
     $example = $classes[$selected];
     $example->setRequest($this->getRequest());
     $result = $example->renderExample();
     if ($result instanceof AphrontResponse) {
         // This allows examples to generate dialogs, etc., for demonstration.
         return $result;
     }
     require_celerity_resource('phabricator-ui-example-css');
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($example->getName());
     $header = id(new PHUIHeaderView())->setHeader(pht('%s (%s)', $example->getName(), get_class($example)))->setSubheader($example->getDescription())->setNoBackground(true);
     $nav->appendChild(array($crumbs, $header, phutil_tag('br'), $result));
     return $this->buildApplicationPage($nav, array('title' => $example->getName()));
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $user = $this->getRequest()->getUser();
     $page = $this->buildStandardPageView();
     $page->setApplicationName('OAuth Server');
     $page->setBaseURI('/oauthserver/');
     $page->setTitle(idx($data, 'title'));
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/oauthserver/'));
     $nav->addLabel('Client Authorizations');
     $nav->addFilter('clientauthorization', 'My Authorizations');
     $nav->addSpacer();
     $nav->addLabel('Clients');
     $nav->addFilter('client/create', 'Create Client');
     foreach ($this->getExtraClientFilters() as $filter) {
         $nav->addFilter($filter['url'], $filter['label']);
     }
     $nav->addFilter('client', 'My Clients');
     $nav->selectFilter($this->getFilter(), 'clientauthorization');
     $nav->appendChild($view);
     $page->appendChild($nav);
     $doc_href = PhabricatorEnv::getDoclink('article/Using_the_Phabricator_OAuth_Server.html');
     $page->setTabs(array('help' => array('name' => 'Help', 'href' => $doc_href)), null);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 /**
  * @param PhutilURI $uri
  */
 public function buildSideNavView($viewer, $uri, $for_app = false)
 {
     $request = $this->getRequest();
     $id = $request->getURIData('id');
     $slug = $request->getURIData('slug');
     if ($slug) {
         $id = $this->getProjectIDfromSlug($slug, $viewer);
     }
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI($uri);
     if ($for_app) {
         if ($id) {
             $nav->addFilter("profile/{$id}/", pht('Profile'));
             $nav->addFilter("board/{$id}/", pht('Workboard'));
             $nav->addFilter("members/{$id}/", pht('Members'));
             $nav->addFilter("feed/{$id}/", pht('Feed'));
             $nav->addFilter("details/{$id}/", pht('Edit Details'));
         }
         $nav->addFilter('create', pht('Create Project'));
     }
     id(new PhabricatorProjectSearchEngine())->setViewer($viewer)->addNavigationItems($nav->getMenu());
     if ($viewer->isLoggedIn()) {
         $nav->addLabel(pht('Sprints'));
         $nav->addFilter('report/list', pht('Sprint List'));
     }
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Herald');
     $page->setBaseURI('/herald/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("☿");
     $doclink = PhabricatorEnv::getDoclink('article/Herald_User_Guide.html');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/herald/'))->addLabel('Rules')->addFilter('new', 'Create Rule');
     $rules_map = HeraldContentTypeConfig::getContentTypeMap();
     $first_filter = null;
     foreach ($rules_map as $key => $value) {
         $nav->addFilter('view/' . $key, $value);
         if (!$first_filter) {
             $first_filter = 'view/' . $key;
         }
     }
     $nav->addSpacer()->addLabel('Utilities')->addFilter('test', 'Test Console')->addFilter('transcript', 'Transcripts');
     $user = $this->getRequest()->getUser();
     if ($user->getIsAdmin()) {
         $nav->addSpacer()->addLabel('Admin');
         $view_PHID = nonempty($this->getRequest()->getStr('phid'), null);
         foreach ($rules_map as $key => $value) {
             $nav->addFilter('all/view/' . $key, $value);
         }
     }
     $nav->selectFilter($this->getFilter(), $first_filter);
     $nav->appendChild($view);
     $page->appendChild($nav);
     $tabs = array('help' => array('href' => $doclink, 'name' => 'Help'));
     $page->setTabs($tabs, null);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildNav()
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/'));
     $applications = id(new PhabricatorApplicationQuery())->setViewer($user)->withInstalled(true)->withUnlisted(false)->withLaunchable(true)->execute();
     $pinned = $user->loadPreferences()->getPinnedApplications($applications, $user);
     // Force "Applications" to appear at the bottom.
     $meta_app = 'PhabricatorApplicationsApplication';
     $pinned = array_fuse($pinned);
     unset($pinned[$meta_app]);
     $pinned[$meta_app] = $meta_app;
     $applications[$meta_app] = PhabricatorApplication::getByClass($meta_app);
     $tiles = array();
     $home_app = new PhabricatorHomeApplication();
     $tiles[] = id(new PhabricatorApplicationLaunchView())->setApplication($home_app)->setApplicationStatus($home_app->loadStatus($user))->addClass('phabricator-application-launch-phone-only')->setUser($user);
     foreach ($pinned as $pinned_application) {
         if (empty($applications[$pinned_application])) {
             continue;
         }
         $application = $applications[$pinned_application];
         $tile = id(new PhabricatorApplicationLaunchView())->setApplication($application)->setApplicationStatus($application->loadStatus($user))->setUser($user);
         $tiles[] = $tile;
     }
     $nav->addCustomBlock(phutil_tag('div', array('class' => 'application-tile-group'), $tiles));
     $nav->addFilter('', pht('Customize Applications...'), '/settings/panel/home/');
     $nav->addClass('phabricator-side-menu-home');
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Conduit');
     $page->setBaseURI('/conduit/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("⇵");
     if ($this->showSideNav()) {
         $nav = new AphrontSideNavFilterView();
         $nav->setBaseURI(new PhutilURI('/conduit/'));
         $method_filters = $this->getMethodFilters();
         foreach ($method_filters as $group => $methods) {
             $nav->addLabel($group);
             foreach ($methods as $method) {
                 $method_name = $method['full_name'];
                 $display_name = $method_name;
                 switch ($method['status']) {
                     case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
                         $display_name = '(' . $display_name . ')';
                         break;
                 }
                 $nav->addFilter('method/' . $method_name, $display_name);
             }
             $nav->addSpacer();
         }
         $nav->selectFilter($this->getFilter());
         $nav->appendChild($view);
         $body = $nav;
     } else {
         $body = $view;
     }
     $page->appendChild($body);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
Example #7
0
 private function renderSideNavFilterView($filter)
 {
     $base_uri = new PhutilURI('/phame/');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI($base_uri);
     $nav->addLabel('Drafts');
     $nav->addFilter('post/new', 'New Draft');
     $nav->addFilter('draft', 'My Drafts');
     foreach ($this->getSideNavExtraDraftFilters() as $draft_filter) {
         $nav->addFilter($draft_filter['key'], $draft_filter['name'], idx($draft_filter, 'uri'));
     }
     $nav->addSpacer();
     $nav->addLabel('Posts');
     $nav->addFilter('post', 'My Posts');
     $nav->addFilter('post/all', 'All Posts', $base_uri);
     foreach ($this->getSideNavExtraPostFilters() as $post_filter) {
         $nav->addFilter($post_filter['key'], $post_filter['name'], idx($post_filter, 'uri'));
     }
     $nav->addSpacer();
     $nav->addLabel('Blogs');
     foreach ($this->getSideNavBlogFilters() as $blog_filter) {
         $nav->addFilter($blog_filter['key'], $blog_filter['name'], idx($blog_filter, 'uri'));
     }
     $nav->selectFilter($filter);
     return $nav;
 }
 public function handleRequest(AphrontRequest $request)
 {
     $id = $request->getURIData('class');
     $classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->loadObjects();
     $classes = msort($classes, 'getName');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
     foreach ($classes as $class => $obj) {
         $name = $obj->getName();
         $nav->addFilter($class, $name);
     }
     $selected = $nav->selectFilter($id, head_key($classes));
     $example = $classes[$selected];
     $example->setRequest($this->getRequest());
     $result = $example->renderExample();
     if ($result instanceof AphrontResponse) {
         // This allows examples to generate dialogs, etc., for demonstration.
         return $result;
     }
     require_celerity_resource('phabricator-ui-example-css');
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($example->getName());
     $note = id(new PHUIInfoView())->setTitle(pht('%s (%s)', $example->getName(), get_class($example)))->appendChild($example->getDescription())->setSeverity(PHUIInfoView::SEVERITY_NODATA);
     $nav->appendChild(array($crumbs, $note, $result));
     return $this->buildApplicationPage($nav, array('title' => $example->getName()));
 }
 public function processRequest()
 {
     $classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->setConcreteOnly(true)->selectAndLoadSymbols();
     $classes = ipull($classes, 'name', 'name');
     foreach ($classes as $class => $ignored) {
         $classes[$class] = newv($class, array());
     }
     $classes = msort($classes, 'getName');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
     foreach ($classes as $class => $obj) {
         $name = $obj->getName();
         $nav->addFilter($class, $name);
     }
     $selected = $nav->selectFilter($this->class, head_key($classes));
     require_celerity_resource('phabricator-ui-example-css');
     $example = $classes[$selected];
     $example->setRequest($this->getRequest());
     $result = $example->renderExample();
     if ($result instanceof AphrontResponse) {
         // This allows examples to generate dialogs, etc., for demonstration.
         return $result;
     }
     $nav->appendChild('<div class="phabricator-ui-example-header">' . '<h1 class="phabricator-ui-example-name">' . phutil_escape_html($example->getName()) . ' (' . get_class($example) . ')' . '</h1>' . '<p class="phabricator-ui-example-description">' . $example->getDescription() . '</p>' . '</div>');
     $nav->appendChild($result);
     return $this->buildApplicationPage($nav, array('title' => 'UI Example', 'device' => true));
 }
 public function buildSideNavView()
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     id(new DrydockLogSearchEngine())->setViewer($this->getRequest()->getUser())->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }
 protected function buildSideNavView()
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     id(new PhabricatorFeedSearchEngine())->setViewer($user)->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildSideNavView()
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     $engine = id(new DrydockRepositoryOperationSearchEngine())->setViewer($this->getViewer());
     $engine->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildSideNavView($for_app = false)
 {
     $viewer = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     id(new PhabricatorSearchApplicationSearchEngine())->setViewer($viewer)->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildSideNavView()
 {
     $viewer = $this->getViewer();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     id(new PhortuneChargeSearchEngine())->setViewer($viewer)->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }
Example #15
0
 public function buildSideNavView()
 {
     $viewer = $this->getViewer();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     id(new HeraldRuleSearchEngine())->setViewer($viewer)->addNavigationItems($nav->getMenu());
     $nav->addLabel(pht('Utilities'))->addFilter('test', pht('Test Console'))->addFilter('transcript', pht('Transcripts'));
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildSideNavView()
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     id(new FundInitiativeSearchEngine())->setViewer($user)->addNavigationItems($nav->getMenu());
     $nav->addLabel(pht('Backers'));
     $nav->addFilter('backers/', pht('Find Backers'));
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildSideNavView()
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     id(new PhabricatorDashboardSearchEngine())->setViewer($user)->addNavigationItems($nav->getMenu());
     $nav->addLabel(pht('Panels'));
     $nav->addFilter('panel/', pht('Manage Panels'));
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildSideNavView()
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     // These are only used on mobile.
     $nav->addFilter('blueprint', pht('Blueprints'));
     $nav->addFilter('resource', pht('Resources'));
     $nav->addFilter('lease', pht('Leases'));
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildSideNavView($for_app = false)
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     id(new HarbormasterBuildableSearchEngine())->setViewer($user)->addNavigationItems($nav->getMenu());
     $nav->addLabel(pht('Build Plans'));
     $nav->addFilter('plan/', pht('Manage Build Plans'));
     $nav->selectFilter(null);
     return $nav;
 }
 protected function buildSideNavView()
 {
     $viewer = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     id(new PhabricatorConduitSearchEngine())->setViewer($viewer)->addNavigationItems($nav->getMenu());
     $nav->addLabel('Logs');
     $nav->addFilter('log', pht('Call Logs'));
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildSideNavView()
 {
     $viewer = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     id(new PhamePostSearchEngine())->setViewer($viewer)->addNavigationItems($nav->getMenu());
     $nav->addLabel(pht('Blogs'));
     $nav->addFilter('blog/', pht('Manage Blogs'));
     $nav->selectFilter(null);
     return $nav;
 }
Example #22
0
 protected final function buildSideNav($selected)
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/drydock/'));
     $nav->addFilter('resource', 'Resources');
     $nav->addFilter('lease', 'Leases');
     $nav->addSpacer();
     $nav->addFilter('log', 'Logs');
     $nav->selectFilter($selected, 'resource');
     return $nav;
 }
 public function buildSideNavView($for_app = false)
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     if ($for_app) {
         $nav->addFilter('', pht('Create Poll'), $this->getApplicationURI('create/'));
     }
     id(new PhabricatorSlowvoteSearchEngine())->setViewer($user)->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }
Example #24
0
 protected function buildSideNavView($for_app = false)
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     if ($for_app) {
         $nav->addFilter('question/create/', pht('Ask Question'));
     }
     id(new PonderQuestionSearchEngine())->setViewer($user)->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }
 private function buildRoomsSideNavView($for_app = false)
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     if ($for_app) {
         $nav->addFilter('room/new/', pht('Create Room'));
     }
     id(new ConpherenceThreadSearchEngine())->setViewer($user)->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildSideNavView($for_app = false)
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     if ($for_app) {
         $nav->addFilter('new', pht('Create Rule'));
     }
     id(new HeraldTranscriptSearchEngine())->setViewer($user)->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildSideNavView($for_app = false)
 {
     $viewer = $this->getViewer();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     if ($for_app) {
         $nav->addFilter('new/', pht('Create Package'));
     }
     id(new PhabricatorOwnersPackageSearchEngine())->setViewer($viewer)->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }
 public function buildSideNavView($for_app = false)
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     if ($for_app) {
         $nav->addFilter('create', pht('New Document'));
         $nav->addFilter('/phriction/', pht('Index'));
     }
     id(new PhrictionSearchEngine())->setViewer($user)->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }
 public function renderSideNav()
 {
     $package_views = array(array('name' => 'Owned', 'key' => 'view/owned'), array('name' => 'All', 'key' => 'view/all'));
     $package_views = array_merge($this->getExtraPackageViews(), $package_views);
     $base_uri = new PhutilURI('/owners/');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseUri($base_uri);
     $nav->addLabel('Packages');
     $nav->addFilters($package_views);
     $filter = $this->getSideNavFilter();
     $nav->selectFilter($filter, 'view/owned');
     return $nav;
 }
 public function buildSideNavView($for_app = false)
 {
     $viewer = $this->getRequest()->getUser();
     $product = $this->getProduct();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     if ($for_app) {
         $nav->addFilter('product/create/', pht('Create Product'));
     }
     id(new ReleephBranchSearchEngine())->setProduct($product)->setViewer($viewer)->addNavigationItems($nav->getMenu());
     $nav->selectFilter(null);
     return $nav;
 }