}
}
+ public function onPreRender($param) {
+ /**
+ * This method overwrites DirectiveListTemplate::onPreRender()
+ * Not calling parent method is intentional here because this class
+ * isn't typical control list class and calling parent::onPreRender()
+ * causes error.
+ */
+ }
+
private function getConfigData($host, array $parameters) {
$default_params = array('config');
$params = array_merge($default_params, $parameters);
class DirectiveComboBox extends DirectiveTemplate {
- public function onLoad($param) {
+ public function onPreRender($param) {
$this->createDirectiveInternal();
$this->saveDirective();
- parent::onLoad($param);
+ parent::onPreRender($param);
}
public function saveDirective() {
if ($this->getPage()->IsCallBack) {
if (method_exists($this->getPage()->CallBackEventTarget, 'getCommandParameter')) {
$command_param = $this->getPage()->CallBackEventTarget->getCommandParameter();
+ } else {
+ $command_param = $this->getPage()->getCallbackEventParameter();
}
} elseif ($this->getPage()->IsPostBack) {
if (method_exists($this->getPage()->PostBackEventTarget, 'getCommandParameter')) {
$this->attachEventHandler('OnDirectiveListLoad', $handler);
}
- public function onLoad($param) {
- parent::onLoad($param);
+ public function onPreRender($param) {
+ parent::onPreRender($param);
+ $cmd = $this->getCmdParam();
+ if ($this->getPage()->IsCallBack && (!$cmd || $cmd === 'show_all_directives') && method_exists($this, 'loadConfig')) {
+ $this->loadConfig();
+ }
if ($this->getPage()->IsCallBack || $this->getPage()->IsPostBack) {
return;
}
class DirectiveMultiComboBox extends DirectiveListTemplate {
- public function onLoad($param) {
- parent::onLoad($param);
- if ($this->getCmdParam() !== 'add_multicombobox') {
- $this->loadConfig();
- }
+ public function dataBind() {
+ $this->loadConfig();
}
public function getDirectiveValue() {
class DirectiveMultiTextBox extends DirectiveListTemplate {
- public function onLoad($param) {
- parent::onLoad($param);
- if ($this->getCmdParam() !== 'add_multitextbox') {
- $this->loadConfig();
- }
+ public function dataBind() {
+ $this->loadConfig();
}
public function getDirectiveValue() {
public function createMultiTextBoxElement($sender, $param) {
$param->Item->Label->Text = $param->Item->Data['label'];
$param->Item->Directive->Text = $param->Item->Data['directive_value'];
-
}
public function addField($sender, $param) {
Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
Prado::using('System.Web.UI.ActiveControls.TActivePanel');
Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
+Prado::using('System.Web.UI.WebControls.TItemDataRenderer');
Prado::using('Application.Web.Portlets.DirectiveListTemplate');
Prado::using('Application.Web.Portlets.DirectiveCheckBox');
Prado::using('Application.Web.Portlets.DirectiveComboBox');
Prado::using('Application.Web.Portlets.DirectiveRunscript');
Prado::using('Application.Web.Portlets.DirectiveMessages');
-class DirectiveRenderer extends DirectiveListTemplate implements IDataRenderer {
+class DirectiveRenderer extends TItemDataRenderer {
const DATA = 'Data';
'DirectiveMultiTextBox'
);
- public $resource_names = array();
-
- private $item_loaded = false;
-
- public function onLoad($param) {
- parent::onLoad($param);
- if (!$this->item_loaded) {
- $this->createItemInternal();
- $this->item_loaded = true;
- }
- }
-
- public function dataBind() {
- if (!$this->item_loaded) {
- $this->createItemInternal();
- $this->item_loaded = true;
- }
- parent::dataBind();
+ public function loadState() {
+ parent::loadState();
+ $this->createItemInternal();
}
public function createItemInternal() {
$data = $this->getData();
$item = $this->createItem($data);
-
$this->addParsedObject($item);
- $cmd = $item->getCmdParam();
-
- if ($item instanceof DirectiveTemplate) {
- $item->createDirective();
- } elseif ($item instanceof DirectiveListTemplate && $cmd === '') {
- $item->loadConfig();
- }
}
public function createItem($data) {