
META-INF.resources.document_library.view.jsp Maven / Gradle / Ivy
The newest version!
<%--
/**
* 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.
*/
--%>
<%@ include file="/document_library/init.jsp" %>
<%
DLPortletInstanceSettingsHelper dlPortletInstanceSettingsHelper = new DLPortletInstanceSettingsHelper(dlRequestHelper);
String mvcRenderCommandName = ParamUtil.getString(request, "mvcRenderCommandName");
String navigation = ParamUtil.getString(request, "navigation");
String browseBy = ParamUtil.getString(request, "browseBy");
Folder folder = (com.liferay.portal.kernel.repository.model.Folder)request.getAttribute(WebKeys.DOCUMENT_LIBRARY_FOLDER);
long folderId = BeanPropertiesUtil.getLong(folder, "folderId", rootFolderId);
boolean defaultFolderView = false;
if ((folder == null) && (folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID)) {
defaultFolderView = true;
}
if (defaultFolderView) {
try {
folder = DLAppLocalServiceUtil.getFolder(folderId);
}
catch (NoSuchFolderException nsfe) {
folderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID;
}
}
long repositoryId = scopeGroupId;
if (folder != null) {
repositoryId = folder.getRepositoryId();
}
String displayStyle = ParamUtil.getString(request, "displayStyle");
String[] displayViews = dlPortletInstanceSettings.getDisplayViews();
if (Validator.isNull(displayStyle)) {
displayStyle = portalPreferences.getValue(DLPortletKeys.DOCUMENT_LIBRARY, "display-style", PropsValues.DL_DEFAULT_DISPLAY_VIEW);
}
else {
if (ArrayUtil.contains(displayViews, displayStyle)) {
portalPreferences.setValue(DLPortletKeys.DOCUMENT_LIBRARY, "display-style", displayStyle);
request.setAttribute(WebKeys.SINGLE_PAGE_APPLICATION_CLEAR_CACHE, Boolean.TRUE);
}
}
if (!ArrayUtil.contains(displayViews, displayStyle)) {
displayStyle = displayViews[0];
}
String orderByCol = ParamUtil.getString(request, "orderByCol");
String orderByType = ParamUtil.getString(request, "orderByType");
if (Validator.isNotNull(orderByCol) && Validator.isNotNull(orderByType)) {
portalPreferences.setValue(DLPortletKeys.DOCUMENT_LIBRARY, "order-by-col", orderByCol);
portalPreferences.setValue(DLPortletKeys.DOCUMENT_LIBRARY, "order-by-type", orderByType);
}
else {
orderByCol = portalPreferences.getValue(DLPortletKeys.DOCUMENT_LIBRARY, "order-by-col", "modifiedDate");
orderByType = portalPreferences.getValue(DLPortletKeys.DOCUMENT_LIBRARY, "order-by-type", "asc");
}
request.setAttribute("view.jsp-folder", folder);
request.setAttribute("view.jsp-folderId", String.valueOf(folderId));
request.setAttribute("view.jsp-repositoryId", String.valueOf(repositoryId));
request.setAttribute("view.jsp-displayStyle", displayStyle);
request.setAttribute("view.jsp-orderByCol", orderByCol);
request.setAttribute("view.jsp-orderByType", orderByType);
%>
<%
boolean portletTitleBasedNavigation = GetterUtil.getBoolean(portletConfig.getInitParameter("portlet-title-based-navigation"));
%>
<%
if (!defaultFolderView && (folder != null) && (portletName.equals(DLPortletKeys.DOCUMENT_LIBRARY) || portletName.equals(DLPortletKeys.DOCUMENT_LIBRARY_ADMIN))) {
PortalUtil.setPageSubtitle(folder.getName(), request);
PortalUtil.setPageDescription(folder.getDescription(), request);
}
%>
function toggleActionsButton() {
var form = AUI.$(document. fm2);
var hide = Liferay.Util.listCheckedExcept(form, ' <%= RowChecker.ALL_ROW_IDS %>').length == 0;
AUI.$('# actionsButtonContainer').toggleClass('hide', hide);
}
toggleActionsButton();
<%
String[] entryColumns = dlPortletInstanceSettingsHelper.getEntryColumns();
String[] escapedEntryColumns = new String[entryColumns.length];
for (int i = 0; i < entryColumns.length; i++) {
escapedEntryColumns[i] = HtmlUtil.escapeJS(entryColumns[i]);
}
String[] escapedDisplayViews = new String[displayViews.length];
for (int i = 0; i < displayViews.length; i++) {
escapedDisplayViews[i] = HtmlUtil.escapeJS(displayViews[i]);
}
%>
var documentLibrary = new Liferay.Portlet.DocumentLibrary(
{
columnNames: ['<%= StringUtil.merge(escapedEntryColumns, "','") %>'],
<%
DecimalFormatSymbols decimalFormatSymbols = DecimalFormatSymbols.getInstance(locale);
%>
decimalSeparator: '<%= decimalFormatSymbols.getDecimalSeparator() %>',
displayStyle: '<%= HtmlUtil.escapeJS(displayStyle) %>',
editEntryUrl: ' ',
folders: {
defaultParentFolderId: '<%= folderId %>',
dimensions: {
height: '<%= PrefsPropsUtil.getLong(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_MAX_HEIGHT) %>',
width: '<%= PrefsPropsUtil.getLong(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_MAX_WIDTH) %>'
}
},
form: {
method: 'POST',
node: A.one(document. fm2)
},
maxFileSize: <%= PrefsPropsUtil.getLong(PropsKeys.DL_FILE_MAX_SIZE) %>,
moveEntryUrl: ' ',
namespace: ' ',
portletId: '<%= HtmlUtil.escapeJS(portletId) %>',
redirect: encodeURIComponent('<%= currentURL %>'),
repositories: [
{
id: '<%= scopeGroupId %>',
name: ' '
}
<%
List mountFolders = DLAppServiceUtil.getMountFolders(repositoryId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
for (Folder mountFolder : mountFolders) {
%>
, {
id: '<%= mountFolder.getRepositoryId() %>',
name: '<%= HtmlUtil.escapeJS(mountFolder.getName()) %>'
}
<%
}
%>
],
scopeGroupId: <%= scopeGroupId %>,
searchContainerId: 'entries',
trashEnabled: <%= (scopeGroupId == repositoryId) && DLTrashUtil.isTrashEnabled(scopeGroupId, repositoryId) %>,
updateable: <%= DLFolderPermission.contains(permissionChecker, scopeGroupId, folderId, ActionKeys.UPDATE) %>,
uploadURL: '<%= uploadURL %>',
viewFileEntryURL: ' '
}
);
var clearDocumentLibraryHandles = function(event) {
if (event.portletId === '<%= portletDisplay.getId() %>') {
documentLibrary.destroy();
Liferay.detach('destroyPortlet', clearDocumentLibraryHandles);
}
};
Liferay.on('destroyPortlet', clearDocumentLibraryHandles);
var changeScopeHandles = function(event) {
documentLibrary.destroy();
Liferay.detach('changeScope', changeScopeHandles);
};
Liferay.on('changeScope', changeScopeHandles);
© 2015 - 2025 Weber Informatics LLC | Privacy Policy