2013-08-26 20:53:11 +02:00
|
|
|
<?php
|
|
|
|
|
2013-09-25 20:23:29 +02:00
|
|
|
final class PHUIObjectBoxView extends AphrontView {
|
2013-08-26 20:53:11 +02:00
|
|
|
|
|
|
|
private $headerText;
|
|
|
|
private $formError = null;
|
|
|
|
private $form;
|
2013-09-19 00:31:58 +02:00
|
|
|
private $validationException;
|
2013-09-29 00:55:38 +02:00
|
|
|
private $header;
|
|
|
|
private $flush;
|
Provide more structure to PHUIObjectBoxView
Summary:
Three changes here.
- Add `setActionList()`, and use that to set the action list.
- Add `setPropertyList()`, and use that to set the property list.
These will let us add some apropriate CSS so we can fix the border issue, and get rid of a bunch of goofy `.x + .y` selectors.
- Replace `addContent()` with `appendChild()`.
This is just a consistency thing; `AphrontView` already provides `appendChild()`, and `addContent()` did the same thing.
Test Plan:
- Viewed "All Config".
- Viewed a countdown.
- Viewed a revision (add comment, change list, table of contents, comment, local commits, open revisions affecting these files, update history).
- Viewed Diffusion (browse, change, history, repository, lint).
- Viewed Drydock (resource, lease).
- Viewed Files.
- Viewed Herald.
- Viewed Legalpad.
- Viewed macro (edit, edit audio, view).
- Viewed Maniphest.
- Viewed Applications.
- Viewed Paste.
- Viewed People.
- Viewed Phulux.
- Viewed Pholio.
- Viewed Phame (blog, post).
- Viewed Phortune (account, product).
- Viewed Ponder (questions, answers, comments).
- Viewed Releeph.
- Viewed Projects.
- Viewed Slowvote.
NOTE: Images in Files aren't on a black background anymore -- I assume that's on purpose?
NOTE: Some jankiness in Phortune, I'll clean that up when I get back to it. Not related to this diff.
Reviewers: chad
Reviewed By: chad
CC: aran
Differential Revision: https://secure.phabricator.com/D7174
2013-09-30 18:36:04 +02:00
|
|
|
private $propertyList;
|
|
|
|
private $actionList;
|
|
|
|
|
|
|
|
public function setActionList(PhabricatorActionListView $action_list) {
|
|
|
|
$this->actionList = $action_list;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setPropertyList(PhabricatorPropertyListView $property_list) {
|
|
|
|
$this->propertyList = $property_list;
|
|
|
|
return $this;
|
|
|
|
}
|
2013-08-26 20:53:11 +02:00
|
|
|
|
|
|
|
public function setHeaderText($text) {
|
|
|
|
$this->headerText = $text;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setFormError($error) {
|
|
|
|
$this->formError = $error;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-08-27 00:45:58 +02:00
|
|
|
public function setForm($form) {
|
2013-08-26 20:53:11 +02:00
|
|
|
$this->form = $form;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-09-29 00:55:38 +02:00
|
|
|
public function setHeader(PHUIHeaderView $header) {
|
|
|
|
$this->header = $header;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setFlush($flush) {
|
|
|
|
$this->flush = $flush;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-09-19 00:31:58 +02:00
|
|
|
public function setValidationException(
|
|
|
|
PhabricatorApplicationTransactionValidationException $ex = null) {
|
|
|
|
$this->validationException = $ex;
|
|
|
|
return $this;
|
|
|
|
}
|
2013-08-26 20:53:11 +02:00
|
|
|
|
2013-09-19 00:31:58 +02:00
|
|
|
public function render() {
|
2013-08-26 20:53:11 +02:00
|
|
|
|
2013-09-29 00:55:38 +02:00
|
|
|
require_celerity_resource('phui-object-box-css');
|
|
|
|
|
|
|
|
if ($this->header) {
|
|
|
|
$header = $this->header;
|
|
|
|
$header->setGradient(PhabricatorActionHeaderView::HEADER_LIGHTBLUE);
|
|
|
|
} else {
|
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setHeader($this->headerText)
|
|
|
|
->setGradient(PhabricatorActionHeaderView::HEADER_LIGHTBLUE);
|
|
|
|
}
|
2013-08-26 20:53:11 +02:00
|
|
|
|
2013-09-19 00:31:58 +02:00
|
|
|
$ex = $this->validationException;
|
|
|
|
$exception_errors = null;
|
|
|
|
if ($ex) {
|
|
|
|
$messages = array();
|
|
|
|
foreach ($ex->getErrors() as $error) {
|
|
|
|
$messages[] = $error->getMessage();
|
|
|
|
}
|
|
|
|
if ($messages) {
|
|
|
|
$exception_errors = id(new AphrontErrorView())
|
|
|
|
->setErrors($messages);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-26 20:53:11 +02:00
|
|
|
$content = id(new PHUIBoxView())
|
2013-09-19 00:31:58 +02:00
|
|
|
->appendChild(
|
|
|
|
array(
|
|
|
|
$header,
|
|
|
|
$this->formError,
|
|
|
|
$exception_errors,
|
|
|
|
$this->form,
|
Provide more structure to PHUIObjectBoxView
Summary:
Three changes here.
- Add `setActionList()`, and use that to set the action list.
- Add `setPropertyList()`, and use that to set the property list.
These will let us add some apropriate CSS so we can fix the border issue, and get rid of a bunch of goofy `.x + .y` selectors.
- Replace `addContent()` with `appendChild()`.
This is just a consistency thing; `AphrontView` already provides `appendChild()`, and `addContent()` did the same thing.
Test Plan:
- Viewed "All Config".
- Viewed a countdown.
- Viewed a revision (add comment, change list, table of contents, comment, local commits, open revisions affecting these files, update history).
- Viewed Diffusion (browse, change, history, repository, lint).
- Viewed Drydock (resource, lease).
- Viewed Files.
- Viewed Herald.
- Viewed Legalpad.
- Viewed macro (edit, edit audio, view).
- Viewed Maniphest.
- Viewed Applications.
- Viewed Paste.
- Viewed People.
- Viewed Phulux.
- Viewed Pholio.
- Viewed Phame (blog, post).
- Viewed Phortune (account, product).
- Viewed Ponder (questions, answers, comments).
- Viewed Releeph.
- Viewed Projects.
- Viewed Slowvote.
NOTE: Images in Files aren't on a black background anymore -- I assume that's on purpose?
NOTE: Some jankiness in Phortune, I'll clean that up when I get back to it. Not related to this diff.
Reviewers: chad
Reviewed By: chad
CC: aran
Differential Revision: https://secure.phabricator.com/D7174
2013-09-30 18:36:04 +02:00
|
|
|
$this->actionList,
|
|
|
|
$this->propertyList,
|
|
|
|
$this->renderChildren(),
|
2013-09-19 00:31:58 +02:00
|
|
|
))
|
2013-08-26 20:53:11 +02:00
|
|
|
->setBorder(true)
|
|
|
|
->addMargin(PHUI::MARGIN_LARGE_TOP)
|
|
|
|
->addMargin(PHUI::MARGIN_LARGE_LEFT)
|
|
|
|
->addMargin(PHUI::MARGIN_LARGE_RIGHT)
|
2013-09-25 20:23:29 +02:00
|
|
|
->addClass('phui-object-box');
|
2013-08-26 20:53:11 +02:00
|
|
|
|
2013-09-29 00:55:38 +02:00
|
|
|
if ($this->flush) {
|
|
|
|
$content->addClass('phui-object-box-flush');
|
|
|
|
}
|
2013-08-26 20:53:11 +02:00
|
|
|
|
2013-09-29 00:55:38 +02:00
|
|
|
return $content;
|
2013-08-26 20:53:11 +02:00
|
|
|
}
|
|
|
|
}
|