diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/dispatcher/CMSPage.java b/ccm-cms/src/main/java/com/arsdigita/cms/dispatcher/CMSPage.java
index 5ba7e4c3e..dd8d401af 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/dispatcher/CMSPage.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/dispatcher/CMSPage.java
@@ -220,7 +220,7 @@ public class CMSPage extends Page implements ResourceHandler {
public ContentSection getContentSection(HttpServletRequest request) {
// Resets all content sections associations.
// return ContentSectionDispatcher.getContentSection(request);
- return ContentSectionServlet.getContentSection(request);
+ throw new UnsupportedOperationException();
}
/**
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/dispatcher/ContentPanel.java b/ccm-cms/src/main/java/com/arsdigita/cms/dispatcher/ContentPanel.java
index 920538f65..200f1cd46 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/dispatcher/ContentPanel.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/dispatcher/ContentPanel.java
@@ -27,11 +27,8 @@ import com.arsdigita.xml.Element;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection;
-import org.librecms.contentsection.ContentSectionServlet;
import org.librecms.dispatcher.ItemResolver;
-import java.util.logging.Level;
-import java.util.logging.Logger;
/**
*
@@ -114,7 +111,7 @@ public class ContentPanel extends SimpleComponent {
String url = DispatcherHelper.getRequestContext().getRemainingURLPart();
if (url.startsWith(CMSDispatcher.PREVIEW)) {
pathInfo.newChildElement("cms:previewPath", CMS.CMS_XML_NS).setText(
- ContentSectionServlet.PREVIEW);
+ "preview");
}
pathInfo.newChildElement("cms:templatePrefix", CMS.CMS_XML_NS).setText(
"/" + ItemResolver.TEMPLATE_CONTEXT_PREFIX);
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/BaseAdminPane.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/BaseAdminPane.java
deleted file mode 100755
index 56b689a10..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/BaseAdminPane.java
+++ /dev/null
@@ -1,94 +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.Component;
-import com.arsdigita.bebop.SingleSelectionModel;
-import com.arsdigita.bebop.list.ListModelBuilder;
-import com.arsdigita.bebop.tree.TreeModelBuilder;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.SelectionPanel;
-
-import org.librecms.CmsConstants;
-
-/**
- * A base component for use in CMS admin panes.
- *
- * @param Type managed by the {@link SingleSelectionModel} used by instances
- * of this class.
- *
- * @author Justin Ross <jross@redhat.com>
- */
-public abstract class BaseAdminPane extends SelectionPanel {
-
- protected BaseAdminPane() {
- super();
- }
-
- protected BaseAdminPane(final Component title,
- final Component selector) {
- super(title, selector);
- }
-
- protected BaseAdminPane(final GlobalizedMessage title,
- final Component selector) {
- super(title, selector);
- }
-
- protected BaseAdminPane(final Component title,
- final Component selector,
- final SingleSelectionModel model) {
- super(title, selector, model);
- }
-
- protected BaseAdminPane(final GlobalizedMessage title,
- final Component selector,
- final SingleSelectionModel model) {
- super(title, selector, model);
- }
-
- protected BaseAdminPane(final Component title,
- final ListModelBuilder builder) {
- super(title, builder);
- }
-
- protected BaseAdminPane(final GlobalizedMessage title,
- final ListModelBuilder builder) {
- super(title, builder);
- }
-
- protected BaseAdminPane(final Component title,
- final TreeModelBuilder builder) {
- super(title, builder);
- }
-
- protected BaseAdminPane(final GlobalizedMessage title,
- final TreeModelBuilder builder) {
- super(title, builder);
- }
-
- protected static GlobalizedMessage gz(final String key) {
- return new GlobalizedMessage(key, CmsConstants.CMS_BUNDLE);
- }
-
- protected static String lz(final String key) {
- return (String) gz(key).localize();
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/BrowsePane.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/BrowsePane.java
deleted file mode 100755
index 3b51b3954..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/BrowsePane.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.ui;
-
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Resettable;
-import com.arsdigita.bebop.SegmentedPanel;
-import com.arsdigita.bebop.SingleSelectionModel;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.event.ActionEvent;
-import com.arsdigita.bebop.event.ActionListener;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.LayoutPanel;
-
-import org.libreccm.categorization.Category;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.librecms.CmsConstants;
-import org.librecms.contentsection.ContentSection;
-import org.librecms.contentsection.Folder;
-
-import java.util.List;
-
-/**
- * A pane that contains a folder tree on the left and a folder manipulator on
- * the right. It is a part of the content section main page and is displayed as
- * the "Browse" tab.
- *
- * @author David LutterKort <dlutter@redhat.com>
- * @author Jens Pelzetter
- */
-public class BrowsePane extends LayoutPanel implements Resettable {
-
- private SingleSelectionModel selectionModel;
- private FlatItemList flatItemList;
-
- public BrowsePane() {
-
-
- final SegmentedPanel left = new SegmentedPanel();
- setLeft(left);
-
- final Label heading = new Label(
- new GlobalizedMessage("cms.ui.folder_browser",
- CmsConstants.CMS_BUNDLE));
- }
-
- @Override
- public final void register(final Page page) {
- super.register(page);
-
- page.addActionListener(new FolderListener());
- page.addActionListener(new TreeListener());
- }
-
- @Override
- public final void reset(final PageState state) {
- super.reset(state);
-
- flatItemList.reset(state);
- }
-
- // Private classes and methods
- /**
- *
- */
- private final class ProcessListener implements FormProcessListener {
-
- @Override
- public final void process(final FormSectionEvent event) {
- final PageState state = event.getPageState();
-
- }
-
- }
-
- private final class SubmissionListener implements FormSubmissionListener {
-
- @Override
- public final void submitted(final FormSectionEvent event) {
- final PageState state = event.getPageState();
-
-
- }
-
- }
-
- private final class FolderListener implements ActionListener {
-
- @Override
- public final void actionPerformed(final ActionEvent event) {
- final PageState state = event.getPageState();
-
- if (!selectionModel.isSelected(state)) {
- final String folder = state
- .getRequest()
- .getParameter(ContentSectionPage.SET_FOLDER);
-
- if (folder == null) {
- final Category root = CMS
- .getContext()
- .getContentSection()
- .getRootDocumentsFolder();
- final Long folderID = root.getObjectId();
-
- /*
- ToDo
- User user = Web.getWebContext().getUser();
- if (user != null) {
- Folder homeFolder = Folder.getUserHomeFolder(
- user, CMS.getContext().getContentSection());
- if (homeFolder != null) {
- folderID = homeFolder.getID();
- }
-
- }*/
- selectionModel.setSelectedKey(state, folderID);
- } else {
- selectionModel.setSelectedKey(state, Long.parseLong(folder));
- }
- }
- }
-
- }
-
- private final class TreeListener implements ActionListener {
-
- @Override
- public final void actionPerformed(final ActionEvent event) {
- final PageState state = event.getPageState();
-
- final Category root = CMS
- .getContext()
- .getContentSection()
- .getRootDocumentsFolder();
-
- }
-
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/CMSApplicationPage.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/CMSApplicationPage.java
deleted file mode 100644
index a39a58456..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/CMSApplicationPage.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (C) 2016 LibreCCM Foundation.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-package com.arsdigita.cms.ui;
-
-import com.arsdigita.bebop.BebopConfig;
-import com.arsdigita.bebop.Container;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.page.PageTransformer;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.templating.PresentationManager;
-import com.arsdigita.xml.Document;
-import com.arsdigita.xml.Element;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.Shiro;
-import org.libreccm.security.User;
-import org.libreccm.web.CcmApplication;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * A CMSApplicationPage is a Bebop {@link com.arsdigita.bebop.Page}
- * implementation serving as a base for any CMS pageElement served by a servlet.
- *
- * It stores the current {@link com.arsdigita.cms.ContentSection} and, if
- * applicable, the {@link com.arsdigita.cms.ContentItem} in the pageElement
- * state as request local objects. Components that are part of the
- * CMSPage may access these objects by calling:
- *
- * getContentSection(PageState state);
- *
- *
- * @author Michael Pih (pihman@arsdigita.com)
- * @author Uday Mathur (umathur@arsdigita.com)
- * @author Jens Pelzetter
- */
-public class CMSApplicationPage extends Page {
-
- private static final Logger LOGGER = LogManager.getLogger(
- CMSApplicationPage.class);
-
- /**
- * The global assets URL stub XML parameter name.
- */
- public final static String ASSETS = "ASSETS";
-
- /**
- * The XML pageElement class.
- */
- public final static String PAGE_CLASS = "CMS";
-
- /**
- * Map of XML parameters
- */
- private Map parameters;
-
- /**
- *
- */
- private PageTransformer pageTransformer;
-
- public CMSApplicationPage() {
- super();
- buildPage();
- }
-
- public CMSApplicationPage(final String title) {
- super(title);
- buildPage();
- }
-
- public CMSApplicationPage(final String title, final Container panel) {
- super(title, panel);
- buildPage();
- }
-
- public CMSApplicationPage(final Label title) {
- super(title);
- buildPage();
- }
-
- public CMSApplicationPage(final Label title, final Container panel) {
- super(title, panel);
- buildPage();
- }
-
- /**
- * Builds the pageElement.
- */
- private void buildPage() {
-
- // Set the class attribute value (down in SimpleComponent).
- setClassAttr(PAGE_CLASS);
-
- // Global XML params.
- // MP: This only works with older versions of Xalan.
- parameters = new HashMap<>();
- setXMLParameter(ASSETS, Utilities.getGlobalAssetsURL());
-
- // MP: This is a hack to so that the XML params work with the newer
- // version of Xalan.
- setAttribute(ASSETS, Utilities.getGlobalAssetsURL());
-
- // Make sure the error display gets rendered.
- getErrorDisplay().setIdAttr("page-body");
-
- final Class presenterClass = BebopConfig
- .getConfig()
- .getPresenterClass();
- final PresentationManager presenter;
- try {
- presenter = presenterClass.getDeclaredConstructor().newInstance();
- } catch (InstantiationException
- | IllegalAccessException
- | NoSuchMethodException
- | InvocationTargetException ex) {
- throw new RuntimeException("Failed to create PresentationManager",
- ex);
- }
-
- if (presenter instanceof PageTransformer) {
- pageTransformer = (PageTransformer) presenter;
- } else {
- pageTransformer = new PageTransformer();
- }
- }
-
- /**
- * Finishes and locks the pageElement. If the pageElement is already locked,
- * does nothing.
- *
- * Client classes may overwrite this method to add context specific bits to
- * the page before it is locked.
- *
- * This method is called by the various servlets serving the various pages
- * of the CMS package, before serving and displaying the page.
- *
- * @param request
- * @param response
- * @param app
- */
- public synchronized void init(final HttpServletRequest request,
- final HttpServletResponse response,
- final CcmApplication app) {
- LOGGER.debug("Initializing the page");
-
- if (!isLocked()) {
- LOGGER.debug("The page hasn't been locked; locking it now");
-
- lock();
- }
- }
-
- /**
- * Fetches the value of the XML parameter.
- *
- * @param name The parameter name
- *
- * @return The parameter value
- *
- * @pre (name != null)
- */
- public String getXMLParameter(final String name) {
- return parameters.get(name);
- }
-
- /**
- * Set an XML parameter.
- *
- * @param name The parameter name
- * @param value The parameter value
- *
- * @pre (name != null)
- */
- public void setXMLParameter(String name, String value) {
- parameters.put(name, value);
- }
-
- /**
- * Overwrites bebop.Page#generateXMLHelper to add the name of the user
- * logged in to the pageElement (displayed as part of the header).
- *
- * @param state
- * @param parent
- *
- * @return pageElement for use in generateXML
- */
- @Override
- protected Element generateXMLHelper(final PageState state,
- final Document parent) {
-
- /* Retain elements already included. */
- Element pageElement = super.generateXMLHelper(state, parent);
-
- /* Add name of user logged in. */
- // Note: There are at least 2 ways in the API to determin the user
- // TODO: Check for differences, determin the best / recommended way and
- // document it in the classes. Probably remove one ore the other
- // way from the API if possible.
- final Shiro shiro = CdiUtil.createCdiUtil().findBean(Shiro.class);
- final Optional user = shiro.getUser();
- // User user = Web.getWebContext().getUser();
- if (user.isPresent()) {
- pageElement.addAttribute("name", user.get().getName());
- }
-
- return pageElement;
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/CategoryForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/CategoryForm.java
deleted file mode 100755
index 5b4a66e00..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/CategoryForm.java
+++ /dev/null
@@ -1,481 +0,0 @@
-/*
- * 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.ui;
-
-import com.arsdigita.bebop.*;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormValidationListener;
-import com.arsdigita.bebop.event.PrintEvent;
-import com.arsdigita.bebop.event.PrintListener;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.form.OptionGroup;
-import com.arsdigita.bebop.form.SingleSelect;
-import com.arsdigita.bebop.form.Submit;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.bebop.util.GlobalizationUtil;
-import com.arsdigita.bebop.util.SequentialMap;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.Globalization;
-import com.arsdigita.util.StringUtils;
-import com.arsdigita.util.UncheckedWrapperException;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.libreccm.categorization.Category;
-import org.libreccm.categorization.CategoryManager;
-import org.libreccm.categorization.CategoryRepository;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.core.CcmObject;
-
-import javax.enterprise.inject.spi.CDI;
-import java.math.BigDecimal;
-import java.util.*;
-
-/**
- * This is an abstract class which displays the category assignment UI.
- *
- * Displays two listboxes for assigning categories to items, with two
- * submit buttons to move categories back and forth. The left
- * listbox displays all available categories which have not been
- * assigned to the current item. The right listbox displays all categories
- * assigned to the current item.
- *
- *
- *
- * @author Stanislav Freidin (sfreidin@arsdigita.com)
- * @author Yannick Bülter
- */
-public abstract class CategoryForm extends Form
- implements FormProcessListener, FormValidationListener {
-
- private static final Logger LOGGER = LogManager.getLogger(
- CategoryForm.class);
- private static final String SEPARATOR = ">";
- public static final String FREE = "free";
- public static final String ASSIGNED = "assigned";
- public static final String ASSIGN = "assign";
- public static final String REMOVE = "remove";
- public static final int SELECT_WIDTH = 30;
- public static final int SELECT_HEIGHT = 10;
- public static final String FILLER_OPTION = StringUtils.repeat("_", SELECT_WIDTH);
-
- private final RequestLocal m_assigned;
- private Submit m_assign, m_remove;
-
- private final Label m_freeLabel;
- private final Label m_assignedLabel;
-
- /**
- * Construct a new CategoryForm component
- *
- * @param name the name of the form
- */
- public CategoryForm(String name) {
- super(name, new ColumnPanel(3));
-
- ColumnPanel panel = (ColumnPanel) getPanel();
- panel.setBorder(false);
- panel.setPadColor("#FFFFFF");
- panel.setColumnWidth(1, "0%");
- panel.setColumnWidth(2, "0%");
- panel.setColumnWidth(3, "0");
- panel.setWidth("0%");
- panel.setClassAttr("CMS Admin");
-
- // Create the request local
- m_assigned = new RequestLocal() {
-
- @Override
- public Object initialValue(PageState state) {
- CategoryMap m = new CategoryMap();
- initAssignedCategories(state, m);
- return m;
- }
- };
-
- // Top row
- m_freeLabel = new Label(GlobalizationUtil.globalize("cms.ui.item.categories.available"), false);
- m_freeLabel.setFontWeight(Label.BOLD);
- add(m_freeLabel, ColumnPanel.LEFT);
-
- //add(new Label(" ", false));
- add(new Embedded(" ", false));
-
- m_assignedLabel = new Label(GlobalizationUtil.globalize("cms.ui.item.categories.assigned"), false);
- m_assignedLabel.setFontWeight(Label.BOLD);
- add(m_assignedLabel, ColumnPanel.LEFT);
-
- // Middle Row
- SingleSelect freeWidget = new SingleSelect(new BigDecimalParameter(FREE));
- try {
- freeWidget.addPrintListener(new FreePrintListener());
- } catch (TooManyListenersException e) {
- UncheckedWrapperException.throwLoggedException(getClass(), "Too many listeners", e);
- }
- freeWidget.setSize(SELECT_HEIGHT);
- add(freeWidget);
-
- BoxPanel box = new BoxPanel(BoxPanel.VERTICAL, true);
- box.setWidth("2%");
- addSubmitButtons(box);
- add(box, ColumnPanel.CENTER | ColumnPanel.MIDDLE);
-
- SingleSelect assignedWidget =
- new SingleSelect(new BigDecimalParameter(ASSIGNED));
- try {
- assignedWidget.addPrintListener(new AssignedPrintListener());
- } catch (TooManyListenersException e) {
- UncheckedWrapperException.throwLoggedException(getClass(), "Too many listeners", e);
- }
- assignedWidget.setSize(SELECT_HEIGHT);
- add(assignedWidget);
-
- // Add listeners
- addProcessListener(this);
- addValidationListener(this);
-
- setClassAttr("CategoryForm");
- }
-
- protected void addSubmitButtons(Container c) {
- addAssignButton(c);
- addRemoveButton(c);
- }
-
- protected void addAssignButton(Container c) {
- m_assign = new Submit(ASSIGN, ">>");
- m_assign.setSize(10);
- c.add(m_assign);
- }
-
- protected void addRemoveButton(Container c) {
- m_remove = new Submit(REMOVE, "<<");
- m_remove.setSize(10);
- c.add(m_remove);
- }
-
- /**
- * Set the caption of the unassigned categories label
- *
- * @param caption the new caption
- */
- public void setUnassignedCaption(String caption) {
- m_freeLabel.setLabel(caption);
- }
-
- /**
- * Set the caption of the assigned categories label
- *
- * @param caption the new caption
- */
- public void setAssignedCaption(String caption) {
- m_assignedLabel.setLabel(caption);
- }
-
- /**
- * @param s the page state
- * @return a {@link CategoryMap} of all assigned categories
- */
- public CategoryMap getAssignedCategories(PageState s) {
- return (CategoryMap) m_assigned.get(s);
- }
-
- // A print listener which populates the listbox with all
- // unassigned categories, apart from result of getExcludedCategory()
- // (if not null), and the root category.
- // Ordering is alphabetical based on qualified path, so entries are
- // ordered like a tree with all nodes expanded.
- // Ideally ordering should be like an expanded tree but based on
- // the sortkey order of the categories. However, I don't know
- // if it would be possible to write a comparison function that
- // could do this efficiently, and I'm not even going to try
- // chris.gilbert@westsussex.gov.uk
- //
- private class FreePrintListener implements PrintListener {
-
- @Override
- public void prepare(PrintEvent e) {
-
- OptionGroup target = (OptionGroup) e.getTarget();
- target.clearOptions();
- PageState state = e.getPageState();
-// Category root = getRootCategory(state);
-// if (root == null) {
-// return;
-// }
-
- // exclude children of the excluded category (as per javadoc on
- // getExcludedCategory() method. This prevents attempts
- // to create circular category graph (which causes
- // exception in Category during addMapping if not checked here
- Category excludedCat = getExcludedCategory(state);
- CategoryMap excluded = new CategoryMap();
- if (excludedCat != null) {
- java.util.List excludedSubTree = getExcludedCategory(state).getSubCategories();
- excludedSubTree.forEach(excluded::add);
- }
- CategoryMap assigned = getAssignedCategories(state);
- SortedMap sortedCats = new TreeMap();
-// java.util.List children = root.getSubCategories();
-// children.forEach(x -> sortedCats.put(x.getName(), x.getUniqueId()));
-
- Iterator it = sortedCats.entrySet().iterator();
- Map.Entry entry;
- String path;
- String id;
- boolean notExcluded;
- boolean notAlreadyAssigned;
-// boolean notRoot;
-
- while (it.hasNext()) {
- entry = (Map.Entry) it.next();
- path = (String) entry.getKey();
- id = (String) entry.getValue();
-
- notExcluded = !excluded.containsKey(id);
- notAlreadyAssigned = !assigned.containsKey(id);
-// notRoot = !id.equals(root.getUniqueId());
-
- if (notExcluded && notAlreadyAssigned) {// && notRoot) {
- target.addOption(new Option(id, new Text(path)));
- }
-
- }
-
- addFillerOption(target);
- }
- }
-
- /**
- * Populate a {@link CategoryMap} with all categories which are assigned to
- * the item. Child classes should override this method to do the right thing.
- *
- * @param map The sequential map of all categories which are assigned to
- * the current item. Overridden method should repeatedly
- * call map.addCategory(someCategory);
- * @param state The page state
- */
- protected abstract void initAssignedCategories(PageState state, CategoryMap map);
-
- /**
- * Assign a category, moving it from the list on the left
- * to the list on the right
- *
- * @param s the page state
- * @param cat the category to assign
- */
- protected abstract void assignCategory(PageState s, Category cat);
-
- /**
- * Unassign a category, moving it from the list on the right
- * to the list on the left
- *
- * @param s the page state
- * @param cat the category to unassign
- */
- protected abstract void unassignCategory(PageState s, Category cat);
-
- /**
- * This method returns the URL for the givne item to make sure that
- * the item it is not possible to have two objects in the same category
- * with the same URL.
- * @param state The Page State
- */
- protected abstract String getItemURL(PageState state);
-
- /**
- * This allows the validation code to validate the properties of the
- * object
- */
- protected abstract CcmObject getObject(PageState state);
-
- /**
- * Get the category which will act as the root for the lists
- * of assigned and unassigned categories. The default implementation
- * returns the root category for the content section. Child classes
- * should override this method if they wish to provide an alternate root category.
- *
- * @param state the page state
- * @return the root category which should be used to populate the lists
- * of assigned and unassigned categories
- */
-// public Category getRootCategory(PageState state) {
-// return null;
-// return CMS.getContext().getContentSection().getRootCategory();
-// }
-
- /**
- * Return a category which should be excluded from the list of
- * free categories. It is permissible to return null
- *
- * @param s the page state
- * @return a category whose subtree will not be shown in the
- * category list
- */
- protected Category getExcludedCategory(PageState s) {
- return null;
- }
-
- // Populates the "assigned categories" widget
- @Deprecated
- private class AssignedPrintListener implements PrintListener {
-
- @Override
- public void prepare(PrintEvent e) {
- OptionGroup o = (OptionGroup) e.getTarget();
- o.clearOptions();
- PageState state = e.getPageState();
- CategoryMap m = getAssignedCategories(state);
-
- if (!m.isEmpty()) {
- for (Iterator i = m.values().iterator(); i.hasNext();) {
- Category c = (Category) i.next();
- o.addOption(new Option(c.getUniqueId(), new Text(getCategoryPath(c))));
- }
- } else {
- o.addOption(new Option("", new Text("-- none --")));
- }
-
- addFillerOption(o);
- }
- }
-
- // Process the form: assign/unassign categories
- @Override
- public void process(FormSectionEvent e) throws FormProcessException {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final CategoryRepository categoryRepository = cdiUtil.findBean(CategoryRepository.class);
-
- PageState state = e.getPageState();
- FormData data = e.getFormData();
- Long id;
-
- if (m_assign.isSelected(state)) {
- id = ((BigDecimal) data.get(FREE)).longValue();
- Optional optional = categoryRepository.findById(id);
- if (optional.isPresent()) {
- Category cat = optional.get();
- assignCategory(state, cat);
- data.put(ASSIGNED, id);
- } else {
- throw new FormProcessException(GlobalizationUtil.globalize(String.format("Can't find category with id %d", id)));
- }
- } else if (m_remove.isSelected(state)) {
- id = ((BigDecimal) data.get(ASSIGNED)).longValue();
- Optional optional = categoryRepository.findById(id);
- if (optional.isPresent()) {
- Category cat = optional.get();
- unassignCategory(state, cat);
- data.put(FREE, id);
- } else {
- throw new FormProcessException(GlobalizationUtil.globalize(String.format("Can't find category with id %d", id)));
- }
- }
- }
-
- // Validate the form: make sure that a category is selected
- // for the remove/assign buttons
- @Override
- public void validate(FormSectionEvent e) throws FormProcessException {
- PageState state = e.getPageState();
- FormData data = e.getFormData();
- if (m_assign.isSelected(state)) {
- if (data.get(FREE) == null) {
- data.addError(GlobalizationUtil.globalize("cms.ui.category.assign_select_missing"));
- } else {
- // we need to make sure that no other item in this
- // category has the same name (url)
- Long id = ((BigDecimal) data.get(FREE)).longValue();
-
- // Assign a new category
-// try {
-// String url = getItemURL(state);
-//
-// if (url != null) {
-// DataQuery query = SessionManager.getSession().retrieveQuery("com.arsdigita.categorization.getAllItemURLsForCategory");
-// query.setParameter("categoryID", id);
-// query.addEqualsFilter("lower(url)", url.toLowerCase());
-//
-// if (query.size() > 0) {
-// // we need to make sure that there is not an item
-// ACSObject item = getObject(state);
-// Collection list;
-// if (item instanceof ContentItem) {
-// list = BasicItemForm.getAllVersionIDs((ContentItem) item);
-// } else {
-// list = new ArrayList();
-// list.add(item.getID());
-// }
-// BigDecimal itemID;
-// while (query.next()) {
-// itemID = (BigDecimal) query.get("itemID");
-// if (!list.contains(itemID)) {
-// data.addError("There is already an item "
-// + "with the url " + url
-// + " in the category "
-// + cat.getName());
-// break;
-// }
-// }
-// }
-// }
-// } catch (DataObjectNotFoundException ex) {
-// s_log.error("Error processing category. Unable to find "
-// + "category with id " + id);
-// throw new FormProcessException(ex);
-// }
- }
- } else if (m_remove.isSelected(state)) {
- if (data.get(ASSIGNED) == null) {
- data.addError(GlobalizationUtil.globalize("cms.ui.category.assign_select_missing"));
- }
- }
- }
-
- // Add a "filler" option to the option group in order to ensure
- // the correct horizontal width
- private static void addFillerOption(OptionGroup o) {
- o.addOption(new Option("", FILLER_OPTION));
- }
-
- /**
- * @return the full path to a category
- */
- public static String getCategoryPath(Category c) {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final CategoryManager categoryManager = cdiUtil.findBean(CategoryManager.class);
- return categoryManager.getCategoryPath(c);
- }
-
- /**
- * A convenience method that abstracts SequentialMap
- * to deal with categories
- */
- protected static class CategoryMap extends SequentialMap {
-
- public CategoryMap() {
- super();
- }
-
- public void add(Category c) {
- super.put(c.getUniqueId(), c);
- }
- }
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/CcmObjectRequestLocal.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/CcmObjectRequestLocal.java
deleted file mode 100755
index 204e60c85..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/CcmObjectRequestLocal.java
+++ /dev/null
@@ -1,32 +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.bebop.RequestLocal;
-
-import org.libreccm.core.CcmObject;
-
-
-public class CcmObjectRequestLocal extends RequestLocal {
-
- public final CcmObject getACSObject(final PageState state) {
- return (CcmObject) get(state);
- }
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/ContentSectionPage.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/ContentSectionPage.java
deleted file mode 100755
index 0e6295b5c..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/ContentSectionPage.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * 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.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.SimpleContainer;
-import com.arsdigita.bebop.TabbedPane;
-import com.arsdigita.bebop.event.ActionEvent;
-import com.arsdigita.bebop.event.ActionListener;
-import com.arsdigita.bebop.event.PrintEvent;
-import com.arsdigita.bebop.event.PrintListener;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.PageLocations;
-
-import org.librecms.contentsection.ContentItem;
-import org.librecms.contentsection.ContentSection;
-
-import com.arsdigita.cms.dispatcher.CMSPage;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.Assert;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.librecms.CMSConfig;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.CmsConstants;
-import org.librecms.contentsection.ContentItemVersion;
-import org.librecms.contentsection.privileges.AdminPrivileges;
-
-/**
- * Contains the entire admin UI for a content section.
- *
- * Developers Note: It is based on the dispatcher model is is going to be
- * replaced by the newer servlet based model. @see
- * c.ad.cms.ui.contentsection.MainPage (currently not active).
- *
- * @author Jack Chung
- * @author Michael Pih
- * @author Xixi D'Moon
- * @author Justin Ross
- * @author Jens Pelzetter
- */
-public class ContentSectionPage extends CMSPage implements ActionListener {
-
- /**
- * 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
- * expansion from content item page.
- */
- public static final String SET_FOLDER = "set_folder";
-
- /**
- * The URL parameter that can be passed in in order to set the current
- * template (for setting the content type)
- */
- public static final String SET_TEMPLATE = "set_template";
-
- /**
- * The URL parameter that can be passed in in order to set the current tab.
- * This is a KLUDGE right now because the TabbedDialog's current tab is
- * selected with a local state parameter.
- */
- public static final String SET_TAB = "set_tab";
-
- /**
- * Index of the search tab
- */
- public static final int SEARCH_TAB = 0;
-
- /**
- * Index of the browse tab
- */
- public static final int BROWSE_TAB = 1;
-
- /**
- * Index of the roles tab
- */
- public static final int ROLES_TAB = 2;
-
- /**
- * Index of the workflows tab
- */
- public static final int WORKFLOW_TAB = 3;
-
- /**
- * Index of the lifecycles tab
- */
- public static final int LIFECYCLES_TAB = 4;
-
- /**
- * Index of the categories tab
- */
- public static final int CATEGORIES_TAB = 5;
-
- /**
- * Index of the content types tab
- */
- public static final int CONTENTTYPES_TAB = 6;
-
- public static final int USER_ADMIN_TAB = 7;
-
- private TabbedPane m_tabbedPane;
-
- private BrowsePane m_browsePane;
-
- private ItemSearch m_searchPane;
-
- /**
- * Creates the content section index page containing - a Navigaton bar for
- * the various tasks (items, search, images, ....) - a breadcrumb - ....
- * Contains the UI for administering a content section.
- */
- public ContentSectionPage() {
- super(new Label(new TitlePrinter()), new SimpleContainer());
-
- setClassAttr("cms-admin");
-
- add(new GlobalNavigation());
-
- // Initialize the individual panes
- m_browsePane = getBrowsePane();
- m_searchPane = getSearchPane();
-
- // The panes
- m_tabbedPane = createTabbedPane();
- m_tabbedPane.setIdAttr("page-body");
- m_tabbedPane.addActionListener(this);
- add(m_tabbedPane);
-
- addActionListener(new ActionListener() {
-
- @Override
- public final void actionPerformed(ActionEvent e) {
- final PageState state = e.getPageState();
-
- final String tab = state.getRequest().getParameter(SET_TAB);
-
- if (tab != null) {
- m_tabbedPane.setSelectedIndex(state, Integer.valueOf(tab)
- .intValue());
- }
-
- final PermissionChecker permissionChecker = CdiUtil
- .createCdiUtil().findBean(PermissionChecker.class);
-
- if (CMSConfig.getConfig().isHideAdminTabs()) {
-
- }
- }
-
- });
- }
-
- /**
- * Creates, and then caches, the browse pane. Overriding this method to
- * return null will prevent this tab from appearing.
- *
- * @return
- */
- protected BrowsePane getBrowsePane() {
- if (m_browsePane == null) {
- m_browsePane = new BrowsePane();
- }
- return m_browsePane;
- }
-
- /**
- * Creates, and then caches, the search pane. Overriding this method to
- * return null will prevent this tab from appearing.
- *
- * @return
- */
- protected ItemSearch getSearchPane() {
- if (m_searchPane == null) {
- m_searchPane
- = new ItemSearch(
- ContentItemVersion.DRAFT.toString(),
- CMSConfig.getConfig().isLimitItemSearchToContentSection());
- }
- return m_searchPane;
- }
-
- /**
- * Adds the specified component, with the specified tab name, to the tabbed
- * pane only if it is not null.
- *
- * @param pane The pane to which to add the tab
- * @param tabName The name of the tab if it's added
- * @param comp The component to add to the pane
- */
- protected void addToPane(final TabbedPane pane,
- final String tabName,
- final Component comp) {
- if (comp != null) {
- pane.addTab(new Label(tabName), comp);
- }
- }
-
- private void tab(final TabbedPane pane,
- final String key,
- final Component tab) {
- if (tab != null) {
- pane.addTab(new Label(gz(key)), tab);
- }
- }
-
- /**
- *
- * Created the TabbedPane to use for this page. Adds the tabs to the pane.
- * The default implementation uses a {@link
- * com.arsdigita.bebop.TabbedPane}. This implementation also adds browse,
- * search, staff admin, viewers admin, workflow admin, category admin, and
- * content type panes.
- *
- *
- * Developers can override this method to add only the tabs they want, or to
- * add additional tabs after the default CMS tabs are added.
- *
- * @return
- */
- protected TabbedPane createTabbedPane() {
- final TabbedPane pane = new TabbedPane();
-
- tab(pane, "cms.ui.browse", getBrowsePane());
- tab(pane, "cms.ui.search", getSearchPane());
-
- return pane;
- }
-
- /**
- * Fetch the request-local content section.
- *
- * @param request The HTTP request
- *
- * @return The current content section
- */
- @Override
- public ContentSection getContentSection(final HttpServletRequest request) {
- // Resets all content sections associations.
- ContentSection section = super.getContentSection(request);
- Assert.exists(section);
- return section;
- }
-
- /**
- * When a new tab is selected, reset the state of the formerly-selected
- * pane.
- *
- * @param event The event fired by selecting a tab
- */
- @Override
- public void actionPerformed(final ActionEvent event) {
- final PageState state = event.getPageState();
-
- final Component pane = m_tabbedPane.getCurrentPane(state);
- }
-
- /**
- * Construct a URL for displaying the tab
- *
- * @param item The item from which we get the corresponding content section
- * @param tab The index of the tab to display
- *
- * @return
- */
- public static String getSectionURL(final ContentItem item, final int tab) {
- // Get the content section associated with the content item.
- final ContentSection section = item.getContentType().getContentSection();
-
- final String url = section.getPrimaryUrl() + PageLocations.SECTION_PAGE
- + "?" + SET_TAB + "=" + tab;
-
- return url;
- }
-
- private static GlobalizedMessage gz(final String key) {
- return new GlobalizedMessage(key, CmsConstants.CMS_BUNDLE);
- }
-
- /**
- * Getting the GlobalizedMessage using a CMS Class targetBundle.
- *
- * @param key The resource key
- *
- * @return
- *
- * @pre key != null
- */
- public static GlobalizedMessage globalize(final String key) {
- return new GlobalizedMessage(key, CmsConstants.CMS_BUNDLE);
- }
-
- /**
- *
- * @param key
- * @param args
- *
- * @return
- */
- public static GlobalizedMessage globalize(final String key,
- final Object[] args) {
- return new GlobalizedMessage(key, CmsConstants.CMS_BUNDLE, args);
- }
-
- /**
- * Helper class to be able to use a PrintListener to set the titel of the
- * page.
- */
- private static class TitlePrinter implements PrintListener {
-
- /**
- *
- * @param event
- */
- @Override
- public void prepare(final PrintEvent event) {
- final Label l = (Label) event.getTarget();
-
- l.setLabel(CMS.getContext().getContentSection().getLabel());
- }
-
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/ContentSectionRequestLocal.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/ContentSectionRequestLocal.java
deleted file mode 100755
index a01e36cf4..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/ContentSectionRequestLocal.java
+++ /dev/null
@@ -1,40 +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.bebop.RequestLocal;
-import com.arsdigita.cms.CMS;
-
-import org.librecms.contentsection.ContentSection;
-
-/**
- *
- */
-public final class ContentSectionRequestLocal extends RequestLocal {
-
- @Override
- protected Object initialValue(final PageState state) {
- return CMS.getContext().getContentSection();
- }
-
- public final ContentSection getContentSection(final PageState state) {
- return (ContentSection) get(state);
- }
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/FlatItemList.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/FlatItemList.java
deleted file mode 100755
index e020d8f95..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/FlatItemList.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * 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.ui;
-
-import com.arsdigita.bebop.ActionLink;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.ParameterSingleSelectionModel;
-import com.arsdigita.bebop.Resettable;
-import com.arsdigita.bebop.SegmentedPanel;
-import com.arsdigita.bebop.SingleSelectionModel;
-import com.arsdigita.bebop.event.ActionEvent;
-import com.arsdigita.bebop.event.ActionListener;
-import com.arsdigita.bebop.event.ChangeEvent;
-import com.arsdigita.bebop.event.ChangeListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.parameters.LongParameter;
-import com.arsdigita.bebop.parameters.StringParameter;
-
-import com.arsdigita.cms.ui.authoring.CreationSelector;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import com.arsdigita.toolbox.ui.ActionGroup;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.libreccm.security.PermissionManager;
-import org.librecms.CmsConstants;
-import org.librecms.contentsection.Folder;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Encapsulates a {@link FolderManipulator} in order to create a flat item
- * listing. Also contains a new item form.
- *
- * @author Stanislav Freidin
- * @author Jens Pelzetter
- */
-public class FlatItemList extends SegmentedPanel implements FormProcessListener,
- ChangeListener,
- FormSubmissionListener,
- Resettable,
- ActionListener {
-
- private static final String CONTENT_TYPE_ID = "ct";
-
- // The folder selectors
- private final SingleSelectionModel typeSelectionModel;
-
- private CreationSelector creationSelector;
-
- private final ActionLink createFolderAction;
-
- private final Segment browseSegment;
-
- private final Segment newItemSegment;
-
- private final Segment newFolderSegment;
-
- private final Segment editFolderSegment;
-
- private final Segment permissionsSegment;
-
- // Folder edit/rename functionality.
- private final ActionLink editFolderAction;
-
- private final Label contentLabel;
-
- private final Label chooseLabel;
-
- private final StringParameter selectedLanguageParam;
-
- /**
- * Construct a new item listing pane. The provided folder selection model is
- * used to keep track of the currently displayed folder.
- *
- * @param folderRequestLocal
- * @param folderSelectionModel maintains the currently displayed folder.
- */
- @SuppressWarnings("unchecked")
- public FlatItemList() {
-
- setIdAttr("flat-item-list");
-
- newItemSegment = addSegment();
- newItemSegment.setIdAttr("folder-new-item");
-
- newFolderSegment = addSegment();
- newFolderSegment.setIdAttr("folder-new-folder");
-
- editFolderSegment = addSegment();
- editFolderSegment.setIdAttr("folder-edit-folder");
-
- browseSegment = addSegment();
- browseSegment.setIdAttr("folder-browse");
-
- final ActionGroup browseActions = new ActionGroup();
- browseSegment.add(browseActions);
-
- // The top 'browse' segment
- contentLabel = new Label(globalize("cms.ui.contents_of"), false);
- browseSegment.addHeader(contentLabel);
- chooseLabel = new Label(globalize("cms.ui.choose_target_folder"),
- false);
- browseSegment.addHeader(chooseLabel);
-
-
- createFolderAction = new ActionLink(new Label(globalize(
- "cms.ui.new_folder")));
- createFolderAction.addActionListener(this);
- browseActions.addAction(createFolderAction);
-
- editFolderAction = new ActionLink(new Label(globalize(
- "cms.ui.edit_folder")));
- editFolderAction.addActionListener(this);
- browseActions.addAction(editFolderAction);
-
- permissionsSegment = addSegment();
- permissionsSegment.setIdAttr("folder-permissions");
-
- final ActionGroup permissionActions = new ActionGroup();
- permissionsSegment.add(permissionActions);
-
- permissionsSegment.addHeader(new Label(new GlobalizedMessage(
- "cms.ui.permissions", CmsConstants.CMS_BUNDLE)));
-
- selectedLanguageParam = new StringParameter(
- ContentItemPage.SELECTED_LANGUAGE);
-
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final PermissionManager permissionManager = cdiUtil.findBean(
- PermissionManager.class);
- final List privileges = permissionManager
- .listDefiniedPrivileges(ItemPrivileges.class);
- final Map privNameMap = new HashMap<>();
- privileges.forEach(privilege -> privNameMap.put(privilege, privilege));
-
- newItemSegment.addHeader(new Label(globalize("cms.ui.new_item")));
- typeSelectionModel = new ParameterSingleSelectionModel<>(
- new LongParameter(CONTENT_TYPE_ID));
- typeSelectionModel.addChangeListener(this);
-
-
- //m_newItemSeg.add(new Label("
", false));
-
- // The 'new folder' segment
- newFolderSegment.addHeader(new Label(globalize("cms.ui.new_folder")));
-// final Form folderCreate = new Form("fcreat");
-
- //folderCreator.add(folderCreator);
- newFolderSegment.add(new Label("
", false));
-
- editFolderSegment.addHeader(new Label(globalize("cms.ui.edit_folder")));
- //Form folderEditorForm = new Form("fedit_form");
- //folderEditorForm.add(folderEditor);
- editFolderSegment.add(new Label("
", false));
- }
-
- @Override
- public void register(final Page page) {
- super.register(page);
-
- page.setVisibleDefault(chooseLabel, false);
-// page.setVisibleDefault(browseSegment, true);
- page.setVisibleDefault(newItemSegment, false);
- page.setVisibleDefault(newFolderSegment, false);
- page.setVisibleDefault(editFolderSegment, false);
-
- page.addComponentStateParam(this,
- typeSelectionModel.getStateParameter());
- page.addGlobalStateParam(selectedLanguageParam);
-
- page.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- final PageState state = event.getPageState();
-
- if (state.isVisibleOnPage(FlatItemList.this)) {
- showHideSegments(state);
- }
- }
-
- });
- }
-
- /**
- * Show/hide segments based on access checks.
- *
- * @param state The page state
- *
- * @pre ( state != null )
- */
- private void showHideSegments(final PageState state) {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final PermissionChecker permissionChecker = cdiUtil.findBean(
- PermissionChecker.class);
- final Folder folder = null;
-
- // MP: This should be checked on the current folder instead of just
- // the content section.
- final boolean newItem = permissionChecker.isPermitted(
- ItemPrivileges.CREATE_NEW, folder);
-
- if (!newItem) {
- browseMode(state);
- }
-
- createFolderAction.setVisible(state, newItem);
-
- final boolean editItem = permissionChecker.isPermitted(
- ItemPrivileges.EDIT, folder);
-
- editFolderAction.setVisible(state, editItem);
-// chooseLabel.setVisible(state, editItem);
-// editFolderSegment.setVisible(state, editItem);
-
- if (permissionChecker.isPermitted(ItemPrivileges.ADMINISTER, folder)) {
- permissionsSegment.setVisible(state, true);
- } else {
- permissionsSegment.setVisible(state, false);
- }
- }
-
- private void browseMode(final PageState state) {
- browseSegment.setVisible(state, true);
- permissionsSegment.setVisible(state, true);
- chooseLabel.setVisible(state, false);
- contentLabel.setVisible(state, true);
- newItemSegment.setVisible(state, false);
- newFolderSegment.setVisible(state, false);
- editFolderSegment.setVisible(state, false);
-
- typeSelectionModel.clearSelection(state);
- }
-
- private void newItemMode(final PageState state) {
- permissionsSegment.setVisible(state, false);
- newItemSegment.setVisible(state, true);
- }
-
- private void newFolderMode(final PageState state) {
- permissionsSegment.setVisible(state, false);
- newFolderSegment.setVisible(state, true);
- }
-
- @Override
- public void submitted(final FormSectionEvent event)
- throws FormProcessException {
-
- final PageState state = event.getPageState();
-
- }
-
- @Override
- public void process(final FormSectionEvent event) {
- final PageState state = event.getPageState();
- final Object source = event.getSource();
-
- }
-
- @Override
- public void stateChanged(final ChangeEvent event) {
- final PageState state = event.getPageState();
- if (event.getSource().equals(typeSelectionModel)) {
- if (!typeSelectionModel.isSelected(state)) {
- browseMode(state);
- }
- }
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- final PageState state = event.getPageState();
- final Object source = event.getSource();
- if (source == createFolderAction) {
- newFolderMode(state);
- } else if (source == editFolderAction) {
- permissionsSegment.setVisible(state, false);
- editFolderSegment.setVisible(state, true);
- }
-// else if (source == togglePrivateAction) {
-// togglePermissions(state);
-// }
-// } else if (source == m_setHomeFolderAction) {
-// User user = Web.getWebContext().getUser();
-// Folder folder = m_folder.getFolder(state);
-// user = (User) DomainObjectFactory.newInstance(user.getOID());
-// Folder.setUserHomeFolder(user, folder);
-// } else if (source == m_removeHomeFolderAction) {
-// User user = Web.getWebContext().getUser();
-// ContentSection section = CMS.getContext().getContentSection();
-// UserHomeFolderMap map = UserHomeFolderMap
-// .findUserHomeFolderMap(user, section);
-// if (map != null) {
-// map.delete();
-// }
-// }
- }
-
- private void togglePermissions(final PageState state) {
- final Folder currentFolder = null;
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final PermissionChecker permissionChecker = cdiUtil.findBean(
- PermissionChecker.class);
- permissionChecker.checkPermission(ItemPrivileges.ADMINISTER,
- currentFolder);
- }
-
- @Override
- public void reset(final PageState state) {
- browseMode(state);
- // switching between folders used to keep showing the permission pane
- // in the same perm mode (direct or inherited) regardless
- // of the folder status
- }
-
-
- public void setPermissionLinkVis(final PageState state) {
-// final Folder currentFolder = folderRequestLocal.getFolder(state);
-// final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
-// final PermissionChecker permissionChecker = cdiUtil.findBean(
-// PermissionChecker.class);
-// if (!permissionChecker.isPermitted(ItemPrivileges.ADMINISTER,
-// currentFolder)) {
-// togglePrivateAction.setVisible(state, false);
-// }
- }
-
- /**
- * Getting the GlobalizedMessage using a CMS Class targetBundle.
- *
- * @param key The resource key
- *
- * @pre ( key != null )
- */
- private static GlobalizedMessage globalize(final String key) {
- return ContentSectionPage.globalize(key);
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/ItemSearch.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/ItemSearch.java
deleted file mode 100755
index 05b157226..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/ItemSearch.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.ui;
-
-import com.arsdigita.bebop.Form;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Resettable;
-import com.arsdigita.bebop.SimpleContainer;
-
-import org.librecms.contentsection.ContentItem;
-
-/**
- * A wrapper around the {@link ItemSearchSection} which embeds the form section
- * in a form.
- *
- * @author Stanislav Freidin (sfreidin@arsdigita.com)
- * @author Jens Pelzetter
- */
-public class ItemSearch extends Form implements Resettable {
-
- public static final String SINGLE_TYPE_PARAM = ItemSearchSection.SINGLE_TYPE_PARAM;
-
- private ItemSearchSection itemSearchSection;
-
- /**
- * Construct a new ItemSearch component Default to limit the
- * search to current content section
- *
- * @param context the context for the retrieved items. Should be
- * {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
- */
- public ItemSearch(String context) {
- this(context, true);
- }
-
- /**
- * Construct a new ItemSearch component
- *
- * @param context the context for the retrieved items. Should be
- * {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
- * @param limitToContentSection limit the search to the current content
- * section
- */
- public ItemSearch(final String context,
- final boolean limitToContentSection) {
- super("itemSearch", new SimpleContainer());
- //setMethod("GET");
- itemSearchSection = createSearchSection(context, limitToContentSection);
- super.add(itemSearchSection);
- }
-
- protected ItemSearchSection createSearchSection(final String context,
- boolean limitToContentSection) {
- return new ItemSearchSection(context, limitToContentSection);
- }
-
- @Override
- public void reset(final PageState state) {
- itemSearchSection.reset(state);
- }
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/ItemSearchSection.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/ItemSearchSection.java
deleted file mode 100755
index 11f6a1381..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/ItemSearchSection.java
+++ /dev/null
@@ -1,189 +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.Component;
-import com.arsdigita.bebop.SimpleContainer;
-import com.arsdigita.bebop.Container;
-import com.arsdigita.bebop.Resettable;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-
-import org.librecms.contentsection.ContentItem;
-import org.librecms.contentsection.ContentType;
-
-import com.arsdigita.cms.ui.search.ItemQueryComponent;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import com.arsdigita.search.ui.ResultsPane;
-import com.arsdigita.search.ui.QueryGenerator;
-import com.arsdigita.toolbox.ui.LayoutPanel;
-
-import org.librecms.CmsConstants;
-
-/**
- * Contains a form for specifying search parameters, as well as a
- * {@link com.arsdigita.search.ui.ResultsPane} which will perform the search and
- * display the results
- *
- * @author Stanislav Freidin (sfreidin@arsdigita.com)
- * @version $Id: ItemSearchSection.java 1940 2009-05-29 07:15:05Z terry $
- */
-public class ItemSearchSection extends FormSection implements Resettable {
-
- public static final String SINGLE_TYPE_PARAM = "single_type";
-
- private ItemQueryComponent itemQueryComponent;
- private Component resultsComponent;
-
- /**
- * Construct a new ItemSearchSection component
- *
- * @param context the context for the retrieved items. Should be
- * {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
- * @param limitToContentSection limit the search to the current content
- * section
- */
- public ItemSearchSection(final String context,
- final boolean limitToContentSection) {
- this(null, context, limitToContentSection);
- }
-
- /**
- * Construct a new ItemSearchSection component
- *
- * @param context the context for the retrieved items. Should be
- * {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
- * @param name The name of the search parameter for the particular
- * FormSection
- * @param limitToContentSection limit the search to the current content
- * section
- */
- public ItemSearchSection(final String name,
- final String context,
- final boolean limitToContentSection) {
- this(name, context, limitToContentSection, null);
- }
-
- public ItemSearchSection(final String name,
- final String context,
- final boolean limitToContentSection,
- final ContentType type) {
- super(new SimpleContainer());
- final String thisName;
- if (name == null) {
- thisName = "itemSearch";
- } else {
- thisName = name;
- }
-
- if (type == null) {
- itemQueryComponent = createQueryGenerator(context,
- limitToContentSection);
- } else {
- itemQueryComponent = createQueryGenerator(context,
- limitToContentSection,
- type);
- }
- resultsComponent = createResultsPane(itemQueryComponent);
-
- LayoutPanel searchPanel = new LayoutPanel();
- searchPanel.setLeft(itemQueryComponent);
- searchPanel.setBody(resultsComponent);
- this.add(searchPanel);
-
- addQueryGenerator(this);
- addResultsPane(this);
- addFormListener();
-
- setClassAttr("itemSearch");
- }
-
-
- @Override
- public void reset(final PageState state) {
- resultsComponent.setVisible(state, false);
- }
-
- protected ItemQueryComponent createQueryGenerator(
- final String context, final boolean limitToContentSection) {
- return new ItemQueryComponent(context, limitToContentSection);
- }
-
- protected ItemQueryComponent createQueryGenerator(
- final String context,
- final boolean limitToContentSection,
- final ContentType type) {
-
- return new ItemQueryComponent(context, limitToContentSection, type);
- }
-
- protected Component createResultsPane(QueryGenerator generator) {
- ResultsPane pane = new ResultsPane(generator);
- pane.setRelativeURLs(true);
- pane.setSearchHelpMsg(new GlobalizedMessage("cms.ui.search.help",
- CmsConstants.CMS_BUNDLE));
- pane.setNoResultsMsg(new GlobalizedMessage("cms.ui.search.no_results",
- CmsConstants.CMS_BUNDLE));
- return pane;
- }
-
- protected void addResultsPane(final Container container) {
- container.add(resultsComponent);
- }
-
- protected void addQueryGenerator(final Container container) {
- container.add(itemQueryComponent);
- }
-
- protected void processQuery(final PageState state) {
- resultsComponent.setVisible(state, itemQueryComponent.hasQuery(state));
- }
-
- protected void addFormListener() {
- addProcessListener(new SearchFormProcessListener());
- }
-
- // Hide results by default
- @Override
- public void register(final Page page) {
- super.register(page);
- page.setVisibleDefault(resultsComponent, false);
- page.addGlobalStateParam(new BigDecimalParameter(SINGLE_TYPE_PARAM));
- }
-
- /**
- * Displays the "keywords" and "content types" widgets
- */
- private class SearchFormProcessListener implements FormProcessListener {
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
-
- PageState s = event.getPageState();
- processQuery(s);
- }
- }
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/PartyAddForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/PartyAddForm.java
deleted file mode 100755
index f8ffdbbcd..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/PartyAddForm.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright (C) 2002-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.ColumnPanel;
-import com.arsdigita.bebop.Form;
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.RequestLocal;
-import com.arsdigita.bebop.SimpleContainer;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.form.CheckboxGroup;
-import com.arsdigita.bebop.form.Hidden;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.form.OptionGroup;
-import com.arsdigita.bebop.form.Submit;
-import com.arsdigita.bebop.form.Widget;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.xml.Element;
-
-import org.libreccm.core.UnexpectedErrorException;
-import org.libreccm.security.Party;
-import org.librecms.CmsConstants;
-
-import java.util.List;
-import java.util.TooManyListenersException;
-
-/**
- * Form for adding multiple parties to a role.
- *
- * @author Scott Seago (scott@arsdigita.com)
- * @author Yannick Bülter
- */
-public abstract class PartyAddForm extends SimpleContainer
- implements FormInitListener, FormProcessListener {
-
- private final static String SEARCH_QUERY = "searchQuery";
- private final static String PARTIES = "parties";
- private final static String SUBMIT = "addSubmit";
- private final static String CANCEL = "addCancel";
-
- private Widget searchWidget;
- private RequestLocal queryRequestLocal;
-
- private CMSContainer noMatchesContainer;
- private CMSContainer matchesContainer;
-
- private Form form;
- private Hidden searchQueryField;
- private Submit cancelButton;
-
- /**
- * Private access prevents this constructor from ever being called directly.
- */
- private PartyAddForm() {
- super();
- }
-
- /**
- * Constructor.
- *
- * @param searchWidget The widget on the search form that contains the value
- * of the search string.
- */
- public PartyAddForm(final Widget searchWidget) {
-
- this();
-
- this.searchWidget = searchWidget;
-
- queryRequestLocal = new RequestLocal() {
-
- @Override
- protected Object initialValue(final PageState state) {
- return makeQuery(state);
- }
-
- };
-
- form = makeForm();
-
- final Label title = new Label(new GlobalizedMessage("cms.ui.matches",
- CmsConstants.CMS_BUNDLE));
- title.setFontWeight(Label.BOLD);
-
- final Label label = new Label(new GlobalizedMessage(
- "cms.ui.there_was_no_one_matching_the_search_criteria",
- CmsConstants.CMS_BUNDLE));
- label.setFontWeight("em");
-
- noMatchesContainer = new CMSContainer();
- noMatchesContainer.add(title);
- noMatchesContainer.add(label);
- super.add(noMatchesContainer);
-
- matchesContainer = new CMSContainer();
- matchesContainer.add(title);
- matchesContainer.add(form);
- super.add(matchesContainer);
- }
-
- /**
- * Build the form used to add parties.
- *
- * @return The form
- */
- private Form makeForm() {
-
- final CMSForm addPartyForm = new CMSForm("AddParties") {
-
- @Override
- public final boolean isCancelled(final PageState state) {
- return cancelButton.isSelected(state);
- }
-
- };
-
- // This hidden field will store the search query. A hidden widget is
- // used instead of a request local variable because the search query
- // should only be updated when the search form is submitted.
- searchQueryField = new Hidden(SEARCH_QUERY);
- addPartyForm.add(searchQueryField, ColumnPanel.FULL_WIDTH);
-
- final Label hintLabel = new Label(
- new GlobalizedMessage("cms.ui.party_add_form.hint",
- CmsConstants.CMS_BUNDLE));
- addPartyForm.add(hintLabel, ColumnPanel.FULL_WIDTH);
-
- // Add the list of parties that can be added.
- final CheckboxGroup partyCheckboxes = new CheckboxGroup(PARTIES);
- partyCheckboxes.addValidationListener(new NotNullValidationListener());
- try {
- partyCheckboxes.addPrintListener(event -> {
- final CheckboxGroup target = (CheckboxGroup) event.getTarget();
- final PageState state = event.getPageState();
- // Ensures that the init listener gets fired before the
- // print listeners.
- final FormData data = addPartyForm.getFormData(state);
- addParties(state, target);
- });
- } catch (TooManyListenersException ex) {
- throw new UnexpectedErrorException(ex);
- }
- addPartyForm.add(partyCheckboxes, ColumnPanel.FULL_WIDTH);
-
- // Submit and Cancel buttons.
- final SimpleContainer buttonContainer = new SimpleContainer();
- final Submit submitButton = new Submit(SUBMIT,
- new GlobalizedMessage(
- "cms.ui.save",
- CmsConstants.CMS_BUNDLE));
- buttonContainer.add(submitButton);
- cancelButton = new Submit(CANCEL,
- new GlobalizedMessage("cms.ui.cancel",
- CmsConstants.CMS_BUNDLE));
- buttonContainer.add(cancelButton);
- addPartyForm.add(buttonContainer, ColumnPanel.FULL_WIDTH
- | ColumnPanel.CENTER);
-
- addPartyForm.addInitListener(this);
- addPartyForm.addProcessListener(this);
-
- return addPartyForm;
- }
-
- /**
- * Fetches the form for adding parties.
- *
- * @return The "add party" form
- */
- public Form getForm() {
- return form;
- }
-
- /**
- * Fetches the widget that contains the search string.
- *
- * @return The widget that contains the search string
- */
- protected Widget getSearchWidget() {
- return searchQueryField;
- }
-
- /**
- * Return true if the form is cancelled, false otherwise.
- *
- * @param state The page state
- *
- * @return true if the form is cancelled, false otherwise.
- *
- * @pre ( state != null )
- */
- public boolean isCancelled(final PageState state) {
- return cancelButton.isSelected(state);
- }
-
- /**
- * Adds parties to the option group.
- *
- * @param state The page state
- * @param target The option group
- *
- * @pre ( state != null && target != null )
- */
- private void addParties(final PageState state, final OptionGroup target) {
-
- @SuppressWarnings("unchecked")
- final List parties = (List) queryRequestLocal.get(state);
-
- target.clearOptions();
-
- for (final Party party : parties) {
- target.addOption(new Option(
- Long.toString(party.getPartyId()),
- new Label(new GlobalizedMessage(party.getName()))
- ));
- }
- }
-
- /**
- * Generates a {@link Object} that encapsulates search results.
- *
- * @param state The page state
- *
- * @return
- */
- protected abstract List makeQuery(PageState state);
-
- /**
- * Stores the search query in the hidden field.
- *
- * @param event The form event
- *
- * @throws com.arsdigita.bebop.FormProcessException
- */
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
-
- PageState state = event.getPageState();
-
- searchQueryField.setValue(state, searchWidget.getValue(state));
- }
-
- /**
- * Process listener for the "Add parties" form.
- *
- * @param event The form event
- *
- * @throws com.arsdigita.bebop.FormProcessException
- */
- @Override
- public abstract void process(FormSectionEvent event)
- throws FormProcessException;
-
- /**
- * Displays the appropriate frame.
- *
- * @param state The page state
- * @param parent The parent DOM element
- */
- @Override
- public void generateXML(final PageState state, final Element parent) {
-
- @SuppressWarnings("unchecked")
- final List searchResults = (List) queryRequestLocal.get(state);
-
- if (searchResults.size() > 0) {
- matchesContainer.generateXML(state, parent);
- } else {
- noMatchesContainer.generateXML(state, parent);
- }
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/PartySearchForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/PartySearchForm.java
deleted file mode 100755
index f4f35c4e8..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/PartySearchForm.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2002-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.Label;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.form.Submit;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.util.Assert;
-
-/**
- * Form to search for parties to be added to a staff group.
- *
- * @author Scott Seago <sseago@redhat.com>
- * @version $Id: PartySearchForm.java 1942 2009-05-29 07:53:23Z terry $
- */
-public class PartySearchForm extends BaseForm {
-
- private final TextField searchField;
-
- public PartySearchForm() {
- super("SearchParties", gz("cms.ui.search"));
-
- addComponent(new Label(gz("cms.ui.search_prompt")));
-
- searchField = new TextField(new StringParameter("query"));
- searchField.setSize(40);
- addComponent(searchField);
-
- addAction(new Submit("finish", gz("cms.ui.search")));
- addAction(new Cancel());
-
- }
-
- @Override
- public final void register(final Page page) {
- super.register(page);
-
- Assert.isTrue(page.stateContains(this));
- }
-
- public TextField getSearchWidget() {
- return searchField;
- }
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/SortableList.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/SortableList.java
deleted file mode 100755
index 020183214..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/SortableList.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2002-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.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.List;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.ParameterSingleSelectionModel;
-import com.arsdigita.bebop.list.ListModel;
-import com.arsdigita.bebop.util.BebopConstants;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.Assert;
-import com.arsdigita.xml.Element;
-
-import java.io.IOException;
-
-/**
- * This list offers the option for the code to provide the developer with links
- * to sort the given categories.
- *
- * NOTE: This UI currently does not scale well with large numbers of items since
- * it just lists all of them. It would probably be nice to integrate a paginator
- * as well to as to allow the user to move an item in large distances and to
- * insert an item in the middle. Right now, when you add an item it is just
- * placed at the end. However, if you want the item to appear in the middle then
- * you must hit the "up" arrow n/2 times where n is the number of items in the
- * list. This clearly is not a good setup.
- *
- *
- * @author Randy Graebner (randyg@alum.mit.edu)
- * @author Yannick Bülter
- */
-public abstract class SortableList extends List {
-
- // It would be really nice if this used the save variable as is
- // used by List but because List has it as private, we cannot do that.
- private static final String SELECT_EVENT = "s";
- protected static final String PREV_EVENT = "prev";
- protected static final String NEXT_EVENT = "next";
- public boolean m_sortItems;
-
- /**
- * This just makes a standard {@link SortableList}
- */
- public SortableList(ParameterSingleSelectionModel model) {
- this(model, false);
- }
-
- public SortableList(ParameterSingleSelectionModel model,
- boolean suppressSort) {
- super(model);
- m_sortItems = !suppressSort;
- }
-
- /**
- * This geneates the XML as specified by the arguments pass in to the
- * constructor.
- */
- public void generateXML(PageState state, Element parent) {
- if (!isVisible(state)) {
- return;
- }
-
- // They want the special sort items
- ListModel m = getModel(state);
-
- if (!m.next()) {
- super.generateXML(state, parent);
- return;
- }
-
- // because m.next() returned true, we know there are items
- // in the list
- Element list = parent
- .newChildElement("cms:sortableList", CMS.CMS_XML_NS);
- exportAttributes(list);
-
- Component c;
- Object selKey = getSelectedKey(state);
- int i = 0;
- boolean hasNext;
- do {
- Element item = list.newChildElement(BebopConstants.BEBOP_CELL,
- BEBOP_XML_NS);
- if (m_sortItems) {
-
- item.addAttribute("configure", "true");
- }
- String key = m.getKey();
- Assert.exists(key);
-
- // Converting both keys to String for comparison
- // since ListModel.getKey returns a String
- boolean selected = (selKey != null)
- && key.equals(selKey.toString());
-
- if (selected) {
- item.addAttribute("selected", "selected");
- }
-
- generateLabelXML(state, item,
- new Label(new GlobalizedMessage(m.getElement()
- .toString())), key, m.getElement());
-
- hasNext = m.next();
-
- // Add attributes containing URLs that fire control events
- // for various portlet actions
- try {
- // Maybe add attribute containing URL for "move up" link
- if (i > 0) {
- state.setControlEvent(this, PREV_EVENT, key);
- item.addAttribute("prevURL", state.stateAsURL());
- }
-
- // Maybe add attribute containing URL for "move down" link
- if (hasNext) {
- state.setControlEvent(this, NEXT_EVENT, key);
- item.addAttribute("nextURL", state.stateAsURL());
- }
-
- } catch (IOException ex) {
- throw new IllegalStateException("Caught IOException: "
- + ex.getMessage());
- }
- i++;
- } while (hasNext);
-
- state.clearControlEvent();
- }
-
- protected void generateLabelXML(PageState state, Element parent,
- Label label, String key, Object element) {
- state.setControlEvent(this, SELECT_EVENT, key);
- Component c = new ControlLink(label);
- c.generateXML(state, parent);
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/WorkspaceContextBar.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/WorkspaceContextBar.java
deleted file mode 100755
index 1d8e9be84..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/WorkspaceContextBar.java
+++ /dev/null
@@ -1,80 +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.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.ContextBar;
-import com.arsdigita.web.URL;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.web.ApplicationRepository;
-import org.libreccm.web.CcmApplication;
-import org.librecms.CmsConstants;
-
-import java.util.List;
-
-/**
- *
- * The context bar of the content center UI.
- *
- * @author Justin Ross
- * @author Jens Pelzetter
- */
-// Made public (instead of unspecified) in 6.6.8
-public class WorkspaceContextBar extends ContextBar {
-
- /**
- * A logger instance, primarily to assist debugging .
- */
- private static final Logger LOGGER = LogManager.getLogger(
- WorkspaceContextBar.class);
-
- /**
- *
- * @param state
- *
- * @return
- */
- @Override
- protected List entries(final PageState state) {
-
- final List entries = super.entries(state);
-
- final String centerTitle = (String) new GlobalizedMessage(
- "cms.ui.content_center", CmsConstants.CMS_BUNDLE).localize();
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final ApplicationRepository appRepo = cdiUtil.findBean(
- ApplicationRepository.class);
- final List apps = appRepo.findByType(
- CmsConstants.CONTENT_CENTER_APP_TYPE);
-
- final String centerPath = apps.get(0).getPrimaryUrl();
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Got Url: " + centerPath);
- }
- final URL url = URL.there(state.getRequest(), centerPath);
- entries.add(new Entry(centerTitle, url));
-
- return entries;
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ItemCategoryForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ItemCategoryForm.java
deleted file mode 100755
index 35a0ebb09..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ItemCategoryForm.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 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.authoring;
-
-import org.apache.logging.log4j.Logger;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.form.Widget;
-import com.arsdigita.bebop.parameters.LongParameter;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.categorization.ui.ACSObjectCategoryForm;
-import com.arsdigita.cms.CMS;
-
-import org.apache.logging.log4j.LogManager;
-import org.libreccm.core.CcmObject;
-
-/**
- * (No description available yet).
- *
- * Usage of this class is configured in parameter
- * c.ad.cms.category_authoring_add_form
- */
-public class ItemCategoryForm extends ACSObjectCategoryForm {
-
- private static Logger LOGGER = LogManager.getLogger(ItemCategoryForm.class);
-
- public ItemCategoryForm(final LongParameter rootParameter,
- final StringParameter modeParameter,
- final Widget widget) {
-
- super(rootParameter, modeParameter, widget);
- LOGGER.debug("creating new ItemTerm Form with widget " + widget);
- }
-
- public ItemCategoryForm(final LongParameter root,
- final StringParameter mode) {
-
- this(root, mode, new CategoryWidget("category", root, mode));
- }
-
- /*
- * @see com.arsdigita.categorization.ui.ACSObjectCategoryForm#getObject()
- */
- @Override
- protected CcmObject getObject(final PageState state) {
- return CMS.getContext().getContentItem();
-
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ItemCategoryStep.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ItemCategoryStep.java
deleted file mode 100755
index b48595c04..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ItemCategoryStep.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 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.authoring;
-
-import com.arsdigita.bebop.SimpleContainer;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.SimpleComponent;
-import com.arsdigita.bebop.event.ActionListener;
-import com.arsdigita.bebop.event.ActionEvent;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.bebop.Resettable;
-import com.arsdigita.bebop.parameters.LongParameter;
-import com.arsdigita.web.RedirectSignal;
-
-import com.arsdigita.cms.CMS;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.util.Classes;
-
-import org.librecms.CMSConfig;
-import org.libreccm.core.UnexpectedErrorException;
-import org.librecms.CmsConstants;
-import org.librecms.ui.authoring.ContentItemAuthoringStep;
-
-import java.math.BigDecimal;
-
-@ContentItemAuthoringStep(
- labelBundle = CmsConstants.CMS_BUNDLE,
- labelKey = "item_category_step.label",
- descriptionBundle = CmsConstants.CMS_BUNDLE,
- descriptionKey = "item_category_step.description"
-)
-public class ItemCategoryStep extends SimpleContainer implements Resettable {
-
- private final LongParameter rootParameter;
- private final StringParameter modeParameter;
-
- private final ItemCategorySummary itemCategorySummary;
-
- private final SimpleComponent addComponent;
-
- private final SimpleComponent[] extensionSummaries;
- private final SimpleComponent[] extensionForms;
- private int extensionsCount;
-
- public ItemCategoryStep(final ItemSelectionModel itemSelectionModel,
- final AuthoringKitWizard authoringKitWizard,
- final StringParameter selectedLanguage) {
-
- super("cms:categoryStep", CMS.CMS_XML_NS);
-
- rootParameter = new LongParameter("root");
- modeParameter = new StringParameter("mode");
-
- itemCategorySummary = new ItemCategorySummary();
- itemCategorySummary.registerAction(ItemCategorySummary.ACTION_ADD,
- new AddActionListener("plain"));
- itemCategorySummary.registerAction(ItemCategorySummary.ACTION_ADD_JS,
- new AddActionListener("javascript"));
-
- final String addFormClassName = null;
- final Class> addFormClass;
- try {
- addFormClass = Class.forName(addFormClassName);
- } catch (ClassNotFoundException ex) {
- throw new UnexpectedErrorException(ex);
- }
- addComponent = (SimpleComponent) Classes
- .newInstance(addFormClass,
- new Class>[]{LongParameter.class,
- StringParameter.class},
- new Object[]{rootParameter, modeParameter});
- addComponent.addCompletionListener(new ResetListener());
-
- final String extensionClassName = CMSConfig
- .getConfig()
- .getCategoryAuthoringExtension();
- final Class> extensionClass;
- try {
- extensionClass = Class.forName(extensionClassName);
- } catch (ClassNotFoundException ex) {
- throw new UnexpectedErrorException(ex);
- }
- final ItemCategoryExtension extension = (ItemCategoryExtension) Classes
- .newInstance(extensionClass);
-
- extensionSummaries = extension.getSummary();
- extensionForms = extension.getForm();
- int nSummaries = extensionSummaries.length;
- int nForms = extensionForms.length;
- if (nSummaries != nForms) {
- throw new UnexpectedErrorException(
- "Invalid category step extension.");
- }
- extensionsCount = nForms;
- for (int i = 0; i < extensionsCount; i++) {
- extensionSummaries[i]
- .addCompletionListener(new ExtensionListener(i));
- extensionForms[i].addCompletionListener(new ResetListener());
- super.add(extensionSummaries[i]);
- super.add(extensionForms[i]);
- }
- super.add(itemCategorySummary);
- super.add(addComponent);
- }
-
- @Override
- public void register(final Page page) {
- super.register(page);
-
- page.setVisibleDefault(addComponent, false);
- for (int i = 0; i < extensionsCount; i++) {
- page.setVisibleDefault(extensionForms[i], false);
- }
- page.addGlobalStateParam(rootParameter);
- page.addGlobalStateParam(modeParameter);
- }
-
- @Override
- public void reset(final PageState state) {
- state.setValue(rootParameter, null);
- state.setValue(modeParameter, null);
-
- itemCategorySummary.setVisible(state, true);
- addComponent.setVisible(state, false);
- for (int i = 0; i < extensionsCount; i++) {
- extensionSummaries[i].setVisible(state, true);
- extensionForms[i].setVisible(state, false);
- }
- }
-
- private class AddActionListener implements ActionListener {
-
- private final String mode;
-
- public AddActionListener(final String mode) {
- this.mode = mode;
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
-
- final PageState state = event.getPageState();
-
- state.setValue(rootParameter,
- new BigDecimal(state.getControlEventValue()));
-
- state.setValue(ItemCategoryStep.this.modeParameter,
- mode);
-
- itemCategorySummary.setVisible(state, false);
- addComponent.setVisible(state, true);
- for (int i=0;iJens Pelzetter
- */
-@RequestScoped
-class ItemCategoryStepController {
-
- @Inject
- private ContentSectionRepository sectionRepo;
-
- @Transactional(Transactional.TxType.REQUIRED)
- protected List getRootCategories(final ContentSection section) {
-
- Objects.requireNonNull(section);
-
- final ContentSection contentSection = sectionRepo
- .findById(section.getObjectId())
- .orElseThrow(() -> new IllegalArgumentException(String
- .format("No ContentSection with ID %d in the database.",
- section.getObjectId())));
-
- return contentSection
- .getDomains()
- .stream()
- .map(domainOwnership -> domainOwnership.getDomain())
- .map(domain -> domain.getRoot())
- .collect(Collectors.toList());
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ItemCategorySummary.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ItemCategorySummary.java
deleted file mode 100755
index a6eaabbef..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ItemCategorySummary.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 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.authoring;
-
-import com.arsdigita.bebop.PageState;
-
-import org.libreccm.categorization.Category;
-
-import com.arsdigita.categorization.ui.ACSObjectCategorySummary;
-import com.arsdigita.cms.CMS;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.core.CcmObject;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-
-import java.util.List;
-
-public class ItemCategorySummary extends ACSObjectCategorySummary {
-
- public ItemCategorySummary() {
- super();
- }
-
- @Override
- protected boolean canEdit(final PageState state) {
-
- final PermissionChecker permissionChecker = CdiUtil
- .createCdiUtil()
- .findBean(PermissionChecker.class);
-
- return permissionChecker.isPermitted(ItemPrivileges.CATEGORIZE,
- CMS.getContext().getContentItem());
- }
-
-
- /*
- * @see com.arsdigita.categorization.ui.ObjectCategorySummary#getObject()
- */
- @Override
- protected CcmObject getObject(final PageState state) {
-
- return CMS.getContext().getContentItem();
- }
-
- /*
- * @see com.arsdigita.categorization.ui.ObjectCategorySummary#getXMLPrefix()
- */
- @Override
- protected String getXMLPrefix() {
- return "cms";
- }
-
- /*
- * @see com.arsdigita.categorization.ui.ObjectCategorySummary#getXMLNameSpace()
- */
- @Override
- protected String getXMLNameSpace() {
- return CMS.CMS_XML_NS;
- }
-
- /*
- * @see com.arsdigita.categorization.ui.ObjectCategorySummary#getRootCategories()
- */
- @Override
- protected List getRootCategories(final PageState state) {
-
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final ItemCategoryStepController controller = cdiUtil
- .findBean(ItemCategoryStepController.class);
-
- return controller.getRootCategories(CMS.getContext().getContentSection());
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ResettableContainer.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ResettableContainer.java
deleted file mode 100755
index 357674f6e..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ResettableContainer.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (C) 2002-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.authoring;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Resettable;
-import com.arsdigita.bebop.SimpleContainer;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * A container which implements the {@link Resettable} interface and provides
- * other useful methods.
- *
- * @author Phong Nguyen
- * @author Jens Pelzetter
- */
-public class ResettableContainer extends SimpleContainer implements Resettable {
-
- /**
- * A list of all resettable components in this container
- */
- private final List resettableComponents = new ArrayList<>();
-
- /**
- * A list of all components that are not visible by default
- */
- private final List componentsNotVisibleByDefault
- = new ArrayList<>();
-
- /**
- * Constructs a new, empty {@code RessetableContainer}.
- *
- */
- public ResettableContainer() {
- super();
- }
-
- /**
- * Constructs a new, empty {@code ResettableContainer}.
- *
- * @param key The key for this container.
- *
- */
- public ResettableContainer(final String key) {
- super();
- setKey(key);
- }
-
- /**
- * Constructs a new, empty {@code RessetableContainer}. The container will
- * wrap its children in the specified tag.
- *
- * @param tag The name of the XML element that will be used to wrap
- * the children of this container.
- * @param namespace The namespace for the tag.
- *
- */
- public ResettableContainer(final String tag, final String namespace) {
- super(tag, namespace);
- }
-
- /**
- * Adds a component to container.
- *
- * @param component The component to be added.
- *
- */
- @Override
- public void add(final Component component) {
- add(component, true);
- }
-
- /**
- * Add a component to this container
- *
- * @param component The component to be added.
- * @param constraints This parameter is ignored. Child classes should
- * override the add method if they wish to provide
- * special handling of constraints.
- *
- */
- @Override
- public void add(final Component component, final int constraints) {
- add(component);
- }
-
- /**
- * Adds the component to this pane with the specified default visibility.
- *
- * @param component
- * @param defaultVisibility The default visibility of this component
- *
- *
- */
- public void add(final Component component,
- final boolean defaultVisibility) {
-
- super.add(component);
- if (component instanceof Resettable) {
- resettableComponents.add(component);
- }
- if (!defaultVisibility) {
- componentsNotVisibleByDefault.add(component);
- }
- }
-
- /**
- * Sets the visibility of all child components to false, except for the
- * component with the specified key.
- *
- * @param state The state of the current request.
- * @param key The key of the component. There will be no visibility
- * changes if key is null.
- *
- */
- public void onlyShowComponent(final PageState state,
- final String key) {
-
- if (key == null) {
- return;
- }
-
- @SuppressWarnings("unchecked")
- final Iterator iter = children();
- Component child;
- while (iter.hasNext()) {
- child = iter.next();
- child.setVisible(state, key.equals(child.getKey()));
- }
- }
-
- /**
- * Sets the visibility of all child components to false, except for the
- * specified component.
- *
- * @param state The state of the current request.
- * @param component The key of the component. There will be no visibility
- * changes if {@code component} is null.
- *
- */
- public void onlyShowComponent(final PageState state,
- final Component component) {
-
- if (component == null) {
- return;
- }
-
- @SuppressWarnings("unchecked")
- final Iterator iter = children();
- Component child;
- while (iter.hasNext()) {
- child = iter.next();
- child.setVisible(state, child.equals(component));
- }
- }
-
- /**
- * Resets all resettable components added to this container.
- *
- * @param state The state of the current request.
- *
- */
- @Override
- public void reset(final PageState state) {
- // Reset all resettable components automatically
- final Iterator iter = resettableComponents.iterator();
- while (iter.hasNext()) {
- ((Resettable) iter.next()).reset(state);
- }
- }
-
- /**
- * Registers with page that this container belongs to and sets the default
- * visibility of child components.
- *
- * @param page The page this container belongs to.
- *
- */
- @Override
- public void register(final Page page) {
- final Iterator iter = componentsNotVisibleByDefault
- .iterator();
- while (iter.hasNext()) {
- page.setVisibleDefault(iter.next(), false);
- }
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/SimpleEditStep.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/SimpleEditStep.java
deleted file mode 100755
index fa44a872b..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/SimpleEditStep.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * 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.ui.authoring;
-
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.RequestEvent;
-import com.arsdigita.bebop.event.RequestListener;
-import com.arsdigita.bebop.parameters.StringParameter;
-
-import org.librecms.contentsection.ContentItem;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.ContentItemPage;
-import com.arsdigita.cms.ui.SecurityPropertyEditor;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.ComponentAccess;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-import java.text.DateFormat;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.core.UnexpectedErrorException;
-import org.libreccm.l10n.GlobalizationHelper;
-import org.librecms.CmsConstants;
-
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Objects;
-import java.util.Optional;
-
-/**
- * A simple implementation of an Authoring Kit editing step. Extends
- * {@link SecurityPropertyEditor} and provides authoring kit integration. See
- * the authoring kit documentation for more info.
- *
- * Child classes should a). call setDisplayComponent() b). call add() zero or
- * more times
- *
- * @author Stanislav Freidin
- * @author Jens Pelzetter
- */
-public class SimpleEditStep extends SecurityPropertyEditor
- implements AuthoringStepComponent, RequestListener {
-
- private AuthoringKitWizard authoringKitWizard;
- private ItemSelectionModel itemSelectionModel;
- private String defaultEditKey = null;
-
- private StringParameter streamlinedCreationParameter;
- private static final String STREAMLINED = "_streamlined";
- private static final String STREAMLINED_DONE = "1";
-
- private final StringParameter selectedLanguageParameter;
-
- private static List additionalDisplayComponents
- = new ArrayList<>();
-
- /**
- * allow additional display components to be added to all implementations of
- * SimpleEditStep. This allows shared optional packages such as notes to
- * display information on the initial authoring page of all content types
- * without causing dependencies from ccm-cms.
- *
- * Any additional components must be added before the edit step is created.
- * An initialiser is a suitable location
- *
- * @param additionalDisplayComponent
- */
- public static void addAdditionalDisplayComponent(
- AdditionalDisplayComponent additionalDisplayComponent) {
-
- additionalDisplayComponents.add(additionalDisplayComponent);
- }
-
- /**
- * Construct a new SimpleEditStep component
- *
- * @param itemModel The {@link ItemSelectionModel} which will be
- * responsible for loading the current item
- *
- * @param parent The parent wizard which contains the form.
- * The component may use the wizard's methods,
- * such as stepForward and stepBack, in its
- * process listener.
- * @param selectedLanguageParam
- */
- public SimpleEditStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLanguageParam) {
- this(itemModel, parent, selectedLanguageParam, "");
- }
-
- /**
- * Construct a new SimpleEditStep component
- *
- * @param itemSelectionModel The {@link ItemSelectionModel} which will be
- * responsible for loading the current item
- *
- * @param authoringKitWizard The parent wizard which contains the form. The
- * component may use the wizard's methods, such as
- * stepForward and stepBack, in its process
- * listener.
- * @param selectedLanguageParam
- *
- * @param parameterSuffix Additional global parameter name suffix if
- * there are multiple SimpleEditStep instances in
- * an authoring kit.
- */
- public SimpleEditStep(final ItemSelectionModel itemSelectionModel,
- final AuthoringKitWizard authoringKitWizard,
- final StringParameter selectedLanguageParam,
- final String parameterSuffix) {
-
- super();
-
- Objects.requireNonNull(selectedLanguageParam);
-
- this.authoringKitWizard = authoringKitWizard;
- this.itemSelectionModel = itemSelectionModel;
-
- this.selectedLanguageParameter = selectedLanguageParam;
-
- streamlinedCreationParameter = new StringParameter(
- authoringKitWizard.getContentType().getContentItemClass().getName()
- + "_properties_done" + parameterSuffix);
-
- authoringKitWizard
- .getList()
- .addActionListener(event -> showDisplayPane(event.getPageState()));
-
- additionalDisplayComponents
- .stream()
- .forEach(component -> {
- component.setItemSelectionModel(itemSelectionModel);
- addDisplayComponent(component);
- });
- }
-
- /**
- * Registers global state parameter for cancelling streamlined creation
- *
- * @param page
- */
- @Override
- public void register(final Page page) {
-
- super.register(page);
- page.addGlobalStateParam(streamlinedCreationParameter);
- page.addRequestListener(this);
- }
-
- /**
- * @return the parent wizard
- */
- public AuthoringKitWizard getParentWizard() {
- return authoringKitWizard;
- }
-
- /**
- * @return The item selection model
- */
- public ItemSelectionModel getItemSelectionModel() {
- return itemSelectionModel;
- }
-
- /**
- * Forward to the next step if the streamlined creation parameter is turned
- * on _and_ the streamlined_creation global state parameter is set to
- * 'active'
- *
- * @param state the PageState
- */
- public void maybeForwardToNextStep(final PageState state) {
- if (ContentItemPage.isStreamlinedCreationActive(state)
- && !STREAMLINED_DONE.equals(state.getValue(
- streamlinedCreationParameter))) {
- state.setValue(streamlinedCreationParameter, STREAMLINED_DONE);
- fireCompletionEvent(state);
- }
- }
-
- /**
- * Cancel streamlined creation for this step if the streamlined creation
- * parameter is turned on _and_ the streamlined_creation global state param
- * is set to 'active'
- *
- * @param state the PageState
- */
- public void cancelStreamlinedCreation(final PageState state) {
-
- if (ContentItemPage.isStreamlinedCreationActive(state)) {
- state.setValue(streamlinedCreationParameter, STREAMLINED_DONE);
- }
- }
-
- public void setDefaultEditKey(final String key) {
- defaultEditKey = key;
- }
-
- /**
- * Open the edit component if the streamlined creation parameter is turned
- * on _and_ the streamlined_creation global state param is set to 'active'
- *
- * @param e
- */
- @Override
- public void pageRequested(final RequestEvent e) {
- PageState state = e.getPageState();
-
- // XXX: This method is called on every page request for every authoring
- // step in every authoring kit. This has in the past revealed a caching
- // side-effect bug, but should in the main be harmless. Except of course
- // for performance.
- // Ideally this method would only be called for a single authoring step
- // on each page load. However, at the stage that this is called,
- // visibility has not been set, and getting the selected authoring kit
- // or component is not straightforward, and would almost certainly
- // involve duplicating code.
- // This need to be rethought.
- //if( !state.isVisibleOnPage( this ) ) return;
- if (defaultEditKey != null && itemSelectionModel.getSelectedItem(state)
- != null) {
-
- final ComponentAccess componentAccess = getAccessMap()
- .get(defaultEditKey);
-
- if (ContentItemPage.isStreamlinedCreationActive(state)
- && !STREAMLINED_DONE
- .equals(state.getValue(streamlinedCreationParameter))
- && componentAccess != null
- && componentAccess.canAccess(state)) {
- showComponent(state, defaultEditKey);
- }
- }
-
- }
-
- /**
- * Public class which implements an AttributeFormatter interface for boolean
- * values. Its format(...) class returns a string representation for either
- * a false or a true value.
- */
- protected static class LaunchDateAttributeFormatter
- implements DomainObjectPropertySheet.AttributeFormatter {
-
- /**
- * Constructor, does nothing.
- */
- public LaunchDateAttributeFormatter() {
- }
-
- /**
- * Formatter for the value of a (LaunchDate) attribute.
- *
- * It currently relays on the prerequisite that the passed in property
- * attribute is in fact a date property. No type checking yet!
- *
- * Note: the format method has to be executed at each page request. Take
- * care to properly adjust globalisation and localisation here!
- *
- * @param object Object containing the attribute to format.
- * @param attribute Name of the attribute to retrieve and format
- * @param state PageState of the request
- *
- * @return A String representation of the retrieved boolean attribute of
- * the domain object.
- */
- @Override
- public String format(final Object object,
- final String attribute,
- final PageState state) {
-
- if (object != null && object instanceof ContentItem) {
-
- final ContentItem page = (ContentItem) object;
- final BeanInfo beanInfo;
- try {
- beanInfo = Introspector
- .getBeanInfo(page.getClass());
- } catch (IntrospectionException ex) {
- throw new UnexpectedErrorException(ex);
- }
- final Optional propertyDescriptor = Arrays
- .stream(beanInfo.getPropertyDescriptors())
- .filter(propDesc -> attribute.equals(propDesc.getName()))
- .findAny();
- if (propertyDescriptor.isPresent()) {
- final Method readMethod = propertyDescriptor
- .get()
- .getReadMethod();
- final Object value;
- try {
- value = readMethod.invoke(object);
- } catch (IllegalAccessException | InvocationTargetException ex) {
- throw new IllegalArgumentException(ex);
- }
- if (value == null) {
- return (String) new GlobalizedMessage("cms.ui.unknown",
- CmsConstants.CMS_BUNDLE)
- .localize();
- } else {
- final GlobalizationHelper globalizationHelper = CdiUtil
- .createCdiUtil()
- .findBean(GlobalizationHelper.class);
-
- // Note: No type safety here! We relay that it is
- // attached to a date property!
- return DateFormat.getDateInstance(
- DateFormat.LONG,
- globalizationHelper.getNegotiatedLocale())
- .format(value);
- }
- } else {
- return (String) new GlobalizedMessage("cms.ui.unknown",
- CmsConstants.CMS_BUNDLE)
- .localize();
- }
-
- } else {
- return (String) new GlobalizedMessage("cms.ui.unknown",
- CmsConstants.CMS_BUNDLE)
- .localize();
- }
- }
-
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/TextBodyPropertySheet.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/TextBodyPropertySheet.java
deleted file mode 100755
index 1bbfac4a4..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/TextBodyPropertySheet.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (C) 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.authoring;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.PropertySheet;
-import com.arsdigita.bebop.PropertySheetModel;
-import com.arsdigita.bebop.PropertySheetModelBuilder;
-import com.arsdigita.util.LockableImpl;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-import java.util.Iterator;
-
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-
-import org.libreccm.l10n.LocalizedString;
-
-/**
- * This extends DomainObjectPropertySheet and has a lot of duplicate code from
- * it because it uses so many private inner classes
- *
- */
-public class TextBodyPropertySheet extends DomainObjectPropertySheet {
-
- /**
- * Construct a new TextAssetBodyPropertySheet
- *
- * @param objModel The selection model which feeds domain
- * objects to this property sheet.
- * @param selectedLanguageParam
- *
- */
- public TextBodyPropertySheet(
- final ItemSelectionModel objModel,
- final StringParameter selectedLanguageParam) {
-
- super(objModel, false, selectedLanguageParam);
- setModelBuilder(new TMBAdapter(new DomainObjectModelBuilder()));
- getColumn(1).setCellRenderer(new TextAssetBodyLabelCellRenderer());
- }
-
- // Build up the object properties model from the iterator over all properties
- private static class TextAssetBodyPropertiesModel
- implements PropertySheetModel {
-
-// public final static String MIME_TYPE_KEY
-// = TextAssetBodyLabelCellRenderer.MIME_TYPE_KEY;
- private static final String ERROR = "No current property. "
- + "Make sure that nextRow() was "
- + "called at least once.";
-
- private LocalizedString textAsset;
- private PageState pageState;
- private Iterator properties;
- private Property currentProperty;
-
- public TextAssetBodyPropertiesModel(final LocalizedString textAsset,
- final Iterator properties,
- final PageState pageState) {
- this.textAsset = textAsset;
- this.properties = properties;
- this.pageState = pageState;
- currentProperty = null;
- }
-
- @Override
- public boolean nextRow() {
-
- if (properties.hasNext()) {
- currentProperty = properties.next();
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * @deprecated use getGlobalizedLabel() instead
- */
- @Override
- @Deprecated
- public String getLabel() {
- return getGlobalizedLabel().getKey();
- }
-
- @Override
- public GlobalizedMessage getGlobalizedLabel() {
- if (currentProperty == null) {
- throw new IllegalStateException(ERROR);
- }
- return currentProperty.getGlobalizedLabel();
- }
-
- @Override
- public String getValue() {
- return getObjectValue().toString();
- }
-
- public Object getObjectValue() {
- if (currentProperty == null) {
- throw new IllegalStateException(ERROR);
- }
-
- return textAsset;
- }
-
- public String getAttribute() {
- return currentProperty.getAttribute();
- }
-
- }
-
- // Builds an TextAssetBodyPropertiesModel
- private static class DomainObjectModelBuilder extends LockableImpl
- implements PropertySheetModelBuilder {
-
- @Override
- public PropertySheetModel makeModel(final PropertySheet sheet,
- final PageState state) {
-
- TextBodyPropertySheet propSheet
- = (TextBodyPropertySheet) sheet;
- throw new UnsupportedOperationException("ToDo");
- }
-
- }
-
- // These are both from PropertySheet
- // Convert a PropertySheetModelBuilder to a TableModelBuilder
- private static class TMBAdapter
- extends LockableImpl implements TableModelBuilder {
-
- private final PropertySheetModelBuilder modelBuilder;
-
- public TMBAdapter(final PropertySheetModelBuilder builder) {
- this.modelBuilder = builder;
- }
-
- @Override
- public TableModel makeModel(final Table table,
- final PageState state) {
- return new TableModelAdapter(
- (TextAssetBodyPropertiesModel) modelBuilder.makeModel(
- (PropertySheet) table, state));
- }
-
- @Override
- public void lock() {
- modelBuilder.lock();
- super.lock();
- }
-
- }
-
- // Wraps a PropertySheetModel
- private static class TableModelAdapter implements TableModel {
-
- private final TextAssetBodyPropertiesModel propertiesModel;
- private int row;
-
- public TableModelAdapter(
- final TextAssetBodyPropertiesModel propertiesModel) {
-
- this.propertiesModel = propertiesModel;
- row = -1;
- }
-
- @Override
- public int getColumnCount() {
- return 2;
- }
-
- @Override
- public boolean nextRow() {
- row++;
- return propertiesModel.nextRow();
- }
-
- @Override
- public Object getElementAt(final int columnIndex) {
- if (columnIndex == 0) {
- return propertiesModel.getGlobalizedLabel();
- } else {
- return propertiesModel.getObjectValue();
- }
- }
-
- @Override
- public Object getKeyAt(final int columnIndex) {
- return propertiesModel.getAttribute();
- }
-
- public PropertySheetModel getPSModel() {
- return propertiesModel;
- }
-
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/item/ItemCreateForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/item/ItemCreateForm.java
deleted file mode 100644
index 938efc4da..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/item/ItemCreateForm.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2016 LibreCCM Foundation.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-package com.arsdigita.cms.ui.item;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ItemCreateForm {
-
- //Placeholder
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/search/ItemQueryComponent.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/search/ItemQueryComponent.java
index 48690f320..05ffeb24a 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/search/ItemQueryComponent.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/search/ItemQueryComponent.java
@@ -18,11 +18,9 @@
*/
package com.arsdigita.cms.ui.search;
-import com.arsdigita.bebop.form.Submit;
import org.librecms.contentsection.ContentType;
-import com.arsdigita.cms.ui.ContentSectionPage;
import com.arsdigita.search.ui.BaseQueryComponent;
/**
@@ -48,92 +46,4 @@ public class ItemQueryComponent extends BaseQueryComponent {
final ContentType type) {
this.context = context;
-//ToDo
-// add(new PermissionFilterComponent(
-// SecurityManager.CMS_PREVIEW_ITEM));
-//
-// add(new SimpleCategoryFilterWidget() {
-//
-// @Override
-// protected Category[] getRoots(PageState state) {
-// Category[] roots;
-// if (limitToContentSection == true && CMS.getContext().
-// hasContentSection()) {
-// ContentSection section = CMS.getContext().
-// getContentSection();
-// roots = new Category[]{section.getRootCategory()};
-// } else {
-// ContentSectionCollection sections =
-// ContentSection.getAllSections();
-// List cats = new ArrayList();
-// while (sections.next()) {
-// ContentSection section =
-// sections.getContentSection();
-// cats.add(section.getRootCategory());
-// }
-// roots =
-// (Category[]) cats.toArray(new Category[cats.size()]);
-// }
-// return roots;
-// }
-// });
-//
-// if (type == null) {
-// add(new ContentTypeFilterWidget() {
-//
-// @Override
-// protected ContentSection getContentSection() {
-// if (limitToContentSection == true && CMS.getContext().
-// hasContentSection()) {
-// return CMS.getContext().getContentSection();
-// } else {
-// return super.getContentSection();
-// }
-// }
-// });
-// } else {
-// add(new ContentTypeFilterWidget(type) {
-//
-// @Override
-// protected ContentSection getContentSection() {
-// if (limitToContentSection == true && CMS.getContext().
-// hasContentSection()) {
-// return CMS.getContext().getContentSection();
-// } else {
-// return super.getContentSection();
-// }
-// }
-// });
-// }
-//
-// add(new VersionFilterComponent(context));
-// if (limitToContentSection == true) {
-// add(new ContentSectionFilterComponent());
-// }
-// add(new DateRangeFilterWidget(new LastModifiedDateFilterType(),
-// LastModifiedDateFilterType.KEY));
-// add(new DateRangeFilterWidget(new CreationDateFilterType(),
-// CreationDateFilterType.KEY));
-// add(new PartyFilterWidget(new CreationUserFilterType(),
-// CreationUserFilterType.KEY));
-// add(new PartyFilterWidget(new LastModifiedUserFilterType(),
-// LastModifiedUserFilterType.KEY));
-// Submit submit = new Submit(context + "_search",
-// ContentSectionPage.globalize("cms.ui.search"));
-// add(submit);
- }
-
-// private class LaunchDateFilterWidget extends DateRangeFilterWidget {
-//
-// public LaunchDateFilterWidget(FilterType type, String name) {
-// super(type, name);
-//
-// }
-//
-// @Override
-// public boolean isVisible(PageState state) {
-// return !ContentSection.getConfig().getHideLaunchDate()
-// && super.isVisible(state);
-// }
-// }
}
diff --git a/ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionServlet.java b/ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionServlet.java
index adaf762a2..d04f12b2d 100644
--- a/ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionServlet.java
+++ b/ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionServlet.java
@@ -21,7 +21,6 @@ package org.librecms.contentsection;
import com.arsdigita.bebop.Page;
import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.dispatcher.ContentItemDispatcher;
-import com.arsdigita.cms.ui.CMSApplicationPage;
import com.arsdigita.dispatcher.AccessDeniedException;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.dispatcher.RequestContext;
@@ -291,16 +290,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
// final RequestContext ctx = DispatcherHelper.getRequestContext();
cmsPage.init();
cmsPage.dispatch(request, response, ctx);
- } else {
- final CMSApplicationPage cmsAppPage = (CMSApplicationPage) page;
- cmsAppPage.init(request, response, app);
- // Serve the page.
- final Document doc = cmsAppPage.buildDocument(request, response);
-
- final PresentationManager pm = Templating
- .getPresentationManager();
- pm.servePage(doc, request, response);
- }
+ }
/* SECONDLY try if we have to serve an item (old style dispatcher based */
} else if (item != null) {