JumpBox-Talk

Summary: Talk page for JumpBox.
Maintainer:
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments

I keep getting the following error

Fatal error: Call to undefined function InputSelect() in /var/www/vhosts/ilovemacaroniandcheese.com/httpdocs/pmwiki/pmwiki.php(1239) : regexp code on line 1

Any ideas? --DavidBessler July 12, 2007, at 10:26 PM

Ditto...Anyone? --BarryKenee? October 29, 2008, at 12:43 PM

You say download and enable jumpbox.php, I know how to download it but how do I enable it?

I added instructions for enabling the recipe above XES August 25, 2008, at 11:17 AM

This recipe works fine on some websites but when the URL is ?n=Group.Page it doesn't work. Script needs to take $ScriptUrl into account and whether clean URLs are enabled or not, and form proper URLS.... don't know how to change the Javascript myself.... XES August 25, 2008, at 11:20 AM

Created a solution. See below:

Jump to any Group/Pagename

This solution gets around using "Group/Pagename" for the jump targets & works only with $EnablePathInfo = 1. You must specify Group, you may use Group without PageName and PmWiki will select the default page for the group, per usual.


<?php if (!defined('PmWiki')) exit();

$HTMLHeaderFmt['jumpbox'] =
  "<script type='text/javascript'><!--
  function jump(postfix)
{
	var destination = '$ScriptUrl/' + postfix;
	window.location.href = destination;
}
//-->  
  </script>

  ";

$FmtPV['$_UniqId_'] = '($GLOBALS["_UniqId_"] = uniqid("id"))';
$FmtPV['$_PrevId_'] = '$GLOBALS["_UniqId_"]';
$InputTags['jumpbox'] = array(
  'name' => 'n',
  ':html' =>
    "<form action='{$PageUrl}' method='get'>
     <select onchange='jump(this.options[this.selectedIndex].value)'
       \$InputSelectArgs class='inputbox' >\$InputSelectOptions</select>
     <input id='{\$_UniqId_}' type='submit' value='$[Jump to page]' class='inputbutton' />
     <script type='text/javascript'><!--
document.getElementById('{\$_PrevId_}').style.display = 'none';
//--></script></form>");

Markup('input-jumpbox', '<split',
  '/\\(:input\\s+jumpbox\\s.*?:\\)(?:\\s*\\(:input\\s+jumpbox\\s.*?:\\))*/ei',
  "InputSelect(\$pagename, 'jumpbox', PSS('$0'))");

20081006
My wiki uses clean url's and I like this recipe. It works well with the pagelist directive but using it manually as
(:input jumpbox value=Main.HomePage:)
doesn't work. I played around with it and finally got it to work perfectly using
(:input jumpbox value={$ScriptUrl}/Main.HomePage label="Home Page":)
You have to use the label= option or else the entire url is shown in the button.
Ian MacGregor

UPDATE: Oops, spoke too soon. This recipe, "out-of-the-box", breaks validation on my site so I won't be able to use it. Ian MacGregor

09-06-2010
a question - how do i get this to open a link in a new window? target='new' or variations of this do not work. any suggestions? i am (unfortunately) using ie6. any help would be appreciated! david

2017-09-17
Wow, this answer took some time. I chanced the code to:
<select \$InputSelectArgs class='inputbox' onchange=\"window.open(this.options[this.selectedIndex].value,'_blank','');\">

to get it in anew window. Armin

Talk page for the JumpBox recipe (users?).