Changeset View
Changeset View
Standalone View
Standalone View
src/view/AphrontDialogView.php
Show All 16 Lines | final class AphrontDialogView extends AphrontView { | ||||
private $isStandalone; | private $isStandalone; | ||||
private $method = 'POST'; | private $method = 'POST'; | ||||
private $disableWorkflowOnSubmit; | private $disableWorkflowOnSubmit; | ||||
private $disableWorkflowOnCancel; | private $disableWorkflowOnCancel; | ||||
private $width = 'default'; | private $width = 'default'; | ||||
private $errors = array(); | private $errors = array(); | ||||
private $flush; | private $flush; | ||||
private $validationException; | private $validationException; | ||||
private $errorSeverity = AphrontErrorView::SEVERITY_ERROR; | |||||
private $formEncoding; | |||||
const WIDTH_DEFAULT = 'default'; | const WIDTH_DEFAULT = 'default'; | ||||
const WIDTH_FORM = 'form'; | const WIDTH_FORM = 'form'; | ||||
const WIDTH_FULL = 'full'; | const WIDTH_FULL = 'full'; | ||||
public function setFormEncoding($form_encoding) { | |||||
$this->formEncoding = $form_encoding; | |||||
return $this; | |||||
} | |||||
public function setMethod($method) { | public function setMethod($method) { | ||||
$this->method = $method; | $this->method = $method; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setErrorSeverity($error_severity) { | |||||
$this->errorSeverity = $error_severity; | |||||
return $this; | |||||
} | |||||
public function setIsStandalone($is_standalone) { | public function setIsStandalone($is_standalone) { | ||||
$this->isStandalone = $is_standalone; | $this->isStandalone = $is_standalone; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setErrors(array $errors) { | public function setErrors(array $errors) { | ||||
$this->errors = $errors; | $this->errors = $errors; | ||||
return $this; | return $this; | ||||
▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | final public function render() { | ||||
} | } | ||||
$attributes = array( | $attributes = array( | ||||
'class' => 'aphront-dialog-view '.$more, | 'class' => 'aphront-dialog-view '.$more, | ||||
'sigil' => 'jx-dialog', | 'sigil' => 'jx-dialog', | ||||
); | ); | ||||
$form_attributes = array( | $form_attributes = array( | ||||
'action' => $this->submitURI, | 'action' => $this->submitURI, | ||||
'method' => $this->method, | 'method' => $this->method, | ||||
'id' => $this->formID, | 'id' => $this->formID, | ||||
'enctype' => $this->formEncoding, | |||||
); | ); | ||||
$hidden_inputs = array(); | $hidden_inputs = array(); | ||||
$hidden_inputs[] = phutil_tag( | $hidden_inputs[] = phutil_tag( | ||||
'input', | 'input', | ||||
array( | array( | ||||
'type' => 'hidden', | 'type' => 'hidden', | ||||
'name' => '__dialog__', | 'name' => '__dialog__', | ||||
Show All 28 Lines | final public function render() { | ||||
if ($ex) { | if ($ex) { | ||||
foreach ($ex->getErrors() as $error) { | foreach ($ex->getErrors() as $error) { | ||||
$errors[] = $error->getMessage(); | $errors[] = $error->getMessage(); | ||||
} | } | ||||
} | } | ||||
if ($errors) { | if ($errors) { | ||||
$children = array( | $children = array( | ||||
id(new AphrontErrorView())->setErrors($errors), | id(new AphrontErrorView()) | ||||
->setErrors($errors) | |||||
->setSeverity($this->errorSeverity), | |||||
$children); | $children); | ||||
} | } | ||||
$header = new PhabricatorActionHeaderView(); | $header = new PhabricatorActionHeaderView(); | ||||
$header->setHeaderTitle($this->title); | $header->setHeaderTitle($this->title); | ||||
$header->setHeaderColor($this->headerColor); | $header->setHeaderColor($this->headerColor); | ||||
$footer = null; | $footer = null; | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |