public function generate() { $content = ''; if (!is_array($this->message)) { $this->message = array($this->message); } $this->box = new MBox($this->caption, $this->close, ''); $textBox = new MDiv($this->id . 'BoxText', $this->message); $this->box->setControls($textBox); $form = $this->form instanceof MBaseForm ? $this->form->getTagId() : ''; $b = new MButton("{$this->id}HelpButton", 'Fechar', "!manager.byId('{$this->id}Help').hide();"); $this->box->addAction($b); $help = new MDiv("{$this->id}Help", new MDiv("{$this->id}Box", $this->box, "mHelp")); $help->addStyle('display', 'none'); $help->setDojoType('Manager.DialogSimple'); return $help->generate(); }
public function inputFile($control) { $this->page->addDojoRequire('dojox.form.Uploader'); $control->addDojoProp('multiple', $control->multiple ? true : false); $this->page->onLoad("manager.page.fileUpload = 'yes';"); $this->page->onLoad("manager.byId('{$control->getId()}').reset();"); $this->page->addDojoRequire("dojox.form.uploader.plugins.IFrame"); $this->page->addDojoRequire("dojox.form.Uploader"); $this->page->addDojoRequire("dojox.form.uploader.FileList"); $control->setDojoType('dojox.form.Uploader'); $control->addDojoProp('label', $control->text); $inner = $this->inputfield($control); $hidden = new MHiddenField("__ISFILEUPLOADPOST[{$control->getId()}]", 'yes'); $btnClearList = new MButton($control->getId() . "ClearFiles", 'Apagar'); $btnClearList->setClass('mFileFieldReset'); $btnClearList->addEvent('click', "manager.byId('{$control->getId()}').reset();"); if ($control->multiple) { $divFiles = new MDiv($control->getId() . "Files"); $divFiles->setDojoType("dojox.form.uploader.FileList"); $divFiles->addDojoProp("uploaderId", $control->getId()); $divFiles->setWidth('445px'); $divFiles->addDojoProp("headerFilename", "Arquivo"); $divFiles->addDojoProp("headerType", "Tipo"); $divFiles->addDojoProp("headerFilesize", "Tamanho"); $fieldset = new MBaseGroup(); $fieldset->addControl(new MHContainer('', array($inner, $btnClearList))); $fieldset->addControl($divFiles); $fieldset->setWidth('450px'); } else { $input = new MDiv($control->getId(), new MLabel($control->text)); $input->setDojoType('dojox.form.Uploader'); $input->addDojoProp('showInput', 'after'); $input->addDojoProp('name', $control->getId()); $input->addDojoProp('force', 'iframe'); $fieldset = new MHContainer('', array($input, $btnClearList)); } return $fieldset->generate() . $hidden->generate(); }
public function generate() { $internalForm = false; if (!is_array($this->message)) { $this->message = array($this->message); } $this->box = new MBox($this->caption, $this->close, ''); $type = ucfirst($this->promptType); $m = new MUnorderedList($this->id . 'Message', $this->message); $m->type = 'none'; $textBox = new MDiv($this->id . 'BoxText', $m, "text"); $iconBox = new MDiv($this->id . 'BoxIcon', '', "icon icon{$type}"); $imageTextBox = new MHContainer('', array($iconBox, $textBox)); $imageTextBox->setClass('mPromptBox'); $this->box->setControls($imageTextBox); if (!$this->form instanceof MBaseForm) { $this->form = new MSimpleForm(); $this->controls[0] = $this->form; $internalForm = true; } if ($this->buttons) { foreach ($this->buttons as $button) { list($label, $action, $event) = $button; $name = $this->name . trim($label); $spanLabel = new MDiv('', $label, 'button'); $b = new MButton($name, $spanLabel->generate()); $onclick = "manager.byId(\"{$this->id}\").hide();" . ($action ? MAction::getOnClick($action, $this->form->getTagId()) : ''); $b->addEvent('click', $onclick, true, false); $this->box->addAction($b); } } $this->box->setExtendClass("title title{$type}"); $this->controls[1] = new MDiv("{$this->id}Box", $this->box, "mPrompt"); $prompt = new MDiv("{$this->id}Pane", $this->controls); if (($this->form instanceof MBaseForm and !$internalForm) || !$this->page->isPostBack()) { $prompt = new MDiv($this->id, $prompt, '', $this->getStyle()); $prompt->addStyle('display', 'none'); $prompt->setDojoType('Manager.DialogSimple'); } return $prompt->generate(); }