Beispiel #1
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();
 }