
META-INF.resources.document_library.view_file_entry_preview.jspf Maven / Gradle / Ivy
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%
String randomNamespace = PortalUtil.generateRandomKey(request, "portlet_document_library_view_file_entry_preview") + StringPool.UNDERLINE;
int previewFileCount = 0;
String previewFileURL = null;
String[] previewFileURLs = null;
String videoThumbnailURL = null;
String previewQueryString = null;
if (hasAudio) {
previewQueryString = "&audioPreview=1";
}
else if (hasImages) {
previewQueryString = "&imagePreview=1";
}
else if (hasPDFImages) {
previewFileCount = PDFProcessorUtil.getPreviewFileCount(fileVersion);
previewQueryString = "&previewFileIndex=";
previewFileURL = DLUtil.getPreviewURL(fileEntry, fileVersion, themeDisplay, previewQueryString);
}
else if (hasVideo) {
previewQueryString = "&videoPreview=1";
videoThumbnailURL = DLUtil.getPreviewURL(fileEntry, fileVersion, themeDisplay, "&videoThumbnail=1");
}
if (status != WorkflowConstants.STATUS_ANY) {
previewQueryString = "&status=" + status;
}
if (Validator.isNotNull(previewQueryString)) {
if (hasAudio) {
previewFileURLs = new String[PropsValues.DL_FILE_ENTRY_PREVIEW_AUDIO_CONTAINERS.length];
for (int i = 0; i < PropsValues.DL_FILE_ENTRY_PREVIEW_AUDIO_CONTAINERS.length; i++) {
previewFileURLs[i] = DLUtil.getPreviewURL(fileEntry, fileVersion, themeDisplay, previewQueryString + "&type=" + PropsValues.DL_FILE_ENTRY_PREVIEW_AUDIO_CONTAINERS[i]);
}
}
else if (hasVideo) {
if (PropsValues.DL_FILE_ENTRY_PREVIEW_VIDEO_CONTAINERS.length > 0) {
previewFileURLs = new String[PropsValues.DL_FILE_ENTRY_PREVIEW_VIDEO_CONTAINERS.length];
for (int i = 0; i < PropsValues.DL_FILE_ENTRY_PREVIEW_VIDEO_CONTAINERS.length; i++) {
previewFileURLs[i] = DLUtil.getPreviewURL(fileEntry, fileVersion, themeDisplay, previewQueryString + "&type=" + PropsValues.DL_FILE_ENTRY_PREVIEW_VIDEO_CONTAINERS[i]);
}
}
else {
previewFileURLs = new String[1];
previewFileURLs[0] = videoThumbnailURL;
}
}
else {
previewFileURLs = new String[1];
previewFileURLs[0] = DLUtil.getPreviewURL(fileEntry, fileVersion, themeDisplay, previewQueryString);
}
previewFileURL = previewFileURLs[0];
if (!hasPDFImages) {
previewFileCount = 1;
}
}
request.setAttribute("view_file_entry.jsp-randomNamespace", randomNamespace);
request.setAttribute("view_file_entry.jsp-supportedAudio", String.valueOf(hasAudio));
request.setAttribute("view_file_entry.jsp-supportedVideo", String.valueOf(hasVideo));
request.setAttribute("view_file_entry.jsp-previewFileURLs", previewFileURLs);
request.setAttribute("view_file_entry.jsp-videoThumbnailURL", videoThumbnailURL);
%>
" key="preview" />" class="lfr-preview-file-image-current" src="<%= previewFileURL %>" />
" key="preview" />" class="lfr-preview-file-image-current" src="<%= previewFileURL %>" />
" key="preview" />" class="lfr-preview-file-image-current" id=" <%= randomNamespace %>previewFileImage" src="<%= previewFileURL + "1" %>" />
1 <%= previewFileCount %>
new Liferay.Preview(
{
actionContent: '# <%= randomNamespace %>previewFileActions',
baseImageURL: '<%= previewFileURL %>',
boundingBox: '# <%= randomNamespace %>previewFile',
contentBox: '# <%= randomNamespace %>previewFileContent',
currentPreviewImage: '# <%= randomNamespace %>previewFileImage',
imageListContent: '# <%= randomNamespace %>previewImagesContent',
maxIndex: <%= previewFileCount %>,
previewFileIndexNode: '# <%= randomNamespace %>previewFileIndex',
toolbar: '# <%= randomNamespace %>previewToolbar'
}
).render();
© 2015 - 2025 Weber Informatics LLC | Privacy Policy