Beispiel #1
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;
 }
 protected function buildLocalNavigation(PhabricatorProject $project)
 {
     $id = $project->getID();
     $nav_view = new AphrontSideNavFilterView();
     $uri = new PhutilURI('/project/view/' . $id . '/');
     $nav_view->setBaseURI($uri);
     $external_arrow = "↗";
     $tasks_uri = '/maniphest/view/all/?projects=' . $project->getPHID();
     $slug = PhabricatorSlug::normalize($project->getName());
     $phriction_uri = '/w/projects/' . $slug;
     $edit_uri = '/project/edit/' . $id . '/';
     $members_uri = '/project/members/' . $id . '/';
     $nav_view->addFilter('dashboard', 'Dashboard');
     $nav_view->addSpacer();
     $nav_view->addFilter('feed', 'Feed');
     $nav_view->addFilter(null, 'Tasks ' . $external_arrow, $tasks_uri);
     $nav_view->addFilter(null, 'Wiki ' . $external_arrow, $phriction_uri);
     $nav_view->addFilter('people', 'People');
     $nav_view->addFilter('about', 'About');
     $user = $this->getRequest()->getUser();
     $can_edit = PhabricatorPolicyCapability::CAN_EDIT;
     $nav_view->addSpacer();
     if (PhabricatorPolicyFilter::hasCapability($user, $project, $can_edit)) {
         $nav_view->addFilter('edit', "Edit Project…", $edit_uri);
         $nav_view->addFilter('members', "Edit Members…", $members_uri);
     } else {
         $nav_view->addFilter('edit', "Edit Project…", $edit_uri, $relative = false, 'disabled');
         $nav_view->addFilter('members', "Edit Members…", $members_uri, $relative = false, 'disabled');
     }
     return $nav_view;
 }
 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 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());
 }
 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());
 }
 public function buildSideNavView(PhabricatorPaste $paste = null)
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI('filter/')));
     if ($paste) {
         $nav->addFilter('paste', 'P' . $paste->getID(), '/P' . $paste->getID());
         $nav->addSpacer();
     }
     $nav->addLabel('Create');
     $nav->addFilter('create', 'New Paste');
     $nav->addSpacer();
     $nav->addLabel('Pastes');
     $nav->addFilter('my', 'My Pastes');
     $nav->addFilter('all', 'All Pastes');
     return $nav;
 }
 private function renderSideNav($oauth_providers)
 {
     $sidenav = new AphrontSideNavFilterView();
     $sidenav->setBaseURI(new PhutilURI('/settings/page/'))->addLabel('Account Information')->addFilter('account', 'Account')->addFilter('profile', 'Profile')->addSpacer()->addLabel('Email')->addFilter('email', 'Email Address')->addFilter('emailpref', 'Email Preferences')->addSpacer()->addLabel('Authentication');
     if (PhabricatorEnv::getEnvConfig('account.editable') && PhabricatorEnv::getEnvConfig('auth.password-auth-enabled')) {
         $sidenav->addFilter('password', 'Password');
     }
     $sidenav->addFilter('conduit', 'Conduit Certificate');
     if (PhabricatorUserSSHKeysSettingsPanelController::isEnabled()) {
         $sidenav->addFilter('sshkeys', 'SSH Public Keys');
     }
     $sidenav->addSpacer();
     $sidenav->addLabel('Application Settings');
     $sidenav->addFilter('preferences', 'Display Preferences');
     $sidenav->addFilter('search', 'Search Preferences');
     $items = array();
     foreach ($oauth_providers as $provider) {
         if (!$provider->isProviderEnabled()) {
             continue;
         }
         $key = $provider->getProviderKey();
         $name = $provider->getProviderName();
         $items[$key] = $name . ' Account';
     }
     if ($items) {
         $sidenav->addSpacer();
         $sidenav->addLabel('Linked Accounts');
         foreach ($items as $key => $name) {
             $sidenav->addFilter($key, $name);
         }
     }
     return $sidenav;
 }
 protected function buildSideNavView(PonderQuestion $question = null)
 {
     $side_nav = new AphrontSideNavFilterView();
     $side_nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     if ($question && $question->getID()) {
         $side_nav->addFilter(null, 'Q' . $question->getID(), 'Q' . $question->getID());
         $side_nav->addSpacer();
     }
     $side_nav->addLabel('Create');
     $side_nav->addFilter('question/ask', 'Ask a Question');
     $side_nav->addSpacer();
     $side_nav->addLabel('Questions');
     $side_nav->addFilter('feed', 'All Questions');
     $side_nav->addSpacer();
     $side_nav->addLabel('User');
     $side_nav->addFilter('questions', 'Your Questions');
     $side_nav->addFilter('answers', 'Your Answers');
     return $side_nav;
 }
 public function buildSideNavView(PhabricatorPaste $paste = null)
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI('filter/')));
     if ($paste) {
         $nav->addFilter('paste', 'P' . $paste->getID(), '/P' . $paste->getID());
         $nav->addSpacer();
     }
     $nav->addLabel('Create');
     $nav->addFilter('edit', 'New Paste', $this->getApplicationURI(), $relative = false, $class = $user->isLoggedIn() ? null : 'disabled');
     $nav->addSpacer();
     $nav->addLabel('Pastes');
     if ($user->isLoggedIn()) {
         $nav->addFilter('my', 'My Pastes');
     }
     $nav->addFilter('all', 'All Pastes');
     return $nav;
 }
 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;
 }
 protected function buildSideNavView(PhabricatorFileImageMacro $macro = null)
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     $nav->addLabel('Create');
     $nav->addFilter('edit', 'Create Macro');
     $nav->addSpacer();
     $nav->addLabel('Macros');
     $nav->addFilter('', 'All Macros');
     return $nav;
 }
 public function buildNav()
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/'));
     $nav->addLabel('Phabricator');
     $nav->addFilter('home', 'Tactical Command', '/');
     $nav->addFilter('jump', 'Jump Nav');
     $nav->addFilter('feed', 'Feed');
     $nav->addSpacer();
     $nav->addLabel('Applications');
     $categories = $this->loadDirectoryCategories();
     foreach ($categories as $category) {
         $nav->addFilter('directory/' . $category->getID(), $category->getName());
     }
     if ($user->getIsAdmin()) {
         $nav->addSpacer();
         $nav->addFilter('directory/edit', 'Edit Applications...');
     }
     return $nav;
 }
 public function buildSideNavView()
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     $is_admin = $this->getRequest()->getUser()->getIsAdmin();
     if ($is_admin) {
         $nav->addLabel('Create Users');
         $nav->addFilter('edit', 'Create New User');
         if (PhabricatorEnv::getEnvConfig('ldap.auth-enabled') === true) {
             $nav->addFilter('ldap', 'Import from LDAP');
         }
         $nav->addSpacer();
     }
     $nav->addLabel('Directory');
     $nav->addFilter('people', 'User Directory', $this->getApplicationURI());
     if ($is_admin) {
         $nav->addSpacer();
         $nav->addLabel('Logs');
         $nav->addFilter('logs', 'Activity Logs');
     }
     return $nav;
 }
 protected function buildBaseSideNav()
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/maniphest/view/'));
     $request = $this->getRequest();
     $user = $request->getUser();
     $custom = id(new ManiphestSavedQuery())->loadAllWhere('userPHID = %s ORDER BY isDefault DESC, name ASC', $user->getPHID());
     if ($custom) {
         $nav->addLabel('Saved Queries');
         foreach ($custom as $query) {
             if ($query->getIsDefault()) {
                 $this->defaultQuery = $query;
             }
             $nav->addFilter('Q:' . $query->getQueryKey(), $query->getName(), '/maniphest/view/custom/?key=' . $query->getQueryKey());
         }
         $nav->addFilter('saved', 'Edit...', '/maniphest/custom/');
         $nav->addSpacer();
     }
     $nav->addLabel('User Tasks');
     $nav->addFilter('action', 'Assigned');
     $nav->addFilter('created', 'Created');
     $nav->addFilter('subscribed', 'Subscribed');
     $nav->addFilter('triage', 'Need Triage');
     $nav->addSpacer();
     $nav->addLabel('User Projects');
     $nav->addFilter('projecttriage', 'Need Triage');
     $nav->addFilter('projectall', 'All Tasks');
     $nav->addSpacer();
     $nav->addLabel('All Tasks');
     $nav->addFilter('alltriage', 'Need Triage');
     $nav->addFilter('all', 'All Tasks');
     $nav->addSpacer();
     $nav->addLabel('Custom');
     $nav->addFilter('custom', 'Custom Query');
     $nav->addSpacer();
     $nav->addLabel('Reports');
     $nav->addFilter('report', 'Reports', '/maniphest/report/');
     return $nav;
 }
 public function buildNav()
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/'));
     $nav->addLabel('Phabricator');
     $nav->addFilter('home', 'Tactical Command', '/');
     $nav->addFilter('jump', 'Jump Nav');
     $nav->addFilter('feed', 'Feed');
     $nav->addSpacer();
     $nav->addFilter('applications', 'More Stuff');
     return $nav;
 }
 protected function buildSideNavView()
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     $nav->addLabel('Daemons');
     $nav->addFilter('', 'Console', $this->getApplicationURI());
     $nav->addFilter('log/running', 'Running Daemons');
     $nav->addFilter('log', 'All Daemons');
     $nav->addFilter('log/combined', 'Combined Log');
     $nav->addSpacer();
     $nav->addLabel('Event Timeline');
     $nav->addFilter('timeline', 'Timeline');
     return $nav;
 }
 public function buildSideNavView()
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     $nav->addLabel('Mail Logs');
     $nav->addFilter('sent', 'Sent Mail', $this->getApplicationURI());
     $nav->addFilter('received', 'Received Mail');
     $nav->addSpacer();
     if ($this->getRequest()->getUser()->getIsAdmin()) {
         $nav->addLabel('Diagnostics');
         $nav->addFilter('send', 'Send Test');
         $nav->addFilter('receive', 'Receive Test');
     }
     return $nav;
 }
 private function renderSideNavFilterView($filter)
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/phame/'));
     $nav->addLabel('Drafts');
     $nav->addFilter('post/new', 'New Draft');
     $nav->addFilter('draft', 'My Drafts');
     $nav->addSpacer();
     $nav->addLabel('Posts');
     $nav->addFilter('post', 'My Posts');
     foreach ($this->getSideNavExtraPostFilters() as $post_filter) {
         $nav->addFilter($post_filter['key'], $post_filter['name']);
     }
     $nav->selectFilter($filter, 'post');
     return $nav;
 }
 private function renderSideNav(array $panels)
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI('/panel/')));
     $group = null;
     foreach ($panels as $panel) {
         if ($panel->getPanelGroup() != $group) {
             if ($group !== null) {
                 $nav->addSpacer();
             }
             $group = $panel->getPanelGroup();
             $nav->addLabel($group);
         }
         $nav->addFilter($panel->getPanelKey(), $panel->getPanelName());
     }
     return $nav;
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     if ($request->isFormPost()) {
         $uri = $request->getRequestURI();
         $project = head($request->getArr('set_project'));
         $project = nonempty($project, null);
         $uri = $uri->alter('project', $project);
         $window = $request->getStr('set_window');
         $uri = $uri->alter('window', $window);
         return id(new AphrontRedirectResponse())->setURI($uri);
     }
     $base_nav = $this->buildBaseSideNav();
     $base_nav->selectFilter('report', 'report');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/maniphest/report/'));
     $nav->addLabel('Open Tasks');
     $nav->addFilter('user', 'By User');
     $nav->addFilter('project', 'By Project');
     $nav->addSpacer();
     $nav->addLabel('Burnup');
     $nav->addFilter('burn', 'Burnup Rate');
     $this->view = $nav->selectFilter($this->view, 'user');
     require_celerity_resource('maniphest-report-css');
     switch ($this->view) {
         case 'burn':
             $core = $this->renderBurn();
             break;
         case 'user':
         case 'project':
             $core = $this->renderOpenTasks();
             break;
         default:
             return new Aphront404Response();
     }
     $nav->appendChild($core);
     $base_nav->appendChild($nav);
     return $this->buildStandardPageResponse($base_nav, array('title' => 'Maniphest Reports'));
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $doclink = PhabricatorEnv::getDoclink('article/Conduit_Technical_Documentation.html');
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Conduit');
     $page->setBaseURI('/conduit/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("⇵");
     $page->setTabs(array('help' => array('href' => $doclink, 'name' => 'Help')), null);
     if ($this->showSideNav()) {
         $nav = new AphrontSideNavFilterView();
         $nav->setBaseURI(new PhutilURI('/conduit/'));
         $first_filter = null;
         $method_filters = $this->getMethodFilters();
         foreach ($method_filters as $group => $methods) {
             $nav->addLabel($group);
             foreach ($methods as $method) {
                 $method_name = $method['full_name'];
                 $nav->addFilter('method/' . $method_name, $method_name);
                 if (!$first_filter) {
                     $first_filter = 'method/' . $method_name;
                 }
             }
             $nav->addSpacer();
         }
         $nav->addLabel('Utilities');
         $nav->addFilter('log', 'Logs');
         $nav->addFilter('token', 'Token');
         $nav->selectFilter($this->getFilter(), $first_filter);
         $nav->appendChild($view);
         $body = $nav;
     } else {
         $body = $view;
     }
     $page->appendChild($body);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 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);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $admin = $request->getUser();
     if ($this->id) {
         $user = id(new PhabricatorUser())->load($this->id);
         if (!$user) {
             return new Aphront404Response();
         }
         $base_uri = '/people/edit/' . $user->getID() . '/';
     } else {
         $user = new PhabricatorUser();
         $base_uri = '/people/edit/';
     }
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($base_uri));
     $nav->addLabel('User Information');
     $nav->addFilter('basic', 'Basic Information');
     $nav->addFilter('role', 'Edit Roles');
     $nav->addFilter('cert', 'Conduit Certificate');
     $nav->addFilter('profile', 'View Profile', '/p/' . $user->getUsername() . '/');
     $nav->addSpacer();
     $nav->addLabel('Special');
     $nav->addFilter('rename', 'Change Username');
     $nav->addFilter('delete', 'Delete User');
     if (!$user->getID()) {
         $this->view = 'basic';
     }
     $view = $nav->selectFilter($this->view, 'basic');
     $content = array();
     if ($request->getStr('saved')) {
         $notice = new AphrontErrorView();
         $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
         $notice->setTitle('Changes Saved');
         $notice->appendChild('<p>Your changes were saved.</p>');
         $content[] = $notice;
     }
     switch ($view) {
         case 'basic':
             $response = $this->processBasicRequest($user);
             break;
         case 'role':
             $response = $this->processRoleRequest($user);
             break;
         case 'cert':
             $response = $this->processCertificateRequest($user);
             break;
         case 'rename':
             $response = $this->processRenameRequest($user);
             break;
         case 'delete':
             $response = $this->processDeleteRequest($user);
             break;
         default:
             return new Aphront404Response();
     }
     if ($response instanceof AphrontResponse) {
         return $response;
     }
     $content[] = $response;
     if ($user->getID()) {
         $nav->appendChild($content);
     } else {
         $nav = $this->buildSideNavView();
         $nav->selectFilter('edit');
         $nav->appendChild($content);
     }
     return $this->buildApplicationPage($nav, array('title' => 'Edit User'));
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     if ($request->isFormPost()) {
         // Redirect to GET so URIs can be copy/pasted.
         $user_phids = $request->getArr('set_users');
         $proj_phids = $request->getArr('set_projects');
         $task_ids = $request->getStr('set_tasks');
         $user_phids = implode(',', $user_phids);
         $proj_phids = implode(',', $proj_phids);
         $user_phids = nonempty($user_phids, null);
         $proj_phids = nonempty($proj_phids, null);
         $task_ids = nonempty($task_ids, null);
         $uri = $request->getRequestURI()->alter('users', $user_phids)->alter('projects', $proj_phids)->alter('tasks', $task_ids);
         return id(new AphrontRedirectResponse())->setURI($uri);
     }
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/maniphest/view/'));
     $nav->addLabel('User Tasks');
     $nav->addFilter('action', 'Assigned');
     $nav->addFilter('created', 'Created');
     $nav->addFilter('subscribed', 'Subscribed');
     $nav->addFilter('triage', 'Need Triage');
     $nav->addSpacer();
     $nav->addLabel('All Tasks');
     $nav->addFilter('alltriage', 'Need Triage');
     $nav->addFilter('all', 'All Tasks');
     $nav->addSpacer();
     $nav->addFilter('custom', 'Custom');
     $this->view = $nav->selectFilter($this->view, 'action');
     $has_filter = array('action' => true, 'created' => true, 'subscribed' => true, 'triage' => true);
     list($status_map, $status_links) = $this->renderStatusLinks();
     list($grouping, $group_links) = $this->renderGroupLinks();
     list($order, $order_links) = $this->renderOrderLinks();
     $user_phids = $request->getStr('users');
     if (strlen($user_phids)) {
         $user_phids = explode(',', $user_phids);
     } else {
         $user_phids = array($user->getPHID());
     }
     $project_phids = $request->getStr('projects');
     if (strlen($project_phids)) {
         $project_phids = explode(',', $project_phids);
     } else {
         $project_phids = array();
     }
     $task_ids = $request->getStrList('tasks');
     $page = $request->getInt('page');
     $page_size = self::DEFAULT_PAGE_SIZE;
     list($tasks, $handles, $total_count) = $this->loadTasks($user_phids, $project_phids, $task_ids, array('status' => $status_map, 'group' => $grouping, 'order' => $order, 'offset' => $page, 'limit' => $page_size));
     $form = id(new AphrontFormView())->setUser($user)->setAction($request->getRequestURI());
     if (isset($has_filter[$this->view])) {
         $tokens = array();
         foreach ($user_phids as $phid) {
             $tokens[$phid] = $handles[$phid]->getFullName();
         }
         $form->appendChild(id(new AphrontFormTokenizerControl())->setDatasource('/typeahead/common/searchowner/')->setName('set_users')->setLabel('Users')->setValue($tokens));
     }
     if ($this->view == 'custom') {
         $form->appendChild(id(new AphrontFormTextControl())->setName('set_tasks')->setLabel('Task IDs')->setValue(join(',', $task_ids)));
     }
     $tokens = array();
     foreach ($project_phids as $phid) {
         $tokens[$phid] = $handles[$phid]->getFullName();
     }
     $form->appendChild(id(new AphrontFormTokenizerControl())->setDatasource('/typeahead/common/projects/')->setName('set_projects')->setLabel('Projects')->setValue($tokens));
     $form->appendChild(id(new AphrontFormToggleButtonsControl())->setLabel('Status')->setValue($status_links))->appendChild(id(new AphrontFormToggleButtonsControl())->setLabel('Group')->setValue($group_links))->appendChild(id(new AphrontFormToggleButtonsControl())->setLabel('Order')->setValue($order_links));
     $form->appendChild(id(new AphrontFormSubmitControl())->setValue('Filter Tasks'));
     $create_uri = new PhutilURI('/maniphest/task/create/');
     if ($project_phids) {
         // If we have project filters selected, use them as defaults for task
         // creation.
         $create_uri->setQueryParam('projects', implode(';', $project_phids));
     }
     $filter = new AphrontListFilterView();
     $filter->addButton(phutil_render_tag('a', array('href' => (string) $create_uri, 'class' => 'green button'), 'Create New Task'));
     $filter->appendChild($form);
     $nav->appendChild($filter);
     $have_tasks = false;
     foreach ($tasks as $group => $list) {
         if (count($list)) {
             $have_tasks = true;
             break;
         }
     }
     require_celerity_resource('maniphest-task-summary-css');
     if (!$have_tasks) {
         $nav->appendChild('<h1 class="maniphest-task-group-header">' . 'No matching tasks.' . '</h1>');
     } else {
         $pager = new AphrontPagerView();
         $pager->setURI($request->getRequestURI(), 'page');
         $pager->setPageSize($page_size);
         $pager->setOffset($page);
         $pager->setCount($total_count);
         $cur = $pager->getOffset() + 1;
         $max = min($pager->getOffset() + $page_size, $total_count);
         $tot = $total_count;
         $cur = number_format($cur);
         $max = number_format($max);
         $tot = number_format($tot);
         $nav->appendChild('<div class="maniphest-total-result-count">' . "Displaying tasks {$cur} - {$max} of {$tot}." . '</div>');
         foreach ($tasks as $group => $list) {
             $task_list = new ManiphestTaskListView();
             $task_list->setUser($user);
             $task_list->setTasks($list);
             $task_list->setHandles($handles);
             $count = number_format(count($list));
             $nav->appendChild('<h1 class="maniphest-task-group-header">' . phutil_escape_html($group) . ' (' . $count . ')' . '</h1>');
             $nav->appendChild($task_list);
         }
         $nav->appendChild($pager);
     }
     return $this->buildStandardPageResponse($nav, array('title' => 'Task List'));
 }
 public function processRequest()
 {
     $viewer = $this->getRequest()->getUser();
     $user = id(new PhabricatorUser())->loadOneWhere('userName = %s', $this->username);
     if (!$user) {
         return new Aphront404Response();
     }
     require_celerity_resource('phabricator-profile-css');
     $profile = id(new PhabricatorUserProfile())->loadOneWhere('userPHID = %s', $user->getPHID());
     if (!$profile) {
         $profile = new PhabricatorUserProfile();
     }
     $username = phutil_escape_uri($user->getUserName());
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/p/' . $username . '/'));
     $nav->addFilter('feed', 'Feed');
     $nav->addFilter('about', 'About');
     $nav->addSpacer();
     $nav->addLabel('Activity');
     $external_arrow = "↗";
     $nav->addFilter(null, "Revisions {$external_arrow}", '/differential/filter/revisions/' . $username . '/');
     $nav->addFilter(null, "Tasks {$external_arrow}", '/maniphest/view/action/?users=' . $user->getPHID());
     $nav->addFilter(null, "Commits {$external_arrow}", '/audit/view/author/' . $username . '/');
     $oauths = id(new PhabricatorUserOAuthInfo())->loadAllWhere('userID = %d', $user->getID());
     $oauths = mpull($oauths, null, 'getOAuthProvider');
     $providers = PhabricatorOAuthProvider::getAllProviders();
     $added_spacer = false;
     foreach ($providers as $provider) {
         if (!$provider->isProviderEnabled()) {
             continue;
         }
         $provider_key = $provider->getProviderKey();
         if (!isset($oauths[$provider_key])) {
             continue;
         }
         $name = $provider->getProviderName() . ' Profile';
         $href = $oauths[$provider_key]->getAccountURI();
         if ($href) {
             if (!$added_spacer) {
                 $nav->addSpacer();
                 $nav->addLabel('Linked Accounts');
                 $added_spacer = true;
             }
             $nav->addFilter(null, $name . ' ' . $external_arrow, $href);
         }
     }
     $this->page = $nav->selectFilter($this->page, 'feed');
     switch ($this->page) {
         case 'feed':
             $content = $this->renderUserFeed($user);
             break;
         case 'about':
             $content = $this->renderBasicInformation($user, $profile);
             break;
         default:
             throw new Exception("Unknown page '{$this->page}'!");
     }
     $picture = $user->loadProfileImageURI();
     $header = new PhabricatorProfileHeaderView();
     $header->setProfilePicture($picture)->setName($user->getUserName() . ' (' . $user->getRealName() . ')')->setDescription($profile->getTitle());
     if ($user->getIsDisabled()) {
         $header->setStatus('Disabled');
     } else {
         $statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses(array($user->getPHID()));
         if ($statuses) {
             $header->setStatus(reset($statuses)->getStatusDescription($viewer));
         }
     }
     $header->appendChild($nav);
     $nav->appendChild('<div style="padding: 1em;">' . $content . '</div>');
     if ($user->getPHID() == $viewer->getPHID()) {
         $nav->addSpacer();
         $nav->addFilter(null, 'Edit Profile...', '/settings/page/profile/');
     }
     if ($viewer->getIsAdmin()) {
         $nav->addSpacer();
         $nav->addFilter(null, 'Administrate User...', '/people/edit/' . $user->getID() . '/');
     }
     return $this->buildStandardPageResponse($header, array('title' => $user->getUsername()));
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $project = id(new PhabricatorProject())->load($this->id);
     if (!$project) {
         return new Aphront404Response();
     }
     $profile = $project->loadProfile();
     if (!$profile) {
         $profile = new PhabricatorProjectProfile();
     }
     $src_phid = $profile->getProfileImagePHID();
     if (!$src_phid) {
         $src_phid = $user->getProfileImagePHID();
     }
     $picture = PhabricatorFileURI::getViewURIForPHID($src_phid);
     $nav_view = new AphrontSideNavFilterView();
     $uri = new PhutilURI('/project/view/' . $project->getID() . '/');
     $nav_view->setBaseURI($uri);
     $external_arrow = "↗";
     $tasks_uri = '/maniphest/view/all/?projects=' . $project->getPHID();
     $slug = PhrictionDocument::normalizeSlug($project->getName());
     $phriction_uri = '/w/projects/' . $slug . '/';
     $edit_uri = '/project/edit/' . $project->getID() . '/';
     $nav_view->addFilter('dashboard', 'Dashboard');
     $nav_view->addSpacer();
     $nav_view->addFilter('feed', 'Feed');
     $nav_view->addFilter(null, 'Tasks ' . $external_arrow, $tasks_uri);
     $nav_view->addFilter(null, 'Wiki ' . $external_arrow, $phriction_uri);
     $nav_view->addFilter('people', 'People');
     $nav_view->addFilter('about', 'About');
     $nav_view->addSpacer();
     $nav_view->addFilter(null, "Edit Project…", $edit_uri);
     $this->page = $nav_view->selectFilter($this->page, 'dashboard');
     require_celerity_resource('phabricator-profile-css');
     switch ($this->page) {
         case 'dashboard':
             $content = $this->renderTasksPage($project, $profile);
             $query = new PhabricatorFeedQuery();
             $query->setFilterPHIDs(array($project->getPHID()));
             $stories = $query->execute();
             $content .= $this->renderStories($stories);
             break;
         case 'about':
             $content = $this->renderAboutPage($project, $profile);
             break;
         case 'people':
             $content = $this->renderPeoplePage($project, $profile);
             break;
         case 'feed':
             $content = $this->renderFeedPage($project, $profile);
             break;
         default:
             throw new Exception("Unimplemented filter '{$this->page}'.");
     }
     $content = '<div style="padding: 1em;">' . $content . '</div>';
     $nav_view->appendChild($content);
     $header = new PhabricatorProfileHeaderView();
     $header->setName($project->getName());
     $header->setDescription(phutil_utf8_shorten($profile->getBlurb(), 1024));
     $header->setProfilePicture($picture);
     $header->appendChild($nav_view);
     return $this->buildStandardPageResponse($header, array('title' => $project->getName() . ' Project'));
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $project = id(new PhabricatorProject())->load($this->id);
     if (!$project) {
         return new Aphront404Response();
     }
     $profile = $project->loadProfile();
     if (!$profile) {
         $profile = new PhabricatorProjectProfile();
     }
     $src_phid = $profile->getProfileImagePHID();
     if (!$src_phid) {
         $src_phid = $user->getProfileImagePHID();
     }
     $file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $src_phid);
     if ($file) {
         $picture = $file->getBestURI();
     } else {
         $picture = null;
     }
     $members = mpull($project->loadAffiliations(), null, 'getUserPHID');
     $nav_view = new AphrontSideNavFilterView();
     $uri = new PhutilURI('/project/view/' . $project->getID() . '/');
     $nav_view->setBaseURI($uri);
     $external_arrow = "↗";
     $tasks_uri = '/maniphest/view/all/?projects=' . $project->getPHID();
     $slug = PhabricatorSlug::normalize($project->getName());
     $phriction_uri = '/w/projects/' . $slug;
     $edit_uri = '/project/edit/' . $project->getID() . '/';
     $nav_view->addFilter('dashboard', 'Dashboard');
     $nav_view->addSpacer();
     $nav_view->addFilter('feed', 'Feed');
     $nav_view->addFilter(null, 'Tasks ' . $external_arrow, $tasks_uri);
     $nav_view->addFilter(null, 'Wiki ' . $external_arrow, $phriction_uri);
     $nav_view->addFilter('people', 'People');
     $nav_view->addFilter('about', 'About');
     $nav_view->addSpacer();
     $nav_view->addFilter(null, "Edit Project…", $edit_uri);
     $this->page = $nav_view->selectFilter($this->page, 'dashboard');
     require_celerity_resource('phabricator-profile-css');
     switch ($this->page) {
         case 'dashboard':
             $content = $this->renderTasksPage($project, $profile);
             $query = new PhabricatorFeedQuery();
             $query->setFilterPHIDs(array($project->getPHID()));
             $stories = $query->execute();
             $content .= $this->renderStories($stories);
             break;
         case 'about':
             $content = $this->renderAboutPage($project, $profile);
             break;
         case 'people':
             $content = $this->renderPeoplePage($project, $profile);
             break;
         case 'feed':
             $content = $this->renderFeedPage($project, $profile);
             break;
         default:
             throw new Exception("Unimplemented filter '{$this->page}'.");
     }
     $content = '<div style="padding: 1em;">' . $content . '</div>';
     $nav_view->appendChild($content);
     $header = new PhabricatorProfileHeaderView();
     $header->setName($project->getName());
     $header->setDescription(phutil_utf8_shorten($profile->getBlurb(), 1024));
     $header->setProfilePicture($picture);
     $action = null;
     if (empty($members[$user->getPHID()])) {
         $action = phabricator_render_form($user, array('action' => '/project/update/' . $project->getID() . '/join/', 'method' => 'post'), phutil_render_tag('button', array('class' => 'green'), 'Join Project'));
     } else {
         $action = javelin_render_tag('a', array('href' => '/project/update/' . $project->getID() . '/leave/', 'sigil' => 'workflow', 'class' => 'grey button'), 'Leave Project...');
     }
     $header->addAction($action);
     $header->appendChild($nav_view);
     return $this->buildStandardPageResponse($header, array('title' => $project->getName() . ' Project'));
 }