1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00

RevisionEdit

This commit is contained in:
epriestley 2011-01-25 13:26:09 -08:00
parent 16ad2386d8
commit 14163aaeef
6 changed files with 164 additions and 7 deletions

View file

@ -76,6 +76,7 @@ phutil_register_library_map(array(
'DifferentialLintStatus' => 'applications/differential/constants/lintstatus',
'DifferentialRevision' => 'applications/differential/storage/revision',
'DifferentialRevisionControlSystem' => 'applications/differential/constants/revisioncontrolsystem',
'DifferentialRevisionEditController' => 'applications/differential/controller/revisionedit',
'DifferentialRevisionStatus' => 'applications/differential/constants/revisionstatus',
'DifferentialUnitStatus' => 'applications/differential/constants/unitstatus',
'Javelin' => 'infratructure/javelin/api',
@ -128,7 +129,7 @@ phutil_register_library_map(array(
array(
'_qsprintf_check_scalar_type' => 'storage/qsprintf',
'_qsprintf_check_type' => 'storage/qsprintf',
'celerity_gen_unique_node_id' => 'infratructure/celerity/api',
'celerity_generate_unique_node_id' => 'infratructure/celerity/api',
'celerity_register_resource_map' => 'infratructure/celerity/map',
'javelin_render_tag' => 'infratructure/javelin/markup',
'qsprintf' => 'storage/qsprintf',
@ -191,6 +192,7 @@ phutil_register_library_map(array(
'DifferentialDiffViewController' => 'DifferentialController',
'DifferentialHunk' => 'DifferentialDAO',
'DifferentialRevision' => 'DifferentialDAO',
'DifferentialRevisionEditController' => 'DifferentialController',
'PhabricatorConduitAPIController' => 'PhabricatorConduitController',
'PhabricatorConduitConnectionLog' => 'PhabricatorConduitDAO',
'PhabricatorConduitConsoleController' => 'PhabricatorConduitController',

View file

@ -79,14 +79,14 @@ class AphrontDefaultApplicationConfiguration
'/differential/' => array(
'diff/(?<id>\d+)/$' => 'DifferentialDiffViewController',
'changeset/(?<id>\d+)/$' => 'DifferentialChangesetViewController',
'revision/edit/(?:(?<id>\d+)/)?$'
=> 'DifferentialRevisionEditController',
),
'/res/' => array(
'(?<hash>[a-f0-9]{8})/(?<path>.+\.(?:css|js))$'
=> 'CelerityResourceController',
),
'.*' => 'AphrontDefaultApplicationController',
);
}

View file

@ -0,0 +1,135 @@
<?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.
*/
class DifferentialRevisionEditController extends DifferentialController {
private $id;
public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}
public function processRequest() {
if ($this->id) {
$revision = id(new DifferentialRevision())->load($this->id);
if (!$revision) {
return new Aphront404Response();
}
} else {
$revision = new DifferentialRevision();
}
/*
$e_name = true;
$errors = array();
$request = $this->getRequest();
if ($request->isFormPost()) {
$category->setName($request->getStr('name'));
$category->setSequence($request->getStr('sequence'));
if (!strlen($category->getName())) {
$errors[] = 'Category name is required.';
$e_name = 'Required';
}
if (!$errors) {
$category->save();
return id(new AphrontRedirectResponse())
->setURI('/directory/category/');
}
}
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())
->setTitle('Form Errors')
->setErrors($errors);
}
*/
$e_name = true;
$form = new AphrontFormView();
if ($revision->getID()) {
$form->setAction('/differential/revision/edit/'.$category->getID().'/');
} else {
$form->setAction('/differential/revision/edit/');
}
$form
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel('Name')
->setName('name')
->setValue($revision->getName())
->setError($e_name))
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel('Summary')
->setName('summary')
->setValue($revision->getSummary()))
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel('Test Plan')
->setName('testplan')
->setValue($revision->getTestPlan())
->setError($e_testplan))
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel('Reviewers')
->setName('reviewers'))
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel('CC')
->setName('cc'))
->appendChild(
id(new AphrontFormTextControl())
->setLabel('Blame Revision')
->setName('blame')
->setValue($revision->getBlameRevision())
->setCaption('Revision which broke the stuff which this '.
'change fixes.'))
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel('Revert')
->setName('revert')
->setValue($revision->getRevertPlan())
->setCaption('Special steps required to safely revert this change.'))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue('Save'));
$panel = new AphrontPanelView();
if ($revision->getID()) {
$panel->setHeader('Edit Differential Revision');
} else {
$panel->setHeader('Create New Differential Revision');
}
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
$error_view = null;
return $this->buildStandardPageResponse(
array($error_view, $panel),
array(
'title' => 'Edit Differential Revision',
));
}
}

View file

@ -0,0 +1,19 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'aphront/response/404');
phutil_require_module('phabricator', 'applications/differential/controller/base');
phutil_require_module('phabricator', 'applications/differential/storage/revision');
phutil_require_module('phabricator', 'view/form/base');
phutil_require_module('phabricator', 'view/form/control/submit');
phutil_require_module('phabricator', 'view/layout/panel');
phutil_require_module('phutil', 'utils');
phutil_require_source('DifferentialRevisionEditController.php');

View file

@ -23,7 +23,8 @@ class DifferentialRevision extends DifferentialDAO {
protected $summary;
protected $testPlan;
protected $revert;
protected $revertPlan;
protected $blameRevision;
protected $phid;
protected $ownerPHID;

View file

@ -10,7 +10,7 @@
.aphront-form-view label {
padding-top: 4px;
width: 14%;
width: 19%;
float: left;
text-align: right;
font-weight: bold;
@ -19,9 +19,9 @@
}
.aphront-form-input {
margin-left: 15%;
margin-left: 20%;
margin-right: 25%;
width: 60%;
width: 55%;
}
.aphront-form-error {