1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

More phabricator organizational stuff.

This commit is contained in:
Evan Priestley 2011-01-22 17:48:55 -08:00 committed by epriestley
parent 85198b3d06
commit eecc003a62
32 changed files with 115 additions and 88 deletions

View file

@ -16,17 +16,6 @@ phutil_register_library_map(array(
'AphrontDefaultApplicationController' => 'aphront/default/controller',
'AphrontDialogResponse' => 'aphront/response/dialog',
'AphrontDialogView' => 'view/dialog',
'AphrontDirectoryCategory' => 'applications/directory/storage/category',
'AphrontDirectoryCategoryDeleteController' => 'applications/directory/controller/categorydelete',
'AphrontDirectoryCategoryEditController' => 'applications/directory/controller/categoryedit',
'AphrontDirectoryCategoryListController' => 'applications/directory/controller/categorylist',
'AphrontDirectoryController' => 'applications/directory/controller/base',
'AphrontDirectoryDAO' => 'applications/directory/storage/base',
'AphrontDirectoryItem' => 'applications/directory/storage/item',
'AphrontDirectoryItemDeleteController' => 'applications/directory/controller/itemdelete',
'AphrontDirectoryItemEditController' => 'applications/directory/controller/itemedit',
'AphrontDirectoryItemListController' => 'applications/directory/controller/itemlist',
'AphrontDirectoryMainController' => 'applications/directory/controller/main',
'AphrontErrorView' => 'view/form/error',
'AphrontFormControl' => 'view/form/control/base',
'AphrontFormSelectControl' => 'view/form/control/select',
@ -34,7 +23,6 @@ phutil_register_library_map(array(
'AphrontFormTextAreaControl' => 'view/form/control/textarea',
'AphrontFormTextControl' => 'view/form/control/text',
'AphrontFormView' => 'view/form/base',
'AphrontLiskDAO' => 'aphront/storage/lisk',
'AphrontMySQLDatabaseConnection' => 'storage/connection/mysql',
'AphrontNullView' => 'view/null',
'AphrontPageView' => 'view/page/base',
@ -49,7 +37,6 @@ phutil_register_library_map(array(
'AphrontRedirectResponse' => 'aphront/response/redirect',
'AphrontRequest' => 'aphront/request',
'AphrontResponse' => 'aphront/response/base',
'AphrontStandardPageView' => 'view/page/standard',
'AphrontTableView' => 'view/control/table',
'AphrontURIMapper' => 'aphront/mapper',
'AphrontView' => 'view/base',
@ -60,6 +47,20 @@ phutil_register_library_map(array(
'DifferentialRevisionStatus' => 'applications/review/constants/revisionstatus',
'DifferentialUnitStatus' => 'applications/review/constants/unitstatus',
'LiskDAO' => 'storage/lisk/dao',
'PhabricatorController' => 'applications/base/controller/base',
'PhabricatorDirectoryCategory' => 'applications/directory/storage/category',
'PhabricatorDirectoryCategoryDeleteController' => 'applications/directory/controller/categorydelete',
'PhabricatorDirectoryCategoryEditController' => 'applications/directory/controller/categoryedit',
'PhabricatorDirectoryCategoryListController' => 'applications/directory/controller/categorylist',
'PhabricatorDirectoryController' => 'applications/directory/controller/base',
'PhabricatorDirectoryDAO' => 'applications/directory/storage/base',
'PhabricatorDirectoryItem' => 'applications/directory/storage/item',
'PhabricatorDirectoryItemDeleteController' => 'applications/directory/controller/itemdelete',
'PhabricatorDirectoryItemEditController' => 'applications/directory/controller/itemedit',
'PhabricatorDirectoryItemListController' => 'applications/directory/controller/itemlist',
'PhabricatorDirectoryMainController' => 'applications/directory/controller/main',
'PhabricatorLiskDAO' => 'applications/base/storage/lisk',
'PhabricatorStandardPageView' => 'view/page/standard',
),
'function' =>
array(
@ -80,17 +81,6 @@ phutil_register_library_map(array(
'AphrontDefaultApplicationController' => 'AphrontController',
'AphrontDialogResponse' => 'AphrontResponse',
'AphrontDialogView' => 'AphrontView',
'AphrontDirectoryCategory' => 'AphrontDirectoryDAO',
'AphrontDirectoryCategoryDeleteController' => 'AphrontDirectoryController',
'AphrontDirectoryCategoryEditController' => 'AphrontDirectoryController',
'AphrontDirectoryCategoryListController' => 'AphrontDirectoryController',
'AphrontDirectoryController' => 'AphrontController',
'AphrontDirectoryDAO' => 'AphrontLiskDAO',
'AphrontDirectoryItem' => 'AphrontDirectoryDAO',
'AphrontDirectoryItemDeleteController' => 'AphrontDirectoryController',
'AphrontDirectoryItemEditController' => 'AphrontDirectoryController',
'AphrontDirectoryItemListController' => 'AphrontDirectoryController',
'AphrontDirectoryMainController' => 'AphrontDirectoryController',
'AphrontErrorView' => 'AphrontView',
'AphrontFormControl' => 'AphrontView',
'AphrontFormSelectControl' => 'AphrontFormControl',
@ -98,7 +88,6 @@ phutil_register_library_map(array(
'AphrontFormTextAreaControl' => 'AphrontFormControl',
'AphrontFormTextControl' => 'AphrontFormControl',
'AphrontFormView' => 'AphrontView',
'AphrontLiskDAO' => 'LiskDAO',
'AphrontMySQLDatabaseConnection' => 'AphrontDatabaseConnection',
'AphrontNullView' => 'AphrontView',
'AphrontPageView' => 'AphrontView',
@ -110,9 +99,22 @@ phutil_register_library_map(array(
'AphrontQueryParameterException' => 'AphrontQueryException',
'AphrontQueryRecoverableException' => 'AphrontQueryException',
'AphrontRedirectResponse' => 'AphrontResponse',
'AphrontStandardPageView' => 'AphrontPageView',
'AphrontTableView' => 'AphrontView',
'AphrontWebpageResponse' => 'AphrontResponse',
'PhabricatorController' => 'AphrontController',
'PhabricatorDirectoryCategory' => 'PhabricatorDirectoryDAO',
'PhabricatorDirectoryCategoryDeleteController' => 'PhabricatorDirectoryController',
'PhabricatorDirectoryCategoryEditController' => 'PhabricatorDirectoryController',
'PhabricatorDirectoryCategoryListController' => 'PhabricatorDirectoryController',
'PhabricatorDirectoryController' => 'PhabricatorController',
'PhabricatorDirectoryDAO' => 'PhabricatorLiskDAO',
'PhabricatorDirectoryItem' => 'PhabricatorDirectoryDAO',
'PhabricatorDirectoryItemDeleteController' => 'PhabricatorDirectoryController',
'PhabricatorDirectoryItemEditController' => 'PhabricatorDirectoryController',
'PhabricatorDirectoryItemListController' => 'PhabricatorDirectoryController',
'PhabricatorDirectoryMainController' => 'PhabricatorDirectoryController',
'PhabricatorLiskDAO' => 'LiskDAO',
'PhabricatorStandardPageView' => 'AphrontPageView',
),
'requires_interface' =>
array(

View file

@ -37,12 +37,4 @@ abstract class AphrontController {
return $this->request;
}
public function buildStandardPageResponse($view) {
$page = new AphrontStandardPageView();
$page->appendChild($view);
$response = new AphrontWebpageResponse();
$response->setContent($page->render());
return $response;
}
}

View file

@ -6,8 +6,5 @@
phutil_require_module('phabricator', 'aphront/response/webpage');
phutil_require_module('phabricator', 'view/page/standard');
phutil_require_source('AphrontController.php');

View file

@ -69,7 +69,7 @@ class AphrontDefaultApplicationConfiguration
'<code>'.phutil_escape_html((string)$ex).'</code>'.
'</div>';
$view = new AphrontStandardPageView();
$view = new PhabricatorStandardPageView();
$view->appendChild($content);
$response = new AphrontWebpageResponse();
@ -82,7 +82,7 @@ class AphrontDefaultApplicationConfiguration
$request = $this->getRequest();
if ($response instanceof AphrontDialogResponse) {
if (!$request->isAjax()) {
$view = new AphrontStandardPageView();
$view = new PhabricatorStandardPageView();
$view->appendChild(
'<div style="padding: 2em 0;">'.
$response->buildResponseString().

View file

@ -28,7 +28,7 @@ class AphrontDefaultApplicationController extends AphrontController {
$host = phutil_escape_html($request->getHost());
$controller_name = phutil_escape_html(get_class($this));
$page = new AphrontStandardPageView();
$page = new PhabricatorStandardPageView();
$response = new AphrontWebpageResponse();
$response->setContent($page->render());

View file

@ -0,0 +1,29 @@
<?php
/*
* Copyright 2011 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 PhabricatorController extends AphrontController {
public function buildStandardPageResponse($view) {
$page = new PhabricatorStandardPageView();
$page->appendChild($view);
$response = new AphrontWebpageResponse();
$response->setContent($page->render());
return $response;
}
}

View file

@ -17,7 +17,7 @@
*/
abstract class AphrontLiskDAO extends LiskDAO {
abstract class PhabricatorLiskDAO extends LiskDAO {
public function establishConnection($mode) {
return new AphrontMySQLDatabaseConnection(
@ -25,15 +25,18 @@ abstract class AphrontLiskDAO extends LiskDAO {
'user' => 'root',
'pass' => '',
'host' => 'localhost',
'database' => 'aphront_'.$this->getApplicationName(),
'database' => 'phabricator_'.$this->getApplicationName(),
));
}
public function getTableName() {
$str = 'phabricator';
$len = strlen($str);
$class = strtolower(get_class($this));
if (!strncmp($class, 'aphront', 7)) {
$class = substr($class, 7);
if (!strncmp($class, $str, $len)) {
$class = substr($class, $len);
}
$app = $this->getApplicationName();
if (!strncmp($class, $app, strlen($app))) {

View file

@ -10,4 +10,4 @@ phutil_require_module('phabricator', 'storage/connection/mysql');
phutil_require_module('phabricator', 'storage/lisk/dao');
phutil_require_source('AphrontLiskDAO.php');
phutil_require_source('PhabricatorLiskDAO.php');

View file

@ -16,10 +16,10 @@
* limitations under the License.
*/
abstract class AphrontDirectoryController extends AphrontController {
abstract class PhabricatorDirectoryController extends PhabricatorController {
public function buildStandardPageResponse($view, array $data) {
$page = new AphrontStandardPageView();
$page = new PhabricatorStandardPageView();
$page->setApplicationName('Directory');
$page->setBaseURI('/');

View file

@ -6,11 +6,11 @@
phutil_require_module('phabricator', 'aphront/controller');
phutil_require_module('phabricator', 'aphront/response/webpage');
phutil_require_module('phabricator', 'applications/base/controller/base');
phutil_require_module('phabricator', 'view/page/standard');
phutil_require_module('phutil', 'utils');
phutil_require_source('AphrontDirectoryController.php');
phutil_require_source('PhabricatorDirectoryController.php');

View file

@ -16,8 +16,8 @@
* limitations under the License.
*/
class AphrontDirectoryCategoryDeleteController
extends AphrontDirectoryController {
class PhabricatorDirectoryCategoryDeleteController
extends PhabricatorDirectoryController {
public function willProcessRequest(array $data) {
$this->id = $data['id'];
@ -25,7 +25,7 @@ class AphrontDirectoryCategoryDeleteController
public function processRequest() {
$category = id(new AphrontDirectoryCategory())->load($this->id);
$category = id(new PhabricatorDirectoryCategory())->load($this->id);
if (!$category) {
return new Aphront404Response();
}

View file

@ -16,4 +16,4 @@ phutil_require_module('phabricator', 'view/dialog');
phutil_require_module('phutil', 'utils');
phutil_require_source('AphrontDirectoryCategoryDeleteController.php');
phutil_require_source('PhabricatorDirectoryCategoryDeleteController.php');

View file

@ -16,8 +16,8 @@
* limitations under the License.
*/
class AphrontDirectoryCategoryEditController
extends AphrontDirectoryController {
class PhabricatorDirectoryCategoryEditController
extends PhabricatorDirectoryController {
private $id;
@ -28,12 +28,12 @@ class AphrontDirectoryCategoryEditController
public function processRequest() {
if ($this->id) {
$category = id(new AphrontDirectoryCategory())->load($this->id);
$category = id(new PhabricatorDirectoryCategory())->load($this->id);
if (!$category) {
return new Aphront404Response();
}
} else {
$category = new AphrontDirectoryCategory();
$category = new PhabricatorDirectoryCategory();
}
$e_name = true;
@ -70,7 +70,7 @@ class AphrontDirectoryCategoryEditController
$form->setAction('/directory/category/edit/');
}
$categories = id(new AphrontDirectoryCategory())->loadAll();
$categories = id(new PhabricatorDirectoryCategory())->loadAll();
$category_map = mpull($categories, 'getName', 'getID');
$form

View file

@ -18,4 +18,4 @@ phutil_require_module('phabricator', 'view/layout/panel');
phutil_require_module('phutil', 'utils');
phutil_require_source('AphrontDirectoryCategoryEditController.php');
phutil_require_source('PhabricatorDirectoryCategoryEditController.php');

View file

@ -16,11 +16,11 @@
* limitations under the License.
*/
class AphrontDirectoryCategoryListController
extends AphrontDirectoryController {
class PhabricatorDirectoryCategoryListController
extends PhabricatorDirectoryController {
public function processRequest() {
$categories = id(new AphrontDirectoryCategory())->loadAll();
$categories = id(new PhabricatorDirectoryCategory())->loadAll();
$categories = msort($categories, 'getSequence');
$rows = array();

View file

@ -15,4 +15,4 @@ phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils');
phutil_require_source('AphrontDirectoryCategoryListController.php');
phutil_require_source('PhabricatorDirectoryCategoryListController.php');

View file

@ -16,7 +16,8 @@
* limitations under the License.
*/
class AphrontDirectoryItemDeleteController extends AphrontDirectoryController {
class PhabricatorDirectoryItemDeleteController
extends PhabricatorDirectoryController {
public function willProcessRequest(array $data) {
$this->id = $data['id'];
@ -24,7 +25,7 @@ class AphrontDirectoryItemDeleteController extends AphrontDirectoryController {
public function processRequest() {
$item = id(new AphrontDirectoryItem())->load($this->id);
$item = id(new PhabricatorDirectoryItem())->load($this->id);
if (!$item) {
return new Aphront404Response();
}

View file

@ -16,4 +16,4 @@ phutil_require_module('phabricator', 'view/dialog');
phutil_require_module('phutil', 'utils');
phutil_require_source('AphrontDirectoryItemDeleteController.php');
phutil_require_source('PhabricatorDirectoryItemDeleteController.php');

View file

@ -16,7 +16,8 @@
* limitations under the License.
*/
class AphrontDirectoryItemEditController extends AphrontDirectoryController {
class PhabricatorDirectoryItemEditController
extends PhabricatorDirectoryController {
private $id;
@ -27,12 +28,12 @@ class AphrontDirectoryItemEditController extends AphrontDirectoryController {
public function processRequest() {
if ($this->id) {
$item = id(new AphrontDirectoryItem())->load($this->id);
$item = id(new PhabricatorDirectoryItem())->load($this->id);
if (!$item) {
return new Aphront404Response();
}
} else {
$item = new AphrontDirectoryItem();
$item = new PhabricatorDirectoryItem();
}
$e_name = true;
@ -78,7 +79,7 @@ class AphrontDirectoryItemEditController extends AphrontDirectoryController {
$form->setAction('/directory/item/edit/');
}
$categories = id(new AphrontDirectoryCategory())->loadAll();
$categories = id(new PhabricatorDirectoryCategory())->loadAll();
$category_map = mpull($categories, 'getName', 'getID');
$form

View file

@ -19,4 +19,4 @@ phutil_require_module('phabricator', 'view/layout/panel');
phutil_require_module('phutil', 'utils');
phutil_require_source('AphrontDirectoryItemEditController.php');
phutil_require_source('PhabricatorDirectoryItemEditController.php');

View file

@ -16,13 +16,14 @@
* limitations under the License.
*/
class AphrontDirectoryItemListController extends AphrontDirectoryController {
class PhabricatorDirectoryItemListController
extends PhabricatorDirectoryController {
public function processRequest() {
$items = id(new AphrontDirectoryItem())->loadAll();
$items = id(new PhabricatorDirectoryItem())->loadAll();
$items = msort($items, 'getSortKey');
$categories = id(new AphrontDirectoryCategory())->loadAll();
$categories = id(new PhabricatorDirectoryCategory())->loadAll();
$category_names = mpull($categories, 'getName', 'getID');
$rows = array();

View file

@ -16,4 +16,4 @@ phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils');
phutil_require_source('AphrontDirectoryItemListController.php');
phutil_require_source('PhabricatorDirectoryItemListController.php');

View file

@ -16,13 +16,14 @@
* limitations under the License.
*/
class AphrontDirectoryMainController extends AphrontDirectoryController {
class PhabricatorDirectoryMainController
extends PhabricatorDirectoryController {
public function processRequest() {
$items = id(new AphrontDirectoryItem())->loadAll();
$items = id(new PhabricatorDirectoryItem())->loadAll();
$items = msort($items, 'getSortKey');
$categories = id(new AphrontDirectoryCategory())->loadAll();
$categories = id(new PhabricatorDirectoryCategory())->loadAll();
$categories = msort($categories, 'getSequence');
$category_map = mpull($categories, 'getName', 'getID');

View file

@ -14,4 +14,4 @@ phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils');
phutil_require_source('AphrontDirectoryMainController.php');
phutil_require_source('PhabricatorDirectoryMainController.php');

View file

@ -16,7 +16,7 @@
* limitations under the License.
*/
abstract class AphrontDirectoryDAO extends AphrontLiskDAO {
abstract class PhabricatorDirectoryDAO extends PhabricatorLiskDAO {
public function getApplicationName() {
return 'directory';

View file

@ -6,7 +6,7 @@
phutil_require_module('phabricator', 'aphront/storage/lisk');
phutil_require_module('phabricator', 'applications/base/storage/lisk');
phutil_require_source('AphrontDirectoryDAO.php');
phutil_require_source('PhabricatorDirectoryDAO.php');

View file

@ -16,7 +16,7 @@
* limitations under the License.
*/
class AphrontDirectoryCategory extends AphrontDirectoryDAO {
class PhabricatorDirectoryCategory extends PhabricatorDirectoryDAO {
protected $name;
protected $sequence;

View file

@ -9,4 +9,4 @@
phutil_require_module('phabricator', 'applications/directory/storage/base');
phutil_require_source('AphrontDirectoryCategory.php');
phutil_require_source('PhabricatorDirectoryCategory.php');

View file

@ -16,7 +16,7 @@
* limitations under the License.
*/
class AphrontDirectoryItem extends AphrontDirectoryDAO {
class PhabricatorDirectoryItem extends PhabricatorDirectoryDAO {
protected $name;
protected $description;

View file

@ -9,4 +9,4 @@
phutil_require_module('phabricator', 'applications/directory/storage/base');
phutil_require_source('AphrontDirectoryItem.php');
phutil_require_source('PhabricatorDirectoryItem.php');

View file

@ -16,7 +16,7 @@
* limitations under the License.
*/
class AphrontStandardPageView extends AphrontPageView {
class PhabricatorStandardPageView extends AphrontPageView {
private $baseURI;
private $applicationName;

View file

@ -12,4 +12,4 @@ phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils');
phutil_require_source('AphrontStandardPageView.php');
phutil_require_source('PhabricatorStandardPageView.php');