Beispiel #1
0
 public function addAction($label, $image, $action, $params = array())
 {
     $id = md5($params['text']);
     $link = new MImageLinkLabelAction('', '', $action, $image, $this->iconType, $target);
     $link->addEvent('mouseenter', "manager.getElementById('{$id}_hlayout').style.backgroundColor='#EEE';");
     $link->addEvent('mouseout', "manager.getElementById('{$id}_hlayout').style.backgroundColor='white';");
     $bold = new MLabel($label, 'black', true);
     $text = new MLabel($bold->generate() . ': ' . $params['text']);
     $control = new MHContainer($id, array($link, $text));
     $control->setShowLabel(false);
     $class = 'mPanelCell' . ucfirst($this->iconType);
     $link->setClass($class);
     $this->add($control, '', '', '');
 }
Beispiel #2
0
 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();
 }
Beispiel #3
0
 public function generateLayoutVertical()
 {
     $id = $this->id ?: 'mv' . uniqid();
     list($layout, $hidden) = $this->getLayout();
     $array = array();
     $row = $i = $j = 0;
     foreach ($layout as $control) {
         if ($control->checkAccess()) {
             $label = $hint = NULL;
             $pos = ($i == 0 ? ' firstCell' : ($i == $j ? ' lastCell' : '')) . ' cell' . $i;
             if (!$control instanceof MContainer) {
                 if ($this->isShowLabel()) {
                     $label = $control->generateLabel();
                 }
                 $hint = $control->generateHint();
             }
             if ($this->labelMode == MFieldLabel::LABEL_ABOVE) {
                 $div = new MDiv($id . '_row' . $i, array($label, $control->generate(), $hint), 'mContainerRow' . $pos);
             } else {
                 // MFieldLabel::LABEL_SIDE
                 $div = new MHContainer($id . '_row' . $i, array($label, $control->generate() . $hint));
             }
             $height = $control->getRowHeight();
             if ($height != '') {
                 $div->setHeight($height);
             }
             $array[] = $div;
             $i++;
         }
     }
     $div = new MDiv($id, $array, 'mVContainer');
     $div->cloneStyle($this);
     $div->setClass('mVContainer');
     return array($div, $hidden);
 }
Beispiel #4
0
 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();
 }