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/04/02 04:35:06 UTC
svn commit: r643690 - in
/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src:
com/ecyrd/jspwiki/action/ webdocs-stripes/
webdocs-stripes/WEB-INF/jsp/templates/default/
Author: ajaquith
Date: Tue Apr 1 19:35:04 2008
New Revision: 643690
URL: http://svn.apache.org/viewvc?rev=643690&view=rev
Log:
Committed some items before syncing with current 2.7.0 branch. Not all of these things work!
Added:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/GroupTab.jsp
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/PreferencesContent.jsp
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/PreferencesTab.jsp
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/ProfileTab.jsp
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/UserPreferences.jsp
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java?rev=643690&r1=643689&r2=643690&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java Tue Apr 1 19:35:04 2008
@@ -4,12 +4,14 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import net.sourceforge.stripes.action.*;
import net.sourceforge.stripes.validation.Validate;
import com.ecyrd.jspwiki.auth.login.CookieAssertionLoginModule;
import com.ecyrd.jspwiki.auth.permissions.WikiPermission;
+import com.ecyrd.jspwiki.ui.EditorManager;
/**
* @author Andrew Jaquith
@@ -20,6 +22,10 @@
{
private String m_assertedName = null;
+ private String m_editor = null;
+
+ private String m_redirect = null;
+
/**
* Clears the user's asserted name by removing the cookie from the user's
* session, then logs out the user by redirecting to <code>/Login.jsp</code>.
@@ -27,7 +33,7 @@
* @return a redirection to the logout page
*/
@HandlesEvent("clearAssertedName")
- @EventPermission(permissionClass=WikiPermission.class, target="${engine.applicationName}", actions=WikiPermission.EDIT_PREFERENCES_ACTION)
+ @EventPermission(permissionClass = WikiPermission.class, target = "${engine.applicationName}", actions = WikiPermission.EDIT_PREFERENCES_ACTION)
public Resolution clearAssertedName()
{
HttpServletResponse response = getContext().getResponse();
@@ -44,9 +50,9 @@
public Resolution editFavorites()
{
Principal principal = this.getCurrentUser();
- return new RedirectResolution("/Edit.jsp?"+principal.getName()+"Favorites");
+ return new RedirectResolution("/Edit.jsp?" + principal.getName() + "Favorites");
}
-
+
/**
* Sets the user's asserted name by setting a cookie in the user's session,
* then redirects to the wiki front page. This method will <em>not</em>
@@ -56,10 +62,10 @@
*/
@DefaultHandler
@HandlesEvent("createAssertedName")
- @EventPermission(permissionClass=WikiPermission.class, target="${engine.applicationName}", actions=WikiPermission.EDIT_PREFERENCES_ACTION)
+ @EventPermission(permissionClass = WikiPermission.class, target = "${engine.applicationName}", actions = WikiPermission.EDIT_PREFERENCES_ACTION)
public Resolution createAssertedName()
{
- if ( !getWikiSession().isAuthenticated() )
+ if (!getWikiSession().isAuthenticated())
{
HttpServletRequest request = getContext().getRequest();
HttpServletResponse response = getContext().getResponse();
@@ -85,10 +91,59 @@
* @param name
* the asserted name
*/
- @Validate(required=true, on="createAssertedName")
+ @Validate(required = true, on = "createAssertedName")
public void setAssertedName(String name)
{
m_assertedName = name;
}
+ /**
+ * Returns the editor specified by the user.
+ *
+ * @return the editor
+ */
+ public String getEditor()
+ {
+ return m_editor;
+ }
+
+ /**
+ * Sets the editor for editing preferences. If this
+ * UserPreferencesActionBean has an associated WikiActionBeanContext, and
+ * that context's request is not <code>null</code>, this method also sets
+ * the editor as an HTTP session attribute.
+ * <em>Note: this functionality was taken directly from the 2.6 UserPreferences.jsp.</em>
+ *
+ * @param editor
+ * the editor
+ */
+ @Validate(required = false)
+ public void setEditor(String editor)
+ {
+ m_editor = editor;
+ if (this.getContext() != null && getContext().getRequest() != null)
+ {
+ HttpSession session = getContext().getRequest().getSession();
+ session.setAttribute(EditorManager.PARA_EDITOR, editor);
+ }
+ }
+
+ /**
+ * Sets the URL to redirect to after the event handler methods fire.
+ * @param url the URL to redirect to
+ */
+ @Validate(required=false)
+ public void setRedirect(String url)
+ {
+ m_redirect = url;
+ }
+
+ /**
+ * Returns the URL to redirect to after the event handler methods fire.
+ * @return the URL to redirect to
+ */
+ public String getRedirect()
+ {
+ return m_redirect;
+ }
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/UserPreferences.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/UserPreferences.jsp?rev=643690&r1=643689&r2=643690&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/UserPreferences.jsp (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/UserPreferences.jsp Tue Apr 1 19:35:04 2008
@@ -1,189 +1,10 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://stripes.sourceforge.net/stripes.tld" prefix="stripes" %>
<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
-<fmt:setBundle basename="templates.DefaultResources"/>
+<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.UserPreferencesActionBean" />
<stripes:layout-render name="/WEB-INF/jsp/templates/default/ViewTemplate.jsp">
- <stripes:layout-component name="contents">
-
- <h3><fmt:message key="prefs.heading.yourprofile"><fmt:param><wiki:Variable var="applicationname"/></fmt:param></fmt:message></h3>
-
- <wiki:TabbedSection defaultTab='<%=request.getParameter("tab")%>'>
- <!-- Tab 1: user preferences -->
- <wiki:Tab id="prefs" title="prefs.tab.prefs">
- <div class="formcontainer">
- <div class="instructions">
- <fmt:message key="prefs.instructions"/>
- </div>
- </div>
- <wiki:Permission permission="editPreferences">
- <wiki:UserCheck status="anonymous">
- <div class="formcontainer">
- <div class="instructions">
- <wiki:Messages div="error" topic="prefs" prefix="Could not save prefs: "/>
- </div>
- <stripes:form id="createAssertedName" action="/UserPreferences.action" method="POST" acceptcharset="UTF-8">
- <stripes:errors/>
- <div class="block">
- <stripes:label for="assertedName" />
- <stripes:text name="assertedName" size="30"><wiki:UserProfile property="asserted"/></stripes:text>
- <div class="description">
- <fmt:message key="prefs.wikiname.description">
- <fmt:param><wiki:Variable var="applicationname" /></fmt:param>
- </fmt:message>
- </div>
- <div class="description">
- <fmt:message key="prefs.wikiname.description2">
- <fmt:param><a onclick="TabbedSection.onclick('profile')" ><fmt:message key="prefs.wikiname.create"/></a></fmt:param>
- </fmt:message>
- </div>
- <stripes:hidden name="tab" value="prefs" />
- <stripes:submit name="createAssertedName"/>
- </div>
- </stripes:form>
- </div>
- </wiki:UserCheck>
-
- <!-- Clearing the 'asserted name' cookie -->
- <wiki:UserCheck status="asserted">
- <div class="formcontainer">
- <stripes:form id="clearAssertedName" action="/UserPreferences.action" method="POST" acceptcharset="UTF-8">
- <div class="block">
- <div class="description">
- <fmt:message key="prefs.clear.description"/>
- </div>
- <stripes:hidden name="tab" value="prefs" />
- <stripes:submit name="clearAssertedName"/>
- </div>
- </stripes:form>
- <stripes:form id="editFavorites" action="/UserPreferences.action" method="GET">
- <div class="block">
- <div class="description">
- <fmt:message key="prefs.favs.description"/>
- </div>
- <stripes:hidden name="tab" value="prefs" />
- <stripes:submit name="editFavorites"/>
- </div>
- </stripes:form>
- </div>
- </wiki:UserCheck>
- </wiki:Permission>
- </wiki:Tab>
-
- <!-- Tab 2: If user can register, allow edits to profile -->
- <wiki:Tab id="profile" title="prefs.tab.profile">
- <wiki:Permission permission="editProfile">
- <div class="formcontainer">
- <div class="instructions">
- <wiki:UserProfile property="new">
- <fmt:message key="prefs.newprofile"/>
- </wiki:UserProfile>
- <wiki:UserProfile property="exists">
- <fmt:message key="prefs.oldprofile"/>
- </wiki:UserProfile>
- </div>
- <stripes:form id="saveProfile" action="/UserProfile.action" method="POST" acceptcharset="UTF-8">
-
- <!-- Any errors? -->
- <stripes:errors/>
-
- <!-- Login name -->
- <div class="block">
- <stripes:label for="loginName"/>
- <wiki:UserProfile property="new">
- <stripes:text name="loginName" size="30" value="${this.loginName}"/>
- <div class="description">
- <fmt:message key="prefs.loginname.description"/>
- </div>
- </wiki:UserProfile>
- <wiki:UserProfile property="exists">
- <p><wiki:UserProfile property="loginname"/></p>
- <div class="description">
- <fmt:message key="prefs.loginname.exists"/>
- </div>
- </wiki:UserProfile>
- </div>
-
- <!-- Password; not displayed if container auth used -->
- <wiki:UserCheck status="setPassword">
- <div class="block">
- <stripes:label for="password"/>
- <stripes:password name="password" size="30" value="" />
- <div class="description">
- <fmt:message key="prefs.password.description"/>
- </div>
- </div>
-
- <div class="block">
- <stripes:label for="passwordAgain"/>
- <stripes:password name="passwordAgain" size="30" value="" />
- <div class="description">
- <fmt:message key="prefs.password2.description"/>
- </div>
- </div>
- </wiki:UserCheck>
-
- <!-- Full name -->
- <div class="block">
- <stripes:label for="fullName"/>
- <wiki:UserProfile property="new">
- <stripes:text name="fullName" size="30" value="${this.fullName}" />
- <div class="description">
- <fmt:message key="prefs.fullname.description"/>
- </div>
- </wiki:UserProfile>
- <wiki:UserProfile property="exists">
- <p><wiki:UserProfile property="fullname"/></p>
- <div class="description">
- <fmt:message key="prefs.fullname.exists"/>
- </div>
- </wiki:UserProfile>
- </div>
-
- <!-- E-mail -->
- <div class="block">
- <stripes:label for="email"/>
- <stripes:text name="email" size="30" value="${this.email}" />
- <div class="description">
- <fmt:message key="prefs.email.description"/>
- </div>
- </div>
-
- <div class="block">
- <wiki:UserCheck status="assertionsAllowed">
- <div class="instructions">
- <fmt:message key="prefs.cookie.info"/>
- </div>
- </wiki:UserCheck>
- <wiki:UserProfile property="exists">
- <div class="instructions">
- <fmt:message key="prefs.acl.info">
- <fmt:param><strong><wiki:UserProfile property="wikiname"/></strong></fmt:param>
- <fmt:param><strong><wiki:UserProfile property="fullname"/></strong></fmt:param>
- <fmt:param><strong><wiki:UserProfile property="roles" /></strong></fmt:param>
- <fmt:param><strong><wiki:UserProfile property="groups" /></strong></fmt:param>
- </fmt:message>
- </div>
- </wiki:UserProfile>
- <div class="instructions">
- <wiki:UserProfile property="exists">
- <fmt:message key="prefs.lastmodified">
- <fmt:param><wiki:UserProfile property="created"/></fmt:param>
- <fmt:param><wiki:UserProfile property="modified"/></fmt:param>
- </fmt:message>
- </wiki:UserProfile>
- <fmt:message key="prefs.save.description"/>
- </div>
- <stripes:hidden name="tab" value="profile" />
- <stripes:submit name="ok" />
- </div>
- </stripes:form>
- </div>
- </wiki:Permission>
- </wiki:Tab>
- </wiki:TabbedSection>
-
- </stripes:layout-component>
-</stripes:layout-render>
+<stripes:layout-component name="contents">
+ <wiki:Include page="/WEB-INF/jsp/templates/default/PreferencesContent.jsp" />
+</stripes:layout-component>
+</stripes:layout-render>
\ No newline at end of file
Added: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/GroupTab.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/GroupTab.jsp?rev=643690&view=auto
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/GroupTab.jsp (added)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/GroupTab.jsp Tue Apr 1 19:35:04 2008
@@ -0,0 +1,159 @@
+<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
+<%@ page import="java.security.Principal" %>
+<%@ page import="java.text.MessageFormat" %>
+<%@ page import="java.util.*" %>
+<%@ page import="com.ecyrd.jspwiki.WikiContext" %>
+<%@ page import="com.ecyrd.jspwiki.auth.*" %>
+<%@ page import="com.ecyrd.jspwiki.auth.PrincipalComparator" %>
+<%@ page import="com.ecyrd.jspwiki.auth.authorize.Group" %>
+<%@ page import="com.ecyrd.jspwiki.auth.authorize.GroupManager" %>
+<%@ page import="org.apache.log4j.*" %>
+<%@ page errorPage="/Error.jsp" %>
+<%@ page import="javax.servlet.jsp.jstl.fmt.*" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%!
+ String printWikiGroupPutGroup( Group group, String name, boolean cursor, PageContext pageContext)
+ {
+ Principal[] m = group.members();
+ java.util.Arrays.sort( m, new PrincipalComparator() );
+
+ String delim = "\", \"";
+
+ StringBuffer ss = new StringBuffer();
+ MessageFormat mf = null;
+ Object[] args = null;
+
+ ss.append( "WikiGroup.putGroup( \"" );
+
+ ss.append( name );
+ ss.append( delim );
+
+ for( int j=0; j < m.length; j++ ) { ss.append( m[j].getName().trim()+"\\n" ); }
+
+ ss.append( delim );
+ mf = new MessageFormat(LocaleSupport.getLocalizedMessage(pageContext, "grp.createdon") );
+ args = new Object[]{(group.getCreated()==null) ? "" : group.getCreated().toString(), group.getCreator()};
+ ss.append( mf.format( args ) );
+
+ mf = new MessageFormat(LocaleSupport.getLocalizedMessage(pageContext, "grp.lastmodified") );
+ args = new Object[]{(group.getCreated()==null) ? "" : group.getCreated().toString(), group.getModifier()};
+ ss.append( mf.format( args ) );
+
+ ss.append( "\", " );
+ ss.append( ( cursor ) ? "true" : "false" );
+
+ ss.append( ");\n" );
+
+
+ return ss.toString();
+ }
+%>
+
+<wiki:Messages div="error" topic="<%=GroupManager.MESSAGES_KEY%>" prefix='<%=LocaleSupport.getLocalizedMessage(pageContext,"group.errorprefix")%>'/>
+
+<table id='wikigroups' class='wikitable' >
+<tr>
+ <th><fmt:message key="group.name" /></th>
+ <th><fmt:message key="group.members" /></th>
+</tr>
+<tr>
+ <td id="groupnames" rowspan="2">
+ <div id="grouptemplate"
+ style="display:none; "
+ title='<fmt:message key="grp.groupnames.title"/>'
+ onclick="WikiGroup.toggle(); WikiGroup.onMouseOverGroup(this);"
+ onmouseover="WikiGroup.onMouseOverGroup(this);" ></div>
+
+ <wiki:Permission permission="createGroups">
+ <div id="groupfield"
+ onmouseover="WikiGroup.onMouseOverGroup(this);" >
+ <input type="text" size="30"
+ id="newgroup"
+ value='<fmt:message key="grp.newgroupname"/>'
+ onblur="if( this.value == '' ) { this.value = this.defaultValue; }; "
+ onfocus="if( this.value == this.defaultValue ) { this.value = ''; WikiGroup.onClickNew(); }; "/>
+ </div>
+ </wiki:Permission>
+ </td>
+ <td id="groupmembers">
+ <div style="float:left;">
+ <textarea rows="8" cols="30" disabled="disabled"
+ name="membersfield" id="membersfield" ></textarea>
+ </div>
+ <form action="<wiki:Link format='url' jsp='Group.jsp'/>"
+ id="groupForm"
+ method="post" accept-charset="<wiki:ContentEncoding />" >
+ <div>
+ <input type="hidden" name="group" value="" />
+ <input type="hidden" name="members" value="" />
+ <input type="hidden" name="action" value="save" />
+ <input type="button" disabled="disabled"
+ name="saveButton" id="saveButton"
+ value='<fmt:message key="grp.savegroup"/>'
+ onclick="WikiGroup.onSubmit( this.form, '<wiki:Link format='url' jsp='EditGroup.jsp' />' );" /></div>
+
+ <wiki:Permission permission="createGroups">
+ <div>
+ <input type="button" disabled="disabled"
+ name="createButton" id="createButton"
+ value='<fmt:message key="grp.savenewgroup"/>'
+ style="display:none; "
+ onclick="WikiGroup.onSubmitNew( this.form, '<wiki:Link format='url' jsp='NewGroup.jsp' />' );" /></div>
+ </wiki:Permission>
+
+ <div>
+ <input type="button" disabled="disabled"
+ name="cancelButton" id="cancelButton"
+ value='<fmt:message key="grp.cancel"/>'
+ onclick="WikiGroup.toggle();" /></div>
+
+ <wiki:Permission permission="deleteGroup">
+ <div>
+ <input type="button" disabled="disabled"
+ name="deleteButton" id="deleteButton"
+ value='<fmt:message key="grp.deletegroup"/>'
+ onclick="confirm( '<fmt:message key="grp.deletegroup.confirm"/>' )
+ && WikiGroup.onSubmit( this.form, '<wiki:Link format='url' jsp='DeleteGroup.jsp' />' );" /></div>
+ </wiki:Permission>
+ </form>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <div class="formhelp"><fmt:message key="grp.formhelp"/></div>
+ <p id="groupinfo" class="formhelp"></p>
+ </td>
+ </tr>
+</table>
+
+<h3><fmt:message key="grp.allgroups"/></h3>
+<p><wiki:Translate>[{Groups}]</wiki:Translate></p>
+
+
+<%
+ String groupname = request.getParameter( "group" );
+%>
+
+<script type="text/javascript">
+//<![CDATA[
+<%
+ WikiContext c = WikiContext.findContext( pageContext );
+ Principal[] roles = c.getWikiSession().getRoles();
+
+ for( int i = 0; i < roles.length; i++ )
+ {
+ if ( roles[i] instanceof GroupPrincipal ) /* bugfix */
+ {
+ String name = roles[i].getName();
+ Group group = c.getEngine().getGroupManager().getGroup( name );
+
+ %><%= printWikiGroupPutGroup( group, name, name.equals( groupname ), pageContext ) %><%
+ }
+ }
+%>
+//]]>
+</script>
+
+<%--
+WikiGroup.putGroup( "Group1qsdf qsdf qsdf qsdf qsdffsdfq en nog een beetje langer he", "Member1\nMember2\nMember3\nMember4\nMember5\nMember6", "createdon", "createdby", "changedon", "changedby" );
+--%>
Added: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/PreferencesContent.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/PreferencesContent.jsp?rev=643690&view=auto
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/PreferencesContent.jsp (added)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/PreferencesContent.jsp Tue Apr 1 19:35:04 2008
@@ -0,0 +1,29 @@
+<%@ page import="javax.servlet.jsp.jstl.fmt.*" %>
+<%@ page import="com.ecyrd.jspwiki.ui.*" %>
+<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%
+ TemplateManager.addResourceRequest( pageContext.getAttribute("wikiActionBean"), "script", "scripts/jspwiki-prefs.js" );
+%>
+
+<wiki:TabbedSection defaultTab="${param.tab}">
+
+ <wiki:Tab id="prefs" title='<%=LocaleSupport.getLocalizedMessage(pageContext, "prefs.tab.prefs")%>' accesskey="p" >
+ <wiki:Include page="PreferencesTab.jsp" />
+ </wiki:Tab>
+
+ <wiki:UserCheck status="authenticated">
+ <wiki:Permission permission="editProfile">
+ <wiki:Tab id="profile" title='<%=LocaleSupport.getLocalizedMessage(pageContext, "prefs.tab.profile")%>' accesskey="o" >
+ <wiki:Include page="ProfileTab.jsp" />
+ </wiki:Tab>
+ </wiki:Permission>
+ </wiki:UserCheck>
+
+ <wiki:Permission permission="createGroups"> <!-- FIXME check right permissions -->
+ <wiki:Tab id="group" title='<%=LocaleSupport.getLocalizedMessage(pageContext, "group.tab")%>' accesskey="g" >
+ <wiki:Include page="GroupTab.jsp" />
+ </wiki:Tab>
+ </wiki:Permission>
+
+</wiki:TabbedSection>
\ No newline at end of file
Added: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/PreferencesTab.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/PreferencesTab.jsp?rev=643690&view=auto
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/PreferencesTab.jsp (added)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/PreferencesTab.jsp Tue Apr 1 19:35:04 2008
@@ -0,0 +1,271 @@
+<%@ page errorPage="/Error.jsp" %>
+<%@ page import="java.util.*" %>
+<%@ page import="com.ecyrd.jspwiki.*" %>
+<%@ page import="com.ecyrd.jspwiki.ui.*" %>
+<%@ page import="com.ecyrd.jspwiki.preferences.*" %>
+<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%@ page import="javax.servlet.jsp.jstl.fmt.*" %>
+<%
+ /* see commonheader.jsp */
+ String prefDateFormat = Preferences.getPreference(pageContext,"DateFormat");
+ String prefTimeZone = Preferences.getPreference(pageContext,"TimeZone");
+
+ WikiContext c = WikiContext.findContext( pageContext );
+ pageContext.setAttribute( "skins", c.getEngine().getTemplateManager().listSkins(pageContext, c.getTemplate() ) );
+%>
+
+<h3><fmt:message key="prefs.heading"><fmt:param><wiki:Variable var="applicationname"/></fmt:param></fmt:message></h3>
+
+<c:if test="${param.tab eq 'prefs'}" >
+ <div class="formhelp">
+ <wiki:Messages div="error" topic="prefs" prefix='<%=LocaleSupport.getLocalizedMessage(pageContext,"prefs.errorprefix.prefs")%>'/>
+ </div>
+</c:if>
+
+<stripes:form action="/UserPreferences.action"
+ class="wikiform"
+ id="createAssertedName"
+ method="POST" accept-charset="<wiki:ContentEncoding />"
+ onsubmit="Wiki.savePrefs(); return Wiki.submitOnce(this);" >
+ <stripes:hidden name="tab" value="prefs" />
+<table>
+
+ <tr>
+ <td><stripes:label for="assertedName" name="prefs.assertedname"/></td>
+ <td>
+ <stripes:text id="assertedName" name="assertedName" size="20" value="<wiki:UserProfile property='wikiname' />" />
+ <%-- CHECK THIS
+ <stripes:text id="assertedName" name="assertedName" size="20" value="<wiki:UserProfile property='loginname'/>" />
+ --%>
+ </td>
+ </tr>
+ <wiki:UserCheck status="anonymous">
+ <tr>
+ <td> </td>
+ <td>
+ <div class="formhelp">
+ <fmt:message key="prefs.assertedname.description">
+ <fmt:param><wiki:Variable var="applicationname" /></fmt:param>
+ <fmt:param>
+ <a href="<wiki:Link jsp='Login.jsp' format='url'><wiki:Param name='tab' value='register'/></wiki:Link>">
+ <fmt:message key="prefs.assertedname.create"/>
+ </a>
+ </fmt:param>
+ </fmt:message>
+ </div>
+ </td>
+ </tr>
+ </wiki:UserCheck>
+
+ <tr>
+ <td><stripes:label for="editor name="edit.chooseeditor"/></td>
+ <td>
+ <select id="editor" name="editor">
+ <wiki:EditorIterator id="edt">
+ <option <%=edt.isSelected()%> value="<%=edt.getName()%>"><%=edt.getName()%></option>
+ </wiki:EditorIterator>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><stripes:label for="prefSkin" name="prefs.user.skin"/></td>
+ <td>
+ <select id="prefSkin" name="prefSkin">
+ <c:forEach items="${skins}" var="i">
+ <option value='<c:out value='${i}'/>' <c:if test='${i == prefs["SkinName"]}'>selected="selected"</c:if> ><c:out value="${i}"/></option>
+ </c:forEach>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><stripes:label for="prefOrientation name="prefs.user.orientation"/></td>
+ <td>
+ <select id="prefOrientation" name="prefOrientation" onchange="Wiki.changeOrientation();">
+ <option value='fav-left' <c:if test='${"fav-left" == prefs["orientation"]}'>selected="selected"</c:if> ><fmt:message key="prefs.user.orientation.left"/></option>
+ <option value='fav-right' <c:if test='${"fav-right" == prefs["orientation"]}'>selected="selected"</c:if> ><fmt:message key="prefs.user.orientation.right"/></option>
+ <%--
+ <option value='fav-hidden' <c:if test='${"fav-hidden" == prefs["orientation"]}'>selected="selected"</c:if> ><fmt:message key="prefs.user.fav-hide"/></option>
+ --%>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><stripes:label for="prefTimeFormat" name="prefs.user.timeformat"/></td>
+ <td>
+ <select id="prefTimeFormat" name="prefTimeFormat" >
+ <%
+ Properties props = c.getEngine().getWikiProperties();
+ ArrayList tfArr = new ArrayList(40);
+
+ /* filter timeformat props */
+ for( Enumeration e = props.propertyNames(); e.hasMoreElements(); )
+ {
+ String name = (String) e.nextElement();
+ if( name.startsWith( "jspwiki.defaultprefs.timeformat." ) )
+ {
+ tfArr.add(name);
+ }
+ }
+
+ /* fetch actual formats */
+ if( tfArr.size() == 0 )
+ {
+ tfArr.add( "dd-MMM-yy" );
+ tfArr.add( "d-MMM-yyyy" );
+ tfArr.add( "EEE, dd-MMM-yyyy, zzzz" );
+ } else {
+ Collections.sort( tfArr );
+ for( int i=0; i < tfArr.size(); i++ )
+ {
+ tfArr.set(i, props.getProperty( (String)tfArr.get(i) ) );
+ }
+ }
+
+ Date d = new Date() ; // Now.
+
+ for( int i=0; i < tfArr.size(); i++ )
+ {
+ String f = (String)tfArr.get(i);
+ String selected = ( prefDateFormat.equals( f ) ? " selected='selected'" : "" ) ;
+ try
+ {
+ java.text.SimpleDateFormat fmt = new java.text.SimpleDateFormat( f );
+ java.util.TimeZone tz = java.util.TimeZone.getDefault();
+ try
+ {
+ tz.setRawOffset( Integer.parseInt( prefTimeZone ) );
+ }
+ catch( Exception e) { /* dont care */ } ;
+ fmt.setTimeZone( tz );
+ %>
+ <option value="<%= f %>" <%= selected%> ><%= fmt.format(d) %></option>
+ <%
+ }
+ catch( IllegalArgumentException e ) { } // skip parameter
+ }
+ %>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><stripes:label for="prefTimeZone" name="prefs.user.timezone"/></td>
+ <td>
+ <select id='prefTimeZone' name='prefTimeZone' class='select'>
+ <%
+ String[][] tzs =
+ { { "-43200000" , "(UTC-12) Enitwetok, Kwajalien" }
+ , { "-39600000" , "(UTC-11) Nome, Midway Island, Samoa" }
+ , { "-36000000" , "(UTC-10) Hawaii" }
+ , { "-32400000" , "(UTC-9) Alaska" }
+ , { "-28800000" , "(UTC-8) Pacific Time" }
+ , { "-25200000" , "(UTC-7) Mountain Time" }
+ , { "-21600000" , "(UTC-6) Central Time, Mexico City" }
+ , { "-18000000" , "(UTC-5) Eastern Time, Bogota, Lima, Quito" }
+ , { "-14400000" , "(UTC-4) Atlantic Time, Caracas, La Paz" }
+ , { "-12600000" , "(UTC-3:30) Newfoundland" }
+ , { "-10800000" , "(UTC-3) Brazil, Buenos Aires, Georgetown, Falkland Is." }
+ , { "-7200000" , "(UTC-2) Mid-Atlantic, Ascention Is., St Helena" }
+ , { "-3600000" , "(UTC-1) Azores, Cape Verde Islands" }
+ , { "0" , "(UTC) Casablanca, Dublin, Edinburgh, London, Lisbon, Monrovia" }
+ , { "3600000" , "(UTC+1) Berlin, Brussels, Copenhagen, Madrid, Paris, Rome" }
+ , { "7200000" , "(UTC+2) Helsinki, Athens, Kaliningrad, South Africa, Warsaw" }
+ , { "10800000" , "(UTC+3) Baghdad, Riyadh, Moscow, Nairobi" }
+ , { "12600000" , "(UTC+3.30) Tehran" }
+ , { "14400000" , "(UTC+4) Adu Dhabi, Baku, Muscat, Tbilisi" }
+ , { "16200000" , "(UTC+4:30) Kabul" }
+ , { "18000000" , "(UTC+5) Islamabad, Karachi, Tashkent" }
+ , { "19800000" , "(UTC+5:30) Bombay, Calcutta, Madras, New Delhi" }
+ , { "21600000" , "(UTC+6) Almaty, Colomba, Dhakra" }
+ , { "25200000" , "(UTC+7) Bangkok, Hanoi, Jakarta" }
+ , { "28800000" , "(UTC+8) Beijing, Hong Kong, Perth, Singapore, Taipei" }
+ , { "32400000" , "(UTC+9) Osaka, Sapporo, Seoul, Tokyo, Yakutsk" }
+ , { "34200000" , "(UTC+9:30) Adelaide, Darwin" }
+ , { "36000000" , "(UTC+10) Melbourne, Papua New Guinea, Sydney, Vladivostok" }
+ , { "39600000" , "(UTC+11) Magadan, New Caledonia, Solomon Islands" }
+ , { "43200000" , "(UTC+12) Auckland, Wellington, Fiji, Marshall Island" }
+ };
+ String servertz = Integer.toString( java.util.TimeZone.getDefault().getRawOffset() ) ;
+ String selectedtz = servertz;
+ for( int i=0; i < tzs.length; i++ )
+ {
+ if( prefTimeZone.equals( tzs[i][0] ) ) selectedtz = prefTimeZone;
+ }
+ for( int i=0; i < tzs.length; i++ )
+ {
+ String selected = ( selectedtz.equals( tzs[i][0] ) ? " selected='selected'" : "" ) ;
+ String server = ( servertz.equals( tzs[i][0] ) ? " [SERVER]" : "" ) ;
+ %>
+ <option value="<%= tzs[i][0] %>" <%= selected%> ><%= tzs[i][1]+server %></option>
+ <%
+ }
+ %>
+ </select>
+ </td>
+ </tr>
+
+ <%-- user browser language only ; why not allow to choose from all installed server languages on jspwiki ??
+ <tr>
+ <td><stripes:label for="prefLanguage">Select Language</stripes:label></td>
+ <td>
+ <select id="prefLanguage" name="prefLanguage" >
+ <option value="">English</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><stripes:label for="prefShowQuickLinks">Show Quick Links</stripes:label></td>
+ <td>
+ <stripes:checkbox class='checkbox' id='prefShowQuickLinks' name='prefShowQuickLinks'
+ <%= (prefShowQuickLinks.equals("yes") ? "checked='checked'" : "") %> />
+ <span class="quicklinks"><span
+ class='quick2Top'><a href='#wikibody' title='Go to Top' >«</a></span><span
+ class='quick2Prev'><a href='#' title='Go to Previous Section'>‹</a></span><span
+ class='quick2Edit'><a href='#' title='Edit this section'>•</a></span><span
+ class='quick2Next'><a href='#' title='Go to Next Section'>›</a></span><span
+ class='quick2Bottom'><a href='#footer' title='Go to Bottom' >»</a></span></span>
+ </td>
+ </tr>
+
+ <tr>
+ <td><stripes:label for="prefShowCalendar">Show Calendar</stripes:label></td>
+ <td>
+ <input class='checkbox' type='checkbox' id='prefShowCalendar' name='prefShowCalendar'
+ <%= (prefShowCalendar.equals("yes") ? "checked='checked'": "") %> >
+ </td>
+ </tr>
+ --%>
+ <tr>
+ <td> </td>
+ <td>
+ <stripes:submit type="submit" name="ok" value="<fmt:message key='prefs.save.prefs.submit'/>"
+ accesskey="s" />
+ <input type="hidden" name="action" value="setAssertedName" />
+ <div class="formhelp"><fmt:message key='prefs.cookies'/></div>
+ </td>
+ </tr>
+
+</table>
+</stripes:form>
+
+<!-- Clearing the 'asserted name' and other prefs in the cookie -->
+<%--wiki:UserCheck status="asserted"--%>
+
+<h3><fmt:message key='prefs.clear.heading'/></h3>
+
+<stripes:form id="clearAssertedName" action="/UserPreferences.action"
+ onsubmit="Wiki.prefs.empty(); return Wiki.submitOnce( this );"
+ method="POST" accept-charset="<wiki:ContentEncoding />" >
+ <stripes:hidden name="tab" value="prefs" />
+ <div>
+ <stripes:submit name="prefs.clear.submit"/>
+ </div>
+ <div class="formhelp"><fmt:message key="prefs.clear.description" /></div>
+</stripes:form>
+<%--/wiki:UserCheck--%>
Added: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/ProfileTab.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/ProfileTab.jsp?rev=643690&view=auto
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/ProfileTab.jsp (added)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/webdocs-stripes/WEB-INF/jsp/templates/default/ProfileTab.jsp Tue Apr 1 19:35:04 2008
@@ -0,0 +1,148 @@
+<%@ 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="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%@ page import="javax.servlet.jsp.jstl.fmt.*" %>
+<%
+ /* dateformatting not yet supported by wiki:UserProfile tag - diy */
+ WikiContext wikiContext = WikiContext.findContext(pageContext);
+ UserManager manager = wikiContext.getEngine().getUserManager();
+ UserProfile profile = manager.getUserProfile( wikiContext.getWikiSession() );
+%>
+<form action="<wiki:CheckRequestContext
+ context='login'><wiki:Link jsp='Login.jsp' format='url'><wiki:Param name='tab'
+ value='profile'/></wiki:Link></wiki:CheckRequestContext><wiki:CheckRequestContext
+ context='prefs'><wiki:Link jsp='UserPreferences.jsp' format='url'><wiki:Param name='tab'
+ value='profile'/></wiki:Link></wiki:CheckRequestContext>"
+ id="editProfile"
+ class="wikiform"
+ onsubmit="return Wiki.submitOnce( this );"
+ method="post" accept-charset="UTF-8">
+
+ <h3>
+ <wiki:UserProfile property="exists"><fmt:message key="prefs.oldprofile"/></wiki:UserProfile>
+ <wiki:UserProfile property="new"><fmt:message key="prefs.newprofile"/></wiki:UserProfile>
+ </h3>
+
+ <c:if test="${param.tab eq 'profile'}" >
+ <div class="formhelp">
+ <wiki:Messages div="error" topic="profile" prefix='<%=LocaleSupport.getLocalizedMessage(pageContext,"prefs.errorprefix.profile")%>'/>
+ </div>
+ </c:if>
+
+ <table>
+
+ <!-- Login name -->
+ <tr>
+ <td><label for="loginname"><fmt:message key="prefs.loginname"/></label></td>
+ <td>
+ <wiki:UserProfile property="canChangeLoginName">
+ <input type="text" name="loginname" id="loginname"
+ size="20" value="<wiki:UserProfile property='loginname' />" />
+ </wiki:UserProfile>
+ <wiki:UserProfile property="!canChangeLoginName">
+ <!-- If user can't change their login name, it's because the container manages the login -->
+ <wiki:UserProfile property="new">
+ <div class="warning"><fmt:message key="prefs.loginname.cannotset.new"/></div>
+ </wiki:UserProfile>
+ <wiki:UserProfile property="exists">
+ <span class="formvalue"><wiki:UserProfile property="loginname"/></span>
+ <div class="warning"><fmt:message key="prefs.loginname.cannotset.exists"/></div>
+ </wiki:UserProfile>
+ </wiki:UserProfile>
+ </td>
+ </tr>
+
+ <!-- Password; not displayed if container auth used -->
+ <wiki:UserProfile property="canChangePassword">
+ <tr>
+ <td><label for="password"><fmt:message key="prefs.password"/></label></td>
+ <td>
+ <%--FIXME Enter Old PW to validate change flow, not yet treated by JSPWiki
+ <label for="password0">Old</label>
+ <input type="password" name="password0" id="password0" size="20" value="" />
+ --%>
+ <input type="password" name="password" id="password" size="20" value="" />
+ </td>
+ </tr>
+ <tr>
+ <td><label for="password2"><fmt:message key="prefs.password2"/></label></td>
+ <td>
+ <input type="password" name="password2" id="password2" size="20" value="" />
+ <%-- extra validation ? min size, allowed chars? --%>
+ </td>
+ </tr>
+ </wiki:UserProfile>
+
+ <!-- Full name -->
+ <tr>
+ <td><label for="fullname"><fmt:message key="prefs.fullname"/></label></td>
+ <td>
+ <input type="text" name="fullname" id="fullname"
+ size="20" value="<wiki:UserProfile property='fullname'/>" />
+ <span class="formhelp"><fmt:message key="prefs.fullname.description"/></span>
+ </td>
+ </tr>
+
+ <!-- E-mail -->
+ <tr>
+ <td><label for="email"><fmt:message key="prefs.email"/></label></td>
+ <td>
+ <input type="text" name="email" id="email"
+ size="20" value="<wiki:UserProfile property='email' />" />
+ <span class="formhelp"><fmt:message key="prefs.email.description"/></span>
+ </td>
+ </tr>
+
+ <wiki:UserProfile property="exists">
+ <tr class="additinfo">
+ <td><label><fmt:message key="prefs.roles"/></label></td>
+ <td><div class="formvalue"><wiki:UserProfile property="roles" /></div></td>
+ </tr>
+ <tr class="additinfo">
+ <td><label><fmt:message key="prefs.groups"/></label></td>
+ <td>
+ <%-- TODO this should become clickable group links so you can immediately go and look at them if you want --%>
+ <div class="formvalue"><wiki:UserProfile property="groups" /></div>
+ <div class="formhelp"><fmt:message key="prefs.acl.info" /></div>
+ </td>
+ </tr>
+
+ <tr class="additinfo">
+ <td><label><fmt:message key="prefs.creationdate"/></label></td>
+ <td class="formvalue">
+ <%--<wiki:UserProfile property="created"/>--%>
+ <fmt:formatDate value="<%= profile.getCreated() %>" pattern="${prefs['DateFormat']}" />
+ </td>
+ </tr>
+ <tr class="additinfo">
+ <td><label><fmt:message key="prefs.profile.lastmodified"/></label></td>
+ <td class="formvalue">
+ <%--<wiki:UserProfile property="modified"/>--%>
+ <fmt:formatDate value="<%= profile.getLastModified() %>" pattern="${prefs['DateFormat']}" />
+ </td>
+ </tr>
+ </wiki:UserProfile>
+
+ <tr>
+ <td> </td>
+ <td>
+ <wiki:UserProfile property="exists">
+ <input type="submit" name="ok" value="<fmt:message key='prefs.save.submit' />" />
+ </wiki:UserProfile>
+ <wiki:UserProfile property="new">
+ <input type="submit" name="ok" value="<fmt:message key='prefs.save.submit' />" />
+ </wiki:UserProfile>
+ <input type="hidden" name="redirect" value="<wiki:Variable var='redirect' default='' />" />
+ <input type="hidden" name="action" value="saveProfile" />
+
+ <wiki:UserCheck status="assertionsAllowed">
+ <div class="formhelp"><fmt:message key="prefs.cookie.info"/></div>
+ </wiki:UserCheck>
+ </td>
+ </tr>
+ </table>
+</form>