You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by aj...@apache.org on 2008/12/17 07:19:57 UTC
svn commit: r727295 - in /incubator/jspwiki/trunk: ./ etc/i18n/templates/
src/com/ecyrd/jspwiki/ src/com/ecyrd/jspwiki/action/
src/com/ecyrd/jspwiki/tags/ src/com/ecyrd/jspwiki/ui/stripes/ src/webdocs/
src/webdocs/templates/default/
Author: ajaquith
Date: Tue Dec 16 22:19:55 2008
New Revision: 727295
URL: http://svn.apache.org/viewvc?rev=727295&view=rev
Log:
Further refinements to Stripes-related JSPs. Refactoring of Login/Profile/View ActionBeans. Introduction of Stripes layout system, which makes templating somewhat easier (but at the moment all Stripes JSPs are hardwired to 'default').
Added:
incubator/jspwiki/trunk/src/webdocs/CreateProfile.jsp
incubator/jspwiki/trunk/src/webdocs/templates/default/CreateProfileContent.jsp
incubator/jspwiki/trunk/src/webdocs/templates/default/EditLayout.jsp
incubator/jspwiki/trunk/src/webdocs/templates/default/ViewLayout.jsp
Modified:
incubator/jspwiki/trunk/ChangeLog
incubator/jspwiki/trunk/etc/i18n/templates/default.properties
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/AbstractActionBean.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/LoginActionBean.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/ViewActionBean.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/WikiTagBase.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiActionBeanContext.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiInterceptor.java
incubator/jspwiki/trunk/src/webdocs/LoginForm.jsp
incubator/jspwiki/trunk/src/webdocs/PageInfo.jsp
incubator/jspwiki/trunk/src/webdocs/UserPreferences.jsp
incubator/jspwiki/trunk/src/webdocs/Wiki.jsp
incubator/jspwiki/trunk/src/webdocs/templates/default/LoginContent.jsp
incubator/jspwiki/trunk/src/webdocs/templates/default/ProfileTab.jsp
Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Tue Dec 16 22:19:55 2008
@@ -1,3 +1,11 @@
+2008-12-17 Andrew Jaquith <ajaquith AT apache DOT org>
+
+ * 3.0.0-svn-32
+
+ * Further refinements to Stripes-related JSPs. Refactoring of Login/Profile/View
+ ActionBeans. Introduction of Stripes layout system, which makes templating
+ somewhat easier (but at the moment all Stripes JSPs are hardwired to 'default').
+
2008-12-11 Harry Metske <me...@apache.org>
* 3.0.0-svn-31
Modified: incubator/jspwiki/trunk/etc/i18n/templates/default.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/templates/default.properties?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/templates/default.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/templates/default.properties Tue Dec 16 22:19:55 2008
@@ -447,6 +447,9 @@
prefs.creationdate=Creation date
prefs.profile.lastmodified=Last modified
+profile.nameCollision=Another user already has a profile with {0} set to {1}
+profile.noPasswordMatch=Passwords must match
+
# Workflow generic messages
workflow.tab=Workflow
workflow.heading=Your Workflow Items
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java Tue Dec 16 22:19:55 2008
@@ -77,7 +77,7 @@
* <p>
* If the build identifier is empty, it is not added.
*/
- public static final String BUILD = "31";
+ public static final String BUILD = "32";
/**
* This is the generic version string you should use
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/AbstractActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/AbstractActionBean.java?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/AbstractActionBean.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/AbstractActionBean.java Tue Dec 16 22:19:55 2008
@@ -1,9 +1,9 @@
package com.ecyrd.jspwiki.action;
-import com.ecyrd.jspwiki.ui.stripes.WikiActionBeanContext;
-
import net.sourceforge.stripes.action.ActionBeanContext;
+import com.ecyrd.jspwiki.ui.stripes.WikiActionBeanContext;
+
/**
* <p>
* Abstract ActionBean superclass for all wiki actions, such as page actions ({@link com.ecyrd.jspwiki.WikiContext}
@@ -15,7 +15,7 @@
*/
public abstract class AbstractActionBean implements WikiActionBean
{
- private WikiActionBeanContext m_actionBeanContext = null;
+ private WikiActionBeanContext m_context = null;
/**
* Creates a new instance of this class, without a WikiEngine, Request or
@@ -35,7 +35,7 @@
*/
public WikiActionBeanContext getContext()
{
- return m_actionBeanContext;
+ return m_context;
}
/**
@@ -44,7 +44,7 @@
*/
public void setContext( ActionBeanContext context )
{
- m_actionBeanContext = ((WikiActionBeanContext) context);
+ m_context = ((WikiActionBeanContext) context);
}
}
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/LoginActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/LoginActionBean.java?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/LoginActionBean.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/LoginActionBean.java Tue Dec 16 22:19:55 2008
@@ -12,9 +12,7 @@
import net.sourceforge.stripes.action.*;
import net.sourceforge.stripes.util.UrlBuilder;
-import net.sourceforge.stripes.validation.SimpleError;
-import net.sourceforge.stripes.validation.Validate;
-import net.sourceforge.stripes.validation.ValidationErrors;
+import net.sourceforge.stripes.validation.*;
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
@@ -28,7 +26,6 @@
import com.ecyrd.jspwiki.auth.user.UserProfile;
import com.ecyrd.jspwiki.log.Logger;
import com.ecyrd.jspwiki.log.LoggerFactory;
-import com.ecyrd.jspwiki.ui.TemplateManager;
import com.ecyrd.jspwiki.ui.stripes.HandlerPermission;
import com.ecyrd.jspwiki.ui.stripes.WikiRequestContext;
import com.ecyrd.jspwiki.util.MailUtil;
@@ -39,6 +36,8 @@
{
private static final Logger log = LoggerFactory.getLogger( LoginActionBean.class );
+ private static final String DEFAULT_TAB = "logincontent";
+
/**
* Sets cookies and redirects the user to a wiki page after a successful
* profile creation or login.
@@ -56,7 +55,8 @@
// Set "remember me?" cookie
if( rememberMe )
{
- CookieAuthenticationLoginModule.setLoginCookie( getContext().getEngine(), getContext().getResponse(), principal.getName() );
+ CookieAuthenticationLoginModule.setLoginCookie( getContext().getEngine(), getContext().getResponse(), principal
+ .getName() );
}
UrlBuilder builder = new UrlBuilder( getContext().getLocale(), ViewActionBean.class, false );
@@ -66,7 +66,7 @@
}
return new RedirectResolution( builder.toString() );
}
-
+
private String m_email = null;
private String m_username = null;
@@ -75,23 +75,26 @@
private String m_password;
- private String m_redirect;
+ private String m_redirect = null;
+
+ private String m_tab = DEFAULT_TAB;
/**
* Returns the e-mail address.
+ *
* @return the e-mail address
*/
public String getEmail()
{
return m_email;
}
-
+
public String getJ_password()
{
return m_password;
}
- public boolean getJ_remember()
+ public boolean getRemember()
{
return m_remember;
}
@@ -101,41 +104,29 @@
return m_username;
}
+ public String getTab()
+ {
+ return m_tab;
+ }
+
public String getRedirect()
{
return m_redirect;
}
- @HandlesEvent( "login" )
- @HandlerPermission( permissionClass = WikiPermission.class, target = "${context.engine.applicationName}", actions = WikiPermission.LOGIN_ACTION )
- public Resolution login()
+ @ValidationMethod( on = "login", when = ValidationState.NO_ERRORS )
+ public void validateCredentials()
{
WikiSession wikiSession = getContext().getWikiSession();
ValidationErrors errors = getContext().getValidationErrors();
ResourceBundle rb = getContext().getBundle( "CoreResources" );
- // If user got here and is already authenticated, it means
- // they just aren't allowed access to what they asked for.
- // Weepy tears and hankies all 'round.
- if( getContext().getWikiSession().isAuthenticated() )
- {
- errors.addGlobalError( new SimpleError( rb.getString( "login.error.noaccess" ) ) );
- return new RedirectResolution( MessageActionBean.class );
- }
-
log.debug( "Attempting to authenticate user " + m_username );
// Log the user in!
- Resolution r = null;
try
{
- if( getContext().getEngine().getAuthenticationManager().login( wikiSession, m_username, m_password ) )
- {
- // Set cookies as needed and redirect
- log.info( "Successfully authenticated user " + m_username + " (custom auth)" );
- r = saveCookiesAndRedirect( m_redirect, m_remember );
- }
- else
+ if( !getContext().getEngine().getAuthenticationManager().login( wikiSession, m_username, m_password ) )
{
log.info( "Failed to authenticate user " + m_username );
errors.addGlobalError( new SimpleError( rb.getString( "login.error.password" ) ) );
@@ -145,15 +136,15 @@
{
errors.addGlobalError( new SimpleError( rb.getString( "login.error" ), e.getMessage() ) );
}
+ }
- // Any errors?
- if( !errors.isEmpty() )
- {
- UrlBuilder builder = new UrlBuilder( getContext().getLocale(), "/Login.jsp", false );
- builder.addParameter( "tab", "logincontent" );
- r = new RedirectResolution( builder.toString() );
- }
-
+ @HandlesEvent( "login" )
+ @HandlerPermission( permissionClass = WikiPermission.class, target = "${context.engine.applicationName}", actions = WikiPermission.LOGIN_ACTION )
+ public Resolution login()
+ {
+ // Set cookies as needed and redirect
+ log.info( "Successfully authenticated user " + m_username + " (custom auth)" );
+ Resolution r = saveCookiesAndRedirect( m_redirect, m_remember );
return r;
}
@@ -166,36 +157,57 @@
HttpServletRequest request = getContext().getRequest();
HttpServletResponse response = getContext().getResponse();
engine.getAuthenticationManager().logout( request );
-
+
// Clear the asserted name cookie
CookieAssertionLoginModule.clearUserCookie( response );
// Delete the authentication cookie
- if ( engine.getAuthenticationManager().allowsCookieAuthentication() )
+ if( engine.getAuthenticationManager().allowsCookieAuthentication() )
{
CookieAuthenticationLoginModule.clearLoginCookie( engine, request, response );
}
-
+
return new RedirectResolution( ViewActionBean.class );
}
/**
* Sets the e-mail property. Used by the {@link #resetPassword()} event.
+ *
* @param email the e-mail address
*/
- @Validate( required = true, on = "resetPassword", converter=net.sourceforge.stripes.validation.EmailTypeConverter.class )
+ @Validate( required = true, on = "resetPassword", converter = net.sourceforge.stripes.validation.EmailTypeConverter.class )
public void setEmail( String email )
{
m_email = email;
}
-
+
@Validate( required = true, on = "login", minlength = 1, maxlength = 128 )
public void setJ_password( String password )
{
m_password = password;
}
- public void setJ_remember( boolean remember )
+ /**
+ * Sets the <code>tab</code> parameter for the source page. The value
+ * supplied to this method is also added to the source page resolution
+ * returned by
+ * {@link com.ecyrd.jspwiki.ui.stripes.WikiActionBeanContext#getSourcePageResolution()}.
+ *
+ * @param tab the tab value
+ */
+ @Validate()
+ public void setTab( String tab )
+ {
+ m_tab = tab;
+ Resolution r = getContext().getSourcePageResolution();
+ if( r instanceof OnwardResolution )
+ {
+ ((OnwardResolution) r).addParameter( "tab", tab );
+ }
+ }
+
+ @Validate()
+ public void setRmember( boolean remember )
{
m_remember = remember;
}
@@ -206,6 +218,7 @@
m_username = username;
}
+ @Validate()
public void setRedirect( String redirect )
{
m_redirect = redirect;
@@ -220,17 +233,22 @@
* @return the resolution
*/
@DefaultHandler
+ @DontValidate
@HandlesEvent( "view" )
@HandlerPermission( permissionClass = WikiPermission.class, target = "${context.engine.applicationName}", actions = WikiPermission.LOGIN_ACTION )
@WikiRequestContext( "login" )
public Resolution view()
{
- Resolution r = null;
+ ValidationErrors errors = getContext().getValidationErrors();
+ ResourceBundle rb = getContext().getBundle( "CoreResources" );
+ // If user got here and is already authenticated, it means
+ // they just aren't allowed access to what they asked for.
+ // Weepy tears and hankies all 'round.
if( getContext().getWikiSession().isAuthenticated() )
{
- // Set cookies as needed and redirect
- r = saveCookiesAndRedirect( m_redirect, m_remember );
+ errors.addGlobalError( new SimpleError( rb.getString( "login.error.noaccess" ) ) );
+ return new RedirectResolution( MessageActionBean.class );
}
if( getContext().getEngine().getAuthenticationManager().isContainerAuthenticated() )
@@ -244,7 +262,6 @@
Object seen = session.getAttribute( "_redirect" );
if( seen != null )
{
- ResourceBundle rb = getContext().getBundle( "CoreResources" );
getContext().getValidationErrors().addGlobalError( new SimpleError( rb.getString( "login.error.noaccess" ) ) );
return new RedirectResolution( MessageActionBean.class );
}
@@ -261,12 +278,16 @@
log.info( "Successfully authenticated user " + user.getName() + " (container auth)" );
}
+ // The user hasn't logged in yet, so send them to the login page
+ ForwardResolution r = new ForwardResolution( "/Login.jsp" );
+ r.addParameter( "tab", "logincontent" );
return r;
}
/**
- * Event handler that resets the user's password, based on the e-mail address
- * returned by {@link #getEmail()}.
+ * Event handler that resets the user's password, based on the e-mail
+ * address returned by {@link #getEmail()}.
+ *
* @return always returns <code>null</code>
*/
@HandlesEvent( "resetPassword" )
@@ -274,14 +295,13 @@
{
String message = null;
ResourceBundle rb = getContext().getBundle( "CoreResources" );
-
+
// Reset pw for account name
WikiEngine wiki = getContext().getEngine();
WikiSession wikiSession = getContext().getWikiSession();
UserDatabase userDatabase = wiki.getUserManager().getUserDatabase();
boolean success = false;
-
try
{
// Look up the e-mail supplied by the user
@@ -297,13 +317,14 @@
// Compose the message subject line
args = new Object[] { wiki.getApplicationName() };
String mailSubject = MessageFormat.format( rb.getString( "lostpwd.newpassword.subject" ), args );
-
+
// Send the message.
MailUtil.sendMessage( wiki, email, mailSubject, mailMessage );
log.info( "User " + email + " requested and received a new password." );
- // Mail succeeded. Now reset the password.
- // If this fails, we're kind of screwed, because we already mailed it.
+ // Mail succeeded. Now reset the password.
+ // If this fails, we're kind of screwed, because we already mailed
+ // it.
profile.setPassword( randomPassword );
userDatabase.save( profile );
success = true;
@@ -329,7 +350,7 @@
message = rb.getString( "lostpwd.nomail" );
log.error( "Tried to reset password and got another exception: " + e );
}
-
+
if( success )
{
wikiSession.addMessage( "resetpwok", rb.getString( "lostpwd.emailed" ) );
@@ -340,8 +361,8 @@
{
wikiSession.addMessage( "resetpw", message );
}
-
- ForwardResolution r = getContext().getContentPage( this, TemplateManager.Template.VIEW, "LoginContent.jsp" );
+
+ ForwardResolution r = new ForwardResolution( "/LoginForm.jsp" );
r.addParameter( "tab", "lostpassword" );
return r;
}
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java Tue Dec 16 22:19:55 2008
@@ -105,7 +105,7 @@
*
* @param name the asserted name
*/
- @Validate( required = true, on = "createAssertedName" )
+ @Validate( required = true, on = "createAssertedName", minlength=1, maxlength=128 )
public void setAssertedName( String name )
{
m_assertedName = name;
@@ -130,7 +130,7 @@
*
* @param editor the editor
*/
- @Validate( required = false )
+ @Validate()
public void setEditor( String editor )
{
m_editor = editor;
@@ -146,7 +146,7 @@
*
* @param url the URL to redirect to
*/
- @Validate( required = false )
+ @Validate()
public void setRedirect( String url )
{
m_redirect = url;
@@ -176,6 +176,6 @@
{
WikiActionBeanContext context = getContext();
TemplateManager.addResourceRequest( context, "script", "scripts/jspwiki-prefs.js" );
- return context.getContentPage( this, TemplateManager.Template.VIEW, "PreferencesContent.jsp" );
+ return new ForwardResolution( "/UserPreferences.jsp" );
}
}
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java Tue Dec 16 22:19:55 2008
@@ -18,7 +18,6 @@
import com.ecyrd.jspwiki.auth.user.UserProfile;
import com.ecyrd.jspwiki.log.Logger;
import com.ecyrd.jspwiki.log.LoggerFactory;
-import com.ecyrd.jspwiki.ui.TemplateManager;
import com.ecyrd.jspwiki.ui.stripes.HandlerPermission;
import com.ecyrd.jspwiki.ui.stripes.WikiActionBeanContext;
import com.ecyrd.jspwiki.ui.stripes.WikiRequestContext;
@@ -55,7 +54,9 @@
/**
* Pre-action that loads the UserProfile before user-supplied parameters are
- * bound to the ActionBean.
+ * bound to the ActionBean. Also stashes the UserProfile as a request-scoped
+ * attribute named <code>profile</code>. This attribute can be used in
+ * JSP EL expressions as <code>$%7Bprofile%7D</code>.
*
* @return <code>null</code>, always
*/
@@ -70,7 +71,11 @@
// Null out the password, so that we don't re-encrypt it by accident
m_profile.setPassword( null );
+
+ // Stash the profile as a request attribute
+ getContext().getRequest().setAttribute( "profile", m_profile );
return null;
+
}
/**
@@ -139,8 +144,8 @@
m_passwordAgain = password;
}
- @ValidateNestedProperties( { @Validate( field = "loginName", maxlength = 100, required = true, on = "save" ),
- @Validate( field = "fullname", maxlength = 100, required = true, on = "save" ),
+ @ValidateNestedProperties( { @Validate( field = "loginName", required = true, minlength = 1, maxlength = 100 ),
+ @Validate( field = "fullname", required = true, minlength = 1, maxlength = 100 ),
@Validate( field = "password", minlength = 8, maxlength = 100 ),
@Validate( field = "email", converter = EmailTypeConverter.class ) } )
public void setProfile( UserProfile profile )
@@ -162,7 +167,7 @@
*
* @param errors the current validation errors for this ActionBean
*/
- @ValidationMethod( on = "save", when = ValidationState.NO_ERRORS )
+ @ValidationMethod( when = ValidationState.NO_ERRORS )
public void validateNoCollision( ValidationErrors errors )
{
WikiEngine engine = getContext().getEngine();
@@ -189,7 +194,7 @@
otherProfile = database.findByLoginName( m_profile.getLoginName() );
if( otherProfile != null && !otherProfile.equals( oldProfile ) )
{
- errors.add( "profile.loginName", new LocalizableError( "nameCollision" ) );
+ errors.add( "profile.loginName", new LocalizableError( "profile.nameCollision" ) );
}
}
catch( NoSuchPrincipalException e )
@@ -200,7 +205,7 @@
otherProfile = database.findByFullName( m_profile.getFullname() );
if( otherProfile != null && !otherProfile.equals( oldProfile ) )
{
- errors.add( "profile.fullname", new LocalizableError( "nameCollision" ) );
+ errors.add( "profile.fullname", new LocalizableError( "profile.nameCollision" ) );
}
}
catch( NoSuchPrincipalException e )
@@ -209,24 +214,12 @@
}
/**
- * After all fields validate correctly, this method validates that the user
- * account is not spam.
- *
- * @param errors the current validation errors for this ActionBean
- */
- @ValidationMethod( on = "save", when = ValidationState.NO_ERRORS )
- public void validateNotSpam( ValidationErrors errors )
- {
- log.info( "Skipped validateNotSpam method because it has not been coded yet..." );
- }
-
- /**
* If the user profile is new, this method verifies that the user has
* supplied matching passwords.
*
* @param errors the current validation errors for this ActionBean
*/
- @ValidationMethod( on = "save", when = ValidationState.ALWAYS )
+ @ValidationMethod( when = ValidationState.ALWAYS )
public void validatePasswords( ValidationErrors errors )
{
// All new profiles must have a supplied password
@@ -234,7 +227,7 @@
{
if( m_profile.getPassword() == null )
{
- errors.add( "profile.password", new LocalizableError( "valueNotPresent" ) );
+ errors.add( "profile.password", new LocalizableError( "validation.required.valueNotPresent" ) );
}
}
@@ -244,22 +237,38 @@
{
if( !m_profile.getPassword().equals( m_passwordAgain ) )
{
- errors.add( "profile.password", new LocalizableError( "noPasswordMatch" ) );
+ errors.add( "profile.password", new LocalizableError( "profile.noPasswordMatch" ) );
}
}
}
/**
- * Default handler that forwards the user back to itself.
+ * Event handler that forwards the user to <code>/CreateProfile.jsp</code>.
+ *
+ * @return the resolution
+ */
+ @HandlesEvent( "create" )
+ @DontValidate
+ public Resolution create()
+ {
+ return new ForwardResolution( "/CreateProfile.jsp" );
+ }
+
+ /**
+ * Default event handler that forwards the user to
+ * <code>/UserPreferences.jsp</code>.
*
* @return the resolution
*/
@HandlesEvent( "view" )
@DefaultHandler
+ @DontValidate
@WikiRequestContext( "profile" )
public Resolution view()
{
- return getContext().getContentPage( this, TemplateManager.Template.VIEW, "PreferencesContent.jsp" );
+ ForwardResolution r = new ForwardResolution( "/UserPreferences.jsp" );
+ r.addParameter( "tab", "profile" );
+ return r;
}
}
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/ViewActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/ViewActionBean.java?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/ViewActionBean.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/ViewActionBean.java Tue Dec 16 22:19:55 2008
@@ -12,7 +12,6 @@
import com.ecyrd.jspwiki.auth.permissions.PagePermission;
import com.ecyrd.jspwiki.log.Logger;
import com.ecyrd.jspwiki.log.LoggerFactory;
-import com.ecyrd.jspwiki.ui.TemplateManager;
import com.ecyrd.jspwiki.ui.stripes.HandlerPermission;
import com.ecyrd.jspwiki.ui.stripes.WikiRequestContext;
@@ -124,22 +123,23 @@
}
/**
- * Default handler that simply forwards the user back to the display JSP <code>PageContent.jsp</code>.
+ * Default handler that simply forwards the user back to the display JSP <code>/Wiki.jsp</code>.
* Every ActionBean needs a default handler to function properly, so we use
* this (very simple) one.
* @return a forward to the content template
*/
@DefaultHandler
+ @DontValidate
@HandlesEvent("view")
@HandlerPermission(permissionClass=PagePermission.class, target="${page.qualifiedName}", actions=PagePermission.VIEW_ACTION)
@WikiRequestContext("view")
public Resolution view()
{
- return getContext().getContentPage( this, TemplateManager.Template.VIEW, "PageContent.jsp" );
+ return new ForwardResolution( "/Wiki.jsp");
}
/**
- * Handler that forwards to the page information display JSP <code>InfoContent.jsp</code>.
+ * Handler that forwards to the page information display JSP <code>/PageInfo.jsp</code>.
* @return a forward to the content template
*/
@HandlesEvent("info")
@@ -147,7 +147,7 @@
@WikiRequestContext("info")
public Resolution info()
{
- return getContext().getContentPage( this, TemplateManager.Template.VIEW, "InfoContent.jsp" );
+ return new ForwardResolution( "/PageInfo.jsp");
}
}
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/WikiTagBase.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/WikiTagBase.java?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/WikiTagBase.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/WikiTagBase.java Tue Dec 16 22:19:55 2008
@@ -85,7 +85,7 @@
/**
* Initializes the tag, and sets an internal reference to the current WikiActionBean
* by delegating to
- * {@link com.ecyrd.jspwiki.ui.stripes.WikiInterceptor#findActionBean(javax.servlet.ServletRequest)}.
+ * {@link com.ecyrd.jspwiki.ui.stripes.WikiInterceptor#findActionBean(PageContext)}.
* (That method retrieves the WikiActionBean from page scope.).
* If the WikiActionBean is a WikiContext, a specific reference to the WikiContext
* will be set also. Both of these available as protected fields {@link #m_wikiActionBean} and
@@ -100,12 +100,12 @@
try
{
// Retrieve the ActionBean injected by WikiInterceptor
- m_wikiActionBean = WikiInterceptor.findActionBean( this.getPageContext().getRequest() );
+ m_wikiActionBean = WikiInterceptor.findActionBean( this.getPageContext() );
// It's really bad news if the WikiActionBean wasn't injected (or saved as a variable!)
if ( m_wikiActionBean == null )
{
- throw new JspException( "Can't find WikiActionBean in page or request context! (tag=" + this.getClass() + ")" );
+ throw new JspException( "Can't find WikiActionBean in page context! (tag=" + this.getClass() + ")" );
}
// The WikiContext is the ActionBean's ActionBeanContext
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiActionBeanContext.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiActionBeanContext.java?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiActionBeanContext.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiActionBeanContext.java Tue Dec 16 22:19:55 2008
@@ -8,14 +8,11 @@
import javax.servlet.http.HttpServletRequest;
import net.sourceforge.stripes.action.ActionBeanContext;
-import net.sourceforge.stripes.action.ForwardResolution;
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.WikiSession;
-import com.ecyrd.jspwiki.action.WikiActionBean;
-import com.ecyrd.jspwiki.ui.TemplateManager;
/**
* <p>
@@ -185,19 +182,6 @@
}
/**
- * Returns a Stripes ForwardResolution for the full path to the resolved content page.
- * @return the resolution
- */
- public ForwardResolution getContentPage( WikiActionBean actionBean, TemplateManager.Template template, String contentJsp )
- {
- TemplateManager mgr = getEngine().getTemplateManager();
- WikiActionBeanContext wikiContext = actionBean.getContext();
- wikiContext.setVariable( "contentTemplate", contentJsp );
- String contentPage = mgr.findResource( wikiContext, wikiContext.getTemplate(), template.template() );
- return new ForwardResolution( contentPage );
- }
-
- /**
* {@inheritDoc}
*/
public Principal getCurrentUser()
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiInterceptor.java?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiInterceptor.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiInterceptor.java Tue Dec 16 22:19:55 2008
@@ -12,7 +12,6 @@
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.controller.*;
-import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiSession;
import com.ecyrd.jspwiki.action.LoginActionBean;
@@ -56,8 +55,8 @@
* <p>
* After the intercept method fires, calling classes can obtain the saved
* WikiActionBean by calling
- * {@link WikiInterceptor#findActionBean(javax.servlet.ServletRequest)}.
- * This is the recommended method that JSP scriptlet code should use.
+ * {@link WikiInterceptor#findActionBean(javax.servlet.ServletRequest)}. This
+ * is the recommended method that JSP scriptlet code should use.
* </p>
* <p>
* Because these objects are saved as attributes, they are available to JSPs as
@@ -72,6 +71,7 @@
public class WikiInterceptor implements Interceptor
{
private static final Logger log = LoggerFactory.getLogger( WikiInterceptor.class );
+
/**
* The PageContext attribute name of the WikiActionBean stored by
* WikiInterceptor.
@@ -137,15 +137,21 @@
HttpServletRequest request = actionBeanContext.getRequest();
// Set the WikiSession, if not set yet
- if ( actionBeanContext.getWikiSession() == null )
+ if( actionBeanContext.getWikiSession() == null )
{
WikiEngine engine = actionBeanContext.getEngine();
WikiSession wikiSession = SessionMonitor.getInstance( engine ).find( request.getSession() );
actionBeanContext.setWikiSession( wikiSession );
}
- // Stash the WikiActionBean and WikiPage in the request
- WikiInterceptor.saveActionBean( request, actionBean );
+ // Stash the ActionBean as request attribute, if not saved yet
+ if( request.getAttribute( ATTR_ACTIONBEAN ) == null )
+ {
+ request.setAttribute( ATTR_ACTIONBEAN, actionBean );
+ }
+
+ // Stash the WikiContext, WikiEngine
+ WikiContextFactory.saveContext( request, actionBean.getContext() );
if( log.isDebugEnabled() )
{
@@ -186,6 +192,14 @@
*/
protected Resolution interceptBindingAndValidation( ExecutionContext context ) throws Exception
{
+ // Stash the WikiActionBean as a PageContext attribute
+ WikiActionBean actionBean = (WikiActionBean) context.getActionBean();
+ PageContext pageContext = DispatcherHelper.getPageContext();
+ if( pageContext != null )
+ {
+ pageContext.setAttribute( ATTR_ACTIONBEAN, actionBean );
+ }
+
// Did the handler resolution stage return a Resolution? If so, bail.
Resolution r = context.proceed();
if( r != null )
@@ -193,14 +207,13 @@
return r;
}
- // Get the resolved ActionBean and event handler method
- WikiActionBean actionBean = (WikiActionBean) context.getActionBean();
+ // Get the event handler method
Method handler = context.getHandler();
-
+
// Make sure we set the WikiContext request context, while we're at it
Map<Method, HandlerInfo> eventinfos = HandlerInfo.getHandlerInfoCollection( actionBean.getClass() );
HandlerInfo eventInfo = eventinfos.get( handler );
- if ( eventInfo != null )
+ if( eventInfo != null )
{
String requestContext = eventInfo.getRequestContext();
actionBean.getContext().setRequestContext( requestContext );
@@ -238,34 +251,41 @@
}
/**
- * <p>
- * Saves the supplied WikiActionBean and its associated WikiContext,
- * WikiEngine and WikiSession in
- * request scope. The action bean is saved as an attribute named
- * {@link WikiInterceptor#ATTR_ACTIONBEAN}. The other attributes are saved
- * as described in {@link WikiContextFactory#saveContext(HttpServletRequest, WikiContext)}.
- * </p>
+ * Returns the WikiActionBean associated with the current
+ * {@link javax.servlet.jsp.PageContext}, which may have been previously stashed by
+ * {@link #interceptBindingAndValidation(ExecutionContext)}. Note that each
+ * PageContext can contain its own ActionBean. The ActionBean will be
+ * retrieved from page-scope attribute {@link WikiInterceptor#ATTR_ACTIONBEAN}.
+ * If the WikiActionBean cannot be obtained as a page-scope attribute, the
+ * request scope will be tried also.
*
- * @param request the HTTP request
- * @param actionBean the WikiActionBean to save
+ * @param pageContext the page context
+ * @return the WikiActionBean
+ * @throws IllegalStateException if the WikiActionBean was not found in the
+ * page context or
*/
- public static void saveActionBean( HttpServletRequest request, WikiActionBean actionBean )
+ public static WikiActionBean findActionBean( PageContext pageContext )
{
- // Stash the WikiActionBean
- request.setAttribute( WikiInterceptor.ATTR_ACTIONBEAN, actionBean );
-
- // Stash the other attributes
- WikiContextFactory.saveContext( request, actionBean.getContext() );
+ WikiActionBean bean = (WikiActionBean) pageContext.getAttribute( WikiInterceptor.ATTR_ACTIONBEAN );
+ if( bean == null )
+ {
+ bean = findActionBean( pageContext.getRequest() );
+ if ( bean == null )
+ {
+ log.debug( "WikiActionBean not found under page context attribute '" + WikiInterceptor.ATTR_ACTIONBEAN
+ + "'! Something failed to stash it..." );
+ }
+ }
+ return bean;
}
/**
* Returns the WikiActionBean associated with the current
- * {@link javax.servlet.http.HttpServletRequest}. The ActionBean will be
- * retrieved from attribute {@link WikiInterceptor#ATTR_ACTIONBEAN}.
- * If an ActionBean is not found under this name, the standard Stripes
- * attribute
- * {@link net.sourceforge.stripes.controller.StripesConstants#REQ_ATTR_ACTION_BEAN}
- * will be attempted.
+ * {@link javax.servlet.http.HttpServletRequest}, which was previously
+ * stashed by {@link #interceptActionBeanResolution(ExecutionContext)}.
+ * Only the first ActionBean on a JSP will be stashed as a request-level
+ * attribute. The ActionBean will be retrieved from attribute
+ * {@link WikiInterceptor#ATTR_ACTIONBEAN}.
*
* @param request the HTTP request
* @return the WikiActionBean
@@ -278,13 +298,8 @@
if( bean == null )
{
log.debug( "WikiActionBean not found under request attribute '" + WikiInterceptor.ATTR_ACTIONBEAN
- + "'; trying standard Stripes attribute '" + StripesConstants.REQ_ATTR_ACTION_BEAN + "'." );
- bean = (WikiActionBean) request.getAttribute( StripesConstants.REQ_ATTR_ACTION_BEAN );
- }
-
- if( bean == null )
- {
- throw new IllegalStateException( "WikiActionBean not found in request! Something failed to stash it..." );
+ + "'! Something failed to stash it..." );
+ bean = (WikiActionBean) request.getAttribute( WikiInterceptor.ATTR_ACTIONBEAN );
}
return bean;
}
Added: incubator/jspwiki/trunk/src/webdocs/CreateProfile.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/CreateProfile.jsp?rev=727295&view=auto
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/CreateProfile.jsp (added)
+++ incubator/jspwiki/trunk/src/webdocs/CreateProfile.jsp Tue Dec 16 22:19:55 2008
@@ -0,0 +1,7 @@
+<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
+<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.UserProfileActionBean" event="create" />
+<stripes:layout-render name="/templates/default/ViewLayout.jsp">
+ <stripes:layout-component name="content">
+ <jsp:include page="/templates/default/CreateProfileContent.jsp" />
+ </stripes:layout-component>
+</stripes:layout-render>
Modified: incubator/jspwiki/trunk/src/webdocs/LoginForm.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/LoginForm.jsp?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/LoginForm.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/LoginForm.jsp Tue Dec 16 22:19:55 2008
@@ -1,34 +1,7 @@
-<%@ page import="com.ecyrd.jspwiki.log.Logger" %>
-<%@ page import="com.ecyrd.jspwiki.log.LoggerFactory" %>
-<%@ page import="com.ecyrd.jspwiki.*" %>
-<%@ page import="com.ecyrd.jspwiki.action.*" %>
-<%@ page errorPage="/Error.jsp" %>
-<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
-<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.LoginActionBean" event="view" executeResolution="true" />
-<%!
- /**
- * This page contains the logic for finding and including
- the correct login form, which is usually loaded from
- the template directory's LoginContent.jsp page.
- It should not be requested directly by users. If
- container-managed authentication is in force, the container
- will prevent direct access to it.
- */
- Logger log = LoggerFactory.getLogger("JSPWiki");
-
-%>
-<%
- WikiEngine wiki = WikiEngine.getInstance( getServletConfig() );
- // Retrieve the Login page context, then go and find the login form
-
- WikiContext wikiContext = WikiContextFactory.findContext( pageContext );
- wikiContext.setVariable( "contentTemplate", "LoginContent.jsp" );
- response.setContentType("text/html; charset="+wiki.getContentEncoding() );
- String contentPage = wiki.getTemplateManager().findJSP( pageContext,
- wikiContext.getTemplate(),
- "ViewTemplate.jsp" );
-
- log.debug("Login template content is: " + contentPage);
-
-%><wiki:Include page="<%=contentPage%>" />
\ No newline at end of file
+<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.LoginActionBean" event="view" />
+<stripes:layout-render name="/templates/default/ViewLayout.jsp">
+ <stripes:layout-component name="content">
+ <jsp:include page="/templates/default/LoginContent.jsp" />
+ </stripes:layout-component>
+</stripes:layout-render>
Modified: incubator/jspwiki/trunk/src/webdocs/PageInfo.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/PageInfo.jsp?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/PageInfo.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/PageInfo.jsp Tue Dec 16 22:19:55 2008
@@ -1,2 +1,7 @@
<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
-<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.ViewActionBean" event="info" executeResolution="true"/>
+<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.ViewActionBean" event="info" />
+<stripes:layout-render name="/templates/default/ViewLayout.jsp">
+ <stripes:layout-component name="content">
+ <jsp:include page="/templates/default/InfoContent.jsp" />
+ </stripes:layout-component>
+</stripes:layout-render>
Modified: incubator/jspwiki/trunk/src/webdocs/UserPreferences.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/UserPreferences.jsp?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/UserPreferences.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/UserPreferences.jsp Tue Dec 16 22:19:55 2008
@@ -1,2 +1,7 @@
<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
-<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.UserPreferencesActionBean" event="prefs" executeResolution="true" />
+<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.UserPreferencesActionBean" event="prefs" />
+<stripes:layout-render name="/templates/default/ViewLayout.jsp">
+ <stripes:layout-component name="content">
+ <jsp:include page="/templates/default/PreferencesContent.jsp" />
+ </stripes:layout-component>
+</stripes:layout-render>
Modified: incubator/jspwiki/trunk/src/webdocs/Wiki.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/Wiki.jsp?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/Wiki.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/Wiki.jsp Tue Dec 16 22:19:55 2008
@@ -1,2 +1,10 @@
<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
-<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.ViewActionBean" event="view" executeResolution="true" />
+<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.ViewActionBean" event="view" />
+<stripes:layout-render name="/templates/default/ViewLayout.jsp">
+ <stripes:layout-component name="content">
+ <jsp:include page="/templates/default/PageContent.jsp" />
+ <!--
+ <wiki:Include page="/templates/default/PageContent.jsp" />
+ -->
+ </stripes:layout-component>
+</stripes:layout-render>
Added: incubator/jspwiki/trunk/src/webdocs/templates/default/CreateProfileContent.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/CreateProfileContent.jsp?rev=727295&view=auto
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/CreateProfileContent.jsp (added)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/CreateProfileContent.jsp Tue Dec 16 22:19:55 2008
@@ -0,0 +1,40 @@
+<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
+<%@ page import="com.ecyrd.jspwiki.*" %>
+<%@ page import="com.ecyrd.jspwiki.action.*" %>
+<%@ page import="com.ecyrd.jspwiki.auth.*" %>
+<%@ page errorPage="/Error.jsp" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
+<%@ page import="javax.servlet.jsp.jstl.fmt.*" %>
+<wiki:TabbedSection defaultTab="profile">
+
+<%-- Login functionality --%>
+<wiki:UserCheck status="notauthenticated">
+<wiki:Tab id="logincontent" titleKey="login.tab" url="Login.jsp?tab=logincontent" />
+
+<%-- Lost pasword functionality --%>
+<wiki:Tab id="lostpassword" titleKey="login.lostpw.tab" url="Login.jsp?tab=lostpassword" />
+</wiki:UserCheck>
+
+<%-- Register new user profile --%>
+<wiki:Permission permission='editProfile'>
+ <wiki:Tab id="profile" titleKey="login.register.tab" accesskey="p">
+ <wiki:Include page="ProfileTab.jsp" />
+ </wiki:Tab>
+</wiki:Permission>
+
+<wiki:Tab id="loginhelp" titleKey="login.tab.help">
+ <wiki:InsertPage page="LoginHelp" />
+
+ <wiki:NoSuchPage page="LoginHelp">
+ <div class="error">
+ <fmt:message key="login.loginhelpmissing">
+ <fmt:param><wiki:EditLink page="LoginHelp">LoginHelp</wiki:EditLink></fmt:param>
+ </fmt:message>
+ </div>
+ </wiki:NoSuchPage>
+
+</wiki:Tab>
+
+</wiki:TabbedSection>
Added: incubator/jspwiki/trunk/src/webdocs/templates/default/EditLayout.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/EditLayout.jsp?rev=727295&view=auto
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/EditLayout.jsp (added)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/EditLayout.jsp Tue Dec 16 22:19:55 2008
@@ -0,0 +1,55 @@
+<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<stripes:layout-definition>
+
+<html id="top" xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+ <title>
+ <wiki:CheckRequestContext context="edit">
+ <fmt:message key="edit.title.edit">
+ <fmt:param><wiki:Variable var="ApplicationName" /></fmt:param>
+ <fmt:param><wiki:PageName/></fmt:param>
+ </fmt:message>
+ </wiki:CheckRequestContext>
+ <wiki:CheckRequestContext context="comment">
+ <fmt:message key="comment.title.comment">
+ <fmt:param><wiki:Variable var="ApplicationName" /></fmt:param>
+ <fmt:param><wiki:PageName/></fmt:param>
+ </fmt:message>
+ </wiki:CheckRequestContext>
+ </title>
+ <meta name="robots" content="noindex,follow" />
+ <wiki:Include page="commonheader.jsp" />
+</head>
+
+<body <wiki:CheckRequestContext context='edit'>class="edit"</wiki:CheckRequestContext> <wiki:CheckRequestContext context='comment'>class="comment"</wiki:CheckRequestContext> >
+
+<div id="wikibody" class="${prefs.Orientation}">
+
+ <wiki:Include page="Header.jsp" />
+
+ <div id="content">
+
+ <div id="page">
+ <wiki:Include page="PageActionsTop.jsp" />
+ <stripes:layout-component name="content" />
+ <wiki:Include page="PageActionsBottom.jsp" />
+ </div>
+
+ <wiki:Include page="Favorites.jsp" />
+
+ <div class="clearbox"></div>
+ </div>
+
+ <wiki:Include page="Footer.jsp" />
+
+</div>
+
+</body>
+</html>
+
+</stripes:layout-definition>
Modified: incubator/jspwiki/trunk/src/webdocs/templates/default/LoginContent.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/LoginContent.jsp?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/LoginContent.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/LoginContent.jsp Tue Dec 16 22:19:55 2008
@@ -31,8 +31,9 @@
<%--<wiki:Include page='LoginTab.jsp'/>--%>
<stripes:form action="<%=postURL%>" id="login" class="wikiform" method="post" acceptcharset="UTF-8">
+ <stripes:param name="tab" value="logincontent" />
-<div class="center">
+ <div class="center">
<h3><fmt:message key="login.heading.login"><fmt:param><wiki:Variable var="applicationname" /></fmt:param></fmt:message></h3>
@@ -56,8 +57,8 @@
</tr>
<% if( supportsCookieAuthentication ) { %>
<tr>
- <td><stripes:label for="j_remember" name="login.remember" /></td>
- <td><stripes:checkbox name="j_remember" id="j_remember" /></td>
+ <td><stripes:label for="remember" name="login.remember" /></td>
+ <td><stripes:checkbox name="remember" id="j_remember" /></td>
</tr>
<% } %>
<tr>
@@ -83,7 +84,7 @@
</a>
</div>
-</div>
+ </div>
</stripes:form>
</wiki:Tab>
@@ -157,9 +158,7 @@
<%-- Register new user profile --%>
<wiki:Permission permission='editProfile'>
-<wiki:Tab id="profile" titleKey="login.register.tab">
- <wiki:Include page='ProfileTab.jsp' />
-</wiki:Tab>
+<wiki:Tab id="profile" titleKey="login.register.tab" url="CreateProfile.jsp" />
</wiki:Permission>
<wiki:Tab id="loginhelp" titleKey="login.tab.help">
Modified: incubator/jspwiki/trunk/src/webdocs/templates/default/ProfileTab.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/ProfileTab.jsp?rev=727295&r1=727294&r2=727295&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/ProfileTab.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/ProfileTab.jsp Tue Dec 16 22:19:55 2008
@@ -1,20 +1,9 @@
<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
-<%@ page import="com.ecyrd.jspwiki.*" %>
-<%@ page import="com.ecyrd.jspwiki.auth.*" %>
-<%@ page import="com.ecyrd.jspwiki.auth.user.*" %>
-<%@ page errorPage="/Error.jsp" %>
+<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
-<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
<%@ page import="javax.servlet.jsp.jstl.fmt.*" %>
-<%@ page import="com.ecyrd.jspwiki.action.WikiContextFactory" %>
-<%
- /* dateformatting not yet supported by wiki:UserProfile tag - diy */
- WikiContext wikiContext = WikiContextFactory.findContext( pageContext );
- UserManager manager = wikiContext.getEngine().getUserManager();
- UserProfile profile = manager.getUserProfile( wikiContext.getWikiSession() );
-%>
-<stripes:form beanclass="com.ecyrd.jspwiki.action.UserPreferencesActionBean" id="editProfile" class="wikiform" method="post" acceptcharset="UTF-8">
+<stripes:form beanclass="com.ecyrd.jspwiki.action.UserProfileActionBean" id="editProfile" class="wikiform" method="post" acceptcharset="UTF-8">
<stripes:param name="tab" value="profile" />
<h3>
@@ -32,10 +21,11 @@
<!-- Login name -->
<tr>
- <td><stripes:label for="loginname" name="prefs.loginname" /></td>
+ <td><stripes:label for="profile.loginName" name="prefs.loginname" /></td>
<td>
<wiki:UserProfile property="canChangeLoginName">
- <stripes:text name="loginname" id="loginname" size="20"><wiki:UserProfile property="loginname" /></stripes:text>
+ <stripes:text name="profile.loginName" id="loginName" size="20"><wiki:UserProfile property="loginname" /></stripes:text>
+ <stripes:errors field="profile.loginName" />
</wiki:UserProfile>
<wiki:UserProfile property="!canChangeLoginName">
<!-- If user can't change their login name, it's because the container manages the login -->
@@ -53,38 +43,37 @@
<!-- Password; not displayed if container auth used -->
<wiki:UserProfile property="canChangePassword">
<tr>
- <td><stripes:label for="password" name="prefs.password" /></td>
+ <td><stripes:label for="profile.password" name="prefs.password" /></td>
<td>
- <%--FIXME Enter Old PW to validate change flow, not yet treated by JSPWiki
- <label for="password">Old</label>
- <input type="password" name="password0" id="password0" size="20" value="" />
- --%>
- <stripes:password name="password" id="password" size="20" value="" />
+ <stripes:password name="profile.password" id="password" size="20" value="" />
+ <stripes:errors field="profile.password" />
</td>
</tr>
<tr>
<td><stripes:label for="passwordAgain" name="prefs.password2" /></td>
<td>
- <stripes:password name="passwordAgain" id="passwordAgain" size="20" value="" />
- <%-- extra validation ? min size, allowed chars? --%>
+ <stripes:password name="passwordAgain" id="passwordAgain" size="20" value="" />
+ <stripes:errors field="profile.passwordAgain" />
</td>
</tr>
</wiki:UserProfile>
<!-- Full name -->
<tr>
- <td><stripes:label for="fullname" name="prefs.fullname" /></td>
+ <td><stripes:label for="profile.fullname" name="prefs.fullname" /></td>
<td>
- <stripes:text name="fullname" id="fullname" size="20"><wiki:UserProfile property="fullname" /></stripes:text>
+ <stripes:text name="profile.fullname" id="fullname" size="20"><wiki:UserProfile property="fullname" /></stripes:text>
+ <stripes:errors field="profile.fullname" />
<div class="formhelp"><fmt:message key="prefs.fullname.description" /></div>
</td>
</tr>
<!-- E-mail -->
<tr>
- <td><stripes:label for="email" name="prefs.email" /></td>
+ <td><stripes:label for="profile.email" name="prefs.email" /></td>
<td>
- <stripes:text name="email" id="email" size="20"><wiki:UserProfile property="email" /></stripes:text>
+ <stripes:text name="profile.email" id="email" size="20"><wiki:UserProfile property="email" /></stripes:text>
+ <stripes:errors field="profile.email" />
<div class="formhelp"><fmt:message key="prefs.email.description" /></div>
</td>
</tr>
@@ -107,14 +96,14 @@
<td><stripes:label name="prefs.creationdate" /></td>
<td class="formvalue">
<%--<wiki:UserProfile property="created"/>--%>
- <fmt:formatDate value="<%= profile.getCreated() %>" pattern="${prefs.DateFormat}" timeZone="${prefs.TimeZone}" />
+ <fmt:formatDate value="${profile.Created}" pattern="${prefs.DateFormat}" timeZone="${prefs.TimeZone}" />
</td>
</tr>
<tr class="additinfo">
<td><stripes:label name="prefs.profile.lastmodified" /></td>
<td class="formvalue">
<%--<wiki:UserProfile property="modified"/>--%>
- <fmt:formatDate value="<%= profile.getLastModified() %>" pattern="${prefs.DateFormat}" timeZone="${prefs.TimeZone}" />
+ <fmt:formatDate value="${profile.LastModified}" pattern="${prefs.DateFormat}" timeZone="${prefs.TimeZone}" />
</td>
</tr>
</wiki:UserProfile>
@@ -123,10 +112,10 @@
<td> </td>
<td>
<wiki:UserProfile property="exists">
- <stripes:submit name="saveProfile"><fmt:message key="prefs.save.submit" /></stripes:submit>
+ <stripes:submit name="save"><fmt:message key="prefs.save.submit" /></stripes:submit>
</wiki:UserProfile>
<wiki:UserProfile property="new">
- <stripes:submit name="saveProfile"><fmt:message key="prefs.save.submit" /></stripes:submit>
+ <stripes:submit name="save"><fmt:message key="prefs.save.submit" /></stripes:submit>
</wiki:UserProfile>
<wiki:UserCheck status="assertionsAllowed">
Added: incubator/jspwiki/trunk/src/webdocs/templates/default/ViewLayout.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/ViewLayout.jsp?rev=727295&view=auto
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/ViewLayout.jsp (added)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/ViewLayout.jsp Tue Dec 16 22:19:55 2008
@@ -0,0 +1,56 @@
+<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
+<%@ page import="com.ecyrd.jspwiki.*" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<stripes:layout-definition>
+
+<html id="top" xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+ <title>
+ <fmt:message key="view.title.view">
+ <fmt:param><wiki:Variable var="ApplicationName" /></fmt:param>
+ <fmt:param><wiki:PageName/></fmt:param>
+ </fmt:message>
+ </title>
+ <wiki:Include page="commonheader.jsp" />
+ <wiki:CheckVersion mode="notlatest">
+ <meta name="robots" content="noindex,nofollow" />
+ </wiki:CheckVersion>
+ <wiki:CheckRequestContext context="diff|info">
+ <meta name="robots" content="noindex,nofollow" />
+ </wiki:CheckRequestContext>
+ <wiki:CheckRequestContext context="!view">
+ <meta name="robots" content="noindex,follow" />
+ </wiki:CheckRequestContext>
+</head>
+
+<body class="view">
+
+<div id="wikibody" class="${prefs.Orientation}">
+
+ <wiki:Include page="Header.jsp" />
+
+ <div id="content">
+
+ <div id="page">
+ <wiki:Include page="PageActionsTop.jsp" />
+ <stripes:layout-component name="content" />
+ <wiki:Include page="PageActionsBottom.jsp" />
+ </div>
+
+ <wiki:Include page="Favorites.jsp" />
+
+ <div class="clearbox"></div>
+ </div>
+
+ <wiki:Include page="Footer.jsp" />
+
+</div>
+
+</body>
+</html>
+
+</stripes:layout-definition>