4 * Copyright (C) 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 * Display a form with text entry box and 'Go' button.
25 * The user enters a page name... if it exists, browse
26 * that page; if not, edit (create) that page.
27 * Note: pagenames are absolute, not relative to the actual subpage.
30 * @author: Michael van Dam
36 function getDescription()
38 return _("Go to or create page.");
41 function getDefaultArguments()
43 return array('size' => 32);
46 function run($dbi, $argstr, &$request, $basepage)
48 $request->setArg('action', false);
49 $args = $this->getArgs($argstr, $request);
52 if ($goto = $request->getArg('goto')) {
53 // The user has pressed 'Go'; process request
54 $request->setArg('goto', false);
55 $target = $goto['target'];
56 if ($dbi->isWikiPage($target))
57 $url = WikiURL($target, 0, 1);
59 $url = WikiURL($target, array('action' => 'edit'), 1);
61 $request->redirect($url);
62 // User should see nothing after redirect
66 $action = $request->getURLtoSelf();
67 $form = HTML::form(array('action' => $action,
71 $form->pushContent(HiddenInputs($request->getArgs()));
73 $textfield = HTML::input(array('type' => 'text',
75 'name' => 'goto[target]'));
77 $button = Button('submit:goto[go]', _("Go"), false);
79 $form->pushContent($textfield, $button);
90 // c-hanging-comment-ender-p: nil
91 // indent-tabs-mode: nil