PortalWorkspaces können jetzt über /ccm/admin angelegt werden.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2286 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2013-08-02 13:01:03 +00:00
parent 6bf4288e69
commit bd835ca5fc
12 changed files with 218 additions and 191 deletions

View File

@ -130,3 +130,4 @@ ui.admin.applications.ApplicationInfoSection.desc.label=Description
ui.admin.applications.no_settings=This application has no settings (yet).
ui.admin.applications.form_not_compatible_now=This application administration form is not yet compatible with this application pane. Please use the applications own administration form.
ui.admin.applications.ApplicationInstancePane.manage.heading=Instance specific settings
ui.admin.applications.parent.label=Select parent application

View File

@ -130,3 +130,4 @@ ui.admin.applications.ApplicationInfoSection.desc.label=Beschreibung
ui.admin.applications.no_settings=Diese Applikation hat (noch) keine Einstellungen.
ui.admin.applications.form_not_compatible_now=Das Formular zur Verwaltung dieser Application ist derzeit noch nicht kompatibel mit dieser Administrationsoberfl\u00e4che. Bitte nutzen Sie den Administrationsoberfl\u00e4che der Application.
ui.admin.applications.ApplicationInstancePane.manage.heading=Einstellungen der Instanz
ui.admin.applications.parent.label=W\u00e4hlen Sie die \u00fcbergeordnete Applikation

View File

@ -130,3 +130,4 @@ ui.admin.applications.ApplicationInfoSection.desc.label=
ui.admin.applications.no_settings=
ui.admin.applications.form_not_compatible_now=
ui.admin.applications.ApplicationInstancePane.manage.heading=
ui.admin.applications.parent.label=

View File

@ -116,3 +116,4 @@ ui.admin.applications.ApplicationInfoSection.desc.label=
ui.admin.applications.no_settings=
ui.admin.applications.form_not_compatible_now=
ui.admin.applications.ApplicationInstancePane.manage.heading=
ui.admin.applications.parent.label=

View File

@ -18,6 +18,9 @@
*/
package com.arsdigita.ui.admin.applications;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Container;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
@ -46,22 +49,25 @@ import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationCollection;
import com.arsdigita.web.ApplicationType;
import java.util.ArrayList;
import java.util.List;
import java.util.TooManyListenersException;
/**
* Basic form for creating new Application instances. Should be suitable for
* most applications types. If you have special needs... $todo
* Basic form for creating new Application instances. Should be suitable for most applications types. If you have
* special needs... $todo
*
* This form does not support parent/child application structures. If
* your app needs this, add a widget for selecting the parent application
* and extend the process method.
* This form does not support parent/child application structures. If your app needs this, add a widget for selecting
* the parent application and extend the process method.
*
* @param <T> Type of application
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class ApplicationCreateForm<T extends Application> extends Form {
public class ApplicationCreateForm<T extends Application> extends Form implements FormSubmissionListener,
FormValidationListener,
FormProcessListener {
public static final String FORM_NAME = "ApplicationCreateForm";
private static final String PARENT_APP = "parentAll";
@ -74,6 +80,7 @@ public class ApplicationCreateForm<T extends Application> extends Form {
private final TextField applicationUrl;
private final TextField applicationTitle;
private final TextArea applicationDesc;
private final Container widgetSection;
private final SaveCancelSection saveCancelSection;
public ApplicationCreateForm(final Class<T> appClass, final boolean allowRoot) {
@ -95,6 +102,9 @@ public class ApplicationCreateForm<T extends Application> extends Form {
applicationType = (ApplicationType) DomainObjectFactory.newInstance(appTypes.getDataObject());
appTypes.close();
widgetSection = new BoxPanel(BoxPanel.VERTICAL);
add(widgetSection);
parentApp = new SingleSelect(PARENT_APP);
try {
parentApp.addPrintListener(new PrintListener() {
@ -103,12 +113,12 @@ public class ApplicationCreateForm<T extends Application> extends Form {
target.addOption(new Option("", ""));
final ApplicationCollection applications = Application.retrieveAllApplications();
applications.addOrder(Application.PRIMARY_URL);
while (applications.next()) {
target.addOption(new Option(applications.getApplication().getPath(),
applications.getApplication().getPath()));
}
}
});
if (!allowRoot) {
@ -140,52 +150,51 @@ public class ApplicationCreateForm<T extends Application> extends Form {
applicationDesc.addValidationListener(new StringInRangeValidationListener(0, 4000, GlobalizationUtil.globalize(
"ui.admin.applications.desc.valiation.minmaxlength")));
add(new Label(GlobalizationUtil.globalize("ui.admin.applications.parent.label")));
add(parentApp);
add(new Label(GlobalizationUtil.globalize("ui.admin.applications.url.label")));
add(applicationUrl);
add(new Label(GlobalizationUtil.globalize("ui.admin.applications.title.label")));
add(applicationTitle);
add(new Label(GlobalizationUtil.globalize("ui.admin.applications.desc.label")));
add(applicationDesc);
widgetSection.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.parent.label")));
widgetSection.add(parentApp);
widgetSection.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.url.label")));
widgetSection.add(applicationUrl);
widgetSection.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.title.label")));
widgetSection.add(applicationTitle);
widgetSection.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.desc.label")));
widgetSection.add(applicationDesc);
saveCancelSection = new SaveCancelSection();
add(saveCancelSection);
addValidationListener(new ValidationListener());
addSubmissionListener(new SubmissionListener());
addProcessListener(new ProcessListener());
addValidationListener(this);
addSubmissionListener(this);
addProcessListener(this);
}
protected Container getWidgetSection() {
return widgetSection;
}
public String getAppClassName() {
return appClassName;
}
private class SubmissionListener implements FormSubmissionListener {
public void submitted(final FormSectionEvent event) throws FormProcessException {
final PageState state = event.getPageState();
if (saveCancelSection.getCancelButton().isSelected(state)) {
parentApp.setValue(state, "");
applicationTitle.setValue(state, "");
applicationUrl.setValue(state, "");
applicationDesc.setValue(state, "");
throw new FormProcessException("Canceled");
}
protected SingleSelect getParentApp() {
return parentApp;
}
protected TextField getApplicationUrl() {
return applicationUrl;
}
private class ProcessListener implements FormProcessListener {
protected TextField getApplicationTitle() {
return applicationTitle;
}
protected TextArea getApplicationDesc() {
return applicationDesc;
}
protected SaveCancelSection getSaveCancelSection() {
return saveCancelSection;
}
/**
* Creates a new application instance using the provided data.
*
* @param event
* @throws FormProcessException
*/
public void process(final FormSectionEvent event) throws FormProcessException {
final PageState state = event.getPageState();
@ -194,7 +203,7 @@ public class ApplicationCreateForm<T extends Application> extends Form {
boolean createContainerGroup;
final String parentPath = (String) parentApp.getValue(state);
if ((parentPath == null) && parentPath.isEmpty()) {
if ((parentPath == null) || parentPath.isEmpty()) {
parent = null;
createContainerGroup = false;
} else {
@ -220,9 +229,18 @@ public class ApplicationCreateForm<T extends Application> extends Form {
}
}
}
public void submitted(final FormSectionEvent event) throws FormProcessException {
final PageState state = event.getPageState();
private class ValidationListener implements FormValidationListener {
if (saveCancelSection.getCancelButton().isSelected(state)) {
parentApp.setValue(state, "");
applicationTitle.setValue(state, "");
applicationUrl.setValue(state, "");
applicationDesc.setValue(state, "");
throw new FormProcessException("Canceled");
}
}
public void validate(final FormSectionEvent event) throws FormProcessException {
final PageState state = event.getPageState();
@ -239,6 +257,4 @@ public class ApplicationCreateForm<T extends Application> extends Form {
"ui.admin.applications.url.validation.url_already_in_use").localize());
}
}
}
}

View File

@ -40,7 +40,8 @@ public class ForumApplicationManager extends AbstractApplicationManager<Forum> {
final BoxPanel panel = new BoxPanel();
panel.add(
new Label(new GlobalizedMessage("forum.ui.admin.no_settings", "com.arsdigita.forum.ui.ForumResources")));
new Label(new GlobalizedMessage("forum.ui.admin.no_settings",
"com.arsdigita.forum.ui.ForumResources")));
container.add(panel);
@ -50,5 +51,4 @@ public class ForumApplicationManager extends AbstractApplicationManager<Forum> {
public boolean allowRoot() {
return false;
}
}

View File

@ -49,6 +49,7 @@ import com.arsdigita.runtime.CompoundInitializer;
import com.arsdigita.runtime.DomainInitEvent;
import com.arsdigita.runtime.PDLInitializer;
import com.arsdigita.runtime.RuntimeConfig;
import com.arsdigita.ui.admin.ApplicationManagers;
import com.arsdigita.xml.XML;
@ -270,5 +271,8 @@ public class Initializer extends CompoundInitializer {
// now moved to navigation ??
// ApplicationNavigationModel.register(Workspace.class.getName(),
// new DefaultNavigationModel());
//Register application manager used for creating the admin form in /ccm/admin
ApplicationManagers.register(new WorkspaceApplicationManager());
}
}

View File

@ -15,7 +15,6 @@
* 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;
import com.arsdigita.domain.DataObjectNotFoundException;
@ -56,44 +55,47 @@ import java.util.LinkedList;
import org.apache.log4j.Logger;
/**
* Class <b>Workspace</b> is the main domain class (extending Application)
* for the portalworkspace module.
* Class <b>Workspace</b> is the main domain class (extending Application) for the portalworkspace module.
*
* 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.
* 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 {
/** Private logger instance for debugging purpose */
/**
* Private logger instance for debugging purpose
*/
private static final Logger s_log = Logger.getLogger(Workspace.class);
/** Config object containing various parameter */
/**
* Config object containing various parameter
*/
private static final WorkspaceConfig s_config = WorkspaceConfig.getConfig();
/** Service method to provide client classes access to configuration. */
/**
* Service method to provide client classes access to configuration.
*/
public static WorkspaceConfig getConfig() {
return s_config;
}
/** PDL stuff */
/**
* PDL stuff
*/
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.portalworkspace.Workspace";
public static final String PARTY = "party";
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
* store this as a static variable as it cannot change during the lifetime of the ccm service
*/
private static Workspace defaultHomepageWorkspace = null;
/**
* Constructor retrieves the domain object using its DataObject representation
*
* @param obj
*/
public Workspace(DataObject obj) {
@ -102,6 +104,7 @@ public class Workspace extends Application {
/**
* Constructor, retrieves the workspace from database using its OID
*
* @param oid
* @throws com.arsdigita.domain.DataObjectNotFoundException
*/
@ -112,18 +115,16 @@ public class Workspace extends Application {
/*
* public String getContextPath() { return "ccm-portalworkspace"; }
*/
/**
* Returns the path name of the location of the applications servlet/JSP.
*
* The method overwrites the super class to provide an application specific
* location for servlets/JSP. This is necessary if you whish to install the
* module (application) along with others in one context. If you install the
* module into its own context (no longer recommended for versions newer
* than 1.0.4) you may use a standard location.
* The method overwrites the super class to provide an application specific location for servlets/JSP. This is
* necessary if you whish to install the module (application) along with others in one context. If you install the
* module into its own context (no longer recommended for versions newer than 1.0.4) you may use a standard
* location.
*
* Usually it is a symbolic name/path, which will be mapped in the web.xml
* to the real location in the file system. Example:
* Usually it is a symbolic name/path, which will be mapped in the web.xml to the real location in the file system.
* Example:
* <servlet>
* <servlet-name>portalworkspace-files</servlet-name>
* <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>
@ -139,8 +140,7 @@ public class Workspace extends Application {
* </servlet-mapping>
*
* @return path name to the applications servlet/JSP
* @return ServletPath (constant) probably should be synchron with web.xml
* entry
* @return ServletPath (constant) probably should be synchron with web.xml entry
*/
@Override
public String getServletPath() {
@ -149,11 +149,11 @@ 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.
* 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
* 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
@ -168,8 +168,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.
* 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
@ -184,11 +184,10 @@ public class Workspace extends Application {
}
/**
* Does the real work to create a workspace as a legacy compatible
* applicationin the storage (db)
* Does the real work to create a workspace as a legacy compatible applicationin 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
* 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
@ -208,23 +207,22 @@ public class Workspace extends Application {
}
Workspace workspace = (Workspace) Application.createApplication(
BASE_DATA_OBJECT_TYPE, url, title, parent);
BASE_DATA_OBJECT_TYPE, url, title, parent, true);
workspace.setupGroups(title, isPublic);
workspace.setDefaultLayout(layout);
return workspace;
}
/**
* Does the real work to create a workspace instance as a
* legacy free application in the storage (db)
* Does the real work to create a workspace instance as a legacy free application in the storage (db)
*
*
* @param url of the application (last part, its "name")
* @param title the application to be created
* @param layout layout to use for this instance
* @param parent, url of the parent part if any, null otherwise
* @param isPublic whether the group that will be created for this instance
* should be created with the public user as a member
* @param isPublic whether the group that will be created for this instance should be created with the public user
* as a member
* @return
*/
public static Workspace createWorkspace(ApplicationType type,
@ -240,7 +238,9 @@ public class Workspace extends Application {
+ "and public access is: " + isPublic);
}
if (layout==null) layout = PageLayout.getDefaultLayout();
if (layout == null) {
layout = PageLayout.getDefaultLayout();
}
/* A container group is always created fo a portal workspace instance. */
// MODIFIED
@ -279,13 +279,11 @@ public class Workspace extends Application {
}
/**
* Retrieve the workspace that is created during loading of the
* ccm-portalworkspace application and is set as the defaultworkspace
* for the site.
* Retrieve the workspace that is created during loading of the ccm-portalworkspace application and is set as the
* defaultworkspace for the site.
*
* Returns null if there are no workspaces (though presumably if that is the
* case, ccm-portalworkspace hasn't been loaded and so I don't know how you
* are invoking this method!)
* Returns null if there are no workspaces (though presumably if that is the case, ccm-portalworkspace hasn't been
* loaded and so I don't know how you are invoking this method!)
*
* @return default workspace instance (created during load)
*/
@ -556,7 +554,9 @@ public class Workspace extends Application {
group.save();
}
/** Participants are the members of the Party group. */
/**
* Participants are the members of the Party group.
*/
public PartyCollection getParticipants() {
Party party = getParty();
@ -580,17 +580,14 @@ public class Workspace extends Application {
}
/**
* <p>Get a list of all the distinct "initials" of participants in
* a Portal Site.</p>
* <p>Get a list of all the distinct "initials" of participants in a Portal Site.</p>
*
* <p>A participant's initial is defined as the first letter of
* their family name when the participant is a user (i.e. a
* person), and the first letter of the group name if the
* participant is a group.</p>
* <p>A participant's initial is defined as the first letter of their family name when the participant is a user
* (i.e. a person), and the first letter of the group name if the participant is a group.</p>
*
* <p>The returned Iterator contains the initials in increasing
* alphabetical order.</p>
**/
* <p>The returned Iterator contains the initials in increasing alphabetical order.</p>
*
*/
public Iterator getParticipantInitials() {
DataQuery query = SessionManager.getSession().retrieveQuery(
"com.arsdigita.portalworkspace.WorkspaceParticipantInitials");
@ -605,13 +602,12 @@ public class Workspace extends Application {
}
/**
* <p>Get a collection of all participants in the Workspace whose
* initial (see {@link getParticipantInitials
* getParticipantInitials} for a definition of a participant's
* initial) is the specified value.</p>
* <p>Get a collection of all participants in the Workspace whose initial (see {@link getParticipantInitials
* getParticipantInitials} for a definition of a participant's initial) is the specified value.</p>
*
* @param initial Single-character string, must be uppercase
**/
*
*/
public PartyCollection getParticipantsWithInitial(String initial) {
Assert.exists(initial);
Assert.isTrue(initial.length() == 1, "Initial needs length 1");
@ -811,7 +807,6 @@ public class Workspace extends Application {
group.addMember(owner);
workspace.setOwner(owner);
new KernelExcursion() {
public void excurse() {
setEffectiveParty(Kernel.getSystemParty());
PermissionDescriptor pd = new PermissionDescriptor(

View File

@ -28,3 +28,5 @@ cw.workspace.ui.select_user_or_group_to_add=Select user or group to add:
cw.permissions.add_a_privilege=Add a privilege
cw.workspace.ui.participant_info=Participant Info
cw.workspace.ui.participant_roles=Participant Roles
cw.workspace.ui.admin.no_settings=No settings yet
cw.workspace.default_layout=Layout

View File

@ -28,3 +28,5 @@ cw.workspace.ui.select_user_or_group_to_add=Select user or group to add:
cw.permissions.add_a_privilege=Add a privilege
cw.workspace.ui.participant_info=Participant Info
cw.workspace.ui.participant_roles=Participant Roles
cw.workspace.ui.admin.no_settings=Noch keine Einstellungen
cw.workspace.default_layout=Layout

View File

@ -28,3 +28,5 @@ cw.workspace.ui.select_user_or_group_to_add=Select user or group to add:
cw.permissions.add_a_privilege=Add a privilege
cw.workspace.ui.participant_info=Participant Info
cw.workspace.ui.participant_roles=Participant Roles
cw.workspace.ui.admin.no_settings=
cw.workspace.default_layout=

View File

@ -28,3 +28,5 @@ cw.workspace.ui.select_user_or_group_to_add=Select user or group to add:
cw.permissions.add_a_privilege=Add a privilege
cw.workspace.ui.participant_info=Participant Info
cw.workspace.ui.participant_roles=Participant Roles
cw.workspace.ui.admin.no_settings=
cw.workspace.default_layout=