From: <bra...@us...> - 2010-07-06 22:23:38
|
Revision: 3166 http://archive-access.svn.sourceforge.net/archive-access/?rev=3166&view=rev Author: bradtofel Date: 2010-07-06 22:23:32 +0000 (Tue, 06 Jul 2010) Log Message: ----------- Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp 2010-07-06 22:22:12 UTC (rev 3165) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp 2010-07-06 22:23:32 UTC (rev 3166) @@ -1,7 +1,9 @@ <%@ page language="java" pageEncoding="utf-8" contentType="text/html;charset=utf-8"%> <%@ page import="java.util.List" %> <%@ page import="java.util.Date" %> +<%@ page import="java.util.Iterator" %> <%@ page import="org.archive.wayback.exception.WaybackException" %> +<%@ page import="org.archive.wayback.ResultURIConverter" %> <%@ page import="org.archive.wayback.exception.ResourceNotInArchiveException"%> <%@ page import="org.archive.wayback.exception.ResourceNotAvailableException"%> <%@ page import="org.archive.wayback.core.CaptureSearchResult" %> @@ -29,17 +31,39 @@ StringFormatter fmt = results.getWbRequest().getFormatter(); %> +<jsp:include page="/WEB-INF/global-template/UI-header.jsp" flush="true" /> -<h2><%= fmt.format(e.getTitleKey()) %></h2> -<p><b><%= fmt.format(e.getMessageKey(),e.getMessage()) %></b></p> + <div id="positionHome"> + <section> + <div id="logoHome"> + <h1><span>Internet Archive's Wayback Machine</span></h1> + </div> + </section> + <section> + <div id="searchHome"> + <form name="form1" method="get" action="<%= queryPrefix %>query"> + <input type="hidden" name="<%= WaybackRequest.REQUEST_TYPE %>" value="<%= WaybackRequest.REQUEST_CAPTURE_QUERY %>"> + <input type="text" name="<%= WaybackRequest.REQUEST_URL %>" value="http://" size="40"> + <button type="submit" name="Submit">Go Wayback!</button> + </form> + <div id="searchAdvHome"> + <a href="[ADVANCED SEARCH]">Advanced Search</a> + </div> + </div> + </section> + <section> + <div id="error"> + + <h2><%= fmt.format(e.getTitleKey()) %></h2> + <p><%= fmt.format(e.getMessageKey(),e.getMessage()) %></p> <% if(e instanceof ResourceNotInArchiveException) { ResourceNotInArchiveException niae = (ResourceNotInArchiveException) e; List<String> closeMatches = niae.getCloseMatches(); if(closeMatches != null && !closeMatches.isEmpty()) { %> - <p> - Other possible close matches to try:<br></br> + <p>Other possible close matches to try:</p> + <p> <% WaybackRequest tmp = wbr.clone(); for(String closeMatch : closeMatches) { @@ -47,7 +71,7 @@ String link = queryPrefix + "query?" + tmp.getQueryArguments(); %> - <a href="<%= link %>"><%= closeMatch %></a><br> + <a href="<%= link %>"><%= closeMatch %></a><br/> <% } } @@ -61,46 +85,58 @@ String escapedLink = fmt.escapeHtml(link); String escapedParentUrl = fmt.escapeHtml(parentUrl); %> - </p> - <p> - More options:<br></br> - Try Searching all pages under <a href="<%= escapedLink %>"><%= escapedParentUrl %></a> - </p> + </p> + <p>More options:</p> + <p>Try Searching all pages under <a href="<%= escapedLink %>"><%= escapedParentUrl %></a></p> <% } } else if(e instanceof ResourceNotAvailableException) { %> <div class="wm-nav-link-div"> <% - CaptureSearchResults cResults = results.getCaptureResults(); - Date firstDate = cResults.getFirstResultDate(); - Date lastDate = cResults.getLastResultDate(); - PartitionPartitionMap yearMap = - new PartitionPartitionMap(); - PartitionSize yearSize = Partitioner.yearSize; - Partitioner<Partition<CaptureSearchResult>> yearPartitioner = - new Partitioner<Partition<CaptureSearchResult>>(yearMap); - - List<Partition<Partition<CaptureSearchResult>>> yearPartitions = - yearPartitioner.getRange(yearSize,firstDate,lastDate); - - String navs[] = PartitionsToGraph.getNavigators(fmt,results.getResult()); - String links[] = PartitionsToGraph.getNavigatorLinks(yearPartitions,results.getURIConverter()); - String searchUrl = wbr.getRequestUrl(); - String starLink = fmt.escapeHtml(queryPrefix + "*/" + searchUrl); - links[PartitionsToGraph.NAV_CURRENT] = starLink; - for(int i = 0; i < navs.length; i++) { - if(i > 0) { - %> <% - } - if(links[i] == null) { - %><%= navs[i] %><% - } else { - %> <a href="<%= links[i] %>"><%= navs[i] %></a> <% - } + ResourceNotAvailableException rnae = (ResourceNotAvailableException) e; + + CaptureSearchResults cResults = rnae.getCaptureSearchResults(); + Iterator<CaptureSearchResult> itr = cResults.iterator(); + CaptureSearchResult prev = null; + CaptureSearchResult next = null; + while(itr.hasNext()) { + CaptureSearchResult cur = itr.next(); + if(cur.isClosest()) { + break; } + prev = cur; + } + if(itr.hasNext()) { + next = itr.next(); + } + if((prev != null) || (next != null)) { + String dateFormat = "{0,date,MMMM dd, yyyy HH:mm:ss}"; + ResultURIConverter conv = wbr.getAccessPoint().getUriConverter(); + %> + <div>Or try another close version:</div> + <% + if(prev != null) { + String safePrevReplay = fmt.escapeHtml(conv.makeReplayURI(prev.getCaptureTimestamp(),prev.getOriginalUrl())); + %> + <div>Previous:<a href="<%= safePrevReplay %>"><%= fmt.format(dateFormat,prev.getCaptureDate())%></a></div> + <% + } + if(next != null) { + String safeNextReplay = fmt.escapeHtml(conv.makeReplayURI(next.getCaptureTimestamp(),next.getOriginalUrl())); + %> + <div>Next:<a href="<%= safeNextReplay %>"><%= fmt.format(dateFormat,next.getCaptureDate())%></a></div> + <% + } + } %> </div> <% } %> + + </div> + </section> + <div id="errorBorder"></div> + +<jsp:include page="/WEB-INF/global-template/UI-footer.jsp" flush="true" /> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |