001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.ui.apps; 029 030import org.opencms.main.CmsLog; 031import org.opencms.ui.actions.CmsAboutDialogAction; 032import org.opencms.ui.actions.CmsAvailabilityDialogAction; 033import org.opencms.ui.actions.CmsCategoriesDialogAction; 034import org.opencms.ui.actions.CmsChangeTypeDialogAction; 035import org.opencms.ui.actions.CmsContextMenuActionItem; 036import org.opencms.ui.actions.CmsCopyDialogAction; 037import org.opencms.ui.actions.CmsCopyToProjectDialogAction; 038import org.opencms.ui.actions.CmsDeleteDialogAction; 039import org.opencms.ui.actions.CmsDirectPublishDialogAction; 040import org.opencms.ui.actions.CmsDisplayAction; 041import org.opencms.ui.actions.CmsEditCodeDialogAction; 042import org.opencms.ui.actions.CmsEditContentAction; 043import org.opencms.ui.actions.CmsEditDialogAction; 044import org.opencms.ui.actions.CmsEditPageAction; 045import org.opencms.ui.actions.CmsEditPointerAction; 046import org.opencms.ui.actions.CmsEditPropertyAction; 047import org.opencms.ui.actions.CmsEditSmallElementsAction; 048import org.opencms.ui.actions.CmsFormEditDialogAction; 049import org.opencms.ui.actions.CmsGalleryDialogAction; 050import org.opencms.ui.actions.CmsGalleryOptimizeDialogAction; 051import org.opencms.ui.actions.CmsHistoryDialogAction; 052import org.opencms.ui.actions.CmsLinkLocaleVariantAction; 053import org.opencms.ui.actions.CmsLockAction; 054import org.opencms.ui.actions.CmsLockedResourcesAction; 055import org.opencms.ui.actions.CmsLogoutAction; 056import org.opencms.ui.actions.CmsMoveDialogAction; 057import org.opencms.ui.actions.CmsPermissionDialogAction; 058import org.opencms.ui.actions.CmsPrefillPageAction; 059import org.opencms.ui.actions.CmsPreviewAction; 060import org.opencms.ui.actions.CmsProjectDialogAction; 061import org.opencms.ui.actions.CmsPropertiesDialogAction; 062import org.opencms.ui.actions.CmsPublishQueueDialogAction; 063import org.opencms.ui.actions.CmsPublishScheduledDialogAction; 064import org.opencms.ui.actions.CmsReindexDialogAction; 065import org.opencms.ui.actions.CmsRenameAction; 066import org.opencms.ui.actions.CmsReplaceDialogAction; 067import org.opencms.ui.actions.CmsResourceInfoAction; 068import org.opencms.ui.actions.CmsRestoreDeletedAction; 069import org.opencms.ui.actions.CmsSecureExportDialogAction; 070import org.opencms.ui.actions.CmsSelectElementViewAction; 071import org.opencms.ui.actions.CmsSeoAction; 072import org.opencms.ui.actions.CmsShowLocaleAction; 073import org.opencms.ui.actions.CmsSiteDialogAction; 074import org.opencms.ui.actions.CmsSitemapAliasAction; 075import org.opencms.ui.actions.CmsSitemapAttributeEditorAction; 076import org.opencms.ui.actions.CmsSitemapEditConfigAction; 077import org.opencms.ui.actions.CmsSitemapOpenParentAction; 078import org.opencms.ui.actions.CmsSitemapRefreshAction; 079import org.opencms.ui.actions.CmsStealLockAction; 080import org.opencms.ui.actions.CmsTemplateContextsAction; 081import org.opencms.ui.actions.CmsTouchDialogAction; 082import org.opencms.ui.actions.CmsUndeleteDialogAction; 083import org.opencms.ui.actions.CmsUndoDialogAction; 084import org.opencms.ui.actions.CmsUnlinkLocaleVariantAction; 085import org.opencms.ui.actions.CmsUnlockAction; 086import org.opencms.ui.actions.CmsUnusedContentFinderAction; 087import org.opencms.ui.actions.CmsViewInExplorerAction; 088import org.opencms.ui.actions.CmsViewOnlineAction; 089import org.opencms.ui.actions.CmsWorkplaceAction; 090import org.opencms.ui.components.CmsResourceTableProperty; 091import org.opencms.ui.contextmenu.CmsSubmenu; 092import org.opencms.ui.contextmenu.I_CmsContextMenuItem; 093import org.opencms.ui.contextmenu.I_CmsContextMenuItemProvider; 094import org.opencms.xml.templatemapper.CmsTemplateMapperAction; 095 096import java.util.Arrays; 097import java.util.Collections; 098import java.util.List; 099 100import org.apache.commons.logging.Log; 101 102/** 103 * Default implementation of menu item provider.<p> 104 */ 105public class CmsDefaultMenuItemProvider implements I_CmsContextMenuItemProvider { 106 107 /** The advanced menu id. */ 108 public static final String ADVANCED_MENU_ID = "advanced"; 109 110 /** Logger instance for this class. */ 111 static final Log LOG = CmsLog.getLog(CmsDefaultMenuItemProvider.class); 112 113 /** The menu items. */ 114 private static final List<I_CmsContextMenuItem> MENU_ITEMS; 115 116 static { 117 CmsSubmenu advanced = new CmsSubmenu(ADVANCED_MENU_ID, null, "%(key.GUI_EXPLORER_CONTEXT_ADVANCED_0)", 2410, 0); 118 // the entries in this list will be sorted by there order property 119 // for better readability please place additional entries according to this sort order 120 List<I_CmsContextMenuItem> items = Arrays.<I_CmsContextMenuItem> asList( 121 122 // hack: the prefill action must come first because it requires some special processing on the client 123 new CmsContextMenuActionItem(new CmsPrefillPageAction(), null, 0, 0), 124 125 new CmsContextMenuActionItem(new CmsSiteDialogAction(), null, 10, 0), 126 new CmsContextMenuActionItem(new CmsEditPageAction(), null, 10, 0), 127 new CmsContextMenuActionItem(new CmsEditDialogAction(), null, 50, 0), 128 new CmsContextMenuActionItem(new CmsEditPointerAction(), null, 50, 0), 129 new CmsContextMenuActionItem(new CmsViewOnlineAction(), null, 75, 0), 130 new CmsContextMenuActionItem(new CmsEditContentAction(), null, 75, 0), 131 new CmsContextMenuActionItem(new CmsPreviewAction(), null, 75, 0), 132 new CmsContextMenuActionItem(new CmsDisplayAction(), null, 75, 0), 133 new CmsContextMenuActionItem(new CmsSitemapOpenParentAction(), null, 75, 0), 134 new CmsContextMenuActionItem(new CmsSitemapRefreshAction(), null, 100, 0), 135 new CmsContextMenuActionItem(new CmsLockAction(), null, 100, 0), 136 new CmsContextMenuActionItem(new CmsUnlockAction(), null, 100, 0), 137 new CmsContextMenuActionItem(new CmsStealLockAction(), null, 100, 0), 138 new CmsContextMenuActionItem(new CmsLockedResourcesAction(), null, 120, 0), 139 new CmsContextMenuActionItem(new CmsGalleryDialogAction(), null, 130, 0), 140 new CmsContextMenuActionItem(new CmsGalleryOptimizeDialogAction(), null, 131, 0), 141 new CmsContextMenuActionItem(new CmsCopyToProjectDialogAction(), null, 150, 0), 142 new CmsContextMenuActionItem(new CmsViewInExplorerAction(), null, 200, 0), 143 new CmsContextMenuActionItem(new CmsDirectPublishDialogAction(), null, 300, 0), 144 new CmsContextMenuActionItem(new CmsPublishScheduledDialogAction(), null, 400, 0), 145 new CmsContextMenuActionItem(new CmsCopyDialogAction(), null, 900, 0), 146 new CmsContextMenuActionItem(new CmsMoveDialogAction(), null, 1000, 0), 147 new CmsContextMenuActionItem( 148 new CmsEditPropertyAction( 149 CmsResourceTableProperty.PROPERTY_RESOURCE_NAME, 150 Messages.GUI_EXPLORER_RENAME_0), 151 null, 152 1100, 153 0), 154 new CmsContextMenuActionItem(new CmsRenameAction(), null, 1100, 0), 155 new CmsContextMenuActionItem(new CmsDeleteDialogAction(), null, 1700, 0), 156 new CmsContextMenuActionItem(new CmsReplaceDialogAction(), null, 1800, 0), 157 new CmsContextMenuActionItem(new CmsUndoDialogAction(), null, 1900, 0), 158 new CmsContextMenuActionItem(new CmsTemplateContextsAction(1), null, 1910, 0), 159 new CmsContextMenuActionItem(new CmsShowLocaleAction(), null, 1925, 0), 160 new CmsContextMenuActionItem(new CmsSelectElementViewAction(), null, 1950, 0), 161 162 new CmsContextMenuActionItem(new CmsTemplateContextsAction(0), null, 1975, 0), 163 164 new CmsContextMenuActionItem(new CmsEditSmallElementsAction(), null, 2000, 0), 165 new CmsContextMenuActionItem(new CmsUndeleteDialogAction(), null, 2100, 0), 166 new CmsContextMenuActionItem(new CmsResourceInfoAction(), null, 2200, 0), 167 new CmsContextMenuActionItem(new CmsCategoriesDialogAction(), null, 2300, 0), 168 new CmsContextMenuActionItem(new CmsPermissionDialogAction(), null, 2400, 0), 169 170 advanced, 171 new CmsContextMenuActionItem(new CmsTouchDialogAction(), advanced.getId(), 170, 0), 172 173 new CmsContextMenuActionItem(new CmsAvailabilityDialogAction(), advanced.getId(), 300, 0), 174 175 new CmsContextMenuActionItem(new CmsSecureExportDialogAction(), advanced.getId(), 500, 0), 176 new CmsContextMenuActionItem(new CmsChangeTypeDialogAction(), advanced.getId(), 700, 0), 177 new CmsContextMenuActionItem(new CmsFormEditDialogAction(), advanced.getId(), 800, 0), 178 new CmsContextMenuActionItem(new CmsEditCodeDialogAction(), advanced.getId(), 900, 0), 179 new CmsContextMenuActionItem(new CmsUnusedContentFinderAction(), advanced.getId(), 920, 0), 180 new CmsContextMenuActionItem(new CmsReindexDialogAction(), advanced.getId(), 950, 0), 181 new CmsContextMenuActionItem(new CmsRestoreDeletedAction(), advanced.getId(), 1000, 0), 182 183 new CmsContextMenuActionItem(new CmsLinkLocaleVariantAction(), advanced.getId(), 1100, 0), 184 new CmsContextMenuActionItem(new CmsUnlinkLocaleVariantAction(), advanced.getId(), 1150, 0), 185 new CmsContextMenuActionItem(new CmsSeoAction(), advanced.getId(), 1200, 0), 186 new CmsContextMenuActionItem(new CmsWorkplaceAction(), advanced.getId(), 1300, 0), 187 188 new CmsContextMenuActionItem(new CmsSitemapAttributeEditorAction(), advanced.getId(), 1500, 0), 189 new CmsContextMenuActionItem(new CmsSitemapEditConfigAction(), advanced.getId(), 1520, 0), 190 new CmsContextMenuActionItem(new CmsSitemapAliasAction(), advanced.getId(), 1600, 0), 191 new CmsContextMenuActionItem(new CmsTemplateMapperAction(), advanced.getId(), 1700, 0), 192 193 new CmsContextMenuActionItem(new CmsHistoryDialogAction(), null, 2450, 0), 194 new CmsContextMenuActionItem(new CmsPropertiesDialogAction(), null, 2500, 0), 195 196 // toolbar menu entries 197 new CmsContextMenuActionItem(new CmsProjectDialogAction(), null, 3100, 0), 198 new CmsContextMenuActionItem(new CmsPublishQueueDialogAction(), null, 3500, 0), 199 new CmsContextMenuActionItem(new CmsAboutDialogAction(), null, 3900, 0), 200 new CmsContextMenuActionItem(new CmsLogoutAction(), null, 4100, 0)); 201 MENU_ITEMS = Collections.unmodifiableList(items); 202 } 203 204 /** 205 * Creates a new instance.<p> 206 */ 207 public CmsDefaultMenuItemProvider() { 208 209 // default constructor, do nothing 210 } 211 212 /** 213 * @see org.opencms.ui.contextmenu.I_CmsContextMenuItemProvider#getMenuItems() 214 */ 215 public List<I_CmsContextMenuItem> getMenuItems() { 216 217 return MENU_ITEMS; 218 } 219}