📄 viewfile.jsp
字号:
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
<%@ page isELIgnored ="false" %>
<%@ page import="org.jboss.portal.core.portlet.cms.admin.AdminCMSConstants,
org.apache.webdav.lib.WebdavResource,
java.util.Enumeration,
java.util.Vector,
org.jboss.portal.core.portlet.cms.WebDAVUtil" %>
<portlet:defineObjects/>
<%
WebdavResource wdResource = (WebdavResource) request.getAttribute("wdResource");
WebDAVUtil wdUtil = new WebDAVUtil();
String sCurrPath = (String)request.getAttribute("currpath");
Enumeration ePropertyValues = (Enumeration) request.getAttribute("versions");
String sDisplayname = (String)request.getAttribute("displayname");
String sFileSize = (String)request.getAttribute("filesize");
String sType = (String)request.getAttribute("content-type");
String sModDate = (String)request.getAttribute("modified-date");
String sCreateDate = (String)request.getAttribute("created-date");
String sPreviewlink = (String)request.getAttribute("previewlink");
%>
<table width="100%" class="moduletable">
<th class="portlet-section-header">${n:i18n("TITLE_HEAD")} :: ${n:i18n("TITLE_VIEWFILE")}</th>
<tr><td height="10"></td></tr>
<tr><td><font class="portlet-font"><b>Current File: <%= sCurrPath %></b></font></td></tr>
<tr><td height="5"></td></tr>
<tr class="portlet-section-body"><td>
<table width="100%">
<tr class="portlet-section-body">
<%
if ("text/html".equals(sType) || "text/plain".equals(sType))
{
%>
<td align="center">
<a class="portlet-menu-item" href="<portlet:renderURL>
<portlet:param name="op" value="<%= AdminCMSConstants.OP_EDIT %>"/>
<portlet:param name="path" value="<%= sCurrPath %>"/>
</portlet:renderURL>">
<img src="<%= renderRequest.getContextPath() + AdminCMSConstants.DEFAULT_IMAGES_PATH%>/edit.gif" alt="edit file" border="0"><br>Edit File
</a>
</td>
<%
}
if (!"text/html".equals(sType) && !"text/plain".equals(sType))
{
%>
<td align="center">
<a class="portlet-menu-item" href="<portlet:renderURL>
<portlet:param name="op" value="<%= AdminCMSConstants.OP_EDIT_BINARY %>"/>
<portlet:param name="path" value="<%= sCurrPath %>"/>
</portlet:renderURL>">
<img src="<%= renderRequest.getContextPath() + AdminCMSConstants.DEFAULT_IMAGES_PATH%>/edit.gif" alt="edit file" border="0"><br>Edit File
</a>
</td>
<td align="center">
<a class="portlet-menu-item" href="<%= sPreviewlink %>" target="blank"><img src="<%= renderRequest.getContextPath() + AdminCMSConstants.DEFAULT_IMAGES_PATH%>/view.gif" alt="preview file" border="0"><br>Preview File</a>
</td>
<%
}
%>
<td align="center">
<a class="portlet-menu-item" href="<portlet:renderURL>
<portlet:param name="op" value="<%= AdminCMSConstants.OP_CONFIRMCOPY %>"/>
<portlet:param name="path"
value="<%= sCurrPath %>"/>
</portlet:renderURL>">
<img src="<%= renderRequest.getContextPath() + AdminCMSConstants.DEFAULT_IMAGES_PATH%>/copy.gif" alt="copy file" border="0"><br>Copy File
</a>
</td><td align="center">
<a class="portlet-menu-item" href="<portlet:renderURL>
<portlet:param name="op" value="<%= AdminCMSConstants.OP_CONFIRMMOVE %>"/>
<portlet:param name="path"
value="<%= sCurrPath %>"/>
</portlet:renderURL>">
<img src="<%= renderRequest.getContextPath() + AdminCMSConstants.DEFAULT_IMAGES_PATH%>/move.gif" alt="move file" border="0"><br>Move File
</a>
</td><td align="center">
<a class="portlet-menu-item" href="<portlet:renderURL>
<portlet:param name="op" value="<%= AdminCMSConstants.OP_CONFIRMDELETE %>"/>
<portlet:param name="path"
value="<%= sCurrPath %>"/>
</portlet:renderURL>">
<img src="<%= renderRequest.getContextPath() + AdminCMSConstants.DEFAULT_IMAGES_PATH%>/delete.gif" alt="delete" border="0"><br>Delete File
</a>
</td></tr>
</table>
</td></tr>
<tr><td height="10"></td></tr>
<tr><td align="center">
<table width="100%">
<tr><td colspan="5" align="center" class="portlet-section-header"><b>File Properties</b></td></tr>
<tr>
<td class="portlet-section-alternate"><b>Displayname</b></td>
<td class="portlet-section-alternate"><b>FileSize (in bytes)</b></td>
<td class="portlet-section-alternate"><b>Content-Type</b></td>
<td class="portlet-section-alternate"><b>Creation Date</b></td>
<td class="portlet-section-alternate"><b>Modified Date</b></td>
</tr>
<tr>
<td class="portlet-section-body"><%= sDisplayname %></td>
<td class="portlet-section-body"><%= sFileSize %></td>
<td class="portlet-section-body"><%= sType %></td>
<td class="portlet-section-body"><%= sCreateDate %></td>
<td class="portlet-section-body"><%= sModDate %></td>
</tr>
</table>
</td></tr>
<tr><td height="10"></td></tr>
<tr><td align="center">
<table width="100%">
<tr><td colspan="4" align="center" class="portlet-section-header"><b>File Version Information</b></td></tr>
<tr>
<td class="portlet-section-alternate"><b>Actions</b></td>
<td class="portlet-section-alternate"><b>Version</b></td>
<td class="portlet-section-alternate"><b>FileSize (in bytes)</b></td>
<td class="portlet-section-alternate"><b>Creation Date</b></td>
</tr>
<%
if(ePropertyValues.hasMoreElements())
{
while(ePropertyValues.hasMoreElements())
{
String sVPath = ePropertyValues.nextElement().toString();
wdUtil.setCurrentPath(wdResource, sVPath);
int nLastSlashIndex = sVPath.lastIndexOf('/');
String sVersion = sVPath.substring(nLastSlashIndex + 1, sVPath.length());
%>
<tr>
<td class="portlet-section-body">
<%
if ("text/html".equals(sType) || "text/plain".equals(sType))
{
%>
<a href="<portlet:renderURL>
<portlet:param name="op" value="<%= AdminCMSConstants.OP_EDIT %>"/>
<portlet:param name="livepath" value="<%= sCurrPath %>"/>
<portlet:param name="path" value="<%= sVPath %>"/>
<portlet:param name="version" value="<%= sVersion %>"/>
</portlet:renderURL>">
<img src="<%= renderRequest.getContextPath() + AdminCMSConstants.DEFAULT_IMAGES_PATH%>/edit.gif" alt="edit file" border="0">
</a>
<%
}
%>
</td>
<td class="portlet-section-body"><%= sVersion %></td>
<td class="portlet-section-body"><%= wdResource.getGetContentLength() %></td>
<td class="portlet-section-body"><%= wdUtil.getCreateDate(wdResource) %></td>
</tr>
<%
}
}
wdUtil.setCurrentPath(wdResource, sCurrPath);
%>
</table>
</td></tr>
</table>
<%
// TODO: this is a hack and needs to be fixed!
wdResource.close();
%>
<div align="center">
<span class="portlet-menu-item">
<a href="<portlet:actionURL>
<portlet:param name="op" value="<%= AdminCMSConstants.OP_DISPLAY_PARENT_DIR %>"/>
<portlet:param name="path" value="<%= sCurrPath + "/"%>"/>
</portlet:actionURL>">
<img src="<%= renderRequest.getContextPath() + AdminCMSConstants.DEFAULT_IMAGES_PATH%>/up.gif" alt="Back to parent directory" border="0"><br>Back to parent directory
</a>
</span></div>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -