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 2010/01/30 16:39:45 UTC
svn commit: r904799 - in /incubator/jspwiki/trunk: src/WebContent/
src/WebContent/templates/default/ src/java/org/apache/wiki/action/
tests/java/org/apache/wiki/action/ tests/java/org/apache/wiki/ui/stripes/
Author: ajaquith
Date: Sat Jan 30 15:39:44 2010
New Revision: 904799
URL: http://svn.apache.org/viewvc?rev=904799&view=rev
Log:
[JSPWIKI-578] Eliminated top-level JSPs for Wiki.jsp, PageInfo.jsp, Diff.jsp, Delete.jsp and Attachments.jsp. The relevant ActionBeans are still bound to these URLs except PageInfo.jsp, but there are no longer physical JSPs for these top-level paths. The template JSPs in /templates/default now contain all of the formatting and markup and are mostly HTML and JSTL. At the moment, ActionBeans all forward to to hard-wired template JSP paths in /templates/default. A "TemplateResolution" class that makes forwards dynamic based on the current template will come a little later.
Added:
incubator/jspwiki/trunk/src/WebContent/templates/default/AttachmentInfo.jsp
incubator/jspwiki/trunk/src/WebContent/templates/default/Attachments.jsp
incubator/jspwiki/trunk/src/WebContent/templates/default/PageInfo.jsp
incubator/jspwiki/trunk/src/WebContent/templates/default/Wiki.jsp
Removed:
incubator/jspwiki/trunk/src/WebContent/Attachments.jsp
incubator/jspwiki/trunk/src/WebContent/Delete.jsp
incubator/jspwiki/trunk/src/WebContent/Diff.jsp
incubator/jspwiki/trunk/src/WebContent/PageInfo.jsp
incubator/jspwiki/trunk/src/WebContent/Wiki.jsp
incubator/jspwiki/trunk/src/WebContent/templates/default/AttachmentInfoTab.jsp
incubator/jspwiki/trunk/src/WebContent/templates/default/AttachmentTab.jsp
incubator/jspwiki/trunk/src/WebContent/templates/default/PageContent.jsp
incubator/jspwiki/trunk/src/WebContent/templates/default/PageInfoTab.jsp
incubator/jspwiki/trunk/src/WebContent/templates/default/PageTab.jsp
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/DiffActionBean.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ViewActionBean.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/DiffActionBeanTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/EditActionBeanTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/GroupActionBeanTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/LoginActionBeanTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/RenameActionBeanTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserPreferencesActionBeanTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserProfileActionBeanTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/ViewActionBeanTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/ui/stripes/ShortUrlRedirectFilterTest.java
Added: incubator/jspwiki/trunk/src/WebContent/templates/default/AttachmentInfo.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/WebContent/templates/default/AttachmentInfo.jsp?rev=904799&view=auto
==============================================================================
--- incubator/jspwiki/trunk/src/WebContent/templates/default/AttachmentInfo.jsp (added)
+++ incubator/jspwiki/trunk/src/WebContent/templates/default/AttachmentInfo.jsp Sat Jan 30 15:39:44 2010
@@ -0,0 +1,199 @@
+<%--
+ JSPWiki - a JSP-based WikiWiki clone.
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+--%>
+<%@ taglib uri="http://jakarta.apache.org/jspwiki.tld" prefix="wiki" %>
+<%@ page import="org.apache.wiki.*" %>
+<%@ page import="org.apache.wiki.attachment.*" %>
+<%@ page import="org.apache.wiki.i18n.InternationalizationManager" %>
+<%@ page import="javax.servlet.jsp.jstl.fmt.*" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://stripes.sourceforge.net/stripes.tld" prefix="s" %>
+<%@ page import="org.apache.wiki.action.WikiContextFactory" %>
+<%@ page import="org.apache.wiki.util.TextUtil" %>
+<%@ page import="org.apache.wiki.api.WikiPage" %>
+<%@ page import="org.apache.wiki.content.jcr.JCRWikiPage" %>
+<%@ page import="java.text.SimpleDateFormat" %>
+<%
+ WikiContext c = WikiContextFactory.findContext( pageContext );
+ WikiPage wikiPage = c.getPage();
+ String creationAuthor ="";
+
+ //FIXME -- seems not to work correctly for attachments !!
+ WikiPage firstPage = c.getEngine().getPage( wikiPage.getName(), 1 );
+ if( firstPage != null )
+ {
+ creationAuthor = firstPage.getAuthor();
+
+ if( creationAuthor != null && creationAuthor.length() > 0 )
+ {
+ creationAuthor = TextUtil.replaceEntities(creationAuthor);
+ }
+ else
+ {
+ creationAuthor = c.getBundle( InternationalizationManager.CORE_BUNDLE ).getString( "common.unknownauthor" );
+ }
+ }
+
+ int itemcount = 0; //number of page versions
+ try
+ {
+ itemcount = wikiPage.getVersion(); /* highest version */
+ }
+ catch( Exception e ) { /* dont care */ }
+
+ int pagesize = 20;
+ int startitem = itemcount-1; /* itemcount==1-20 -> startitem=0-19 ... */
+
+ String parm_start = request.getParameter( "start" );
+ if( parm_start != null ) startitem = Integer.parseInt( parm_start ) ;
+
+ /* round to start of block: 0-19 becomes 0; 20-39 becomes 20 ... */
+ if( startitem > -1 ) startitem = ((startitem)/pagesize) * pagesize;
+
+ /* startitem drives the pagination logic */
+ /* startitem=-1:show all; startitem=0:show block 1-20; startitem=20:block 21-40 ... */
+%>
+<%
+ int MAXATTACHNAMELENGTH = 30;
+ String progressId = c.getEngine().getProgressManager().getNewProgressIdentifier();
+
+ int attCount = c.getEngine().getAttachmentManager().listAttachments(c.getPage()).size();
+ String attTitle = LocaleSupport.getLocalizedMessage(pageContext, "attach.tab");
+ if( attCount != 0 ) attTitle += " (" + attCount + ")";
+%>
+<wiki:TabbedSection defaultTab="info">
+
+ <wiki:Tab id="pagecontent" titleKey="view.tab" accesskey="v" url="Wiki.jsp?page=${wikiActionBean.page.name}"/>
+
+ <wiki:Tab id="attach" title="<%= attTitle %>" accesskey="a" url="Attachments.jsp?page=${wikiActionBean.page.name}" />
+
+ <wiki:Tab id="info" titleKey="info.tab" accesskey="i">
+ <h3><fmt:message key="info.uploadnew" /></h3>
+ <wiki:Permission permission="upload">
+ <form action="<wiki:Link jsp='attach' format='url' absolute='true'><wiki:Param name='progressid' value='<%=progressId%>'/></wiki:Link>"
+ class="wikiform"
+ id="uploadform"
+ onsubmit="return Wiki.submitUpload(this, '<%=progressId%>');"
+ method="post" accept-charset="<wiki:ContentEncoding/>"
+ enctype="multipart/form-data" >
+
+ <%-- Do NOT change the order of wikiname and content, otherwise the
+ servlet won't find its parts. --%>
+
+ <table>
+ <tr>
+ <td colspan="2"><div class="formhelp"><fmt:message key="info.uploadnew.help" /></div></td>
+ </tr>
+ <tr>
+ <td><label for="content"><fmt:message key="info.uploadnew.filename" /></label></td>
+ <td><input type="file" name="content" size="60" /></td>
+ </tr>
+ <tr>
+ <td><label for="changenote"><fmt:message key="info.uploadnew.changenote" /></label></td>
+ <td>
+ <input type="text" name="changenote" maxlength="80" size="60" />
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="hidden" name="page" value="<wiki:Variable var='pagename' />" />
+ <input type="submit" name="upload" value="<fmt:message key='attach.add.submit' />" id="upload" /> <input type="hidden" name="action" value="upload" />
+ <input type="hidden" name="nextpage" value="<wiki:PageInfoLink format='url' />" />
+ <div id="progressbar"><div class="ajaxprogress"></div></div>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </wiki:Permission>
+
+ <wiki:Permission permission="delete">
+ <h3><fmt:message key="info.deleteattachment"/></h3>
+ <s:form beanclass="org.apache.wiki.action.ViewActionBean" class="wikiform" id="deleteForm" method="post" acceptcharset="UTF-8">
+ <div>
+ <s:submit name="deleteAttachment" id="delete-all" />
+ </div>
+ </s:form>
+ </wiki:Permission>
+
+ <%-- FIXME why not add pagination here - no need for large amounts of attach versions on one page --%>
+ <h3><fmt:message key='info.attachment.history' /></h3>
+ <div class="zebra-table">
+ <div class="slimbox-img sortable">
+ <table class="wikitable">
+ <tr>
+ <th><fmt:message key="info.attachment.type" /></th>
+ <%--<th><fmt:message key="info.attachment.name"/></th>--%>
+ <th><fmt:message key="info.version" /></th>
+ <th><fmt:message key="info.size" /></th>
+ <th><fmt:message key="info.date" /></th>
+ <th><fmt:message key="info.author" /></th>
+ <th class='changenote'><fmt:message key="info.changenote" /></th>
+ </tr>
+
+ <wiki:HistoryIterator id="att"><%-- <wiki:AttachmentsIterator id="att"> --%>
+ <%
+ String name = att.getName(); //att.getFileName();
+ String sname = name;
+ if( sname.length() > MAXATTACHNAMELENGTH ) sname = sname.substring(0,MAXATTACHNAMELENGTH) + "...";
+
+ String mimetype = att.getContentType().replace('/','-');
+
+ java.util.Date modified = new SimpleDateFormat(JCRWikiPage.DATEFORMAT_ISO8601_2000).parse(att.getAttribute(JCRWikiPage.ATTR_CREATED).toString());
+
+ %>
+ <tr>
+ <%-- The 'title' attribute is used to sort empty cells --%>
+ <td title="<%= att.getContentType() %>"><div class="mime <%= mimetype %>" /></td>
+ <td>
+ <a href="<wiki:Link version='<%=Integer.toString(att.getVersion())%>' format='url' />" title="<%= name %>" class="attachment"><wiki:PageVersion /></a>
+ </td>
+ <td style="white-space:nowrap;text-align:right;">
+ <fmt:formatNumber value='<%=Double.toString(att.getSize()/1000.0)%>' maxFractionDigits='1' minFractionDigits='1' /> <fmt:message key="info.kilobytes" />
+ </td>
+ <td style="xwhite-space:nowrap;" jspwiki:sortvalue="<%= modified.getTime() %>">
+ <fmt:formatDate value="<%= modified %>" pattern="${prefs.TimeFormat}" timeZone="${prefs.TimeZone}" />
+ </td>
+ <td style="white-space:nowrap;" ><wiki:Author/></td>
+ <%--
+ <wiki:Permission permission="delete">
+ <td>
+ <input type="button" value="<fmt:message key='attach.delete' />" src="<wiki:Link format='url' context='<%=WikiContext.DELETE%>' />" onclick="$('deleteForm').setProperty('action',this.src); $('delete-all').click();" />
+ </td>
+ </wiki:Permission>
+ --%>
+ <td class="changenote">
+<%
+ //FIXME: should probably also become a JCRWikiPage attriute.
+ String changeNote = TextUtil.replaceEntities((String)att.getAttribute(WikiPage.CHANGENOTE));
+ if( changeNote != null ) {
+ %><%=changeNote%><%
+ }
+%>
+ </td>
+ </tr>
+ </wiki:HistoryIterator>
+ </table>
+ </div>
+ </div>
+ </wiki:Tab>
+
+</wiki:TabbedSection>
Added: incubator/jspwiki/trunk/src/WebContent/templates/default/Attachments.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/WebContent/templates/default/Attachments.jsp?rev=904799&view=auto
==============================================================================
--- incubator/jspwiki/trunk/src/WebContent/templates/default/Attachments.jsp (added)
+++ incubator/jspwiki/trunk/src/WebContent/templates/default/Attachments.jsp Sat Jan 30 15:39:44 2010
@@ -0,0 +1,158 @@
+<%--
+ JSPWiki - a JSP-based WikiWiki clone.
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+--%>
+<%@ 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://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ taglib uri="http://jakarta.apache.org/jspwiki.tld" prefix="wiki" %>
+<%@ taglib uri="http://stripes.sourceforge.net/stripes.tld" prefix="s" %>
+<%@ page errorPage="/Error.jsp" %>
+<s:layout-render name="${templates['DefaultLayout.jsp']}">
+ <s:layout-component name="content">
+ <wiki:TabbedSection defaultTab="attach">
+
+ <wiki:NoSuchPage>
+ <wiki:Tab id="attach" titleKey="view.tab" accesskey="v">
+ <fmt:message key="common.nopage">
+ <fmt:param><wiki:EditLink><fmt:message key="common.createit" /></wiki:EditLink></fmt:param>
+ </fmt:message>
+ </wiki:Tab>
+ </wiki:NoSuchPage>
+
+ <wiki:PageExists>
+
+ <%-- Content tab --%>
+ <wiki:Tab id="pagecontent" titleKey="view.tab" accesskey="v" beanclass="org.apache.wiki.action.ViewActionBean" event="view">
+ <wiki:Param name="page" value="${wikiActionBean.page.name}" />
+ </wiki:Tab>
+
+ <%-- Attachments tab --%>
+ <wiki:Tab id="attach" accesskey="a"
+ title="${wiki:attachmentsTitle(request.Locale, wikiActionBean.attachments)}">
+ <%-- Add new attachments --%>
+ <div id="addattachment">
+ <h3><fmt:message key="attach.add" /></h3>
+ <wiki:Permission permission="upload">
+ <s:form beanclass="org.apache.wiki.action.AttachmentActionBean" class="wikiform" id="uploadform" acceptcharset="UTF-8">
+ <s:param name="progressid" value="${wikiEngine.progressManager.newProgressIdentifier}" />
+ <s:param name="page" value="${wikiActionBean.page.name}" />
+ <table>
+ <tr>
+ <td colspan="2"><div class="formhelp"><fmt:message key="attach.add.info" /></div></td>
+ </tr>
+ <tr>
+ <td colspan="2"><s:errors field="newAttachments" /></td>
+ </tr>
+ <tr>
+ <td><s:label for="attachfile0" name="attach.add.selectfile" /></td>
+ <td><s:file name="newAttachments[0]" id="attachfile0" /><br/>
+ <s:file name="newAttachments[1]" id="attachfile1" /><br/>
+ <s:file name="newAttachments[2]" id="attachfile2" /></td>
+ </tr>
+ <tr>
+ <td><s:label for="attachnote" name="attach.add.changenote" /></td>
+ <td><s:text name="changenote" id="attachnote" maxlength="80" size="60" /></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <s:submit name="upload" id="upload" />
+ <div id="progressbar"><div class="ajaxprogress"></div></div>
+ </td>
+ </tr>
+ </table>
+ </s:form>
+ </wiki:Permission>
+ </div>
+
+ <%-- Show existing attachments --%>
+ <wiki:HasAttachments>
+ <h3><fmt:message key="attach.list" /></h3>
+ <wiki:Permission permission="delete">
+ <%-- hidden delete form --%>
+ </wiki:Permission>
+ <div class="zebra-table">
+ <div class="slimbox-img sortable">
+ <table class="wikitable">
+ <tr>
+ <th><fmt:message key="info.attachment.type" /></th>
+ <th><fmt:message key="info.attachment.name" /></th>
+ <th><fmt:message key="info.size" /></th>
+ <th><fmt:message key="info.version" /></th>
+ <th><fmt:message key="info.date" /></th>
+ <th><fmt:message key="info.author" /></th>
+ <wiki:Permission permission="delete"><th><fmt:message key="info.actions" /></th></wiki:Permission>
+ <th class="changenote"><fmt:message key="info.changenote" /></th>
+ </tr>
+
+ <c:forEach var="att" items="${wikiActionBean.attachments}" >
+ <tr>
+ <%-- The 'title' attribute is used to sort empty cells --%>
+ <td title="${att.contentType}">
+ <div class="${fn:replace(att.contentType,'/','-')}"> </div>
+ </td>
+ <td title="${att.name}">
+ <s:link beanclass="org.apache.wiki.action.AttachmentActionBean" event="download">
+ <s:param name="page" value="${att.path}" />
+ ${wiki:shorten(att.name,30)}
+ </s:link>
+ </td>
+ <td style="white-space:nowrap;text-align:right;">
+ <fmt:formatNumber value="${att.size div 1000}" maxFractionDigits="1" minFractionDigits="1" /> <fmt:message key="info.kilobytes" />
+ </td>
+ <c:set var="attTitle"><fmt:message key="attach.moreinfo.title" /></c:set>
+ <td style="text-align:center;">
+ <s:link beanclass="org.apache.wiki.action.ViewActionBean" event="info" title="${attTitle}">
+ <s:param name="page" value="${att.path}" />
+ ${att.version}
+ </s:link>
+ </td>
+ <td jspwiki:sortvalue="${wiki:iso8601date(att.lastModified)}">
+ <fmt:formatDate value="${att.lastModified}" pattern="${prefs.TimeFormat}" timeZone="${prefs.TimeZone}" />
+ </td>
+ <td style="white-space:nowrap;" ><wiki:Author/></td>
+ <wiki:Permission permission="delete">
+ <td>
+ <s:form beanclass="org.apache.wiki.action.DeleteActionBean">
+ <s:param name="page" value="${att.path}" />
+ <s:submit name="delete"><fmt:message key="attach.delete" /></s:submit>
+ </s:form>
+ </td>
+ </wiki:Permission>
+ <td class="changenote"><c:out value="${att.changeNote}"/></td>
+ </tr>
+ </c:forEach>
+
+ </table>
+ </div>
+ </div>
+
+ </wiki:HasAttachments>
+ </wiki:Tab>
+
+ <%-- Info tab --%>
+ <wiki:Tab id="info" titleKey="info.tab" accesskey="i" beanclass="org.apache.wiki.action.ViewActionBean" event="info">
+ <wiki:Param name="page" value="${wikiActionBean.page.name}" />
+ </wiki:Tab>
+ </wiki:PageExists>
+
+ </wiki:TabbedSection>
+ </s:layout-component>
+</s:layout-render>
Added: incubator/jspwiki/trunk/src/WebContent/templates/default/PageInfo.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/WebContent/templates/default/PageInfo.jsp?rev=904799&view=auto
==============================================================================
--- incubator/jspwiki/trunk/src/WebContent/templates/default/PageInfo.jsp (added)
+++ incubator/jspwiki/trunk/src/WebContent/templates/default/PageInfo.jsp Sat Jan 30 15:39:44 2010
@@ -0,0 +1,190 @@
+<%--
+ JSPWiki - a JSP-based WikiWiki clone.
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+--%>
+<%@ 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://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ taglib uri="http://jakarta.apache.org/jspwiki.tld" prefix="wiki" %>
+<%@ taglib uri="http://stripes.sourceforge.net/stripes.tld" prefix="s" %>
+<s:layout-render name="${templates['DefaultLayout.jsp']}">
+ <s:layout-component name="content">
+ <wiki:TabbedSection defaultTab="info">
+ <wiki:NoSuchPage>
+ <wiki:Tab id="info" titleKey="info.tab" accesskey="i">
+ <fmt:message key="common.nopage">
+ <fmt:param><wiki:EditLink><fmt:message key="common.createit" /></wiki:EditLink></fmt:param>
+ </fmt:message>
+ </wiki:Tab>
+ </wiki:NoSuchPage>
+
+ <wiki:PageExists>
+
+ <%-- Content tab --%>
+ <wiki:Tab id="pagecontent" titleKey="view.tab" accesskey="v" beanclass="org.apache.wiki.action.ViewActionBean" event="view">
+ <wiki:Param name="page" value="${wikiActionBean.page.name}" />
+ </wiki:Tab>
+
+ <%-- Attachments tab --%>
+ <wiki:Tab id="attach" accesskey="a"
+ title="${wiki:attachmentsTitle(request.Locale, wikiActionBean.attachments)}"
+ beanclass="org.apache.wiki.action.ViewActionBean" event="attachments">
+ <wiki:Param name="page" value="${wikiActionBean.page.name}" />
+ </wiki:Tab>
+
+ <%-- Info tab --%>
+ <wiki:Tab id="info" titleKey="info.tab" accesskey="i">
+
+ <%-- Rename page --%>
+ <wiki:Permission permission="rename">
+ <s:form beanclass="org.apache.wiki.action.RenameActionBean" class="wikiform" id="renameform" method="post" acceptcharset="UTF-8" >
+ <p>
+ <s:hidden name="page" />
+ <s:submit name="rename" />
+ <s:text name="renameTo" size="40" />
+
+ <s:checkbox name="changeReferences" />
+ <fmt:message key="info.updatereferrers" />
+ </p>
+ </s:form>
+ </wiki:Permission>
+
+ <%-- Delete page --%>
+ <wiki:Permission permission="delete">
+ <s:form beanclass="org.apache.wiki.action.DeleteActionBean" class="wikiform" id="deleteForm" method="post" acceptcharset="UTF-8">
+ <p>
+ <s:hidden name="page" />
+ <s:submit name="delete" />
+ </p>
+ </s:form>
+ </wiki:Permission>
+
+ <%-- Referring pages --%>
+ <div class='line'>
+ <div class="collapsebox-closed unit size1of2" id="incomingLinks">
+ <h4><fmt:message key="info.tab.incoming" /></h4>
+ <wiki:Plugin plugin="ReferringPagesPlugin" args="before='*' after='\n' " />
+ </div>
+ <div class="collapsebox-closed lastUnit size1of2 " id="outgoingLinks">
+ <h4><fmt:message key="info.tab.outgoing" /></h4>
+ <wiki:Plugin plugin="ReferredPagesPlugin" args="depth='1' type='local'" />
+ </div>
+ </div>
+
+ <%-- Diff page versions --%>
+ <wiki:CheckRequestContext context="diff">
+ <s:form beanclass="org.apache.wiki.action.DiffActionBean" method="get" acceptcharset="UTF-8">
+ <div class="collapsebox" id="diffcontent">
+ <h4>
+ <s:hidden name="page" />
+ <fmt:message key="diff.difference">
+ <fmt:param>
+ <s:select id="r1" name="r1" value="${wikiActionBean.r1}" onchange="this.form.submit();">
+ <s:options-collection collection="${wikiActionBean.history}" value="version" label="version" />
+ </s:select>
+ </fmt:param>
+ <fmt:param>
+ <s:select id="r2" name="r2" value="${wikiActionBean.r2}" onchange="this.form.submit();">
+ <s:options-collection collection="${wikiActionBean.history}" value="version" label="version" />
+ </s:select>
+ </fmt:param>
+ </fmt:message>
+ </h4>
+ <c:if test='${diffprovider eq "ContextualDiffProvider"}'>
+ <div class="diffnote">
+ <a href="#change-1" title="<fmt:message key='diff.gotofirst.title' />" class="diff-nextprev">
+ <fmt:message key="diff.gotofirst" />
+ </a>»»
+ </div>
+ </c:if>
+ <div class="diffbody">
+ <wiki:InsertDiff><i><fmt:message key="diff.nodiff" /></i></wiki:InsertDiff>
+ </div>
+ </div>
+ </s:form>
+ </wiki:CheckRequestContext>
+
+ <%-- Previous versions --%>
+ <wiki:CheckVersion mode="notfirst">
+ <c:if test="${fn:length(wikiActionBean.history) > 1}">
+ <div class="zebra-table sortable">
+ <table class="wikitable">
+ <tr>
+ <th><fmt:message key="info.version" /></th>
+ <th><fmt:message key="info.date" /></th>
+ <th><fmt:message key="info.size" /></th>
+ <th><fmt:message key="info.author" /></th>
+ <th><fmt:message key="info.changes" /></th>
+ <th class='changenote'><fmt:message key="info.changenote" /></th>
+ </tr>
+ <c:forEach var="page" items="${wikiActionBean.history}">
+ <tr>
+ <td>
+ <s:link beanclass="org.apache.wiki.action.ViewActionBean" event="view">
+ <s:param name="page" value="${page.name}" />
+ <s:param name="version" value="${page.version}" />
+ ${page.version}
+ </s:link>
+ </td>
+
+ <td>
+ <fmt:formatDate value="${page.lastModified}" pattern="${prefs.TimeFormat}" timeZone="${prefs.TimeZone}" />
+ </td>
+
+ <td style="white-space:nowrap;text-align:right;">
+ <c:set var="ff"><wiki:PageSize/></c:set>
+ <fmt:formatNumber value='${ff/1000}' maxFractionDigits='3' minFractionDigits='1' /> <fmt:message key="info.kilobytes" />
+ </td>
+
+ <td>${page.author}</td>
+
+ <td>
+ <c:if test="${page.version > 1}">
+ <s:link beanclass="org.apache.wiki.action.DiffActionBean" event="diff">
+ <s:param name="page" value="${page.name}" />
+ <s:param name="r1" value="${page.version}" />
+ <s:param name="r2" value="${page.version - 1}" />
+ <fmt:message key="info.difftoprev" />
+ </s:link>
+ </c:if>
+ <c:if test="${page.version < wikiActionBean.page.version}">
+ <s:link beanclass="org.apache.wiki.action.DiffActionBean" event="diff">
+ <s:param name="page" value="${page.name}" />
+ <s:param name="r1" value="${page.version}" />
+ <s:param name="r2" value="${wikiActionBean.page.version}" />
+ <fmt:message key="info.difftolast" />
+ </s:link>
+ </c:if>
+ </td>
+
+ <td class="changenote">${page.changeNote}</td>
+ </tr>
+ </c:forEach>
+
+ </table>
+ </div>
+ </c:if>
+ </wiki:CheckVersion>
+ </wiki:Tab>
+
+ </wiki:PageExists>
+
+ </wiki:TabbedSection>
+ </s:layout-component>
+</s:layout-render>
Added: incubator/jspwiki/trunk/src/WebContent/templates/default/Wiki.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/WebContent/templates/default/Wiki.jsp?rev=904799&view=auto
==============================================================================
--- incubator/jspwiki/trunk/src/WebContent/templates/default/Wiki.jsp (added)
+++ incubator/jspwiki/trunk/src/WebContent/templates/default/Wiki.jsp Sat Jan 30 15:39:44 2010
@@ -0,0 +1,150 @@
+<%--
+ JSPWiki - a JSP-based WikiWiki clone.
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+--%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ taglib uri="http://jakarta.apache.org/jspwiki.tld" prefix="wiki" %>
+<%@ taglib uri="http://stripes.sourceforge.net/stripes.tld" prefix="s" %>
+<%@ page import="javax.servlet.jsp.jstl.fmt.*" %>
+<%@ page import="org.apache.wiki.*" %>
+<%@ page import="org.apache.wiki.action.WikiContextFactory" %>
+<%@ page import="org.apache.wiki.api.WikiPage" %>
+<%@ page import="org.apache.wiki.attachment.*" %>
+<%@ page import="org.apache.wiki.util.TextUtil" %>
+<%@ page errorPage="/Error.jsp" %>
+<%
+ WikiContext c = WikiContextFactory.findContext( pageContext );
+ WikiPage p = c.getPage();
+ String pagename = p.getName();
+
+ /* check possible permalink (blogentry) pages */
+ String blogcommentpage="";
+ String mainblogpage="";
+ if( pagename.indexOf("_blogentry_") != -1 )
+ {
+ blogcommentpage = TextUtil.replaceString( pagename, "blogentry", "comments" );
+ mainblogpage = pagename.substring(0, pagename.indexOf("_blogentry_"));
+ }
+%>
+<s:layout-render name="${templates['DefaultLayout.jsp']}">
+
+ <%-- If wiki page is current, allow search engines to spider it --%>
+ <wiki:CheckVersion mode="latest">
+ <s:layout-component name="headMetaRobots">
+ <meta name="robots" content="index,follow" />
+ </s:layout-component>
+ </wiki:CheckVersion>
+
+ <s:layout-component name="content">
+ <wiki:TabbedSection defaultTab="pagecontent">
+
+ <wiki:NoSuchPage>
+ <wiki:Tab id="pagecontent" titleKey="view.tab" accesskey="v">
+ <fmt:message key="common.nopage">
+ <fmt:param><wiki:EditLink><fmt:message key="common.createit" /></wiki:EditLink></fmt:param>
+ </fmt:message>
+ </wiki:Tab>
+ </wiki:NoSuchPage>
+
+ <wiki:PageExists>
+
+ <%-- Content tab --%>
+ <wiki:Tab id="pagecontent" titleKey="view.tab" accesskey="v">
+ <%-- If the page is an older version, then offer a note and a possibility
+ to restore this version as the latest one. --%>
+ <wiki:CheckVersion mode="notlatest">
+ <s:form beanclass="org.apache.wiki.action.ViewActionBean" method="get" acceptcharset='UTF-8'>
+ <s:hidden name="page" />
+ <div class="warning">
+ <fmt:message key="view.oldversion">
+ <fmt:param>
+ <select id="version" name="version" onchange="this.form.submit();">
+<%
+int latestVersion = c.getEngine().getPage( pagename, WikiProvider.LATEST_VERSION ).getVersion();
+int thisVersion = p.getVersion();
+
+if( thisVersion == WikiProvider.LATEST_VERSION ) thisVersion = latestVersion; //should not happen
+ for( int i = 1; i <= latestVersion; i++)
+ {
+%>
+ <option value="<%= i %>" <%= ((i==thisVersion) ? "selected='selected'" : "") %> ><%= i %></option>
+<%
+ }
+%>
+ </select>
+ </fmt:param>
+ </fmt:message>
+ <br/>
+ <wiki:LinkTo><fmt:message key="view.backtocurrent" /></wiki:LinkTo>
+ <wiki:EditLink version="this"><fmt:message key="view.restore" /></wiki:EditLink>
+ </div>
+
+ </s:form>
+ </wiki:CheckVersion>
+
+ <%-- Inserts no text if there is no page. --%>
+ <wiki:InsertPage/>
+
+<% if( ! mainblogpage.equals("") ) { %>
+ <wiki:PageExists page="<%= mainblogpage%>">
+
+ <% if( ! blogcommentpage.equals("") ) { %>
+ <wiki:PageExists page="<%= blogcommentpage%>">
+ <div class="weblogcommentstitle"><fmt:message key="blog.commenttitle" /></div>
+ <div class="weblogcomments"><wiki:InsertPage page="<%= blogcommentpage%>" /></div>
+ </wiki:PageExists>
+ <% }; %>
+ <div class="information">
+ <wiki:Link page="<%= mainblogpage %>"><fmt:message key="blog.backtomain" /></wiki:Link>
+ <wiki:Link context="comment" page="<%= blogcommentpage%>"><fmt:message key="blog.addcomments" /></wiki:Link>
+ </div>
+
+ </wiki:PageExists>
+<% }; %>
+
+ <wiki:PageType type="attachment">
+ <div class="information">
+ <fmt:message key="info.backtoparentpage">
+ <fmt:param><wiki:LinkToParent><wiki:ParentPageName/></wiki:LinkToParent></fmt:param>
+ </fmt:message>
+ </div>
+ <div style="overflow:hidden;">
+ <wiki:Translate>[${wikiActionBean.page.name}]</wiki:Translate>
+ </div>
+ </wiki:PageType>
+ </wiki:Tab>
+
+ <%-- Attachments tab --%>
+ <wiki:Tab id="attach" accesskey="a"
+ title="${wiki:attachmentsTitle(request.Locale, wikiActionBean.attachments)}"
+ beanclass="org.apache.wiki.action.ViewActionBean" event="attachments">
+ <wiki:Param name="page" value="${wikiActionBean.page.name}" />
+ </wiki:Tab>
+
+ <%-- Info tab --%>
+ <wiki:Tab id="info" titleKey="info.tab" accesskey="i" beanclass="org.apache.wiki.action.ViewActionBean" event="info">
+ <wiki:Param name="page" value="${wikiActionBean.page.name}" />
+ </wiki:Tab>
+ </wiki:PageExists>
+
+ </wiki:TabbedSection>
+ </s:layout-component>
+
+</s:layout-render>
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/action/DiffActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/action/DiffActionBean.java?rev=904799&r1=904798&r2=904799&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/action/DiffActionBean.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/action/DiffActionBean.java Sat Jan 30 15:39:44 2010
@@ -1,11 +1,6 @@
package org.apache.wiki.action;
-import java.util.List;
-
-import net.sourceforge.stripes.action.DefaultHandler;
-import net.sourceforge.stripes.action.ForwardResolution;
-import net.sourceforge.stripes.action.HandlesEvent;
-import net.sourceforge.stripes.action.Resolution;
+import net.sourceforge.stripes.action.*;
import net.sourceforge.stripes.validation.Validate;
import org.apache.wiki.WikiContext;
@@ -22,6 +17,7 @@
* assume current version (= -1). If "r2" is null, then assume the previous
* version (=current version-1)
*/
+@UrlBinding( "/Diff.jsp" )
public class DiffActionBean extends AbstractPageActionBean
{
private int m_r1 = WikiProvider.LATEST_VERSION;
@@ -30,8 +26,6 @@
private String m_diffProvider = "TraditionalDiffProvider";
- private List<WikiPage> m_history = null;
-
/**
* Returns the newer version to compare.
*
@@ -80,23 +74,16 @@
* Returns the DiffProvider used by this wiki.
* @return the diff provider
*/
+ @DontBind
public String getDiffProvider()
{
return m_diffProvider;
}
/**
- * Returns the page history.
- * @return the history
- */
- public List<WikiPage> getHistory()
- {
- return m_history;
- }
-
- /**
* Event that diffs the current state of the edited page and forwards the
- * user to the diff JSP.
+ * user to the template JSP {@code AttachmentInfo.jsp} if the current page is an
+ * attachment, or {@code PageInfo.jsp} otherwise.
*
* @return a forward resolution back to the preview page.
*/
@@ -118,10 +105,15 @@
// Set the page history collection and DiffProvider
WikiContext c = getContext();
- m_history = c.getEngine().getVersionHistory( getPage().getName() );
m_diffProvider = c.getEngine().getVariable( c, "jspwiki.diffProvider" );
- return new ForwardResolution( "/Diff.jsp" );
+ // Forward to display JSP
+ WikiPage page = getPage();
+ if ( page.isAttachment() )
+ {
+ return new ForwardResolution( "/templates/default/AttachmentInfo.jsp" );
+ }
+ return new ForwardResolution( "/templates/default/PageInfo.jsp" );
}
}
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ViewActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ViewActionBean.java?rev=904799&r1=904798&r2=904799&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ViewActionBean.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ViewActionBean.java Sat Jan 30 15:39:44 2010
@@ -46,6 +46,7 @@
import org.apache.wiki.log.Logger;
import org.apache.wiki.log.LoggerFactory;
import org.apache.wiki.plugin.PluginManager;
+import org.apache.wiki.providers.ProviderException;
import org.apache.wiki.ui.stripes.HandlerPermission;
import org.apache.wiki.ui.stripes.WikiActionBeanContext;
import org.apache.wiki.ui.stripes.WikiRequestContext;
@@ -54,7 +55,7 @@
* Displays the wiki page a users requested, resolving special page names and
* redirecting if needed.
*/
-@UrlBinding( "/Wiki.action" )
+@UrlBinding( "/Wiki.jsp" )
public class ViewActionBean extends AbstractPageActionBean
{
private static final Logger log = LoggerFactory.getLogger( ViewActionBean.class );
@@ -115,7 +116,7 @@
@HandlerPermission( permissionClass = PagePermission.class, target = "${page.path}", actions = PagePermission.VIEW_ACTION )
public Resolution attachments()
{
- return new ForwardResolution( "/Attachments.jsp" );
+ return new ForwardResolution( "/templates/default/Attachments.jsp" );
}
/**
@@ -139,17 +140,23 @@
}
/**
- * Handler that forwards to the page information display JSP
- * <code>/PageInfo.jsp</code>.
+ * Handler that forwards to the template JSP
+ * {@code AttachmentInfo.jsp} if the current page is an
+ * attachment, or {@code PageInfo.jsp} otherwise.
*
* @return a forward to the content template
*/
@HandlesEvent( "info" )
@HandlerPermission( permissionClass = PagePermission.class, target = "${page.path}", actions = PagePermission.VIEW_ACTION )
@WikiRequestContext( "info" )
- public Resolution info()
+ public Resolution info() throws ProviderException
{
- return new ForwardResolution( "/PageInfo.jsp" );
+ WikiPage page = getPage();
+ if ( page.isAttachment() )
+ {
+ return new ForwardResolution( "/templates/default/AttachmentInfo.jsp" );
+ }
+ return new ForwardResolution( "/templates/default/PageInfo.jsp" );
}
/**
@@ -286,9 +293,8 @@
}
/**
- * 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.
+ * Default handler that simply forwards the user back to the template JSP
+ * <code>/Wiki.jsp</code>.
*
* @return a forward to the content template
*/
@@ -297,9 +303,10 @@
@HandlesEvent( "view" )
@HandlerPermission( permissionClass = PagePermission.class, target = "${page.path}", actions = PagePermission.VIEW_ACTION )
@WikiRequestContext( "view" )
- public Resolution view()
+ public Resolution view() throws ProviderException
{
- return new ForwardResolution( "/Wiki.jsp" );
+ // Forward to display JSP
+ return new ForwardResolution( "/templates/default/Wiki.jsp" );
}
/**
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/DiffActionBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/DiffActionBeanTest.java?rev=904799&r1=904798&r2=904799&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/DiffActionBeanTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/DiffActionBeanTest.java Sat Jan 30 15:39:44 2010
@@ -65,7 +65,7 @@
public void testDiffProvider() throws Exception
{
// Try diffing without specifying a page
- MockRoundtrip trip = m_engine.guestTrip( "/Diff.action" );
+ MockRoundtrip trip = m_engine.guestTrip( "/Diff.jsp" );
trip.execute( "diff" );
DiffActionBean bean = trip.getActionBean( DiffActionBean.class );
assertEquals( "TraditionalDiffProvider", bean.getDiffProvider() );
@@ -83,7 +83,7 @@
m_engine.saveText( pageName, "This is version three..." );
// Diff with no versions
- MockRoundtrip trip = m_engine.guestTrip( "/Diff.action" );
+ MockRoundtrip trip = m_engine.guestTrip( "/Diff.jsp" );
trip.setParameter( "page", pageName );
trip.execute( "diff" );
@@ -108,7 +108,7 @@
public void testNoParameters() throws Exception
{
// Try diffing without specifying a page
- MockRoundtrip trip = m_engine.guestTrip( "/Diff.action" );
+ MockRoundtrip trip = m_engine.guestTrip( "/Diff.jsp" );
trip.execute( "diff" );
// ...we should NOT see any page bound to the ActionBean
@@ -138,7 +138,7 @@
m_engine.saveText( pageName, "This is version three..." );
// Diff without specifying R1 or R2
- MockRoundtrip trip = m_engine.guestTrip( "/Diff.action" );
+ MockRoundtrip trip = m_engine.guestTrip( "/Diff.jsp" );
trip.setParameter( "page", pageName );
trip.execute( "diff" );
@@ -147,8 +147,8 @@
assertEquals( WikiProvider.LATEST_VERSION, bean.getR1() );
assertEquals( 2, bean.getR2() );
- // ...and the destination should be Diff.jsp (aka display JSP)
- assertEquals( "/Diff.jsp", trip.getDestination() );
+ // ...and the destination should be the PageInfo template JSP
+ assertEquals( "/templates/default/PageInfo.jsp", trip.getDestination() );
// Delete the test page
m_engine.deletePage( pageName );
@@ -167,7 +167,7 @@
m_engine.saveText( pageName, "This is version three..." );
// Diff with R1 and R2
- MockRoundtrip trip = m_engine.guestTrip( "/Diff.action" );
+ MockRoundtrip trip = m_engine.guestTrip( "/Diff.jsp" );
trip.setParameter( "page", pageName );
trip.setParameter( "r1", "1" );
trip.setParameter( "r2", "2" );
@@ -184,8 +184,8 @@
assertEquals( 1, bean.getR1() );
assertEquals( 2, bean.getR2() );
- // ...and the destination should be Diff.jsp (aka display JSP)
- assertEquals( "/Diff.jsp", trip.getDestination() );
+ // ...and the destination should be the PageInfo template JSP
+ assertEquals( "/templates/default/PageInfo.jsp", trip.getDestination() );
// Delete the test page
m_engine.deletePage( pageName );
@@ -203,7 +203,7 @@
m_engine.saveText( pageName, "This is version three..." );
// Diff with R1 but not R2
- MockRoundtrip trip = m_engine.guestTrip( "/Diff.action" );
+ MockRoundtrip trip = m_engine.guestTrip( "/Diff.jsp" );
trip.setParameter( "page", pageName );
trip.setParameter( "r1", "1" );
trip.execute( "diff" );
@@ -213,8 +213,8 @@
assertEquals( 1, bean.getR1() );
assertEquals( 2, bean.getR2() );
- // ...and the destination should be Diff.jsp (aka display JSP)
- assertEquals( "/Diff.jsp", trip.getDestination() );
+ // ...and the destination should be the PageInfo template JSP
+ assertEquals( "/templates/default/PageInfo.jsp", trip.getDestination() );
// Delete the test page
m_engine.deletePage( pageName );
@@ -232,7 +232,7 @@
m_engine.saveText( pageName, "This is version three..." );
// Diff with R2 but not R1
- MockRoundtrip trip = m_engine.guestTrip( "/Diff.action" );
+ MockRoundtrip trip = m_engine.guestTrip( "/Diff.jsp" );
trip.setParameter( "page", pageName );
trip.setParameter( "r2", "1" );
trip.execute( "diff" );
@@ -242,8 +242,8 @@
assertEquals( WikiProvider.LATEST_VERSION, bean.getR1() );
assertEquals( 1, bean.getR2() );
- // ...and the destination should be Diff.jsp (aka display JSP)
- assertEquals( "/Diff.jsp", trip.getDestination() );
+ // ...and the destination should be the PageInfo template JSP
+ assertEquals( "/templates/default/PageInfo.jsp", trip.getDestination() );
// Delete the test page
m_engine.deletePage( pageName );
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/EditActionBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/EditActionBeanTest.java?rev=904799&r1=904798&r2=904799&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/EditActionBeanTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/EditActionBeanTest.java Sat Jan 30 15:39:44 2010
@@ -138,8 +138,8 @@
assertEquals( page, bean.getPage() );
assertEquals( "This is the edited text\r\n", page.getContentAsString() );
- // ...and the destination should be Wiki.action (aka display JSP)
- assertEquals( "/Wiki.action?view=&page=" + pageName, trip.getDestination() );
+ // ...and the destination should be the Wiki action bean
+ assertEquals( "/Wiki.jsp?view=&page=" + pageName, trip.getDestination() );
// Save the page one more time!
trip = m_engine.guestTrip( "/Edit.action" );
@@ -185,8 +185,8 @@
assertNotNull( bean.getPage() );
assertEquals( pageName, bean.getPage().getName() );
- // ...and the destination should be Wiki.action (aka display JSP)
- assertEquals( "/Wiki.action?view=&page=" + pageName, trip.getDestination() );
+ // ...and the destination should be the Wiki action bean
+ assertEquals( "/Wiki.jsp?view=&page=" + pageName, trip.getDestination() );
// Delete the test page
m_engine.deletePage( pageName );
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/GroupActionBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/GroupActionBeanTest.java?rev=904799&r1=904798&r2=904799&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/GroupActionBeanTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/GroupActionBeanTest.java Sat Jan 30 15:39:44 2010
@@ -175,7 +175,7 @@
GroupActionBean bean = trip.getActionBean( GroupActionBean.class );
ValidationErrors errors = bean.getContext().getValidationErrors();
assertEquals( 0, errors.size() );
- assertEquals( "/Wiki.action", trip.getDestination() );
+ assertEquals( "/Wiki.jsp", trip.getDestination() );
}
public void testSaveExistingGroup() throws Exception
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/LoginActionBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/LoginActionBeanTest.java?rev=904799&r1=904798&r2=904799&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/LoginActionBeanTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/LoginActionBeanTest.java Sat Jan 30 15:39:44 2010
@@ -90,7 +90,7 @@
errors = bean.getContext().getValidationErrors();
assertEquals( 0, errors.size() );
assertEquals( Users.JANNE, wikiSession.getLoginPrincipal().getName() );
- assertEquals( "/Wiki.action", trip.getDestination() );
+ assertEquals( "/Wiki.jsp", trip.getDestination() );
// Should be just one cookie (the JSPWiki asserted name cookie)
Cookie[] cookies = trip.getResponse().getCookies();
@@ -158,7 +158,7 @@
errors = bean.getContext().getValidationErrors();
assertEquals( 0, errors.size() );
assertEquals( Users.JANNE, wikiSession.getLoginPrincipal().getName() );
- assertEquals( "/Wiki.action?page=Foo", trip.getDestination() );
+ assertEquals( "/Wiki.jsp?page=Foo", trip.getDestination() );
}
public void testLoginRememberMe() throws Exception
@@ -184,7 +184,7 @@
errors = bean.getContext().getValidationErrors();
assertEquals( 0, errors.size() );
assertEquals( Users.JANNE, wikiSession.getLoginPrincipal().getName() );
- assertEquals( "/Wiki.action", trip.getDestination() );
+ assertEquals( "/Wiki.jsp", trip.getDestination() );
// Should be two cookies (the JSPWiki asserted name cookie plus the
// Remember Me? cookie)
@@ -212,7 +212,7 @@
errors = bean.getContext().getValidationErrors();
assertEquals( 0, errors.size() );
assertNotSame( Users.JANNE, wikiSession.getLoginPrincipal().getName() );
- assertEquals( "/Wiki.action", trip.getDestination() );
+ assertEquals( "/Wiki.jsp", trip.getDestination() );
// Should be just one cookie (the JSPWiki asserted name cookie), and it
// should be empty
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/RenameActionBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/RenameActionBeanTest.java?rev=904799&r1=904798&r2=904799&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/RenameActionBeanTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/RenameActionBeanTest.java Sat Jan 30 15:39:44 2010
@@ -138,7 +138,7 @@
trip.execute("rename");
errors = trip.getValidationErrors();
assertEquals( 0, errors.size() );
- assertEquals( "/Wiki.action?page=TestRenamed", trip.getDestination() );
+ assertEquals( "/Wiki.jsp?page=TestRenamed", trip.getDestination() );
assertFalse( m_engine.pageExists( "Test" ) );
assertTrue( m_engine.pageExists( "TestRenamed" ) );
}
@@ -165,7 +165,7 @@
trip.execute("rename");
errors = trip.getValidationErrors();
assertEquals( 0, errors.size() );
- assertEquals( "/Wiki.action?page=TestRenamed", trip.getDestination() );
+ assertEquals( "/Wiki.jsp?page=TestRenamed", trip.getDestination() );
assertFalse( m_engine.pageExists( "Test" ) );
assertTrue( m_engine.pageExists( "TestRenamed" ) );
referringText = m_engine.getPureText( m_engine.getPage("ReferstoTest") );
@@ -187,7 +187,7 @@
trip.execute("rename");
errors = trip.getValidationErrors();
assertEquals( 0, errors.size() );
- assertEquals( "/Wiki.action?page=TestRenamed", trip.getDestination() );
+ assertEquals( "/Wiki.jsp?page=TestRenamed", trip.getDestination() );
assertFalse( m_engine.pageExists( "Test" ) );
assertTrue( m_engine.pageExists( "TestRenamed" ) );
referringText = m_engine.getPureText( m_engine.getPage("ReferstoTest") );
@@ -210,7 +210,7 @@
trip.execute("rename");
errors = trip.getValidationErrors();
assertEquals( 0, errors.size() );
- assertEquals( "/Wiki.action?page=TestRenamed", trip.getDestination() );
+ assertEquals( "/Wiki.jsp?page=TestRenamed", trip.getDestination() );
assertFalse( m_engine.pageExists( "Test" ) );
assertTrue( m_engine.pageExists( "TestRenamed" ) );
referringText = m_engine.getPureText( m_engine.getPage("ReferstoTest") );
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserPreferencesActionBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserPreferencesActionBeanTest.java?rev=904799&r1=904798&r2=904799&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserPreferencesActionBeanTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserPreferencesActionBeanTest.java Sat Jan 30 15:39:44 2010
@@ -73,7 +73,7 @@
trip.setParameter( "assertedName", "MyAssertedIdentity" );
trip.execute( "createAssertedName" );
bean = trip.getActionBean( UserPreferencesActionBean.class );
- assertEquals( "/Wiki.action", trip.getDestination() );
+ assertEquals( "/Wiki.jsp", trip.getDestination() );
// Verify that the asserted name cookie is present in the Response
MockHttpServletResponse response = (MockHttpServletResponse) bean.getContext().getResponse();
@@ -100,7 +100,7 @@
trip.setParameter( "assertedName", "MyAssertedIdentity" );
trip.execute( "createAssertedName" );
bean = trip.getActionBean( UserPreferencesActionBean.class );
- assertEquals( "/Wiki.action", trip.getDestination() );
+ assertEquals( "/Wiki.jsp", trip.getDestination() );
// Verify that the asserted name cookie is NOT present in the Response
// (authenticated users cannot set the assertion cookie)
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserProfileActionBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserProfileActionBeanTest.java?rev=904799&r1=904798&r2=904799&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserProfileActionBeanTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserProfileActionBeanTest.java Sat Jan 30 15:39:44 2010
@@ -251,7 +251,7 @@
errors = bean.getContext().getValidationErrors();
// Check to make sure no validation errors here...
assertEquals( 0, errors.size() );
- assertEquals( "/Wiki.action", trip.getDestination() );
+ assertEquals( "/Wiki.jsp", trip.getDestination() );
// Verify user was saved
assertTrue( userExists( "user" + suffix ) );
@@ -286,7 +286,7 @@
// Check to make sure no validation errors here...
errors = bean.getContext().getValidationErrors();
assertEquals( 0, errors.size() );
- assertEquals( "/Wiki.action", trip.getDestination() );
+ assertEquals( "/Wiki.jsp", trip.getDestination() );
assertTrue( userExists( "user" + suffix1 ) );
// Create user #2, but same loginName as #1; save; verify it did NOT
@@ -347,7 +347,7 @@
bean = trip.getActionBean( UserProfileActionBean.class );
errors = bean.getContext().getValidationErrors();
assertEquals( 0, errors.size() );
- assertEquals( "/Wiki.action", trip.getDestination() );
+ assertEquals( "/Wiki.jsp", trip.getDestination() );
assertTrue( userExists( "user" + suffix ) );
// Create new session and login as new user...
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/ViewActionBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/ViewActionBeanTest.java?rev=904799&r1=904798&r2=904799&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/ViewActionBeanTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/ViewActionBeanTest.java Sat Jan 30 15:39:44 2010
@@ -63,7 +63,7 @@
assertFalse( m_engine.pageExists( pageName ) );
// Set the 'page' request parameter to test page name...
- MockRoundtrip trip = m_engine.guestTrip( "/Wiki.action");
+ MockRoundtrip trip = m_engine.guestTrip( "/Wiki.jsp");
trip.setParameter("page", pageName );
trip.execute("view");
@@ -72,8 +72,8 @@
assertNotNull( bean.getPage() );
assertEquals( pageName, bean.getPage().getName() );
- // ...and the destination should be Wiki.jsp (aka display JSP)
- assertEquals("/Wiki.jsp", trip.getDestination() );
+ // ...and the destination should be the Wiki template JSP
+ assertEquals("/templates/default/Wiki.jsp", trip.getDestination() );
}
public void testNoParameter() throws Exception {
@@ -83,7 +83,7 @@
assertNotNull("Did not save page Main!", page);
// Execute the request without specifying a page
- MockRoundtrip trip = m_engine.guestTrip( "/Wiki.action");
+ MockRoundtrip trip = m_engine.guestTrip( "/Wiki.jsp");
trip.execute("view");
// ...we should automatically see Main bound to the ActionBean (nice!)
@@ -91,8 +91,8 @@
page = m_engine.getPage("Main");
assertEquals( page, bean.getPage() );
- // ...and the destination should be Wiki.jsp (aka display JSP)
- assertEquals("/Wiki.jsp", trip.getDestination() );
+ // ...and the destination should be the Wiki template JSP
+ assertEquals("/templates/default/Wiki.jsp", trip.getDestination() );
}
public void testSpecialPage() throws Exception {
@@ -100,7 +100,7 @@
m_engine.deletePage( "FindPage" );
// Execute the request with a 'special page' reference
- MockRoundtrip trip = m_engine.guestTrip( "/Wiki.action");
+ MockRoundtrip trip = m_engine.guestTrip( "/Wiki.jsp");
trip.addParameter( "page","FindPage" );
trip.execute("view");
@@ -123,7 +123,7 @@
assertNotNull("Did not save page " + pageName + "!", page);
// Set the 'page' request parameter to 'ViewActionBeanTest'...
- MockRoundtrip trip = m_engine.guestTrip( "/Wiki.action" );
+ MockRoundtrip trip = m_engine.guestTrip( "/Wiki.jsp" );
trip.setParameter( "page", pageName );
trip.execute( "view" );
@@ -131,8 +131,8 @@
ViewActionBean bean = trip.getActionBean( ViewActionBean.class );
assertEquals( page, bean.getPage() );
- // ...and the destination should be Wiki.jsp (aka display JSP)
- assertEquals( "/Wiki.jsp", trip.getDestination() );
+ // ...and the destination should be the Wiki template JSP
+ assertEquals( "/templates/default/Wiki.jsp", trip.getDestination() );
}
public void testViewVersion() throws Exception {
@@ -145,7 +145,7 @@
assertNotNull("Did not save page " + pageName + "!", page);
// Go get the first version
- MockRoundtrip trip = m_engine.guestTrip( "/Wiki.action" );
+ MockRoundtrip trip = m_engine.guestTrip( "/Wiki.jsp" );
trip.setParameter( "page", pageName );
trip.execute( "view" );
ViewActionBean bean = trip.getActionBean( ViewActionBean.class );
@@ -159,7 +159,7 @@
WikiPage pageV2 = m_engine.getPage( pageName, 2 );
// Go get the first version again
- trip = m_engine.guestTrip( "/Wiki.action" );
+ trip = m_engine.guestTrip( "/Wiki.jsp" );
trip.setParameter( "page", pageName );
trip.setParameter( "version", "1" );
trip.execute( "view" );
@@ -169,7 +169,7 @@
assertEquals( "This is the first version.\r\n", pageText );
// Go get the second version
- trip = m_engine.guestTrip( "/Wiki.action" );
+ trip = m_engine.guestTrip( "/Wiki.jsp" );
trip.setParameter( "page", pageName );
trip.setParameter( "version", "2" );
trip.execute( "view" );
@@ -179,7 +179,7 @@
assertEquals( "This is the second version.\r\n", pageText );
// Go get the "latest" version
- trip = m_engine.guestTrip( "/Wiki.action" );
+ trip = m_engine.guestTrip( "/Wiki.jsp" );
trip.setParameter( "page", pageName );
trip.execute( "view" );
bean = trip.getActionBean( ViewActionBean.class );
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/ui/stripes/ShortUrlRedirectFilterTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/ui/stripes/ShortUrlRedirectFilterTest.java?rev=904799&r1=904798&r2=904799&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/ui/stripes/ShortUrlRedirectFilterTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/ui/stripes/ShortUrlRedirectFilterTest.java Sat Jan 30 15:39:44 2010
@@ -70,7 +70,7 @@
trip.execute();
ViewActionBean bean = trip.getActionBean( ViewActionBean.class );
assertNull( bean );
- assertEquals( "/Wiki.action?view=&page=Foo", trip.getDestination() );
+ assertEquals( "/Wiki.jsp?view=&page=Foo", trip.getDestination() );
}
public void testRedirectViewNoPage() throws Exception
@@ -80,7 +80,7 @@
trip.execute();
ViewActionBean bean = trip.getActionBean( ViewActionBean.class );
assertNull( bean );
- assertEquals( "/Wiki.action", trip.getDestination() );
+ assertEquals( "/Wiki.jsp", trip.getDestination() );
}
public static Test suite()