
META-INF.resources.document_library.edit_file_shortcut.jsp 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.
*/
--%>
<%@ include file="/document_library/init.jsp" %>
<%
String mvcRenderCommandName = ParamUtil.getString(request, "mvcRenderCommandName");
String tabs2 = ParamUtil.getString(request, "tabs2", "version-history");
String redirect = ParamUtil.getString(request, "redirect");
FileShortcut fileShortcut = (FileShortcut)request.getAttribute(WebKeys.DOCUMENT_LIBRARY_FILE_SHORTCUT);
long fileShortcutId = BeanParamUtil.getLong(fileShortcut, request, "fileShortcutId");
long toGroupId = ParamUtil.getLong(request, "toGroupId");
Group toGroup = null;
long repositoryId = BeanParamUtil.getLong(fileShortcut, request, "repositoryId");
long folderId = BeanParamUtil.getLong(fileShortcut, request, "folderId");
long toFileEntryId = BeanParamUtil.getLong(fileShortcut, request, "toFileEntryId");
FileEntry toFileEntry = null;
if (toFileEntryId > 0) {
try {
toFileEntry = DLAppLocalServiceUtil.getFileEntry(toFileEntryId);
toFileEntry = toFileEntry.toEscapedModel();
toGroupId = toFileEntry.getRepositoryId();
toGroup = GroupLocalServiceUtil.getGroup(toGroupId);
toGroup = toGroup.toEscapedModel();
}
catch (Exception e) {
}
}
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setParameter("mvcRenderCommandName", mvcRenderCommandName);
portletURL.setParameter("tabs2", tabs2);
portletURL.setParameter("redirect", redirect);
portletURL.setParameter("fileShortcutId", String.valueOf(fileShortcutId));
String headerTitle = (fileShortcut != null) ? LanguageUtil.format(request, "shortcut-to-x", fileShortcut.getToTitle(), false) : LanguageUtil.get(request, "new-file-shortcut");
boolean portletTitleBasedNavigation = GetterUtil.getBoolean(portletConfig.getInitParameter("portlet-title-based-navigation"));
if (portletTitleBasedNavigation) {
portletDisplay.setShowBackIcon(true);
portletDisplay.setURLBack(redirect);
renderResponse.setTitle(headerTitle);
}
%>
>
<%
String toGroupName = StringPool.BLANK;
if (toGroup != null) {
toGroupName = HtmlUtil.escape(toGroup.getDescriptiveName(locale));
}
%>
<%
String toFileEntryTitle = BeanPropertiesUtil.getString(toFileEntry, "title");
%>
$('# selectGroupButton').on(
'click',
function(event) {
Liferay.Util.selectEntity(
{
dialog: {
constrain: true,
destroyOnHide: true,
modal: true,
},
id: ' selectGroup',
title: ' ',
uri: '<%= selectGroupURL.toString() %>'
},
function(event) {
if (document. fm. toGroupId.value != event.groupid) {
selectFileEntry('', '');
}
document. fm. toGroupId.value = event.groupid;
document. fm. toFileEntryId.value = 0;
document.getElementById(' toGroupName').value = _.escape(event.groupdescriptivename);
Liferay.Util.toggleDisabled('# selectToFileEntryButton', false);
}
);
}
);
$('# selectToFileEntryButton').on(
'click',
function(event) {
Liferay.Util.selectEntity(
{
dialog: {
constrain: true,
destroyOnHide: true,
modal: true,
},
id: createSelectFileEntryId(),
title: ' ',
uri: createSelectFileEntryURL('<%= selectFileEntryURL.toString() %>')
},
function(event) {
selectFileEntry(event.entryid, event.entryname);
}
);
}
);
function createSelectFileEntryId() {
return ' selectFileEntry_' + document. fm. toGroupId.value;
}
function createSelectFileEntryURL(url) {
url += '& groupId=' + document. fm. toGroupId.value;
url += '& fileEntryId=' + document. fm. toFileEntryId.value;
return url;
}
function saveFileShortcut() {
document. fm. <%= Constants.CMD %>.value = '<%= (fileShortcut == null) ? Constants.ADD : Constants.UPDATE %>';
submitForm(document. fm);
}
function selectFileEntry(fileEntryId, title) {
document. fm. toFileEntryId.value = fileEntryId;
document.getElementById(' toFileEntryTitle').value = title;
}
<%
if (fileShortcut != null) {
DLBreadcrumbUtil.addPortletBreadcrumbEntries(fileShortcut, request, renderResponse);
PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "edit"), currentURL);
}
else {
DLBreadcrumbUtil.addPortletBreadcrumbEntries(folderId, request, renderResponse);
PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "add-file-shortcut"), currentURL);
}
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy