One of the biggest issues i have for new users is how to do obvious things like create, delete, and rename pages.
Update: wiki usage is up considerably after adding the create new page feature.
Here's my solution for creating a new page.
Add CreatePageBox.jsp in your templates directory.
<%-- Provides a entry field for specifying a page to create that can be
easily included anywhere on the page --%>
<DIV class="createbox">
<FORM action="<wiki:Variable var="baseURL"/>Edit.jsp"
ACCEPT-CHARSET="ISO-8859-1,UTF-8" method="POST">
<INPUT type="text" name="page" size="12" value="" />
<INPUT TYPE="submit" value="Create Page" />
</FORM>
</DIV>
It would be nice to have an additional button like 'Create' in analogy to the 'Find' button in 'Search Wiki'. If I try to add such a button in CreatePageBox.jsp:
<div class="createbox">
<form action="<wiki:Variable var="baseURL"/>Edit.jsp"
accept-charset="<wiki:ContentEncoding />">
<wiki:LinkTo page="CreateNewPage">Seite:</wiki:LinkTo>
<input type="text" name="page" size="15"/>
<input type="submit" name="ok" value="Create"/>
</form>
</div>
JSPWiki (v. 2.1.115) shows the follwing error:
JSPWiki has detected an error
Error Message
null
Exception
java.lang.NumberFormatException
Place where detected
java.lang.Long.parseLong(), line 363
Does anybody know what's wrong?-- Reinhard Engel, 2004-11-10
No-one's posted a resolution, thought I would as I have just added a create box to my wiki
Change the form
<div class="createbox">
<form action="<wiki:Variable var="baseURL"/>Edit.jsp"
accept-charset="<wiki:ContentEncoding />">
<wiki:LinkTo page="CreateNewPage">Seite:</wiki:LinkTo>
<input type="text" name="page" size="15"/>
<input type="submit" name="action" value="Create"/>
</form>
</div>
There's some date processing in the generated Edit_jsp.java that is triggered if the parameter "ok" is set (resolves the last "edittime"). This doesn't exist in your form. Either set it, or bypass it by changing the submit param name. If you leave the box blank, then you edit the current page, so labelling the button "Seite" may be somewhat a misnomer ;)
-- LewinChan, 2005-05-23
Edit ViewTemplate.jsp
Replace SearchBox with CreatePageBox. The search is still available in the left hand side menu so nothing is lost. You could obviously put the box anywhere.
Create CreateNewPage Page
This is the text I put in:
To create a new page just type in the name of the page you want to create and hit return. You will be taken to an edit box where you can input the content of your page.
This description is not compatible with JSPWiki 2.4.+.
--Martin, 15-Nov-2006
I came up with a better solution, at least for me.
Basically, I added a new tab between the "Comment?" and "Index" tabs called "Create Page"
Please note: I'm using the Brushed set of templates so my changes only apply there but I see no reason why this could not be applied to other templates.
Edit the PageActionsTop.jsp file and Copy/Paste this fragment after the comment tab definition
<wiki:CheckRequestContext context='view|info|diff|upload'>
<wiki:Permission permission="edit">
<span class="actionEdit">
<a href="javascript://nop/"
onclick="return SearchBox.go( '<wiki:Link format="url" page="__PAGEHERE__" context="edit" />','Enter page name to create ' );"
title="Create a new page[ c ]" accesskey="c">Create Page</a>
</span>
</wiki:Permission>
</wiki:CheckRequestContext>
This will add a new "Create Page" tab. When a user clicks on this tab, a dialog will pop-up prompting them for the name of the new page. If they enter a name and click ok, it will take them to the Edit page for the new wiki page.
I've tested this on Firefox 2.x and IE 5.0.
-- cfitch
(Added by JJ because this message gets caught by Akismet.)
In the above modification to PageActionsTop.jsp 'SearchBox.go' should be 'SearchBox.navigate' when using the default template and JSPWiki v2.6.2.
--PatrickBerry
, 27-Apr-2008