<%-- 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://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="java.text.SimpleDateFormat" %> <%@ 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.i18n.InternationalizationManager" %> <%@ page import="org.apache.wiki.util.TextUtil" %> <%@ page import="org.apache.wiki.content.jcr.JCRWikiPage" %> <%@ page errorPage="/Error.jsp" %> <% 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 + ")"; %>

<%-- Do NOT change the order of wikiname and content, otherwise the servlet won't find its parts. --%>

<%-- FIXME why not add pagination here - no need for large amounts of attach versions on one page --%>

<%----%> <%-- --%> <% 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()); %> <%-- The 'title' attribute is used to sort empty cells --%> <%-- --%>
  <% //FIXME: should probably also become a JCRWikiPage attriute. String changeNote = TextUtil.replaceEntities((String)att.getAttribute(WikiPage.CHANGENOTE)); if( changeNote != null ) { %><%=changeNote%><% } %>