Diverse Formatierungen und Ergänzungen Kommentare / Doku.
git-svn-id: https://svn.libreccm.org/ccm/trunk@888 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
0e77a923bb
commit
751e7716e1
|
|
@ -26,18 +26,20 @@ import com.arsdigita.util.Assert;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A basic implementation of the {@link Container} interface.
|
* A basic implementation of the {@link Container} interface which, by default,
|
||||||
* <p>By default,
|
* renders all of its children directly, without wrapping them in any kind of
|
||||||
* renders all of its children directly, without wrapping them in any
|
* tag.
|
||||||
* kind of tag.
|
|
||||||
* However, the {@link #SimpleContainer(String, String)} constructor
|
|
||||||
* and/or the {@link #setTag(String)} method can be used to cause the container
|
|
||||||
* to wrap the XML for its children in an arbitrary tag. This functionality
|
|
||||||
* is useful for XSL templating.
|
|
||||||
* For example, a template rule might be
|
|
||||||
* written to arrange the children of this component in paragraphs:
|
|
||||||
*
|
*
|
||||||
* <blockquote><pre><code>// Java Code:
|
* However, the {@link #SimpleContainer(String, String)} constructor and/or the
|
||||||
|
* {@link #setTag(String)} method can be used to cause the container to wrap
|
||||||
|
* the XML for its children in an arbitrary tag. This functionality is useful
|
||||||
|
* for XSL templating.
|
||||||
|
*
|
||||||
|
* For example, a template rule might be written to arrange the children of this
|
||||||
|
* component in paragraphs:
|
||||||
|
*
|
||||||
|
* <blockquote><pre><code>
|
||||||
|
* // Java Code:
|
||||||
* m_container = new SimpleContainer("cms:foo", CMS_XML_NS);
|
* m_container = new SimpleContainer("cms:foo", CMS_XML_NS);
|
||||||
*
|
*
|
||||||
* // XSL code:
|
* // XSL code:
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,14 @@ import com.arsdigita.domain.DomainObject;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link SingleSelectionModel} which loads an item from the
|
* A {@link SingleSelectionModel} which loads an item from the database.
|
||||||
* database. The isSelected() method will return true if it
|
*
|
||||||
* was possible to load the item.
|
* The isSelected() method will return true if it was possible to load the item.
|
||||||
|
*
|
||||||
|
* @version $Id: DomainObjectSelectionModel.java 287 2005-02-22 00:29:02Z sskracic $
|
||||||
*/
|
*/
|
||||||
public interface DomainObjectSelectionModel extends SingleSelectionModel {
|
public interface DomainObjectSelectionModel extends SingleSelectionModel {
|
||||||
|
|
||||||
public static final String versionId = "$Id: DomainObjectSelectionModel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the item which was selected and loaded from the database,
|
* Return the item which was selected and loaded from the database,
|
||||||
* using the values supplied in PageState.
|
* using the values supplied in PageState.
|
||||||
|
|
@ -38,7 +38,6 @@ public interface DomainObjectSelectionModel extends SingleSelectionModel {
|
||||||
* @param state The page state
|
* @param state The page state
|
||||||
* @return The item domain object, or null if no item is
|
* @return The item domain object, or null if no item is
|
||||||
* selected.
|
* selected.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
DomainObject getSelectedObject(PageState state);
|
DomainObject getSelectedObject(PageState state);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,12 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Workspace domain class.
|
* Class <b>Workspace</b> is the main domain class (extending Application) for
|
||||||
* A workspace represents an area containing 0...n portals each arranged
|
* the portalworkspace module.
|
||||||
* as a pane of page. Each portal (or pane) manages a number of portlets.
|
*
|
||||||
|
* A (portal)workspace represents an area containing 0...n portals each arranged
|
||||||
|
* as a pane of page. Each portal (or pane) manages a number of portlets. So a
|
||||||
|
* workspace is a container for a set of portal panes.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Workspace extends Application {
|
public class Workspace extends Application {
|
||||||
|
|
@ -69,11 +72,13 @@ public class Workspace extends Application {
|
||||||
/** Private logger instance for debugging purpose */
|
/** Private logger instance for debugging purpose */
|
||||||
private static final Logger s_log = Logger.getLogger(Workspace.class);
|
private static final Logger s_log = Logger.getLogger(Workspace.class);
|
||||||
|
|
||||||
|
/** Config object containing various parameter */
|
||||||
private static final WorkspaceConfig s_config = WorkspaceConfig.getConfig();
|
private static final WorkspaceConfig s_config = WorkspaceConfig.getConfig();
|
||||||
|
|
||||||
public static WorkspaceConfig getConfig() {
|
public static WorkspaceConfig getConfig() {
|
||||||
return s_config;
|
return s_config;
|
||||||
}
|
}
|
||||||
|
/** PDL stuff */
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.portalworkspace.Workspace";
|
"com.arsdigita.portalworkspace.Workspace";
|
||||||
public static final String PARTY = "party";
|
public static final String PARTY = "party";
|
||||||
|
|
@ -88,7 +93,7 @@ public class Workspace extends Application {
|
||||||
private static Workspace defaultHomepageWorkspace = null;
|
private static Workspace defaultHomepageWorkspace = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor retrieves the domain object using its DataObject representation
|
||||||
* @param obj
|
* @param obj
|
||||||
*/
|
*/
|
||||||
public Workspace(DataObject obj) {
|
public Workspace(DataObject obj) {
|
||||||
|
|
@ -246,12 +251,12 @@ public class Workspace extends Application {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the workspace that is created during loading of the
|
* Retrieve the workspace that is created during loading of the
|
||||||
* ccm-ldn-portal application and is set as the defaultworkspace for the
|
* ccm-portalworkspace application and is set as the defaultworkspace
|
||||||
* site.
|
* for the site.
|
||||||
*
|
*
|
||||||
* Returns null if there are no workspaces (though presumably if that is the
|
* Returns null if there are no workspaces (though presumably if that is the
|
||||||
* case, ccm-ldn-portal hasn't been loaded and so I don't know how you are
|
* case, ccm-portalworkspace hasn't been loaded and so I don't know how you
|
||||||
* invoking this method!)
|
* are invoking this method!)
|
||||||
*
|
*
|
||||||
* @return default workspace instance (created during load)
|
* @return default workspace instance (created during load)
|
||||||
*/
|
*/
|
||||||
|
|
@ -280,6 +285,9 @@ public class Workspace extends Application {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void beforeSave() {
|
public void beforeSave() {
|
||||||
// If no permissions are configured, then setup empty groups
|
// If no permissions are configured, then setup empty groups
|
||||||
|
|
@ -346,6 +354,11 @@ public class Workspace extends Application {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param title
|
||||||
|
* @param isPublic
|
||||||
|
*/
|
||||||
private void setupGroups(String title, boolean isPublic) {
|
private void setupGroups(String title, boolean isPublic) {
|
||||||
Group members = new Group();
|
Group members = new Group();
|
||||||
members.setName(title);
|
members.setName(title);
|
||||||
|
|
@ -380,10 +393,19 @@ public class Workspace extends Application {
|
||||||
setParty(members);
|
setParty(members);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static WorkspaceCollection retrieveAll() {
|
public static WorkspaceCollection retrieveAll() {
|
||||||
return retrieveAll(null);
|
return retrieveAll(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static WorkspaceCollection retrieveAll(Application parent) {
|
public static WorkspaceCollection retrieveAll(Application parent) {
|
||||||
DataCollection wks = SessionManager.getSession().retrieve(
|
DataCollection wks = SessionManager.getSession().retrieve(
|
||||||
BASE_DATA_OBJECT_TYPE);
|
BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
@ -394,11 +416,14 @@ public class Workspace extends Application {
|
||||||
return new WorkspaceCollection(wks);
|
return new WorkspaceCollection(wks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
public Workspace retrieveSubworkspaceForParty(Party owner)
|
public Workspace retrieveSubworkspaceForParty(Party owner)
|
||||||
throws DataObjectNotFoundException {
|
throws DataObjectNotFoundException {
|
||||||
|
|
||||||
DataCollection wks = SessionManager.getSession().retrieve(
|
DataCollection wks = SessionManager.getSession()
|
||||||
BASE_DATA_OBJECT_TYPE);
|
.retrieve(BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
||||||
wks.addEqualsFilter("parentResource.id", getID());
|
wks.addEqualsFilter("parentResource.id", getID());
|
||||||
wks.addEqualsFilter(PARTY_ID, owner.getID());
|
wks.addEqualsFilter(PARTY_ID, owner.getID());
|
||||||
|
|
@ -741,6 +766,11 @@ public class Workspace extends Application {
|
||||||
return (User) get("owner");
|
return (User) get("owner");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param owner
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static Workspace createPersonalWorkspace(final User owner) {
|
public static Workspace createPersonalWorkspace(final User owner) {
|
||||||
|
|
||||||
s_log.debug("creating the personal portal for "
|
s_log.debug("creating the personal portal for "
|
||||||
|
|
@ -786,6 +816,11 @@ public class Workspace extends Application {
|
||||||
return workspace;
|
return workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param owner
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static Workspace retrievePersonalWorkspace(User owner) {
|
public static Workspace retrievePersonalWorkspace(User owner) {
|
||||||
DataCollection personalWorkspaces = SessionManager.getSession().retrieve(
|
DataCollection personalWorkspaces = SessionManager.getSession().retrieve(
|
||||||
BASE_DATA_OBJECT_TYPE);
|
BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -21,61 +24,92 @@ import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
import com.arsdigita.portalworkspace.Workspace;
|
import com.arsdigita.portalworkspace.Workspace;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
public abstract class AbstractWorkspaceComponent extends SimpleContainer {
|
public abstract class AbstractWorkspaceComponent extends SimpleContainer {
|
||||||
|
|
||||||
private WorkspaceSelectionModel m_workspace;
|
private WorkspaceSelectionModel m_workspace;
|
||||||
|
|
||||||
private DefaultPortalSelectionModel m_portal;
|
private DefaultPortalSelectionModel m_portal;
|
||||||
|
|
||||||
private WorkspaceDetails m_details;
|
private WorkspaceDetails m_details;
|
||||||
|
|
||||||
private PortalList m_portalList;
|
private PortalList m_portalList;
|
||||||
|
|
||||||
private PersistentPortal m_portalDisplay;
|
private PersistentPortal m_portalDisplay;
|
||||||
|
|
||||||
public AbstractWorkspaceComponent() {
|
/**
|
||||||
this(null);
|
* Default constructor creates a new, empty
|
||||||
}
|
* <code>AbstractWorkspaceComponent</code> using parents (SimpleContainer)
|
||||||
|
* default constructor.
|
||||||
|
*/
|
||||||
|
public AbstractWorkspaceComponent() {
|
||||||
|
this(null);
|
||||||
|
}
|
||||||
|
|
||||||
public AbstractWorkspaceComponent(WorkspaceSelectionModel workspace) {
|
/**
|
||||||
super("portal:workspace", PortalConstants.PORTAL_XML_NS);
|
*
|
||||||
|
* @param workspace
|
||||||
|
*/
|
||||||
|
public AbstractWorkspaceComponent(WorkspaceSelectionModel workspace) {
|
||||||
|
|
||||||
m_workspace = workspace;
|
/* Creates a WorkspaceComponent (SimpleContainer) that will wrap its
|
||||||
|
* children in the specified tag. */
|
||||||
|
super("portal:workspace", PortalConstants.PORTAL_XML_NS);
|
||||||
|
|
||||||
m_details = new WorkspaceDetails(m_workspace);
|
m_workspace = workspace;
|
||||||
|
m_details = new WorkspaceDetails(m_workspace);
|
||||||
|
m_portal = new DefaultPortalSelectionModel(new BigDecimalParameter(
|
||||||
|
"portal"));
|
||||||
|
m_portalList = createPortalList(m_portal);
|
||||||
|
m_portalDisplay = createPortalDisplay(m_portal);
|
||||||
|
|
||||||
m_portal = new DefaultPortalSelectionModel(new BigDecimalParameter(
|
add(m_details);
|
||||||
"portal"));
|
add(m_portalList);
|
||||||
|
add(m_portalDisplay);
|
||||||
|
}
|
||||||
|
|
||||||
m_portalList = createPortalList(m_portal);
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setWorkspaceModel(WorkspaceSelectionModel workspace) {
|
||||||
|
m_workspace = workspace;
|
||||||
|
m_details.setWorkspaceModel(workspace);
|
||||||
|
m_portalList.setWorkspaceModel(workspace);
|
||||||
|
m_portal.setWorkspaceModel(workspace);
|
||||||
|
}
|
||||||
|
|
||||||
m_portalDisplay = createPortalDisplay(m_portal);
|
public Workspace getSelectedWorkspace(PageState state) {
|
||||||
|
return m_workspace.getSelectedWorkspace(state);
|
||||||
|
}
|
||||||
|
|
||||||
add(m_details);
|
/**
|
||||||
add(m_portalList);
|
* To be overwritten by children class with class specific logic.
|
||||||
add(m_portalDisplay);
|
*
|
||||||
}
|
* @param portal
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected abstract PortalList createPortalList(PortalSelectionModel portal);
|
||||||
|
|
||||||
public void setWorkspaceModel(WorkspaceSelectionModel workspace) {
|
/**
|
||||||
m_workspace = workspace;
|
* To be overwritten by children class with class specific logic.
|
||||||
m_details.setWorkspaceModel(workspace);
|
*
|
||||||
m_portalList.setWorkspaceModel(workspace);
|
* @param portal
|
||||||
m_portal.setWorkspaceModel(workspace);
|
* @return
|
||||||
}
|
*/
|
||||||
|
protected abstract PersistentPortal createPortalDisplay(
|
||||||
|
PortalSelectionModel portal);
|
||||||
|
|
||||||
public Workspace getSelectedWorkspace(PageState state) {
|
/**
|
||||||
return m_workspace.getSelectedWorkspace(state);
|
*
|
||||||
}
|
*/
|
||||||
|
public void register(Page page) {
|
||||||
|
|
||||||
protected abstract PortalList createPortalList(PortalSelectionModel portal);
|
super.register(page);
|
||||||
|
page.addComponentStateParam(this, m_portal.getStateParameter());
|
||||||
|
|
||||||
protected abstract PersistentPortal createPortalDisplay(
|
}
|
||||||
PortalSelectionModel portal);
|
|
||||||
|
|
||||||
public void register(Page page) {
|
|
||||||
super.register(page);
|
|
||||||
|
|
||||||
page.addComponentStateParam(this, m_portal.getStateParameter());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,35 +27,55 @@ import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
public class ApplicationPortlet extends AbstractPortletRenderer {
|
public class ApplicationPortlet extends AbstractPortletRenderer {
|
||||||
|
|
||||||
private RequestLocal m_parent;
|
private RequestLocal m_parent;
|
||||||
|
private Component m_portletComponent;
|
||||||
|
private Component m_appComponent;
|
||||||
|
|
||||||
private Component m_portletComponent;
|
|
||||||
|
|
||||||
private Component m_appComponent;
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param title
|
||||||
|
* @param column
|
||||||
|
* @param row
|
||||||
|
* @param parent
|
||||||
|
* @param portletComponent
|
||||||
|
* @param appComponent
|
||||||
|
*/
|
||||||
|
public ApplicationPortlet(String title, int column, int row,
|
||||||
|
RequestLocal parent, Component portletComponent,
|
||||||
|
Component appComponent) {
|
||||||
|
|
||||||
public ApplicationPortlet(String title, int column, int row,
|
Assert.exists(parent, RequestLocal.class);
|
||||||
RequestLocal parent, Component portletComponent,
|
Assert.exists(portletComponent, Component.class);
|
||||||
Component appComponent) {
|
Assert.exists(appComponent, Component.class);
|
||||||
Assert.exists(parent, RequestLocal.class);
|
|
||||||
Assert.exists(portletComponent, Component.class);
|
|
||||||
Assert.exists(appComponent, Component.class);
|
|
||||||
|
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_portletComponent = portletComponent;
|
m_portletComponent = portletComponent;
|
||||||
m_appComponent = appComponent;
|
m_appComponent = appComponent;
|
||||||
|
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
setCellNumber(column);
|
setCellNumber(column);
|
||||||
setSortKey(row);
|
setSortKey(row);
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param state
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
|
protected void generateBodyXML(PageState state, Element parent) {
|
||||||
|
|
||||||
|
Element content = parent.newChildElement("portlet:simple",
|
||||||
|
PortalConstants.PORTLET_XML_NS);
|
||||||
|
|
||||||
|
if (m_parent.get(state) == null) {
|
||||||
|
m_appComponent.generateXML(state, content);
|
||||||
|
} else {
|
||||||
|
m_portletComponent.generateXML(state, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected void generateBodyXML(PageState state, Element parent) {
|
|
||||||
Element content = parent.newChildElement("portlet:simple",
|
|
||||||
PortalConstants.PORTLET_XML_NS);
|
|
||||||
if (m_parent.get(state) == null) {
|
|
||||||
m_appComponent.generateXML(state, content);
|
|
||||||
} else {
|
|
||||||
m_portletComponent.generateXML(state, content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,64 +31,83 @@ import com.arsdigita.bebop.form.Option;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
import com.arsdigita.bebop.SaveCancelSection;
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
import com.arsdigita.bebop.SimpleContainer;
|
import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.web.ApplicationType;
|
|
||||||
import com.arsdigita.web.Application;
|
|
||||||
import com.arsdigita.web.ApplicationCollection;
|
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.Party;
|
import com.arsdigita.kernel.Party;
|
||||||
import com.arsdigita.kernel.permissions.PermissionService;
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||||
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
import com.arsdigita.web.ApplicationType;
|
||||||
|
import com.arsdigita.web.Application;
|
||||||
|
import com.arsdigita.web.ApplicationCollection;
|
||||||
|
|
||||||
import com.arsdigita.london.util.ui.parameters.DomainObjectParameter;
|
import com.arsdigita.london.util.ui.parameters.DomainObjectParameter;
|
||||||
|
|
||||||
import java.util.TooManyListenersException;
|
import java.util.TooManyListenersException;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class ApplicationSelector extends Form {
|
public class ApplicationSelector extends Form {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(ApplicationSelector.class);
|
private static final Logger s_log = Logger.getLogger(ApplicationSelector.class);
|
||||||
|
|
||||||
private ApplicationType m_type;
|
private ApplicationType m_type;
|
||||||
private SingleSelect m_apps;
|
private SingleSelect m_apps;
|
||||||
private DomainObjectParameter m_app;
|
private DomainObjectParameter m_app;
|
||||||
private SaveCancelSection m_buttons;
|
private SaveCancelSection m_buttons;
|
||||||
|
|
||||||
private PrivilegeDescriptor m_privilege;
|
private PrivilegeDescriptor m_privilege;
|
||||||
|
|
||||||
public ApplicationSelector(ApplicationType type,
|
|
||||||
DomainObjectParameter app) {
|
|
||||||
this(type, app, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenient Constructor
|
||||||
|
* @param type
|
||||||
|
* @param app
|
||||||
|
*/
|
||||||
|
public ApplicationSelector(ApplicationType type,DomainObjectParameter app) {
|
||||||
|
this(type, app, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param type
|
||||||
|
* @param app
|
||||||
|
* @param privilege
|
||||||
|
*/
|
||||||
public ApplicationSelector(ApplicationType type,
|
public ApplicationSelector(ApplicationType type,
|
||||||
DomainObjectParameter app,
|
DomainObjectParameter app,
|
||||||
PrivilegeDescriptor privilege) {
|
PrivilegeDescriptor privilege) {
|
||||||
super("applicationSelector");
|
super("applicationSelector");
|
||||||
|
|
||||||
m_type = type;
|
m_type = type;
|
||||||
m_app = app;
|
m_app = app;
|
||||||
m_privilege = privilege;
|
m_privilege = privilege;
|
||||||
|
|
||||||
s_log.debug("displayed applications will be filtered by privilege " +
|
s_log.debug("displayed applications will be filtered by privilege " +
|
||||||
m_privilege);
|
m_privilege);
|
||||||
|
|
||||||
m_apps = new SingleSelect(new DomainObjectParameter("apps"));
|
m_apps = new SingleSelect(new DomainObjectParameter("apps"));
|
||||||
m_apps.addValidationListener(new NotNullValidationListener());
|
m_apps.addValidationListener(new NotNullValidationListener());
|
||||||
try {
|
try {
|
||||||
m_apps.addPrintListener(new AppPrintListener());
|
m_apps.addPrintListener(new AppPrintListener());
|
||||||
} catch (TooManyListenersException ex) {
|
} catch (TooManyListenersException ex) {
|
||||||
throw new UncheckedWrapperException("this cannot happen", ex);
|
throw new UncheckedWrapperException("this cannot happen", ex);
|
||||||
}
|
}
|
||||||
add(m_apps);
|
add(m_apps);
|
||||||
|
|
||||||
m_buttons = new SaveCancelSection(new SimpleContainer());
|
m_buttons = new SaveCancelSection(new SimpleContainer());
|
||||||
add(m_buttons);
|
add(m_buttons);
|
||||||
|
|
||||||
addProcessListener(new AppProcessListener());
|
addProcessListener(new AppProcessListener());
|
||||||
addSubmissionListener(new AppSubmissionListener());
|
addSubmissionListener(new AppSubmissionListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AppSubmissionListener implements FormSubmissionListener {
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private class AppSubmissionListener implements FormSubmissionListener {
|
||||||
public void submitted(FormSectionEvent e)
|
public void submitted(FormSectionEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
if (m_buttons.getCancelButton().isSelected(e.getPageState())) {
|
if (m_buttons.getCancelButton().isSelected(e.getPageState())) {
|
||||||
|
|
@ -98,40 +117,53 @@ public class ApplicationSelector extends Form {
|
||||||
}
|
}
|
||||||
s_log.debug("Falling through for process");
|
s_log.debug("Falling through for process");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private class AppProcessListener implements FormProcessListener {
|
|
||||||
public void process(FormSectionEvent e)
|
|
||||||
throws FormProcessException {
|
|
||||||
s_log.debug("Firing event for process");
|
|
||||||
|
|
||||||
PageState state = e.getPageState();
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private class AppProcessListener implements FormProcessListener {
|
||||||
|
|
||||||
state.setValue(m_app, m_apps.getValue(state));
|
public void process(FormSectionEvent e) throws FormProcessException {
|
||||||
|
s_log.debug("Firing event for process");
|
||||||
|
|
||||||
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
|
state.setValue(m_app, m_apps.getValue(state));
|
||||||
fireCompletionEvent(e.getPageState());
|
fireCompletionEvent(e.getPageState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private class AppPrintListener implements PrintListener {
|
|
||||||
public void prepare(PrintEvent e) {
|
/**
|
||||||
ApplicationCollection apps = Application.retrieveAllApplications();
|
*
|
||||||
|
*/
|
||||||
|
private class AppPrintListener implements PrintListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
public void prepare(PrintEvent e) {
|
||||||
|
ApplicationCollection apps = Application.retrieveAllApplications();
|
||||||
apps.addEqualsFilter("resourceType.id",
|
apps.addEqualsFilter("resourceType.id",
|
||||||
m_type.getID());
|
m_type.getID());
|
||||||
if (m_privilege != null) {
|
if (m_privilege != null) {
|
||||||
Party user = Kernel.getContext().getParty();
|
Party user = Kernel.getContext().getParty();
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
user = Kernel.getPublicUser();
|
user = Kernel.getPublicUser();
|
||||||
}
|
}
|
||||||
PermissionService.filterObjects(apps,m_privilege, user.getOID());
|
PermissionService.filterObjects(apps,m_privilege, user.getOID());
|
||||||
}
|
}
|
||||||
apps.addOrder("primaryURL");
|
apps.addOrder("primaryURL");
|
||||||
|
|
||||||
SingleSelect t = (SingleSelect) e.getTarget();
|
SingleSelect t = (SingleSelect) e.getTarget();
|
||||||
t.addOption(new Option(null,
|
t.addOption(new Option(null, "--select one--"));
|
||||||
"--select one--"));
|
while (apps.next()) {
|
||||||
while (apps.next()) {
|
Application app = apps.getApplication();
|
||||||
Application app = apps.getApplication();
|
|
||||||
t.addOption(new Option(app.getOID().toString(),
|
t.addOption(new Option(app.getOID().toString(),
|
||||||
app.getTitle() + " (" + app.getPath() + ")"));
|
app.getTitle() + " (" + app.getPath() + ")"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
import com.arsdigita.domain.DomainObject;
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
|
@ -25,66 +26,106 @@ import com.arsdigita.portalworkspace.Workspace;
|
||||||
import com.arsdigita.portalworkspace.WorkspacePage;
|
import com.arsdigita.portalworkspace.WorkspacePage;
|
||||||
import com.arsdigita.portalworkspace.WorkspacePageCollection;
|
import com.arsdigita.portalworkspace.WorkspacePageCollection;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class DefaultPortalSelectionModel extends ACSObjectSelectionModel
|
public class DefaultPortalSelectionModel extends ACSObjectSelectionModel
|
||||||
implements PortalSelectionModel {
|
implements PortalSelectionModel {
|
||||||
|
|
||||||
private WorkspaceSelectionModel m_workspace;
|
private WorkspaceSelectionModel m_workspace;
|
||||||
|
|
||||||
public DefaultPortalSelectionModel(BigDecimalParameter param) {
|
/**
|
||||||
this(null, param);
|
*
|
||||||
}
|
* @param param
|
||||||
|
*/
|
||||||
|
public DefaultPortalSelectionModel(BigDecimalParameter param) {
|
||||||
|
this(null, param);
|
||||||
|
}
|
||||||
|
|
||||||
public DefaultPortalSelectionModel(WorkspaceSelectionModel workspace,
|
public DefaultPortalSelectionModel(WorkspaceSelectionModel workspace,
|
||||||
BigDecimalParameter param) {
|
BigDecimalParameter param) {
|
||||||
super(WorkspacePage.class.getName(),
|
super(WorkspacePage.class.getName(),
|
||||||
WorkspacePage.BASE_DATA_OBJECT_TYPE, param);
|
WorkspacePage.BASE_DATA_OBJECT_TYPE, param);
|
||||||
|
|
||||||
m_workspace = workspace;
|
m_workspace = workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWorkspaceModel(WorkspaceSelectionModel workspace) {
|
/**
|
||||||
m_workspace = workspace;
|
*
|
||||||
}
|
* @param workspace
|
||||||
|
*/
|
||||||
|
public void setWorkspaceModel(WorkspaceSelectionModel workspace) {
|
||||||
|
m_workspace = workspace;
|
||||||
|
}
|
||||||
|
|
||||||
public Workspace getSelectedWorkspace(PageState state) {
|
/**
|
||||||
return m_workspace.getSelectedWorkspace(state);
|
*
|
||||||
}
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Workspace getSelectedWorkspace(PageState state) {
|
||||||
|
return m_workspace.getSelectedWorkspace(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object getSelectedKey(PageState state) {
|
public Object getSelectedKey(PageState state) {
|
||||||
BigDecimal key = (BigDecimal) super.getSelectedKey(state);
|
BigDecimal key = (BigDecimal) super.getSelectedKey(state);
|
||||||
if (key == null) {
|
if (key == null) {
|
||||||
loadDefaultPortal(state);
|
loadDefaultPortal(state);
|
||||||
}
|
}
|
||||||
|
return super.getSelectedKey(state);
|
||||||
return super.getSelectedKey(state);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DomainObject getSelectedObject(PageState state) {
|
public DomainObject getSelectedObject(PageState state) {
|
||||||
BigDecimal key = (BigDecimal) super.getSelectedKey(state);
|
BigDecimal key = (BigDecimal) super.getSelectedKey(state);
|
||||||
if (key == null) {
|
if (key == null) {
|
||||||
loadDefaultPortal(state);
|
loadDefaultPortal(state);
|
||||||
}
|
}
|
||||||
|
return super.getSelectedObject(state);
|
||||||
|
}
|
||||||
|
|
||||||
return super.getSelectedObject(state);
|
/**
|
||||||
}
|
*
|
||||||
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public WorkspacePage getSelectedPortal(PageState state) {
|
||||||
|
return (WorkspacePage) getSelectedObject(state);
|
||||||
|
}
|
||||||
|
|
||||||
public WorkspacePage getSelectedPortal(PageState state) {
|
/**
|
||||||
return (WorkspacePage) getSelectedObject(state);
|
*
|
||||||
}
|
* @param state
|
||||||
|
*/
|
||||||
|
private void loadDefaultPortal(PageState state) {
|
||||||
|
|
||||||
|
Workspace workspace = getSelectedWorkspace(state);
|
||||||
|
WorkspacePageCollection portals = workspace.getPages();
|
||||||
|
portals.addOrder(WorkspacePage.SORT_KEY);
|
||||||
|
if (portals.next()) {
|
||||||
|
WorkspacePage portal = portals.getPage();
|
||||||
|
setSelectedObject(state, portal);
|
||||||
|
portals.close();
|
||||||
|
} else {
|
||||||
|
WorkspacePage portal = workspace.addPage("Main", "Main page");
|
||||||
|
setSelectedObject(state, portal);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void loadDefaultPortal(PageState state) {
|
|
||||||
Workspace workspace = getSelectedWorkspace(state);
|
|
||||||
WorkspacePageCollection portals = workspace.getPages();
|
|
||||||
portals.addOrder(WorkspacePage.SORT_KEY);
|
|
||||||
if (portals.next()) {
|
|
||||||
WorkspacePage portal = portals.getPage();
|
|
||||||
setSelectedObject(state, portal);
|
|
||||||
portals.close();
|
|
||||||
} else {
|
|
||||||
WorkspacePage portal = workspace.addPage("Main", "Main page");
|
|
||||||
setSelectedObject(state, portal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.event.ActionEvent;
|
import com.arsdigita.bebop.event.ActionEvent;
|
||||||
import com.arsdigita.bebop.event.ActionListener;
|
import com.arsdigita.bebop.event.ActionListener;
|
||||||
|
|
@ -36,79 +35,94 @@ import com.arsdigita.portal.Portlet;
|
||||||
import com.arsdigita.portal.PortletCollection;
|
import com.arsdigita.portal.PortletCollection;
|
||||||
import com.arsdigita.web.LoginSignal;
|
import com.arsdigita.web.LoginSignal;
|
||||||
|
|
||||||
public class DefaultWorkspace extends WorkspaceComponent implements
|
import java.math.BigDecimal;
|
||||||
ActionListener {
|
|
||||||
|
|
||||||
private static final Logger s_log = Logger
|
import org.apache.log4j.Logger;
|
||||||
.getLogger(DefaultWorkspace.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Another specific entry point into a portal workspace page, here based upon
|
||||||
|
* WorkspaceComponent (as an alternative to AbstractWorkspaceComponent.
|
||||||
|
* Presumably intended to construct a (personal) homepage / startpage when a
|
||||||
|
* user logs in / is logged in.
|
||||||
|
*/
|
||||||
|
// As of APLAWS 1.0.4 / CCM 6.6.x this class may never have been used and is
|
||||||
|
// propably unfinished work or undinished port from ccm-portalserver module.
|
||||||
|
// As with WorkspaceViewer it should be invoked by a jsp. It is not directly
|
||||||
|
// used by any java code.
|
||||||
|
public class DefaultWorkspace extends WorkspaceComponent
|
||||||
|
implements ActionListener {
|
||||||
|
|
||||||
|
private static final Logger s_log = Logger.getLogger(DefaultWorkspace.class);
|
||||||
|
|
||||||
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public DefaultWorkspace() {
|
public DefaultWorkspace() {
|
||||||
super(new DefaultWorkspaceSelectionModel());
|
super(new DefaultWorkspaceSelectionModel());
|
||||||
|
|
||||||
addCustomizeListener(this);
|
addCustomizeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e
|
||||||
*/
|
*/
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
|
Workspace workspace = getWorkspaceModel().getSelectedWorkspace(state);
|
||||||
|
|
||||||
Workspace workspace = getWorkspaceModel().getSelectedWorkspace(state);
|
Party party = Kernel.getContext().getParty();
|
||||||
|
if (party == null) {
|
||||||
|
throw new LoginSignal(state.getRequest());
|
||||||
|
}
|
||||||
|
|
||||||
Party party = Kernel.getContext().getParty();
|
PermissionDescriptor admin = new PermissionDescriptor(
|
||||||
if (party == null) {
|
PrivilegeDescriptor.ADMIN, workspace, party);
|
||||||
throw new LoginSignal(state.getRequest());
|
|
||||||
}
|
|
||||||
|
|
||||||
PermissionDescriptor admin = new PermissionDescriptor(
|
// don't create user workspaces if the required parameter is set
|
||||||
PrivilegeDescriptor.ADMIN, workspace, party);
|
if (!party.equals(workspace.getParty())
|
||||||
|
&& !PermissionService.checkPermission(admin)
|
||||||
|
&& Workspace.getConfig().getCreateUserWorkspaces()) {
|
||||||
|
|
||||||
// don't create user workspaces if the required parameter is set
|
// Clone the workspace
|
||||||
if (!party.equals(workspace.getParty())
|
Workspace parent = (Workspace) Kernel.getContext().getResource();
|
||||||
&& !PermissionService.checkPermission(admin)
|
|
||||||
&& Workspace.getConfig().getCreateUserWorkspaces()) {
|
|
||||||
|
|
||||||
// Clone the workspace
|
Workspace clone = Workspace.createWorkspace("personal-"
|
||||||
Workspace parent = (Workspace) Kernel.getContext().getResource();
|
+ party.getID(), "Personal Workspace for "
|
||||||
|
+ party.getDisplayName(), parent, (User) party);
|
||||||
|
|
||||||
Workspace clone = Workspace.createWorkspace("personal-"
|
BigDecimal old_id = (BigDecimal) getPortalModel()
|
||||||
+ party.getID(), "Personal Workspace for "
|
.getSelectedKey(state);
|
||||||
+ party.getDisplayName(), parent, (User) party);
|
BigDecimal new_id = null;
|
||||||
|
|
||||||
BigDecimal old_id = (BigDecimal) getPortalModel().getSelectedKey(
|
WorkspacePageCollection pages = workspace.getPages();
|
||||||
state);
|
pages.addOrder(WorkspacePage.SORT_KEY);
|
||||||
BigDecimal new_id = null;
|
while (pages.next()) {
|
||||||
|
WorkspacePage old_page = pages.getPage();
|
||||||
|
WorkspacePage new_page = clone.addPage(old_page.getTitle(),
|
||||||
|
old_page.getDescription(),
|
||||||
|
old_page.getLayout(),
|
||||||
|
old_page.getSortKey());
|
||||||
|
|
||||||
WorkspacePageCollection pages = workspace.getPages();
|
if (old_page.getID().equals(old_id)) {
|
||||||
pages.addOrder(WorkspacePage.SORT_KEY);
|
new_id = new_page.getID();
|
||||||
while (pages.next()) {
|
}
|
||||||
WorkspacePage old_page = pages.getPage();
|
|
||||||
WorkspacePage new_page = clone.addPage(old_page.getTitle(),
|
|
||||||
old_page.getDescription(), old_page.getLayout(),
|
|
||||||
old_page.getSortKey());
|
|
||||||
|
|
||||||
if (old_page.getID().equals(old_id)) {
|
PortletCollection portlets = old_page.getPortlets();
|
||||||
new_id = new_page.getID();
|
while (portlets.next()) {
|
||||||
}
|
Portlet old_portlet = portlets.getPortlet();
|
||||||
|
Portlet new_portlet = (Portlet) new DomainObjectCopier()
|
||||||
|
.copy(old_portlet);
|
||||||
|
new_page.addPortlet(new_portlet, old_portlet
|
||||||
|
.getCellNumber());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clone.save();
|
||||||
|
|
||||||
PortletCollection portlets = old_page.getPortlets();
|
getPortalModel().setSelectedKey(state, new_id);
|
||||||
while (portlets.next()) {
|
getWorkspaceModel().setSelectedWorkspace(state, workspace);
|
||||||
Portlet old_portlet = portlets.getPortlet();
|
}
|
||||||
Portlet new_portlet = (Portlet) new DomainObjectCopier()
|
}
|
||||||
.copy(old_portlet);
|
|
||||||
new_page.addPortlet(new_portlet, old_portlet
|
|
||||||
.getCellNumber());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
clone.save();
|
|
||||||
|
|
||||||
getPortalModel().setSelectedKey(state, new_id);
|
|
||||||
getWorkspaceModel().setSelectedWorkspace(state, workspace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -21,21 +24,35 @@ import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.Party;
|
import com.arsdigita.kernel.Party;
|
||||||
import com.arsdigita.portalworkspace.Workspace;
|
import com.arsdigita.portalworkspace.Workspace;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Used by the jsp, specified in web.xml and used to construct a perspnal
|
||||||
|
* homepage for an loggedIn user
|
||||||
|
*/
|
||||||
public class DefaultWorkspaceSelectionModel extends WorkspaceSelectionModel {
|
public class DefaultWorkspaceSelectionModel extends WorkspaceSelectionModel {
|
||||||
|
|
||||||
protected Workspace getDefaultWorkspace(PageState state) {
|
/**
|
||||||
Workspace workspace = (Workspace) Kernel.getContext().getResource();
|
*
|
||||||
Party party = Kernel.getContext().getParty();
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected Workspace getDefaultWorkspace(PageState state) {
|
||||||
|
|
||||||
if (party != null) {
|
Workspace workspace = (Workspace) Kernel.getContext().getResource();
|
||||||
try {
|
Party party = Kernel.getContext().getParty();
|
||||||
workspace = workspace.retrieveSubworkspaceForParty(party);
|
|
||||||
|
|
||||||
} catch (DataObjectNotFoundException ex) {
|
if (party != null) { // the visitor is logged in
|
||||||
// fall through
|
try {
|
||||||
}
|
workspace = workspace.retrieveSubworkspaceForParty(party);
|
||||||
}
|
|
||||||
|
|
||||||
return workspace;
|
} catch (DataObjectNotFoundException ex) {
|
||||||
}
|
// fall through
|
||||||
|
// pboy: i.e. a generell default workspace initialized at the
|
||||||
|
// beginning is provided.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return workspace;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -28,56 +31,96 @@ import com.arsdigita.portalworkspace.Workspace;
|
||||||
import com.arsdigita.toolbox.ui.SecurityContainer;
|
import com.arsdigita.toolbox.ui.SecurityContainer;
|
||||||
import com.arsdigita.web.LoginSignal;
|
import com.arsdigita.web.LoginSignal;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Another specific entry point into a portal workspace page, here based upon
|
||||||
|
* WorkspaceComponent (as an alternative to AbstractWorkspaceComponent.
|
||||||
|
*/
|
||||||
|
// As of APLAWS 1.0.4 / CCM 6.6.x this class may never have been used and is
|
||||||
|
// propably unfinished work or undinished port from ccm-portalserver module.
|
||||||
|
// As with WorkspaceViewer it should be invoked by a jsp. It is not directly
|
||||||
|
// used by any java code.
|
||||||
public class PackageWorkspace extends WorkspaceComponent {
|
public class PackageWorkspace extends WorkspaceComponent {
|
||||||
|
|
||||||
private RequestLocal m_isAdmin = new RequestLocal();
|
private RequestLocal m_isAdmin = new RequestLocal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public PackageWorkspace() {
|
||||||
|
super(new PackageWorkspaceSelectionModel());
|
||||||
|
addCustomizeListener(new CustomizeListener());
|
||||||
|
}
|
||||||
|
|
||||||
public PackageWorkspace() {
|
/**
|
||||||
super(new PackageWorkspaceSelectionModel());
|
*
|
||||||
|
* @param parent
|
||||||
|
* @param child
|
||||||
|
*/
|
||||||
|
protected void addCustomizeLinks(Container parent, Component child) {
|
||||||
|
Container secure = new WorkspaceSecurityContainer(child);
|
||||||
|
super.addCustomizeLinks(parent, secure);
|
||||||
|
}
|
||||||
|
|
||||||
addCustomizeListener(new CustomizeListener());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCustomizeLinks(Container parent, Component child) {
|
/**
|
||||||
Container secure = new WorkspaceSecurityContainer(child);
|
*
|
||||||
super.addCustomizeLinks(parent, secure);
|
*/
|
||||||
}
|
private class CustomizeListener implements ActionListener {
|
||||||
|
|
||||||
private class CustomizeListener implements ActionListener {
|
/**
|
||||||
public void actionPerformed(ActionEvent e) {
|
*
|
||||||
PageState state = e.getPageState();
|
* @param e
|
||||||
|
*/
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
Workspace workspace = getWorkspaceModel().getSelectedWorkspace(
|
Workspace workspace = getWorkspaceModel()
|
||||||
state);
|
.getSelectedWorkspace(state);
|
||||||
|
|
||||||
Party party = Kernel.getContext().getParty();
|
Party party = Kernel.getContext().getParty();
|
||||||
if (party == null) {
|
if (party == null) {
|
||||||
throw new LoginSignal(state.getRequest());
|
throw new LoginSignal(state.getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PortalHelper.canCustomize(party, workspace)) {
|
if (!PortalHelper.canCustomize(party, workspace)) {
|
||||||
throw new AccessDeniedException(
|
throw new AccessDeniedException(
|
||||||
"no permission to customize workspace");
|
"no permission to customize workspace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private class WorkspaceSecurityContainer extends SecurityContainer {
|
}
|
||||||
|
|
||||||
public WorkspaceSecurityContainer(Component c) {
|
/**
|
||||||
super(c);
|
*
|
||||||
}
|
*/
|
||||||
|
private class WorkspaceSecurityContainer extends SecurityContainer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param c
|
||||||
|
*/
|
||||||
|
public WorkspaceSecurityContainer(Component c) {
|
||||||
|
super(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param party
|
||||||
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected boolean canAccess(Party party, PageState state) {
|
||||||
|
Boolean isAdmin = (Boolean) m_isAdmin.get(state);
|
||||||
|
if (isAdmin == null) {
|
||||||
|
Workspace workspace = getWorkspaceModel()
|
||||||
|
.getSelectedWorkspace(state);
|
||||||
|
boolean canAccess = PortalHelper.canCustomize(party, workspace);
|
||||||
|
isAdmin = new Boolean(canAccess);
|
||||||
|
m_isAdmin.set(state, isAdmin);
|
||||||
|
}
|
||||||
|
return isAdmin.booleanValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean canAccess(Party party, PageState state) {
|
|
||||||
Boolean isAdmin = (Boolean) m_isAdmin.get(state);
|
|
||||||
if (isAdmin == null) {
|
|
||||||
Workspace workspace = getWorkspaceModel().getSelectedWorkspace(
|
|
||||||
state);
|
|
||||||
boolean canAccess = PortalHelper.canCustomize(party, workspace);
|
|
||||||
isAdmin = new Boolean(canAccess);
|
|
||||||
m_isAdmin.set(state, isAdmin);
|
|
||||||
}
|
|
||||||
return isAdmin.booleanValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,40 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.portalworkspace.Workspace;
|
import com.arsdigita.portalworkspace.Workspace;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class PackageWorkspaceSelectionModel extends WorkspaceSelectionModel {
|
public class PackageWorkspaceSelectionModel extends WorkspaceSelectionModel {
|
||||||
|
|
||||||
protected Workspace getDefaultWorkspace(PageState state) {
|
/**
|
||||||
return (Workspace) Kernel.getContext().getResource();
|
*
|
||||||
}
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected Workspace getDefaultWorkspace(PageState state) {
|
||||||
|
return (Workspace) Kernel.getContext().getResource();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -26,7 +29,6 @@ import com.arsdigita.bebop.FormProcessException;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.SimpleContainer;
|
import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
import com.arsdigita.bebop.Component;
|
|
||||||
import com.arsdigita.bebop.RequestLocal;
|
import com.arsdigita.bebop.RequestLocal;
|
||||||
import com.arsdigita.bebop.event.ChangeListener;
|
import com.arsdigita.bebop.event.ChangeListener;
|
||||||
import com.arsdigita.bebop.event.ChangeEvent;
|
import com.arsdigita.bebop.event.ChangeEvent;
|
||||||
|
|
@ -36,7 +38,6 @@ import com.arsdigita.bebop.event.ActionEvent;
|
||||||
import com.arsdigita.bebop.event.ActionListener;
|
import com.arsdigita.bebop.event.ActionListener;
|
||||||
import com.arsdigita.bebop.jsp.DefinePage;
|
import com.arsdigita.bebop.jsp.DefinePage;
|
||||||
import com.arsdigita.bebop.parameters.IntegerParameter;
|
import com.arsdigita.bebop.parameters.IntegerParameter;
|
||||||
import com.arsdigita.bebop.parameters.BooleanParameter;
|
|
||||||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
import com.arsdigita.bebop.portal.PortletRenderer;
|
import com.arsdigita.bebop.portal.PortletRenderer;
|
||||||
import com.arsdigita.bebop.portal.PortalModel;
|
import com.arsdigita.bebop.portal.PortalModel;
|
||||||
|
|
@ -44,19 +45,15 @@ import com.arsdigita.bebop.portal.PortalModelBuilder;
|
||||||
|
|
||||||
import com.arsdigita.portal.PortletType;
|
import com.arsdigita.portal.PortletType;
|
||||||
import com.arsdigita.portal.Portlet;
|
import com.arsdigita.portal.Portlet;
|
||||||
import com.arsdigita.portal.PortletCollection;
|
|
||||||
import com.arsdigita.portal.PortletTypeCollection;
|
import com.arsdigita.portal.PortletTypeCollection;
|
||||||
|
|
||||||
import com.arsdigita.kernel.Resource;
|
import com.arsdigita.kernel.Resource;
|
||||||
import com.arsdigita.kernel.Party;
|
import com.arsdigita.kernel.Party;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
|
||||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
|
||||||
import com.arsdigita.kernel.ui.ResourceConfigComponent;
|
import com.arsdigita.kernel.ui.ResourceConfigComponent;
|
||||||
|
|
||||||
import com.arsdigita.dispatcher.AccessDeniedException;
|
import com.arsdigita.dispatcher.AccessDeniedException;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
|
||||||
import com.arsdigita.persistence.DataQuery;
|
import com.arsdigita.persistence.DataQuery;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
|
|
@ -68,7 +65,6 @@ import com.arsdigita.london.util.ui.parameters.DomainObjectParameter;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import com.arsdigita.formbuilder.util.FormBuilderUtil;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
|
@ -79,7 +75,7 @@ import org.apache.log4j.Logger;
|
||||||
// XXX this class is disgusting
|
// XXX this class is disgusting
|
||||||
/**
|
/**
|
||||||
* PersistentPortals are able to have more than one column, and the constructor
|
* PersistentPortals are able to have more than one column, and the constructor
|
||||||
* for PersitentPortal takes in an integer argument for number of columns.
|
* for PersistentPortal takes in an integer argument for number of columns.
|
||||||
*
|
*
|
||||||
* HomepagePortals defined on the jsp page each construct instances of this
|
* HomepagePortals defined on the jsp page each construct instances of this
|
||||||
* class, one for the portal in view mode, one in edit mode.
|
* class, one for the portal in view mode, one in edit mode.
|
||||||
|
|
@ -87,131 +83,145 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class PersistentPortal extends SimpleContainer {
|
public class PersistentPortal extends SimpleContainer {
|
||||||
|
|
||||||
public static final String ACTION_CUSTOMIZE = "customize";
|
|
||||||
public static final String ACTION_MOVE_UP = "moveUp";
|
|
||||||
public static final String ACTION_MOVE_DOWN = "moveDown";
|
|
||||||
public static final String ACTION_MOVE_LEFT = "moveLeft";
|
|
||||||
public static final String ACTION_MOVE_RIGHT = "moveRight";
|
|
||||||
|
|
||||||
|
|
||||||
public static final String ACTION_DELETE = "delete";
|
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(PersistentPortal.class);
|
private static final Logger s_log = Logger.getLogger(PersistentPortal.class);
|
||||||
|
|
||||||
private WorkspaceSelectionModel m_workspace;
|
public static final String ACTION_CUSTOMIZE = "customize";
|
||||||
private PortalSelectionModel m_portal;
|
public static final String ACTION_MOVE_UP = "moveUp";
|
||||||
private PortletTypeSelectionModel m_portletType;
|
public static final String ACTION_MOVE_DOWN = "moveDown";
|
||||||
private PortletSelectionModel m_portlet;
|
public static final String ACTION_MOVE_LEFT = "moveLeft";
|
||||||
|
public static final String ACTION_MOVE_RIGHT = "moveRight";
|
||||||
|
|
||||||
private String m_mode;
|
|
||||||
private int m_columns;
|
|
||||||
|
|
||||||
private PortletTypeForm m_adders[];
|
public static final String ACTION_DELETE = "delete";
|
||||||
private HashMap m_create;
|
|
||||||
private HashMap m_modify;
|
|
||||||
private HashMap m_createApp;
|
|
||||||
|
|
||||||
private RequestLocal m_parentResource;
|
private WorkspaceSelectionModel m_workspace;
|
||||||
private RequestLocal m_currentResource;
|
private PortalSelectionModel m_portal;
|
||||||
private RequestLocal m_currentApp;
|
private PortletTypeSelectionModel m_portletType;
|
||||||
private PortalModelBuilder m_portalModelBuilder;
|
private PortletSelectionModel m_portlet;
|
||||||
private DomainObjectParameter m_parentApp;
|
|
||||||
|
|
||||||
private SingleSelectionModel m_column;
|
private String m_mode;
|
||||||
|
private int m_columns;
|
||||||
|
|
||||||
// Ought to be enough until browser window size is a few thousand
|
private PortletTypeForm m_adders[];
|
||||||
// pixels wide...
|
private HashMap m_create;
|
||||||
public static final int MAX_COLUMNS = 10;
|
private HashMap m_modify;
|
||||||
|
private HashMap m_createApp;
|
||||||
|
|
||||||
|
private RequestLocal m_parentResource;
|
||||||
|
private RequestLocal m_currentResource;
|
||||||
|
private RequestLocal m_currentApp;
|
||||||
|
private PortalModelBuilder m_portalModelBuilder;
|
||||||
|
private DomainObjectParameter m_parentApp;
|
||||||
|
|
||||||
|
private SingleSelectionModel m_column;
|
||||||
|
|
||||||
|
// Ought to be enough until browser window size is a few thousand
|
||||||
|
// pixels wide...
|
||||||
|
public static final int MAX_COLUMNS = 10;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param portal
|
||||||
|
* @param mode
|
||||||
|
*/
|
||||||
public PersistentPortal(PortalSelectionModel portal,
|
public PersistentPortal(PortalSelectionModel portal,
|
||||||
String mode) {
|
String mode) {
|
||||||
this(portal, "portal", mode);
|
this(portal, "portal", mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param portal
|
||||||
|
* @param name
|
||||||
|
* @param mode
|
||||||
|
*/
|
||||||
public PersistentPortal(PortalSelectionModel portal,
|
public PersistentPortal(PortalSelectionModel portal,
|
||||||
String name,
|
String name,
|
||||||
String mode) {
|
String mode) {
|
||||||
setTag("portal:portal");
|
|
||||||
setNamespace(PortalConstants.PORTAL_XML_NS);
|
setTag("portal:portal");
|
||||||
|
setNamespace(PortalConstants.PORTAL_XML_NS);
|
||||||
|
|
||||||
s_log.debug("IN constructor" + name + " " + mode);
|
s_log.debug("IN constructor" + name + " " + mode);
|
||||||
m_adders = new PortletTypeForm[MAX_COLUMNS];
|
m_adders = new PortletTypeForm[MAX_COLUMNS];
|
||||||
m_mode = mode;
|
m_mode = mode;
|
||||||
m_portal = portal;
|
m_portal = portal;
|
||||||
|
|
||||||
m_column = new ParameterSingleSelectionModel(new IntegerParameter("column"));
|
m_column = new ParameterSingleSelectionModel(new IntegerParameter("column"));
|
||||||
|
|
||||||
|
|
||||||
if (m_mode.equals(PortalConstants.MODE_EDITOR)) {
|
|
||||||
for (int i = 0; i < m_adders.length; i++) {
|
if (m_mode.equals(PortalConstants.MODE_EDITOR)) {
|
||||||
m_adders[i] = new PortletTypeForm("add" + name + i);
|
for (int i = 0; i < m_adders.length; i++) {
|
||||||
m_adders[i].setRedirecting(true);
|
m_adders[i] = new PortletTypeForm("add" + name + i);
|
||||||
add(m_adders[i]);
|
m_adders[i].setRedirecting(true);
|
||||||
m_adders[i].addProcessListener(new PortletAddListener(m_portal,
|
add(m_adders[i]);
|
||||||
i + 1));
|
m_adders[i].addProcessListener(new PortletAddListener(m_portal,
|
||||||
}
|
i + 1));
|
||||||
|
}
|
||||||
|
|
||||||
m_portlet = new PortletSelectionModel(
|
m_portlet = new PortletSelectionModel(
|
||||||
new BigDecimalParameter("edit")
|
new BigDecimalParameter("edit") );
|
||||||
);
|
m_portletType = new PortletTypeSelectionModel(
|
||||||
m_portletType = new PortletTypeSelectionModel(
|
new BigDecimalParameter("create") );
|
||||||
new BigDecimalParameter("create")
|
|
||||||
);
|
|
||||||
|
|
||||||
m_portal.addChangeListener(new ChangeListener() {
|
m_portal.addChangeListener(new ChangeListener() {
|
||||||
public void stateChanged(ChangeEvent event) {
|
public void stateChanged(ChangeEvent event) {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
if (m_portal.isSelected(state)) {
|
if (m_portal.isSelected(state)) {
|
||||||
WorkspacePage portal =
|
WorkspacePage portal = m_portal.getSelectedPortal(state);
|
||||||
m_portal.getSelectedPortal(state);
|
s_log.debug("Setting portal" + portal);
|
||||||
s_log.debug("Setting portal" + portal);
|
m_parentResource.set(state, portal);
|
||||||
m_parentResource.set(state, portal);
|
} else {
|
||||||
} else {
|
s_log.debug("Clearing portal");
|
||||||
s_log.debug("Clearing portal");
|
m_parentResource.set(state, null);
|
||||||
m_parentResource.set(state, null);
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
m_portlet.addChangeListener(new ChangeListener() {
|
m_portlet.addChangeListener(new ChangeListener() {
|
||||||
public void stateChanged(ChangeEvent event) {
|
public void stateChanged(ChangeEvent event) {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
if (m_portal.isSelected(state)) {
|
if (m_portal.isSelected(state)) {
|
||||||
com.arsdigita.portal.Portlet portlet =
|
com.arsdigita.portal.Portlet portlet =
|
||||||
m_portlet.getSelectedPortlet(state);
|
m_portlet.getSelectedPortlet(state);
|
||||||
s_log.debug("Setting portlet" + portlet);
|
s_log.debug("Setting portlet" + portlet);
|
||||||
m_currentResource.set(state, portlet);
|
m_currentResource.set(state, portlet);
|
||||||
} else {
|
} else {
|
||||||
s_log.debug("Clearing portlet");
|
s_log.debug("Clearing portlet");
|
||||||
m_currentResource.set(state, null);
|
m_currentResource.set(state, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m_parentApp = new DomainObjectParameter("parentApp");
|
m_parentApp = new DomainObjectParameter("parentApp");
|
||||||
m_parentResource = new RequestLocal() {
|
|
||||||
public Object initialValue(PageState state) {
|
|
||||||
return state.getValue(m_parentApp);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
m_currentResource = new RequestLocal() {
|
|
||||||
public Object initialValue(PageState state) {
|
|
||||||
return m_portlet.getSelectedPortlet(state);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
m_currentApp = new RequestLocal() {
|
|
||||||
public Object initialValue(PageState state) {
|
|
||||||
return Kernel.getContext().getResource();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
PortletTypeCollection types = PortletType.retrieveAllPortletTypes();
|
m_parentResource = new RequestLocal() {
|
||||||
m_create = new HashMap();
|
public Object initialValue(PageState state) {
|
||||||
m_modify = new HashMap();
|
return state.getValue(m_parentApp);
|
||||||
m_createApp = new HashMap();
|
}
|
||||||
s_log.debug("Do add types");
|
};
|
||||||
while (types.next()) {
|
|
||||||
PortletType type = types.getPortletType();
|
m_currentResource = new RequestLocal() {
|
||||||
s_log.debug("Add type " + type.getResourceObjectType());
|
public Object initialValue(PageState state) {
|
||||||
|
return m_portlet.getSelectedPortlet(state);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
m_currentApp = new RequestLocal() {
|
||||||
|
public Object initialValue(PageState state) {
|
||||||
|
return Kernel.getContext().getResource();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
PortletTypeCollection types = PortletType.retrieveAllPortletTypes();
|
||||||
|
m_create = new HashMap();
|
||||||
|
m_modify = new HashMap();
|
||||||
|
m_createApp = new HashMap();
|
||||||
|
s_log.debug("Do add types");
|
||||||
|
while (types.next()) {
|
||||||
|
PortletType type = types.getPortletType();
|
||||||
|
s_log.debug("Add type " + type.getResourceObjectType());
|
||||||
|
|
||||||
final ResourceConfigComponent create =
|
final ResourceConfigComponent create =
|
||||||
type.getCreateComponent(m_parentResource);
|
type.getCreateComponent(m_parentResource);
|
||||||
|
|
@ -219,104 +229,106 @@ public class PersistentPortal extends SimpleContainer {
|
||||||
type.getModifyComponent(m_currentResource);
|
type.getModifyComponent(m_currentResource);
|
||||||
|
|
||||||
|
|
||||||
ApplicationType appType = type.getProviderApplicationType();
|
ApplicationType appType = type.getProviderApplicationType();
|
||||||
SimpleContainer createApp = null;
|
SimpleContainer createApp = null;
|
||||||
if (appType != null) {
|
if (appType != null) {
|
||||||
final ResourceConfigComponent appCreate =
|
final ResourceConfigComponent appCreate =
|
||||||
appType.getCreateComponent(m_currentApp);
|
appType.getCreateComponent(m_currentApp);
|
||||||
ApplicationSelector sel = new ApplicationSelector(appType,
|
ApplicationSelector sel = new ApplicationSelector(
|
||||||
m_parentApp,
|
appType,
|
||||||
appType.getConfig() == null ? null : appType.getConfig().getViewPrivilege());
|
m_parentApp,
|
||||||
appCreate.addCompletionListener(new ActionListener() {
|
appType.getConfig() == null ? null : appType.getConfig().getViewPrivilege());
|
||||||
public void actionPerformed(ActionEvent e) {
|
appCreate.addCompletionListener(new ActionListener() {
|
||||||
PageState state = e.getPageState();
|
public void actionPerformed(ActionEvent e) {
|
||||||
s_log.debug("Do create of portlet");
|
PageState state = e.getPageState();
|
||||||
Resource resource = appCreate.createResource(state);
|
s_log.debug("Do create of portlet");
|
||||||
if (resource == null) {
|
Resource resource = appCreate.createResource(state);
|
||||||
s_log.debug("No resource, reset");
|
if (resource == null) {
|
||||||
m_portletType.clearSelection(e.getPageState());
|
s_log.debug("No resource, reset");
|
||||||
} else {
|
m_portletType.clearSelection(e.getPageState());
|
||||||
s_log.debug("Seting res to " + resource);
|
} else {
|
||||||
state.setValue(m_parentApp, resource);
|
s_log.debug("Seting res to " + resource);
|
||||||
}
|
state.setValue(m_parentApp, resource);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
sel.addCompletionListener(new ActionListener() {
|
});
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
PageState state = e.getPageState();
|
|
||||||
if (state.getValue(m_parentApp) == null) {
|
|
||||||
s_log.debug("Sel no resource, reset");
|
|
||||||
m_portletType.clearSelection(e.getPageState());
|
|
||||||
} else {
|
|
||||||
s_log.debug("Got res " +
|
|
||||||
state.getValue(m_parentApp));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
createApp = new SimpleContainer();
|
sel.addCompletionListener(new ActionListener() {
|
||||||
createApp.add(appCreate);
|
public void actionPerformed(ActionEvent e) {
|
||||||
createApp.add(sel);
|
PageState state = e.getPageState();
|
||||||
}
|
if (state.getValue(m_parentApp) == null) {
|
||||||
|
s_log.debug("Sel no resource, reset");
|
||||||
|
m_portletType.clearSelection(e.getPageState());
|
||||||
|
} else {
|
||||||
|
s_log.debug("Got res " +
|
||||||
|
state.getValue(m_parentApp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
s_log.debug("Create component is " + create);
|
createApp = new SimpleContainer();
|
||||||
s_log.debug("Modify component is " + modify);
|
createApp.add(appCreate);
|
||||||
|
createApp.add(sel);
|
||||||
|
}
|
||||||
|
|
||||||
create.addCompletionListener(new ActionListener() {
|
s_log.debug("Create component is " + create);
|
||||||
public void actionPerformed(ActionEvent e) {
|
s_log.debug("Modify component is " + modify);
|
||||||
PageState state = e.getPageState();
|
|
||||||
s_log.debug("Do create of portlet");
|
|
||||||
Resource resource = create.createResource(state);
|
|
||||||
|
|
||||||
if (resource != null) {
|
create.addCompletionListener(new ActionListener() {
|
||||||
Integer column = (Integer)
|
public void actionPerformed(ActionEvent e) {
|
||||||
m_column.getSelectedKey(state);
|
PageState state = e.getPageState();
|
||||||
Assert.exists(column, Integer.class);
|
s_log.debug("Do create of portlet");
|
||||||
|
Resource resource = create.createResource(state);
|
||||||
|
|
||||||
WorkspacePage portal =
|
if (resource != null) {
|
||||||
m_portal.getSelectedPortal(state);
|
Integer column = (Integer)
|
||||||
portal.addPortlet((Portlet)resource,
|
m_column.getSelectedKey(state);
|
||||||
|
Assert.exists(column, Integer.class);
|
||||||
|
|
||||||
|
WorkspacePage portal = m_portal
|
||||||
|
.getSelectedPortal(state);
|
||||||
|
portal.addPortlet((Portlet)resource,
|
||||||
column.intValue());
|
column.intValue());
|
||||||
portal.save();
|
portal.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// added cg - remove cached page if max existing
|
||||||
// added cg - remove cached page if max existing
|
// stateful portlet count is exceeded so page is
|
||||||
// stateful portlet count is exceeded so page is
|
// rebuilt with correct number of renderers
|
||||||
// rebuilt with correct number of renderers
|
if (resource instanceof StatefulPortlet) {
|
||||||
if (resource instanceof StatefulPortlet) {
|
s_log.debug("Stateful portlet added");
|
||||||
s_log.debug("Stateful portlet added");
|
// check if the maximum number of stateful
|
||||||
// check if the maximum number of stateful
|
// portlets has increased
|
||||||
// portlets has increased
|
PortletType portletType =
|
||||||
PortletType portletType =
|
|
||||||
((Portlet) resource).getPortletType();
|
((Portlet) resource).getPortletType();
|
||||||
DataQuery findMaxInstances =
|
DataQuery findMaxInstances =
|
||||||
SessionManager.getSession().retrieveQuery(
|
SessionManager.getSession().retrieveQuery(
|
||||||
"com.arsdigita.london.portal.MaxPortletInstances");
|
"com.arsdigita.london.portal.MaxPortletInstances");
|
||||||
findMaxInstances.setParameter(
|
findMaxInstances.setParameter("portletType",
|
||||||
"portletType",
|
portletType.getID());
|
||||||
portletType.getID());
|
int maxCount = 0;
|
||||||
int maxCount = 0;
|
while (findMaxInstances.next()) {
|
||||||
while (findMaxInstances.next()) {
|
|
||||||
maxCount =
|
maxCount =
|
||||||
((Integer) findMaxInstances
|
((Integer) findMaxInstances
|
||||||
.get("maxCount"))
|
.get("maxCount"))
|
||||||
.intValue();
|
.intValue();
|
||||||
}
|
}
|
||||||
String key = portletType.getResourceObjectType();
|
|
||||||
|
|
||||||
int previousMax = StatefulPersistentPortal.getCurrentPortletRendererInstances(key);
|
String key = portletType.getResourceObjectType();
|
||||||
|
|
||||||
s_log.debug(
|
int previousMax = StatefulPersistentPortal
|
||||||
portletType
|
.getCurrentPortletRendererInstances(key);
|
||||||
+ ": previous count = "
|
|
||||||
+ previousMax
|
s_log.debug( portletType + ": previous count = "
|
||||||
+ " | new max = "
|
+ previousMax + " | new max = "
|
||||||
+ maxCount);
|
+ maxCount);
|
||||||
if (maxCount > previousMax) {
|
if (maxCount > previousMax) {
|
||||||
DefinePage.invalidatePage(DispatcherHelper.getCurrentResourcePath(state.getRequest())); }
|
DefinePage.invalidatePage(
|
||||||
}
|
DispatcherHelper
|
||||||
m_portletType.clearSelection(e.getPageState());
|
.getCurrentResourcePath(state.getRequest())); }
|
||||||
|
}
|
||||||
|
|
||||||
|
m_portletType.clearSelection(e.getPageState());
|
||||||
state.setValue(m_parentApp, null);
|
state.setValue(m_parentApp, null);
|
||||||
m_parentResource.set(state, null);
|
m_parentResource.set(state, null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -44,76 +47,102 @@ import com.arsdigita.util.Assert;
|
||||||
public class PortalEditForm extends Form implements FormProcessListener,
|
public class PortalEditForm extends Form implements FormProcessListener,
|
||||||
FormInitListener {
|
FormInitListener {
|
||||||
|
|
||||||
private WorkspaceSelectionModel m_workspace;
|
private WorkspaceSelectionModel m_workspace;
|
||||||
|
private PortalSelectionModel m_portal;
|
||||||
|
private TextField m_title;
|
||||||
|
private Submit m_save;
|
||||||
|
|
||||||
private PortalSelectionModel m_portal;
|
|
||||||
|
|
||||||
private TextField m_title;
|
/**
|
||||||
|
*
|
||||||
|
* @param portal
|
||||||
|
*/
|
||||||
|
public PortalEditForm(PortalSelectionModel portal) {
|
||||||
|
this(null, portal);
|
||||||
|
}
|
||||||
|
|
||||||
private Submit m_save;
|
|
||||||
|
|
||||||
public PortalEditForm(PortalSelectionModel portal) {
|
/**
|
||||||
this(null, portal);
|
*
|
||||||
}
|
* @param workspace
|
||||||
|
* @param portal
|
||||||
|
*/
|
||||||
|
public PortalEditForm(WorkspaceSelectionModel workspace,
|
||||||
|
PortalSelectionModel portal) {
|
||||||
|
|
||||||
public PortalEditForm(WorkspaceSelectionModel workspace,
|
super("editPortal", new SimpleContainer("portal:editPortal",
|
||||||
PortalSelectionModel portal) {
|
PortalConstants.PORTAL_XML_NS));
|
||||||
super("editPortal", new SimpleContainer("portal:editPortal",
|
|
||||||
PortalConstants.PORTAL_XML_NS));
|
|
||||||
|
|
||||||
m_workspace = workspace;
|
m_workspace = workspace;
|
||||||
m_portal = portal;
|
m_portal = portal;
|
||||||
|
|
||||||
m_title = new TextField(new StringParameter("title"));
|
m_title = new TextField(new StringParameter("title"));
|
||||||
m_title.addValidationListener(new NotNullValidationListener());
|
m_title.addValidationListener(new NotNullValidationListener());
|
||||||
m_title
|
m_title.addValidationListener(new StringInRangeValidationListener(1,40));
|
||||||
.addValidationListener(new StringInRangeValidationListener(1,
|
|
||||||
40));
|
|
||||||
|
|
||||||
m_save = new Submit("Save");
|
m_save = new Submit("Save");
|
||||||
|
|
||||||
add(m_title);
|
add(m_title);
|
||||||
add(m_save);
|
add(m_save);
|
||||||
|
|
||||||
addProcessListener(this);
|
addProcessListener(this);
|
||||||
addInitListener(this);
|
addInitListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWorkspaceModel(WorkspaceSelectionModel workspace) {
|
/**
|
||||||
m_workspace = workspace;
|
*
|
||||||
}
|
* @param workspace
|
||||||
|
*/
|
||||||
|
public void setWorkspaceModel(WorkspaceSelectionModel workspace) {
|
||||||
|
m_workspace = workspace;
|
||||||
|
}
|
||||||
|
|
||||||
public Workspace getSelectedWorkspace(PageState state) {
|
/**
|
||||||
return m_workspace.getSelectedWorkspace(state);
|
*
|
||||||
}
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Workspace getSelectedWorkspace(PageState state) {
|
||||||
|
return m_workspace.getSelectedWorkspace(state);
|
||||||
|
}
|
||||||
|
|
||||||
public void init(FormSectionEvent e) {
|
/**
|
||||||
PageState state = e.getPageState();
|
*
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
public void init(FormSectionEvent e) {
|
||||||
|
|
||||||
WorkspacePage portal = (WorkspacePage) m_portal
|
PageState state = e.getPageState();
|
||||||
.getSelectedPortal(state);
|
WorkspacePage portal = (WorkspacePage) m_portal
|
||||||
|
.getSelectedPortal(state);
|
||||||
|
|
||||||
Assert.exists(portal, WorkspacePage.class);
|
|
||||||
|
|
||||||
m_title.setValue(state, portal.getTitle());
|
Assert.exists(portal, WorkspacePage.class);
|
||||||
}
|
m_title.setValue(state, portal.getTitle());
|
||||||
|
|
||||||
public void process(FormSectionEvent e) {
|
}
|
||||||
PageState state = e.getPageState();
|
|
||||||
|
|
||||||
Workspace workspace = getSelectedWorkspace(state);
|
/**
|
||||||
Party party = Kernel.getContext().getParty();
|
*
|
||||||
if (!PortalHelper.canCustomize(party, workspace)) {
|
* @param e
|
||||||
throw new AccessDeniedException(
|
*/
|
||||||
"no permissions to customize workspace");
|
public void process(FormSectionEvent e) {
|
||||||
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
|
Workspace workspace = getSelectedWorkspace(state);
|
||||||
|
Party party = Kernel.getContext().getParty();
|
||||||
|
if (!PortalHelper.canCustomize(party, workspace)) {
|
||||||
|
throw new AccessDeniedException(
|
||||||
|
"no permissions to customize workspace");
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkspacePage portal = (WorkspacePage) m_portal
|
WorkspacePage portal = (WorkspacePage) m_portal.getSelectedPortal(state);
|
||||||
.getSelectedPortal(state);
|
|
||||||
|
|
||||||
Assert.exists(portal, WorkspacePage.class);
|
Assert.exists(portal, WorkspacePage.class);
|
||||||
|
|
||||||
|
String title = (String) m_title.getValue(state);
|
||||||
|
portal.setTitle(title);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
String title = (String) m_title.getValue(state);
|
|
||||||
portal.setTitle(title);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,139 +37,197 @@ import com.arsdigita.portal.PortletType;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
|
||||||
public class PortalEditModelBuilder extends LockableImpl implements
|
/**
|
||||||
PortalModelBuilder {
|
* Builds the logic to modify (edit) a portal pane (remember: 0..n portal panes
|
||||||
|
* make up a workspace, see com.arsdigita.portalworkspace.Workspace).
|
||||||
|
*
|
||||||
|
* It collects the portlets belonging to a portal, determines whether a portlet
|
||||||
|
* is currently (request wise) to be edited or not and constructs the
|
||||||
|
* corresponding modification or display logic and enables the addition of new
|
||||||
|
* portlets.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PortalEditModelBuilder extends LockableImpl
|
||||||
|
implements PortalModelBuilder {
|
||||||
|
|
||||||
private static final Logger s_log = Logger
|
private static final Logger s_log = Logger
|
||||||
.getLogger(PortalEditModelBuilder.class);
|
.getLogger(PortalEditModelBuilder.class);
|
||||||
|
private Component m_adders[];
|
||||||
|
private PortalSelectionModel m_portal;
|
||||||
|
private PortletTypeSelectionModel m_creating;
|
||||||
|
private SingleSelectionModel m_column;
|
||||||
|
private PortletSelectionModel m_editing;
|
||||||
|
private HashMap m_create;
|
||||||
|
private HashMap m_modify;
|
||||||
|
private HashMap m_createApp;
|
||||||
|
private RequestLocal m_parentResource;
|
||||||
|
|
||||||
private Component m_adders[];
|
/**
|
||||||
|
* Constructor, checks existence of parameters and initialies internal
|
||||||
|
* variables.
|
||||||
|
*
|
||||||
|
* @param portal
|
||||||
|
* @param adders
|
||||||
|
* @param creating
|
||||||
|
* @param column
|
||||||
|
* @param editing
|
||||||
|
* @param create
|
||||||
|
* @param modify
|
||||||
|
* @param createApp
|
||||||
|
* @param parentResource
|
||||||
|
*/
|
||||||
|
public PortalEditModelBuilder(PortalSelectionModel portal,
|
||||||
|
Component adders[],
|
||||||
|
PortletTypeSelectionModel creating,
|
||||||
|
SingleSelectionModel column,
|
||||||
|
PortletSelectionModel editing,
|
||||||
|
HashMap create,
|
||||||
|
HashMap modify,
|
||||||
|
HashMap createApp,
|
||||||
|
RequestLocal parentResource) {
|
||||||
|
|
||||||
private PortalSelectionModel m_portal;
|
Assert.exists(portal, PortalSelectionModel.class);
|
||||||
|
Assert.exists(adders, Component.class);
|
||||||
|
Assert.exists(creating, PortletTypeSelectionModel.class);
|
||||||
|
Assert.exists(column, SingleSelectionModel.class);
|
||||||
|
Assert.exists(editing, PortletSelectionModel.class);
|
||||||
|
Assert.exists(create, HashMap.class);
|
||||||
|
Assert.exists(modify, HashMap.class);
|
||||||
|
Assert.exists(createApp, HashMap.class);
|
||||||
|
Assert.exists(parentResource, RequestLocal.class);
|
||||||
|
|
||||||
private PortletTypeSelectionModel m_creating;
|
m_portal = portal;
|
||||||
|
m_adders = adders;
|
||||||
|
m_create = create;
|
||||||
|
m_modify = modify;
|
||||||
|
m_creating = creating;
|
||||||
|
m_column = column;
|
||||||
|
m_editing = editing;
|
||||||
|
m_parentResource = parentResource;
|
||||||
|
m_createApp = createApp;
|
||||||
|
|
||||||
private SingleSelectionModel m_column;
|
}
|
||||||
|
|
||||||
private PortletSelectionModel m_editing;
|
|
||||||
|
|
||||||
private HashMap m_create;
|
/**
|
||||||
|
* Actually builds the logic for the pane under consideration.
|
||||||
|
*
|
||||||
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public PortalModel buildModel(PageState state) {
|
||||||
|
|
||||||
private HashMap m_modify;
|
WorkspacePage portal = m_portal.getSelectedPortal(state);
|
||||||
|
|
||||||
private HashMap m_createApp;
|
ArrayList list = new ArrayList();
|
||||||
|
PortletCollection portlets = portal.getPortlets();
|
||||||
|
while (portlets.next()) {
|
||||||
|
com.arsdigita.portal.Portlet portlet = portlets.getPortlet();
|
||||||
|
PortletRenderer renderer = null;
|
||||||
|
|
||||||
private RequestLocal m_parentResource;
|
if (portlet.getID().equals(m_editing.getSelectedKey(state))) {
|
||||||
|
// If this portlet is being edited, show the edit form
|
||||||
|
renderer = new SimplePortlet("Configure portlet",
|
||||||
|
portlet.getCellNumber(),
|
||||||
|
portlet.getSortKey(),
|
||||||
|
(Component) m_modify
|
||||||
|
.get(portlet.getPortletType()
|
||||||
|
.getResourceObjectType()));
|
||||||
|
} else {
|
||||||
|
// Otherwise show the normal portlet XML
|
||||||
|
renderer = (PortletRenderer) portlet.getPortletRenderer();
|
||||||
|
}
|
||||||
|
list.add(new Object[] { renderer, portlet.getID() });
|
||||||
|
}
|
||||||
|
|
||||||
public PortalEditModelBuilder(PortalSelectionModel portal,
|
// If we've selected a portlet type then show the form
|
||||||
Component adders[], PortletTypeSelectionModel creating,
|
// for creating that portlet
|
||||||
SingleSelectionModel column, PortletSelectionModel editing,
|
if (m_creating.isSelected(state)) {
|
||||||
HashMap create, HashMap modify, HashMap createApp,
|
PortletType type = m_creating.getSelectedPortletType(state);
|
||||||
RequestLocal parentResource) {
|
|
||||||
Assert.exists(portal, PortalSelectionModel.class);
|
|
||||||
Assert.exists(adders, Component.class);
|
|
||||||
Assert.exists(creating, PortletTypeSelectionModel.class);
|
|
||||||
Assert.exists(column, SingleSelectionModel.class);
|
|
||||||
Assert.exists(editing, PortletSelectionModel.class);
|
|
||||||
Assert.exists(create, HashMap.class);
|
|
||||||
Assert.exists(modify, HashMap.class);
|
|
||||||
Assert.exists(createApp, HashMap.class);
|
|
||||||
Assert.exists(parentResource, RequestLocal.class);
|
|
||||||
|
|
||||||
m_portal = portal;
|
if (s_log.isDebugEnabled()) {
|
||||||
m_adders = adders;
|
s_log.debug("Selected type " + m_creating.getSelectedKey(state)
|
||||||
m_create = create;
|
+ (type == null ? null : type.getID()));
|
||||||
m_modify = modify;
|
}
|
||||||
m_creating = creating;
|
|
||||||
m_column = column;
|
|
||||||
m_editing = editing;
|
|
||||||
m_parentResource = parentResource;
|
|
||||||
m_createApp = createApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PortalModel buildModel(PageState state) {
|
Component component = (Component) m_create.get(type
|
||||||
WorkspacePage portal = m_portal.getSelectedPortal(state);
|
.getResourceObjectType());
|
||||||
|
Integer column = (Integer) m_column.getSelectedKey(state);
|
||||||
|
|
||||||
ArrayList list = new ArrayList();
|
if (s_log.isDebugEnabled()) {
|
||||||
PortletCollection portlets = portal.getPortlets();
|
s_log.debug("Component is " + component + " "
|
||||||
while (portlets.next()) {
|
+ type.getResourceObjectType());
|
||||||
com.arsdigita.portal.Portlet portlet = portlets.getPortlet();
|
}
|
||||||
PortletRenderer renderer = null;
|
|
||||||
|
|
||||||
if (portlet.getID().equals(m_editing.getSelectedKey(state))) {
|
if (type.getProviderApplicationType() == null) {
|
||||||
// If this portlet is being edited, show the edit form
|
list.add(new SimplePortlet("Create portlet",
|
||||||
renderer = new SimplePortlet("Configure portlet", portlet
|
column.intValue(),
|
||||||
.getCellNumber(), portlet.getSortKey(),
|
99998,
|
||||||
(Component) m_modify.get(portlet.getPortletType()
|
component));
|
||||||
.getResourceObjectType()));
|
} else {
|
||||||
} else {
|
Component appCreate = (Component) m_createApp
|
||||||
// Otherwise show the normal portlet XML
|
.get(type
|
||||||
renderer = (PortletRenderer) portlet.getPortletRenderer();
|
.getResourceObjectType());
|
||||||
}
|
list.add(new ApplicationPortlet("Create portlet",
|
||||||
list.add(new Object[] { renderer, portlet.getID() });
|
column.intValue(),
|
||||||
}
|
99998,
|
||||||
|
m_parentResource,
|
||||||
|
component,
|
||||||
|
appCreate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we've selected a portlet type then show the form
|
// Show the forms for picking a portlet type to create
|
||||||
// for creating that portlet
|
for (int i = 0; i < portal.getLayout().getColumns(); i++) {
|
||||||
if (m_creating.isSelected(state)) {
|
if (s_log.isDebugEnabled()) {
|
||||||
PortletType type = m_creating.getSelectedPortletType(state);
|
s_log.debug("Adding adder number " + i + m_adders[i]);
|
||||||
|
}
|
||||||
|
|
||||||
if (s_log.isDebugEnabled()) {
|
list.add(new SimplePortlet("Add portlet",
|
||||||
s_log.debug("Selected type " + m_creating.getSelectedKey(state)
|
i + 1,
|
||||||
+ (type == null ? null : type.getID()));
|
999999,
|
||||||
}
|
m_adders[i]));
|
||||||
|
}
|
||||||
|
|
||||||
Component component = (Component) m_create.get(type
|
return new PortalEditModel(list.iterator(), portal.getTitle());
|
||||||
.getResourceObjectType());
|
|
||||||
Integer column = (Integer) m_column.getSelectedKey(state);
|
|
||||||
|
|
||||||
if (s_log.isDebugEnabled()) {
|
}
|
||||||
s_log.debug("Component is " + component + " "
|
|
||||||
+ type.getResourceObjectType());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type.getProviderApplicationType() == null) {
|
|
||||||
list.add(new SimplePortlet("Create portlet", column.intValue(),
|
|
||||||
99998, component));
|
|
||||||
} else {
|
|
||||||
Component appCreate = (Component) m_createApp.get(type
|
|
||||||
.getResourceObjectType());
|
|
||||||
list.add(new ApplicationPortlet("Create portlet", column
|
|
||||||
.intValue(), 99998, m_parentResource, component,
|
|
||||||
appCreate));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show the forms for picking a portlet type to create
|
/**
|
||||||
for (int i = 0; i < portal.getLayout().getColumns(); i++) {
|
*
|
||||||
if (s_log.isDebugEnabled()) {
|
*/
|
||||||
s_log.debug("Adding adder number " + i + m_adders[i]);
|
private class PortalEditModel implements PortalModel {
|
||||||
}
|
|
||||||
|
|
||||||
list.add(new SimplePortlet("Add portlet", i + 1, 999999,
|
private Iterator m_portlets;
|
||||||
m_adders[i]));
|
private String m_title;
|
||||||
}
|
|
||||||
|
|
||||||
return new PortalEditModel(list.iterator(), portal.getTitle());
|
/**
|
||||||
}
|
*
|
||||||
|
* @param portlets
|
||||||
|
* @param title
|
||||||
|
*/
|
||||||
|
public PortalEditModel(Iterator portlets, String title) {
|
||||||
|
m_portlets = portlets;
|
||||||
|
m_title = title;
|
||||||
|
}
|
||||||
|
|
||||||
private class PortalEditModel implements PortalModel {
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Iterator getPortletRenderers() {
|
||||||
|
return m_portlets;
|
||||||
|
}
|
||||||
|
|
||||||
private Iterator m_portlets;
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getTitle() {
|
||||||
|
return m_title;
|
||||||
|
}
|
||||||
|
|
||||||
private String m_title;
|
}
|
||||||
|
|
||||||
public PortalEditModel(Iterator portlets, String title) {
|
|
||||||
m_portlets = portlets;
|
|
||||||
m_title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Iterator getPortletRenderers() {
|
|
||||||
return m_portlets;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return m_title;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -21,17 +24,40 @@ import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||||
import com.arsdigita.kernel.permissions.PermissionService;
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Support class to determine users permission for viewing and/or modifying a
|
||||||
|
* portal.
|
||||||
|
*/
|
||||||
public class PortalHelper {
|
public class PortalHelper {
|
||||||
|
|
||||||
public static boolean canBrowse(Party party, ACSObject object) {
|
/**
|
||||||
PermissionDescriptor perm = new PermissionDescriptor(
|
* Check if user is allowed to view a portal.
|
||||||
PrivilegeDescriptor.READ, object, party);
|
*
|
||||||
return PermissionService.checkPermission(perm);
|
* @param party
|
||||||
}
|
* @param object
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean canBrowse(Party party, ACSObject object) {
|
||||||
|
PermissionDescriptor perm =
|
||||||
|
new PermissionDescriptor(PrivilegeDescriptor.READ,
|
||||||
|
object,
|
||||||
|
party);
|
||||||
|
return PermissionService.checkPermission(perm);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if user is allowed to modify (customize) a portal.
|
||||||
|
*
|
||||||
|
* @param party
|
||||||
|
* @param object
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean canCustomize(Party party, ACSObject object) {
|
||||||
|
PermissionDescriptor perm =
|
||||||
|
new PermissionDescriptor(PrivilegeDescriptor.ADMIN,
|
||||||
|
object,
|
||||||
|
party);
|
||||||
|
return PermissionService.checkPermission(perm);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean canCustomize(Party party, ACSObject object) {
|
|
||||||
PermissionDescriptor perm = new PermissionDescriptor(
|
|
||||||
PrivilegeDescriptor.ADMIN, object, party);
|
|
||||||
return PermissionService.checkPermission(perm);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -38,66 +41,66 @@ import com.arsdigita.xml.XML;
|
||||||
*/
|
*/
|
||||||
public abstract class PortalList extends SimpleContainer {
|
public abstract class PortalList extends SimpleContainer {
|
||||||
|
|
||||||
private WorkspaceSelectionModel m_workspace;
|
private WorkspaceSelectionModel m_workspace;
|
||||||
|
private PortalSelectionModel m_portal;
|
||||||
|
|
||||||
private PortalSelectionModel m_portal;
|
private Map m_actions = new HashMap();
|
||||||
|
|
||||||
private Map m_actions = new HashMap();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param portal
|
* @param portal
|
||||||
*/
|
*/
|
||||||
public PortalList(PortalSelectionModel portal) {
|
public PortalList(PortalSelectionModel portal) {
|
||||||
this(null, portal);
|
this(null, portal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param workspace
|
* @param workspace
|
||||||
* @param portal
|
* @param portal
|
||||||
*/
|
*/
|
||||||
public PortalList(WorkspaceSelectionModel workspace,
|
public PortalList(WorkspaceSelectionModel workspace,
|
||||||
PortalSelectionModel portal) {
|
PortalSelectionModel portal) {
|
||||||
super("portal:portalList", PortalConstants.PORTAL_XML_NS);
|
super("portal:portalList", PortalConstants.PORTAL_XML_NS);
|
||||||
|
|
||||||
m_workspace = workspace;
|
m_workspace = workspace;
|
||||||
m_portal = portal;
|
m_portal = portal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWorkspaceModel(WorkspaceSelectionModel workspace) {
|
public void setWorkspaceModel(WorkspaceSelectionModel workspace) {
|
||||||
m_workspace = workspace;
|
m_workspace = workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addPortalAction(String name, ActionListener listener) {
|
protected void addPortalAction(String name, ActionListener listener) {
|
||||||
m_actions.put(name, listener);
|
m_actions.put(name, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void respond(PageState state) {
|
public void respond(PageState state) {
|
||||||
String name = state.getControlEventName();
|
String name = state.getControlEventName();
|
||||||
|
|
||||||
ActionListener listener = (ActionListener) m_actions.get(name);
|
ActionListener listener = (ActionListener) m_actions.get(name);
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.actionPerformed(new ActionEvent(this, state));
|
listener.actionPerformed(new ActionEvent(this, state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedPortal(PageState state, WorkspacePage portal) {
|
public void setSelectedPortal(PageState state, WorkspacePage portal) {
|
||||||
m_portal.setSelectedObject(state, portal);
|
m_portal.setSelectedObject(state, portal);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkspacePage getSelectedPortal(PageState state) {
|
public WorkspacePage getSelectedPortal(PageState state) {
|
||||||
return (WorkspacePage) m_portal.getSelectedPortal(state);
|
return (WorkspacePage) m_portal.getSelectedPortal(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearSelectedPortal(PageState state) {
|
public void clearSelectedPortal(PageState state) {
|
||||||
m_portal.clearSelection(state);
|
m_portal.clearSelection(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Workspace getSelectedWorkspace(PageState state) {
|
public Workspace getSelectedWorkspace(PageState state) {
|
||||||
return m_workspace.getSelectedWorkspace(state);
|
return m_workspace.getSelectedWorkspace(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -105,64 +108,71 @@ public abstract class PortalList extends SimpleContainer {
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void generateXML(PageState state, Element parent) {
|
public void generateXML(PageState state, Element parent) {
|
||||||
if (!isVisible(state)) {
|
|
||||||
return;
|
if (!isVisible(state)) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Element content = generateParent(parent);
|
Element content = generateParent(parent);
|
||||||
|
generateChildrenXML(state, content);
|
||||||
|
generatePortalListXML(state, content);
|
||||||
|
|
||||||
generateChildrenXML(state, content);
|
}
|
||||||
|
|
||||||
generatePortalListXML(state, content);
|
/**
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
*
|
||||||
* @param state
|
* @param state
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
protected void generatePortalListXML(PageState state, Element parent) {
|
protected void generatePortalListXML(PageState state, Element parent) {
|
||||||
WorkspacePage current = m_portal.getSelectedPortal(state);
|
|
||||||
|
|
||||||
Workspace workspace = getSelectedWorkspace(state);
|
WorkspacePage current = m_portal.getSelectedPortal(state);
|
||||||
WorkspacePageCollection pages = workspace.getPages();
|
|
||||||
pages.addOrder(WorkspacePage.SORT_KEY);
|
|
||||||
while (pages.next()) {
|
|
||||||
Element pageEl = new Element("portal:portalDetails",
|
|
||||||
PortalConstants.PORTAL_XML_NS);
|
|
||||||
|
|
||||||
WorkspacePage page = pages.getPage();
|
Workspace workspace = getSelectedWorkspace(state);
|
||||||
|
WorkspacePageCollection pages = workspace.getPages();
|
||||||
|
pages.addOrder(WorkspacePage.SORT_KEY);
|
||||||
|
while (pages.next()) {
|
||||||
|
Element pageEl = new Element("portal:portalDetails",
|
||||||
|
PortalConstants.PORTAL_XML_NS);
|
||||||
|
WorkspacePage page = pages.getPage();
|
||||||
|
generatePageXML(state, pageEl, page);
|
||||||
|
|
||||||
generatePageXML(state, pageEl, page);
|
pageEl.addAttribute("isSelected",
|
||||||
|
XML.format(page.equals(current) ? Boolean.TRUE
|
||||||
|
: Boolean.FALSE));
|
||||||
|
|
||||||
pageEl.addAttribute("isSelected",
|
parent.addContent(pageEl);
|
||||||
XML.format(page.equals(current) ? Boolean.TRUE
|
}
|
||||||
: Boolean.FALSE));
|
|
||||||
|
|
||||||
parent.addContent(pageEl);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void generatePageXML(PageState state, Element parent,
|
/**
|
||||||
WorkspacePage page) {
|
*
|
||||||
DomainObjectXMLRenderer xr = new DomainObjectXMLRenderer(parent);
|
* @param state
|
||||||
xr.setWrapRoot(false);
|
* @param parent
|
||||||
xr.setWrapAttributes(true);
|
* @param page
|
||||||
xr.setWrapObjects(false);
|
*/
|
||||||
|
protected void generatePageXML(PageState state, Element parent,
|
||||||
|
WorkspacePage page) {
|
||||||
|
DomainObjectXMLRenderer xr = new DomainObjectXMLRenderer(parent);
|
||||||
|
xr.setWrapRoot(false);
|
||||||
|
xr.setWrapAttributes(true);
|
||||||
|
xr.setWrapObjects(false);
|
||||||
|
|
||||||
xr.walk(page, PortalList.class.getName());
|
xr.walk(page, PortalList.class.getName());
|
||||||
|
|
||||||
|
Iterator actions = m_actions.keySet().iterator();
|
||||||
|
while (actions.hasNext()) {
|
||||||
|
String name = (String) actions.next();
|
||||||
|
state.setControlEvent(this, name, page.getID().toString());
|
||||||
|
try {
|
||||||
|
parent.addAttribute(name + "Action", state.stateAsURL());
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new UncheckedWrapperException("cannot get state url", ex);
|
||||||
|
}
|
||||||
|
state.clearControlEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Iterator actions = m_actions.keySet().iterator();
|
|
||||||
while (actions.hasNext()) {
|
|
||||||
String name = (String) actions.next();
|
|
||||||
state.setControlEvent(this, name, page.getID().toString());
|
|
||||||
try {
|
|
||||||
parent.addAttribute(name + "Action", state.stateAsURL());
|
|
||||||
} catch (IOException ex) {
|
|
||||||
throw new UncheckedWrapperException("cannot get state url", ex);
|
|
||||||
}
|
|
||||||
state.clearControlEvent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -26,36 +29,45 @@ import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.portalworkspace.WorkspacePage;
|
import com.arsdigita.portalworkspace.WorkspacePage;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class PortalListViewer extends PortalList {
|
public class PortalListViewer extends PortalList {
|
||||||
|
|
||||||
private static final Logger s_log = Logger
|
/** Logger instance to support debugging */
|
||||||
.getLogger(PortalListViewer.class);
|
private static final Logger s_log = Logger
|
||||||
|
.getLogger(PortalListViewer.class);
|
||||||
|
|
||||||
public PortalListViewer(PortalSelectionModel portal) {
|
/**
|
||||||
this(null, portal);
|
*
|
||||||
}
|
* @param portal
|
||||||
|
*/
|
||||||
|
public PortalListViewer(PortalSelectionModel portal) {
|
||||||
|
this(null, portal);
|
||||||
|
}
|
||||||
|
|
||||||
public PortalListViewer(WorkspaceSelectionModel workspace,
|
public PortalListViewer(WorkspaceSelectionModel workspace,
|
||||||
PortalSelectionModel portal) {
|
PortalSelectionModel portal) {
|
||||||
super(workspace, portal);
|
|
||||||
|
|
||||||
addPortalAction("select", new ActionListener() {
|
super(workspace, portal);
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
PageState state = e.getPageState();
|
|
||||||
String value = state.getControlEventValue();
|
|
||||||
|
|
||||||
if (s_log.isDebugEnabled()) {
|
addPortalAction("select",
|
||||||
s_log.debug("Selecting portal " + value);
|
new ActionListener() {
|
||||||
}
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
PageState state = e.getPageState();
|
||||||
WorkspacePage portal = (WorkspacePage) DomainObjectFactory
|
String value = state.getControlEventValue();
|
||||||
.newInstance(new OID(
|
if (s_log.isDebugEnabled()) {
|
||||||
WorkspacePage.BASE_DATA_OBJECT_TYPE,
|
s_log.debug("Selecting portal " + value);
|
||||||
new BigDecimal(value)));
|
}
|
||||||
|
WorkspacePage portal = (WorkspacePage)
|
||||||
setSelectedPortal(state, portal);
|
DomainObjectFactory
|
||||||
}
|
.newInstance(new OID(
|
||||||
});
|
WorkspacePage.BASE_DATA_OBJECT_TYPE,
|
||||||
}
|
new BigDecimal(value)));
|
||||||
|
setSelectedPortal(state, portal);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -19,7 +22,17 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.kernel.ui.DomainObjectSelectionModel;
|
import com.arsdigita.kernel.ui.DomainObjectSelectionModel;
|
||||||
import com.arsdigita.portalworkspace.WorkspacePage;
|
import com.arsdigita.portalworkspace.WorkspacePage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface PortalSelectionModel extends DomainObjectSelectionModel {
|
public interface PortalSelectionModel extends DomainObjectSelectionModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public WorkspacePage getSelectedPortal(PageState state);
|
public WorkspacePage getSelectedPortal(PageState state);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,48 +30,75 @@ import com.arsdigita.portalworkspace.WorkspacePage;
|
||||||
import com.arsdigita.portal.PortletCollection;
|
import com.arsdigita.portal.PortletCollection;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
|
||||||
public class PortalViewModelBuilder extends LockableImpl implements
|
/**
|
||||||
PortalModelBuilder {
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PortalViewModelBuilder extends LockableImpl
|
||||||
|
implements PortalModelBuilder {
|
||||||
|
|
||||||
private static final Logger s_log = Logger
|
/** Logger object to support debugging */
|
||||||
.getLogger(PortalViewModelBuilder.class);
|
private static final Logger s_log =
|
||||||
|
Logger.getLogger(PortalViewModelBuilder.class);
|
||||||
|
|
||||||
private PortalSelectionModel m_portal;
|
private PortalSelectionModel m_portal;
|
||||||
|
|
||||||
public PortalViewModelBuilder(PortalSelectionModel portal) {
|
|
||||||
m_portal = portal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PortalModel buildModel(PageState state) {
|
/**
|
||||||
WorkspacePage portal = m_portal.getSelectedPortal(state);
|
*
|
||||||
|
* @param portal
|
||||||
|
*/
|
||||||
|
public PortalViewModelBuilder(PortalSelectionModel portal) {
|
||||||
|
m_portal = portal;
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList list = new ArrayList();
|
/**
|
||||||
PortletCollection portlets = portal.getPortlets();
|
*
|
||||||
while (portlets.next()) {
|
* @param state
|
||||||
com.arsdigita.portal.Portlet portlet = portlets.getPortlet();
|
* @return
|
||||||
list.add(portlet.getPortletRenderer());
|
*/
|
||||||
}
|
public PortalModel buildModel(PageState state) {
|
||||||
|
|
||||||
return new PortalViewModel(list.iterator(), portal.getTitle());
|
WorkspacePage portal = m_portal.getSelectedPortal(state);
|
||||||
}
|
|
||||||
|
|
||||||
private class PortalViewModel implements PortalModel {
|
ArrayList list = new ArrayList();
|
||||||
|
PortletCollection portlets = portal.getPortlets();
|
||||||
|
while (portlets.next()) {
|
||||||
|
com.arsdigita.portal.Portlet portlet = portlets.getPortlet();
|
||||||
|
list.add(portlet.getPortletRenderer());
|
||||||
|
}
|
||||||
|
|
||||||
private Iterator m_portlets;
|
return new PortalViewModel(list.iterator(), portal.getTitle());
|
||||||
|
|
||||||
private String m_title;
|
}
|
||||||
|
|
||||||
public PortalViewModel(Iterator portlets, String title) {
|
/**
|
||||||
m_portlets = portlets;
|
*
|
||||||
m_title = title;
|
*/
|
||||||
}
|
private class PortalViewModel implements PortalModel {
|
||||||
|
|
||||||
public Iterator getPortletRenderers() {
|
private Iterator m_portlets;
|
||||||
return m_portlets;
|
private String m_title;
|
||||||
}
|
public PortalViewModel(Iterator portlets, String title) {
|
||||||
|
m_portlets = portlets;
|
||||||
|
m_title = title;
|
||||||
|
|
||||||
public String getTitle() {
|
}
|
||||||
return m_title;
|
|
||||||
}
|
/**
|
||||||
}
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Iterator getPortletRenderers() {
|
||||||
|
return m_portlets;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getTitle() {
|
||||||
|
return m_title;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
|
||||||
* License (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS
|
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
||||||
* implied. See the License for the specific language governing
|
|
||||||
* rights and limitations under the License.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.arsdigita.london.portal.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.RequestLocal;
|
|
||||||
import com.arsdigita.kernel.ResourceType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use com.arsdigita.bebop.portal.PortletConfigFormSection
|
|
||||||
* @see com.arsdigita.bebop.portal.PortletConfigFormSection
|
|
||||||
*/
|
|
||||||
public class PortletConfigFormSection extends
|
|
||||||
com.arsdigita.bebop.portal.PortletConfigFormSection {
|
|
||||||
|
|
||||||
public PortletConfigFormSection(ResourceType resType,
|
|
||||||
RequestLocal parentAppRL) {
|
|
||||||
super(resType, parentAppRL);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PortletConfigFormSection(RequestLocal application) {
|
|
||||||
super(application);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -28,11 +31,21 @@ import com.arsdigita.portal.Portlet;
|
||||||
*/
|
*/
|
||||||
public class PortletSelectionModel extends ACSObjectSelectionModel {
|
public class PortletSelectionModel extends ACSObjectSelectionModel {
|
||||||
|
|
||||||
public PortletSelectionModel(BigDecimalParameter p) {
|
/**
|
||||||
super(p);
|
*
|
||||||
}
|
* @param p
|
||||||
|
*/
|
||||||
|
public PortletSelectionModel(BigDecimalParameter p) {
|
||||||
|
super(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Portlet getSelectedPortlet(PageState state) {
|
||||||
|
return (Portlet) getSelectedObject(state);
|
||||||
|
}
|
||||||
|
|
||||||
public Portlet getSelectedPortlet(PageState state) {
|
|
||||||
return (Portlet) getSelectedObject(state);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,35 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Another specific entry point into a portal workspace page, here based upon
|
||||||
|
* WorkspaceComponent (as an alternative to AbstractWorkspaceComponent.
|
||||||
|
*/
|
||||||
|
// As of APLAWS 1.0.4 / CCM 6.6.x this class may never have been used and is
|
||||||
|
// propably unfinished work or undinished port from ccm-portalserver module.
|
||||||
|
// As with WorkspaceViewer it should be invoked by a jsp. It is not directly
|
||||||
|
// used by any java code.
|
||||||
public class UserWorkspace extends WorkspaceComponent {
|
public class UserWorkspace extends WorkspaceComponent {
|
||||||
|
|
||||||
public UserWorkspace() {
|
public UserWorkspace() {
|
||||||
super(new UserWorkspaceSelectionModel());
|
super(new UserWorkspaceSelectionModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,22 +25,28 @@ import com.arsdigita.web.LoginSignal;
|
||||||
|
|
||||||
public class UserWorkspaceSelectionModel extends WorkspaceSelectionModel {
|
public class UserWorkspaceSelectionModel extends WorkspaceSelectionModel {
|
||||||
|
|
||||||
protected Workspace getDefaultWorkspace(PageState state) {
|
/**
|
||||||
Workspace workspace = (Workspace) Kernel.getContext().getResource();
|
*
|
||||||
Party party = Kernel.getContext().getParty();
|
* @param state
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected Workspace getDefaultWorkspace(PageState state) {
|
||||||
|
|
||||||
|
Workspace workspace = (Workspace) Kernel.getContext().getResource();
|
||||||
|
Party party = Kernel.getContext().getParty();
|
||||||
|
|
||||||
if (party == null) {
|
if (party == null) {
|
||||||
throw new LoginSignal(state.getRequest());
|
throw new LoginSignal(state.getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
workspace = workspace.retrieveSubworkspaceForParty(party);
|
workspace = workspace.retrieveSubworkspaceForParty(party);
|
||||||
|
} catch (DataObjectNotFoundException ex) {
|
||||||
|
throw new UncheckedWrapperException("cannot find workspace for party "
|
||||||
|
+ party.getID(), ex);
|
||||||
|
}
|
||||||
|
return workspace;
|
||||||
|
|
||||||
} catch (DataObjectNotFoundException ex) {
|
}
|
||||||
throw new UncheckedWrapperException(
|
|
||||||
"cannot find workspace for party " + party.getID(), ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return workspace;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -40,6 +43,10 @@ import com.arsdigita.web.RedirectSignal;
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class WorkspaceComponent extends SimpleContainer {
|
public class WorkspaceComponent extends SimpleContainer {
|
||||||
|
|
||||||
private WorkspaceSelectionModel m_workspace;
|
private WorkspaceSelectionModel m_workspace;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@ import com.arsdigita.portalworkspace.Workspace;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class WorkspaceDetails extends SimpleComponent {
|
public class WorkspaceDetails extends SimpleComponent {
|
||||||
|
|
||||||
private WorkspaceSelectionModel m_workspace;
|
private WorkspaceSelectionModel m_workspace;
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
@ -46,44 +49,70 @@ import com.arsdigita.portalworkspace.Workspace;
|
||||||
import com.arsdigita.portalworkspace.WorkspacePage;
|
import com.arsdigita.portalworkspace.WorkspacePage;
|
||||||
import com.arsdigita.portalworkspace.util.GlobalizationUtil;
|
import com.arsdigita.portalworkspace.util.GlobalizationUtil;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Another entry point into a standard portal workspace page where the
|
||||||
|
* page is constructed in "edit" mode to allow configuration and modification
|
||||||
|
* by an authorized participant.
|
||||||
|
*
|
||||||
|
* It is used via a jsp page which is invoked at the applications url.
|
||||||
|
*
|
||||||
|
* Example code stub:
|
||||||
|
* <pre>
|
||||||
|
* <define:component name="edit"
|
||||||
|
* classname="com.arsdigita.portalworkspace.ui.WorkspaceEditor" />
|
||||||
|
* <jsp:scriptlet>
|
||||||
|
* ((AbstractWorkspaceComponent)edit).setWorkspaceModel(
|
||||||
|
* new DefaultWorkspaceSelectionModel());
|
||||||
|
* </jsp:scriptlet>
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* Currently there is a jsp for the default url at
|
||||||
|
* (web)/templates/ccm-portalworkspace/edit.jsp which is mapped via web.xml
|
||||||
|
* to /ccm/portal/edit.jsp in the default, pre-configured configuration.
|
||||||
|
*/
|
||||||
public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(WorkspaceEditor.class);
|
private static final Logger s_log = Logger.getLogger(WorkspaceEditor.class);
|
||||||
|
|
||||||
private ActionLink m_add;
|
private ActionLink m_add;
|
||||||
|
|
||||||
private SelectThemeForm m_selectForm;
|
private SelectThemeForm m_selectForm;
|
||||||
|
|
||||||
private RadioGroup m_grp;
|
private RadioGroup m_grp;
|
||||||
|
|
||||||
private CreateThemeForm m_createForm;
|
private CreateThemeForm m_createForm;
|
||||||
|
|
||||||
private ActionLink m_createThemeLink;
|
private ActionLink m_createThemeLink;
|
||||||
|
|
||||||
private WorkspaceThemeCollection m_workspaceThemes;
|
private WorkspaceThemeCollection m_workspaceThemes;
|
||||||
|
|
||||||
private BasicPropertiesForm m_basisPropertiesForm;
|
private BasicPropertiesForm m_basisPropertiesForm;
|
||||||
|
|
||||||
private ActionLink m_editBasicPropertiesLink;
|
private ActionLink m_editBasicPropertiesLink;
|
||||||
|
|
||||||
public WorkspaceEditor() {
|
|
||||||
this(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void register(Page page) {
|
/**
|
||||||
super.register(page);
|
* Default Constructor constructs a new, empty WorkspaceEditor object.
|
||||||
page.setVisibleDefault(m_selectForm, !m_workspaceThemes.isEmpty());
|
*/
|
||||||
page.setVisibleDefault(m_createForm, false);
|
public WorkspaceEditor() {
|
||||||
page.setVisibleDefault(m_basisPropertiesForm, false);
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkspaceEditor(WorkspaceSelectionModel workspace) {
|
/**
|
||||||
super(workspace);
|
* Constructs a WorkspaceViewer for a specific workspace object
|
||||||
s_log.debug("WorkspaceEditor constructed");
|
* and sets the xml tags accordingly.
|
||||||
|
*
|
||||||
|
* @param workspace
|
||||||
|
*/
|
||||||
|
public WorkspaceEditor(WorkspaceSelectionModel workspace) {
|
||||||
|
|
||||||
m_add = new ActionLink("add pane");
|
super(workspace);
|
||||||
m_add.setClassAttr("actionLink");
|
s_log.debug("WorkspaceEditor constructed");
|
||||||
m_add.addActionListener(new ActionListener() {
|
|
||||||
|
m_add = new ActionLink("add pane");
|
||||||
|
m_add.setClassAttr("actionLink");
|
||||||
|
m_add.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
|
|
@ -99,48 +128,67 @@ public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
add(m_add);
|
add(m_add);
|
||||||
|
|
||||||
m_createThemeLink = new ActionLink((String) GlobalizationUtil
|
m_createThemeLink = new ActionLink((String) GlobalizationUtil
|
||||||
.globalize("portal.ui.admin.create_theme").localize());
|
.globalize("portal.ui.admin.create_theme").localize());
|
||||||
m_createThemeLink.setClassAttr("actionLink");
|
m_createThemeLink.setClassAttr("actionLink");
|
||||||
m_createThemeLink.addActionListener(new CreateThemeLinkListener());
|
m_createThemeLink.addActionListener(new CreateThemeLinkListener());
|
||||||
m_grp = new RadioGroup("themes");
|
m_grp = new RadioGroup("themes");
|
||||||
m_grp.setClassAttr("vertical");
|
m_grp.setClassAttr("vertical");
|
||||||
populateOptionGroup();
|
populateOptionGroup();
|
||||||
m_selectForm = new SelectThemeForm();
|
m_selectForm = new SelectThemeForm();
|
||||||
m_createForm = new CreateThemeForm();
|
m_createForm = new CreateThemeForm();
|
||||||
|
|
||||||
add(m_selectForm);
|
add(m_selectForm);
|
||||||
add(m_createForm);
|
add(m_createForm);
|
||||||
add(m_createThemeLink); // nb. this line is commented in the undp src
|
add(m_createThemeLink); // nb. this line is commented in the undp src
|
||||||
|
|
||||||
// now add the basic properties controls
|
// now add the basic properties controls
|
||||||
m_editBasicPropertiesLink = new ActionLink((String) GlobalizationUtil
|
m_editBasicPropertiesLink = new ActionLink((String) GlobalizationUtil
|
||||||
.globalize("portal.ui.admin.edit_basic_properties").localize());
|
.globalize("portal.ui.admin.edit_basic_properties").localize());
|
||||||
m_editBasicPropertiesLink
|
m_editBasicPropertiesLink
|
||||||
.addActionListener(new BasicPropertiesLinkListener());
|
.addActionListener(new BasicPropertiesLinkListener());
|
||||||
m_editBasicPropertiesLink.setClassAttr("actionLink");
|
m_editBasicPropertiesLink.setClassAttr("actionLink");
|
||||||
add(m_editBasicPropertiesLink);
|
add(m_editBasicPropertiesLink);
|
||||||
m_basisPropertiesForm = new BasicPropertiesForm();
|
m_basisPropertiesForm = new BasicPropertiesForm();
|
||||||
add(m_basisPropertiesForm);
|
add(m_basisPropertiesForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PortalList createPortalList(PortalSelectionModel portal) {
|
/**
|
||||||
return new PortalListEditor(portal);
|
*
|
||||||
}
|
* @param portal
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected PortalList createPortalList(PortalSelectionModel portal) {
|
||||||
|
return new PortalListEditor(portal);
|
||||||
|
}
|
||||||
|
|
||||||
protected PersistentPortal createPortalDisplay(PortalSelectionModel portal) {
|
|
||||||
return new PersistentPortal(portal, PortalConstants.MODE_EDITOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO
|
public void register(Page page) {
|
||||||
// there is a big problem with this model
|
super.register(page);
|
||||||
// the options are locked and therefore you can't see
|
page.setVisibleDefault(m_selectForm, !m_workspaceThemes.isEmpty());
|
||||||
// the theme created until after a server restart
|
page.setVisibleDefault(m_createForm, false);
|
||||||
// however this is as the code came from skylift so
|
page.setVisibleDefault(m_basisPropertiesForm, false);
|
||||||
// I'm leaving it like this.
|
}
|
||||||
private void populateOptionGroup() {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param portal
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected PersistentPortal createPortalDisplay(PortalSelectionModel portal) {
|
||||||
|
return new PersistentPortal(portal, PortalConstants.MODE_EDITOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// there is a big problem with this model
|
||||||
|
// the options are locked and therefore you can't see
|
||||||
|
// the theme created until after a server restart
|
||||||
|
// however this is as the code came from skylift so
|
||||||
|
// I'm leaving it like this.
|
||||||
|
private void populateOptionGroup() {
|
||||||
m_grp.clearOptions();
|
m_grp.clearOptions();
|
||||||
m_workspaceThemes = WorkspaceTheme.retrieveAllWorkspaceThemes();
|
m_workspaceThemes = WorkspaceTheme.retrieveAllWorkspaceThemes();
|
||||||
while (m_workspaceThemes.next()) {
|
while (m_workspaceThemes.next()) {
|
||||||
|
|
@ -149,22 +197,26 @@ public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
||||||
String name = m_workspaceThemes.getWorkspaceTheme().getName();
|
String name = m_workspaceThemes.getWorkspaceTheme().getName();
|
||||||
addOption(id, name);
|
addOption(id, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addOption(String id, String name) {
|
private void addOption(String id, String name) {
|
||||||
Option opt = new Option(id, name);
|
Option opt = new Option(id, name);
|
||||||
m_grp.addOption(opt);
|
m_grp.addOption(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SelectThemeForm extends Form implements FormProcessListener,
|
/**
|
||||||
FormInitListener {
|
*
|
||||||
private Label instruction;
|
*/
|
||||||
|
public class SelectThemeForm extends Form implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
private Label instruction;
|
||||||
|
private Submit button;
|
||||||
|
RequestLocal prtlRL;
|
||||||
|
|
||||||
private Submit button;
|
/**
|
||||||
|
*
|
||||||
RequestLocal prtlRL;
|
*/
|
||||||
|
public SelectThemeForm() {
|
||||||
public SelectThemeForm() {
|
|
||||||
super("selectthemeform");
|
super("selectthemeform");
|
||||||
s_log.debug("SelectThemeForm constructed");
|
s_log.debug("SelectThemeForm constructed");
|
||||||
instruction = new Label(GlobalizationUtil
|
instruction = new Label(GlobalizationUtil
|
||||||
|
|
@ -180,9 +232,13 @@ public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
||||||
add(m_grp);
|
add(m_grp);
|
||||||
addProcessListener(this);
|
addProcessListener(this);
|
||||||
addInitListener(this);
|
addInitListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process(FormSectionEvent e) {
|
/**
|
||||||
|
*
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
public void process(FormSectionEvent e) {
|
||||||
s_log.debug("process called for SelectThemeForm");
|
s_log.debug("process called for SelectThemeForm");
|
||||||
String selectedkey;
|
String selectedkey;
|
||||||
PageState s = e.getPageState();
|
PageState s = e.getPageState();
|
||||||
|
|
@ -197,9 +253,9 @@ public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
||||||
workspace.setTheme(theme);
|
workspace.setTheme(theme);
|
||||||
workspace.save();
|
workspace.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(FormSectionEvent e) throws FormProcessException {
|
public void init(FormSectionEvent e) throws FormProcessException {
|
||||||
s_log.debug("init called for SelectThemeForm");
|
s_log.debug("init called for SelectThemeForm");
|
||||||
PageState ps = e.getPageState();
|
PageState ps = e.getPageState();
|
||||||
if (m_workspaceThemes.isEmpty())
|
if (m_workspaceThemes.isEmpty())
|
||||||
|
|
@ -214,45 +270,37 @@ public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
||||||
WorkspaceTheme theme = workspace.getTheme();
|
WorkspaceTheme theme = workspace.getTheme();
|
||||||
if (theme != null)
|
if (theme != null)
|
||||||
fd.put("themes", theme.getID().toString());
|
fd.put("themes", theme.getID().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateThemeForm extends Form implements FormProcessListener,
|
|
||||||
FormInitListener {
|
|
||||||
private Label instruction;
|
|
||||||
|
|
||||||
private Submit savebutton;
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CreateThemeForm extends Form implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
private Label instruction;
|
||||||
|
private Submit savebutton;
|
||||||
|
private TextField themename;
|
||||||
|
private ColorPicker background;
|
||||||
|
private ColorPicker text;
|
||||||
|
private ColorPicker activetab;
|
||||||
|
private ColorPicker inactivetab;
|
||||||
|
private ColorPicker activetabtext;
|
||||||
|
private ColorPicker inactivetabtext;
|
||||||
|
private ColorPicker toprule;
|
||||||
|
private ColorPicker bottomrule;
|
||||||
|
private ColorPicker portletheader;
|
||||||
|
private ColorPicker portletborder;
|
||||||
|
private ColorPicker portletheadertext;
|
||||||
|
private ColorPicker portletbodynarrow;
|
||||||
|
RequestLocal prtlRL;
|
||||||
|
|
||||||
private TextField themename;
|
/**
|
||||||
|
*
|
||||||
private ColorPicker background;
|
*/
|
||||||
|
public CreateThemeForm() {
|
||||||
private ColorPicker text;
|
|
||||||
|
|
||||||
private ColorPicker activetab;
|
|
||||||
|
|
||||||
private ColorPicker inactivetab;
|
|
||||||
|
|
||||||
private ColorPicker activetabtext;
|
|
||||||
|
|
||||||
private ColorPicker inactivetabtext;
|
|
||||||
|
|
||||||
private ColorPicker toprule;
|
|
||||||
|
|
||||||
private ColorPicker bottomrule;
|
|
||||||
|
|
||||||
private ColorPicker portletheader;
|
|
||||||
|
|
||||||
private ColorPicker portletborder;
|
|
||||||
|
|
||||||
private ColorPicker portletheadertext;
|
|
||||||
|
|
||||||
private ColorPicker portletbodynarrow;
|
|
||||||
|
|
||||||
RequestLocal prtlRL;
|
|
||||||
|
|
||||||
public CreateThemeForm() {
|
|
||||||
super("createthemeform");
|
super("createthemeform");
|
||||||
s_log.debug("CreateThemeForm constructed");
|
s_log.debug("CreateThemeForm constructed");
|
||||||
setClassAttr("themecreator");
|
setClassAttr("themecreator");
|
||||||
|
|
@ -299,7 +347,7 @@ public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
||||||
|
|
||||||
addProcessListener(this);
|
addProcessListener(this);
|
||||||
addInitListener(this);
|
addInitListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process(FormSectionEvent e) {
|
public void process(FormSectionEvent e) {
|
||||||
s_log.debug("processing the create theme form");
|
s_log.debug("processing the create theme form");
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -25,43 +29,44 @@ import com.arsdigita.portalworkspace.Workspace;
|
||||||
*/
|
*/
|
||||||
public abstract class WorkspaceSelectionModel {
|
public abstract class WorkspaceSelectionModel {
|
||||||
|
|
||||||
/** Workspace. Bound to the current HTTP request. */
|
/** Workspace. Bound to the current HTTP request. */
|
||||||
private RequestLocal m_workspace;
|
private RequestLocal m_workspace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
public WorkspaceSelectionModel() {
|
public WorkspaceSelectionModel() {
|
||||||
m_workspace = new RequestLocal() {
|
m_workspace = new RequestLocal() {
|
||||||
@Override
|
@Override
|
||||||
public Object initialValue(PageState state) {
|
public Object initialValue(PageState state) {
|
||||||
return getDefaultWorkspace(state);
|
return getDefaultWorkspace(state);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param state
|
* @param state
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected abstract Workspace getDefaultWorkspace(PageState state);
|
protected abstract Workspace getDefaultWorkspace(PageState state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param state
|
* @param state
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Workspace getSelectedWorkspace(PageState state) {
|
public Workspace getSelectedWorkspace(PageState state) {
|
||||||
return (Workspace) m_workspace.get(state);
|
return (Workspace) m_workspace.get(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param state
|
* @param state
|
||||||
* @param workspace
|
* @param workspace
|
||||||
*/
|
*/
|
||||||
public void setSelectedWorkspace(PageState state, Workspace workspace) {
|
public void setSelectedWorkspace(PageState state, Workspace workspace) {
|
||||||
m_workspace.set(state, workspace);
|
m_workspace.set(state, workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,68 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* This library is free software; you can redistribute it and/or
|
||||||
* License (the "License"); you may not use this file except in
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* compliance with the License. You may obtain a copy of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* This library is distributed in the hope that it will be useful,
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* implied. See the License for the specific language governing
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* rights and limitations under the License.
|
* 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.portalworkspace.ui;
|
package com.arsdigita.portalworkspace.ui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main (default) entry point into a standard portal workspace page where the
|
||||||
|
* page is constructed in"view" mode to present information to a visitor.
|
||||||
|
*
|
||||||
|
* It is used via a jsp page which is invoked at the applications url.
|
||||||
|
*
|
||||||
|
* Example code stub:
|
||||||
|
* <pre>
|
||||||
|
* <define:component name="view"
|
||||||
|
* classname="com.arsdigita.portalworkspace.ui.WorkspaceViewer" />
|
||||||
|
* <jsp:scriptlet>
|
||||||
|
* ((AbstractWorkspaceComponent) view).setWorkspaceModel(
|
||||||
|
* new DefaultWorkspaceSelectionModel());
|
||||||
|
* </jsp:scriptlet>
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* Currently there is a jsp for the default url at
|
||||||
|
* (web)/templates/ccm-portalworkspace/index.jsp which is mapped via web.xml
|
||||||
|
* to /ccm/portal/ in the default, pre-configured configuration.
|
||||||
|
*/
|
||||||
public class WorkspaceViewer extends AbstractWorkspaceComponent {
|
public class WorkspaceViewer extends AbstractWorkspaceComponent {
|
||||||
|
|
||||||
public WorkspaceViewer() {
|
/**
|
||||||
this(null);
|
* Default Constructor constructs a new, empty WorkspaceViewer
|
||||||
}
|
*/
|
||||||
|
public WorkspaceViewer() {
|
||||||
|
this(null);
|
||||||
|
}
|
||||||
|
|
||||||
public WorkspaceViewer(WorkspaceSelectionModel workspace) {
|
/**
|
||||||
super(workspace);
|
* Constructor instantiates a WorkspaceViewer for a specific workspace
|
||||||
}
|
* object and sets the xml tags accordingly.
|
||||||
|
*
|
||||||
|
* @param workspace
|
||||||
|
*/
|
||||||
|
public WorkspaceViewer(WorkspaceSelectionModel workspace) {
|
||||||
|
super(workspace);
|
||||||
|
}
|
||||||
|
|
||||||
protected PortalList createPortalList(PortalSelectionModel portal) {
|
protected PortalList createPortalList(PortalSelectionModel portal) {
|
||||||
return new PortalListViewer(portal);
|
return new PortalListViewer(portal);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PersistentPortal createPortalDisplay(PortalSelectionModel portal) {
|
protected PersistentPortal createPortalDisplay(PortalSelectionModel portal) {
|
||||||
return new PersistentPortal(portal, PortalConstants.MODE_DISPLAY);
|
return new PersistentPortal(portal, PortalConstants.MODE_DISPLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,13 @@
|
||||||
DispatcherHelper.cacheDisable(response);
|
DispatcherHelper.cacheDisable(response);
|
||||||
</jsp:scriptlet>
|
</jsp:scriptlet>
|
||||||
|
|
||||||
<define:page name="editWorkspace" application="portal" title="Workspace Customize" cache="true">
|
<define:page name="editWorkspace" application="portal"
|
||||||
<define:component name="edit" classname="com.arsdigita.portalworkspace.ui.WorkspaceEditor" />
|
title="Workspace Customize" cache="true">
|
||||||
|
<define:component name="edit"
|
||||||
|
classname="com.arsdigita.portalworkspace.ui.WorkspaceEditor" />
|
||||||
<jsp:scriptlet>
|
<jsp:scriptlet>
|
||||||
((AbstractWorkspaceComponent)edit).setWorkspaceModel(new DefaultWorkspaceSelectionModel());
|
((AbstractWorkspaceComponent)edit).setWorkspaceModel(
|
||||||
|
new DefaultWorkspaceSelectionModel());
|
||||||
</jsp:scriptlet>
|
</jsp:scriptlet>
|
||||||
</define:page>
|
</define:page>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue