Commit 9789de5c authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Separated ButtonAttribute from DialogButtonAttribute

Showing with 22 additions and 14 deletions
+22 -14
......@@ -516,25 +516,14 @@ class SystemsAttribute extends DialogAttribute
class ButtonAttribute extends Attribute
{
protected $dialogClass = NULL;
protected $buttonText = NULL;
protected $buttonText = NULL;
function __construct ($label, $description, $ldapName, $required, $dialogClass, $buttonText, $defaultValue = "", $acl = "")
function __construct ($label, $description, $ldapName, $required, $buttonText, $defaultValue = "", $acl = "")
{
parent::__construct($label, $description, $ldapName, $required, $defaultValue, $acl);
$this->dialogClass = $dialogClass;
$this->buttonText = $buttonText;
}
function loadPostValue ()
{
if ($this->isVisible()) {
if (isset($_POST[$this->getLdapName()])) {
$this->plugin->openDialog(new $this->dialogClass($this->plugin, $this));
}
}
}
function renderFormInput ()
{
$id = $this->getHtmlId();
......@@ -546,10 +535,29 @@ class ButtonAttribute extends Attribute
function applyPostValue ()
{
}
}
class DialogButtonAttribute extends ButtonAttribute
{
protected $dialogClass = NULL;
function __construct ($label, $description, $ldapName, $required, $dialogClass, $buttonText, $defaultValue = "", $acl = "")
{
parent::__construct($label, $description, $ldapName, $required, $buttonText, $defaultValue, $acl);
$this->dialogClass = $dialogClass;
}
function loadPostValue ()
{
if ($this->isVisible()) {
if (isset($_POST[$this->getLdapName()])) {
$this->plugin->openDialog(new $this->dialogClass($this->plugin, $this));
}
}
}
}
class UserAttribute extends ButtonAttribute
class UserAttribute extends DialogButtonAttribute
{
function __construct ($label, $description, $ldapName, $required = FALSE, $defaultValue = "", $acl = "")
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment