Update Forum ergänzt, verschiedene Kleinigkeiten.

git-svn-id: https://svn.libreccm.org/ccm/trunk@806 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2011-03-28 18:52:52 +00:00
parent 1da79e6098
commit d15c09b82d
13 changed files with 235 additions and 107 deletions

View File

@ -43,11 +43,10 @@ import java.util.Iterator;
* Represents a group.
*
* @version 1.0
* @version $Id: Group.java 287 2005-02-22 00:29:02Z sskracic $
**/
public class Group extends Party {
public static final String versionId = "$Id: Group.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
private Collection m_roles = new ArrayList();
/**

View File

@ -62,6 +62,7 @@ public class ResourceType extends DomainObject {
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.kernel.ResourceType";
@Override
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
@ -336,13 +337,13 @@ public class ResourceType extends DomainObject {
static final Map s_configMap = Collections.synchronizedMap(new HashMap());
public static final void registerResourceTypeConfig
public static void registerResourceTypeConfig
(final String resourceObjectType,
final ResourceTypeConfig config) {
s_configMap.put(resourceObjectType, config);
}
public static final Iterator getConfigs() {
public static Iterator getConfigs() {
return s_configMap.entrySet().iterator();
}

View File

@ -102,68 +102,78 @@ public class Application extends Resource {
}
/**
* Create (new style / legacy free) application without parent, and without
* an associated container group
* Convenient class for creation of a new style / legacy free application
* just based on its type and title,
* without parent, no explicit URL fragment, no associated container group
*/
public static Application createRootApplication(final ApplicationType type,
final String title) {
return Application.createRootApplication(type, title, false);
return Application.createRootApplication(type, title, false);
}
/**
* Create (new style / legacy free) application without parent and with
* an associated container group
* Convenient class for creation of a new style / legacy free application
* just based on its type and title and whether to associate a container
* group,
* without parent and without an explicit URL fragment
*/
public static Application createRootApplication(final ApplicationType type,
final String title,
final boolean createContainerGroup) {
public static Application createRootApplication(
final ApplicationType type,
final String title,
final boolean createContainerGroup) {
if (Assert.isEnabled()) {
Assert.exists(type, ApplicationType.class);
Assert.exists(title, String.class);
Assert.isTrue(type.m_legacyFree);
}
return Application.make(type, null, title, null, createContainerGroup);
return Application.make(type, null, title, null, createContainerGroup);
}
/**
* Wrapper class to create a new application using a limited set of parameters,
* here: createContainerGroup is false.
*
* @param type
* @param fragment URL fragment of the application
* @param title
* @param parent parent Application
* @return
*/
public static Application createApplication(final ApplicationType type,
final String fragment,
final String title,
final Application parent) {
s_log.debug("Create Application");
return Application.createApplication(type,fragment,title,parent,false);
}
public static Application createApplication(final ApplicationType type,
final String fragment,
final String title,
final Application parent,
final boolean createContainerGroup) {
if (Assert.isEnabled()) {
Assert.exists(type, ApplicationType.class);
Assert.exists(fragment, String.class);
Assert.exists(title, String.class);
Assert.isTrue(!fragment.equals(""),
"The URL fragment must not be the empty string");
}
if (type.m_legacyFree) {
return Application.make(type,fragment,title,parent,createContainerGroup);
} else {
s_log.debug("Creating legacy compatible app");
return Application.legacyMake(type,fragment,title,parent,createContainerGroup);
}
s_log.debug("Create Application");
return Application.createApplication(type,fragment,title,parent,false);
}
// For convenience.
/**
*
* @param typeName
* @param fragment URL fragment of the application
* @param title
* @param parent
* @return
*/
public static Application createApplication(final String typeName,
final String fragment,
final String title,
final Application parent) {
return Application.createApplication(typeName,fragment,title,parent,false);
return Application.createApplication(typeName,fragment,title,parent,false);
}
/**
*
* @param typeName
* @param fragment
* @param title
* @param parent
* @param createContainerGroup
* @return
*/
public static Application createApplication(final String typeName,
final String fragment,
final String title,
@ -179,8 +189,44 @@ public class Application extends Resource {
title,parent,createContainerGroup);
}
/**
/**
* Prepares the actual creation of an application either as a legacy free or
* as a legacy compatible type, depending on the style of its applicationType.
* (A legacy compatible app creates the corresponding entries in deprecated
* kernel Package and Sitenode stuff as well, in parallel.)
*
* @param type application class (class name)
* @param fragment URL fragment og the application
* @param title
* @param parent parent application
* @param createContainerGroup
* @return
*/
public static Application createApplication(
final ApplicationType type,
final String fragment,
final String title,
final Application parent,
final boolean createContainerGroup) {
if (Assert.isEnabled()) {
Assert.exists(type, ApplicationType.class);
Assert.exists(fragment, String.class);
Assert.exists(title, String.class);
Assert.isTrue(!fragment.equals(""),
"The URL fragment must not be the empty string");
}
if (type.m_legacyFree) {
return Application.make(type,fragment,title,parent,createContainerGroup);
} else {
s_log.debug("Creating legacy compatible app");
return Application.legacyMake(type,fragment,title,parent,createContainerGroup);
}
}
/**
* Creates (makes) a legacy free application.
*
* @param type application type
* @param fragment last part of the applications URL
* @param title descriptive name
@ -217,7 +263,16 @@ public class Application extends Resource {
return app;
}
// Actually does the work.
/**
* Creates (makes) a legacy compatible application (using deprecated kernel
* packageType and sitenode stuff).
* @param type
* @param fragment
* @param title
* @param parent
* @param createContainerGroup
* @return
*/
private static Application legacyMake(final ApplicationType type,
final String fragment,
final String title,

View File

@ -122,7 +122,7 @@ public class ApplicationType extends ResourceType {
// (to be honest I can't remember the problem that was
// causing, but it did cause a problem in some
// circumstances)
// Method overwrtes a (overwritable) method provided by the super class to
// Method overwrites a (overwritable) method provided by the super class to
// process a created (empty) data object.
@Override
public void initialize() {

View File

@ -12,4 +12,7 @@
<version from="6.5.1" to="6.5.2">
<script class="com.arsdigita.forum.upgrade.CreateContainerGroups"/>
</version>
<version from="6.6.0" to="6.6.1">
<script sql="ccm-forum/upgrade/::database::-6.6.0-6.6.1.sql"/>
</version>
</upgrade>

View File

@ -21,7 +21,9 @@ package com.arsdigita.aplaws;
import org.apache.log4j.Logger;
/**
*
* Central entry point for the london APLAWS integration and configuration
* module.
* Provides just a handle into config file.
* @version "$Id: Aplaws.java 1297 2006-08-25 18:17:50Z apevec $
*/
public class Aplaws {

View File

@ -87,6 +87,7 @@ public class Initializer extends CompoundInitializer {
*
* @param e
*/
@Override
public void init(DomainInitEvent e) {
super.init(e);
@ -97,6 +98,7 @@ public class Initializer extends CompoundInitializer {
e.getFactory().registerInstantiator(
Workspace.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new Workspace(dataObject);
}
@ -105,6 +107,7 @@ public class Initializer extends CompoundInitializer {
e.getFactory().registerInstantiator(
WorkspacePage.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new WorkspacePage(dataObject);
}
@ -187,6 +190,7 @@ public class Initializer extends CompoundInitializer {
e.getFactory().registerInstantiator(
WorkspaceNavigatorPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new WorkspaceNavigatorPortlet(dataObject);
}
@ -195,6 +199,7 @@ public class Initializer extends CompoundInitializer {
e.getFactory().registerInstantiator(
WorkspaceSummaryPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new WorkspaceSummaryPortlet(dataObject);
}
@ -244,6 +249,7 @@ public class Initializer extends CompoundInitializer {
return config;
}
@Override
public ResourceConfigFormSection getModifyFormSection(
final RequestLocal application) {
final RSSFeedPortletEditorForm config =
@ -251,6 +257,7 @@ public class Initializer extends CompoundInitializer {
return config;
}
@Override
public ResourceConfigComponent getCreateComponent(
final ResourceType resType,
final RequestLocal parentAppRL) {
@ -268,6 +275,7 @@ public class Initializer extends CompoundInitializer {
};
new ResourceTypeConfig(FreeformHTMLPortlet.BASE_DATA_OBJECT_TYPE) {
@Override
public ResourceConfigFormSection getCreateFormSection(
final ResourceType resType,
final RequestLocal parentAppRL) {
@ -276,6 +284,7 @@ public class Initializer extends CompoundInitializer {
return config;
}
@Override
public ResourceConfigFormSection getModifyFormSection(
final RequestLocal application) {
final FreeformHTMLPortletEditor config =

View File

@ -114,6 +114,7 @@ public class Loader extends PackageLoader {
*/
private void createApplication(String url, Boolean isPublic, String title) {
// First create an application type for portal Workspace
ApplicationType type = setupWorkspaceType();
if (url != null) {
@ -151,6 +152,9 @@ public class Loader extends PackageLoader {
*
* No localization here because it is an invariant configuration.
*
* Creates an entry in table application_types and a corresponding entry in
* apm_package_types
*
* @return
*/
private ApplicationType setupWorkspaceType() {
@ -165,7 +169,10 @@ public class Loader extends PackageLoader {
}
/**
* Setup WorkspacePage type.
*
* Creates an entry for class (=type) c.ad.ldn.portal.WorkspacePage in
* table application_types, but not in apm_package_types.
* @return
*/
private ResourceType setupWorkspacePageType() {

View File

@ -53,21 +53,17 @@ import java.util.Iterator;
import java.util.LinkedList;
/**
* Workspace domain class, a workspace represents an area containing 0...n portals
* each arranged as a pane of page. Each portal (or pane) manages a number of portlets.
*
* Workspace domain class.
* A workspace represents an area containing 0...n portals each arranged
* as a pane of page. Each portal (or pane) manages a number of portlets.
*
*/
public class Workspace extends Application {
/** Private logger instance for debugging purpose */
private static final Logger s_log = Logger.getLogger(Workspace.class);
private static final WorkspaceConfig s_config = new WorkspaceConfig();
static {
s_log.debug("Static initalizer starting...");
s_config.load();
s_log.debug("Static initalizer finished.");
}
private static final WorkspaceConfig s_config = WorkspaceConfig.getConfig();
public static WorkspaceConfig getConfig() {
return s_config;
@ -78,6 +74,7 @@ public class Workspace extends Application {
public static final String PARTY_ID = PARTY + "." + ACSObject.ID;
public static final String DEFAULT_LAYOUT = "defaultLayout";
public static final String PAGES = "pages";
/**
* store this as a static variable as it cannot change during the lifetime
* of the ccm service
@ -115,12 +112,15 @@ public class Workspace extends Application {
}
/**
* Wrapper class to handle a limited set of parameters,
* Wrapper class to create a new workspace using a limited set of parameters,
* here: page layout is set to default layout.
*
* NOTE: Parameter isPublic may be a misnomer, the actual usage of it in the
* process of application creation uses it as createGroupContainer
*
* @param url
* @param title
* @param parent
* @param parent parent application
* @param isPublic
* @return
*/
@ -131,6 +131,8 @@ public class Workspace extends Application {
}
/**
* Wrapper class to create a new workspace using a limited set of parameters,
* here: page layout is set to default layout.
*
* @param url
* @param title
@ -146,12 +148,15 @@ public class Workspace extends Application {
/**
* Does the real work to create a workspace in the storage (db)
*
* NOTE: Parameter isPublic may be a misnomer, the actual usage of it in the
* process of application creation uses it as createGroupContainer
*
* @param url
* @param title
* @param layout
* @param parent
* @param isPublic
* @param isPublic whether to create a workspace group
* @return
*/
public static Workspace createWorkspace(String url, String title,
@ -198,8 +203,7 @@ 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
* site.
*
@ -207,7 +211,7 @@ public class Workspace extends Application {
* case, ccm-ldn-portal hasn't been loaded and so I don't know how you are
* invoking this method!)
*
* @return
* @return default workspace instance (created during load)
*/
public static Workspace getDefaultHomepageWorkspace() {

View File

@ -34,59 +34,83 @@ import org.apache.log4j.Logger;
public class WorkspaceConfig extends AbstractConfig {
/** A logger instance. */
private static final Logger s_log = Logger.getLogger(WorkspaceConfig.class);
private ResourceParameter m_adapters;
/** Singelton config object. */
private static WorkspaceConfig s_conf;
private StringParameter m_defaultLayout;
/**
* Gain a WorkspaceConfig object.
*
* Singelton pattern, don't instantiate a config object using the
* constructor directly!
* @return
*/
public static synchronized WorkspaceConfig getConfig() {
if (s_conf == null) {
s_conf = new WorkspaceConfig();
s_conf.load();
}
private BooleanParameter m_createUserWorkspaces;
return s_conf;
}
private Parameter m_excludedPortletTypes;
private Parameter m_adminPortletTypes;
// set of configuration parameters
/** File with rules for configuring information in generated XML */
private final Parameter m_adapters =
new ResourceParameter(
"com.arsdigita.london.portal.traversal_adapters",
Parameter.REQUIRED,
"/WEB-INF/resources/portal-adapters.xml");
private BooleanParameter m_htmlPortletWysiwygEditor;
/** Default column layout for workspace portals */
private final Parameter m_defaultLayout =
new StringParameter(
"com.arsdigita.london.portal.default_layout",
Parameter.REQUIRED, PageLayout.FORMAT_THREE_COLUMNS);
private StringParameter m_workspacePartyPrivilege;
/** Whether non-admin users should have their own custom workspaces */
private final Parameter m_createUserWorkspaces =
new BooleanParameter(
"com.arsdigita.portal.create_user_workspaces",
Parameter.REQUIRED, Boolean.TRUE);
private BooleanParameter m_checkWorkspaceReadPermissions;
/** Types not to be included in the drop down list of portlets to add to a page*/
private final Parameter m_excludedPortletTypes =
new StringArrayParameter(
"com.arsdigita.london.portal.excluded_portlet_types",
Parameter.OPTIONAL, new String[0]);
/** Types only available to administrator of homepage, or subsite frontpage*/
private final Parameter m_adminPortletTypes =
new StringArrayParameter(
"com.arsdigita.london.portal.admin_only_portlet_types",
Parameter.OPTIONAL, new String[0]);
/** Whether to use editor specified by waf.bebop.dhtml_editor for editing
freeform html portlet*/
private final Parameter m_htmlPortletWysiwygEditor =
new BooleanParameter(
"com.arsdigita.london.portal.portlet.freeform_html_editor",
Parameter.REQUIRED, Boolean.FALSE);
/** Which privilege ("read" or "edit") is granted to the workspace party. */
private final Parameter m_workspacePartyPrivilege =
new StringParameter(
"com.arsdigita.london.portal.workspacePartyPrivilege",
Parameter.OPTIONAL, "read");
/** Whether READ permissions will be checked when viewing workspaces.
By default we don't, which is odd. */
private final Parameter m_checkWorkspaceReadPermissions =
new BooleanParameter(
"com.arsdigita.london.portal.checkWorkspaceReadPermissions",
Parameter.OPTIONAL, Boolean.FALSE);
public WorkspaceConfig() {
m_adapters = new ResourceParameter(
"com.arsdigita.london.portal.traversal_adapters",
Parameter.REQUIRED,
"/WEB-INF/resources/portal-adapters.xml");
m_defaultLayout = new StringParameter(
"com.arsdigita.london.portal.default_layout",
Parameter.REQUIRED, PageLayout.FORMAT_THREE_COLUMNS);
m_createUserWorkspaces = new BooleanParameter(
"com.arsdigita.portal.create_user_workspaces",
Parameter.REQUIRED, Boolean.TRUE);
m_excludedPortletTypes = new StringArrayParameter(
"com.arsdigita.london.portal.excluded_portlet_types",
Parameter.OPTIONAL, new String[0]);
m_adminPortletTypes = new StringArrayParameter(
"com.arsdigita.london.portal.admin_only_portlet_types",
Parameter.OPTIONAL, new String[0]);
m_htmlPortletWysiwygEditor = new BooleanParameter(
"com.arsdigita.london.portal.portlet.freeform_html.wysiwyg_editor",
Parameter.REQUIRED, Boolean.FALSE);
m_workspacePartyPrivilege = new StringParameter(
"com.arsdigita.london.portal.workspacePartyPrivilege",
Parameter.OPTIONAL, "read");
m_checkWorkspaceReadPermissions = new BooleanParameter(
"com.arsdigita.london.portal.checkWorkspaceReadPermissions",
Parameter.OPTIONAL, Boolean.FALSE);
register(m_adapters);
register(m_defaultLayout);
register(m_createUserWorkspaces);

View File

@ -23,10 +23,10 @@ com.arsdigita.london.portal.admin_only_portlet_types.purpose=Only available to a
com.arsdigita.london.portal.admin_only_portlet_types.format=[string,string,string]
com.arsdigita.london.portal.admin_only_portlet_types.example=com.arsdigita.london.portal.portlet.ApplicationDirectoryPortlet,com.arsdigita.london.portal.portlet.TimeOfDayPortlet
com.arsdigita.london.portal.portlet.freeform_html.wysiwyg_editor.title=use wysiwyg editor for freeform html portlet
com.arsdigita.london.portal.portlet.freeform_html.wysiwyg_editor.purpose=If true, use editor specified by waf.bebop.dhtml_editor when user edits freeform html portlet
com.arsdigita.london.portal.portlet.freeform_html.wysiwyg_editor.format=[boolean]
com.arsdigita.london.portal.portlet.freeform_html.wysiwyg_editor.example=false
com.arsdigita.london.portal.portlet.freeform_html_editor.title=use wysiwyg editor for freeform html portlet
com.arsdigita.london.portal.portlet.freeform_html_editor.purpose=If true, use editor specified by waf.bebop.dhtml_editor when user edits freeform html portlet
com.arsdigita.london.portal.portlet.freeform_html_editor.format=[boolean]
com.arsdigita.london.portal.portlet.freeform_html_editor.example=false
com.arsdigita.london.portal.workspacePartyPrivilege.title=Privilege granted to the workspace party
com.arsdigita.london.portal.workspacePartyPrivilege.purpose=Specify which privilege is granted to the workspace party. Should be "read" or "edit".

View File

@ -19,25 +19,49 @@ import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.london.portal.Workspace;
/**
*
*
*/
public abstract class WorkspaceSelectionModel {
private RequestLocal m_workspace;
/** Workspace. Bound to the current HTTP request. */
private RequestLocal m_workspace;
public WorkspaceSelectionModel() {
/**
* Constructor.
*/
public WorkspaceSelectionModel() {
m_workspace = new RequestLocal() {
@Override
public Object initialValue(PageState state) {
return getDefaultWorkspace(state);
}
};
}
protected abstract Workspace getDefaultWorkspace(PageState state);
/**
*
* @param state
* @return
*/
protected abstract Workspace getDefaultWorkspace(PageState state);
public Workspace getSelectedWorkspace(PageState state) {
/**
*
* @param state
* @return
*/
public Workspace getSelectedWorkspace(PageState state) {
return (Workspace) m_workspace.get(state);
}
public void setSelectedWorkspace(PageState state, Workspace workspace) {
/**
*
* @param state
* @param workspace
*/
public void setSelectedWorkspace(PageState state, Workspace workspace) {
m_workspace.set(state, workspace);
}
}

View File

@ -29,7 +29,7 @@ import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.SessionManager;
/**
* Attempts to create new term in the proper terms domain
* Attempts to create new term in the proper terms domain
* whenever a new category is created through CMS interface.
*/
public class TermCategoryListener implements CategoryListener {