2 rcs_id('$Id: GoTo.php,v 1.1 2004-04-12 13:16:54 rurban Exp $');
5 * Display a form with text entry box and 'Go' button.
6 * The user enters a page name... if it exists, browse
7 * that page; if not, edit (create) that page.
8 * Note: pagenames are absolute, not relative to the actual subpage.
10 * Usage: <?plugin GoTo ?>
11 * @author: Michael van Dam
21 function getDescription () {
22 return _("Go to or create page.");
25 function getDefaultArguments() {
29 function run($dbi, $argstr, $request, $basepage) {
30 $request->setArg('action',false);
31 $args = $this->getArgs($argstr, $request);
34 if ($goto = $request->getArg('goto')) {
35 // The user has pressed 'Go'; process request
36 $request->setArg('goto', false);
37 $target = $goto['target'];
38 if ($dbi->isWikiPage($target))
39 $url = WikiURL($target,0,1);
41 $url = WikiURL($target, array('action'=>'edit'),1);
43 $request->redirect($url);
44 // User should see nothing after redirect
48 $action = $request->getURLtoSelf();
49 $form = HTML::form(array('action'=>$action,
53 $form->pushContent(HiddenInputs($request->getArgs()));
55 $textfield = HTML::input(array('type'=>'text',
57 'name'=>'goto[target]'));
59 $button = Button('submit:goto[go]', _("Go"), false);
61 $form->pushContent($textfield, $button);
72 // c-hanging-comment-ender-p: nil
73 // indent-tabs-mode: nil