2011-02-08 19:53:59 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2012-02-15 02:00:12 +01:00
|
|
|
* Copyright 2012 Facebook, Inc.
|
2011-02-08 19:53:59 +01:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2011-07-04 22:04:22 +02:00
|
|
|
/**
|
|
|
|
* @group maniphest
|
|
|
|
*/
|
2011-02-08 19:53:59 +01:00
|
|
|
abstract class ManiphestController extends PhabricatorController {
|
|
|
|
|
2012-04-10 18:46:04 +02:00
|
|
|
private $defaultQuery;
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
public function buildStandardPageResponse($view, array $data) {
|
|
|
|
$page = $this->buildStandardPageView();
|
|
|
|
|
|
|
|
$page->setApplicationName('Maniphest');
|
|
|
|
$page->setBaseURI('/maniphest/');
|
|
|
|
$page->setTitle(idx($data, 'title'));
|
|
|
|
$page->setGlyph("\xE2\x9A\x93");
|
2012-06-14 02:28:21 +02:00
|
|
|
$page->appendPageObjects(idx($data, 'pageObjects', array()));
|
2011-02-08 19:53:59 +01:00
|
|
|
$page->appendChild($view);
|
2012-02-15 02:00:12 +01:00
|
|
|
$page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_OPEN_TASKS);
|
2011-02-08 19:53:59 +01:00
|
|
|
|
|
|
|
$response = new AphrontWebpageResponse();
|
|
|
|
return $response->setContent($page->render());
|
|
|
|
}
|
|
|
|
|
2012-03-01 23:19:11 +01:00
|
|
|
protected function buildBaseSideNav() {
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
|
|
$nav->setBaseURI(new PhutilURI('/maniphest/view/'));
|
2012-04-10 18:46:04 +02:00
|
|
|
|
|
|
|
$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();
|
|
|
|
}
|
|
|
|
|
2012-03-01 23:19:11 +01:00
|
|
|
$nav->addLabel('User Tasks');
|
|
|
|
$nav->addFilter('action', 'Assigned');
|
|
|
|
$nav->addFilter('created', 'Created');
|
|
|
|
$nav->addFilter('subscribed', 'Subscribed');
|
|
|
|
$nav->addFilter('triage', 'Need Triage');
|
|
|
|
$nav->addSpacer();
|
2012-03-15 02:01:14 +01:00
|
|
|
$nav->addLabel('User Projects');
|
|
|
|
$nav->addFilter('projecttriage','Need Triage');
|
|
|
|
$nav->addFilter('projectall', 'All Tasks');
|
|
|
|
$nav->addSpacer();
|
2012-03-01 23:19:11 +01:00
|
|
|
$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;
|
|
|
|
}
|
|
|
|
|
2012-04-10 18:46:04 +02:00
|
|
|
protected function getDefaultQuery() {
|
|
|
|
return $this->defaultQuery;
|
|
|
|
}
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
}
|