[66] | 1 | <%-- |
---|
| 2 | Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 3 | contributor license agreements. See the NOTICE file distributed with |
---|
| 4 | this work for additional information regarding copyright ownership. |
---|
| 5 | The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 6 | (the "License"); you may not use this file except in compliance with |
---|
| 7 | the License. You may obtain a copy of the License at |
---|
| 8 | |
---|
| 9 | http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 10 | |
---|
| 11 | Unless required by applicable law or agreed to in writing, software |
---|
| 12 | distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 14 | See the License for the specific language governing permissions and |
---|
| 15 | limitations under the License. |
---|
| 16 | --%> |
---|
| 17 | <% |
---|
| 18 | // @author John Xing |
---|
| 19 | // show meta info (currently type, size, date of last-modified) |
---|
| 20 | // for each hit. These info are indexed by ./src/plugin/index-more. |
---|
| 21 | |
---|
| 22 | // do not show unless we have something |
---|
| 23 | boolean showMore = false; |
---|
| 24 | |
---|
| 25 | // Content-Type |
---|
| 26 | String primaryType = detail.getValue("primaryType"); |
---|
| 27 | String subType = detail.getValue("subType"); |
---|
| 28 | |
---|
| 29 | String contentType = subType; |
---|
| 30 | if (contentType == null) |
---|
| 31 | contentType = primaryType; |
---|
| 32 | if (contentType != null) { |
---|
| 33 | contentType = "[<span class=\"contentType\">" + contentType + "</span>]"; |
---|
| 34 | showMore = true; |
---|
| 35 | } else { |
---|
| 36 | contentType = ""; |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | // Content-Length |
---|
| 40 | String contentLength = detail.getValue("contentLength"); |
---|
| 41 | if (contentLength != null) { |
---|
| 42 | contentLength = "(" + contentLength + " bytes)"; |
---|
| 43 | showMore = true; |
---|
| 44 | } else { |
---|
| 45 | contentLength = ""; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | // Last-Modified |
---|
| 49 | String lastModified = detail.getValue("lastModified"); |
---|
| 50 | if (lastModified != null) { |
---|
| 51 | Calendar cal = new GregorianCalendar(); |
---|
| 52 | cal.setTimeInMillis(new Long(lastModified).longValue()); |
---|
| 53 | lastModified = cal.get(Calendar.YEAR) |
---|
| 54 | + "." + (1+cal.get(Calendar.MONTH)) // it is 0-based |
---|
| 55 | + "." + cal.get(Calendar.DAY_OF_MONTH); |
---|
| 56 | showMore = true; |
---|
| 57 | } else { |
---|
| 58 | lastModified = ""; |
---|
| 59 | } |
---|
| 60 | %> |
---|
| 61 | |
---|
| 62 | <% if (showMore) { |
---|
| 63 | if ("text".equalsIgnoreCase(primaryType)) { %> |
---|
| 64 | <br><font size=-1><nobr><%=contentType%> <%=contentLength%> <%=lastModified%></nobr></font> |
---|
| 65 | <% } else { %> |
---|
| 66 | <br><font size=-1><nobr><%=contentType%> <%=contentLength%> <%=lastModified%> - <a href="../text.jsp?<%=id%>"><i18n:message key="viewAsText"/></a></nobr></font> |
---|
| 67 | <% } |
---|
| 68 | } %> |
---|