Grid viewer for Portal Workspace
git-svn-id: https://svn.libreccm.org/ccm/trunk@2925 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
eb56a010ba
commit
c559329701
|
|
@ -5,7 +5,7 @@ insert into pw_workspace_page_layouts (layout_id, title, description, format)
|
|||
values (nextval('acs_object_id_seq'), '2 Column', 'Two columns, equal size', '50%,50%');
|
||||
|
||||
insert into pw_workspace_page_layouts (layout_id, title, description, format)
|
||||
values (nextval('acs_object_id_seq'), '3 Column', 'Three columns, equal size', '30%,40%,30%');
|
||||
values (nextval('acs_object_id_seq'), '3 Column', 'Three columns, equal size', '33.33%,33.33%,33.33%');
|
||||
|
||||
insert into pw_workspace_page_layouts (layout_id, title, description, format)
|
||||
values (nextval('acs_object_id_seq'), '4 Column', 'Four columns, equal size', '25%,25%,25%,25%');
|
||||
|
|
|
|||
|
|
@ -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.kernel.Kernel;
|
||||
|
|
@ -40,16 +39,15 @@ import com.arsdigita.web.ApplicationType;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Executes nonrecurring at install time and loads (and configures ) a default
|
||||
* workspace instance (i.e. instance of ccm-portalworkspace) in a default
|
||||
* configuration.
|
||||
* Executes nonrecurring at install time and loads (and configures ) a default workspace instance
|
||||
* (i.e. instance of ccm-portalworkspace) in a default configuration.
|
||||
*
|
||||
* Configuration can be modified by configuration parameters before processing,
|
||||
* otherwise hardcoded default values take effect. A set of portlets, part of
|
||||
* the ccm-ldn-portal package, are loaded as well, so they are statically available.
|
||||
* Configuration can be modified by configuration parameters before processing, otherwise hardcoded
|
||||
* default values take effect. A set of portlets, part of the ccm-ldn-portal package, are loaded as
|
||||
* well, so they are statically available.
|
||||
*
|
||||
* After processing the installation values can not be modified anymore without
|
||||
* a fresh installation of the whole system.
|
||||
* After processing the installation values can not be modified anymore without a fresh installation
|
||||
* of the whole system.
|
||||
*
|
||||
* @author Justin Ross <jross@redhat.com>
|
||||
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
|
||||
|
|
@ -57,35 +55,36 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class Loader extends PackageLoader {
|
||||
|
||||
/** Private Logger instance for debugging purpose. */
|
||||
/**
|
||||
* Private Logger instance for debugging purpose.
|
||||
*/
|
||||
private static final Logger s_log = Logger.getLogger(Loader.class);
|
||||
|
||||
private StringParameter m_url = new StringParameter(
|
||||
"com.arsdigita.portalworkspace.default_url",
|
||||
Parameter.REQUIRED,
|
||||
"/portal/");
|
||||
"com.arsdigita.portalworkspace.default_url",
|
||||
Parameter.REQUIRED,
|
||||
"/portal/");
|
||||
|
||||
private StringParameter m_title = new StringParameter(
|
||||
"com.arsdigita.portalworkspace.default_title",
|
||||
Parameter.REQUIRED,
|
||||
"Portal Homepage");
|
||||
"com.arsdigita.portalworkspace.default_title",
|
||||
Parameter.REQUIRED,
|
||||
"Portal Homepage");
|
||||
|
||||
/**
|
||||
* If true the group created for the instance of portal workspace will
|
||||
* contain the public user as a member.
|
||||
* NOTE: Current implementation actually doesn't check for access permission!
|
||||
* If true the group created for the instance of portal workspace will contain the public user
|
||||
* as a member. NOTE: Current implementation actually doesn't check for access permission!
|
||||
*/
|
||||
private BooleanParameter m_isPublic = new BooleanParameter(
|
||||
"com.arsdigita.portalworkspace.default_is_public",
|
||||
Parameter.REQUIRED, Boolean.TRUE);
|
||||
"com.arsdigita.portalworkspace.default_is_public",
|
||||
Parameter.REQUIRED, Boolean.TRUE);
|
||||
|
||||
/**
|
||||
* Standard constructor loads/registers the configuration parameter.
|
||||
*/
|
||||
public Loader() {
|
||||
register(m_isPublic);
|
||||
register(m_url);
|
||||
register(m_title);
|
||||
register(m_isPublic);
|
||||
register(m_url);
|
||||
register(m_title);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -96,6 +95,7 @@ public class Loader extends PackageLoader {
|
|||
public void run(final ScriptContext ctx) {
|
||||
|
||||
new KernelExcursion() {
|
||||
|
||||
public void excurse() {
|
||||
setEffectiveParty(Kernel.getSystemParty());
|
||||
|
||||
|
|
@ -111,17 +111,17 @@ public class Loader extends PackageLoader {
|
|||
loadRSSFeedPortlet();
|
||||
// loadTimeOfDayPortlet();
|
||||
}
|
||||
|
||||
}.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares creation of application type by checking proper formatting of
|
||||
* applications url and determining whether a parent is specified as part
|
||||
* of the url.
|
||||
* Prepares creation of application type by checking proper formatting of applications url and
|
||||
* determining whether a parent is specified as part of the url.
|
||||
*
|
||||
* @param url Sting containing the full url (including parents url in any
|
||||
* @param isPublic if true the group created for this instance will include
|
||||
* the public user as a member
|
||||
* @param url Sting containing the full url (including parents url in any
|
||||
* @param isPublic if true the group created for this instance will include the public user as a
|
||||
* member
|
||||
* @param title
|
||||
*/
|
||||
private void createApplication(String url, Boolean isPublic, String title) {
|
||||
|
|
@ -137,8 +137,8 @@ public class Loader extends PackageLoader {
|
|||
Assert.isTrue(url.endsWith("/"), "url ends not with /");
|
||||
Assert.isTrue(!url.equals("/"), "url is just /");
|
||||
|
||||
int last = url.lastIndexOf("/" // last = 0 is leading slash
|
||||
,url.length() - 2);// trailing slash excluded
|
||||
int last = url.lastIndexOf("/" // last = 0 is leading slash
|
||||
, url.length() - 2);// trailing slash excluded
|
||||
s_log.debug("last slash at " + last); // last > 0 : multipe elements
|
||||
|
||||
Application parent = null;
|
||||
|
|
@ -156,7 +156,8 @@ public class Loader extends PackageLoader {
|
|||
|
||||
// set up the portal workspace default node (instance)
|
||||
Workspace workspace = Workspace.createWorkspace(type, name, title,
|
||||
null, parent, Boolean.TRUE.equals(isPublic));
|
||||
null, parent, Boolean.TRUE.equals(
|
||||
isPublic));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -170,8 +171,8 @@ public class Loader extends PackageLoader {
|
|||
*/
|
||||
private ApplicationType setupWorkspaceType() {
|
||||
|
||||
s_log.debug("Creating an application type for portal workspace. " +
|
||||
"Base Data Object Type: " + Workspace.BASE_DATA_OBJECT_TYPE);
|
||||
s_log.debug("Creating an application type for portal workspace. "
|
||||
+ "Base Data Object Type: " + Workspace.BASE_DATA_OBJECT_TYPE);
|
||||
|
||||
/* Create legacy-free application type
|
||||
*
|
||||
|
|
@ -182,8 +183,8 @@ public class Loader extends PackageLoader {
|
|||
* hyphen and converted to lower case.
|
||||
* "Portal Workspace" will become "portal-workspace". */
|
||||
ApplicationType type = new ApplicationType(
|
||||
"Portal Workspace",
|
||||
Workspace.BASE_DATA_OBJECT_TYPE );
|
||||
"Portal Workspace",
|
||||
Workspace.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Portal based collaborative workspaces");
|
||||
|
||||
/* Create an application type specific group in user administration *
|
||||
|
|
@ -198,57 +199,59 @@ public class Loader extends PackageLoader {
|
|||
/**
|
||||
* Setup WorkspacePage type.
|
||||
*
|
||||
* Creates an entry for class (=type) c.ad.portalworkspace.WorkspacePage in
|
||||
* table application_types, but not in apm_package_types.
|
||||
* Creates an entry for class (=type) c.ad.portalworkspace.WorkspacePage in table
|
||||
* application_types, but not in apm_package_types.
|
||||
*
|
||||
* Uses the legacy free type of application Information (i.e. a title string and the object type
|
||||
* = fully qualified domain class name) for creation
|
||||
*
|
||||
* Uses the legacy free type of application Information (i.e. a title string
|
||||
* and the object type = fully qualified domain class name) for creation
|
||||
* @return
|
||||
*/
|
||||
private ResourceType setupWorkspacePageType() {
|
||||
ResourceType type = ResourceType.createResourceType(
|
||||
"Portal Workspace Page",
|
||||
WorkspacePage.BASE_DATA_OBJECT_TYPE);
|
||||
"Portal Workspace Page",
|
||||
WorkspacePage.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Pages for the portal workspaces");
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void loadApplicationDirectoryPortlet() {
|
||||
PortletType type = PortletType.createPortletType(
|
||||
"PW Application Directory", PortletType.WIDE_PROFILE,
|
||||
ApplicationDirectoryPortlet.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Displays a list of portal workspace applications");
|
||||
}
|
||||
PortletType type = PortletType.createPortletType(
|
||||
"PW Application Directory", PortletType.WIDE_PROFILE,
|
||||
ApplicationDirectoryPortlet.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Displays a list of portal workspace applications");
|
||||
}
|
||||
|
||||
private void loadContentDirectoryPortlet() {
|
||||
PortletType type = PortletType.createPortletType("PW Content Directory",
|
||||
PortletType.WIDE_PROFILE,
|
||||
ContentDirectoryPortlet.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Displays the content directory categories");
|
||||
}
|
||||
private void loadContentDirectoryPortlet() {
|
||||
PortletType type = PortletType.createPortletType("PW Content Directory",
|
||||
PortletType.WIDE_PROFILE,
|
||||
ContentDirectoryPortlet.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Displays the content directory categories");
|
||||
}
|
||||
|
||||
private void loadFreeformHTMLPortlet() {
|
||||
PortletType type = PortletType.createPortletType("Freeform HTML",
|
||||
PortletType.WIDE_PROFILE,
|
||||
FreeformHTMLPortlet.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Displays a freeform block of HTML");
|
||||
}
|
||||
private void loadFreeformHTMLPortlet() {
|
||||
PortletType type = PortletType.createPortletType("Freeform HTML",
|
||||
PortletType.WIDE_PROFILE,
|
||||
FreeformHTMLPortlet.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Displays a freeform block of HTML");
|
||||
}
|
||||
|
||||
private void loadLoginPortlet() {
|
||||
PortletType type = PortletType.createPortletType("Site Login",
|
||||
PortletType.WIDE_PROFILE, LoginPortlet.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Display a login form or user details");
|
||||
}
|
||||
private void loadLoginPortlet() {
|
||||
PortletType type = PortletType.createPortletType("Site Login",
|
||||
PortletType.WIDE_PROFILE,
|
||||
LoginPortlet.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Display a login form or user details");
|
||||
}
|
||||
|
||||
private void loadRSSFeedPortlet() {
|
||||
PortletType type = PortletType.createPortletType("RSS Feed",
|
||||
PortletType.WIDE_PROFILE, RSSFeedPortlet.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Displays an RSS Feed");
|
||||
}
|
||||
private void loadRSSFeedPortlet() {
|
||||
PortletType type = PortletType.createPortletType("RSS Feed",
|
||||
PortletType.WIDE_PROFILE,
|
||||
RSSFeedPortlet.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("Displays an RSS Feed");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -259,5 +262,4 @@ public class Loader extends PackageLoader {
|
|||
// TimeOfDayPortlet.BASE_DATA_OBJECT_TYPE);
|
||||
// type.setDescription("Displays the current date and time");
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 java.math.BigDecimal;
|
||||
|
|
@ -37,8 +36,7 @@ import com.arsdigita.util.UncheckedWrapperException;
|
|||
*/
|
||||
public class PageLayout extends DomainObject {
|
||||
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.portalworkspace.PageLayout";
|
||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.portalworkspace.PageLayout";
|
||||
|
||||
public static final String ID = "id";
|
||||
public static final String TITLE = "title";
|
||||
|
|
@ -46,7 +44,8 @@ public class PageLayout extends DomainObject {
|
|||
public static final String FORMAT = "format";
|
||||
public static final String FORMAT_ONE_COLUMN = "100%";
|
||||
public static final String FORMAT_TWO_COLUMNS = "50%,50%";
|
||||
public static final String FORMAT_THREE_COLUMNS = "30%,40%,30%";
|
||||
//public static final String FORMAT_THREE_COLUMNS = "30%,40%,30%";
|
||||
public static final String FORMAT_THREE_COLUMNS = "33.33%,33.33%,33.33%";
|
||||
public static final String FORMAT_FOUR_COLUMNS = "25%,25%,25%,25%";
|
||||
|
||||
public PageLayout() {
|
||||
|
|
@ -68,6 +67,7 @@ public class PageLayout extends DomainObject {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void initialize() {
|
||||
|
||||
super.initialize();
|
||||
|
|
@ -102,6 +102,7 @@ public class PageLayout extends DomainObject {
|
|||
* @param title
|
||||
* @param description
|
||||
* @param format
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static PageLayout create(String title, String description,
|
||||
|
|
@ -117,42 +118,43 @@ public class PageLayout extends DomainObject {
|
|||
setFormat(format);
|
||||
}
|
||||
|
||||
public static DomainCollection retrieveAll() {
|
||||
DataCollection layouts = SessionManager.getSession().retrieve(
|
||||
BASE_DATA_OBJECT_TYPE);
|
||||
return new DomainCollection(layouts);
|
||||
}
|
||||
public static DomainCollection retrieveAll() {
|
||||
DataCollection layouts = SessionManager.getSession().retrieve(
|
||||
BASE_DATA_OBJECT_TYPE);
|
||||
return new DomainCollection(layouts);
|
||||
}
|
||||
|
||||
public BigDecimal getID() {
|
||||
return (BigDecimal) get(ID);
|
||||
}
|
||||
public BigDecimal getID() {
|
||||
return (BigDecimal) get(ID);
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
set(TITLE, title);
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
set(TITLE, title);
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return (String) get(TITLE);
|
||||
}
|
||||
public String getTitle() {
|
||||
return (String) get(TITLE);
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
set(DESCRIPTION, description);
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
set(DESCRIPTION, description);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return (String) get(DESCRIPTION);
|
||||
}
|
||||
public String getDescription() {
|
||||
return (String) get(DESCRIPTION);
|
||||
}
|
||||
|
||||
public void setFormat(String format) {
|
||||
set(FORMAT, format);
|
||||
}
|
||||
public void setFormat(String format) {
|
||||
set(FORMAT, format);
|
||||
}
|
||||
|
||||
public String getFormat() {
|
||||
return (String) get(FORMAT);
|
||||
}
|
||||
public String getFormat() {
|
||||
return (String) get(FORMAT);
|
||||
}
|
||||
|
||||
public int getColumns() {
|
||||
String[] bits = StringUtils.split(getFormat(), ',');
|
||||
return bits.length;
|
||||
}
|
||||
|
||||
public int getColumns() {
|
||||
String[] bits = StringUtils.split(getFormat(), ',');
|
||||
return bits.length;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.kernel.permissions.PrivilegeDescriptor;
|
||||
|
|
@ -34,20 +33,23 @@ import org.apache.log4j.Logger;
|
|||
|
||||
public class WorkspaceConfig extends AbstractConfig {
|
||||
|
||||
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||
* by editing /WEB-INF/conf/log4j.properties int hte runtime environment
|
||||
* and set com.arsdigita.portalworkspace.WorkspaceConfig=DEBUG by
|
||||
* uncommenting or adding it. */
|
||||
private static final Logger s_log = Logger.getLogger(WorkspaceConfig.class);
|
||||
/**
|
||||
* Internal logger instance to faciliate debugging. Enable logging output by editing
|
||||
* /WEB-INF/conf/log4j.properties int hte runtime environment and set
|
||||
* com.arsdigita.portalworkspace.WorkspaceConfig=DEBUG by uncommenting or adding it.
|
||||
*/
|
||||
private static final Logger s_log = Logger.getLogger(WorkspaceConfig.class);
|
||||
|
||||
/** Singelton config object. */
|
||||
/**
|
||||
* Singelton config object.
|
||||
*/
|
||||
private static WorkspaceConfig s_conf;
|
||||
|
||||
/**
|
||||
* Gain a WorkspaceConfig object.
|
||||
*
|
||||
* Singelton pattern, don't instantiate a config object using the
|
||||
* constructor directly!
|
||||
* Singelton pattern, don't instantiate a config object using the constructor directly!
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static synchronized WorkspaceConfig getInstanceOf() {
|
||||
|
|
@ -59,94 +61,100 @@ public class WorkspaceConfig extends AbstractConfig {
|
|||
return s_conf;
|
||||
}
|
||||
|
||||
|
||||
// set of configuration parameters
|
||||
/** File with rules for configuring information in generated XML */
|
||||
private final Parameter m_adapters =
|
||||
new ResourceParameter(
|
||||
"com.arsdigita.portalworkspace.traversal_adapters",
|
||||
Parameter.REQUIRED,
|
||||
"/WEB-INF/resources/portalworkspace-adapters.xml");
|
||||
/**
|
||||
* File with rules for configuring information in generated XML
|
||||
*/
|
||||
private final Parameter m_adapters = new ResourceParameter(
|
||||
"com.arsdigita.portalworkspace.traversal_adapters",
|
||||
Parameter.REQUIRED,
|
||||
"/WEB-INF/resources/portalworkspace-adapters.xml");
|
||||
|
||||
/** Default column layout for workspace portals */
|
||||
private final Parameter m_defaultLayout =
|
||||
new StringParameter(
|
||||
"com.arsdigita.portalworkspace.default_layout",
|
||||
Parameter.REQUIRED, PageLayout.FORMAT_THREE_COLUMNS);
|
||||
/**
|
||||
* Default column layout for workspace portals
|
||||
*/
|
||||
private final Parameter m_defaultLayout = new StringParameter(
|
||||
"com.arsdigita.portalworkspace.default_layout",
|
||||
Parameter.REQUIRED, PageLayout.FORMAT_THREE_COLUMNS);
|
||||
|
||||
/** Whether non-admin users should have their own custom workspaces */
|
||||
private final Parameter m_createUserWorkspaces =
|
||||
new BooleanParameter(
|
||||
"com.arsdigita.portalworkspace.create_user_workspaces",
|
||||
Parameter.REQUIRED, Boolean.TRUE);
|
||||
/**
|
||||
* Whether non-admin users should have their own custom workspaces
|
||||
*/
|
||||
private final Parameter m_createUserWorkspaces = new BooleanParameter(
|
||||
"com.arsdigita.portalworkspace.create_user_workspaces",
|
||||
Parameter.REQUIRED, Boolean.TRUE);
|
||||
|
||||
/** 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.portalworkspace.excluded_portlet_types",
|
||||
Parameter.OPTIONAL, new String[0]);
|
||||
/**
|
||||
* 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.portalworkspace.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.portalworkspace.admin_only_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.portalworkspace.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.portalworkspace.portlet.freeform_html_editor",
|
||||
Parameter.REQUIRED, Boolean.FALSE);
|
||||
/**
|
||||
* Whether to use editor specified by waf.bebop.dhtml_editor for editing freeform html portlet
|
||||
*/
|
||||
private final Parameter m_htmlPortletWysiwygEditor = new BooleanParameter(
|
||||
"com.arsdigita.portalworkspace.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.portalworkspace.workspacePartyPrivilege",
|
||||
Parameter.OPTIONAL, "read");
|
||||
/**
|
||||
* Which privilege ("read" or "edit") is granted to the workspace party.
|
||||
*/
|
||||
private final Parameter m_workspacePartyPrivilege = new StringParameter(
|
||||
"com.arsdigita.portalworkspace.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.portalworkspace.checkWorkspaceReadPermissions",
|
||||
Parameter.OPTIONAL, Boolean.FALSE);
|
||||
/**
|
||||
* 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.portalworkspace.checkWorkspaceReadPermissions",
|
||||
Parameter.OPTIONAL, Boolean.FALSE);
|
||||
|
||||
public WorkspaceConfig() {
|
||||
public WorkspaceConfig() {
|
||||
|
||||
register(m_adapters);
|
||||
register(m_defaultLayout);
|
||||
register(m_createUserWorkspaces);
|
||||
register(m_excludedPortletTypes);
|
||||
register(m_adminPortletTypes);
|
||||
register(m_adapters);
|
||||
register(m_defaultLayout);
|
||||
register(m_createUserWorkspaces);
|
||||
register(m_excludedPortletTypes);
|
||||
register(m_adminPortletTypes);
|
||||
register(m_htmlPortletWysiwygEditor);
|
||||
register(m_workspacePartyPrivilege);
|
||||
register(m_checkWorkspaceReadPermissions);
|
||||
register(m_workspacePartyPrivilege);
|
||||
register(m_checkWorkspaceReadPermissions);
|
||||
|
||||
loadInfo();
|
||||
}
|
||||
loadInfo();
|
||||
}
|
||||
|
||||
InputStream getTraversalAdapters() {
|
||||
return (InputStream) get(m_adapters);
|
||||
}
|
||||
InputStream getTraversalAdapters() {
|
||||
return (InputStream) get(m_adapters);
|
||||
}
|
||||
|
||||
public String getDefaultLayout() {
|
||||
return (String) get(m_defaultLayout);
|
||||
}
|
||||
public String getDefaultLayout() {
|
||||
return (String) get(m_defaultLayout);
|
||||
}
|
||||
|
||||
public boolean getCreateUserWorkspaces() {
|
||||
return ((Boolean) get(m_createUserWorkspaces)).booleanValue();
|
||||
}
|
||||
public boolean getCreateUserWorkspaces() {
|
||||
return ((Boolean) get(m_createUserWorkspaces)).booleanValue();
|
||||
}
|
||||
|
||||
public List getExcludedPortletTypes() {
|
||||
String[] excludedTypes = (String[]) get(m_excludedPortletTypes);
|
||||
return Arrays.asList(excludedTypes);
|
||||
}
|
||||
public List getExcludedPortletTypes() {
|
||||
String[] excludedTypes = (String[]) get(m_excludedPortletTypes);
|
||||
return Arrays.asList(excludedTypes);
|
||||
}
|
||||
|
||||
public List getAdminPortletTypes() {
|
||||
String[] adminTypes = (String[]) get(m_adminPortletTypes);
|
||||
return Arrays.asList(adminTypes);
|
||||
}
|
||||
public List getAdminPortletTypes() {
|
||||
String[] adminTypes = (String[]) get(m_adminPortletTypes);
|
||||
return Arrays.asList(adminTypes);
|
||||
}
|
||||
|
||||
public boolean useWysiwygEditor() {
|
||||
return ((Boolean) get(m_htmlPortletWysiwygEditor)).booleanValue();
|
||||
|
|
@ -168,14 +176,15 @@ public class WorkspaceConfig extends AbstractConfig {
|
|||
}
|
||||
}
|
||||
|
||||
public PrivilegeDescriptor getWorkspacePartyPrivilege() {
|
||||
public PrivilegeDescriptor getWorkspacePartyPrivilege() {
|
||||
if (workspacePartyPrivilegeDescriptor == null) {
|
||||
initWorkspacePartyPrivilegeDescriptor();
|
||||
}
|
||||
return workspacePartyPrivilegeDescriptor;
|
||||
}
|
||||
return workspacePartyPrivilegeDescriptor;
|
||||
}
|
||||
|
||||
public boolean getCheckWorkspaceReadPermissions() {
|
||||
return ((Boolean) get(m_checkWorkspaceReadPermissions)).booleanValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.DomainObjectFactory;
|
||||
|
|
@ -30,34 +29,34 @@ import com.arsdigita.portal.Portal;
|
|||
*/
|
||||
public class WorkspacePage extends Portal {
|
||||
|
||||
public static final String SORT_KEY = "sortKey";
|
||||
public static final String SORT_KEY = "sortKey";
|
||||
|
||||
public static final String LAYOUT = "layout";
|
||||
public static final String LAYOUT = "layout";
|
||||
|
||||
public static final String WORKSPACE = "workspace";
|
||||
public static final String WORKSPACE = "workspace";
|
||||
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.portalworkspace.WorkspacePage";
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.portalworkspace.WorkspacePage";
|
||||
public static final String MODE_EDITOR = "editor";
|
||||
public static final String PORTAL_XML_NS = "http://www.uk.arsdigita.com/portal/1.0";
|
||||
public static final String PORTLET_XML_NS = "http://www.uk.arsdigita.com/portlet/1.0";
|
||||
public static final String MODE_DISPLAY = "display";
|
||||
|
||||
public WorkspacePage() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
public WorkspacePage() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public WorkspacePage(String type) {
|
||||
super(type);
|
||||
}
|
||||
public WorkspacePage(String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public WorkspacePage(DataObject dobj) {
|
||||
super(dobj);
|
||||
}
|
||||
public WorkspacePage(DataObject dobj) {
|
||||
super(dobj);
|
||||
}
|
||||
|
||||
public WorkspacePage(OID oid) {
|
||||
super(oid);
|
||||
}
|
||||
public WorkspacePage(OID oid) {
|
||||
super(oid);
|
||||
}
|
||||
|
||||
static WorkspacePage create(String title,
|
||||
String description,
|
||||
|
|
@ -65,47 +64,47 @@ public class WorkspacePage extends Portal {
|
|||
Workspace workspace,
|
||||
int sortKey) {
|
||||
WorkspacePage page = (WorkspacePage) Resource
|
||||
.createResource(WorkspacePage.BASE_DATA_OBJECT_TYPE,
|
||||
title,
|
||||
null);
|
||||
.createResource(WorkspacePage.BASE_DATA_OBJECT_TYPE,
|
||||
title,
|
||||
null);
|
||||
page.setup(description, layout, workspace, sortKey);
|
||||
return page;
|
||||
}
|
||||
|
||||
protected void setup(String description,
|
||||
PageLayout layout,
|
||||
Workspace workspace,
|
||||
int sortKey) {
|
||||
setDescription(description);
|
||||
setLayout(layout);
|
||||
setWorkspace(workspace);
|
||||
setSortKey(sortKey);
|
||||
}
|
||||
protected void setup(String description,
|
||||
PageLayout layout,
|
||||
Workspace workspace,
|
||||
int sortKey) {
|
||||
setDescription(description);
|
||||
setLayout(layout);
|
||||
setWorkspace(workspace);
|
||||
setSortKey(sortKey);
|
||||
}
|
||||
|
||||
void setSortKey(int key) {
|
||||
set(SORT_KEY, new Integer(key));
|
||||
}
|
||||
void setSortKey(int key) {
|
||||
set(SORT_KEY, new Integer(key));
|
||||
}
|
||||
|
||||
public int getSortKey() {
|
||||
return ((Integer) get(SORT_KEY)).intValue();
|
||||
}
|
||||
public int getSortKey() {
|
||||
return ((Integer) get(SORT_KEY)).intValue();
|
||||
}
|
||||
|
||||
void setWorkspace(Workspace workspace) {
|
||||
setAssociation(WORKSPACE, workspace);
|
||||
}
|
||||
void setWorkspace(Workspace workspace) {
|
||||
setAssociation(WORKSPACE, workspace);
|
||||
}
|
||||
|
||||
public Workspace getWorkspace() {
|
||||
return (Workspace) DomainObjectFactory
|
||||
.newInstance((DataObject) get(WORKSPACE));
|
||||
}
|
||||
public Workspace getWorkspace() {
|
||||
return (Workspace) DomainObjectFactory
|
||||
.newInstance((DataObject) get(WORKSPACE));
|
||||
}
|
||||
|
||||
public void setLayout(PageLayout layout) {
|
||||
setAssociation(LAYOUT, layout);
|
||||
}
|
||||
public void setLayout(PageLayout layout) {
|
||||
setAssociation(LAYOUT, layout);
|
||||
}
|
||||
|
||||
public PageLayout getLayout() {
|
||||
return (PageLayout) DomainObjectFactory
|
||||
.newInstance((DataObject) get(LAYOUT));
|
||||
}
|
||||
public PageLayout getLayout() {
|
||||
return (PageLayout) DomainObjectFactory
|
||||
.newInstance((DataObject) get(LAYOUT));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,3 +30,6 @@ 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
|
||||
cw.workspace.ui.categorized.create_workspace.info=Currently there is no Portal Workspace for this category. If you want to create one now, please click the link below.
|
||||
cw.workspace.ui.categorized.create_workspace.link=Create PortalWorkspace for this category
|
||||
cw.workspace.ui.categorized.workspace.add_row.link=Add new row
|
||||
|
|
|
|||
|
|
@ -30,3 +30,6 @@ 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
|
||||
cw.workspace.ui.categorized.create_workspace.info=Es gibt noch keinen Portal Workspace f\u00fcr diese Kategorie. Wenn Sie jetzt einen neuen Workspace f\u00fcr diese Kategorie anlegen m\u00f6chten klicken Sie bitte auf untenstehenden Link.
|
||||
cw.workspace.ui.categorized.create_workspace.link=PortalWorkspace f\u00fcr diese Kategorie anlegen
|
||||
cw.workspace.ui.categorized.workspace.add_row.link=Weitere Zeile hinzuf\u00fcgen
|
||||
|
|
|
|||
|
|
@ -30,3 +30,6 @@ cw.workspace.ui.participant_info=Participant Info
|
|||
cw.workspace.ui.participant_roles=Participant Roles
|
||||
cw.workspace.ui.admin.no_settings=
|
||||
cw.workspace.default_layout=
|
||||
cw.workspace.ui.categorized.create_workspace.info=
|
||||
cw.workspace.ui.categorized.create_workspace.link=
|
||||
cw.workspace.ui.categorized.workspace.add_row.link=
|
||||
|
|
|
|||
|
|
@ -30,3 +30,6 @@ cw.workspace.ui.participant_info=Participant Info
|
|||
cw.workspace.ui.participant_roles=Participant Roles
|
||||
cw.workspace.ui.admin.no_settings=
|
||||
cw.workspace.default_layout=
|
||||
cw.workspace.ui.categorized.create_workspace.info=
|
||||
cw.workspace.ui.categorized.create_workspace.link=
|
||||
cw.workspace.ui.categorized.workspace.add_row.link=
|
||||
|
|
|
|||
|
|
@ -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.ui;
|
||||
|
||||
import com.arsdigita.portalworkspace.StatefulPersistentPortal;
|
||||
|
|
@ -74,11 +73,11 @@ import org.apache.log4j.Logger;
|
|||
|
||||
// XXX this class is disgusting
|
||||
/**
|
||||
* PersistentPortals are able to have more than one column, and the constructor
|
||||
* for PersistentPortal takes in an integer argument for number of columns.
|
||||
* PersistentPortals are able to have more than one column, and the constructor for PersistentPortal
|
||||
* takes in an integer argument for number of columns.
|
||||
*
|
||||
* HomepagePortals defined on the jsp page each construct instances of this
|
||||
* class, one for the portal in view mode, one in edit mode.
|
||||
* HomepagePortals defined on the jsp page each construct instances of this class, one for the
|
||||
* portal in view mode, one in edit mode.
|
||||
*
|
||||
*/
|
||||
public class PersistentPortal extends SimpleContainer {
|
||||
|
|
@ -91,7 +90,6 @@ public class PersistentPortal extends SimpleContainer {
|
|||
public static final String ACTION_MOVE_LEFT = "moveLeft";
|
||||
public static final String ACTION_MOVE_RIGHT = "moveRight";
|
||||
|
||||
|
||||
public static final String ACTION_DELETE = "delete";
|
||||
|
||||
private WorkspaceSelectionAbstractModel m_workspace;
|
||||
|
|
@ -119,9 +117,9 @@ public class PersistentPortal extends SimpleContainer {
|
|||
// pixels wide...
|
||||
public static final int MAX_COLUMNS = 10;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param portal
|
||||
* @param mode
|
||||
*/
|
||||
|
|
@ -150,7 +148,6 @@ public class PersistentPortal extends SimpleContainer {
|
|||
|
||||
m_column = new ParameterSingleSelectionModel(new IntegerParameter("column"));
|
||||
|
||||
|
||||
if (m_mode.equals(WorkspacePage.MODE_EDITOR)) {
|
||||
for (int i = 0; i < m_adders.length; i++) {
|
||||
m_adders[i] = new PortletTypeForm("add" + name + i);
|
||||
|
|
@ -161,11 +158,12 @@ public class PersistentPortal extends SimpleContainer {
|
|||
}
|
||||
|
||||
m_portlet = new PortletSelectionModel(
|
||||
new BigDecimalParameter("edit") );
|
||||
new BigDecimalParameter("edit"));
|
||||
m_portletType = new PortletTypeSelectionModel(
|
||||
new BigDecimalParameter("create") );
|
||||
new BigDecimalParameter("create"));
|
||||
|
||||
m_portal.addChangeListener(new ChangeListener() {
|
||||
|
||||
public void stateChanged(ChangeEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
if (m_portal.isSelected(state)) {
|
||||
|
|
@ -177,14 +175,16 @@ public class PersistentPortal extends SimpleContainer {
|
|||
m_parentResource.set(state, null);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
m_portlet.addChangeListener(new ChangeListener() {
|
||||
|
||||
public void stateChanged(ChangeEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
if (m_portal.isSelected(state)) {
|
||||
com.arsdigita.portal.Portlet portlet =
|
||||
m_portlet.getSelectedPortlet(state);
|
||||
com.arsdigita.portal.Portlet portlet
|
||||
= m_portlet.getSelectedPortlet(state);
|
||||
s_log.debug("Setting portlet" + portlet);
|
||||
m_currentResource.set(state, portlet);
|
||||
} else {
|
||||
|
|
@ -192,26 +192,33 @@ public class PersistentPortal extends SimpleContainer {
|
|||
m_currentResource.set(state, null);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
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();
|
||||
|
|
@ -223,22 +230,23 @@ public class PersistentPortal extends SimpleContainer {
|
|||
PortletType type = types.getPortletType();
|
||||
s_log.debug("Add type " + type.getResourceObjectType());
|
||||
|
||||
final ResourceConfigComponent create =
|
||||
type.getCreateComponent(m_parentResource);
|
||||
final ResourceConfigComponent modify =
|
||||
type.getModifyComponent(m_currentResource);
|
||||
|
||||
final ResourceConfigComponent create
|
||||
= type.getCreateComponent(m_parentResource);
|
||||
final ResourceConfigComponent modify
|
||||
= type.getModifyComponent(m_currentResource);
|
||||
|
||||
ApplicationType appType = type.getProviderApplicationType();
|
||||
SimpleContainer createApp = null;
|
||||
if (appType != null) {
|
||||
final ResourceConfigComponent appCreate =
|
||||
appType.getCreateComponent(m_currentApp);
|
||||
final ResourceConfigComponent appCreate
|
||||
= appType.getCreateComponent(m_currentApp);
|
||||
ApplicationSelector sel = new ApplicationSelector(
|
||||
appType,
|
||||
m_parentApp,
|
||||
appType.getConfig() == null ? null : appType.getConfig().getViewPrivilege());
|
||||
appType,
|
||||
m_parentApp,
|
||||
appType.getConfig() == null ? null : appType.getConfig().
|
||||
getViewPrivilege());
|
||||
appCreate.addCompletionListener(new ActionListener() {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
s_log.debug("Do create of portlet");
|
||||
|
|
@ -251,19 +259,21 @@ public class PersistentPortal extends SimpleContainer {
|
|||
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));
|
||||
s_log.debug("Got res " + state.getValue(m_parentApp));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
createApp = new SimpleContainer();
|
||||
|
|
@ -275,20 +285,20 @@ public class PersistentPortal extends SimpleContainer {
|
|||
s_log.debug("Modify component is " + modify);
|
||||
|
||||
create.addCompletionListener(new ActionListener() {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
s_log.debug("Do create of portlet");
|
||||
Resource resource = create.createResource(state);
|
||||
|
||||
if (resource != null) {
|
||||
Integer column = (Integer)
|
||||
m_column.getSelectedKey(state);
|
||||
Integer column = (Integer) m_column.getSelectedKey(state);
|
||||
Assert.exists(column, Integer.class);
|
||||
|
||||
WorkspacePage portal = m_portal
|
||||
.getSelectedPortal(state);
|
||||
portal.addPortlet((Portlet)resource,
|
||||
column.intValue());
|
||||
.getSelectedPortal(state);
|
||||
portal.addPortlet((Portlet) resource,
|
||||
column.intValue());
|
||||
portal.save();
|
||||
}
|
||||
|
||||
|
|
@ -299,254 +309,268 @@ public class PersistentPortal extends SimpleContainer {
|
|||
s_log.debug("Stateful portlet added");
|
||||
// check if the maximum number of stateful
|
||||
// portlets has increased
|
||||
PortletType portletType =
|
||||
((Portlet) resource).getPortletType();
|
||||
DataQuery findMaxInstances =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.london.portal.MaxPortletInstances");
|
||||
PortletType portletType
|
||||
= ((Portlet) resource).getPortletType();
|
||||
DataQuery findMaxInstances
|
||||
= SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.london.portal.MaxPortletInstances");
|
||||
findMaxInstances.setParameter("portletType",
|
||||
portletType.getID());
|
||||
int maxCount = 0;
|
||||
while (findMaxInstances.next()) {
|
||||
maxCount =
|
||||
((Integer) findMaxInstances
|
||||
.get("maxCount"))
|
||||
.intValue();
|
||||
maxCount
|
||||
= ((Integer) findMaxInstances
|
||||
.get("maxCount"))
|
||||
.intValue();
|
||||
}
|
||||
|
||||
String key = portletType.getResourceObjectType();
|
||||
|
||||
int previousMax = StatefulPersistentPortal
|
||||
.getCurrentPortletRendererInstances(key);
|
||||
.getCurrentPortletRendererInstances(key);
|
||||
|
||||
s_log.debug( portletType + ": previous count = "
|
||||
+ previousMax + " | new max = "
|
||||
+ maxCount);
|
||||
s_log.debug(portletType + ": previous count = "
|
||||
+ previousMax + " | new max = "
|
||||
+ maxCount);
|
||||
if (maxCount > previousMax) {
|
||||
DefinePage.invalidatePage(
|
||||
DispatcherHelper
|
||||
.getCurrentResourcePath(state.getRequest())); }
|
||||
.getCurrentResourcePath(state.getRequest()));
|
||||
}
|
||||
}
|
||||
|
||||
m_portletType.clearSelection(e.getPageState());
|
||||
state.setValue(m_parentApp, null);
|
||||
m_parentResource.set(state, null);
|
||||
}
|
||||
});
|
||||
modify.addCompletionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
s_log.debug("Do modify of portlet");
|
||||
PageState state = e.getPageState();
|
||||
modify.modifyResource(state);
|
||||
Portlet portlet = m_portlet.getSelectedPortlet(state);
|
||||
portlet.save();
|
||||
m_portlet.clearSelection(state);
|
||||
}
|
||||
});
|
||||
m_create.put(type.getResourceObjectType(), create);
|
||||
m_modify.put(type.getResourceObjectType(), modify);
|
||||
if (createApp != null) {
|
||||
m_createApp.put(type.getResourceObjectType(), createApp);
|
||||
}
|
||||
add(create);
|
||||
add(modify);
|
||||
if (createApp != null) {
|
||||
add(createApp);
|
||||
}
|
||||
}
|
||||
state.setValue(m_parentApp, null);
|
||||
m_parentResource.set(state, null);
|
||||
}
|
||||
|
||||
});
|
||||
modify.addCompletionListener(new ActionListener() {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
s_log.debug("Do modify of portlet");
|
||||
PageState state = e.getPageState();
|
||||
modify.modifyResource(state);
|
||||
Portlet portlet = m_portlet.getSelectedPortlet(state);
|
||||
portlet.save();
|
||||
m_portlet.clearSelection(state);
|
||||
}
|
||||
|
||||
});
|
||||
m_create.put(type.getResourceObjectType(), create);
|
||||
m_modify.put(type.getResourceObjectType(), modify);
|
||||
if (createApp != null) {
|
||||
m_createApp.put(type.getResourceObjectType(), createApp);
|
||||
}
|
||||
add(create);
|
||||
add(modify);
|
||||
if (createApp != null) {
|
||||
add(createApp);
|
||||
}
|
||||
}
|
||||
s_log.debug("Done with add types" + m_create.size()
|
||||
+ " " + m_modify.size());
|
||||
+ " " + m_modify.size());
|
||||
|
||||
Assert.exists(m_parentResource, RequestLocal.class);
|
||||
m_portalModelBuilder = new PortalEditModelBuilder(
|
||||
portal, m_adders,
|
||||
m_portletType, m_column, m_portlet,
|
||||
m_create, m_modify, m_createApp, m_parentResource);
|
||||
} else {
|
||||
m_portalModelBuilder = new PortalViewModelBuilder(portal);
|
||||
}
|
||||
}
|
||||
Assert.exists(m_parentResource, RequestLocal.class);
|
||||
m_portalModelBuilder = new PortalEditModelBuilder(portal,
|
||||
m_adders,
|
||||
m_portletType,
|
||||
m_column,
|
||||
m_portlet,
|
||||
m_create,
|
||||
m_modify,
|
||||
m_createApp,
|
||||
m_parentResource);
|
||||
} else {
|
||||
m_portalModelBuilder = new PortalViewModelBuilder(portal);
|
||||
}
|
||||
}
|
||||
|
||||
public void register(Page page) {
|
||||
super.register(page);
|
||||
public void register(Page page) {
|
||||
super.register(page);
|
||||
|
||||
if (m_portlet != null) {
|
||||
page.addComponentStateParam(this, m_portlet.getStateParameter());
|
||||
}
|
||||
if (m_portletType != null) {
|
||||
if (m_portlet != null) {
|
||||
page.addComponentStateParam(this, m_portlet.getStateParameter());
|
||||
}
|
||||
if (m_portletType != null) {
|
||||
page.addComponentStateParam(this, m_portletType.getStateParameter());
|
||||
}
|
||||
}
|
||||
|
||||
page.addComponentStateParam(this, m_column.getStateParameter());
|
||||
if (m_parentApp != null) {
|
||||
page.addComponentStateParam(this, m_parentApp);
|
||||
}
|
||||
}
|
||||
page.addComponentStateParam(this, m_column.getStateParameter());
|
||||
if (m_parentApp != null) {
|
||||
page.addComponentStateParam(this, m_parentApp);
|
||||
}
|
||||
}
|
||||
|
||||
public void generateXML(PageState state,
|
||||
Element parent) {
|
||||
Element content = generateParent(parent);
|
||||
Element content = generateParent(parent);
|
||||
|
||||
WorkspacePage page = m_portal.getSelectedPortal(state);
|
||||
content.addAttribute("layout", page.getLayout().getFormat());
|
||||
content.addAttribute("style", page.getLayout().getTitle());
|
||||
content.addAttribute("title", page.getTitle());
|
||||
content.addAttribute("description", page.getDescription());
|
||||
WorkspacePage page = m_portal.getSelectedPortal(state);
|
||||
content.addAttribute("layout", page.getLayout().getFormat());
|
||||
content.addAttribute("style", page.getLayout().getTitle());
|
||||
content.addAttribute("title", page.getTitle());
|
||||
content.addAttribute("description", page.getDescription());
|
||||
|
||||
PortalModel pm = m_portalModelBuilder.buildModel(state);
|
||||
Iterator portlets = pm.getPortletRenderers();
|
||||
PortalModel pm = m_portalModelBuilder.buildModel(state);
|
||||
Iterator portlets = pm.getPortletRenderers();
|
||||
|
||||
while (portlets.hasNext()) {
|
||||
Object entry = portlets.next();
|
||||
if (entry instanceof Object[]) {
|
||||
PortletRenderer renderer = (PortletRenderer) ((Object[]) entry)[0];
|
||||
BigDecimal portlet = (BigDecimal) ((Object[]) entry)[1];
|
||||
while (portlets.hasNext()) {
|
||||
Object entry = portlets.next();
|
||||
if (entry instanceof Object[]) {
|
||||
PortletRenderer renderer = (PortletRenderer) ((Object[]) entry)[0];
|
||||
BigDecimal portlet = (BigDecimal) ((Object[]) entry)[1];
|
||||
|
||||
// We want the root element created by the portlet
|
||||
// but the crap generateXML signature doesn't let
|
||||
// us get at it :-( And the bebop portlet isn't
|
||||
// any more helpful either :-(
|
||||
Element hack = new Element("hack");
|
||||
// We want the root element created by the portlet
|
||||
// but the crap generateXML signature doesn't let
|
||||
// us get at it :-( And the bebop portlet isn't
|
||||
// any more helpful either :-(
|
||||
Element hack = new Element("hack");
|
||||
|
||||
renderer.generateXML(state, hack);
|
||||
renderer.generateXML(state, hack);
|
||||
|
||||
Iterator elements = hack.getChildren().iterator();
|
||||
while (elements.hasNext()) {
|
||||
Element child = (Element) elements.next();
|
||||
Iterator elements = hack.getChildren().iterator();
|
||||
while (elements.hasNext()) {
|
||||
Element child = (Element) elements.next();
|
||||
|
||||
generateActionXML(state, child, portlet);
|
||||
content.addContent(child);
|
||||
}
|
||||
} else {
|
||||
PortletRenderer renderer = (PortletRenderer) entry;
|
||||
renderer.generateXML(state, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
generateActionXML(state, child, portlet);
|
||||
content.addContent(child);
|
||||
}
|
||||
} else {
|
||||
PortletRenderer renderer = (PortletRenderer) entry;
|
||||
renderer.generateXML(state, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void generateActionXML(PageState state,
|
||||
Element parent,
|
||||
BigDecimal portlet) {
|
||||
generateActionXML(state, parent, portlet, ACTION_CUSTOMIZE);
|
||||
generateActionXML(state, parent, portlet, ACTION_MOVE_UP);
|
||||
generateActionXML(state, parent, portlet, ACTION_MOVE_DOWN);
|
||||
generateActionXML(state, parent, portlet, ACTION_MOVE_LEFT);
|
||||
generateActionXML(state, parent, portlet, ACTION_MOVE_RIGHT);
|
||||
generateActionXML(state, parent, portlet, ACTION_DELETE);
|
||||
}
|
||||
BigDecimal portlet) {
|
||||
generateActionXML(state, parent, portlet, ACTION_CUSTOMIZE);
|
||||
generateActionXML(state, parent, portlet, ACTION_MOVE_UP);
|
||||
generateActionXML(state, parent, portlet, ACTION_MOVE_DOWN);
|
||||
generateActionXML(state, parent, portlet, ACTION_MOVE_LEFT);
|
||||
generateActionXML(state, parent, portlet, ACTION_MOVE_RIGHT);
|
||||
generateActionXML(state, parent, portlet, ACTION_DELETE);
|
||||
}
|
||||
|
||||
public void generateActionXML(PageState state,
|
||||
Element parent,
|
||||
BigDecimal portlet,
|
||||
String name) {
|
||||
Element action = parent.newChildElement("portlet:action",
|
||||
WorkspacePage.PORTLET_XML_NS);
|
||||
try {
|
||||
Element action = parent.newChildElement("portlet:action",
|
||||
WorkspacePage.PORTLET_XML_NS);
|
||||
try {
|
||||
state.setControlEvent(this,
|
||||
name,
|
||||
portlet.toString());
|
||||
action.addAttribute("name", name);
|
||||
action.addAttribute("url", state.stateAsURL());
|
||||
action.addAttribute("name", name);
|
||||
action.addAttribute("url", state.stateAsURL());
|
||||
|
||||
state.clearControlEvent();
|
||||
} catch (IOException ex) {
|
||||
throw new UncheckedWrapperException("cannot get state url", ex);
|
||||
}
|
||||
}
|
||||
state.clearControlEvent();
|
||||
} catch (IOException ex) {
|
||||
throw new UncheckedWrapperException("cannot get state url", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void respond(PageState state) {
|
||||
WorkspacePage portal = m_portal.getSelectedPortal(state);
|
||||
public void respond(PageState state) {
|
||||
WorkspacePage portal = m_portal.getSelectedPortal(state);
|
||||
|
||||
if (m_mode.equals(WorkspacePage.MODE_EDITOR)) {
|
||||
if (m_mode.equals(WorkspacePage.MODE_EDITOR)) {
|
||||
|
||||
// check permission on Workspace, not WorkspacePage,
|
||||
// as this is where the permissiones/groups are set
|
||||
Workspace workspace = portal.getWorkspace();
|
||||
Party party = Kernel.getContext().getParty();
|
||||
// check permission on Workspace, not WorkspacePage,
|
||||
// as this is where the permissiones/groups are set
|
||||
Workspace workspace = portal.getWorkspace();
|
||||
Party party = Kernel.getContext().getParty();
|
||||
if (!PortalHelper.canCustomize(party,
|
||||
workspace)) {
|
||||
throw new AccessDeniedException(
|
||||
"no permissions to customize workspace");
|
||||
}
|
||||
throw new AccessDeniedException(
|
||||
"no permissions to customize workspace");
|
||||
}
|
||||
|
||||
String key = state.getControlEventName();
|
||||
String value = state.getControlEventValue();
|
||||
Portlet portlet = Portlet.retrievePortlet(new BigDecimal(value));
|
||||
String key = state.getControlEventName();
|
||||
String value = state.getControlEventValue();
|
||||
Portlet portlet = Portlet.retrievePortlet(new BigDecimal(value));
|
||||
|
||||
if (ACTION_MOVE_UP.equals(key)) {
|
||||
portal.swapPortletWithPrevious(portlet);
|
||||
portal.save();
|
||||
} else if (ACTION_MOVE_DOWN.equals(key)) {
|
||||
portal.swapPortletWithNext(portlet);
|
||||
portal.save();
|
||||
if (ACTION_MOVE_UP.equals(key)) {
|
||||
portal.swapPortletWithPrevious(portlet);
|
||||
portal.save();
|
||||
} else if (ACTION_MOVE_DOWN.equals(key)) {
|
||||
portal.swapPortletWithNext(portlet);
|
||||
portal.save();
|
||||
|
||||
} else if (ACTION_MOVE_LEFT.equals(key)) {
|
||||
} else if (ACTION_MOVE_LEFT.equals(key)) {
|
||||
int cell = portlet.getCellNumber();
|
||||
cell = cell - 1;
|
||||
if (cell < 1) { cell = 1; }
|
||||
if (cell < 1) {
|
||||
cell = 1;
|
||||
}
|
||||
portlet.setCellNumber(cell);
|
||||
portlet.save();
|
||||
} else if (ACTION_MOVE_RIGHT.equals(key)) {
|
||||
} else if (ACTION_MOVE_RIGHT.equals(key)) {
|
||||
int cello = portlet.getCellNumber();
|
||||
cello = cello + 1;
|
||||
if (cello > 3) { cello = 3; }
|
||||
if (cello > 3) {
|
||||
cello = 3;
|
||||
}
|
||||
portlet.setCellNumber(cello);
|
||||
portlet.save();
|
||||
} else if (ACTION_DELETE.equals(key)) {
|
||||
} else if (ACTION_DELETE.equals(key)) {
|
||||
if (portlet != null) {
|
||||
// null if double click on link - in which case do nothing
|
||||
// note - may not have js double click protection on this as it is
|
||||
// a link cg
|
||||
portlet.delete();
|
||||
// null if double click on link - in which case do nothing
|
||||
// note - may not have js double click protection on this as it is
|
||||
// a link cg
|
||||
portlet.delete();
|
||||
} else {
|
||||
s_log.debug("doubleclick detected");
|
||||
s_log.debug("doubleclick detected");
|
||||
}
|
||||
|
||||
} else if (ACTION_CUSTOMIZE.equals(key)) {
|
||||
m_portlet.setSelectedKey(state, new BigDecimal(value));
|
||||
}
|
||||
}
|
||||
state.clearControlEvent();
|
||||
}
|
||||
} else if (ACTION_CUSTOMIZE.equals(key)) {
|
||||
m_portlet.setSelectedKey(state, new BigDecimal(value));
|
||||
}
|
||||
}
|
||||
state.clearControlEvent();
|
||||
}
|
||||
|
||||
private class PortletAddListener implements FormProcessListener {
|
||||
private class PortletAddListener implements FormProcessListener {
|
||||
|
||||
private PortalSelectionModel m_portal;
|
||||
private int m_col;
|
||||
private PortalSelectionModel m_portal;
|
||||
private int m_col;
|
||||
|
||||
public PortletAddListener(PortalSelectionModel portal,
|
||||
int column) {
|
||||
m_portal = portal;
|
||||
m_col = column;
|
||||
}
|
||||
m_portal = portal;
|
||||
m_col = column;
|
||||
}
|
||||
|
||||
public void process(FormSectionEvent e)
|
||||
throws FormProcessException {
|
||||
PageState state = e.getPageState();
|
||||
PageState state = e.getPageState();
|
||||
|
||||
PortletTypeForm form = (PortletTypeForm) e.getSource();
|
||||
PortletTypeForm form = (PortletTypeForm) e.getSource();
|
||||
|
||||
WorkspacePage portal = m_portal.getSelectedPortal(state);
|
||||
WorkspacePage portal = m_portal.getSelectedPortal(state);
|
||||
|
||||
// check permission on Workspace, not WorkspacePage,
|
||||
// as this is where the permissiones/groups are set
|
||||
Workspace workspace = portal.getWorkspace();
|
||||
Party party = Kernel.getContext().getParty();
|
||||
// check permission on Workspace, not WorkspacePage,
|
||||
// as this is where the permissiones/groups are set
|
||||
Workspace workspace = portal.getWorkspace();
|
||||
Party party = Kernel.getContext().getParty();
|
||||
if (!PortalHelper.canCustomize(party,
|
||||
workspace)) {
|
||||
throw new AccessDeniedException(
|
||||
throw new AccessDeniedException(
|
||||
"no permissions to customize workspace"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PortletType type = PortletType.retrievePortletType(
|
||||
form.getPortletType(state));
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Got create event for type " +
|
||||
type.getID() + " column " + m_col);
|
||||
}
|
||||
m_portletType.setSelectedKey(state, type.getID());
|
||||
m_column.setSelectedKey(state, new Integer(m_col));
|
||||
}
|
||||
}
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Got create event for type " + type.getID() + " column " + m_col);
|
||||
}
|
||||
m_portletType.setSelectedKey(state, type.getID());
|
||||
m_column.setSelectedKey(state, new Integer(m_col));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
* rights and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.portalworkspace.ui;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -26,27 +25,30 @@ import com.arsdigita.portal.PortletType;
|
|||
|
||||
public class PortletTypeSelectionModel extends AbstractSingleSelectionModel {
|
||||
|
||||
private ParameterSingleSelectionModel m_model;
|
||||
private ParameterSingleSelectionModel m_model;
|
||||
|
||||
public PortletTypeSelectionModel(BigDecimalParameter p) {
|
||||
m_model = new ParameterSingleSelectionModel(p);
|
||||
}
|
||||
public PortletTypeSelectionModel(BigDecimalParameter p) {
|
||||
m_model = new ParameterSingleSelectionModel(p);
|
||||
}
|
||||
|
||||
public Object getSelectedKey(PageState state) {
|
||||
return m_model.getSelectedKey(state);
|
||||
}
|
||||
@Override
|
||||
public Object getSelectedKey(PageState state) {
|
||||
return m_model.getSelectedKey(state);
|
||||
}
|
||||
|
||||
public void setSelectedKey(PageState state, Object key) {
|
||||
m_model.setSelectedKey(state, key);
|
||||
}
|
||||
@Override
|
||||
public void setSelectedKey(PageState state, Object key) {
|
||||
m_model.setSelectedKey(state, key);
|
||||
}
|
||||
|
||||
public ParameterModel getStateParameter() {
|
||||
return m_model.getStateParameter();
|
||||
}
|
||||
@Override
|
||||
public ParameterModel getStateParameter() {
|
||||
return m_model.getStateParameter();
|
||||
}
|
||||
|
||||
public PortletType getSelectedPortletType(PageState state) {
|
||||
BigDecimal key = (BigDecimal) getSelectedKey(state);
|
||||
public PortletType getSelectedPortletType(PageState state) {
|
||||
BigDecimal key = (BigDecimal) getSelectedKey(state);
|
||||
|
||||
return PortletType.retrievePortletType(key);
|
||||
}
|
||||
return PortletType.retrievePortletType(key);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.ui;
|
||||
|
||||
import com.arsdigita.bebop.PageState;
|
||||
|
|
@ -37,57 +36,75 @@ import com.arsdigita.xml.XML;
|
|||
*/
|
||||
public class WorkspaceDetails extends SimpleComponent {
|
||||
|
||||
private WorkspaceSelectionAbstractModel m_workspace;
|
||||
private WorkspaceSelectionAbstractModel workspaceModel;
|
||||
|
||||
public WorkspaceDetails(WorkspaceSelectionAbstractModel workspace) {
|
||||
m_workspace = workspace;
|
||||
}
|
||||
public WorkspaceDetails(final WorkspaceSelectionAbstractModel workspace) {
|
||||
super();
|
||||
this.workspaceModel = workspace;
|
||||
}
|
||||
|
||||
public void setWorkspaceModel(WorkspaceSelectionAbstractModel workspace) {
|
||||
m_workspace = workspace;
|
||||
}
|
||||
public void setWorkspaceModel(final WorkspaceSelectionAbstractModel workspace) {
|
||||
this.workspaceModel = workspace;
|
||||
}
|
||||
|
||||
public Workspace getSelectedWorkspace(PageState state) {
|
||||
return m_workspace.getSelectedWorkspace(state);
|
||||
}
|
||||
public Workspace getSelectedWorkspace(final PageState state) {
|
||||
return workspaceModel.getSelectedWorkspace(state);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Overridden {@link SimpleComponent#isVisible(com.arsdigita.bebop.PageState)} to ensure that
|
||||
* {@code WorkspaceDetails} is not rendered when there is not Workspace to show.
|
||||
*
|
||||
* Previously an none existing Workspace (which can occur when using a PortalWorkspace on a
|
||||
* category page) caused a NPE.
|
||||
*
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isVisible(final PageState state) {
|
||||
return super.isVisible(state) && workspaceModel.getSelectedWorkspace(state) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateXML(PageState state, Element parent) {
|
||||
Workspace workspace = getSelectedWorkspace(state);
|
||||
public void generateXML(final PageState state, final Element parent) {
|
||||
final Workspace workspace = getSelectedWorkspace(state);
|
||||
|
||||
Element content = new Element("portal:workspaceDetails",
|
||||
WorkspacePage.PORTAL_XML_NS);
|
||||
exportAttributes(content);
|
||||
final Element content = new Element("portal:workspaceDetails",
|
||||
WorkspacePage.PORTAL_XML_NS);
|
||||
exportAttributes(content);
|
||||
|
||||
generateWorkspaceXML(state, content, workspace);
|
||||
generatePermissionXML(state, content, workspace);
|
||||
generateWorkspaceXML(state, content, workspace);
|
||||
generatePermissionXML(state, content, workspace);
|
||||
|
||||
parent.addContent(content);
|
||||
}
|
||||
parent.addContent(content);
|
||||
}
|
||||
|
||||
protected void generateWorkspaceXML(PageState state, Element content,
|
||||
Workspace workspace) {
|
||||
protected void generateWorkspaceXML(final PageState state,
|
||||
final Element content,
|
||||
final Workspace workspace) {
|
||||
|
||||
DomainObjectXMLRenderer xr = new DomainObjectXMLRenderer(content);
|
||||
xr.setWrapRoot(false);
|
||||
xr.setWrapAttributes(true);
|
||||
xr.setWrapObjects(false);
|
||||
final DomainObjectXMLRenderer renderer = new DomainObjectXMLRenderer(content);
|
||||
renderer.setWrapRoot(false);
|
||||
renderer.setWrapAttributes(true);
|
||||
renderer.setWrapObjects(false);
|
||||
|
||||
xr.walk(workspace, WorkspaceDetails.class.getName());
|
||||
}
|
||||
renderer.walk(workspace, WorkspaceDetails.class.getName());
|
||||
}
|
||||
|
||||
protected void generatePermissionXML(PageState state, Element content,
|
||||
Workspace workspace) {
|
||||
Party party = Kernel.getContext().getParty();
|
||||
protected void generatePermissionXML(final PageState state,
|
||||
final Element content,
|
||||
final Workspace workspace) {
|
||||
final Party party = Kernel.getContext().getParty();
|
||||
|
||||
PermissionDescriptor edit = new PermissionDescriptor(
|
||||
PrivilegeDescriptor.EDIT, workspace, party);
|
||||
PermissionDescriptor admin = new PermissionDescriptor(
|
||||
PrivilegeDescriptor.ADMIN, workspace, party);
|
||||
final PermissionDescriptor edit = new PermissionDescriptor(
|
||||
PrivilegeDescriptor.EDIT, workspace, party);
|
||||
final PermissionDescriptor admin = new PermissionDescriptor(
|
||||
PrivilegeDescriptor.ADMIN, workspace, party);
|
||||
|
||||
content.addAttribute("canEdit", XML.format(PermissionService.checkPermission(edit)));
|
||||
content.addAttribute("canAdmin", XML.format(PermissionService.checkPermission(admin)));
|
||||
}
|
||||
|
||||
content.addAttribute("canEdit", XML.format(new Boolean(
|
||||
PermissionService.checkPermission(edit))));
|
||||
content.addAttribute("canAdmin", XML.format(new Boolean(
|
||||
PermissionService.checkPermission(admin))));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.ui;
|
||||
|
||||
import com.arsdigita.bebop.ActionLink;
|
||||
|
|
@ -42,11 +41,9 @@ import com.arsdigita.portalworkspace.util.GlobalizationUtil;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* Entry point into a standard (public or access restricted) portal workspace
|
||||
* page where the page is constructed in "edit" mode to allow configuration
|
||||
* and modification by an authorized participant.
|
||||
* Entry point into a standard (public or access restricted) 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.
|
||||
*
|
||||
|
|
@ -60,9 +57,8 @@ import org.apache.log4j.Logger;
|
|||
* </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.
|
||||
* 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 {
|
||||
|
||||
|
|
@ -74,7 +70,6 @@ public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
|||
|
||||
private ActionLink m_editBasicPropertiesLink;
|
||||
|
||||
|
||||
/**
|
||||
* Default Constructor constructs a new, empty WorkspaceEditor object.
|
||||
*/
|
||||
|
|
@ -83,8 +78,8 @@ public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a WorkspaceViewer for a specific workspace object
|
||||
* and sets the xml tags accordingly.
|
||||
* Constructs a WorkspaceViewer for a specific workspace object and sets the xml tags
|
||||
* accordingly.
|
||||
*
|
||||
* @param workspace
|
||||
*/
|
||||
|
|
@ -96,28 +91,28 @@ public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
|||
m_add = new ActionLink("add pane");
|
||||
m_add.setClassAttr("actionLink");
|
||||
m_add.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
public void actionPerformed(ActionEvent 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");
|
||||
}
|
||||
Workspace workspace = getSelectedWorkspace(state);
|
||||
Party party = Kernel.getContext().getParty();
|
||||
if (!PortalHelper.canCustomize(party, workspace)) {
|
||||
throw new AccessDeniedException(
|
||||
"no permissions to customize workspace");
|
||||
}
|
||||
|
||||
WorkspacePage page = workspace.addPage("New page",
|
||||
"New portal page");
|
||||
}
|
||||
});
|
||||
WorkspacePage page = workspace.addPage("New page",
|
||||
"New portal page");
|
||||
}
|
||||
});
|
||||
|
||||
add(m_add);
|
||||
|
||||
// now add the basic properties controls
|
||||
m_editBasicPropertiesLink = new ActionLink((String) GlobalizationUtil
|
||||
.globalize("portal.ui.admin.edit_basic_properties").localize());
|
||||
.globalize("portal.ui.admin.edit_basic_properties").localize());
|
||||
m_editBasicPropertiesLink
|
||||
.addActionListener(new BasicPropertiesLinkListener());
|
||||
.addActionListener(new BasicPropertiesLinkListener());
|
||||
m_editBasicPropertiesLink.setClassAttr("actionLink");
|
||||
add(m_editBasicPropertiesLink);
|
||||
m_basisPropertiesForm = new BasicPropertiesForm();
|
||||
|
|
@ -133,17 +128,15 @@ public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
|||
return new PortalListEditor(portal);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void register(Page page) {
|
||||
super.register(page);
|
||||
super.register(page);
|
||||
// Modigyable themes removed, cf. above
|
||||
// page.setVisibleDefault(m_selectForm, !m_workspaceThemes.isEmpty());
|
||||
// page.setVisibleDefault(m_createForm, false);
|
||||
page.setVisibleDefault(m_basisPropertiesForm, false);
|
||||
page.setVisibleDefault(m_basisPropertiesForm, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param portal
|
||||
|
|
@ -157,81 +150,83 @@ public class WorkspaceEditor extends AbstractWorkspaceComponent {
|
|||
*
|
||||
*/
|
||||
private class BasicPropertiesLinkListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
m_editBasicPropertiesLink.setVisible(ps, false);
|
||||
m_basisPropertiesForm.setVisible(ps, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class BasicPropertiesForm extends Form implements
|
||||
FormProcessListener, FormInitListener {
|
||||
private Label title;
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
m_editBasicPropertiesLink.setVisible(ps, false);
|
||||
m_basisPropertiesForm.setVisible(ps, true);
|
||||
}
|
||||
}
|
||||
|
||||
private TextField m_title;
|
||||
public class BasicPropertiesForm extends Form implements
|
||||
FormProcessListener, FormInitListener {
|
||||
|
||||
private Label description;
|
||||
private Label title;
|
||||
|
||||
private Submit savebutton;
|
||||
private TextField m_title;
|
||||
|
||||
private Submit cancelbutton;
|
||||
private Label description;
|
||||
|
||||
private TextArea m_description;
|
||||
private Submit savebutton;
|
||||
|
||||
public BasicPropertiesForm() {
|
||||
super("basicpropertiesform");
|
||||
setClassAttr("basicprops");
|
||||
private Submit cancelbutton;
|
||||
|
||||
title = new Label(GlobalizationUtil
|
||||
.globalize("portal.ui.admin.workspace_title"));
|
||||
private TextArea m_description;
|
||||
|
||||
m_title = new TextField("title");
|
||||
m_title.setSize(40);
|
||||
m_title.getParameterModel().addParameterListener(
|
||||
new NotEmptyValidationListener());
|
||||
public BasicPropertiesForm() {
|
||||
super("basicpropertiesform");
|
||||
setClassAttr("basicprops");
|
||||
|
||||
m_description = new TextArea("description");
|
||||
m_description.setRows(10);
|
||||
m_description.setCols(40);
|
||||
title = new Label(GlobalizationUtil
|
||||
.globalize("portal.ui.admin.workspace_title"));
|
||||
|
||||
description = new Label(GlobalizationUtil
|
||||
.globalize("portal.ui.admin.workspace_description"));
|
||||
m_title = new TextField("title");
|
||||
m_title.setSize(40);
|
||||
m_title.getParameterModel().addParameterListener(
|
||||
new NotEmptyValidationListener());
|
||||
|
||||
savebutton = new Submit("save", "Save");
|
||||
cancelbutton = new Submit("cancel", "Cancel");
|
||||
m_description = new TextArea("description");
|
||||
m_description.setRows(10);
|
||||
m_description.setCols(40);
|
||||
|
||||
add(title);
|
||||
add(m_title);
|
||||
add(description);
|
||||
add(m_description);
|
||||
add(cancelbutton);
|
||||
add(savebutton);
|
||||
addProcessListener(this);
|
||||
addInitListener(this);
|
||||
}
|
||||
description = new Label(GlobalizationUtil
|
||||
.globalize("portal.ui.admin.workspace_description"));
|
||||
|
||||
public void process(FormSectionEvent e) {
|
||||
s_log.debug("processing the basic properties form");
|
||||
PageState ps = e.getPageState();
|
||||
if (savebutton.isSelected(ps)) {
|
||||
savebutton = new Submit("save", "Save");
|
||||
cancelbutton = new Submit("cancel", "Cancel");
|
||||
|
||||
Workspace workspace = getSelectedWorkspace(ps);
|
||||
workspace.setTitle((String) m_title.getValue(ps));
|
||||
workspace.setDescription((String) m_description.getValue(ps));
|
||||
workspace.save();
|
||||
}
|
||||
m_editBasicPropertiesLink.setVisible(ps, true);
|
||||
this.setVisible(ps, false);
|
||||
}
|
||||
add(title);
|
||||
add(m_title);
|
||||
add(description);
|
||||
add(m_description);
|
||||
add(cancelbutton);
|
||||
add(savebutton);
|
||||
addProcessListener(this);
|
||||
addInitListener(this);
|
||||
}
|
||||
|
||||
public void init(FormSectionEvent e) throws FormProcessException {
|
||||
// s_log.debug("initialising the basic properties form");
|
||||
PageState ps = e.getPageState();
|
||||
Workspace workspace = getSelectedWorkspace(ps);
|
||||
m_title.setValue(ps, workspace.getTitle());
|
||||
m_description.setValue(ps, workspace.getDescription());
|
||||
// s_log.debug("setting visibility to false");
|
||||
// this.setVisible(ps, false);
|
||||
}
|
||||
}
|
||||
public void process(FormSectionEvent e) {
|
||||
s_log.debug("processing the basic properties form");
|
||||
PageState ps = e.getPageState();
|
||||
if (savebutton.isSelected(ps)) {
|
||||
|
||||
Workspace workspace = getSelectedWorkspace(ps);
|
||||
workspace.setTitle((String) m_title.getValue(ps));
|
||||
workspace.setDescription((String) m_description.getValue(ps));
|
||||
workspace.save();
|
||||
}
|
||||
m_editBasicPropertiesLink.setVisible(ps, true);
|
||||
this.setVisible(ps, false);
|
||||
}
|
||||
|
||||
public void init(FormSectionEvent e) throws FormProcessException {
|
||||
// s_log.debug("initialising the basic properties form");
|
||||
PageState ps = e.getPageState();
|
||||
Workspace workspace = getSelectedWorkspace(ps);
|
||||
m_title.setValue(ps, workspace.getTitle());
|
||||
m_description.setValue(ps, workspace.getDescription());
|
||||
// s_log.debug("setting visibility to false");
|
||||
// this.setVisible(ps, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,368 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.portalworkspace.ui;
|
||||
|
||||
import com.arsdigita.bebop.ActionLink;
|
||||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
import com.arsdigita.bebop.event.ActionEvent;
|
||||
import com.arsdigita.bebop.event.ActionListener;
|
||||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.PrintEvent;
|
||||
import com.arsdigita.bebop.event.PrintListener;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.bebop.portal.PortletRenderer;
|
||||
import com.arsdigita.categorization.Category;
|
||||
import com.arsdigita.dispatcher.AccessDeniedException;
|
||||
import com.arsdigita.kernel.Group;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.Party;
|
||||
import com.arsdigita.kernel.PartyCollection;
|
||||
import com.arsdigita.navigation.Navigation;
|
||||
import com.arsdigita.navigation.NavigationModel;
|
||||
import com.arsdigita.portal.Portlet;
|
||||
import com.arsdigita.portal.PortletCollection;
|
||||
import com.arsdigita.portalworkspace.Workspace;
|
||||
import com.arsdigita.portalworkspace.WorkspacePage;
|
||||
import com.arsdigita.portalworkspace.WorkspacePageCollection;
|
||||
import com.arsdigita.portalworkspace.util.GlobalizationUtil;
|
||||
import com.arsdigita.web.ParameterMap;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.xml.Element;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jensp
|
||||
*/
|
||||
public class WorkspaceGridViewer extends SimpleContainer {
|
||||
|
||||
private WorkspaceSelectionAbstractModel workspaceModel;
|
||||
private ParameterSingleSelectionModel rowAction;
|
||||
private ParameterSingleSelectionModel rowModel;
|
||||
|
||||
private WorkspaceDetails workspaceDetails;
|
||||
private WorkspaceCreator workspaceCreator;
|
||||
private WorkspaceEditor workspaceEditor;
|
||||
private WorkspaceGridRowEditor workspaceGridRowEditor;
|
||||
|
||||
public WorkspaceGridViewer() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public WorkspaceGridViewer(final WorkspaceSelectionAbstractModel workspaceModel) {
|
||||
super("portal:gridWorkspace", WorkspacePage.PORTAL_XML_NS);
|
||||
|
||||
this.workspaceModel = workspaceModel;
|
||||
|
||||
rowAction = new ParameterSingleSelectionModel(new StringParameter("rowAction"));
|
||||
rowModel = new ParameterSingleSelectionModel(new StringParameter("selectedRow"));
|
||||
|
||||
workspaceDetails = new WorkspaceDetails(workspaceModel);
|
||||
workspaceEditor = new WorkspaceEditor();
|
||||
workspaceGridRowEditor = new WorkspaceGridRowEditor();
|
||||
|
||||
workspaceCreator = new WorkspaceCreator();
|
||||
add(workspaceCreator);
|
||||
|
||||
add(workspaceDetails);
|
||||
|
||||
add(workspaceEditor);
|
||||
|
||||
final SimpleContainer gridRowEditorContainer = new SimpleContainer(
|
||||
"portal:workspaceGridRowEditor", WorkspacePage.PORTAL_XML_NS) {
|
||||
|
||||
@Override
|
||||
public boolean isVisible(final PageState state) {
|
||||
return super.isVisible(state) && "edit".equals(rowAction.getSelectedKey(state));
|
||||
}
|
||||
|
||||
};
|
||||
add(gridRowEditorContainer);
|
||||
gridRowEditorContainer.add(workspaceGridRowEditor);
|
||||
|
||||
}
|
||||
|
||||
public WorkspaceSelectionAbstractModel getWorkspaceModel() {
|
||||
return workspaceModel;
|
||||
}
|
||||
|
||||
public void setWorkspaceModel(final WorkspaceSelectionAbstractModel workspaceModel) {
|
||||
this.workspaceModel = workspaceModel;
|
||||
workspaceDetails.setWorkspaceModel(workspaceModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(final Page page) {
|
||||
super.register(page);
|
||||
|
||||
page.addComponentStateParam(this, rowAction.getStateParameter());
|
||||
page.addComponentStateParam(this, rowModel.getStateParameter());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateXML(final PageState state, final Element parent) {
|
||||
if (isVisible(state)) {
|
||||
final Element content = generateParent(parent);
|
||||
|
||||
if (workspaceModel.getSelectedWorkspace(state) == null) {
|
||||
workspaceDetails.setVisible(state, false);
|
||||
workspaceCreator.setVisible(state, true);
|
||||
} else {
|
||||
workspaceDetails.setVisible(state, true);
|
||||
workspaceCreator.setVisible(state, false);
|
||||
}
|
||||
|
||||
if (rowModel.isSelected(state)) {
|
||||
content.addAttribute("selectedRow", (String) rowModel.getSelectedKey(state));
|
||||
}
|
||||
|
||||
generateChildrenXML(state, content);
|
||||
|
||||
if (workspaceModel.getSelectedWorkspace(state) != null) {
|
||||
|
||||
final WorkspacePageCollection pages = workspaceModel.getSelectedWorkspace(state).
|
||||
getPages();
|
||||
|
||||
final Element pagesElem = content.newChildElement("portal:rows",
|
||||
WorkspacePage.PORTAL_XML_NS);
|
||||
|
||||
while (pages.next()) {
|
||||
generateRowXML(pagesElem, state, pages.getPage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void generateRowXML(final Element pagesElem,
|
||||
final PageState state,
|
||||
final WorkspacePage row) {
|
||||
final Element rowElem = pagesElem.newChildElement("portal:row",
|
||||
WorkspacePage.PORTAL_XML_NS);
|
||||
|
||||
rowElem.addAttribute("id", row.getID().toString());
|
||||
rowElem.addAttribute("layout", row.getLayout().getFormat());
|
||||
rowElem.addAttribute("style", row.getLayout().getTitle());
|
||||
rowElem.addAttribute("title", row.getTitle());
|
||||
rowElem.addAttribute("description", row.getDescription());
|
||||
final HttpServletRequest request = state.getRequest();
|
||||
final String pathInfo = request.getPathInfo();
|
||||
final ParameterMap parameterMap = new ParameterMap(request);
|
||||
parameterMap.setParameter(rowAction.getStateParameter().getName(), "edit");
|
||||
parameterMap.setParameter(rowModel.getStateParameter().getName(), row.getID().toString());
|
||||
rowElem.addAttribute("editLink", URL.here(request, pathInfo, parameterMap).toString());
|
||||
|
||||
final PortletCollection portlets = row.getPortlets();
|
||||
final Element portletsElem = rowElem.newChildElement("portal:portlets",
|
||||
WorkspacePage.PORTAL_XML_NS);
|
||||
|
||||
while (portlets.next()) {
|
||||
generatePortletXML(portletsElem, state, portlets.getPortlet());
|
||||
}
|
||||
}
|
||||
|
||||
private void generatePortletXML(final Element portletsElem,
|
||||
final PageState state,
|
||||
final Portlet portlet) {
|
||||
final PortletRenderer renderer = portlet.getPortletRenderer();
|
||||
|
||||
renderer.generateXML(state, portletsElem);
|
||||
}
|
||||
|
||||
private class WorkspaceCreator extends SimpleContainer {
|
||||
|
||||
public WorkspaceCreator() {
|
||||
super("portal:workspaceCreator", WorkspacePage.PORTAL_XML_NS);
|
||||
|
||||
final Label info = new Label(GlobalizationUtil.globalize(
|
||||
"cw.workspace.ui.categorized.create_workspace.info"));
|
||||
add(info);
|
||||
|
||||
final ActionLink link = new ActionLink(new Label(GlobalizationUtil.globalize(
|
||||
"cw.workspace.ui.categorized.create_workspace.link")));
|
||||
link.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent event) {
|
||||
if (!canCreate()) {
|
||||
throw new AccessDeniedException(
|
||||
"Current party is not authorized to create a new portal workspace");
|
||||
}
|
||||
|
||||
final NavigationModel navModel = Navigation.getConfig().getDefaultModel();
|
||||
final Category category = navModel.getCategory();
|
||||
|
||||
final String workspaceUrl = String.format("workspace-%s-%s",
|
||||
category.getID().toString(),
|
||||
category.getURL());
|
||||
final String workspaceTitle = String.format("Workspace-%s-%s",
|
||||
category.getID().toString(),
|
||||
category.getName());
|
||||
final String workspaceDesc = String.format(
|
||||
"Portal Workspace for category %s (ID: %s).",
|
||||
category.getID().toString(),
|
||||
category.getName());
|
||||
|
||||
final Workspace workspace = Workspace.createWorkspace(workspaceUrl,
|
||||
workspaceTitle,
|
||||
null,
|
||||
true);
|
||||
workspace.setDescription(workspaceDesc);
|
||||
workspace.save();
|
||||
|
||||
category.addChild(workspace);
|
||||
}
|
||||
|
||||
});
|
||||
add(link);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible(final PageState state) {
|
||||
// final boolean visible = super.isVisible(state);
|
||||
//
|
||||
// return visible && canCreate();
|
||||
return workspaceModel.getSelectedWorkspace(state) == null && canCreate();
|
||||
}
|
||||
|
||||
public boolean canCreate() {
|
||||
final PartyCollection parties = Party.retrieveAllParties();
|
||||
parties.filter("Site-wide Administrators");
|
||||
parties.next();
|
||||
final Group admins = (Group) parties.getParty();
|
||||
parties.close();
|
||||
|
||||
final Party currentParty = Kernel.getContext().getParty();
|
||||
return currentParty != null && admins.hasMember(currentParty);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class WorkspaceEditor extends SimpleContainer {
|
||||
|
||||
public WorkspaceEditor() {
|
||||
super("portal:workspaceGridEditor", WorkspacePage.PORTAL_XML_NS);
|
||||
|
||||
final ActionLink addRowLink = new ActionLink(GlobalizationUtil.globalize(
|
||||
"cw.workspace.ui.categorized.workspace.add_row.link"));
|
||||
addRowLink.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent event) {
|
||||
final PageState state = event.getPageState();
|
||||
final Workspace workspace = workspaceModel.getSelectedWorkspace(state);
|
||||
final Party currentParty = Kernel.getContext().getParty();
|
||||
if (!PortalHelper.canCustomize(currentParty, workspace)) {
|
||||
throw new AccessDeniedException(
|
||||
"Current party has now permission to edit this workspace");
|
||||
}
|
||||
|
||||
final WorkspacePageCollection pages = workspace.getPages();
|
||||
final long size = pages.size();
|
||||
pages.close();
|
||||
|
||||
workspace.addPage(String.format("workspace-grid-row-%d", size + 1), "");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
add(addRowLink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible(final PageState state) {
|
||||
return workspaceModel.getSelectedWorkspace(state) != null && canEdit(state);
|
||||
}
|
||||
|
||||
public boolean canEdit(final PageState state) {
|
||||
return PortalHelper.canCustomize(Kernel.getContext().getParty(),
|
||||
workspaceModel.getSelectedWorkspace(state));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// private class GridRowSelectionModel extends AbstractSingleSelectionModel {
|
||||
//
|
||||
// private final RequestLocal selected;
|
||||
//
|
||||
// public GridRowSelectionModel() {
|
||||
// selected = new RequestLocal();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Object getSelectedKey(final PageState state) {
|
||||
// return selected.get(state);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setSelectedKey(final PageState state, final Object key) {
|
||||
// selected.set(state, key);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ParameterModel getStateParameter() {
|
||||
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
// }
|
||||
//
|
||||
// }
|
||||
private class WorkspaceGridRowEditor extends Form {
|
||||
|
||||
private final TextField key;
|
||||
|
||||
public WorkspaceGridRowEditor() {
|
||||
super("WordspaceGridRowEditor", new SimpleContainer());
|
||||
|
||||
final Label label = new Label();
|
||||
label.addPrintListener(new PrintListener() {
|
||||
|
||||
@Override
|
||||
public void prepare(final PrintEvent event) {
|
||||
final Label target = (Label) event.getTarget();
|
||||
|
||||
target.setLabel(rowModel.getStateParameter().getName());
|
||||
}
|
||||
|
||||
});
|
||||
add(label);
|
||||
|
||||
key = new TextField("key");
|
||||
add(key);
|
||||
|
||||
addInitListener(new FormInitListener() {
|
||||
|
||||
@Override
|
||||
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||
key.setValue(event.getPageState(),
|
||||
rowModel.getSelectedKey(event.getPageState()));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateXML(final PageState state, final Element parent) {
|
||||
super.generateXML(state, parent);
|
||||
|
||||
if (rowModel.isSelected(state)) {
|
||||
parent.addAttribute("selectedRow",
|
||||
(String) rowModel.getSelectedKey(state));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -66,6 +66,7 @@ public class WorkspaceViewer extends AbstractWorkspaceComponent {
|
|||
* @param portal
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected PortalList createPortalList(PortalSelectionModel portal) {
|
||||
return new PortalListViewer(portal);
|
||||
}
|
||||
|
|
@ -75,6 +76,7 @@ public class WorkspaceViewer extends AbstractWorkspaceComponent {
|
|||
* @param portal
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected PersistentPortal createPortalDisplay(PortalSelectionModel portal) {
|
||||
return new PersistentPortal(portal, WorkspacePage.MODE_DISPLAY);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue