protected function override_html_register() { global $lang; global $conf; global $INPUT; $base_attrs = array('size' => 50, 'required' => 'required'); $email_attrs = $base_attrs + array('type' => 'email', 'class' => 'edit'); print $this->override_locale_xhtml('register'); print '<div class="centeralign">' . NL; $form = new Doku_Form(array('id' => 'dw__register')); $form->startFieldset($lang['btn_register']); $form->addHidden('do', 'register'); $form->addHidden('save', '1'); $form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block', $base_attrs)); if (!$conf['autopasswd']) { $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', $base_attrs)); $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', $base_attrs)); } $form->addElement(form_makeTextField('fullname', $INPUT->post->str('fullname'), $lang['fullname'], '', 'block', $base_attrs)); $form->addElement(form_makeField('email', 'email', $INPUT->post->str('email'), $lang['email'], '', 'block', $email_attrs)); $form->addElement(form_makeButton('submit', '', $lang['btn_register'])); $form->endFieldset(); html_form('register', $form); print '</div>' . NL; }
/** * Output HTML form */ function html() { global $INPUT; global $conf; echo $this->locale_xhtml('intro'); if (!$conf['mailfrom']) { msg($this->getLang('nofrom'), -1); } $form = new Doku_Form(array()); $form->startFieldset('Testmail'); $form->addHidden('send', 1); $form->addElement(form_makeField('text', 'to', $INPUT->str('to'), 'To:', '', 'block')); $form->addElement(form_makeField('text', 'cc', $INPUT->str('cc'), 'Cc:', '', 'block')); $form->addElement(form_makeField('text', 'bcc', $INPUT->str('bcc'), 'Bcc:', '', 'block')); $form->addElement(form_makeButton('submit', '', 'Send Email')); $form->printForm(); }
function _editData($data, &$renderer) { $renderer->form->startFieldset($this->getLang('dataentry')); $renderer->form->_content[count($renderer->form->_content) - 1]['class'] = 'plugin__data'; if ($this->getConf('edit_content_only')) { $renderer->form->addHidden('data_edit[classes]', $data['classes']); $renderer->form->addElement('<table>'); } else { $renderer->form->addElement(form_makeField('text', 'data_edit[classes]', $data['classes'], $this->getLang('class'), 'data__classes')); $renderer->form->addElement('<table>'); $text = '<tr>'; foreach (array('title', 'type', 'multi', 'value', 'comment') as $val) { $text .= '<th>' . $this->getLang($val) . '</th>'; } $renderer->form->addElement($text . '</tr>'); // New line $data['data'][''] = ''; $data['cols'][''] = array('type' => '', 'multi' => false); } $n = 0; foreach ($data['cols'] as $key => $vals) { $fieldid = 'data_edit[data][' . $n++ . ']'; $content = $vals['multi'] ? implode(', ', $data['data'][$key]) : $data['data'][$key]; if (is_array($vals['type'])) { $vals['basetype'] = $vals['type']['type']; if (isset($vals['type']['enum'])) { $vals['enum'] = $vals['type']['enum']; } $vals['type'] = $vals['origtype']; } else { $vals['basetype'] = $vals['type']; } $renderer->form->addElement('<tr>'); if ($this->getConf('edit_content_only')) { if (isset($vals['enum'])) { $values = preg_split('/\\s*,\\s*/', $vals['enum']); if (!$vals['multi']) { array_unshift($values, ''); } $content = form_makeListboxField($fieldid . '[value][]', $values, $data['data'][$key], $vals['title'], '', '', $vals['multi'] ? array('multiple' => 'multiple') : array()); } else { $classes = 'data_type_' . $vals['type'] . ($vals['multi'] ? 's' : '') . ' ' . 'data_type_' . $vals['basetype'] . ($vals['multi'] ? 's' : ''); $attr = array(); if ($vals['basetype'] == 'date' && !$vals['multi']) { $attr['class'] = 'datepicker'; } $content = form_makeField('text', $fieldid . '[value]', $content, $vals['title'], '', $classes, $attr); } $cells = array($vals['title'] . ':', $content, $vals['comment']); foreach (array('title', 'multi', 'comment', 'type') as $field) { $renderer->form->addHidden($fieldid . "[{$field}]", $vals[$field]); } } else { $check_data = $vals['multi'] ? array('checked' => 'checked') : array(); $cells = array(form_makeField('text', $fieldid . '[title]', $vals['title'], $this->getLang('title')), form_makeMenuField($fieldid . '[type]', array_merge(array('', 'page', 'nspage', 'title', 'img', 'mail', 'url', 'tag', 'wiki', 'dt'), array_keys($this->dthlp->_aliases())), $vals['type'], $this->getLang('type')), form_makeCheckboxField($fieldid . '[multi]', array('1', ''), $this->getLang('multi'), '', '', $check_data), form_makeField('text', $fieldid . '[value]', $content, $this->getLang('value')), form_makeField('text', $fieldid . '[comment]', $vals['comment'], $this->getLang('comment'), '', 'data_comment', array('readonly' => 1))); } foreach ($cells as $cell) { $renderer->form->addElement('<td>'); $renderer->form->addElement($cell); $renderer->form->addElement('</td>'); } $renderer->form->addElement('</tr>'); } $renderer->form->addElement('</table>'); $renderer->form->endFieldset(); }
/** * Add input fields for dynamic filtering */ protected function renderDynamicFilters() { if ($this->mode != 'xhtml') { return; } if (!$this->data['dynfilters']) { return; } global $conf; $this->renderer->doc .= '<tr class="dataflt">'; // add extra column for row numbers if ($this->data['rownumbers']) { $this->renderer->doc .= '<th></th>'; } // each column gets a form foreach ($this->columns as $column) { $this->renderer->doc .= '<th>'; $form = new \Doku_Form(array('method' => 'GET', 'action' => wl($this->id))); unset($form->_hidden['sectok']); // we don't need it here if (!$conf['userewrite']) { $form->addHidden('id', $this->id); } // current value $dynamic = $this->searchConfig->getDynamicParameters(); $filters = $dynamic->getFilters(); if (isset($filters[$column->getFullQualifiedLabel()])) { list(, $current) = $filters[$column->getFullQualifiedLabel()]; $dynamic->removeFilter($column); } else { $current = ''; } // Add current request params $params = $dynamic->getURLParameters(); foreach ($params as $key => $val) { $form->addHidden($key, $val); } // add input field $key = $column->getFullQualifiedLabel() . '*~'; $form->addElement(form_makeField('text', SearchConfigParameters::$PARAM_FILTER . '[' . $key . ']', $current, '')); $this->renderer->doc .= $form->getForm(); $this->renderer->doc .= '</th>'; } $this->renderer->doc .= '</tr>'; }
function preList($clist, $data) { global $ID; global $conf; // Save current request params to not loose them $cur_params = array(); if (isset($_REQUEST['dataflt'])) { $cur_params = $this->dthlp->_a2ua('dataflt', $_REQUEST['dataflt']); } if (isset($_REQUEST['datasrt'])) { $cur_params['datasrt'] = $_REQUEST['datasrt']; } if (isset($_REQUEST['dataofs'])) { $cur_params['dataofs'] = $_REQUEST['dataofs']; } // build table $text = '<div class="table dataaggregation">' . '<table class="inline dataplugin_table ' . $data['classes'] . '">'; // build column headers $text .= '<tr>'; foreach ($data['headers'] as $num => $head) { $ckey = $clist[$num]; $text .= '<th>'; // add sort arrow if (isset($data['sort']) && $ckey == $data['sort'][0]) { if ($data['sort'][1] == 'ASC') { $text .= '<span>↓</span> '; $ckey = '^' . $ckey; } else { $text .= '<span>↑</span> '; } } // Clickable header for dynamic sorting $text .= '<a href="' . wl($ID, array('datasrt' => $ckey) + $cur_params) . '" title="' . $this->getLang('sort') . '">' . hsc($head) . '</a>'; $text .= '</th>'; } $text .= '</tr>'; // Dynamic filters if ($data['dynfilters']) { $text .= '<tr class="dataflt">'; foreach ($data['headers'] as $num => $head) { $text .= '<th>'; $form = new Doku_Form(array('method' => 'GET')); $form->_hidden = array(); if (!$conf['userewrite']) { $form->addHidden('id', $ID); } $key = 'dataflt[' . $data['cols'][$clist[$num]]['colname'] . '*~' . ']'; $val = isset($cur_params[$key]) ? $cur_params[$key] : ''; // Add current request params foreach ($cur_params as $c_key => $c_val) { if ($c_val !== '' && $c_key !== $key) { $form->addHidden($c_key, $c_val); } } $form->addElement(form_makeField('text', $key, $val, '')); $text .= $form->getForm(); $text .= '</th>'; } $text .= '</tr>'; } return $text; }
/** * Print the update profile form * * @author Christopher Smith <*****@*****.**> * @author Andreas Gohr <*****@*****.**> */ function html_updateprofile() { global $lang; global $conf; global $INPUT; global $INFO; /** @var DokuWiki_Auth_Plugin $auth */ global $auth; print p_locale_xhtml('updateprofile'); print '<div class="centeralign">' . NL; $fullname = $INPUT->post->str('fullname', $INFO['userinfo']['name'], true); $email = $INPUT->post->str('email', $INFO['userinfo']['mail'], true); $form = new Doku_Form(array('id' => 'dw__register')); $form->startFieldset($lang['profile']); $form->addHidden('do', 'profile'); $form->addHidden('save', '1'); $form->addElement(form_makeTextField('login', $_SERVER['REMOTE_USER'], $lang['user'], '', 'block', array('size' => '50', 'disabled' => 'disabled'))); $attr = array('size' => '50'); if (!$auth->canDo('modName')) { $attr['disabled'] = 'disabled'; } $form->addElement(form_makeTextField('fullname', $fullname, $lang['fullname'], '', 'block', $attr)); $attr = array('size' => '50', 'class' => 'edit'); if (!$auth->canDo('modMail')) { $attr['disabled'] = 'disabled'; } $form->addElement(form_makeField('email', 'email', $email, $lang['email'], '', 'block', $attr)); $form->addElement(form_makeTag('br')); if ($auth->canDo('modPass')) { $form->addElement(form_makePasswordField('newpass', $lang['newpass'], '', 'block', array('size' => '50'))); $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size' => '50'))); } if ($conf['profileconfirm']) { $form->addElement(form_makeTag('br')); $form->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size' => '50', 'required' => 'required'))); } $form->addElement(form_makeButton('submit', '', $lang['btn_save'])); $form->addElement(form_makeButton('reset', '', $lang['btn_reset'])); $form->endFieldset(); html_form('updateprofile', $form); if ($auth->canDo('delUser') && actionOK('profile_delete')) { $form_profiledelete = new Doku_Form(array('id' => 'dw__profiledelete')); $form_profiledelete->startFieldset($lang['profdeleteuser']); $form_profiledelete->addHidden('do', 'profile_delete'); $form_profiledelete->addHidden('delete', '1'); $form_profiledelete->addElement(form_makeCheckboxField('confirm_delete', '1', $lang['profconfdelete'], 'dw__confirmdelete', '', array('required' => 'required'))); if ($conf['profileconfirm']) { $form_profiledelete->addElement(form_makeTag('br')); $form_profiledelete->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size' => '50', 'required' => 'required'))); } $form_profiledelete->addElement(form_makeButton('submit', '', $lang['btn_deleteuser'])); $form_profiledelete->endFieldset(); html_form('profiledelete', $form_profiledelete); } print '</div>' . NL; }
/** * output appropriate html */ function html() { global $ID; ptln('<h1>' . $this->getLang('menu') . '</h1>'); $form = new Doku_Form(array('id' => 'vg', 'action' => wl($ID))); $form->addHidden('cmd', $this->edit ? 'edit' : 'add'); $form->addHidden('sectok', getSecurityToken()); $form->addHidden('page', $this->getPluginName()); $form->addHidden('do', 'admin'); $form->startFieldset($this->getLang($this->edit ? 'edituser' : 'adduser')); if ($this->edit) { $form->addElement(form_makeField('text', 'user', $this->data['user'], $this->getLang('user'), '', '', array('disabled' => 'disabled'))); $form->addHidden('uid', $this->data['user']); $form->addElement('<br />'); } else { $form->addElement(form_makeField('text', 'uid', '', $this->getLang('user'))); $form->addElement('<br />'); } $form->addElement(form_makeField('text', 'grp', $this->edit ? implode(', ', $this->data['grp']) : '', $this->getLang('grp'))); $form->addElement('<br />'); $form->addElement(form_makeButton('submit', '', $this->getLang($this->edit ? 'change' : 'add'))); $form->endFieldset(); $form->printForm(); ptln('<table class="inline" id="vg__show">'); ptln(' <tr>'); ptln(' <th class="user">' . hsc($this->getLang('users')) . '</th>'); ptln(' <th class="grp">' . hsc($this->getLang('grps')) . '</th>'); ptln(' <th> </th>'); ptln(' </tr>'); foreach ($this->users as $user => $grps) { //$userdata=$this->_auth->getUserData($user); ptln(' <tr>'); ptln(' <td>' . hsc($user) . (isset($userdata['name']) ? hsc(' (' . $userdata['name'] . ')') : '') . '</td>'); ptln(' <td>' . hsc(implode(', ', $grps)) . '</td>'); ptln(' <td class="act">'); ptln(' <a class="vg_edit" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'edit', 'uid' => $user, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('edit')) . '</a>'); ptln(' • '); ptln(' <a class="vg_del" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'del', 'uid' => $user, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('del')) . '</a>'); ptln(' </td>'); ptln(' </tr>'); } ptln('</table>'); $form = new Doku_Form(array('id' => 'vg', 'action' => wl($ID))); $form->addHidden('cmd', $this->editgroup ? 'editgroup' : 'addgroup'); $form->addHidden('sectok', getSecurityToken()); $form->addHidden('page', $this->getPluginName()); $form->addHidden('do', 'admin'); if ($this->editgroup) { $form->startFieldset($this->getLang('editgroup')); $form->addElement(form_makeField('text', 'group', $this->data['group'], $this->getLang('grp'), '', '', array('disabled' => 'disabled'))); $form->addElement('<br />'); $form->addHidden('uid', $this->data['group']); $form->addElement(form_makeField('text', 'users', implode(', ', $this->data['users']), $this->getLang('users'))); $form->addElement('<br />'); } else { $form->startFieldset($this->getLang('addgroup')); $form->addElement(form_makeField('text', 'uid', '', $this->getLang('grp'))); $form->addElement('<br />'); $form->addElement(form_makeField('text', 'users', '', $this->getLang('users'))); $form->addElement('<br />'); } $form->addElement(form_makeButton('submit', '', $this->getLang($this->editgroup ? 'change' : 'add'))); $form->endFieldset(); $form->printForm(); ptln('<table class="inline" id="vg__show">'); ptln(' <tr>'); ptln(' <th class="grp">' . hsc($this->getLang('grps')) . '</th>'); ptln(' <th class="user">' . hsc($this->getLang('users')) . '</th>'); ptln(' <th class="act"> </th>'); ptln(' </tr>'); foreach ($this->groups as $group => $users) { ptln(' <tr>'); ptln(' <td>' . hsc($group) . '</td>'); ptln(' <td>' . hsc(implode(', ', $users)) . '</td>'); ptln(' <td class="act">'); ptln(' <a class="vg_edit" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'editgroup', 'uid' => $group, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('edit')) . '</a>'); ptln(' • '); ptln(' <a class="vg_del" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'delgroup', 'uid' => $group, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('del')) . '</a>'); ptln(' </td>'); ptln(' </tr>'); } ptln('</table>'); $form = new Doku_Form(array('id' => 'vg', 'action' => wl($ID))); $form->addHidden('cmd', 'search'); $form->addHidden('sectok', getSecurityToken()); $form->addHidden('page', $this->getPluginName()); $form->addHidden('do', 'admin'); $form->startFieldset($this->getLang('searchuser')); $form->addElement(form_makeField('text', 'uid', '', $this->getLang('searchname'))); $form->addElement(form_makeButton('submit', '', $this->getLang('search'))); $form->printForm(); if (!empty($this->_auth_userlist)) { ptln('<table class="inline" id="vg__show">'); ptln(' <tr>'); ptln(' <th class="user">' . hsc($this->getLang('users')) . '</th>'); ptln(' <th class="act"> </th>'); ptln(' </tr>'); foreach ($this->_auth_userlist as $user => $userinfo) { ptln(' <tr>'); ptln(' <td>' . hsc($user . ' (' . $userinfo['name'] . ')') . '</td>'); ptln(' <td class="act">'); ptln(' <a class="vg_edit" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'edit', 'uid' => $user, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('edit')) . '</a>'); ptln(' </td>'); ptln(' </tr>'); } ptln('</table>'); } }
/** * Create table header * * @param array $clist keys of the columns * @param array $data instruction by handler * @return string html of table header */ function preList($clist, $data) { global $ID; global $conf; // Save current request params to not loose them $cur_params = $this->dthlp->_get_current_param(); //show active filters $text = '<div class="table dataaggregation">'; if (isset($_REQUEST['dataflt'])) { $filters = $this->dthlp->_get_filters(); $fltrs = array(); foreach ($filters as $filter) { if (strpos($filter['compare'], 'LIKE') !== false) { if (strpos($filter['compare'], 'NOT') !== false) { $comparator_value = '!~' . str_replace('%', '*', $filter['value']); } else { $comparator_value = '*~' . str_replace('%', '', $filter['value']); } $fltrs[] = $filter['key'] . $comparator_value; } else { $fltrs[] = $filter['key'] . $filter['compare'] . $filter['value']; } } $text .= '<div class="filter">'; $text .= '<h4>' . sprintf($this->getLang('tablefilteredby'), hsc(implode(' & ', $fltrs))) . '</h4>'; $text .= '<div class="resetfilter">' . '<a href="' . wl($ID) . '">' . $this->getLang('tableresetfilter') . '</a>' . '</div>'; $text .= '</div>'; } // build table $text .= '<table class="inline dataplugin_table ' . $data['classes'] . '">'; // build column headers $text .= '<tr>'; if ($data['rownumbers']) { $text .= '<th>#</th>'; } foreach ($data['headers'] as $num => $head) { $ckey = $clist[$num]; $width = ''; if (isset($data['widths'][$num]) and $data['widths'][$num] != '-') { $width = ' style="width: ' . $data['widths'][$num] . ';"'; } $text .= '<th' . $width . '>'; // add sort arrow if (isset($data['sort']) && $ckey == $data['sort'][0]) { if ($data['sort'][1] == 'ASC') { $text .= '<span>↓</span> '; $ckey = '^' . $ckey; } else { $text .= '<span>↑</span> '; } } // Clickable header for dynamic sorting $text .= '<a href="' . wl($ID, array('datasrt' => $ckey) + $cur_params) . '" title="' . $this->getLang('sort') . '">' . hsc($head) . '</a>'; $text .= '</th>'; } $text .= '</tr>'; // Dynamic filters if ($data['dynfilters']) { $text .= '<tr class="dataflt">'; if ($data['rownumbers']) { $text .= '<th></th>'; } foreach ($data['headers'] as $num => $head) { $text .= '<th>'; $form = new Doku_Form(array('method' => 'GET')); $form->_hidden = array(); if (!$conf['userewrite']) { $form->addHidden('id', $ID); } $key = 'dataflt[' . $data['cols'][$clist[$num]]['colname'] . '*~' . ']'; $val = isset($cur_params[$key]) ? $cur_params[$key] : ''; // Add current request params foreach ($cur_params as $c_key => $c_val) { if ($c_val !== '' && $c_key !== $key) { $form->addHidden($c_key, $c_val); } } $form->addElement(form_makeField('text', $key, $val, '')); $text .= $form->getForm(); $text .= '</th>'; } $text .= '</tr>'; } return $text; }
/** * Display the form to edit image meta data * * @author Andreas Gohr <*****@*****.**> * @author Kate Arzamastseva <*****@*****.**> */ function media_metaform($id, $auth) { global $lang; if ($auth < AUTH_UPLOAD) { echo '<div class="nothing">' . $lang['media_perm_upload'] . '</div>' . NL; return false; } // load the field descriptions static $fields = null; if (is_null($fields)) { $config_files = getConfigFiles('mediameta'); foreach ($config_files as $config_file) { if (@file_exists($config_file)) { include $config_file; } } } $src = mediaFN($id); // output $form = new Doku_Form(array('action' => media_managerURL(array('tab_details' => 'view'), '&'), 'class' => 'meta')); $form->addHidden('img', $id); $form->addHidden('mediado', 'save'); foreach ($fields as $key => $field) { // get current value if (empty($field[0])) { continue; } $tags = array($field[0]); if (is_array($field[3])) { $tags = array_merge($tags, $field[3]); } $value = tpl_img_getTag($tags, '', $src); $value = cleanText($value); // prepare attributes $p = array(); $p['class'] = 'edit'; $p['id'] = 'meta__' . $key; $p['name'] = 'meta[' . $field[0] . ']'; $p_attrs = array('class' => 'edit'); $form->addElement('<div class="row">'); if ($field[2] == 'text') { $form->addElement(form_makeField('text', $p['name'], $value, $lang[$field[1]] ? $lang[$field[1]] : $field[1] . ':', $p['id'], $p['class'], $p_attrs)); } else { $att = buildAttributes($p); $form->addElement('<label for="meta__' . $key . '">' . $lang[$field[1]] . '</label>'); $form->addElement("<textarea {$att} rows=\"6\" cols=\"50\">" . formText($value) . '</textarea>'); } $form->addElement('</div>' . NL); } $form->addElement('<div class="buttons">'); $form->addElement(form_makeButton('submit', '', $lang['btn_save'], array('accesskey' => 's', 'name' => 'mediado[save]'))); $form->addElement('</div>' . NL); $form->printForm(); return true; }
/** * The custom editor for editing data entries * * Gets called from action_plugin_data::_editform() where also the form member is attached * * @param array $data * @param Doku_Renderer_plugin_data_edit $renderer */ function _editData($data, &$renderer) { $renderer->form->startFieldset($this->getLang('dataentry')); $renderer->form->_content[count($renderer->form->_content) - 1]['class'] = 'plugin__data'; $renderer->form->addHidden('range', '0-0'); // Adora Belle bugfix if ($this->getConf('edit_content_only')) { $renderer->form->addHidden('data_edit[classes]', $data['classes']); $columns = array('title', 'value', 'comment'); $class = 'edit_content_only'; } else { $renderer->form->addElement(form_makeField('text', 'data_edit[classes]', $data['classes'], $this->getLang('class'), 'data__classes')); $columns = array('title', 'type', 'multi', 'value', 'comment'); $class = 'edit_all_content'; // New line $data['data'][''] = ''; $data['cols'][''] = array('type' => '', 'multi' => false); } $renderer->form->addElement("<table class=\"{$class}\">"); //header $header = '<tr>'; foreach ($columns as $column) { $header .= '<th class="' . $column . '">' . $this->getLang($column) . '</th>'; } $header .= '</tr>'; $renderer->form->addElement($header); //rows $n = 0; foreach ($data['cols'] as $key => $vals) { $fieldid = 'data_edit[data][' . $n++ . ']'; $content = $vals['multi'] ? implode(', ', $data['data'][$key]) : $data['data'][$key]; if (is_array($vals['type'])) { $vals['basetype'] = $vals['type']['type']; if (isset($vals['type']['enum'])) { $vals['enum'] = $vals['type']['enum']; } $vals['type'] = $vals['origtype']; } else { $vals['basetype'] = $vals['type']; } if ($vals['type'] === 'hidden') { $renderer->form->addElement('<tr class="hidden">'); } else { $renderer->form->addElement('<tr>'); } if ($this->getConf('edit_content_only')) { if (isset($vals['enum'])) { $values = preg_split('/\\s*,\\s*/', $vals['enum']); if (!$vals['multi']) { array_unshift($values, ''); } $content = form_makeListboxField($fieldid . '[value][]', $values, $data['data'][$key], $vals['title'], '', '', $vals['multi'] ? array('multiple' => 'multiple') : array()); } else { $classes = 'data_type_' . $vals['type'] . ($vals['multi'] ? 's' : '') . ' ' . 'data_type_' . $vals['basetype'] . ($vals['multi'] ? 's' : ''); $attr = array(); if ($vals['basetype'] == 'date' && !$vals['multi']) { $attr['class'] = 'datepicker'; } $content = form_makeField('text', $fieldid . '[value]', $content, $vals['title'], '', $classes, $attr); } $cells = array(hsc($vals['title']) . ':', $content, '<span title="' . hsc($vals['comment']) . '">' . hsc($vals['comment']) . '</span>'); foreach (array('multi', 'comment', 'type') as $field) { $renderer->form->addHidden($fieldid . "[{$field}]", $vals[$field]); } $renderer->form->addHidden($fieldid . "[title]", $vals['origkey']); //keep key as key, even if title is translated } else { $check_data = $vals['multi'] ? array('checked' => 'checked') : array(); $cells = array(form_makeField('text', $fieldid . '[title]', $vals['origkey'], $this->getLang('title')), form_makeMenuField($fieldid . '[type]', array_merge(array('', 'page', 'nspage', 'title', 'img', 'mail', 'url', 'tag', 'wiki', 'dt', 'hidden'), array_keys($this->dthlp->_aliases())), $vals['type'], $this->getLang('type')), form_makeCheckboxField($fieldid . '[multi]', array('1', ''), $this->getLang('multi'), '', '', $check_data), form_makeField('text', $fieldid . '[value]', $content, $this->getLang('value')), form_makeField('text', $fieldid . '[comment]', $vals['comment'], $this->getLang('comment'), '', 'data_comment', array('readonly' => 1, 'title' => $vals['comment']))); } foreach ($cells as $index => $cell) { $renderer->form->addElement("<td class=\"{$columns[$index]}\">"); $renderer->form->addElement($cell); $renderer->form->addElement('</td>'); } $renderer->form->addElement('</tr>'); } $renderer->form->addElement('</table>'); $renderer->form->endFieldset(); }
/** * render the manage_files action * */ function render(&$event, $param) { global $ID; $perm = auth_quickaclcheck($ID); if ($event->data != 'manage_files') { return; } $event->preventDefault(); if ($perm < AUTH_READ) { echo '<h1>Error</h1><p>You do not have permission to view this page</p>'; return; } $project = Project::project(); if ($project == NULL) { echo '<h1>Error</h1>'; $project = getNS($ID); $path = explode(":", $project); if (!$project || $path[0] != PROJECTS_NAMESPACE) { echo "<p>Projects wiki has to work under the " . PROJECTS_NAMESPACE . " namespace</p>"; return; } $parent = getNS($project); if (!$parent) { echo "<p>The namespace " . PROJECTS_NAMESPACE . " has not been created yet!</p>"; return; } echo "<p>This project does not exist!</p>"; $name = noNS($parent); $link = DOKU_URL . "/doku.php?id={$parent}:{$name}&do=manage_files"; echo "<p>Go back to <a href=\"{$link}\">{$parent}</a>"; return; } echo '<h1>Manage Project ' . $project->name() . '</h1>'; $files = $project->files(); ksort($files); echo "<h1>Manage Files</h1>"; echo "<table>"; foreach (array(SOURCE, TARGET, CROSSLINK) as $type) { $count = 0; $utype = ucfirst($type); echo "<tr><td></td><td></td><td><h2>{$utype} Files</h2></td></tr>"; foreach ($files as $file) { if ($file->type() != $type) { continue; } echo "<tr>"; $name = $file->name(); echo "<td>"; if ($file->is_target() && $perm > AUTH_READ) { echo button_remake($project->id($name)); } echo "</td>"; echo "<td>"; if ($perm >= AUTH_DELETE) { echo button_delete($project->id($name)); } echo "</td>"; echo "<td>"; echo html_wikilink($project->id($name)); if ($project->error($name) != NULL) { echo "<img src=\"" . DOKU_URL . "/lib/images/error.png\"></img>"; } echo "</td>"; echo "</tr>"; $count++; } if ($count == 0) { echo "<tr><td></td><td></td><td>No {$type} files in this project</td></tr>"; } } $files = $project->subprojects(); if ($files) { sort($files); echo "<tr><td></td><td></td><td><h2>Subprojects</h2></td></tr>"; foreach ($files as $file) { $id = $project->name() . ":{$file}"; $link = DOKU_URL . "/doku.php?id={$id}:{$file}&do=manage_files"; echo "<tr><td></td><td></td><td>"; echo "<a href=\"{$link}\">{$file}</a>"; echo "</td>"; echo "</tr>"; } } echo "</table>"; $parent = $project->parent(); if ($parent != NULL) { echo "<h1>Parent project</h1>"; $name = $parent->name(); $file = end(explode(":", $name)); $link = DOKU_URL . "/doku.php?id={$name}:{$file}&do=manage_files"; echo "<a href=\"{$link}\">{$name}</a>"; } if ($perm <= AUTH_READ) { return; } echo "<p/><h1>Create Files</h1>"; $create = new Doku_Form("Create"); $create->addHidden("do", "create"); $create->addHidden("page", "projects_manage_files"); $create->addHidden("id", $ID); $create->startFieldSet('Create a new file'); $create->addElement(form_makeOpenTag("p")); $create->addElement(form_makeField('text', 'File name')); $create->addElement(form_makeCloseTag("p")); $create->addElement(form_makeOpenTag("p")); $create->addElement(form_makeRadioField('Type', SOURCE, "Source", "", "", array('checked' => "true"))); $create->addElement(form_makeRadioField('Type', TARGET, 'Generated')); $create->addElement(form_makeRadioField('Type', CROSSLINK, 'Crosslink')); $create->addElement(form_makeCloseTag("p")); $create->addElement(form_makeButton("submit", '', "Create")); $create->endFieldSet(); echo $create->getForm(); echo "<h1>Create subproject</h1>"; $subproject = new Doku_Form("Subproject"); $subproject->addHidden("do", "create_subproject"); $subproject->addHidden("page", "projects_manage_files"); $subproject->addHidden("id", $ID); $subproject->startFieldSet('Create a new subproject'); $subproject->addElement(form_makeOpenTag("p")); $subproject->addElement(form_makeField('text', 'Project name')); $subproject->addElement(form_makeCloseTag("p")); $subproject->addElement(form_makeButton("submit", '', "Create sub-project")); $subproject->endFieldSet(); echo $subproject->getForm(); echo "<h1>Clean up</h1>"; $clean = new Doku_Form("Clean"); $clean->addHidden("do", "clean"); $clean->addHidden("page", "projects_manage_files"); $clean->addHidden("id", $ID); $clean->startFieldSet('Clean the project'); $clean->addElement(form_makeCheckboxField("Recursive")); $clean->addElement(form_makeButton("submit", "", "Clean")); $clean->endFieldSet(); echo $clean->getForm(); if ($perm < AUTH_ADMIN) { return; } echo "<h1>Rebuild the project</h1>"; $rebuild = new Doku_Form("rebuild"); $rebuild->addHidden("do", "rebuild"); $rebuild->addHidden("page", "projects_manage_files"); $rebuild->addHidden("id", $ID); $rebuild->startFieldSet('Rebuild the project'); $rebuild->addElement(form_makeButton("submit", '', "Rebuild")); $rebuild->endFieldSet(); echo $rebuild->getForm(); }