Add a meta-application
Summary: - Adds a new "Applications" application. - Builds an application list via application config instead of via hard-coding, so we can move toward better concepts of installing/uninstalling applications, etc. - Applications indicate that they need attention with notice counts and brief status messages rathern than 50 giant tables of all sorts of app data. I want to try replacing the home screen with this screen, pretty much. Not sure if this is totally crazy or not. What does everyone else think? Test Plan: Will add screenshots. Reviewers: btrahan, chad, vrana, alanh Reviewed By: vrana CC: aran, davidreuss, champo Maniphest Tasks: T1569 Differential Revision: https://secure.phabricator.com/D3129
This commit is contained in:
@@ -7,6 +7,55 @@
|
||||
*/
|
||||
|
||||
celerity_register_resource_map(array(
|
||||
'/rsrc/image/app/app_audit.png' =>
|
||||
array(
|
||||
'hash' => '5f5b4a7c48fe921532bef4c986328bdc',
|
||||
'uri' => '/res/5f5b4a7c/rsrc/image/app/app_audit.png',
|
||||
'disk' => '/rsrc/image/app/app_audit.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/app/app_differential.png' =>
|
||||
array(
|
||||
'hash' => 'b2e42893b64791f8382f7f5a0350b44d',
|
||||
'uri' => '/res/b2e42893/rsrc/image/app/app_differential.png',
|
||||
'disk' => '/rsrc/image/app/app_differential.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/app/app_diffusion.png' =>
|
||||
array(
|
||||
'hash' => 'e9e4b1c380e19a2908730ad397ae5eca',
|
||||
'uri' => '/res/e9e4b1c3/rsrc/image/app/app_diffusion.png',
|
||||
'disk' => '/rsrc/image/app/app_diffusion.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/app/app_fact.png' =>
|
||||
array(
|
||||
'hash' => '8b4da94b07e2aad9f741beca9519df98',
|
||||
'uri' => '/res/8b4da94b/rsrc/image/app/app_fact.png',
|
||||
'disk' => '/rsrc/image/app/app_fact.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/app/app_flags.png' =>
|
||||
array(
|
||||
'hash' => 'e75e1047a6bc2ff428161d2130526367',
|
||||
'uri' => '/res/e75e1047/rsrc/image/app/app_flags.png',
|
||||
'disk' => '/rsrc/image/app/app_flags.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/app/app_maniphest.png' =>
|
||||
array(
|
||||
'hash' => '88b6a06029b1ce38d5e7a70c1d2ebd97',
|
||||
'uri' => '/res/88b6a060/rsrc/image/app/app_maniphest.png',
|
||||
'disk' => '/rsrc/image/app/app_maniphest.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/app/app_phriction.png' =>
|
||||
array(
|
||||
'hash' => '68f2387363a26c15653a39bd847157f3',
|
||||
'uri' => '/res/68f23873/rsrc/image/app/app_phriction.png',
|
||||
'disk' => '/rsrc/image/app/app_phriction.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/apps.png' =>
|
||||
array(
|
||||
'hash' => 'f7cb4abeb73245fea4098a02fd784653',
|
||||
@@ -14,6 +63,34 @@ celerity_register_resource_map(array(
|
||||
'disk' => '/rsrc/image/apps.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/appstatus_empty.png' =>
|
||||
array(
|
||||
'hash' => '2f8102e0a0f5a0980d87d4ab4ba8c8fd',
|
||||
'uri' => '/res/2f8102e0/rsrc/image/appstatus_empty.png',
|
||||
'disk' => '/rsrc/image/appstatus_empty.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/appstatus_info.png' =>
|
||||
array(
|
||||
'hash' => '407de6daf2edc4a8b68e2e369f4fc8cb',
|
||||
'uri' => '/res/407de6da/rsrc/image/appstatus_info.png',
|
||||
'disk' => '/rsrc/image/appstatus_info.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/appstatus_needs.png' =>
|
||||
array(
|
||||
'hash' => '2c1e193bc786ca4fca0b851ed9cd3d92',
|
||||
'uri' => '/res/2c1e193b/rsrc/image/appstatus_needs.png',
|
||||
'disk' => '/rsrc/image/appstatus_needs.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/appstatus_okay.png' =>
|
||||
array(
|
||||
'hash' => 'd00e683ee1c61d0ccced1200775cdbb5',
|
||||
'uri' => '/res/d00e683e/rsrc/image/appstatus_okay.png',
|
||||
'disk' => '/rsrc/image/appstatus_okay.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
'/rsrc/image/avatar.png' =>
|
||||
array(
|
||||
'hash' => '1c5f255071537f05406adee86717ff27',
|
||||
@@ -2142,6 +2219,15 @@ celerity_register_resource_map(array(
|
||||
),
|
||||
'disk' => '/rsrc/css/application/directory/phabricator-app-buttons.css',
|
||||
),
|
||||
'phabricator-application-launch-view-css' =>
|
||||
array(
|
||||
'uri' => '/res/e157830a/rsrc/css/application/base/phabricator-application-launch-view.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
),
|
||||
'disk' => '/rsrc/css/application/base/phabricator-application-launch-view.css',
|
||||
),
|
||||
'phabricator-chatlog-css' =>
|
||||
array(
|
||||
'uri' => '/res/f6631adc/rsrc/css/application/chatlog/chatlog.css',
|
||||
|
||||
@@ -536,9 +536,18 @@ phutil_register_library_map(array(
|
||||
'Phabricator404Controller' => 'applications/base/controller/Phabricator404Controller.php',
|
||||
'PhabricatorAccessLog' => 'infrastructure/PhabricatorAccessLog.php',
|
||||
'PhabricatorApplication' => 'applications/base/PhabricatorApplication.php',
|
||||
'PhabricatorApplicationApplications' => 'applications/meta/application/PhabricatorApplicationApplications.php',
|
||||
'PhabricatorApplicationAudit' => 'applications/audit/application/PhabricatorApplicationAudit.php',
|
||||
'PhabricatorApplicationDifferential' => 'applications/differential/application/PhabricatorApplicationDifferential.php',
|
||||
'PhabricatorApplicationDiffusion' => 'applications/diffusion/application/PhabricatorApplicationDiffusion.php',
|
||||
'PhabricatorApplicationFact' => 'applications/fact/application/PhabricatorApplicationFact.php',
|
||||
'PhabricatorApplicationFlags' => 'applications/flag/application/PhabricatorApplicationFlags.php',
|
||||
'PhabricatorApplicationLaunchView' => 'applications/meta/view/PhabricatorApplicationLaunchView.php',
|
||||
'PhabricatorApplicationManiphest' => 'applications/maniphest/application/PhabricatorApplicationManiphest.php',
|
||||
'PhabricatorApplicationPhriction' => 'applications/phriction/application/PhabricatorApplicationPhriction.php',
|
||||
'PhabricatorApplicationStatusView' => 'applications/meta/view/PhabricatorApplicationStatusView.php',
|
||||
'PhabricatorApplicationsController' => 'applications/meta/controller/PhabricatorApplicationsController.php',
|
||||
'PhabricatorApplicationsListController' => 'applications/meta/controller/PhabricatorApplicationsListController.php',
|
||||
'PhabricatorAuditActionConstants' => 'applications/audit/constants/PhabricatorAuditActionConstants.php',
|
||||
'PhabricatorAuditAddCommentController' => 'applications/audit/controller/PhabricatorAuditAddCommentController.php',
|
||||
'PhabricatorAuditComment' => 'applications/audit/storage/PhabricatorAuditComment.php',
|
||||
@@ -1602,9 +1611,18 @@ phutil_register_library_map(array(
|
||||
'PackageDeleteMail' => 'PackageMail',
|
||||
'PackageModifyMail' => 'PackageMail',
|
||||
'Phabricator404Controller' => 'PhabricatorController',
|
||||
'PhabricatorApplicationApplications' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationAudit' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationDifferential' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationDiffusion' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationFact' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationFlags' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationLaunchView' => 'AphrontView',
|
||||
'PhabricatorApplicationManiphest' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationPhriction' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationStatusView' => 'AphrontView',
|
||||
'PhabricatorApplicationsController' => 'PhabricatorController',
|
||||
'PhabricatorApplicationsListController' => 'PhabricatorApplicationsController',
|
||||
'PhabricatorAuditAddCommentController' => 'PhabricatorAuditController',
|
||||
'PhabricatorAuditComment' => 'PhabricatorAuditDAO',
|
||||
'PhabricatorAuditCommitListView' => 'AphrontView',
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
final class PhabricatorApplicationAudit extends PhabricatorApplication {
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'Audit Code';
|
||||
}
|
||||
|
||||
public function getBaseURI() {
|
||||
return '/audit/';
|
||||
}
|
||||
|
||||
|
||||
public function getIconURI() {
|
||||
return celerity_get_resource_uri('/rsrc/image/app/app_audit.png');
|
||||
}
|
||||
|
||||
public function loadStatus(PhabricatorUser $user) {
|
||||
$status = array();
|
||||
|
||||
$phids = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user);
|
||||
|
||||
$audits = id(new PhabricatorAuditQuery())
|
||||
->withAuditorPHIDs($phids)
|
||||
->withStatus(PhabricatorAuditQuery::STATUS_OPEN)
|
||||
->withAwaitingUser($user)
|
||||
->execute();
|
||||
|
||||
$count = count($audits);
|
||||
$type = $count
|
||||
? PhabricatorApplicationStatusView::TYPE_INFO
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Commit(s) Awaiting Audit', $count))
|
||||
->setCount($count);
|
||||
|
||||
|
||||
$commits = id(new PhabricatorAuditCommitQuery())
|
||||
->withAuthorPHIDs($phids)
|
||||
->withStatus(PhabricatorAuditQuery::STATUS_OPEN)
|
||||
->execute();
|
||||
|
||||
$count = count($commits);
|
||||
$type = $count
|
||||
? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Problem Commit(s)', $count))
|
||||
->setCount($count);
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -57,6 +57,10 @@ abstract class PhabricatorApplication {
|
||||
return PhabricatorUser::getDefaultProfileImageURI();
|
||||
}
|
||||
|
||||
public function shouldAppearInLaunchView() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* -( URI Routing )-------------------------------------------------------- */
|
||||
|
||||
@@ -74,6 +78,14 @@ abstract class PhabricatorApplication {
|
||||
}
|
||||
|
||||
|
||||
/* -( Launch Integration )------------------------------------------------- */
|
||||
|
||||
|
||||
public function loadStatus(PhabricatorUser $user) {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/* -( Application Management )--------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
@@ -18,18 +18,54 @@
|
||||
|
||||
final class PhabricatorApplicationDifferential extends PhabricatorApplication {
|
||||
|
||||
public function getBaseURI() {
|
||||
return '/differential/';
|
||||
}
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'Review Code';
|
||||
}
|
||||
|
||||
public function getIconURI() {
|
||||
return celerity_get_resource_uri('/rsrc/image/app/app_differential.png');
|
||||
}
|
||||
|
||||
public function getFactObjectsForAnalysis() {
|
||||
return array(
|
||||
new DifferentialRevision(),
|
||||
);
|
||||
}
|
||||
|
||||
public function getBaseURI() {
|
||||
return '/differential/';
|
||||
}
|
||||
public function loadStatus(PhabricatorUser $user) {
|
||||
$revisions = id(new DifferentialRevisionQuery())
|
||||
->withResponsibleUsers(array($user->getPHID()))
|
||||
->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
|
||||
->execute();
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'Code Review Application';
|
||||
list($active, $waiting) = DifferentialRevisionQuery::splitResponsible(
|
||||
$revisions,
|
||||
$user->getPHID());
|
||||
|
||||
$status = array();
|
||||
|
||||
$active = count($active);
|
||||
$type = $active
|
||||
? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Review(s) Need Attention', $active))
|
||||
->setCount($active);
|
||||
|
||||
$waiting = count($waiting);
|
||||
$type = $waiting
|
||||
? PhabricatorApplicationStatusView::TYPE_INFO
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Review(s) Waiting on Others', $waiting));
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
final class PhabricatorApplicationDiffusion extends PhabricatorApplication {
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'Repository Browser';
|
||||
}
|
||||
|
||||
public function getBaseURI() {
|
||||
return '/diffusion/';
|
||||
}
|
||||
|
||||
public function getIconURI() {
|
||||
return celerity_get_resource_uri('/rsrc/image/app/app_diffusion.png');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,18 @@
|
||||
|
||||
final class PhabricatorApplicationFact extends PhabricatorApplication {
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'Analyze Data';
|
||||
}
|
||||
|
||||
public function getBaseURI() {
|
||||
return '/fact/';
|
||||
}
|
||||
|
||||
public function getIconURI() {
|
||||
return celerity_get_resource_uri('/rsrc/image/app/app_fact.png');
|
||||
}
|
||||
|
||||
public function getRoutes() {
|
||||
return array(
|
||||
'/fact/' => array(
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
final class PhabricatorApplicationFlags extends PhabricatorApplication {
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'Reminders';
|
||||
}
|
||||
|
||||
public function getBaseURI() {
|
||||
return '/flag/';
|
||||
}
|
||||
|
||||
public function getIconURI() {
|
||||
return celerity_get_resource_uri('/rsrc/image/app/app_flags.png');
|
||||
}
|
||||
|
||||
public function loadStatus(PhabricatorUser $user) {
|
||||
$status = array();
|
||||
|
||||
$flags = id(new PhabricatorFlagQuery())
|
||||
->withOwnerPHIDs(array($user->getPHID()))
|
||||
->execute();
|
||||
|
||||
$count = count($flags);
|
||||
$type = $count
|
||||
? PhabricatorApplicationStatusView::TYPE_INFO
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Flagged Object(s)', $count))
|
||||
->setCount($count);
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,15 +18,64 @@
|
||||
|
||||
final class PhabricatorApplicationManiphest extends PhabricatorApplication {
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'Tasks and Bugs';
|
||||
}
|
||||
|
||||
public function getBaseURI() {
|
||||
return '/maniphest/';
|
||||
}
|
||||
|
||||
public function isEnabled() {
|
||||
return PhabricatorEnv::getEnvConfig('maniphest.enabled');
|
||||
}
|
||||
|
||||
public function getIconURI() {
|
||||
return celerity_get_resource_uri('/rsrc/image/app/app_maniphest.png');
|
||||
}
|
||||
|
||||
public function getFactObjectsForAnalysis() {
|
||||
return array(
|
||||
new ManiphestTask(),
|
||||
);
|
||||
}
|
||||
|
||||
public function loadStatus(PhabricatorUser $user) {
|
||||
$status = array();
|
||||
|
||||
$query = id(new ManiphestTaskQuery())
|
||||
->withStatus(ManiphestTaskQuery::STATUS_OPEN)
|
||||
->withPriority(ManiphestTaskPriority::PRIORITY_UNBREAK_NOW)
|
||||
->setLimit(1)
|
||||
->setCalculateRows(true);
|
||||
$query->execute();
|
||||
|
||||
$count = $query->getRowCount();
|
||||
$type = $count
|
||||
? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Unbreak Now Task(s)!', $count))
|
||||
->setCount($count);
|
||||
|
||||
$query = id(new ManiphestTaskQuery())
|
||||
->withStatus(ManiphestTaskQuery::STATUS_OPEN)
|
||||
->withOwners(array($user->getPHID()))
|
||||
->setLimit(1)
|
||||
->setCalculateRows(true);
|
||||
$query->execute();
|
||||
|
||||
$count = $query->getRowCount();
|
||||
$type = $count
|
||||
? PhabricatorApplicationStatusView::TYPE_INFO
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Assigned Task(s)', $count));
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
final class PhabricatorApplicationApplications extends PhabricatorApplication {
|
||||
|
||||
public function getBaseURI() {
|
||||
return '/applications/';
|
||||
}
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'Manage Applications';
|
||||
}
|
||||
|
||||
public function getRoutes() {
|
||||
return array(
|
||||
'/applications/' => array(
|
||||
'' => 'PhabricatorApplicationsListController'
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function shouldAppearInLaunchView() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
abstract class PhabricatorApplicationsController extends PhabricatorController {
|
||||
|
||||
public function buildStandardPageResponse($view, array $data) {
|
||||
|
||||
$page = $this->buildStandardPageView();
|
||||
|
||||
$page->setApplicationName('Applications');
|
||||
$page->setBaseURI('/applications/');
|
||||
$page->setTitle(idx($data, 'title'));
|
||||
$page->setGlyph("\xE0\xBC\x84");
|
||||
$page->appendChild($view);
|
||||
|
||||
$response = new AphrontWebpageResponse();
|
||||
return $response->setContent($page->render());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
final class PhabricatorApplicationsListController
|
||||
extends PhabricatorApplicationsController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$applications = PhabricatorApplication::getAllInstalledApplications();
|
||||
$applications = msort($applications, 'getName');
|
||||
|
||||
foreach ($applications as $key => $application) {
|
||||
if (!$application->shouldAppearInLaunchView()) {
|
||||
unset($applications[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$status = array();
|
||||
foreach ($applications as $key => $application) {
|
||||
$status[$key] = $application->loadStatus($user);
|
||||
}
|
||||
|
||||
$views = array();
|
||||
foreach ($applications as $key => $application) {
|
||||
$views[] = id(new PhabricatorApplicationLaunchView())
|
||||
->setApplication($application)
|
||||
->setApplicationStatus(idx($status, $key, array()))
|
||||
->setUser($user);
|
||||
}
|
||||
|
||||
$view = phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-application-list',
|
||||
),
|
||||
id(new AphrontNullView())->appendChild($views)->render());
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$view,
|
||||
array(
|
||||
'title' => 'Applications',
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
final class PhabricatorApplicationLaunchView extends AphrontView {
|
||||
|
||||
private $user;
|
||||
private $application;
|
||||
private $status;
|
||||
|
||||
public function setApplication(PhabricatorApplication $application) {
|
||||
$this->application = $application;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUser(PhabricatorUser $user) {
|
||||
$this->user = $user;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setApplicationStatus(array $status) {
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$application = $this->application;
|
||||
|
||||
require_celerity_resource('phabricator-application-launch-view-css');
|
||||
|
||||
$content = array();
|
||||
$content[] = phutil_render_tag(
|
||||
'span',
|
||||
array(
|
||||
'class' => 'phabricator-application-launch-name',
|
||||
),
|
||||
phutil_escape_html($application->getName()));
|
||||
$content[] = phutil_render_tag(
|
||||
'span',
|
||||
array(
|
||||
'class' => 'phabricator-application-launch-description',
|
||||
),
|
||||
phutil_escape_html($application->getShortDescription()));
|
||||
|
||||
|
||||
$count = 0;
|
||||
if ($this->status) {
|
||||
$content[] = '<span class="phabricator-application-status-block">';
|
||||
foreach ($this->status as $status) {
|
||||
$count += $status->getCount();
|
||||
$content[] = $status;
|
||||
}
|
||||
$content[] = '</span>';
|
||||
}
|
||||
|
||||
if ($count) {
|
||||
$content[] = phutil_render_tag(
|
||||
'span',
|
||||
array(
|
||||
'class' => 'phabricator-application-launch-attention',
|
||||
),
|
||||
phutil_escape_html($count));
|
||||
}
|
||||
|
||||
return phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'class' => 'phabricator-application-launch-container',
|
||||
'style' => 'background-image: url('.$application->getIconURI().')',
|
||||
'href' => $application->getBaseURI(),
|
||||
),
|
||||
$this->renderSingleView($content));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
final class PhabricatorApplicationStatusView extends AphrontView {
|
||||
|
||||
private $count;
|
||||
private $text;
|
||||
private $type;
|
||||
|
||||
const TYPE_NEEDS_ATTENTION = 'needs';
|
||||
const TYPE_INFO = 'info';
|
||||
const TYPE_OKAY = 'okay';
|
||||
const TYPE_WARNING = 'warning';
|
||||
const TYPE_EMPTY = 'empty';
|
||||
|
||||
public function setType($type) {
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setText($text) {
|
||||
$this->text = $text;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCount($count) {
|
||||
$this->count = $count;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCount() {
|
||||
return $this->count;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$classes = array(
|
||||
'phabricator-application-status',
|
||||
'phabricator-application-status-type-'.$this->type,
|
||||
);
|
||||
|
||||
return phutil_render_tag(
|
||||
'span',
|
||||
array(
|
||||
'class' => implode(' ', $classes),
|
||||
),
|
||||
phutil_escape_html($this->text));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
final class PhabricatorApplicationPhriction extends PhabricatorApplication {
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'Wiki';
|
||||
}
|
||||
|
||||
public function getBaseURI() {
|
||||
return '/w/';
|
||||
}
|
||||
|
||||
public function getIconURI() {
|
||||
return celerity_get_resource_uri('/rsrc/image/app/app_phriction.png');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -131,6 +131,41 @@ abstract class PhabricatorBaseEnglishTranslation
|
||||
'There are %d aggregate facts in storage.',
|
||||
),
|
||||
|
||||
'%d Commit(s) Awaiting Audit' => array(
|
||||
'%d Commit Awaiting Audit',
|
||||
'%d Commits Awaiting Audit',
|
||||
),
|
||||
|
||||
'%d Problem Commit(s)' => array(
|
||||
'%d Problem Commit',
|
||||
'%d Problem Commits',
|
||||
),
|
||||
|
||||
'%d Review(s) Need Attention' => array(
|
||||
'%d Review Needs Attention',
|
||||
'%d Reviews Need Attention',
|
||||
),
|
||||
|
||||
'%d Review(s) Waiting on Others' => array(
|
||||
'%d Review Waiting on Others',
|
||||
'%d Reviews Waiting on Others',
|
||||
),
|
||||
|
||||
'%d Flagged Object(s)' => array(
|
||||
'%d Flagged Object',
|
||||
'%d Flagged Objects',
|
||||
),
|
||||
|
||||
'%d Unbreak Now Task(s)!' => array(
|
||||
'%d Unbreak Now Task!',
|
||||
'%d Unbreak Now Tasks!',
|
||||
),
|
||||
|
||||
'%d Assigned Task(s)' => array(
|
||||
'%d Assigned Task',
|
||||
'%d Assigned Tasks',
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user