/** * Arguments: * - cmd * - label * - ^ (optional) * * @param array $args The tokenized definition, only split at spaces */ function initialize($args) { parent::initialize($args); $attr = array(); if (!isset($this->opt['optional'])) { $attr['required'] = 'required'; } $this->tpl = form_makeFileField('@@NAME@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@', $attr); if (!isset($this->opt['optional'])) { $this->tpl['class'] .= ' required'; } }
/** * Print the media upload form if permissions are correct * * @author Andreas Gohr <*****@*****.**> * @author Kate Arzamastseva <*****@*****.**> */ function media_uploadform($ns, $auth, $fullscreen = false) { global $lang; global $conf; global $INPUT; if ($auth < AUTH_UPLOAD) { echo '<div class="nothing">' . $lang['media_perm_upload'] . '</div>' . NL; return; } $auth_ow = $conf['mediarevisions'] ? AUTH_UPLOAD : AUTH_DELETE; $update = false; $id = ''; if ($auth >= $auth_ow && $fullscreen && $INPUT->str('mediado') == 'update') { $update = true; $id = cleanID($INPUT->str('image')); } // The default HTML upload form $params = array('id' => 'dw__upload', 'enctype' => 'multipart/form-data'); if (!$fullscreen) { $params['action'] = DOKU_BASE . 'lib/exe/mediamanager.php'; } else { $params['action'] = media_managerURL(array('tab_files' => 'files', 'tab_details' => 'view'), '&'); } $form = new Doku_Form($params); if (!$fullscreen) { echo '<div class="upload">' . $lang['mediaupload'] . '</div>'; } $form->addElement(formSecurityToken()); $form->addHidden('ns', hsc($ns)); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeFileField('upload', $lang['txt_upload'], 'upload__file')); $form->addElement(form_makeCloseTag('p')); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeTextField('mediaid', noNS($id), $lang['txt_filename'], 'upload__name')); $form->addElement(form_makeButton('submit', '', $lang['btn_upload'])); $form->addElement(form_makeCloseTag('p')); if ($auth >= $auth_ow) { $form->addElement(form_makeOpenTag('p')); $attrs = array(); if ($update) { $attrs['checked'] = 'checked'; } $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check', $attrs)); $form->addElement(form_makeCloseTag('p')); } echo NL . '<div id="mediamanager__uploader">' . NL; html_form('upload', $form); echo '</div>' . NL; echo '<p class="maxsize">'; printf($lang['maxuploadsize'], filesize_h(media_getuploadsize())); echo '</p>' . NL; }
/** * Display the template tab */ public function tabInstall() { echo '<div class="panelHeader">'; echo $this->locale_xhtml('intro_install'); echo '</div>'; $form = new Doku_Form(array('action' => $this->tabURL('', array(), '&'), 'enctype' => 'multipart/form-data', 'class' => 'install')); $form->addElement(form_makeTextField('installurl', '', $this->getLang('install_url'), '', 'block')); $form->addElement(form_makeFileField('installfile', $this->getLang('install_upload'), '', 'block')); $form->addElement(form_makeButton('submit', '', $this->getLang('btn_install'))); $form->printForm(); }
/** * Print the media upload form if permissions are correct * * @author Andreas Gohr <*****@*****.**> */ function media_uploadform($ns, $auth) { global $lang; if ($auth < AUTH_UPLOAD) { return; } //fixme print info on missing permissions? // The default HTML upload form $form = new Doku_Form(array('id' => 'dw__upload', 'action' => DOKU_BASE . 'lib/exe/mediamanager.php', 'enctype' => 'multipart/form-data')); $form->addElement('<div class="upload">' . $lang['mediaupload'] . '</div>'); $form->addElement(formSecurityToken()); $form->addHidden('ns', hsc($ns)); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeFileField('upload', $lang['txt_upload'] . ':', 'upload__file')); $form->addElement(form_makeCloseTag('p')); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeTextField('id', '', $lang['txt_filename'] . ':', 'upload__name')); $form->addElement(form_makeButton('submit', '', $lang['btn_upload'])); $form->addElement(form_makeCloseTag('p')); if ($auth >= AUTH_DELETE) { $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check')); $form->addElement(form_makeCloseTag('p')); } html_form('upload', $form); // prepare flashvars for multiupload $opt = array('L_gridname' => $lang['mu_gridname'], 'L_gridsize' => $lang['mu_gridsize'], 'L_gridstat' => $lang['mu_gridstat'], 'L_namespace' => $lang['mu_namespace'], 'L_overwrite' => $lang['txt_overwrt'], 'L_browse' => $lang['mu_browse'], 'L_upload' => $lang['btn_upload'], 'L_toobig' => $lang['mu_toobig'], 'L_ready' => $lang['mu_ready'], 'L_done' => $lang['mu_done'], 'L_fail' => $lang['mu_fail'], 'L_authfail' => $lang['mu_authfail'], 'L_progress' => $lang['mu_progress'], 'L_filetypes' => $lang['mu_filetypes'], 'L_info' => $lang['mu_info'], 'L_lasterr' => $lang['mu_lasterr'], 'O_ns' => ":{$ns}", 'O_backend' => 'mediamanager.php?' . session_name() . '=' . session_id(), 'O_maxsize' => php_to_byte(ini_get('upload_max_filesize')), 'O_extensions' => join('|', array_keys(getMimeTypes())), 'O_overwrite' => $auth >= AUTH_DELETE, 'O_sectok' => getSecurityToken(), 'O_authtok' => auth_createToken()); $var = buildURLparams($opt); // output the flash uploader ?> <div id="dw__flashupload" style="display:none"> <div class="upload"><?php echo $lang['mu_intro']; ?> </div> <?php echo html_flashobject('multipleUpload.swf', '500', '190', null, $opt); ?> </div> <?php }
/** * Print the media upload form if permissions are correct * * @author Andreas Gohr <*****@*****.**> */ function media_uploadform($ns, $auth) { global $lang; if ($auth < AUTH_UPLOAD) { return; } //fixme print info on missing permissions? print '<div class="upload">' . $lang['mediaupload'] . '</div>'; $form = new Doku_Form('dw__upload', DOKU_BASE . 'lib/exe/mediamanager.php', false, 'multipart/form-data'); $form->addElement(formSecurityToken()); $form->addHidden('ns', hsc($ns)); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeFileField('upload', $lang['txt_upload'] . ':', 'upload__file')); $form->addElement(form_makeCloseTag('p')); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeTextField('id', '', $lang['txt_filename'] . ':', 'upload__name')); $form->addElement(form_makeButton('submit', '', $lang['btn_upload'])); $form->addElement(form_makeCloseTag('p')); if ($auth >= AUTH_DELETE) { $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check')); $form->addElement(form_makeCloseTag('p')); } html_form('upload', $form); }