[{SET versionLabel='Approved' }]   
[{SET liveVersion='37' }]      
JSPWiki is great in handling multiple versions of a page.
However, there is no easy way to add meta data to a version of a page.

It would be useful to add a __versionLabel__ and a __liveVersion__ to a page.
The versionLabel indicates the 'state' of that page : 
e.g. 'Draft', 'Approved', 'Under construction', etc.
The liveVersion refers to the actual stable version of the page.
(i got the idea of a liveVersion from [Daisy|http://new.cocoondev.org/daisy/2])

Here is my (to) simplistic approach.   --[DF|DirkFrederickx]

! Add meta data to a page. 

An easy way to introduce the __versionLabel__ and __liveVersion__ in a page, is to use a wiki variable.
You can change the value of this variable at each edit session of the page.

  [{SET versionLabel='First DRAFT' }]
  [{SET liveVersion='14' }]

A few small changes are needed on the {{~InfoContent.jsp}} to display the versionLabel for each
version, and a orange marker for the live version.

  <table class="wikitable">

      <wiki:PageType type="page">
        <th>Version Label</th>  <!-- insert extra column here -->

    <wiki:HistoryIterator id="currentPage">
        <wiki:LinkTo version="<%=Integer.toString(currentPage.getVersion())%>">
        <%= ( (liveVersion!= 0) && (liveVersion == currentPage.getVersion() ) ) 
            ? "&nbsp;&nbsp;<span style=\"background:#FF9933;\">&laquo;Live</span>" : "" 
      <!-- get value of the wiki variable of this page -->
      <wiki:PageType type="page">
        <td><wiki:Variable var='versionLabel' default="&nbsp;"/></td>
Note: the ~HistoryIterator allows for automatic retrieval of the variable of that specific page. Magic !

! Simplified editing of the meta data of the page

Using a variable is probably not convenient for all kinds of users. Some more support
by the Edit.jsp would be welcome. 

! Establish a hyperlink to a specific version of a page

JSPWiki does not allow you to insert a hyperlink to a specific version of a page
unless you are using the external hyperlink syntax.

One solution is to use an interwiki link.
* Definition in jspwiki.properties
   jspwiki.interWikiRef.Version = Wiki.jsp?page=%s
* Usage in a wiki page.

Another, more elaborated solution, is to use a plugin to expand the link.
This approach should allow for automatic indication whether the 
referred version is the latest or whether a newer version exists. (this is already available in the wiki jsp-tags)

! Some other ideas
(this should probably be moved to the Ideas page)

The JSPWiki syntax for links could be expanded to support version hyperlinks. 
Similary a reference to a variable in a page would be useful as well.

The suggested syntax restricts somewhat the naming allowed for attachments but I assume
this should be acceptable.


Cool idea, thanks :).  Actually, I was thinking about using a ReiserFS-style naming convention for page properties and so on, which is pretty much what you suggest there.  But I don't know if that is going to make it to the next or the release thereafter...

This does remind me though that we could use the WikiFormsPlugin to handle editing as well (UseWikiFormsForEditing)...  Would make templating a lot easier, and it would also allow user-editable properties to go along with each page.  But that requires better handling of WikiPageMetadata.

-- JanneJalkanen


Small update, introducing a __liveVersion__ and updating the ~InfoContent.jsp. --26 nov 04, [DF|DirkFrederickx]