예제 #1
0
 public function generateInner()
 {
     $this->form->onSubmit("(dojo.byId(\"{$this->getId()}\").value = dijit.byId(\"{$this->getId()}_iframe\").getValue())");
     $hidden = new MHiddenField($this->getId(), $this->getValue());
     $this->setId($this->getId() . '_iframe');
     $this->inner = $hidden->generate() . $this->render();
 }
예제 #2
0
 public function generateInner()
 {
     $id = $this->id;
     $this->id = '___' . $id;
     parent::generateInner();
     $hidden = new MHiddenField($id, $this->value);
     $this->addEvent('change', "dojo.byId('{$id}').value = dojo.byId('{$this->id}').checked ? '1' : '0';", false);
     $this->inner .= $hidden->generate();
 }
예제 #3
0
 public function generateInner()
 {
     if ($this->autoPostBack) {
         $this->addEvent('onChange', "manager.doPostBack('{$this->id}');");
     }
     $this->content = $this->list->generateOptions($this->getValue());
     $this->addAttribute('placeHolder', _M('-- Selecione --'));
     $this->generateValidator();
     if ($this->getValue() == '') {
         $this->setAttribute('value', '');
     }
     $hidden = NULL;
     if ($this->readonly) {
         $hidden = new MHiddenField($this->getId(), $this->getValue());
         $this->setId($this->getId() . '_ro');
         //$this->setName($this->getName() . '_ro');
         $this->setValue($this->getOption($this->getValue()));
         if ($this->type == 'group' || $this->type == 'multiple') {
             // widgets uses native HTML <selection> and the readonly attribute will not work
             $this->addAttribute('disabled', 'disabled');
         } else {
             $this->addAttribute('readonly');
         }
         $this->size = $this->cols ? $this->cols : strlen(trim($this->getValue())) + 10;
     } else {
         $this->addEvent("onChange", "dojo.publish('{$this->getId()}ChangeValue',[manager.byId('{$this->getId()}').get('value')]);", false);
     }
     $required = $this->getRequired() ? 'true' : 'false';
     if ($this->type == 'filter') {
         $this->page->addDojoRequire('dijit.form.FilteringSelect');
         $this->page->addDojoRequire('dijit.form.Select');
         $this->setDojoType('dijit.form.FilteringSelect');
         if ($this->getValue() == '') {
             $this->page->onLoad("manager.byId(\"" . $this->getId() . "\").set(\"value\",\"\");");
         }
         $this->page->onLoad("manager.byId(\"" . $this->getId() . "\").set(\"required\",{$required});");
     } elseif ($this->type == 'multiple') {
         $this->page->addDojoRequire('dijit.form.MultiSelect');
         $this->setDojoType('dijit.form.MultiSelect');
         $this->addDojoProp('size', $this->size ? $this->size : '3');
     } elseif ($this->type == 'group') {
     } elseif ($this->type == 'input') {
         $this->page->addDojoRequire('dijit.form.ComboBox');
         $this->setDojoType('dijit.form.ComboBox');
         $this->addDojoProp('size', $this->size ? $this->size : '3');
     } elseif ($this->type == 'selectOnly') {
         $this->page->addDojoRequire('dijit.form.Select');
         $this->setDojoType('dijit.form.Select');
         $this->addDojoProp('size', $this->size ? $this->size : '3');
     }
     $this->inner = ($hidden ? $hidden->generate() : '') . $this->render();
 }
예제 #4
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();
 }