Permalink
Browse files

LPS-28158 Support for disabling the Recycle Bin

  • Loading branch information...
1 parent e092ba9 commit 7e0fb2c5eef2cc428e52c7c73d1d37c33ff238e6 @ealonso ealonso committed with brianchandotcom Jul 6, 2012
@@ -43,6 +43,7 @@ page import="com.liferay.portlet.blogs.service.permission.BlogsEntryPermission"
page import="com.liferay.portlet.blogs.service.permission.BlogsPermission" %><%@
page import="com.liferay.portlet.blogs.util.BlogsUtil" %><%@
page import="com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil" %><%@
+page import="com.liferay.portlet.trash.util.TrashUtil" %><%@
page import="com.liferay.util.RSSUtil" %>
<%
@@ -117,14 +117,14 @@ AssetEntry assetEntry = (AssetEntry)request.getAttribute("view_entry_content.jsp
<portlet:actionURL var="deleteEntryURL">
<portlet:param name="struts_action" value="/blogs/edit_entry" />
- <portlet:param name="<%= Constants.CMD %>" value="<%= Constants.MOVE_TO_TRASH %>" />
+ <portlet:param name="<%= Constants.CMD %>" value="<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) ? Constants.MOVE_TO_TRASH : Constants.DELETE %>" />
<portlet:param name="redirect" value="<%= viewURL %>" />
<portlet:param name="entryId" value="<%= String.valueOf(entry.getEntryId()) %>" />
</portlet:actionURL>
<liferay-ui:icon-delete
label="<%= true %>"
- trash="<%= true %>"
+ trash="<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) %>"
url="<%= deleteEntryURL %>"
/>
</td>
@@ -71,11 +71,11 @@ BlogsEntry entry = (BlogsEntry)row.getObject();
<c:if test="<%= BlogsEntryPermission.contains(permissionChecker, entry, ActionKeys.DELETE) %>">
<portlet:actionURL var="deleteEntryURL">
<portlet:param name="struts_action" value="/blogs_admin/edit_entry" />
- <portlet:param name="<%= Constants.CMD %>" value="<%= Constants.MOVE_TO_TRASH %>" />
+ <portlet:param name="<%= Constants.CMD %>" value="<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) ? Constants.MOVE_TO_TRASH : Constants.DELETE %>" />
<portlet:param name="redirect" value="<%= redirect %>" />
<portlet:param name="entryId" value="<%= String.valueOf(entry.getEntryId()) %>" />
</portlet:actionURL>
- <liferay-ui:icon-delete trash="<%= true %>" url="<%= deleteEntryURL %>" />
+ <liferay-ui:icon-delete trash="<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) %>" url="<%= deleteEntryURL %>" />
</c:if>
</liferay-ui:icon-menu>
@@ -28,6 +28,7 @@ page import="com.liferay.portlet.blogs.service.permission.BlogsEntryPermission"
page import="com.liferay.portlet.blogs.service.permission.BlogsPermission" %><%@
page import="com.liferay.portlet.blogsadmin.search.EntryDisplayTerms" %><%@
page import="com.liferay.portlet.blogsadmin.search.EntrySearch" %><%@
-page import="com.liferay.portlet.blogsadmin.search.EntrySearchTerms" %>
+page import="com.liferay.portlet.blogsadmin.search.EntrySearchTerms" %><%@
+page import="com.liferay.portlet.trash.util.TrashUtil" %>
<%@ include file="/html/portlet/blogs_admin/init-ext.jsp" %>
@@ -76,7 +76,7 @@ portletURL.setParameter("struts_action", "/blogs_admin/view");
</liferay-ui:search-container-row>
<c:if test="<%= total > 0 %>">
- <aui:button onClick='<%= renderResponse.getNamespace() + "deleteEntries();" %>' value="move-to-the-recycle-bin" />
+ <aui:button onClick='<%= renderResponse.getNamespace() + "deleteEntries();" %>' value='<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) ? "move-to-the-recycle-bin" : "delete" %>' />
<div class="separator"><!-- --></div>
</c:if>
@@ -90,9 +90,9 @@ portletURL.setParameter("struts_action", "/blogs_admin/view");
window,
'<portlet:namespace />deleteEntries',
function() {
- if (confirm('<%= UnicodeLanguageUtil.get(pageContext, "are-you-sure-you-want-to-move-the-selected-entries-to-the-recycle-bin") %>')) {
+ if (confirm('<%= UnicodeLanguageUtil.get(pageContext, TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) ? "are-you-sure-you-want-to-move-the-selected-entries-to-the-recycle-bin" : "are-you-sure-you-want-to-delete-the-selected-entries") %>')) {
document.<portlet:namespace />fm.method = "post";
- document.<portlet:namespace />fm.<portlet:namespace /><%= Constants.CMD %>.value = "<%= Constants.MOVE_TO_TRASH %>";
+ document.<portlet:namespace />fm.<portlet:namespace /><%= Constants.CMD %>.value = "<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) ? Constants.MOVE_TO_TRASH :Constants.DELETE %>";
document.<portlet:namespace />fm.<portlet:namespace />deleteEntryIds.value = Liferay.Util.listCheckedExcept(document.<portlet:namespace />fm, "<portlet:namespace />allRowIds");
submitForm(document.<portlet:namespace />fm, "<portlet:actionURL><portlet:param name="struts_action" value="/blogs_admin/edit_entry" /></portlet:actionURL>");
}
@@ -18,7 +18,7 @@
<c:when test="<%= (fileShortcut == null) %>">
<c:if test="<%= showActions && DLFileEntryPermission.contains(permissionChecker, fileEntry, ActionKeys.DELETE) %>">
<c:choose>
- <c:when test="<%= fileEntry.getModel() instanceof DLFileEntry %>">
+ <c:when test="<%= (fileEntry.getModel() instanceof DLFileEntry) && TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) %>">
<portlet:actionURL var="deleteURL">
<portlet:param name="struts_action" value="/document_library/edit_file_entry" />
<portlet:param name="<%= Constants.CMD %>" value="<%= Constants.MOVE_TO_TRASH %>" />
@@ -50,13 +50,13 @@
<c:if test="<%= showActions && DLFileShortcutPermission.contains(permissionChecker, fileShortcut, ActionKeys.DELETE) %>">
<portlet:actionURL var="deleteShortcutURL">
<portlet:param name="struts_action" value="/document_library/edit_file_shortcut" />
- <portlet:param name="<%= Constants.CMD %>" value="<%= Constants.MOVE_TO_TRASH %>" />
+ <portlet:param name="<%= Constants.CMD %>" value="<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) ? Constants.MOVE_TO_TRASH : Constants.DELETE %>" />
<portlet:param name="redirect" value="<%= viewFolderURL.toString() %>" />
<portlet:param name="fileShortcutId" value="<%= String.valueOf(fileShortcut.getFileShortcutId()) %>" />
</portlet:actionURL>
<liferay-ui:icon-delete
- trash="<%= true %>"
+ trash="<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) %>"
url="<%= deleteShortcutURL %>"
/>
</c:if>
@@ -186,12 +186,12 @@ if ((row == null) && (portletName.equals(PortletKeys.DOCUMENT_LIBRARY_DISPLAY) |
<portlet:actionURL var="deleteURL">
<portlet:param name="struts_action" value="/document_library/edit_folder" />
- <portlet:param name="<%= Constants.CMD %>" value="<%= (folder.getModel() instanceof DLFolder) ? Constants.MOVE_TO_TRASH : Constants.DELETE %>" />
+ <portlet:param name="<%= Constants.CMD %>" value="<%= ((folder.getModel() instanceof DLFolder) && TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId())) ? Constants.MOVE_TO_TRASH : Constants.DELETE %>" />
<portlet:param name="redirect" value="<%= (view || folderSelected) ? redirectURL : redirect %>" />
<portlet:param name="folderId" value="<%= String.valueOf(folderId) %>" />
</portlet:actionURL>
- <liferay-ui:icon-delete trash="<%= folder.getModel() instanceof DLFolder %>" url="<%= deleteURL %>" />
+ <liferay-ui:icon-delete trash="<%= ((folder.getModel() instanceof DLFolder) && TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId())) %>" url="<%= deleteURL %>" />
</c:if>
<c:if test="<%= hasDeletePermission && folder.isMountPoint() %>">
@@ -98,6 +98,7 @@ page import="com.liferay.portlet.dynamicdatamapping.util.DDMXSDUtil" %><%@
page import="com.liferay.portlet.dynamicdatamapping.util.comparator.StructureStructureKeyComparator" %><%@
page import="com.liferay.portlet.journal.search.FileEntryDisplayTerms" %><%@
page import="com.liferay.portlet.journal.search.FileEntrySearch" %><%@
+page import="com.liferay.portlet.trash.util.TrashUtil" %><%@
page import="com.liferay.portlet.usersadmin.search.GroupSearch" %>
<%
@@ -81,12 +81,12 @@ Folder folder = (Folder)request.getAttribute("view.jsp-folder");
<c:when test="<%= (folder == null) || (folder.getModel() instanceof DLFolder) %>">
<%
- String taglibURL = "Liferay.fire('" + renderResponse.getNamespace() + "editFileEntry', {action: '" + Constants.MOVE_TO_TRASH + "'});";
+ String taglibURL = "Liferay.fire('" + renderResponse.getNamespace() + "editFileEntry', {action: '" + (TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) ? Constants.MOVE_TO_TRASH : Constants.DELETE) + "'});";
%>
<liferay-ui:icon-delete
- confirmation="are-you-sure-you-want-to-move-the-selected-entries-to-the-recycle-bin"
- trash="<%= true %>"
+ confirmation='<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) ? "are-you-sure-you-want-to-move-the-selected-entries-to-the-recycle-bin" : "are-you-sure-you-want-to-delete-the-selected-entries" %>'
+ trash="<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) %>"
url="<%= taglibURL %>"
/>
</c:when>
@@ -135,7 +135,7 @@
</liferay-ui:search-container-row>
<c:if test="<%= (total > 0) && showActions && showDeleteButton %>">
- <aui:button onClick='<%= renderResponse.getNamespace() + "deleteEntries();" %>' value="move-to-the-recycle-bin" />
+ <aui:button onClick='<%= renderResponse.getNamespace() + "deleteEntries();" %>' value='<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) ? "move-to-the-recycle-bin" : "delete" %>' />
<div class="separator"><!-- --></div>
</c:if>
@@ -149,9 +149,9 @@
window,
'<portlet:namespace />deleteEntries',
function() {
- if (confirm('<%= UnicodeLanguageUtil.get(pageContext, "are-you-sure-you-want-to-move-this-entry-to-the-recycle-bin") %>')) {
+ if (confirm('<%= UnicodeLanguageUtil.get(pageContext, TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) ? "are-you-sure-you-want-to-move-this-entry-to-the-recycle-bin" : "are-you-sure-you-want-to-delete-this-entry") %>')) {
document.<portlet:namespace />fm.method = "post";
- document.<portlet:namespace />fm.<portlet:namespace /><%= Constants.CMD %>.value = "<%= Constants.MOVE_TO_TRASH %>";
+ document.<portlet:namespace />fm.<portlet:namespace /><%= Constants.CMD %>.value = "<%= TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) ? Constants.MOVE_TO_TRASH : Constants.DELETE %>";
document.<portlet:namespace />fm.<portlet:namespace />deleteFileEntryIds.value = Liferay.Util.listCheckedExcept(document.<portlet:namespace />fm, "<portlet:namespace />allRowIds");
submitForm(document.<portlet:namespace />fm, "<portlet:actionURL><portlet:param name="struts_action" value="/document_library_display/edit_file_entry" /></portlet:actionURL>");
}
@@ -936,7 +936,7 @@ request.setAttribute("view_file_entry.jsp-fileEntry", fileEntry);
);
</c:if>
- <c:if test="<%= DLFileEntryPermission.contains(permissionChecker, fileEntry, ActionKeys.DELETE) && (fileEntry.getModel() instanceof DLFileEntry) %>">
+ <c:if test="<%= DLFileEntryPermission.contains(permissionChecker, fileEntry, ActionKeys.DELETE) && (fileEntry.getModel() instanceof DLFileEntry) && TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId()) %>">
fileEntryToolbarChildren.push(
{
<portlet:renderURL var="viewFolderURL">
@@ -957,7 +957,7 @@ request.setAttribute("view_file_entry.jsp-fileEntry", fileEntry);
);
</c:if>
- <c:if test="<%= DLFileEntryPermission.contains(permissionChecker, fileEntry, ActionKeys.DELETE) && !(fileEntry.getModel() instanceof DLFileEntry) %>">
+ <c:if test="<%= DLFileEntryPermission.contains(permissionChecker, fileEntry, ActionKeys.DELETE) && (!(fileEntry.getModel() instanceof DLFileEntry) || !TrashUtil.isTrashEnabled(themeDisplay.getScopeGroupId())) %>">
fileEntryToolbarChildren.push(
{
<portlet:renderURL var="viewFolderURL">
@@ -44,7 +44,8 @@ page import="com.liferay.portlet.documentlibrary.service.permission.DLFileEntryP
page import="com.liferay.portlet.documentlibrary.util.DLUtil" %><%@
page import="com.liferay.portlet.journal.search.FileEntryDisplayTerms" %><%@
page import="com.liferay.portlet.journal.search.FileEntrySearch" %><%@
-page import="com.liferay.portlet.journal.search.FileEntrySearchTerms" %>
+page import="com.liferay.portlet.journal.search.FileEntrySearchTerms" %><%@
+page import="com.liferay.portlet.trash.util.TrashUtil" %>
<%
PortletPreferences preferences = renderRequest.getPreferences();
@@ -43,7 +43,8 @@ page import="com.liferay.portlet.documentlibrary.util.DLUtil" %><%@
page import="com.liferay.portlet.documentlibrary.util.ImageProcessorUtil" %><%@
page import="com.liferay.portlet.documentlibrary.util.PDFProcessorUtil" %><%@
page import="com.liferay.portlet.documentlibrary.util.VideoProcessorUtil" %><%@
-page import="com.liferay.portlet.imagegallerydisplay.util.IGUtil" %>
+page import="com.liferay.portlet.imagegallerydisplay.util.IGUtil" %><%@
+page import="com.liferay.portlet.trash.util.TrashUtil" %>
<%
PortletPreferences preferences = renderRequest.getPreferences();
@@ -26,6 +26,7 @@ page import="com.liferay.portal.security.auth.AuthSettingsUtil" %><%@
page import="com.liferay.portal.security.ldap.LDAPSettingsUtil" %><%@
page import="com.liferay.portal.security.ldap.PortalLDAPUtil" %><%@
page import="com.liferay.portal.servlet.filters.sso.opensso.OpenSSOUtil" %><%@
+page import="com.liferay.portlet.trash.model.TrashConstants" %><%@
page import="com.liferay.util.ldap.LDAPUtil" %>
<%@ page import="java.net.HttpURLConnection" %><%@
@@ -84,6 +84,13 @@ if (group != null) {
miscellaneousSections = PropsValues.SITES_FORM_UPDATE_MISCELLANEOUS;
}
+
+String enableRecycleBin = PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.ENABLE_RECYCLE_BIN);
+
+if (enableRecycleBin.equals(TrashConstants.DISABLED) && ArrayUtil.contains(advancedSections, "recycle-bin")) {
+ advancedSections = ArrayUtil.remove(advancedSections, "recycle-bin");
+}
+
String[][] categorySections = {mainSections, seoSections, advancedSections, miscellaneousSections};
%>
@@ -52,6 +52,7 @@ page import="com.liferay.portlet.sitesadmin.search.TeamSearch" %><%@
page import="com.liferay.portlet.sitesadmin.search.TeamSearchTerms" %><%@
page import="com.liferay.portlet.sitesadmin.search.UserGroupTeamChecker" %><%@
page import="com.liferay.portlet.sitesadmin.search.UserTeamChecker" %><%@
+page import="com.liferay.portlet.trash.model.TrashConstants" %><%@
page import="com.liferay.portlet.usergroupsadmin.search.UserGroupChecker" %><%@
page import="com.liferay.portlet.usergroupsadmin.search.UserGroupGroupChecker" %><%@
page import="com.liferay.portlet.usergroupsadmin.search.UserGroupSearch" %><%@

0 comments on commit 7e0fb2c

Please sign in to comment.