diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 61a4b03257..ddb4302f8a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -706,9 +706,6 @@ phutil_register_library_map(array( 'ManiphestReplyHandler' => 'applications/maniphest/mail/ManiphestReplyHandler.php', 'ManiphestReportController' => 'applications/maniphest/controller/ManiphestReportController.php', 'ManiphestSavedQuery' => 'applications/maniphest/storage/ManiphestSavedQuery.php', - 'ManiphestSavedQueryDeleteController' => 'applications/maniphest/controller/ManiphestSavedQueryDeleteController.php', - 'ManiphestSavedQueryEditController' => 'applications/maniphest/controller/ManiphestSavedQueryEditController.php', - 'ManiphestSavedQueryListController' => 'applications/maniphest/controller/ManiphestSavedQueryListController.php', 'ManiphestSearchIndexer' => 'applications/maniphest/search/ManiphestSearchIndexer.php', 'ManiphestSubpriorityController' => 'applications/maniphest/controller/ManiphestSubpriorityController.php', 'ManiphestSubscribeController' => 'applications/maniphest/controller/ManiphestSubscribeController.php', @@ -2771,9 +2768,6 @@ phutil_register_library_map(array( 'ManiphestReplyHandler' => 'PhabricatorMailReplyHandler', 'ManiphestReportController' => 'ManiphestController', 'ManiphestSavedQuery' => 'ManiphestDAO', - 'ManiphestSavedQueryDeleteController' => 'ManiphestController', - 'ManiphestSavedQueryEditController' => 'ManiphestController', - 'ManiphestSavedQueryListController' => 'ManiphestController', 'ManiphestSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'ManiphestSubpriorityController' => 'ManiphestController', 'ManiphestSubscribeController' => 'ManiphestController', diff --git a/src/applications/maniphest/application/PhabricatorApplicationManiphest.php b/src/applications/maniphest/application/PhabricatorApplicationManiphest.php index 556f681a20..aad050b2cb 100644 --- a/src/applications/maniphest/application/PhabricatorApplicationManiphest.php +++ b/src/applications/maniphest/application/PhabricatorApplicationManiphest.php @@ -68,11 +68,6 @@ final class PhabricatorApplicationManiphest extends PhabricatorApplication { ), 'export/(?P[^/]+)/' => 'ManiphestExportController', 'subpriority/' => 'ManiphestSubpriorityController', - 'custom/' => array( - '' => 'ManiphestSavedQueryListController', - 'edit/(?:(?P[1-9]\d*)/)?' => 'ManiphestSavedQueryEditController', - 'delete/(?P[1-9]\d*)/' => 'ManiphestSavedQueryDeleteController', - ), 'subscribe/(?Padd|rem)/(?P[1-9]\d*)/' => 'ManiphestSubscribeController', ), diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php index 27a38fccf5..a5df572be2 100644 --- a/src/applications/maniphest/controller/ManiphestBatchEditController.php +++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php @@ -36,10 +36,6 @@ final class ManiphestBatchEditController extends ManiphestController { ->setURI('/maniphest/query/?ids='.$task_ids); } - $panel = new AphrontPanelView(); - $panel->setHeader(pht('Maniphest Batch Editor')); - $panel->setNoBackground(); - $handle_phids = mpull($tasks, 'getOwnerPHID'); $handles = $this->loadViewerHandles($handle_phids); @@ -125,15 +121,26 @@ final class ManiphestBatchEditController extends ManiphestController { ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Update Tasks')) - ->addCancelButton('/maniphest/', 'Done')); + ->addCancelButton('/maniphest/')); - $panel->appendChild($form); + $title = pht('Batch Editor'); + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addCrumb( + id(new PhabricatorCrumbView()) + ->setName($title)); - return $this->buildStandardPageResponse( - $panel, + $form_box = id(new PHUIFormBoxView()) + ->setHeaderText(pht('Batch Edit Tasks')) + ->setForm($form); + + return $this->buildApplicationPage( array( - 'title' => pht('Batch Editor'), + $crumbs, + $form_box, + ), + array( + 'title' => $title, )); } diff --git a/src/applications/maniphest/controller/ManiphestController.php b/src/applications/maniphest/controller/ManiphestController.php index 5cbfd24615..aba532bae0 100644 --- a/src/applications/maniphest/controller/ManiphestController.php +++ b/src/applications/maniphest/controller/ManiphestController.php @@ -1,87 +1,43 @@ buildStandardPageView(); - - $page->setApplicationName(pht('Maniphest')); - $page->setBaseURI('/maniphest/'); - $page->setTitle(idx($data, 'title')); - $page->setGlyph("\xE2\x9A\x93"); - $page->appendPageObjects(idx($data, 'pageObjects', array())); - $page->appendChild($view); - $page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_OPEN_TASKS); - - $response = new AphrontWebpageResponse(); - return $response->setContent($page->render()); + public function buildApplicationMenu() { + return $this->buildSideNavView(true)->getMenu(); } - protected function buildBaseSideNav($filter = null, $for_app = false) { + public function buildSideNavView($for_app = false) { + $user = $this->getRequest()->getUser(); + $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()); - - // TODO: Enforce uniqueness. Currently, it's possible to save the same - // query under multiple names, and then SideNavFilterView explodes on - // duplicate keys. Generally, we should clean up the custom/saved query - // code as it's a bit of a mess. - $custom = mpull($custom, null, 'getQueryKey'); - - 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', pht('Edit...'), '/maniphest/custom/'); - } + $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); if ($for_app) { - $nav->addFilter('', pht('Create Task'), - $this->getApplicationURI('task/create/')); + $nav->addFilter('create', pht('Create Task')); } - $nav->addLabel(pht('User Tasks')); - $nav->addFilter('action', pht('Assigned')); - $nav->addFilter('created', pht('Created')); - $nav->addFilter('subscribed', pht('Subscribed')); - $nav->addFilter('triage', pht('Need Triage')); - $nav->addLabel(pht('User Projects')); - $nav->addFilter('projecttriage', pht('Need Triage')); - $nav->addFilter('projectall', pht('All Tasks')); - $nav->addLabel('All Tasks'); - $nav->addFilter('alltriage', pht('Need Triage')); - $nav->addFilter('all', pht('All Tasks')); - $nav->addLabel(pht('Custom')); - $nav->addFilter('custom', pht('Custom Query')); - $nav->addFilter('report', pht('Reports'), '/maniphest/report/'); + id(new ManiphestTaskSearchEngine()) + ->setViewer($user) + ->addNavigationItems($nav->getMenu()); + + $nav->addLabel(pht('Reports')); + $nav->addFilter('reports', pht('Reports'), 'report/'); + + $nav->selectFilter(null); return $nav; } - public function buildApplicationMenu() { - return $this->buildBaseSideNav(null, true)->getMenu(); - } + protected function buildApplicationCrumbs() { + $crumbs = parent::buildApplicationCrumbs(); - protected function getDefaultQuery() { - return $this->defaultQuery; + $crumbs->addAction( + id(new PHUIListItemView()) + ->setName(pht('Create Task')) + ->setHref($this->getApplicationURI('task/create/')) + ->setIcon('create')); + + return $crumbs; } protected function renderSingleTask(ManiphestTask $task) { diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index c76653f288..97b2b7ad25 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -28,10 +28,6 @@ final class ManiphestReportController extends ManiphestController { 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(pht('Open Tasks')); @@ -63,7 +59,7 @@ final class ManiphestReportController extends ManiphestController { id(new PhabricatorCrumbView()) ->setName(pht('Reports')))); - return $this->buildStandardPageResponse( + return $this->buildApplicationPage( $nav, array( 'title' => pht('Maniphest Reports'), diff --git a/src/applications/maniphest/controller/ManiphestSavedQueryDeleteController.php b/src/applications/maniphest/controller/ManiphestSavedQueryDeleteController.php deleted file mode 100644 index c4fa4d9123..0000000000 --- a/src/applications/maniphest/controller/ManiphestSavedQueryDeleteController.php +++ /dev/null @@ -1,48 +0,0 @@ -id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); - - $id = $this->id; - $query = id(new ManiphestSavedQuery())->load($id); - if (!$query) { - return new Aphront404Response(); - } - if ($query->getUserPHID() != $user->getPHID()) { - return new Aphront400Response(); - } - - if ($request->isDialogFormPost()) { - $query->delete(); - return id(new AphrontRedirectResponse())->setURI('/maniphest/custom/'); - } - - $name = $query->getName(); - $inst = pht( - 'Really delete the query "%s"? It will be lost forever!', $name); - - $dialog = id(new AphrontDialogView()) - ->setUser($user) - ->setTitle(pht('Really delete this query?')) - ->appendChild(hsprintf( - '

%s

', - $inst)) - ->addCancelButton('/maniphest/custom/') - ->addSubmitButton(pht('Delete')); - - return id(new AphrontDialogResponse())->setDialog($dialog); - } - -} diff --git a/src/applications/maniphest/controller/ManiphestSavedQueryEditController.php b/src/applications/maniphest/controller/ManiphestSavedQueryEditController.php deleted file mode 100644 index fde8404934..0000000000 --- a/src/applications/maniphest/controller/ManiphestSavedQueryEditController.php +++ /dev/null @@ -1,105 +0,0 @@ -id = idx($data, 'id'); - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); - - $key = $request->getStr('key'); - if (!$key) { - $id = nonempty($this->id, $request->getInt('id')); - if (!$id) { - return new Aphront404Response(); - } - $query = id(new ManiphestSavedQuery())->load($id); - if (!$query) { - return new Aphront404Response(); - } - if ($query->getUserPHID() != $user->getPHID()) { - return new Aphront400Response(); - } - } else { - $query = new ManiphestSavedQuery(); - $query->setUserPHID($user->getPHID()); - $query->setQueryKey($key); - $query->setIsDefault(0); - } - - $e_name = true; - $errors = array(); - - if ($request->isFormPost()) { - $e_name = null; - $query->setName($request->getStr('name')); - if (!strlen($query->getName())) { - $e_name = pht('Required'); - $errors[] = pht('Saved query name is required.'); - } - - if (!$errors) { - $query->save(); - return id(new AphrontRedirectResponse())->setURI('/maniphest/custom/'); - } - } - - if ($errors) { - $error_view = new AphrontErrorView(); - $error_view->setTitle(pht('Form Errors')); - $error_view->setErrors($errors); - } else { - $error_view = null; - } - - if ($query->getID()) { - $header = pht('Edit Saved Query'); - $cancel_uri = '/maniphest/custom/'; - } else { - $header = pht('New Saved Query'); - $cancel_uri = '/maniphest/view/custom/?key='.$key; - } - - $form = id(new AphrontFormView()) - ->setUser($user) - ->addHiddenInput('key', $key) - ->addHiddenInput('id', $query->getID()) - ->appendChild( - id(new AphrontFormTextControl()) - ->setLabel(pht('Name')) - ->setValue($query->getName()) - ->setName('name') - ->setError($e_name)) - ->appendChild( - id(new AphrontFormSubmitControl()) - ->addCancelButton($cancel_uri) - ->setValue(pht('Save'))); - - $panel = new AphrontPanelView(); - $panel->setHeader($header); - $panel->appendChild($form); - $panel->setWidth(AphrontPanelView::WIDTH_FORM); - - $nav = $this->buildBaseSideNav(); - // The side nav won't show "Saved Queries..." until you have at least one. - $nav->selectFilter('saved', 'custom'); - $nav->appendChild($error_view); - $nav->appendChild($panel); - - return $this->buildApplicationPage( - $nav, - array( - 'title' => pht('Saved Queries'), - 'device' => true, - )); - } - -} diff --git a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php b/src/applications/maniphest/controller/ManiphestSavedQueryListController.php deleted file mode 100644 index c308739c3f..0000000000 --- a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php +++ /dev/null @@ -1,133 +0,0 @@ -getRequest(); - $user = $request->getUser(); - $nav = $this->buildBaseSideNav(); - - $queries = id(new ManiphestSavedQuery())->loadAllWhere( - 'userPHID = %s ORDER BY name ASC', - $user->getPHID()); - - $default = null; - - if ($request->isFormPost()) { - $new_default = null; - foreach ($queries as $query) { - if ($query->getID() == $request->getInt('default')) { - $new_default = $query; - } - } - - if ($this->getDefaultQuery()) { - $this->getDefaultQuery()->setIsDefault(0)->save(); - } - if ($new_default) { - $new_default->setIsDefault(1)->save(); - } - - return id(new AphrontRedirectResponse())->setURI('/maniphest/custom/'); - } - - $rows = array(); - foreach ($queries as $query) { - if ($query->getIsDefault()) { - $default = $query; - } - $rows[] = array( - phutil_tag( - 'input', - array( - 'type' => 'radio', - 'name' => 'default', - 'value' => $query->getID(), - 'checked' => ($query->getIsDefault() ? 'checked' : null), - )), - phutil_tag( - 'a', - array( - 'href' => '/maniphest/view/custom/?key='.$query->getQueryKey(), - ), - $query->getName()), - phutil_tag( - 'a', - array( - 'href' => '/maniphest/custom/edit/'.$query->getID().'/', - 'class' => 'grey small button', - ), - 'Edit'), - javelin_tag( - 'a', - array( - 'href' => '/maniphest/custom/delete/'.$query->getID().'/', - 'class' => 'grey small button', - 'sigil' => 'workflow', - ), - 'Delete'), - ); - } - - $rows[] = array( - phutil_tag( - 'input', - array( - 'type' => 'radio', - 'name' => 'default', - 'value' => 0, - 'checked' => ($default === null ? 'checked' : null), - )), - phutil_tag('em', array(), pht('No Default')), - '', - '', - ); - - $table = new AphrontTableView($rows); - $table->setHeaders( - array( - pht('Default'), - pht('Name'), - pht('Edit'), - pht('Delete'), - )); - $table->setColumnClasses( - array( - 'radio', - 'wide pri', - 'action', - 'action', - )); - - $panel = new AphrontPanelView(); - $panel->setHeader(pht('Saved Custom Queries')); - $panel->addButton( - phutil_tag( - 'button', - array(), - pht('Save Default Query'))); - $panel->appendChild($table); - - $form = phabricator_form( - $user, - array( - 'method' => 'POST', - 'action' => $request->getRequestURI(), - ), - $panel->render()); - - $nav->selectFilter('saved', 'saved'); - $nav->appendChild($form); - - return $this->buildApplicationPage( - $nav, - array( - 'title' => pht('Saved Queries'), - 'device' => true, - )); - } - -} diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index 9bbef02099..58e9bd594c 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -337,12 +337,7 @@ final class ManiphestTaskDetailController extends ManiphestController { id(new PhabricatorCrumbView()) ->setName($object_name) ->setHref('/'.$object_name)) - ->setActionList($actions) - ->addAction( - id(new PHUIListItemView()) - ->setHref($this->getApplicationURI('/task/create/')) - ->setName(pht('Create Task')) - ->setIcon('create')); + ->setActionList($actions); $header = $this->buildHeaderView($task); $properties = $this->buildPropertyView($task, $aux_fields, $edges, $engine); diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index 8283cf13ec..4e773cdd35 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -554,13 +554,7 @@ final class ManiphestTaskEditController extends ManiphestController { $crumbs = $this->buildApplicationCrumbs(); $crumbs->addCrumb( id(new PhabricatorCrumbView()) - ->setName($header_name) - ->setHref($this->getApplicationURI('/task/create/'))) - ->addAction( - id(new PHUIListItemView()) - ->setHref($this->getApplicationURI('/task/create/')) - ->setName(pht('Create Task')) - ->setIcon('create')); + ->setName($header_name)); return $this->buildApplicationPage( array( diff --git a/src/applications/maniphest/controller/ManiphestTaskListController.php b/src/applications/maniphest/controller/ManiphestTaskListController.php index 692f80ed55..37f53052ce 100644 --- a/src/applications/maniphest/controller/ManiphestTaskListController.php +++ b/src/applications/maniphest/controller/ManiphestTaskListController.php @@ -181,28 +181,6 @@ final class ManiphestTaskListController } } - 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('Create Task')); - } - - id(new ManiphestTaskSearchEngine()) - ->setViewer($user) - ->addNavigationItems($nav->getMenu()); - - $nav->addLabel(pht('Reports')); - $nav->addFilter('reports', pht('Reports'), 'report/'); - - $nav->selectFilter(null); - - return $nav; - } - private function renderBatchEditor(PhabricatorSavedQuery $saved_query) { $user = $this->getRequest()->getUser();