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
40 function getDescription () {
41 return _("Go to or create page.");
44 function getDefaultArguments() {
45 return array('size' => 32);
48 function run($dbi, $argstr, &$request, $basepage) {
49 $request->setArg('action',false);
50 $args = $this->getArgs($argstr, $request);
53 if ($goto = $request->getArg('goto')) {
54 // The user has pressed 'Go'; process request
55 $request->setArg('goto', false);
56 $target = $goto['target'];
57 if ($dbi->isWikiPage($target))
58 $url = WikiURL($target,0,1);
60 $url = WikiURL($target, array('action'=>'edit'),1);
62 $request->redirect($url);
63 // User should see nothing after redirect
67 $action = $request->getURLtoSelf();
68 $form = HTML::form(array('action'=>$action,
72 $form->pushContent(HiddenInputs($request->getArgs()));
74 $textfield = HTML::input(array('type' => 'text',
76 'name' => 'goto[target]'));
78 $button = Button('submit:goto[go]', _("Go"), false);
80 $form->pushContent($textfield, $button);
91 // c-hanging-comment-ender-p: nil
92 // indent-tabs-mode: nil