Author: ajaquith
Date: Sat Feb 23 11:13:41 2008
New Revision: 630509
URL: http://svn.apache.org/viewvc?rev=630509&view=rev
Log:
Initial Stripes component commit.
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/htmltowiki/XHtmlToWikiConfig.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Groups.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Image.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IndexPlugin.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Note.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginManager.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RecentChangesPlugin.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferredPagesPlugin.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Search.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/TableOfContents.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogArchivePlugin.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogEntryPlugin.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogPlugin.java
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/htmltowiki/XHtmlToWikiConfig.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/htmltowiki/XHtmlToWikiConfig.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/htmltowiki/XHtmlToWikiConfig.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/htmltowiki/XHtmlToWikiConfig.java
Sat Feb 23 11:13:41 2008
@@ -20,6 +20,10 @@
package com.ecyrd.jspwiki.htmltowiki;
import com.ecyrd.jspwiki.WikiContext;
+import com.ecyrd.jspwiki.action.AttachActionBean;
+import com.ecyrd.jspwiki.action.EditActionBean;
+import com.ecyrd.jspwiki.action.PageInfoActionBean;
+import com.ecyrd.jspwiki.action.ViewActionBean;
/**
* Defines a Wiki configuration to XHtmlToWikiTranslator, including things
like
@@ -61,13 +65,13 @@
// the Wiki page name in VIEW or ATTACH
//
- m_wikiJspPage = wikiContext.getURL( WikiContext.VIEW, "" );
+ m_wikiJspPage = wikiContext.getContext().getURL( ViewActionBean.class,
"" );
- m_editJspPage = wikiContext.getURL( WikiContext.EDIT, "" );
+ m_editJspPage = wikiContext.getContext().getURL( EditActionBean.class,
"" );
- m_attachPage = wikiContext.getURL( WikiContext.ATTACH, "" );
+ m_attachPage = wikiContext.getContext().getURL(
AttachActionBean.class, "" );
- m_pageInfoJsp = wikiContext.getURL( WikiContext.INFO, "" );
+ m_pageInfoJsp = wikiContext.getContext().getURL(
PageInfoActionBean.class, "" );
}
/*
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java
Sat Feb 23 11:13:41 2008
@@ -35,6 +35,7 @@
import org.jdom.*;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.*;
import com.ecyrd.jspwiki.attachment.Attachment;
import com.ecyrd.jspwiki.attachment.AttachmentManager;
import com.ecyrd.jspwiki.auth.WikiSecurityException;
@@ -141,6 +142,8 @@
/** If set to "true", all external links are tagged with 'rel="nofollow"'
*/
public static final String PROP_USERELNOFOLLOW =
"jspwiki.translatorReader.useRelNofollow";
+ private static final Map<String,String> NO_PARAMS =
Collections.unmodifiableMap( new HashMap<String,String>() );
+
/** If true, then considers CamelCase links as well. */
private boolean m_camelCaseLinks = false;
@@ -512,15 +515,16 @@
}
ResourceBundle rb =
m_context.getBundle(InternationalizationManager.CORE_BUNDLE);
Object[] args = { link };
+ boolean makeAbsoluteLinks = "absolute".equals( m_context.getVariable(
WikiEngine.PROP_REFSTYLE ) );
switch(type)
{
case READ:
- el = createAnchor( READ, m_context.getURL(WikiContext.VIEW,
link), text, section );
+ el = createAnchor( READ,
m_context.getContext().getURL(ViewActionBean.class, link), text, section );
break;
case EDIT:
- el = createAnchor( EDIT,
m_context.getURL(WikiContext.EDIT,link), text, "" );
+ el = createAnchor( EDIT, m_context.getContext().getURL(
EditActionBean.class, link, NO_PARAMS, makeAbsoluteLinks ), text, "" );
el.setAttribute("title", MessageFormat.format( rb.getString(
"markupparser.link.create" ), args ) );
break;
@@ -565,7 +569,7 @@
break;
case IMAGEWIKILINK:
- String pagelink = m_context.getURL(WikiContext.VIEW,text);
+ String pagelink =
m_context.getContext().getURL(ViewActionBean.class,text);
el = new Element("img").setAttribute("class","inline");
el.setAttribute("src",link);
el.setAttribute("alt",text);
@@ -582,14 +586,14 @@
break;
case ATTACHMENT:
- String attlink = m_context.getURL( WikiContext.ATTACH,
- link );
+ String attlink = m_context.getContext().getURL(
AttachActionBean.class,
+ link, NO_PARAMS,
makeAbsoluteLinks );
- String infolink = m_context.getURL( WikiContext.INFO,
- link );
+ String infolink = m_context.getContext().getURL(
PageInfoActionBean.class,
+ link, NO_PARAMS,
makeAbsoluteLinks );
- String imglink = m_context.getURL( WikiContext.NONE,
-
"images/attachment_small.png" );
+ String imglink = m_context.getContext().getURL(
NoneActionBean.class,
+
"images/attachment_small.png", NO_PARAMS, makeAbsoluteLinks );
el = createAnchor( ATTACHMENT, attlink, text, "" );
@@ -1065,9 +1069,10 @@
{
if( m_cleanTranslator == null )
{
- WikiContext dummyContext = new WikiContext( m_engine,
-
m_context.getHttpRequest(),
- m_context.getPage() );
+ WikiContext dummyContext =
m_engine.getWikiActionBeanFactory().newViewActionBean(
+
m_context.getContext().getRequest(),
+
m_context.getContext().getResponse(),
+ m_context.getPage()
);
m_cleanTranslator = new JSPWikiMarkupParser( dummyContext, null );
m_cleanTranslator.m_allowHTML = true;
@@ -1197,7 +1202,7 @@
{
if( m_outlinkImageURL == null )
{
- m_outlinkImageURL = m_context.getURL( WikiContext.NONE,
OUTLINK_IMAGE );
+ m_outlinkImageURL = m_context.getContext().getURL(
NoneActionBean.class, OUTLINK_IMAGE );
}
el = new Element("img").setAttribute("class", "outlink");
@@ -1530,7 +1535,7 @@
if( isImageLink( linkref ) )
{
- attachment = m_context.getURL( WikiContext.ATTACH,
attachment );
+ attachment = m_context.getContext().getURL(
AttachActionBean.class, attachment );
sb.append( handleImageLink( attachment, linktext,
link.hasReference() ) );
}
else
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Groups.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Groups.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Groups.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Groups.java
Sat Feb 23 11:13:41 2008
@@ -24,8 +24,12 @@
import java.util.Comparator;
import java.util.Map;
+import net.sourceforge.stripes.action.UrlBinding;
+import net.sourceforge.stripes.util.UrlBuilder;
+
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.GroupActionBean;
import com.ecyrd.jspwiki.auth.PrincipalComparator;
import com.ecyrd.jspwiki.auth.authorize.GroupManager;
@@ -56,12 +60,18 @@
{
String name = groups[i].getName();
- // Make URL
- String url = engine.getURLConstructor().makeURL(
WikiContext.VIEW_GROUP, name, false, null );
+ // Make Stripes URL
+ String groupUrl =
GroupActionBean.class.getAnnotation(UrlBinding.class).value();
+ UrlBuilder urlBuilder = new UrlBuilder( groupUrl, true );
+ urlBuilder.addParameter("group", name);
+ String url = urlBuilder.toString();
+
+ // Make re-written URL
+ String rewriteUrl = context.getContext().getResponse().encodeURL(
url );
// Create hyperlink
s.append( "<a href=\"" );
- s.append( url );
+ s.append( rewriteUrl );
s.append( "\">" );
s.append( name );
s.append( "</a>" );
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Image.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Image.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Image.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Image.java
Sat Feb 23 11:13:41 2008
@@ -21,6 +21,7 @@
import java.util.*;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.AttachActionBean;
import com.ecyrd.jspwiki.attachment.AttachmentManager;
import com.ecyrd.jspwiki.attachment.Attachment;
import com.ecyrd.jspwiki.providers.ProviderException;
@@ -96,7 +97,7 @@
if( att != null )
{
- src = context.getURL( WikiContext.ATTACH, att.getName() );
+ src = context.getContext().getURL( AttachActionBean.class,
att.getName() );
}
}
catch( ProviderException e )
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IndexPlugin.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IndexPlugin.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IndexPlugin.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IndexPlugin.java
Sat Feb 23 11:13:41 2008
@@ -27,6 +27,7 @@
import org.apache.oro.text.regex.*;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.providers.ProviderException;
/**
@@ -216,7 +217,7 @@
}
m_bodyPart.write("<a href=\""+
- context.getURL(WikiContext.VIEW,
curPage.getName())+"\">"+
+ context.getContext().getURL(ViewActionBean.class,
curPage.getName())+"\">"+
context.getEngine().beautifyTitleNoBreak(curPage.getName())+
"</a>");
}
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java
Sat Feb 23 11:13:41 2008
@@ -20,6 +20,8 @@
package com.ecyrd.jspwiki.plugin;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.EditActionBean;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.auth.*;
import com.ecyrd.jspwiki.auth.permissions.PermissionFactory;
@@ -132,7 +134,7 @@
if( pageData.length() > maxlen )
{
pageData = pageData.substring( 0, maxlen )+" ...";
- moreLink = "<p><a
href=\""+context.getURL(WikiContext.VIEW,includedPage)+"\">More...</a></p>";
+ moreLink = "<p><a
href=\""+context.getContext().getURL(ViewActionBean.class,includedPage)+"\">More...</a></p>";
}
res.append("<div style=\""+style+"\""+(clazz != null ? "
class=\""+clazz+"\"" : "")+">");
@@ -155,7 +157,7 @@
else
{
res.append("There is no page called '"+includedPage+"'.
Would you like to ");
- res.append("<a href=\""+context.getURL( WikiContext.EDIT,
includedPage )+"\">create it?</a>");
+ res.append("<a href=\""+context.getContext().getURL(
EditActionBean.class, includedPage )+"\">create it?</a>");
}
}
}
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Note.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Note.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Note.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Note.java
Sat Feb 23 11:13:41 2008
@@ -24,6 +24,7 @@
import com.ecyrd.jspwiki.TextUtil;
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.NoneActionBean;
/**
* Outputs an image with the supplied text as the <tt>title</tt> which is
shown as a tooltip by
@@ -72,7 +73,7 @@
engine.getTemplateDir(),
commentImage );
- return ctx.getURL( WikiContext.NONE, resource );
+ return ctx.getContext().getURL( NoneActionBean.class, resource );
}
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginManager.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginManager.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginManager.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginManager.java
Sat Feb 23 11:13:41 2008
@@ -173,7 +173,7 @@
*/
public static final String PARAM_DEBUG = "debug";
- private ArrayList m_searchPath = new ArrayList();
+ private ArrayList<String> m_searchPath = new ArrayList<String>();
private Pattern m_pluginPattern;
@@ -182,7 +182,7 @@
/**
* Keeps a list of all known plugin classes.
*/
- private Map m_pluginClassMap = new HashMap();
+ private Map<String,WikiPluginInfo> m_pluginClassMap = new
HashMap<String,WikiPluginInfo>();
/**
@@ -340,7 +340,7 @@
boolean debug = TextUtil.isPositive( (String) params.get(
PARAM_DEBUG ) );
- WikiPluginInfo pluginInfo = (WikiPluginInfo)
m_pluginClassMap.get(classname);
+ WikiPluginInfo pluginInfo = m_pluginClassMap.get(classname);
if(pluginInfo == null)
{
@@ -435,10 +435,10 @@
*
* @throws IOException If the parsing fails.
*/
- public Map parseArgs( String argstring )
+ public Map<String,Object> parseArgs( String argstring )
throws IOException
{
- HashMap arglist = new HashMap();
+ HashMap<String,Object>arglist = new HashMap<String,Object>();
//
// Protection against funny users.
@@ -613,7 +613,7 @@
String args = commandline.substring(res.endOffset(0),
commandline.length() -
(commandline.charAt(commandline.length()-1) == '}' ? 1 : 0 ) );
- Map arglist = parseArgs( args );
+ Map<String,Object> arglist = parseArgs( args );
// set wikitext bounds of plugin as '_bounds' parameter, e.g.,
[345,396]
if ( pos != -1 )
@@ -963,14 +963,12 @@
/**
* [EMAIL PROTECTED]
*/
- public Collection modules()
+ public Collection<WikiModuleInfo> modules()
{
- TreeSet ls = new TreeSet();
+ TreeSet<WikiModuleInfo> ls = new TreeSet<WikiModuleInfo>();
- for( Iterator i = m_pluginClassMap.values().iterator(); i.hasNext(); )
+ for( WikiModuleInfo wmi : m_pluginClassMap.values() )
{
- WikiModuleInfo wmi = (WikiModuleInfo)i.next();
-
if( !ls.contains(wmi) ) ls.add(wmi);
}
@@ -992,7 +990,7 @@
{
WikiPlugin plugin;
- WikiPluginInfo pluginInfo = (WikiPluginInfo) m_pluginClassMap.get(
content.getPluginName() );
+ WikiPluginInfo pluginInfo = m_pluginClassMap.get(
content.getPluginName() );
if(pluginInfo == null)
{
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RecentChangesPlugin.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RecentChangesPlugin.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RecentChangesPlugin.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RecentChangesPlugin.java
Sat Feb 23 11:13:41 2008
@@ -30,6 +30,7 @@
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiPage;
+import com.ecyrd.jspwiki.action.*;
import com.ecyrd.jspwiki.attachment.Attachment;
/**
@@ -130,7 +131,7 @@
olddate = lastmod;
}
- String link = context.getURL( pageref instanceof Attachment ?
WikiContext.ATTACH : WikiContext.VIEW,
+ String link = context.getContext().getURL( pageref instanceof
Attachment ? AttachActionBean.class : ViewActionBean.class,
pageref.getName() ) ;
a linkel = new a(link,engine.beautifyTitle(pageref.getName()));
@@ -144,8 +145,8 @@
//
if( pageref instanceof Attachment )
{
- linkel = new
a().setHref(context.getURL(WikiContext.INFO,pageref.getName()));
- linkel.addElement( new
img().setSrc(context.getURL(WikiContext.NONE, "images/attachment_small.png")));
+ linkel = new
a().setHref(context.getContext().getURL(PageInfoActionBean.class,pageref.getName()));
+ linkel.addElement( new
img().setBorder(0).setSrc(context.getContext().getURL(NoneActionBean.class,
"images/attachment_small.png")));
col.addElement( linkel );
}
@@ -161,7 +162,9 @@
else
{
td infocol = (td) new td().setClass("lastchange");
- infocol.addElement( new a(context.getURL(WikiContext.DIFF,
pageref.getName(), "r1=-1"),tfmt.format(lastmod)) );
+ Map<String,String> urlParams = new
HashMap<String,String>();
+ urlParams.put("r1", "-1");
+ infocol.addElement( new
a(context.getContext().getURL(DiffActionBean.class, pageref.getName(),
urlParams),tfmt.format(lastmod)) );
row.addElement(infocol);
}
@@ -180,7 +183,7 @@
{
if( engine.pageExists(author) )
{
- authorinfo.addElement( new
a(context.getURL(WikiContext.VIEW, author),author) );
+ authorinfo.addElement( new
a(context.getContext().getURL(ViewActionBean.class, author),author) );
}
else
{
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferredPagesPlugin.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferredPagesPlugin.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferredPagesPlugin.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferredPagesPlugin.java
Sat Feb 23 11:13:41 2008
@@ -42,6 +42,7 @@
import org.apache.oro.text.regex.*;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.ViewActionBean;
public class ReferredPagesPlugin implements WikiPlugin
{
@@ -218,7 +219,7 @@
isUL = true; m_result.append("<ul>\n");
}
- String href = context.getURL(WikiContext.VIEW,link);
+ String href =
context.getContext().getURL(ViewActionBean.class,link);
m_result.append("<li><a class=\"wikipage\" href=\""+ href
+"\">"+link+"</a></li>\n" );
m_exists.add( link );
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
Sat Feb 23 11:13:41 2008
@@ -21,6 +21,7 @@
import org.apache.log4j.Logger;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.PageInfoActionBean;
import java.text.MessageFormat;
import java.util.*;
@@ -86,7 +87,7 @@
if( items < links.size() && items > 0 )
{
Object[] args = { "" + ( links.size() - items),
- context.getURL( WikiContext.INFO,
page.getName() ) };
+ context.getContext().getURL(
PageInfoActionBean.class, page.getName() ) };
extras = MessageFormat.format(extras, args);
wikitext += extras;
}
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Search.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Search.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Search.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Search.java
Sat Feb 23 11:13:41 2008
@@ -30,6 +30,7 @@
import com.ecyrd.jspwiki.SearchResult;
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.providers.ProviderException;
/**
@@ -119,7 +120,7 @@
td name = new td().setWidth("30%");
name.addElement( "<a href=\""+
- context.getURL( WikiContext.VIEW,
sr.getPage().getName() )+
+ context.getContext().getURL(
ViewActionBean.class, sr.getPage().getName() )+
"\">"+engine.beautifyTitle(sr.getPage().getName())+"</a>");
row.addElement( name );
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/TableOfContents.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/TableOfContents.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/TableOfContents.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/TableOfContents.java
Sat Feb 23 11:13:41 2008
@@ -21,6 +21,7 @@
import org.apache.log4j.Logger;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.parser.Heading;
import com.ecyrd.jspwiki.parser.HeadingListener;
import com.ecyrd.jspwiki.parser.JSPWikiMarkupParser;
@@ -97,7 +98,7 @@
String titleSection = hd.m_titleSection.replace( '%', '_' );
String pageName =
context.getEngine().encodeName(context.getPage().getName()).replace( '%', '_' );
- String url = context.getURL( WikiContext.VIEW,
context.getPage().getName() );
+ String url = context.getContext().getURL( ViewActionBean.class,
context.getPage().getName() );
String sectref = "#section-"+pageName+"-"+titleSection;
m_buf.append( "<a class=\"wikipage\" href=\""+url+sectref+"\">");
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogArchivePlugin.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogArchivePlugin.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogArchivePlugin.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogArchivePlugin.java
Sat Feb 23 11:13:41 2008
@@ -20,6 +20,7 @@
package com.ecyrd.jspwiki.plugin;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.providers.ProviderException;
import org.apache.log4j.Logger;
@@ -51,10 +52,12 @@
if( weblogName == null ) weblogName = context.getPage().getName();
-
+ Map<String,String> dateParams = new HashMap<String,String>();
+ dateParams.put("weblog.startDate", "'ddMMyy'");
+ dateParams.put("weblog.days", "%d");
m_monthUrlFormat = new SimpleDateFormat("'"+
- context.getURL(
WikiContext.VIEW, weblogName,
-
"weblog.startDate='ddMMyy'&weblog.days=%d")+"'");
+ context.getContext().getURL(
ViewActionBean.class, weblogName,dateParams)+
+ "'");
StringBuffer sb = new StringBuffer();
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogEntryPlugin.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogEntryPlugin.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogEntryPlugin.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogEntryPlugin.java
Sat Feb 23 11:13:41 2008
@@ -20,6 +20,7 @@
package com.ecyrd.jspwiki.plugin;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.NewBlogEntryActionBean;
import com.ecyrd.jspwiki.providers.ProviderException;
import org.apache.log4j.Logger;
@@ -82,7 +83,9 @@
if( entryText == null )
entryText = rb.getString("weblogentryplugin.newentry");
- String url = context.getURL( WikiContext.NONE, "NewBlogEntry.jsp",
"page="+engine.encodeName(weblogName) );
+ Map<String,String> blogParams = new HashMap<String,String>();
+ blogParams.put("page", engine.encodeName(weblogName));
+ String url = context.getContext().getURL(
NewBlogEntryActionBean.class, null, blogParams );
sb.append("<a href=\""+url+"\">"+entryText+"</a>");
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogPlugin.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogPlugin.java?rev=630509&r1=630508&r2=630509&view=diff
==============================================================================
---
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogPlugin.java
(original)
+++
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogPlugin.java
Sat Feb 23 11:13:41 2008
@@ -22,15 +22,7 @@
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -39,6 +31,8 @@
import com.ecyrd.jspwiki.*;
import com.ecyrd.jspwiki.auth.AuthorizationManager;
import com.ecyrd.jspwiki.auth.permissions.PagePermission;
+import com.ecyrd.jspwiki.action.CommentActionBean;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.parser.PluginContent;
import com.ecyrd.jspwiki.providers.ProviderException;
@@ -225,7 +219,7 @@
try
{
- List blogEntries = findBlogEntries( engine.getPageManager(),
+ List<WikiPage> blogEntries = findBlogEntries(
engine.getPageManager(),
weblogName,
startTime.getTime(),
stopTime.getTime() );
@@ -322,7 +316,7 @@
{
if( engine.pageExists(author) )
{
- author = "<a href=\""+entryCtx.getURL( WikiContext.VIEW,
author )+"\">"+engine.beautifyTitle(author)+"</a>";
+ author = "<a href=\""+entryCtx.getContext().getURL(
ViewActionBean.class, author )+"\">"+engine.beautifyTitle(author)+"</a>";
}
}
else
@@ -331,7 +325,7 @@
}
buffer.append("By "+author+" ");
- buffer.append( "<a href=\""+entryCtx.getURL(WikiContext.VIEW,
entry.getName())+"\">Permalink</a>" );
+ buffer.append( "<a href=\""+entryCtx.getContext().getURL(
ViewActionBean.class, entry.getName())+"\">Permalink</a>" );
String commentPageName = TextUtil.replaceString( entry.getName(),
"blogentry",
"comments" );
@@ -346,10 +340,10 @@
// has changed.
//
buffer.append( " " );
+ Map<String,String> urlParams = new HashMap<String,String>();
+ urlParams.put("nc",String.valueOf(numComments));
buffer.append( "<a target=\"_blank\" href=\""+
- entryCtx.getURL(WikiContext.COMMENT,
- commentPageName,
- "nc="+numComments)+
+ entryCtx.getContext().getURL(CommentActionBean.class,
commentPageName, urlParams) +
"\">Comments? ("+
numComments+
")</a>" );
@@ -387,20 +381,18 @@
* @return a list of pages with their FIRST revisions.
* @throws ProviderException If something goes wrong
*/
- public List findBlogEntries( PageManager mgr,
+ public List<WikiPage> findBlogEntries( PageManager mgr,
String baseName, Date start, Date end )
throws ProviderException
{
- Collection everyone = mgr.getAllPages();
- ArrayList result = new ArrayList();
+ Collection<WikiPage> everyone = mgr.getAllPages();
+ List<WikiPage> result = new ArrayList<WikiPage>();
baseName = makeEntryPage( baseName );
SimpleDateFormat fmt = new SimpleDateFormat(DEFAULT_DATEFORMAT);
- for( Iterator i = everyone.iterator(); i.hasNext(); )
+ for( WikiPage p : everyone )
{
- WikiPage p = (WikiPage)i.next();
-
String pageName = p.getName();
if( pageName.startsWith( baseName ) )
@@ -451,19 +443,16 @@
/**
* Reverse comparison.
*/
- private static class PageDateComparator implements Comparator
+ private static class PageDateComparator implements Comparator<WikiPage>
{
- public int compare( Object o1, Object o2 )
+ public int compare( WikiPage o1, WikiPage o2 )
{
if( o1 == null || o2 == null )
{
return 0;
}
- WikiPage page1 = (WikiPage)o1;
- WikiPage page2 = (WikiPage)o2;
-
- return page2.getLastModified().compareTo( page1.getLastModified()
);
+ return o2.getLastModified().compareTo( o1.getLastModified() );
}
}