@@ -0,0 +1,2802 @@
+/* %0A    JSPWiki - a JSP-based WikiWiki clone.%0A%0A    Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)%0A%0A    This program is free software; you can redistribute it and/or modify%0A    it under the terms of the GNU General Public License as published by%0A    the Free Software Foundation; either version 2 of the License, or%0A    (at your option) any later version.%0A%0A    This program is distributed in the hope that it will be useful,%0A    but WITHOUT ANY WARRANTY; without even the implied warranty of%0A    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A    GNU General Public License for more details.%0A%0A    You should have received a copy of the GNU General Public License%0A    along with this program; if not, write to the Free Software%0A    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA%0A */%0Apackage com.ecyrd.jspwiki.tags;%0A%0Aimport java.io.IOException;%0Aimport javax.servlet.jsp.JspWriter;%0A%0Aimport com.ecyrd.jspwiki.WikiEngine;%0Aimport com.ecyrd.jspwiki.WikiPage;%0A%0A/**%0A *  Writes a diff link.  Body of the link becomes the link text.%0A *  %3CP%3E%3CB%3EAttributes%3CB%3E%3C/P%3E%0A *  %3CUL%3E%0A *    %3CLI%3Epage - Page name to refer to.  Default is the current page.%0A *  %3C/UL%3E%0A *%0A *  @author Janne Jalkanen%0A *  @since 2.0%0A */%0Apublic class DiffLinkTag%0A    extends WikiLinkTag%0A%7B%0A    private String m_version;%0A    private String m_newVersion;%0A%0A    public String getVersion()%0A    %7B%0A        return m_version;%0A    %7D%0A%0A    public void setVersion( String arg )%0A    %7B%0A        m_version = arg;%0A    %7D%0A%0A    public String getNewVersion()%0A    %7B%0A        return m_newVersion;%0A    %7D%0A%0A    public void setNewVersion( String arg )%0A    %7B%0A        m_newVersion = arg;%0A    %7D%0A%0A    public final int doWikiStartTag()%0A        throws IOException%0A    %7B%0A        WikiEngine engine   = m_wikiContext.getEngine();%0A        String     pageName = m_pageName;%0A%0A        if( m_pageName == null )%0A        %7B%0A            if( m_wikiContext.getPage() != null )%0A            %7B%0A                pageName = m_wikiContext.getPage().getName();%0A            %7D%0A            else%0A            %7B%0A                return SKIP_BODY;%0A            %7D%0A        %7D%0A%0A        JspWriter out = pageContext.getOut();%0A        String encodedlink = engine.encodeName( pageName );%0A%0A        int r1 = 0;%0A        int r2 = 0;%0A%0A        if( getVersion().equals(%22latest%22) )%0A        %7B%0A            r1 = m_wikiContext.getPage().getVersion();%0A            r2 = (r1 %3E 1) ? (r1-1) : -1;%0A        %7D%0A%0A        switch( m_format )%0A        %7B%0A          case ANCHOR:%0A            out.print(%22%3CA HREF=%5C%22%22+engine.getBaseURL()+%22Diff.jsp?page=%22+encodedlink+%22&r1=%22+r1+%22&r2=%22+r2+%22%5C%22%3E%22);%0A            break;%0A%0A          case URL:%0A            out.print( engine.getBaseURL()+%22Diff.jsp?page=%22+encodedlink+%22&r1=%22+r1+%22&r2=%22+r2 );%0A            break;%0A        %7D%0A%0A        return EVAL_BODY_INCLUDE;%0A    %7D%0A%7D%0A

Writes a diff link.