2012-08-02 23:07:21 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorApplicationDiffusion extends PhabricatorApplication {
|
|
|
|
|
|
|
|
public function getShortDescription() {
|
2013-05-11 17:23:19 +02:00
|
|
|
return pht('Repository Browser');
|
2012-08-02 23:07:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getBaseURI() {
|
|
|
|
return '/diffusion/';
|
|
|
|
}
|
|
|
|
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 22:37:28 +01:00
|
|
|
public function getIconName() {
|
2012-08-14 23:23:55 +02:00
|
|
|
return 'diffusion';
|
2012-08-02 23:07:21 +02:00
|
|
|
}
|
|
|
|
|
2012-08-14 00:28:41 +02:00
|
|
|
public function getHelpURI() {
|
|
|
|
return PhabricatorEnv::getDoclink('article/Diffusion_User_Guide.html');
|
|
|
|
}
|
|
|
|
|
2012-08-15 02:44:15 +02:00
|
|
|
public function getFactObjectsForAnalysis() {
|
|
|
|
return array(
|
|
|
|
new PhabricatorRepositoryCommit(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-02-05 22:46:02 +01:00
|
|
|
public function getEventListeners() {
|
|
|
|
return array(
|
2013-04-06 02:01:54 +02:00
|
|
|
new DiffusionHovercardEventListener(),
|
2013-02-05 22:46:02 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-02-27 17:04:54 +01:00
|
|
|
public function getRemarkupRules() {
|
|
|
|
return array(
|
|
|
|
new DiffusionRemarkupRule(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-08-05 23:03:39 +02:00
|
|
|
public function getRoutes() {
|
|
|
|
return array(
|
|
|
|
'/r(?P<callsign>[A-Z]+)(?P<commit>[a-z0-9]+)'
|
|
|
|
=> 'DiffusionCommitController',
|
|
|
|
'/diffusion/' => array(
|
2013-09-11 00:26:08 +02:00
|
|
|
'(?:query/(?P<queryKey>[^/]+)/)?'
|
|
|
|
=> 'DiffusionRepositoryListController',
|
2013-07-14 16:37:17 +02:00
|
|
|
'create/' => 'DiffusionRepositoryCreateController',
|
2012-08-05 23:03:39 +02:00
|
|
|
'(?P<callsign>[A-Z]+)/' => array(
|
|
|
|
'' => 'DiffusionRepositoryController',
|
|
|
|
|
|
|
|
'repository/(?P<dblob>.*)' => 'DiffusionRepositoryController',
|
|
|
|
'change/(?P<dblob>.*)' => 'DiffusionChangeController',
|
|
|
|
'history/(?P<dblob>.*)' => 'DiffusionHistoryController',
|
Improve organization of Diffusion browse controllers
Summary:
Currently we have this:
- DiffusionController (abstract, has some random shared browse code)
- DiffusionBrowseController (concrete, Handles routing, directories, and search)
- DiffusionBrowseFileController (concrete, handles files)
Instead, do this:
- DiffusionController (no browse-related code)
- DiffusionBrowseController (abstract, shared browse code)
- DiffusionBrowseMainController (concrete, handles routing)
- DiffusionBrowseDirectoryController (concrete, handles directories)
- DiffusionBrowseFileController (concrete, handles files)
- DiffusionBrowseSearchController (concrete, handles search)
Feels a lot cleaner.
Test Plan: Looked at directories, searches, and files.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D7045
2013-09-20 01:01:34 +02:00
|
|
|
'browse/(?P<dblob>.*)' => 'DiffusionBrowseMainController',
|
2012-08-05 23:03:39 +02:00
|
|
|
'lastmodified/(?P<dblob>.*)' => 'DiffusionLastModifiedController',
|
|
|
|
'diff/' => 'DiffusionDiffController',
|
|
|
|
'tags/(?P<dblob>.*)' => 'DiffusionTagListController',
|
|
|
|
'branches/(?P<dblob>.*)' => 'DiffusionBranchTableController',
|
2012-11-08 20:11:44 +01:00
|
|
|
'lint/(?P<dblob>.*)' => 'DiffusionLintController',
|
2012-08-05 23:03:39 +02:00
|
|
|
|
|
|
|
'commit/(?P<commit>[a-z0-9]+)/branches/'
|
|
|
|
=> 'DiffusionCommitBranchesController',
|
|
|
|
'commit/(?P<commit>[a-z0-9]+)/tags/'
|
|
|
|
=> 'DiffusionCommitTagsController',
|
2012-08-08 19:03:41 +02:00
|
|
|
'commit/(?P<commit>[a-z0-9]+)/edit/'
|
|
|
|
=> 'DiffusionCommitEditController',
|
2013-05-24 21:37:42 +02:00
|
|
|
'edit/' => array(
|
2013-10-26 00:58:58 +02:00
|
|
|
'' => 'DiffusionRepositoryEditMainController',
|
2013-05-24 21:37:42 +02:00
|
|
|
'basic/' => 'DiffusionRepositoryEditBasicController',
|
2013-05-25 15:30:38 +02:00
|
|
|
'encoding/' => 'DiffusionRepositoryEditEncodingController',
|
2013-09-22 01:23:35 +02:00
|
|
|
'activate/' => 'DiffusionRepositoryEditActivateController',
|
2013-09-23 21:53:41 +02:00
|
|
|
'policy/' => 'DiffusionRepositoryEditPolicyController',
|
2013-10-25 22:57:14 +02:00
|
|
|
'branches/' => 'DiffusionRepositoryEditBranchesController',
|
2013-10-25 22:58:03 +02:00
|
|
|
'subversion/' => 'DiffusionRepositoryEditSubversionController',
|
2013-10-25 22:58:15 +02:00
|
|
|
'actions/' => 'DiffusionRepositoryEditActionsController',
|
2013-10-25 22:59:02 +02:00
|
|
|
'(?P<edit>remote)/' => 'DiffusionRepositoryCreateController',
|
2013-10-29 20:20:26 +01:00
|
|
|
'local/' => 'DiffusionRepositoryEditLocalController',
|
2013-10-29 20:26:07 +01:00
|
|
|
'delete/' => 'DiffusionRepositoryEditDeleteController',
|
2013-10-26 05:13:38 +02:00
|
|
|
'hosting/' => 'DiffusionRepositoryEditHostingController',
|
|
|
|
'(?P<serve>serve)/' => 'DiffusionRepositoryEditHostingController',
|
2013-05-24 21:37:42 +02:00
|
|
|
),
|
2012-08-05 23:03:39 +02:00
|
|
|
),
|
Accept and route VCS HTTP requests
Summary:
Mostly ripped from D7391, with some changes:
- Serve repositories at `/diffusion/X/`, with no special `/git/` or `/serve/` URI component.
- This requires a little bit of magic, but I got the magic working for Git, Mercurial and SVN, and it seems reasonable.
- I think having one URI for everything will make it easier for users to understand.
- One downside is that git will clone into `X` by default, but I think that's not a big deal, and we can work around that in the future easily enough.
- Accept HTTP requests for Git, SVN and Mercurial repositories.
- Auth logic is a little different in order to be more consistent with how other things work.
- Instead of AphrontBasicAuthResponse, added "VCSResponse". Mercurial can print strings we send it on the CLI if we're careful, so support that. I did a fair amount of digging and didn't have any luck with git or svn.
- Commands we don't know about are assumed to require "Push" capability by default.
No actual VCS data going over the wire yet.
Test Plan:
Ran a bunch of stuff like this:
$ hg clone http://local.aphront.com:8080/diffusion/P/
abort: HTTP Error 403: This repository is not available over HTTP.
...and got pretty reasonable-seeming errors in all cases. All this can do is produce errors for now.
Reviewers: hach-que, btrahan
Reviewed By: hach-que
CC: aran
Maniphest Tasks: T2230
Differential Revision: https://secure.phabricator.com/D7417
2013-10-26 16:56:17 +02:00
|
|
|
|
|
|
|
// NOTE: This must come after the rule above; it just gives us a
|
|
|
|
// catch-all for serving repositories over HTTP. We must accept
|
|
|
|
// requests without the trailing "/" because SVN commands don't
|
|
|
|
// necessarily include it.
|
|
|
|
'(?P<callsign>[A-Z]+)(/|$).*' => 'DiffusionRepositoryDefaultController',
|
|
|
|
|
2012-08-05 23:03:39 +02:00
|
|
|
'inline/' => array(
|
|
|
|
'edit/(?P<phid>[^/]+)/' => 'DiffusionInlineCommentController',
|
|
|
|
'preview/(?P<phid>[^/]+)/' =>
|
|
|
|
'DiffusionInlineCommentPreviewController',
|
|
|
|
),
|
|
|
|
'services/' => array(
|
|
|
|
'path/' => array(
|
|
|
|
'complete/' => 'DiffusionPathCompleteController',
|
|
|
|
'validate/' => 'DiffusionPathValidateController',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'symbol/(?P<name>[^/]+)/' => 'DiffusionSymbolController',
|
|
|
|
'external/' => 'DiffusionExternalController',
|
2012-12-03 22:12:19 +01:00
|
|
|
'lint/' => 'DiffusionLintController',
|
2012-08-05 23:03:39 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-10-04 00:46:19 +02:00
|
|
|
public function getApplicationGroup() {
|
|
|
|
return self::GROUP_CORE;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationOrder() {
|
Add basic support for new navigation menu
Summary:
Add a new left-side application menu. This menu shows which application you're in and provides a quick way to get to other applications.
On desktops, menus are always shown but the app menu can be collapsed to be very small.
On tablets, navigation buttons allow you to choose between the menus and the content.
On phones, navigation buttons allow you to choose between the app menu, the local menu, and the content.
This needs some code and UI cleanup, but has no effect yet so I think it's okay to land as-is, I'll clean it up a bit as I start integrating it. I want to play around with it a bit and see if it's good/useful or horrible anyway.
Test Plan: Will include screenshots.
Reviewers: vrana, btrahan, chad
Reviewed By: btrahan
CC: aran, alanh
Maniphest Tasks: T1569
Differential Revision: https://secure.phabricator.com/D3223
2012-08-11 16:06:12 +02:00
|
|
|
return 0.120;
|
|
|
|
}
|
|
|
|
|
2013-10-26 02:46:08 +02:00
|
|
|
protected function getCustomCapabilities() {
|
|
|
|
return array(
|
|
|
|
DiffusionCapabilityDefaultView::CAPABILITY => array(
|
|
|
|
),
|
|
|
|
DiffusionCapabilityDefaultEdit::CAPABILITY => array(
|
|
|
|
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
|
|
|
),
|
2013-10-26 05:13:38 +02:00
|
|
|
DiffusionCapabilityDefaultPush::CAPABILITY => array(
|
|
|
|
),
|
2013-10-26 02:46:08 +02:00
|
|
|
DiffusionCapabilityCreateRepositories::CAPABILITY => array(
|
|
|
|
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-08-02 23:07:21 +02:00
|
|
|
}
|