20,268 downloads - November 27, 2013
We are switched to admin only, please email markdilley@gmail if you would like to edit.

Add The Link To JAMWiki

From Universal Edit Button

Jump to: navigation, search

The most trivial way to add the link to JAMWiki is to edit main/webapp/WEB-INF/jsp/top.jsp that makes the header of wiki pages, by adding the lines

 <link rel="alternate" type="application/x-wiki" title="Click to edit '${pageInfo.pageTitle.params[0]}' page" 
   href="./Special:Edit?topic=${pageInfo.pageTitle.params[0]}"/>

You even do not need to be a Java programmer to implement this change, and you can make it in compiled (or even deployed and running) installation. The main limitation of this simple solution is that the topic name directly goes into URL, so you need to care about the allowed characters in your topic name (even space character may not work).

To implement properly, you also need to modify the method view of the TopicServlet.java in main/java/org/jamwiki/servlets/ and set there the JSP variable editlink, probably using the method ServletUtil.isEditable to check if the page is actually editable for the current user:

next.add("editlink", "./Special:Edit?topic="+Utilities.encodeAndEscapeTopicName(topicName));

The variable topicName is available in the 0.8.1 version and may still be available in later versions. Unfortunately, after this change you need to rebuild the modified project in Maven and, in general, it is advisible to be a Java programmer and undestand that are you doing.

Then, in top.jsp, the following change is enough:

<c:if test="${!empty editlink}">
  <link rel="alternate" type="application/x-wiki" title="Click to edit '${pageInfo.pageTitle.params[0]}' page" href="./${editlink}"/>
</c:if>

Hopefully JAMWiki will implement native support in the future.

Personal tools