mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Simplify PHUIObjectBoxViews handling of Save and Error states
Summary: This removes the bulk of the "Form Errors" text, some variations likely exists. These are a bit redundant and space consuming. I'd also like to back ErrorView more into PHUIObjectBox. Test Plan: Test out the forms, see errors without the text. Reviewers: epriestley, btrahan CC: Korvin, epriestley, aran, hach-que Differential Revision: https://secure.phabricator.com/D7924
This commit is contained in:
parent
2ee4507486
commit
b74c7a3d37
64 changed files with 107 additions and 457 deletions
|
@ -7,7 +7,7 @@
|
|||
return array(
|
||||
'names' =>
|
||||
array(
|
||||
'core.pkg.css' => '3c41daee',
|
||||
'core.pkg.css' => '9567aaae',
|
||||
'core.pkg.js' => 'c907bd96',
|
||||
'darkconsole.pkg.js' => 'ca8671ce',
|
||||
'differential.pkg.css' => '827749c1',
|
||||
|
@ -23,7 +23,7 @@ return array(
|
|||
'rsrc/css/aphront/context-bar.css' => '1c3b0529',
|
||||
'rsrc/css/aphront/dark-console.css' => '6378ef3d',
|
||||
'rsrc/css/aphront/dialog-view.css' => 'dd9db96c',
|
||||
'rsrc/css/aphront/error-view.css' => '472968e0',
|
||||
'rsrc/css/aphront/error-view.css' => 'ca515eae',
|
||||
'rsrc/css/aphront/lightbox-attachment.css' => '686f8885',
|
||||
'rsrc/css/aphront/list-filter-view.css' => '9577c6da',
|
||||
'rsrc/css/aphront/multi-column.css' => '05bbd016',
|
||||
|
@ -475,7 +475,7 @@ return array(
|
|||
'aphront-contextbar-view-css' => '1c3b0529',
|
||||
'aphront-dark-console-css' => '6378ef3d',
|
||||
'aphront-dialog-view-css' => 'dd9db96c',
|
||||
'aphront-error-view-css' => '472968e0',
|
||||
'aphront-error-view-css' => 'ca515eae',
|
||||
'aphront-list-filter-view-css' => '9577c6da',
|
||||
'aphront-multi-column-view-css' => '05bbd016',
|
||||
'aphront-notes' => '6acadd3f',
|
||||
|
|
|
@ -304,13 +304,6 @@ final class PhabricatorAuthRegisterController
|
|||
unset($unguarded);
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle(pht('Registration Failed'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($request->getUser());
|
||||
|
||||
|
@ -424,7 +417,7 @@ final class PhabricatorAuthRegisterController
|
|||
$object_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setForm($form)
|
||||
->setFormError($error_view);
|
||||
->setFormErrors($errors);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
|
|
|
@ -153,10 +153,6 @@ final class PhabricatorAuthEditController
|
|||
$issues = array();
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())->setErrors($errors);
|
||||
}
|
||||
|
||||
if ($is_new) {
|
||||
$button = pht('Add Provider');
|
||||
$crumb = pht('Add Provider');
|
||||
|
@ -302,7 +298,7 @@ final class PhabricatorAuthEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -37,10 +37,6 @@ final class PhabricatorAuthNewController
|
|||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())->setErrors($errors);
|
||||
}
|
||||
|
||||
$options = id(new AphrontFormRadioButtonControl())
|
||||
->setLabel(pht('Provider'))
|
||||
->setName('provider')
|
||||
|
@ -83,7 +79,7 @@ final class PhabricatorAuthNewController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Add Authentication Provider'))
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
|
|
|
@ -165,7 +165,7 @@ final class PhabricatorCalendarEditStatusController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($page_title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$nav = $this->buildSideNavView($status);
|
||||
|
|
|
@ -112,7 +112,7 @@ final class PhabricatorConduitConsoleController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($method->getAPIMethodName())
|
||||
->setFormError($status_view)
|
||||
->setErrorView($status_view)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
|
|
|
@ -195,9 +195,12 @@ final class PhabricatorConfigEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setForm($form);
|
||||
|
||||
if ($error_view) {
|
||||
$form_box->setErrorView($error_view);
|
||||
}
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb(pht('Config'), $this->getApplicationURI());
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ final class PhabricatorCountdownEditController
|
|||
$countdown = PhabricatorCountdown::initializeNewCountdown($user);
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
$e_text = true;
|
||||
$e_epoch = null;
|
||||
|
||||
|
@ -71,11 +70,6 @@ final class PhabricatorCountdownEditController
|
|||
$countdown->save();
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/countdown/'.$countdown->getID().'/');
|
||||
} else {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setErrors($errors)
|
||||
->setTitle(pht('It\'s not The Final Countdown (du nu nuuu nun)' .
|
||||
' until you fix these problem'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +129,7 @@ final class PhabricatorCountdownEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($page_title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -84,14 +84,8 @@ final class DifferentialDiffCreateController extends DifferentialController {
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Create New Diff'))
|
||||
->setForm($form);
|
||||
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setSeverity(AphrontErrorView::SEVERITY_ERROR)
|
||||
->appendChild($errors);
|
||||
$form_box->setFormError($error_view);
|
||||
}
|
||||
->setForm($form)
|
||||
->setFormErrors($errors);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb(pht('Create Diff'));
|
||||
|
|
|
@ -108,13 +108,6 @@ final class DifferentialRevisionEditController extends DifferentialController {
|
|||
$form->setAction('/differential/revision/edit/');
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
if ($diff && $revision->getID()) {
|
||||
$form
|
||||
->appendChild(
|
||||
|
@ -168,7 +161,7 @@ final class DifferentialRevisionEditController extends DifferentialController {
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs->addTextCrumb($title);
|
||||
|
|
|
@ -269,7 +269,7 @@ final class DiffusionCommitController extends DiffusionController {
|
|||
->appendChild(
|
||||
pht("This commit is very large. Load each file individually."));
|
||||
|
||||
$change_panel->setFormError($warning_view);
|
||||
$change_panel->setErrorView($warning_view);
|
||||
$header->addActionLink($button);
|
||||
}
|
||||
|
||||
|
|
|
@ -83,14 +83,6 @@ final class DiffusionRepositoryEditBasicController
|
|||
$crumbs->addTextCrumb(pht('Edit Basics'));
|
||||
|
||||
$title = pht('Edit %s', $repository->getName());
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$project_handles = $this->loadViewerHandles($repository->getProjectPHIDs());
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
|
@ -122,7 +114,7 @@ final class DiffusionRepositoryEditBasicController
|
|||
$object_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setForm($form)
|
||||
->setFormError($error_view);
|
||||
->setFormErrors($errors);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
|
|
|
@ -61,13 +61,6 @@ final class DiffusionRepositoryEditEncodingController
|
|||
|
||||
$title = pht('Edit %s', $repository->getName());
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($user)
|
||||
->appendRemarkupInstructions($this->getEncodingInstructions())
|
||||
|
@ -85,7 +78,7 @@ final class DiffusionRepositoryEditEncodingController
|
|||
$object_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setForm($form)
|
||||
->setFormError($error_view);
|
||||
->setFormErrors($errors);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
|
|
|
@ -33,13 +33,6 @@ final class DiffusionRepositoryEditLocalController
|
|||
|
||||
$title = pht('Edit %s', $repository->getName());
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($user)
|
||||
->appendRemarkupInstructions(
|
||||
|
@ -61,7 +54,7 @@ final class DiffusionRepositoryEditLocalController
|
|||
$object_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setForm($form)
|
||||
->setFormError($error_view);
|
||||
->setFormErrors($errors);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
|
|
|
@ -86,13 +86,6 @@ final class DiffusionSetPasswordPanel extends PhabricatorSettingsPanel {
|
|||
|
||||
$title = pht('Set VCS Password');
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($user)
|
||||
->appendRemarkupInstructions(
|
||||
|
@ -165,7 +158,7 @@ final class DiffusionSetPasswordPanel extends PhabricatorSettingsPanel {
|
|||
$object_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setForm($form)
|
||||
->setFormError($error_view);
|
||||
->setFormErrors($errors);
|
||||
|
||||
$remove_form = id(new AphrontFormView())
|
||||
->setUser($user);
|
||||
|
|
|
@ -29,12 +29,6 @@ final class DrydockBlueprintCreateController
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$control = id(new AphrontFormRadioButtonControl())
|
||||
->setName('blueprint-type')
|
||||
->setLabel(pht('Blueprint Type'))
|
||||
|
@ -69,7 +63,7 @@ final class DrydockBlueprintCreateController
|
|||
->setValue(pht('Continue')));
|
||||
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setHeaderText($title)
|
||||
->setForm($form);
|
||||
|
||||
|
|
|
@ -86,11 +86,6 @@ final class DrydockBlueprintEditController extends DrydockBlueprintController {
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())->setErrors($errors);
|
||||
}
|
||||
|
||||
$policies = id(new PhabricatorPolicyQuery())
|
||||
->setViewer($viewer)
|
||||
->setObject($blueprint)
|
||||
|
@ -144,7 +139,7 @@ final class DrydockBlueprintEditController extends DrydockBlueprintController {
|
|||
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($header)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -64,18 +64,12 @@ final class PhabricatorFileUploadController extends PhabricatorFileController {
|
|||
|
||||
$title = pht('Upload File');
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$global_upload = id(new PhabricatorGlobalUploadTargetView())
|
||||
->setShowIfSupportedID($support_id);
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -98,10 +98,6 @@ final class HeraldNewController extends HeraldController {
|
|||
$content_type = $request->getStr('content_type');
|
||||
$rule_type = $request->getStr('rule_type');
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($viewer)
|
||||
->setAction($this->getApplicationURI('new/'));
|
||||
|
@ -203,7 +199,7 @@ final class HeraldNewController extends HeraldController {
|
|||
->addCancelButton($cancel_uri, $cancel_text));
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setHeaderText(pht('Create Herald Rule'))
|
||||
->setForm($form);
|
||||
|
||||
|
|
|
@ -118,14 +118,6 @@ final class HeraldRuleController extends HeraldController {
|
|||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
$error_view->setErrors($errors);
|
||||
} else {
|
||||
$error_view = null;
|
||||
}
|
||||
|
||||
$must_match_selector = $this->renderMustMatchSelector($rule);
|
||||
$repetition_selector = $this->renderRepetitionSelector($rule, $adapter);
|
||||
|
||||
|
@ -233,7 +225,7 @@ final class HeraldRuleController extends HeraldController {
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this
|
||||
|
|
|
@ -74,14 +74,6 @@ final class HeraldTestConsoleController extends HeraldController {
|
|||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
$error_view->setErrors($errors);
|
||||
} else {
|
||||
$error_view = null;
|
||||
}
|
||||
|
||||
$text = pht(
|
||||
'Enter an object to test rules for, like a Diffusion commit (e.g., '.
|
||||
'rX123) or a Differential revision (e.g., D123). You will be shown '.
|
||||
|
@ -103,7 +95,7 @@ final class HeraldTestConsoleController extends HeraldController {
|
|||
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Herald Test Console'))
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = id($this->buildApplicationCrumbs())
|
||||
|
|
|
@ -102,11 +102,7 @@ final class LegalpadDocumentEditController extends LegalpadController {
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('A Fatal Omission!'))
|
||||
->setErrors($errors);
|
||||
// set these to what was specified in the form on post
|
||||
$document->setViewPolicy($can_view);
|
||||
$document->setEditPolicy($can_edit);
|
||||
|
@ -169,7 +165,7 @@ final class LegalpadDocumentEditController extends LegalpadController {
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs($this->buildSideNav());
|
||||
|
|
|
@ -220,7 +220,7 @@ final class LegalpadDocumentSignController extends LegalpadController {
|
|||
|
||||
return id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Sign and Agree'))
|
||||
->setFormError($error_view)
|
||||
->setErrorView($error_view)
|
||||
->setForm($form);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,14 +82,6 @@ final class PhabricatorMacroAudioController
|
|||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
$error_view->setErrors($errors);
|
||||
} else {
|
||||
$error_view = null;
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->addHiddenInput('behaviorForm', 1)
|
||||
->setUser($viewer);
|
||||
|
@ -152,7 +144,7 @@ final class PhabricatorMacroAudioController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -135,14 +135,6 @@ final class PhabricatorMacroEditController
|
|||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
$error_view->setErrors($errors);
|
||||
} else {
|
||||
$error_view = null;
|
||||
}
|
||||
|
||||
$current_file = null;
|
||||
if ($macro->getFilePHID()) {
|
||||
$current_file = $macro->getFile();
|
||||
|
@ -257,7 +249,7 @@ final class PhabricatorMacroEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -74,13 +74,6 @@ final class PhabricatorMailingListsEditController
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = new AphrontFormView();
|
||||
$form->setUser($request->getUser());
|
||||
if ($list->getID()) {
|
||||
|
@ -124,7 +117,7 @@ final class PhabricatorMailingListsEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($page_title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -419,7 +419,6 @@ final class ManiphestTaskEditController extends ManiphestController {
|
|||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setErrors($errors);
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
}
|
||||
|
||||
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
|
||||
|
@ -650,7 +649,7 @@ final class ManiphestTaskEditController extends ManiphestController {
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($header_name)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$preview = id(new PHUIRemarkupPreviewPanel())
|
||||
|
|
|
@ -164,10 +164,8 @@ abstract class NuanceSourceDefinition extends Phobject {
|
|||
$layout = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($this->getEditTitle())
|
||||
->setValidationException($validation_exception)
|
||||
->setFormErrors($error_messages)
|
||||
->setForm($form);
|
||||
if ($error_messages) {
|
||||
$layout->setFormError($this->renderEditErrorView($error_messages));
|
||||
}
|
||||
|
||||
return $layout;
|
||||
}
|
||||
|
@ -237,15 +235,6 @@ abstract class NuanceSourceDefinition extends Phobject {
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* return @{class:AphrontErrorView}
|
||||
*/
|
||||
public function renderEditErrorView(array $errors) {
|
||||
return id(new AphrontErrorView())
|
||||
->setTitle(pht('Error with submission.'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to build up @{class:PhabricatorTransactions}.
|
||||
*
|
||||
|
|
|
@ -112,13 +112,6 @@ final class PhabricatorOwnersEditController
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle(pht('Package Errors'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
$handles = $this->loadViewerHandles($owners);
|
||||
|
||||
$primary = $package->getPrimaryOwnerPHID();
|
||||
|
@ -252,7 +245,7 @@ final class PhabricatorOwnersEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$nav = $this->buildSideNavView();
|
||||
|
|
|
@ -26,12 +26,6 @@ final class PassphraseCredentialCreateController extends PassphraseController {
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$types_control = id(new AphrontFormRadioButtonControl())
|
||||
->setName('type')
|
||||
->setLabel(pht('Credential Type'))
|
||||
|
@ -59,7 +53,7 @@ final class PassphraseCredentialCreateController extends PassphraseController {
|
|||
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Create New Credential'))
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -123,13 +123,6 @@ final class PhabricatorPasteEditController extends PhabricatorPasteController {
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('A Fatal Omission!'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = new AphrontFormView();
|
||||
|
||||
$langs = array(
|
||||
|
@ -207,7 +200,7 @@ final class PhabricatorPasteEditController extends PhabricatorPasteController {
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView());
|
||||
|
|
|
@ -214,13 +214,6 @@ final class PhabricatorPeopleEditController
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = new AphrontFormView();
|
||||
$form->setUser($admin);
|
||||
if ($user->getID()) {
|
||||
|
@ -347,7 +340,7 @@ final class PhabricatorPeopleEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return array($form_box);
|
||||
|
@ -396,14 +389,6 @@ final class PhabricatorPeopleEditController
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($admin)
|
||||
->setAction($request->getRequestURI()->alter('saved', null));
|
||||
|
@ -452,7 +437,7 @@ final class PhabricatorPeopleEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return array($form_box);
|
||||
|
@ -537,14 +522,6 @@ final class PhabricatorPeopleEditController
|
|||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
} else {
|
||||
$errors = null;
|
||||
}
|
||||
|
||||
$inst1 = pht('Be careful when renaming users!');
|
||||
$inst2 = pht('The old username will no longer be tied to the user, so '.
|
||||
'anything which uses it (like old commit messages) will no longer '.
|
||||
|
@ -590,7 +567,7 @@ final class PhabricatorPeopleEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Change Username'))
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return array($form_box);
|
||||
|
@ -636,14 +613,6 @@ final class PhabricatorPeopleEditController
|
|||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
} else {
|
||||
$errors = null;
|
||||
}
|
||||
|
||||
$str1 = pht('Be careful when deleting users!');
|
||||
$str2 = pht('If this user interacted with anything, it is generally '.
|
||||
'better to disable them, not delete them. If you delete them, it will '.
|
||||
|
@ -683,7 +652,7 @@ final class PhabricatorPeopleEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Delete User'))
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return array($form_box);
|
||||
|
|
|
@ -258,7 +258,7 @@ final class PhabricatorPeopleProfilePictureController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$upload_form = id(new AphrontFormView())
|
||||
|
@ -276,15 +276,6 @@ final class PhabricatorPeopleProfilePictureController
|
|||
->addCancelButton($profile_uri)
|
||||
->setValue(pht('Upload Picture')));
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())->setErrors($errors);
|
||||
}
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($errors)
|
||||
->setForm($form);
|
||||
|
||||
$upload_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Upload New Picture'))
|
||||
->setForm($upload_form);
|
||||
|
|
|
@ -162,17 +162,9 @@ final class PhameBlogEditController
|
|||
->addCancelButton($cancel_uri)
|
||||
->setValue($submit_button));
|
||||
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
} else {
|
||||
$error_view = null;
|
||||
}
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($page_title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
|
|
|
@ -163,17 +163,9 @@ final class PhamePostEditController
|
|||
'uri' => '/phame/post/preview/',
|
||||
));
|
||||
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Errors saving post.'))
|
||||
->setErrors($errors);
|
||||
} else {
|
||||
$error_view = null;
|
||||
}
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($page_title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
|
|
|
@ -109,11 +109,6 @@ final class PhluxEditController extends PhluxController {
|
|||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$policies = id(new PhabricatorPolicyQuery())
|
||||
->setViewer($user)
|
||||
->setObject($var)
|
||||
|
@ -172,7 +167,7 @@ final class PhluxEditController extends PhluxController {
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -199,14 +199,6 @@ final class PholioMockEditController extends PholioController {
|
|||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
} else {
|
||||
$error_view = null;
|
||||
}
|
||||
|
||||
if ($this->id) {
|
||||
$submit = id(new AphrontFormSubmitControl())
|
||||
->addCancelButton('/M'.$this->id)
|
||||
|
@ -322,7 +314,7 @@ final class PholioMockEditController extends PholioController {
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
|
|
|
@ -32,10 +32,8 @@ final class PhragmentSnapshotCreateController extends PhragmentController {
|
|||
->withLeadingPath($fragment->getPath().'/')
|
||||
->execute();
|
||||
|
||||
$error_view = null;
|
||||
|
||||
$errors = array();
|
||||
if ($request->isFormPost()) {
|
||||
$errors = array();
|
||||
|
||||
$v_name = $request->getStr('name');
|
||||
if (strlen($v_name) === 0) {
|
||||
|
@ -79,10 +77,6 @@ final class PhragmentSnapshotCreateController extends PhragmentController {
|
|||
->setURI('/phragment/snapshot/view/'.$snapshot->getID());
|
||||
}
|
||||
}
|
||||
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setErrors($errors)
|
||||
->setTitle(pht('Errors while creating snapshot'));
|
||||
}
|
||||
|
||||
$fragment_sequence = "-";
|
||||
|
@ -158,7 +152,7 @@ final class PhragmentSnapshotCreateController extends PhragmentController {
|
|||
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Create Snapshot of %s', $fragment->getName()))
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -149,13 +149,6 @@ final class PhrictionEditController
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
if ($document->getID()) {
|
||||
$panel_header = pht('Edit Phriction Document');
|
||||
$submit_button = pht('Save Changes');
|
||||
|
@ -230,7 +223,7 @@ final class PhrictionEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Edit Document'))
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$preview = id(new PHUIRemarkupPreviewPanel())
|
||||
|
|
|
@ -111,7 +111,6 @@ final class PhrictionMoveController
|
|||
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,10 +61,6 @@ final class PonderAnswerEditController extends PonderController {
|
|||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())->setErrors($errors);
|
||||
}
|
||||
|
||||
$answer_content_id = celerity_generate_unique_node_id();
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
|
@ -91,7 +87,7 @@ final class PonderAnswerEditController extends PonderController {
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Edit Answer'))
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$preview = id(new PHUIRemarkupPreviewPanel())
|
||||
|
|
|
@ -76,13 +76,6 @@ final class PonderQuestionEditController extends PonderController {
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($user)
|
||||
->appendChild(
|
||||
|
@ -110,7 +103,7 @@ final class PonderQuestionEditController extends PonderController {
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Ask New Question'))
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
|
|
|
@ -63,11 +63,6 @@ final class PhabricatorProjectBoardEditController
|
|||
return id(new AphrontRedirectResponse())->setURI($view_uri);
|
||||
}
|
||||
}
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = new AphrontFormView();
|
||||
$form->setUser($request->getUser())
|
||||
|
@ -98,7 +93,7 @@ final class PhabricatorProjectBoardEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -67,7 +67,6 @@ final class PhabricatorProjectCreateController
|
|||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
|
@ -118,7 +117,7 @@ final class PhabricatorProjectCreateController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Create New Project'))
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -93,13 +93,6 @@ final class PhabricatorProjectProfileEditController
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
$header_name = pht('Edit Project');
|
||||
$title = pht('Edit Project');
|
||||
$action = '/project/edit/'.$project->getID().'/';
|
||||
|
@ -162,7 +155,7 @@ final class PhabricatorProjectProfileEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView())
|
||||
|
|
|
@ -222,11 +222,6 @@ final class PhabricatorProjectProfilePictureController
|
|||
->setLabel(pht('Quick Create'))
|
||||
->setValue($compose_form));
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($errors)
|
||||
->setForm($form);
|
||||
|
||||
$upload_form = id(new AphrontFormView())
|
||||
->setUser($viewer)
|
||||
->setEncType('multipart/form-data')
|
||||
|
@ -242,13 +237,9 @@ final class PhabricatorProjectProfilePictureController
|
|||
->addCancelButton($project_uri)
|
||||
->setValue(pht('Upload Picture')));
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())->setErrors($errors);
|
||||
}
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$upload_box = id(new PHUIObjectBoxView())
|
||||
|
|
|
@ -68,7 +68,6 @@ final class ReleephBranchCreateController extends ReleephProjectController {
|
|||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setErrors($errors);
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
}
|
||||
|
||||
$project_id = $releeph_project->getID();
|
||||
|
|
|
@ -52,12 +52,6 @@ final class ReleephProjectCreateController extends ReleephProjectController {
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
$arc_project_options = $this->getArcProjectSelectOptions($arc_projects);
|
||||
|
||||
$project_name_input = id(new AphrontFormTextControl())
|
||||
|
@ -110,7 +104,7 @@ final class ReleephProjectCreateController extends ReleephProjectController {
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Create New Project'))
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
|
|
|
@ -116,7 +116,6 @@ final class ReleephProjectEditController extends ReleephProjectController {
|
|||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setErrors($errors);
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
}
|
||||
|
||||
$projects = mpull(
|
||||
|
|
|
@ -204,7 +204,6 @@ final class ReleephRequestEditController extends ReleephProjectController {
|
|||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setErrors($errors);
|
||||
$error_view->setTitle('Form Errors');
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
|
|
|
@ -66,11 +66,6 @@ final class PhabricatorSearchEditController
|
|||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($user);
|
||||
|
||||
|
@ -94,7 +89,7 @@ final class PhabricatorSearchEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
|
|
|
@ -51,21 +51,6 @@ final class PhabricatorSettingsPanelAccount
|
|||
}
|
||||
}
|
||||
|
||||
$notice = null;
|
||||
if (!$errors) {
|
||||
if ($request->getStr('saved')) {
|
||||
$notice = new AphrontErrorView();
|
||||
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
|
||||
$notice->setTitle(pht('Changes Saved'));
|
||||
$notice->appendChild(
|
||||
phutil_tag('p', array(), pht('Your changes have been saved.')));
|
||||
$notice = $notice->render();
|
||||
}
|
||||
} else {
|
||||
$notice = new AphrontErrorView();
|
||||
$notice->setErrors($errors);
|
||||
}
|
||||
|
||||
$timezone_ids = DateTimeZone::listIdentifiers();
|
||||
$timezone_id_map = array_fuse($timezone_ids);
|
||||
|
||||
|
@ -139,10 +124,11 @@ final class PhabricatorSettingsPanelAccount
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Account Settings'))
|
||||
->setFormSaved($request->getStr('saved'))
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return array(
|
||||
$notice,
|
||||
$form_box,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -59,16 +59,18 @@ final class PhabricatorSettingsPanelConpherencePreferences
|
|||
$error_view = null;
|
||||
if ($request->getBool('saved')) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Preferences Saved'))
|
||||
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
|
||||
->setErrors(array(pht('Your preferences have been saved.')));
|
||||
->appendChild(pht('Preferences Saved'))
|
||||
->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
|
||||
}
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Conpherence Preferences'))
|
||||
->setFormError($error_view)
|
||||
->setForm($form);
|
||||
|
||||
if ($error_view) {
|
||||
$form_box->setErrorView($error_view);
|
||||
}
|
||||
|
||||
return array(
|
||||
$form_box,
|
||||
);
|
||||
|
|
|
@ -85,17 +85,9 @@ final class PhabricatorSettingsPanelDeveloperPreferences
|
|||
id(new AphrontFormSubmitControl())
|
||||
->setValue(pht('Save Preferences')));
|
||||
|
||||
$error_view = null;
|
||||
if ($request->getBool('saved')) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Preferences Saved'))
|
||||
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
|
||||
->setErrors(array(pht('Your preferences have been saved.')));
|
||||
}
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Developer Settings'))
|
||||
->setFormError($error_view)
|
||||
->setFormSaved($request->getBool('saved'))
|
||||
->setForm($form);
|
||||
|
||||
return array(
|
||||
|
|
|
@ -58,17 +58,9 @@ final class PhabricatorSettingsPanelDiffPreferences
|
|||
id(new AphrontFormSubmitControl())
|
||||
->setValue(pht('Save Preferences')));
|
||||
|
||||
$error_view = null;
|
||||
if ($request->getBool('saved')) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Preferences Saved'))
|
||||
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
|
||||
->setErrors(array(pht('Your preferences have been saved.')));
|
||||
}
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Diff Preferences'))
|
||||
->setFormError($error_view)
|
||||
->setFormSaved($request->getBool('saved'))
|
||||
->setForm($form);
|
||||
|
||||
return array(
|
||||
|
|
|
@ -137,17 +137,9 @@ EXAMPLE;
|
|||
id(new AphrontFormSubmitControl())
|
||||
->setValue(pht('Save Preferences')));
|
||||
|
||||
$error_view = null;
|
||||
if ($request->getStr('saved') === 'true') {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Preferences Saved'))
|
||||
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
|
||||
->setErrors(array(pht('Your preferences have been saved.')));
|
||||
}
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Display Preferences'))
|
||||
->setFormError($error_view)
|
||||
->setFormSaved($request->getStr('saved') === 'true')
|
||||
->setForm($form);
|
||||
|
||||
return array(
|
||||
|
|
|
@ -69,21 +69,6 @@ final class PhabricatorSettingsPanelEmailPreferences
|
|||
->setURI($this->getPanelURI('?saved=true'));
|
||||
}
|
||||
|
||||
$notice = null;
|
||||
if (!$errors) {
|
||||
if ($request->getStr('saved')) {
|
||||
$notice = new AphrontErrorView();
|
||||
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
|
||||
$notice->setTitle(pht('Changes Saved'));
|
||||
$notice->appendChild(
|
||||
phutil_tag('p', array(), pht('Your changes have been saved.')));
|
||||
}
|
||||
} else {
|
||||
$notice = new AphrontErrorView();
|
||||
$notice->setTitle(pht('Form Errors'));
|
||||
$notice->setErrors($errors);
|
||||
}
|
||||
|
||||
$re_prefix_default = PhabricatorEnv::getEnvConfig('metamta.re-prefix')
|
||||
? pht('Enabled')
|
||||
: pht('Disabled');
|
||||
|
@ -218,7 +203,8 @@ final class PhabricatorSettingsPanelEmailPreferences
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Email Preferences'))
|
||||
->setFormError($notice)
|
||||
->setFormSaved($request->getStr('saved'))
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return id(new AphrontNullView())
|
||||
|
|
|
@ -108,21 +108,6 @@ final class PhabricatorSettingsPanelPassword
|
|||
}
|
||||
}
|
||||
|
||||
$notice = null;
|
||||
if (!$errors) {
|
||||
if ($request->getStr('saved')) {
|
||||
$notice = new AphrontErrorView();
|
||||
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
|
||||
$notice->setTitle(pht('Changes Saved'));
|
||||
$notice->appendChild(
|
||||
phutil_tag('p', array(), pht('Your password has been updated.')));
|
||||
}
|
||||
} else {
|
||||
$notice = new AphrontErrorView();
|
||||
$notice->setTitle(pht('Error Changing Password'));
|
||||
$notice->setErrors($errors);
|
||||
}
|
||||
|
||||
$len_caption = null;
|
||||
if ($min_len) {
|
||||
$len_caption = pht('Minimum password length: %d characters.', $min_len);
|
||||
|
@ -161,7 +146,8 @@ final class PhabricatorSettingsPanelPassword
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Change Password'))
|
||||
->setFormError($notice)
|
||||
->setFormSaved($request->getStr('saved'))
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return array(
|
||||
|
|
|
@ -126,13 +126,6 @@ final class PhabricatorSettingsPanelSSHKeys
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
$is_new = !$key->getID();
|
||||
|
||||
if ($is_new) {
|
||||
|
@ -165,7 +158,7 @@ final class PhabricatorSettingsPanelSSHKeys
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($header)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $form_box;
|
||||
|
|
|
@ -50,17 +50,9 @@ final class PhabricatorSettingsPanelSearchPreferences
|
|||
id(new AphrontFormSubmitControl())
|
||||
->setValue(pht('Save')));
|
||||
|
||||
$error_view = null;
|
||||
if ($request->getStr('saved') === 'true') {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle(pht('Preferences Saved'))
|
||||
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
|
||||
->setErrors(array(pht('Your preferences have been saved.')));
|
||||
}
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Search Preferences'))
|
||||
->setFormError($error_view)
|
||||
->setFormSaved($request->getStr('saved') === 'true')
|
||||
->setForm($form);
|
||||
|
||||
return array(
|
||||
|
|
|
@ -123,13 +123,6 @@ final class PhabricatorSlowvoteEditController
|
|||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle(pht('Form Errors'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
$instructions =
|
||||
phutil_tag(
|
||||
'p',
|
||||
|
@ -248,7 +241,7 @@ final class PhabricatorSlowvoteEditController
|
|||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setFormError($error_view)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -262,12 +262,8 @@ final class PHUIPagedFormView extends AphrontTagView {
|
|||
$form->appendChild($selected_page);
|
||||
$form->appendChild($submit);
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new AphrontErrorView())->setErrors($errors);
|
||||
}
|
||||
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setFormError($errors)
|
||||
->setFormErrors($errors)
|
||||
->setForm($form);
|
||||
|
||||
if ($selected_page->getPageName()) {
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
final class PHUIObjectBoxView extends AphrontView {
|
||||
|
||||
private $headerText;
|
||||
private $formError = null;
|
||||
private $formErrors = null;
|
||||
private $formSaved = false;
|
||||
private $errorView;
|
||||
private $form;
|
||||
private $validationException;
|
||||
private $header;
|
||||
|
@ -64,8 +66,30 @@ final class PHUIObjectBoxView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setFormError($error) {
|
||||
$this->formError = $error;
|
||||
public function setFormErrors(array $errors, $title = null) {
|
||||
if (nonempty($errors)) {
|
||||
$this->formErrors = id(new AphrontErrorView())
|
||||
->setTitle($title)
|
||||
->setErrors($errors);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setFormSaved($saved, $text = null) {
|
||||
if (!$text) {
|
||||
$text = pht('Changes saved.');
|
||||
}
|
||||
if ($saved) {
|
||||
$save = id(new AphrontErrorView())
|
||||
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
|
||||
->appendChild($text);
|
||||
$this->formSaved = $save;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setErrorView(AphrontErrorView $view) {
|
||||
$this->errorView = $view;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -193,7 +217,9 @@ final class PHUIObjectBoxView extends AphrontView {
|
|||
->appendChild(
|
||||
array(
|
||||
$header,
|
||||
$this->formError,
|
||||
$this->errorView,
|
||||
$this->formErrors,
|
||||
$this->formSaved,
|
||||
$exception_errors,
|
||||
$this->form,
|
||||
$tabs,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
|
||||
form.aphront-dialog-view .aphront-error-view {
|
||||
margin: 8px 0;
|
||||
margin: 0 0 12px 0;
|
||||
}
|
||||
|
||||
.aphront-error-view {
|
||||
|
|
Loading…
Reference in a new issue