TitleSearch, Edit, and GoTo buttons
Date27-Nov-2005 20:43:54 EET
JSPWiki version2.2.33
Submitter69.194.120.34
Idea CategoryTemplateIdea, UserInterfaceIdea
Reference
Idea StatusNewIdea

The SearchBox in the upper-right corner of a JSPWiki normally has a single function... To search.

I have modified it to have three functions: GoTo, Edit and Search. I find this to be a huge convenience in navigating and editing the wiki.

A little javascript makes it work. When you click:

  • GoTo, it takes you to view the page you have typed in the box.
  • Edit, it takes you immediately to editing the page you have typed in the box.
  • Search works just like the old "Find!" button.
  • The "adv." text is for "advanced search", and is a link to the search page, in the same way the old "Search Wiki" link was.

In all three cases, if the box is empty, it will use the name of the current page you are viewing or editing. ie. The "Edit" button can double for the "Edit this page" link, and the "Search" button will quickly find other pages containing the text of the name of this page.

(Actually, use "Find" instead of "Search". It's just a bit tighter and nicer.)

To make this work, all you need to do is copy the three attached button-images (goto.gif, edit.gif and search.gif into the "images" directory of the webapp, and change your SearchBox.jsp file in your template to look something like this:

<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
<%-- Provides a simple searchbox that can be easily included anywhere
     on the page --%>

<div class="searchbox">
<form name="searchform" onsubmit="if(box.value==''){box.value='<wiki:PageName/>';}" accept-charset="<wiki:ContentEncoding />">
	<input name="box">
	<SCRIPT LANGUAGE="JavaScript">
		var sf= document.searchform;
		var box=sf.box;
		var baseurl = "<wiki:BaseURL/>";
		
		button("goto.gif","Goto","Wiki.jsp","page"); 
		button("edit.gif","Edit","Edit.jsp","page");
		button("search.gif","Search","Search.jsp","query");

		function button (gif, alt, handler, boxname)
		{
			document.write('<input type=image src="'+baseurl+'images/'+gif+'" alt="'+alt+'" onclick="sf.action=\''+baseurl+handler+'\';box.name=\''+boxname+'\'">\n');
		}
	</SCRIPT>
	<wiki:LinkTo page="FindPage">adv.</wiki:LinkTo>
</form>
</div>

To give yourself similar capabilities as this in a wiki that you don't own, try my solution that uses bookmarklets instead: IdeaSearchEditAndGotoBookmarklets.

-- DanHoward, November 2005

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
png
GotoEditSearchButtons.png 10.0 kB 1 27-Nov-2005 20:44 DanHoward
gif
before.gif 1.5 kB 1 27-Nov-2005 20:48 DanHoward
gif
edit.gif 0.9 kB 1 27-Nov-2005 21:59 DanHoward
gif
find.gif 0.9 kB 1 01-Dec-2005 00:26 DanHoward
gif
goto.gif 0.9 kB 1 27-Nov-2005 21:59 DanHoward
gif
search.gif 0.9 kB 1 27-Nov-2005 21:59 DanHoward
« This page (revision-10) was last changed on 01-Dec-2005 00:30 by DanHoward