2 // $Id: WikiForm.php 8158 2011-10-03 12:40:18Z vargenau $
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 along
19 * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 getDefaultArguments() {
42 return array('action' => 'upload', // 'upload', 'loadfile', or
45 'buttontext' => false,
50 function run($dbi, $argstr, &$request, $basepage) {
51 extract($this->getArgs($argstr, $request));
52 $form = HTML::form(array('action' => $request->getPostURL(),
54 'class' => 'wikiadmin',
55 'accept-charset' => $GLOBALS['charset']),
56 HiddenInputs(array('action' => $action,
57 'pagename' => $basepage)));
58 $input = array('type' => 'text',
64 $input['name'] = 'source';
66 $input['value'] = DEFAULT_DUMP_DIR;
68 $buttontext = _("Load File");
72 $input['name'] = 'source';
74 $buttontext = _("Sign In");
78 $input['name'] = 'directory';
80 $input['value'] = DEFAULT_DUMP_DIR;
82 $buttontext = _("Dump Pages");
86 $input['name'] = 'directory';
88 $input['value'] = HTML_DUMP_DIR;
90 $buttontext = _("Dump Pages as XHTML");
94 $form->setAttr('enctype', 'multipart/form-data');
95 $form->pushContent(HTML::input(array('name' => 'MAX_FILE_SIZE',
96 'value' => MAX_UPLOAD_SIZE,
97 'type' => 'hidden')));
98 $input['name'] = 'file';
99 $input['type'] = 'file';
101 $buttontext = _("Upload");
102 $class = false; // local OS function, so use native OS button
105 return HTML::p(fmt("WikiForm: %s: unknown action", $action));
109 $input = HTML::input($input);
110 $input->addTooltip($buttontext);
111 $button = Button('submit:', $buttontext, $class);
112 if ($request->getArg('start_debug'))
113 $form->pushContent(HTML::input(array('name' => 'start_debug',
114 'value' => $request->getArg('start_debug'),
115 'type' => 'hidden')));
116 $form->pushContent(HTML::span(array('class' => $class),
127 // c-hanging-comment-ender-p: nil
128 // indent-tabs-mode: nil