4 * Copyright 1999, 2000, 2001, 2002, 2004 $ThePhpWikiProgrammingTeam
6 * This file is part of PhpWiki.
8 * PhpWiki is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * PhpWiki is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with PhpWiki; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * This is a replacement for MagicPhpWikiURL forms.
25 * Just a few old actions are supported, which where previously
26 * encoded with the phpwiki: syntax.
28 * See WikiFormMore for the more generic version.
30 class WikiPlugin_WikiForm
37 function getDescription () {
38 return _("Provide generic WikiForm input buttons");
41 function getVersion() {
42 return preg_replace("/[Revision: $]/", '',
46 function getDefaultArguments() {
47 return array('action' => 'upload', // 'upload', 'loadfile', or
50 'buttontext' => false,
56 function run($dbi, $argstr, &$request, $basepage) {
57 extract($this->getArgs($argstr, $request));
58 $form = HTML::form(array('action' => $request->getPostURL(),
60 'class' => 'wikiadmin',
61 'accept-charset' => $GLOBALS['charset']),
62 HiddenInputs(array('action' => $action,
63 'pagename' => $basepage)));
64 $input = array('type' => 'text',
70 $input['name'] = 'source';
72 $input['value'] = DEFAULT_DUMP_DIR;
74 $buttontext = _("Load File");
78 $input['name'] = 'source';
80 $buttontext = _("Login");
84 $input['name'] = 'directory';
86 $input['value'] = DEFAULT_DUMP_DIR;
88 $buttontext = _("Dump Pages");
92 $input['name'] = 'directory';
94 $input['value'] = HTML_DUMP_DIR;
96 $buttontext = _("Dump Pages as XHTML");
100 $form->setAttr('enctype', 'multipart/form-data');
101 $form->pushContent(HTML::input(array('name' => 'MAX_FILE_SIZE',
102 'value' => MAX_UPLOAD_SIZE,
103 'type' => 'hidden')));
104 $input['name'] = 'file';
105 $input['type'] = 'file';
107 $buttontext = _("Upload");
108 $class = false; // local OS function, so use native OS button
111 return HTML::p(fmt("WikiForm: %s: unknown action", $action));
115 $input = HTML::input($input);
116 $input->addTooltip($buttontext);
117 $button = Button('submit:', $buttontext, $class);
118 if ($request->getArg('start_debug'))
119 $form->pushContent(HTML::input(array('name' => 'start_debug',
120 'value' => $request->getArg('start_debug'),
121 'type' => 'hidden')));
122 $form->pushContent(HTML::span(array('class' => $class),
134 // c-hanging-comment-ender-p: nil
135 // indent-tabs-mode: nil