CCM NG/ccm-cms: ContentSectionPage

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4434 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2016-11-09 16:39:22 +00:00
parent 874cc0ff83
commit 4390a92891
4 changed files with 299 additions and 251 deletions

View File

@ -0,0 +1,32 @@
/*
* Copyright (C) 2001-2004 Red Hat 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.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms;
/**
* Specifies the standard locations of the pages that comprise the
* content section user interface.
*
* @author Karl Goldstein (karlg at arsdigita dot com)
*
* @version $Id: PageLocations.java 2090 2010-04-17 08:04:14Z pboy $
**/
public interface PageLocations {
public String SECTION_PAGE = "admin/index.jsp";
public String ITEM_PAGE = "admin/item.jsp";
}

View File

@ -0,0 +1,160 @@
/*
* Copyright (C) 2003-2004 Red Hat 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.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.ui;
import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.PageLocations;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.Folder;
import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.URL;
import org.apache.logging.log4j.LogManager;
import java.math.BigDecimal;
import java.util.List;
import java.util.Stack;
import org.apache.logging.log4j.Logger;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.core.CcmObject;
import org.librecms.contentsection.ContentSectionManager;
import java.util.Optional;
/**
* The context bar of the content section UI.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
* @author Justin Ross
*/
public class ContentSectionContextBar extends WorkspaceContextBar {
private static final Logger LOGGER = LogManager.getLogger(
ContentSectionContextBar.class);
@Override
protected List entries(final PageState state) {
/* Include breadcrumb entries already set by content-center (i.e. the
* URL of the content center itself */
final List entries = super.entries(state);
final ContentSection section = CMS.getContext().getContentSection();
final Stack folderEntryStack = new Stack();
String currentFolderLabel = null;
ParameterMap params = new ParameterMap();
boolean isTemplate = false;
BigDecimal templateID = null;
if (CMS.getContext().hasContentItem()) {
final ContentItem item = CMS.getContext().getContentItem();
if (item == null) {
LOGGER.warn("item is null");
} else if (item.getContentType() == null) {
LOGGER.warn(
"item.getContentType() returns null. item.class.getName(): "
+ item.getClass().getName());
}
//ToDo NG - Not sure what happens here...
// final Optional<CcmObject> parent = item.getParent();
//
// while (!isTemplate
// && parent.isPresent()
// && parent.get() instanceof ContentItem) {
// if (currentFolderLabel != null) {
// final URL folderURL = URL.there
// (state.getRequest(),
// section.getPath() + "/" + PageLocations.SECTION_PAGE,
// params);
// folderEntryStack.push(new Entry(currentFolderLabel, folderURL));
// currentFolderLabel = null;
// params = new ParameterMap();
// }
// final ContentItem pitem = (ContentItem) parent;
//
// if (pitem instanceof Folder) {
// final Folder folder = (Folder) pitem;
// parent = folder.getParent();
//
// currentFolderLabel = folder.getLabel();
// if (parent != null || folder.equals(section.getRootFolder())) {
// params.setParameter
// (ContentSectionPage.SET_FOLDER, folder.getID());
// }
// } else if (pitem instanceof ContentBundle) {
// final ACSObject ppitem = pitem.getParent();
//
// if (ppitem != null && ppitem instanceof Folder) {
// final Folder folder = (Folder) ppitem;
//
// parent = folder.getParent();
// currentFolderLabel = folder.getLabel();
// if (parent != null || folder.equals(section
// .getRootFolder())) {
// params.setParameter
// (ContentSectionPage.SET_FOLDER, folder.getID());
// }
// } else {
// parent = null;
// }
// } else {
// parent = null;
// }
// }
}
if (isTemplate) {
params.setParameter(ContentSectionPage.SET_TAB,
new BigDecimal(
ContentSectionPage.CONTENTTYPES_TAB));
params.setParameter(ContentSectionPage.SET_TEMPLATE, templateID);
}
// add section-level entry. if this is for an item page, the URL
// will be for the root folder.
final URL url = URL.there(
state.getRequest(),
String.format("%s/" + PageLocations.SECTION_PAGE,
section.getPrimaryUrl()),
params);
final String sectionTitle = lz("cms.ui.content_section");
final String title = sectionTitle + ": " + section.getLabel();
entries.add(new Entry(title, url));
// add any folders to the path now
while (!folderEntryStack.empty()) {
entries.add(folderEntryStack.pop());
}
return entries;
}
private static String lz(final String key) {
return (String) ContentSectionPage.globalize(key).localize();
}
}

View File

@ -1,156 +0,0 @@
/*
* Copyright (C) 2003-2004 Red Hat 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.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.ui;
import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.Folder;
import com.arsdigita.cms.PageLocations;
import com.arsdigita.cms.Template;
import com.arsdigita.kernel.ACSObject;
import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.URL;
import java.math.BigDecimal;
import java.util.List;
import java.util.Stack;
import org.apache.log4j.Logger;
/**
* The context bar of the content section UI.
*
* @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: ContentSectionContextBar.java 287 2005-02-22 00:29:02Z sskracic $
*/
// class ContentSectionContextBar extends WorkspaceContextBar {
public class ContentSectionContextBar extends WorkspaceContextBar {
private static final Logger s_log = Logger.getLogger
(ContentSectionContextBar.class);
@Override
protected List entries(final PageState state) {
/* Include breadcrumb entries already set by content-center (i.e. the
* URL of the content center itself */
final List entries = super.entries(state);
final ContentSection section = CMS.getContext().getContentSection();
final Stack folderEntryStack = new Stack();
String currentFolderLabel = null;
ParameterMap params = new ParameterMap();
boolean isTemplate = false;
BigDecimal templateID = null;
if (CMS.getContext().hasContentItem()) {
final ContentItem item = CMS.getContext().getContentItem();
if (item == null) {
s_log.warn("item is null");
} else if(item.getContentType() == null) {
s_log.warn("item.getContentType() returns null. item.class.getName(): "
+ item.getClass().getName());
}
isTemplate =
item.getContentType().equals(ContentType
.findByAssociatedObjectType(Template.BASE_DATA_OBJECT_TYPE));
if (isTemplate) {
templateID = item.getID();
}
ACSObject parent = item.getParent();
while (!isTemplate && parent != null && parent instanceof ContentItem) {
if (currentFolderLabel != null) {
final URL folderURL = URL.there
(state.getRequest(),
section.getPath() + "/" + PageLocations.SECTION_PAGE,
params);
folderEntryStack.push(new Entry(currentFolderLabel, folderURL));
currentFolderLabel = null;
params = new ParameterMap();
}
final ContentItem pitem = (ContentItem) parent;
if (pitem instanceof Folder) {
final Folder folder = (Folder) pitem;
parent = folder.getParent();
currentFolderLabel = folder.getLabel();
if (parent != null || folder.equals(section.getRootFolder())) {
params.setParameter
(ContentSectionPage.SET_FOLDER, folder.getID());
}
} else if (pitem instanceof ContentBundle) {
final ACSObject ppitem = pitem.getParent();
if (ppitem != null && ppitem instanceof Folder) {
final Folder folder = (Folder) ppitem;
parent = folder.getParent();
currentFolderLabel = folder.getLabel();
if (parent != null || folder.equals(section
.getRootFolder())) {
params.setParameter
(ContentSectionPage.SET_FOLDER, folder.getID());
}
} else {
parent = null;
}
} else {
parent = null;
}
}
}
if (isTemplate) {
params.setParameter
( ContentSectionPage.SET_TAB,
new BigDecimal(ContentSectionPage.CONTENTTYPES_TAB) );
params.setParameter(ContentSectionPage.SET_TEMPLATE, templateID);
}
// add section-level entry. if this is for an item page, the URL
// will be for the root folder.
final URL url = URL.there
(state.getRequest(),
section.getPath() + "/" + PageLocations.SECTION_PAGE,
params);
final String sectionTitle = lz("cms.ui.content_section");
final String title = sectionTitle + ": " + section.getName();
entries.add(new Entry(title, url));
// add any folders to the path now
while (!folderEntryStack.empty()) {
entries.add(folderEntryStack.pop());
}
return entries;
}
private static String lz(final String key) {
return (String) ContentSectionPage.globalize(key).localize();
}
}

View File

@ -29,13 +29,14 @@ import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.event.PrintEvent; import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
import com.arsdigita.cms.PageLocations;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import com.arsdigita.cms.dispatcher.CMSPage; import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.ui.category.CategoryAdminPane; //ToDo NG import com.arsdigita.cms.ui.category.CategoryAdminPane;
import com.arsdigita.cms.ui.cse.ContentSoonExpiredPane; //ToDo NG import com.arsdigita.cms.ui.cse.ContentSoonExpiredPane;
import com.arsdigita.cms.ui.folder.FolderAdminPane; import com.arsdigita.cms.ui.folder.FolderAdminPane;
import com.arsdigita.cms.ui.lifecycle.LifecycleAdminPane; import com.arsdigita.cms.ui.lifecycle.LifecycleAdminPane;
import com.arsdigita.cms.ui.role.RoleAdminPane; import com.arsdigita.cms.ui.role.RoleAdminPane;
@ -46,15 +47,20 @@ import com.arsdigita.toolbox.ui.LayoutPanel;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import com.arsdigita.web.Web; import com.arsdigita.web.Web;
import org.apache.logging.log4j.LogManager;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.arsdigita.cms.CMSConfig; import org.arsdigita.cms.CMSConfig;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.security.PermissionChecker; import org.libreccm.security.PermissionChecker;
import org.librecms.CmsConstants; import org.librecms.CmsConstants;
import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contentsection.ContentItemVersion; import org.librecms.contentsection.ContentItemVersion;
import org.librecms.contentsection.ContentSectionConfig; import org.librecms.contentsection.ContentSectionConfig;
import org.librecms.contentsection.privileges.AdminPrivileges;
/** /**
* Contains the entire admin UI for a content section. * Contains the entire admin UI for a content section.
@ -63,18 +69,18 @@ import org.librecms.contentsection.ContentSectionConfig;
* replaced by the newer servlet based model. @see * replaced by the newer servlet based model. @see
* c.ad.cms.ui.contentsection.MainPage (currently not active). * c.ad.cms.ui.contentsection.MainPage (currently not active).
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
* @author Jack Chung * @author Jack Chung
* @author Michael Pih * @author Michael Pih
* @author Xixi D'Moon &lt;xdmoon@redhat.com&gt; * @author Xixi D'Moon
* @author Justin Ross &lt;jross@redhat.com&gt; * @author Justin Ross
* @version $Id: ContentSectionPage.java 2224 2011-08-01 07:45:23Z pboy $
*/ */
public class ContentSectionPage extends CMSPage implements ActionListener { public class ContentSectionPage extends CMSPage implements ActionListener {
private static final Logger s_log = Logger.getLogger( private static final Logger LOGGER = LogManager.getLogger(
ContentSectionPage.class); ContentSectionPage.class);
public static final String RESOURCE_BUNDLE
= "com.arsdigita.cms.CMSResources";
/** /**
* The URL parameter that can be passed in in order to set the current * The URL parameter that can be passed in in order to set the current
* folder. This is used in getting back to the correct level of folder * folder. This is used in getting back to the correct level of folder
@ -123,17 +129,17 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
public static final int USER_ADMIN_TAB = 7; public static final int USER_ADMIN_TAB = 7;
private TabbedPane m_tabbedPane; private TabbedPane m_tabbedPane;
private FolderAdminPane m_folderPane; private FolderAdminPane m_folderPane;
private BrowsePane m_browsePane; //ToDo NG private BrowsePane m_browsePane;
private ItemSearch m_searchPane; //ToDo NG private ItemSearch m_searchPane;
private ImagesPane m_imagesPane; //ToDo NG private ImagesPane m_imagesPane;
private RoleAdminPane m_rolePane; private RoleAdminPane m_rolePane;
private WorkflowAdminPane m_workflowPane; private WorkflowAdminPane m_workflowPane;
private LifecycleAdminPane m_lifecyclePane; private LifecycleAdminPane m_lifecyclePane;
private CategoryAdminPane m_categoryPane; //ToDo NG private CategoryAdminPane m_categoryPane;
private ContentTypeAdminPane m_typePane; private ContentTypeAdminPane m_typePane;
//private LayoutPanel m_userAdminPane; //private LayoutPanel m_userAdminPane;
private LayoutPanel m_csePane; private LayoutPanel m_csePane;
private ReportPane m_reportPane; //ToDo NG private ReportPane m_reportPane;
/** /**
* Creates the content section index page containing - a Navigaton bar for * Creates the content section index page containing - a Navigaton bar for
@ -150,19 +156,19 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
// Initialize the individual panes // Initialize the individual panes
m_folderPane = getFolderAdminPane(); m_folderPane = getFolderAdminPane();
m_browsePane = getBrowsePane(); //ToDo NG m_browsePane = getBrowsePane();
m_searchPane = getSearchPane(); //ToDo NG m_searchPane = getSearchPane();
m_imagesPane = getImagesPane(); //ToDo NG m_imagesPane = getImagesPane();
m_rolePane = getRoleAdminPane(); m_rolePane = getRoleAdminPane();
m_workflowPane = getWorkflowAdminPane(); m_workflowPane = getWorkflowAdminPane();
m_lifecyclePane = getLifecycleAdminPane(); m_lifecyclePane = getLifecycleAdminPane();
m_categoryPane = getCategoryAdminPane(); //ToDo NG m_categoryPane = getCategoryAdminPane();
m_typePane = getContentTypeAdminPane(); m_typePane = getContentTypeAdminPane();
// userAdminPane removed, used to contain just one item (reset user // userAdminPane removed, used to contain just one item (reset user
// folder) which moved to the FolderAdminPane // folder) which moved to the FolderAdminPane
//m_userAdminPane = getUserAdminPane(); //m_userAdminPane = getUserAdminPane();
m_csePane = getCSEPane(); m_csePane = getCSEPane();
m_reportPane = getReportPane(); //ToDo NG m_reportPane = getReportPane();
// The panes // The panes
m_tabbedPane = createTabbedPane(); m_tabbedPane = createTabbedPane();
@ -186,32 +192,32 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
final PermissionChecker permissionChecker = CdiUtil final PermissionChecker permissionChecker = CdiUtil
.createCdiUtil().findBean(PermissionChecker.class); .createCdiUtil().findBean(PermissionChecker.class);
//m_tabbedPane.setTabVisible(state, m_userAdminPane, sm.canAccess(user, SecurityConstants.STAFF_ADMIN));
if (CMSConfig.getConfig().isHideAdminTabs()) { if (CMSConfig.getConfig().isHideAdminTabs()) {
m_tabbedPane.setTabVisible( m_tabbedPane.setTabVisible(
state, state,
m_workflowPane, m_workflowPane,
permissionChecker.isPermitted( permissionChecker.isPermitted(
CmsConstants.PRIVILEGE_ADMINISTER_WORKFLOW)); AdminPrivileges.ADMINISTER_WORKFLOW));
m_tabbedPane.setTabVisible( //ToDo NG
state, m_categoryPane, // m_tabbedPane.setTabVisible(
permissionChecker.isPermitted( // state, m_categoryPane,
CmsConstants.PRIVILEGE_ADMINISTER_CATEGORIES)); // permissionChecker.isPermitted(
// AdminPrivileges.ADMINISTER_CATEGORIES));
m_tabbedPane.setTabVisible( m_tabbedPane.setTabVisible(
state, state,
m_lifecyclePane, m_lifecyclePane,
permissionChecker.isPermitted( permissionChecker.isPermitted(
CmsConstants.PRIVILEGE_ADMINISTER_LIFECYLES)); AdminPrivileges.ADMINISTER_LIFECYLES));
m_tabbedPane.setTabVisible( m_tabbedPane.setTabVisible(
state, state,
m_typePane, m_typePane,
permissionChecker.isPermitted( permissionChecker.isPermitted(
CmsConstants.PRIVILEGE_ADMINISTER_CONTENT_TYPES)); AdminPrivileges.ADMINISTER_CONTENT_TYPES));
m_tabbedPane.setTabVisible( m_tabbedPane.setTabVisible(
state, state,
m_rolePane, m_rolePane,
permissionChecker.isPermitted( permissionChecker.isPermitted(
CmsConstants.PRIVILEGE_ADMINISTER_ROLES)); AdminPrivileges.ADMINISTER_ROLES));
// csePane: should check permission // csePane: should check permission
m_tabbedPane.setTabVisible(state, m_csePane, true); m_tabbedPane.setTabVisible(state, m_csePane, true);
// TODO Check for reportPane as well // TODO Check for reportPane as well
@ -239,34 +245,37 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
* *
* @return * @return
*/ */
protected BrowsePane getBrowsePane() { // ToDo NG
if (m_browsePane == null) { // protected BrowsePane getBrowsePane() {
m_browsePane = new BrowsePane(); // if (m_browsePane == null) {
} // m_browsePane = new BrowsePane();
return m_browsePane; // }
} // return m_browsePane;
// }
/** /**
* Creates, and then caches, the search pane. Overriding this method to * Creates, and then caches, the search pane. Overriding this method to
* return null will prevent this tab from appearing. * return null will prevent this tab from appearing.
* @return * @return
*/ */
protected ItemSearch getSearchPane() { // ToDo NG
if (m_searchPane == null) { // protected ItemSearch getSearchPane() {
m_searchPane // if (m_searchPane == null) {
= new ItemSearch( // m_searchPane
ContentItemVersion.DRAFT.toString(), // = new ItemSearch(
CMSConfig.getConfig().isLimitItemSearchToContentSection()); // ContentItemVersion.DRAFT.toString(),
} // CMSConfig.getConfig().isLimitItemSearchToContentSection());
return m_searchPane; // }
} // return m_searchPane;
// }
protected ImagesPane getImagesPane() { // ToDo NG
if (m_imagesPane == null) { // protected ImagesPane getImagesPane() {
m_imagesPane = new ImagesPane(); // if (m_imagesPane == null) {
} // m_imagesPane = new ImagesPane();
return m_imagesPane; // }
} // return m_imagesPane;
// }
protected RoleAdminPane getRoleAdminPane() { protected RoleAdminPane getRoleAdminPane() {
if (m_rolePane == null) { if (m_rolePane == null) {
@ -301,17 +310,20 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
* Creates, and then caches, the category administration pane. Overriding * Creates, and then caches, the category administration pane. Overriding
* this method to return null will prevent this tab from appearing. * this method to return null will prevent this tab from appearing.
*/ */
protected CategoryAdminPane getCategoryAdminPane() { //ToDo NG
if (m_categoryPane == null) { // protected CategoryAdminPane getCategoryAdminPane() {
m_categoryPane = new CategoryAdminPane(); // if (m_categoryPane == null) {
} // m_categoryPane = new CategoryAdminPane();
return m_categoryPane; // }
} // return m_categoryPane;
// }
/** /**
* Creates, and then caches, the content type administration pane. * Creates, and then caches, the content type administration pane.
* Overriding this method to return null will prevent this tab from * Overriding this method to return null will prevent this tab from
* appearing. * appearing.
*
* @return
*/ */
protected ContentTypeAdminPane getContentTypeAdminPane() { protected ContentTypeAdminPane getContentTypeAdminPane() {
if (m_typePane == null) { if (m_typePane == null) {
@ -332,17 +344,18 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
if (m_csePane == null) { if (m_csePane == null) {
m_csePane = new LayoutPanel(); m_csePane = new LayoutPanel();
m_csePane.setLeft(new SimpleComponent()); m_csePane.setLeft(new SimpleComponent());
m_csePane.setBody(new ContentSoonExpiredPane()); //ToDo NG m_csePane.setBody(new ContentSoonExpiredPane());
} }
return m_csePane; return m_csePane;
} }
protected ReportPane getReportPane() { // ToDo NG
if (m_reportPane == null) { // protected ReportPane getReportPane() {
m_reportPane = new ReportPane(); // if (m_reportPane == null) {
} // m_reportPane = new ReportPane();
return m_reportPane; // }
} // return m_reportPane;
// }
/** /**
* Adds the specified component, with the specified tab name, to the tabbed * Adds the specified component, with the specified tab name, to the tabbed
@ -352,7 +365,9 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
* @param tabName The name of the tab if it's added * @param tabName The name of the tab if it's added
* @param comp The component to add to the pane * @param comp The component to add to the pane
*/ */
protected void addToPane(TabbedPane pane, String tabName, Component comp) { protected void addToPane(final TabbedPane pane,
final String tabName,
final Component comp) {
if (comp != null) { if (comp != null) {
pane.addTab(new Label(tabName), comp); pane.addTab(new Label(tabName), comp);
} }
@ -384,21 +399,17 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
final TabbedPane pane = new TabbedPane(); final TabbedPane pane = new TabbedPane();
//tab(pane, "cms.ui.folders", getFolderAdminPane()); //tab(pane, "cms.ui.folders", getFolderAdminPane());
tab(pane, "cms.ui.browse", getBrowsePane()); // ToDo NG tab(pane, "cms.ui.browse", getBrowsePane());
tab(pane, "cms.ui.search", getSearchPane()); // ToDo NG tab(pane, "cms.ui.search", getSearchPane());
tab(pane, "cms.ui.images", getImagesPane()); // ToDo NG tab(pane, "cms.ui.images", getImagesPane());
tab(pane, "cms.ui.roles", getRoleAdminPane()); tab(pane, "cms.ui.roles", getRoleAdminPane());
tab(pane, "cms.ui.workflows", getWorkflowAdminPane()); tab(pane, "cms.ui.workflows", getWorkflowAdminPane());
tab(pane, "cms.ui.lifecycles", getLifecycleAdminPane()); tab(pane, "cms.ui.lifecycles", getLifecycleAdminPane());
tab(pane, "cms.ui.categories", getCategoryAdminPane()); // ToDo NG tab(pane, "cms.ui.categories", getCategoryAdminPane());
tab(pane, "cms.ui.content_types", getContentTypeAdminPane()); tab(pane, "cms.ui.content_types", getContentTypeAdminPane());
// user admin tab removed from tab bar and the only one widget there
// (reset home folder) moved to folder browser
// tab(pane, "cms.ui.user_admin", getUserAdminPane());
tab(pane, "cms.ui.cse", getCSEPane()); tab(pane, "cms.ui.cse", getCSEPane());
//if (DbHelper.getDatabase() == DbHelper.DB_ORACLE) { // ToDo NG tab(pane, "cms.ui.reports", getReportPane());
tab(pane, "cms.ui.reports", getReportPane());
//}
return pane; return pane;
} }
@ -411,7 +422,7 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
* @return The current content section * @return The current content section
*/ */
@Override @Override
public ContentSection getContentSection(HttpServletRequest request) { public ContentSection getContentSection(final HttpServletRequest request) {
// Resets all content sections associations. // Resets all content sections associations.
ContentSection section = super.getContentSection(request); ContentSection section = super.getContentSection(request);
Assert.exists(section); Assert.exists(section);
@ -425,27 +436,28 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
* @param event The event fired by selecting a tab * @param event The event fired by selecting a tab
*/ */
@Override @Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(final ActionEvent event) {
final PageState state = event.getPageState(); final PageState state = event.getPageState();
final Component pane = m_tabbedPane.getCurrentPane(state); final Component pane = m_tabbedPane.getCurrentPane(state);
if (pane == m_searchPane) { //ToDo NG if (pane == m_searchPane) {
m_searchPane.reset(state); // m_searchPane.reset(state);
} else if (pane == m_imagesPane) { // } else if (pane == m_imagesPane) {
m_imagesPane.reset(state); // m_imagesPane.reset(state);
} else if (pane == m_folderPane) { // } else
if (pane == m_folderPane) {
m_folderPane.reset(state); m_folderPane.reset(state);
} else if (pane == m_browsePane) { //ToDo NG } else if (pane == m_browsePane) {
m_browsePane.reset(state); // m_browsePane.reset(state);
} else if (pane == m_rolePane) { } else if (pane == m_rolePane) {
m_rolePane.reset(state); m_rolePane.reset(state);
} else if (pane == m_workflowPane) { } else if (pane == m_workflowPane) {
m_workflowPane.reset(state); m_workflowPane.reset(state);
} else if (pane == m_lifecyclePane) { } else if (pane == m_lifecyclePane) {
m_lifecyclePane.reset(state); m_lifecyclePane.reset(state);
} else if (pane == m_categoryPane) { //ToDo NG } else if (pane == m_categoryPane) {
m_categoryPane.reset(state); // m_categoryPane.reset(state);
} else if (pane == m_typePane) { } else if (pane == m_typePane) {
m_typePane.reset(state); m_typePane.reset(state);
// } else if (pane == m_userAdminPane) { // } else if (pane == m_userAdminPane) {
@ -463,18 +475,18 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
* *
* @return * @return
*/ */
public static String getSectionURL(ContentItem item, int tab) { public static String getSectionURL(final ContentItem item, final int tab) {
// Get the content section associated with the content item. // Get the content section associated with the content item.
ContentSection section = ContentSection.getContentSection(item); final ContentSection section = item.getContentType().getContentSection();
String url = section.getURL() + PageLocations.SECTION_PAGE final String url = section.getPrimaryUrl() + PageLocations.SECTION_PAGE
+ "?" + SET_TAB + "=" + tab; + "?" + SET_TAB + "=" + tab;
return url; return url;
} }
private static GlobalizedMessage gz(final String key) { private static GlobalizedMessage gz(final String key) {
return new GlobalizedMessage(key, RESOURCE_BUNDLE); return new GlobalizedMessage(key, CmsConstants.CMS_BUNDLE);
} }
/** /**
@ -487,7 +499,7 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
* @pre key != null * @pre key != null
*/ */
public static GlobalizedMessage globalize(final String key) { public static GlobalizedMessage globalize(final String key) {
return new GlobalizedMessage(key, RESOURCE_BUNDLE); return new GlobalizedMessage(key, CmsConstants.CMS_BUNDLE);
} }
/** /**
@ -499,7 +511,7 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
*/ */
public static GlobalizedMessage globalize(final String key, public static GlobalizedMessage globalize(final String key,
final Object[] args) { final Object[] args) {
return new GlobalizedMessage(key, RESOURCE_BUNDLE, args); return new GlobalizedMessage(key, CmsConstants.CMS_BUNDLE, args);
} }
/** /**
@ -510,13 +522,13 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
/** /**
* *
* @param e * @param event
*/ */
@Override @Override
public void prepare(PrintEvent e) { public void prepare(final PrintEvent event) {
final Label l = (Label) e.getTarget(); final Label l = (Label) event.getTarget();
l.setLabel(CMS.getContext().getContentSection().getName()); l.setLabel(CMS.getContext().getContentSection().getLabel());
} }
} }