Page MenuHomePhabricator

D15871.id.diff
No OneTemporary

D15871.id.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -762,10 +762,10 @@
'DiffusionRepositoryEditDeleteController' => 'applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php',
'DiffusionRepositoryEditEngine' => 'applications/diffusion/editor/DiffusionRepositoryEditEngine.php',
'DiffusionRepositoryEditUpdateController' => 'applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php',
- 'DiffusionRepositoryEditproController' => 'applications/diffusion/controller/DiffusionRepositoryEditproController.php',
'DiffusionRepositoryHistoryManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryHistoryManagementPanel.php',
'DiffusionRepositoryListController' => 'applications/diffusion/controller/DiffusionRepositoryListController.php',
'DiffusionRepositoryManageController' => 'applications/diffusion/controller/DiffusionRepositoryManageController.php',
+ 'DiffusionRepositoryManagePanelsController' => 'applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php',
'DiffusionRepositoryManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryManagementPanel.php',
'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php',
'DiffusionRepositoryPoliciesManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php',
@@ -4975,17 +4975,17 @@
'DiffusionRepositoryDatasource' => 'PhabricatorTypeaheadDatasource',
'DiffusionRepositoryDefaultController' => 'DiffusionController',
'DiffusionRepositoryDocumentationManagementPanel' => 'DiffusionRepositoryManagementPanel',
- 'DiffusionRepositoryEditActivateController' => 'DiffusionRepositoryEditController',
+ 'DiffusionRepositoryEditActivateController' => 'DiffusionRepositoryManageController',
'DiffusionRepositoryEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
- 'DiffusionRepositoryEditController' => 'DiffusionController',
- 'DiffusionRepositoryEditDangerousController' => 'DiffusionRepositoryEditController',
- 'DiffusionRepositoryEditDeleteController' => 'DiffusionRepositoryEditController',
+ 'DiffusionRepositoryEditController' => 'DiffusionRepositoryManageController',
+ 'DiffusionRepositoryEditDangerousController' => 'DiffusionRepositoryManageController',
+ 'DiffusionRepositoryEditDeleteController' => 'DiffusionRepositoryManageController',
'DiffusionRepositoryEditEngine' => 'PhabricatorEditEngine',
- 'DiffusionRepositoryEditUpdateController' => 'DiffusionRepositoryEditController',
- 'DiffusionRepositoryEditproController' => 'DiffusionRepositoryEditController',
+ 'DiffusionRepositoryEditUpdateController' => 'DiffusionRepositoryManageController',
'DiffusionRepositoryHistoryManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositoryListController' => 'DiffusionController',
'DiffusionRepositoryManageController' => 'DiffusionController',
+ 'DiffusionRepositoryManagePanelsController' => 'DiffusionRepositoryManageController',
'DiffusionRepositoryManagementPanel' => 'Phobject',
'DiffusionRepositoryPath' => 'Phobject',
'DiffusionRepositoryPoliciesManagementPanel' => 'DiffusionRepositoryManagementPanel',
@@ -4997,7 +4997,7 @@
'DiffusionRepositoryStorageManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositorySymbolsManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositoryTag' => 'Phobject',
- 'DiffusionRepositoryTestAutomationController' => 'DiffusionRepositoryEditController',
+ 'DiffusionRepositoryTestAutomationController' => 'DiffusionRepositoryManageController',
'DiffusionRepositoryURICredentialController' => 'DiffusionController',
'DiffusionRepositoryURIDisableController' => 'DiffusionController',
'DiffusionRepositoryURIEditController' => 'DiffusionController',
diff --git a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
--- a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
+++ b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
@@ -58,7 +58,7 @@
$this->getQueryRoutePattern()
=> 'DiffusionRepositoryListController',
$this->getEditRoutePattern('edit/') =>
- 'DiffusionRepositoryEditproController',
+ 'DiffusionRepositoryEditController',
'pushlog/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => 'DiffusionPushLogListController',
'view/(?P<id>\d+)/' => 'DiffusionPushEventViewController',
@@ -87,7 +87,7 @@
'commit/(?P<commit>[a-z0-9]+)/edit/'
=> 'DiffusionCommitEditController',
'manage/(?:(?P<panel>[^/]+)/)?'
- => 'DiffusionRepositoryManageController',
+ => 'DiffusionRepositoryManagePanelsController',
'uri/' => array(
'view/(?P<id>[0-9]\d*)/' => 'DiffusionRepositoryURIViewController',
'disable/(?P<id>[0-9]\d*)/'
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php
@@ -1,7 +1,7 @@
<?php
final class DiffusionRepositoryEditActivateController
- extends DiffusionRepositoryEditController {
+ extends DiffusionRepositoryManageController {
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditController.php
@@ -1,28 +1,69 @@
<?php
-abstract class DiffusionRepositoryEditController
- extends DiffusionController {
+final class DiffusionRepositoryEditController
+ extends DiffusionRepositoryManageController {
- protected function buildApplicationCrumbs($is_main = false) {
- $crumbs = parent::buildApplicationCrumbs();
+ public function handleRequest(AphrontRequest $request) {
+ $engine = id(new DiffusionRepositoryEditEngine())
+ ->setController($this);
- if ($this->hasDiffusionRequest()) {
- $drequest = $this->getDiffusionRequest();
- $repository = $drequest->getRepository();
- $repo_uri = $repository->getURI();
- $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
+ $id = $request->getURIData('id');
+ if (!$id) {
+ $this->requireApplicationCapability(
+ DiffusionCreateRepositoriesCapability::CAPABILITY);
- $crumbs->addTextCrumb($repository->getDisplayname(), $repo_uri);
-
- if ($is_main) {
- $crumbs->addTextCrumb(pht('Edit Repository'));
- } else {
- $crumbs->addTextCrumb(pht('Edit'), $edit_uri);
+ $vcs = $request->getStr('vcs');
+ $vcs_types = PhabricatorRepositoryType::getRepositoryTypeMap();
+ if (empty($vcs_types[$vcs])) {
+ return $this->buildVCSTypeResponse();
}
+
+ $engine
+ ->addContextParameter('vcs', $vcs)
+ ->setVersionControlSystem($vcs);
}
+
+ return $engine->buildResponse();
+ }
+
+ private function buildVCSTypeResponse() {
+ $vcs_types = PhabricatorRepositoryType::getRepositoryTypeMap();
+
+ $request = $this->getRequest();
+ $viewer = $this->getViewer();
+
+ $crumbs = $this->buildApplicationCrumbs();
+ $crumbs->addTextCrumb(pht('Create Repository'));
$crumbs->setBorder(true);
- return $crumbs;
+ $title = pht('Choose Repository Type');
+ $header = id(new PHUIHeaderView())
+ ->setHeader(pht('Create Repository'))
+ ->setHeaderIcon('fa-plus-square');
+
+ $layout = id(new AphrontMultiColumnView())
+ ->setFluidLayout(true);
+
+ $create_uri = $request->getRequestURI();
+
+ foreach ($vcs_types as $vcs_key => $vcs_type) {
+ $action = id(new PHUIActionPanelView())
+ ->setIcon(idx($vcs_type, 'icon'))
+ ->setHeader(idx($vcs_type, 'create.header'))
+ ->setHref($create_uri->alter('vcs', $vcs_key))
+ ->setSubheader(idx($vcs_type, 'create.subheader'));
+
+ $layout->addColumn($action);
+ }
+
+ $view = id(new PHUITwoColumnView())
+ ->setHeader($header)
+ ->setFooter($layout);
+
+ return $this->newPage()
+ ->setTitle($title)
+ ->setCrumbs($crumbs)
+ ->appendChild($view);
}
}
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditDangerousController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditDangerousController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditDangerousController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditDangerousController.php
@@ -1,7 +1,7 @@
<?php
final class DiffusionRepositoryEditDangerousController
- extends DiffusionRepositoryEditController {
+ extends DiffusionRepositoryManageController {
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php
@@ -1,7 +1,7 @@
<?php
final class DiffusionRepositoryEditDeleteController
- extends DiffusionRepositoryEditController {
+ extends DiffusionRepositoryManageController {
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php
@@ -1,7 +1,7 @@
<?php
final class DiffusionRepositoryEditUpdateController
- extends DiffusionRepositoryEditController {
+ extends DiffusionRepositoryManageController {
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditproController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditproController.php
deleted file mode 100644
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditproController.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-final class DiffusionRepositoryEditproController
- extends DiffusionRepositoryEditController {
-
- public function handleRequest(AphrontRequest $request) {
- $engine = id(new DiffusionRepositoryEditEngine())
- ->setController($this);
-
- $id = $request->getURIData('id');
- if (!$id) {
- $this->requireApplicationCapability(
- DiffusionCreateRepositoriesCapability::CAPABILITY);
-
- $vcs = $request->getStr('vcs');
- $vcs_types = PhabricatorRepositoryType::getRepositoryTypeMap();
- if (empty($vcs_types[$vcs])) {
- return $this->buildVCSTypeResponse();
- }
-
- $engine
- ->addContextParameter('vcs', $vcs)
- ->setVersionControlSystem($vcs);
- }
-
- return $engine->buildResponse();
- }
-
- private function buildVCSTypeResponse() {
- $vcs_types = PhabricatorRepositoryType::getRepositoryTypeMap();
-
- $request = $this->getRequest();
- $viewer = $this->getViewer();
-
- $crumbs = $this->buildApplicationCrumbs();
- $crumbs->addTextCrumb(pht('Create Repository'));
- $crumbs->setBorder(true);
-
- $title = pht('Choose Repository Type');
- $header = id(new PHUIHeaderView())
- ->setHeader(pht('Create Repository'))
- ->setHeaderIcon('fa-plus-square');
-
- $layout = id(new AphrontMultiColumnView())
- ->setFluidLayout(true);
-
- $create_uri = $request->getRequestURI();
-
- foreach ($vcs_types as $vcs_key => $vcs_type) {
- $action = id(new PHUIActionPanelView())
- ->setIcon(idx($vcs_type, 'icon'))
- ->setHeader(idx($vcs_type, 'create.header'))
- ->setHref($create_uri->alter('vcs', $vcs_key))
- ->setSubheader(idx($vcs_type, 'create.subheader'));
-
- $layout->addColumn($action);
- }
-
- $view = id(new PHUITwoColumnView())
- ->setHeader($header)
- ->setFooter($layout);
-
- return $this->newPage()
- ->setTitle($title)
- ->setCrumbs($crumbs)
- ->appendChild($view);
- }
-
-}
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryManageController.php b/src/applications/diffusion/controller/DiffusionRepositoryManageController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryManageController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryManageController.php
@@ -1,139 +1,25 @@
<?php
-final class DiffusionRepositoryManageController
+abstract class DiffusionRepositoryManageController
extends DiffusionController {
- private $navigation;
+ protected function buildApplicationCrumbs() {
+ $crumbs = parent::buildApplicationCrumbs();
- public function buildApplicationMenu() {
- // TODO: This is messy for now; the mobile menu should be set automatically
- // when the body content is a two-column view with navigation.
- if ($this->navigation) {
- return $this->navigation->getMenu();
- }
- return parent::buildApplicationMenu();
- }
-
-
- public function handleRequest(AphrontRequest $request) {
- $response = $this->loadDiffusionContext();
- if ($response) {
- return $response;
- }
-
- $viewer = $this->getViewer();
- $drequest = $this->getDiffusionRequest();
- $repository = $drequest->getRepository();
-
- $panels = DiffusionRepositoryManagementPanel::getAllPanels();
-
- foreach ($panels as $panel) {
- $panel
- ->setViewer($viewer)
- ->setRepository($repository)
- ->setController($this);
- }
-
- $selected = $request->getURIData('panel');
- if (!strlen($selected)) {
- $selected = head_key($panels);
- }
-
- if (empty($panels[$selected])) {
- return new Aphront404Response();
- }
-
- $nav = $this->renderSideNav($repository, $panels, $selected);
- $this->navigation = $nav;
-
- $panel = $panels[$selected];
-
- $content = $panel->buildManagementPanelContent();
-
- $title = array(
- $panel->getManagementPanelLabel(),
- $repository->getDisplayName(),
- );
-
- $crumbs = $this->buildApplicationCrumbs();
- $crumbs->addTextCrumb(
- $repository->getDisplayName(),
- $repository->getURI());
- $crumbs->addTextCrumb(
- pht('Manage'),
- $repository->getPathURI('manage/'));
- $crumbs->addTextCrumb($panel->getManagementPanelLabel());
+ if ($this->hasDiffusionRequest()) {
+ $drequest = $this->getDiffusionRequest();
+ $repository = $drequest->getRepository();
- $header_text = pht(
- '%s: %s',
- $repository->getDisplayName(),
- $panel->getManagementPanelLabel());
+ $crumbs->addTextCrumb(
+ $repository->getDisplayName(),
+ $repository->getURI());
- $header = id(new PHUIHeaderView())
- ->setHeader($header_text)
- ->setHeaderIcon('fa-pencil');
- if ($repository->isTracked()) {
- $header->setStatus('fa-check', 'bluegrey', pht('Active'));
- } else {
- $header->setStatus('fa-ban', 'dark', pht('Inactive'));
+ $crumbs->addTextCrumb(
+ pht('Manage'),
+ $repository->getPathURI('manage/'));
}
- $view = id(new PHUITwoColumnView())
- ->setHeader($header)
- ->setNavigation($nav)
- ->setMainColumn($content);
-
- $curtain = $panel->buildManagementPanelCurtain();
- if ($curtain) {
- $view->setCurtain($curtain);
- }
-
- return $this->newPage()
- ->setTitle($title)
- ->setCrumbs($crumbs)
- ->appendChild($view);
+ return $crumbs;
}
- private function renderSideNav(
- PhabricatorRepository $repository,
- array $panels,
- $selected) {
-
- $base_uri = $repository->getPathURI('manage/');
- $base_uri = new PhutilURI($base_uri);
-
- $nav = id(new AphrontSideNavFilterView())
- ->setBaseURI($base_uri);
-
- foreach ($panels as $panel) {
- $key = $panel->getManagementPanelKey();
- $label = $panel->getManagementPanelLabel();
- $icon = $panel->getManagementPanelIcon();
- $href = $panel->getPanelNavigationURI();
-
- $item = id(new PHUIListItemView())
- ->setKey($key)
- ->setName($label)
- ->setType(PHUIListItemView::TYPE_LINK)
- ->setHref($href)
- ->setIcon($icon);
-
- $nav->addMenuItem($item);
- }
-
- $nav->selectFilter($selected);
-
- return $nav;
- }
-
- public function newTimeline(PhabricatorRepository $repository) {
- $timeline = $this->buildTransactionTimeline(
- $repository,
- new PhabricatorRepositoryTransactionQuery());
- $timeline->setShouldTerminate(true);
-
- return $timeline;
- }
-
-
}
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryManageController.php b/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php
copy from src/applications/diffusion/controller/DiffusionRepositoryManageController.php
copy to src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryManageController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php
@@ -1,7 +1,7 @@
<?php
-final class DiffusionRepositoryManageController
- extends DiffusionController {
+final class DiffusionRepositoryManagePanelsController
+ extends DiffusionRepositoryManageController {
private $navigation;
@@ -56,12 +56,6 @@
);
$crumbs = $this->buildApplicationCrumbs();
- $crumbs->addTextCrumb(
- $repository->getDisplayName(),
- $repository->getURI());
- $crumbs->addTextCrumb(
- pht('Manage'),
- $repository->getPathURI('manage/'));
$crumbs->addTextCrumb($panel->getManagementPanelLabel());
$header_text = pht(
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php b/src/applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php
@@ -1,7 +1,7 @@
<?php
final class DiffusionRepositoryTestAutomationController
- extends DiffusionRepositoryEditController {
+ extends DiffusionRepositoryManageController {
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 6, 11:00 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6735262
Default Alt Text
D15871.id.diff (19 KB)

Event Timeline