Portlett WorkspeceDirectory nach ccm-ldn-rss verschoben, so dass keine

Abhängigkeit mehr besteht.

RssFeedPortlet bleibt in Portal und funkitioniert unabhängig von ccm-ldn-rss.
Kann verwendet werden, um externe RSS Feeds anzuzeigen. 

Portlent NavigationDirectory nach ccm-ldn-navigation verschoben, wo auch
andere Portlets vorhanden sind. 

Kleine Formatierungskorrekturen.


git-svn-id: https://svn.libreccm.org/ccm/trunk@391 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2010-04-24 21:52:15 +00:00
parent b645b42849
commit e76ea01d9c
23 changed files with 297 additions and 836 deletions

View File

@ -11,7 +11,9 @@
<ccm:requires name="ccm-ldn-subsite" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-forum" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-ldn-navigation" version="6.6.0" relation="ge"/>
<!-- TEST, workspace portlet relocated
<ccm:requires name="ccm-ldn-rss" version="6.6.0" relation="ge"/>
-->
<ccm:requires name="ccm-ldn-util" version="6.6.0" relation="ge"/>
</ccm:dependencies>
<ccm:contacts>

View File

@ -1,26 +0,0 @@
// Copyright (C) 2008 Permeance Technologies Pty Ltd. All Rights Reserved.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation; either version 2.1 of the License, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
model com.arsdigita.london.portal.portlet;
import com.arsdigita.london.navigation.Navigation;
import com.arsdigita.portal.Portlet;
object type NavigationDirectoryPortlet extends Portlet {
Navigation[1..1] navigation = join portlet_navigation_directory.navigation_id to nav_app.application_id;
Integer[1..1] depth = portlet_navigation_directory.depth INTEGER;
reference key (portlet_navigation_directory.portlet_id);
}

View File

@ -1,21 +0,0 @@
//
// Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
//
// The contents of this file are subject to the ArsDigita Public
// License (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of
// the License at http://www.arsdigita.com/ADPL.txt
//
// Software distributed under the License is distributed on an "AS
// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
// implied. See the License for the specific language governing
// rights and limitations under the License.
//
model com.arsdigita.london.portal.portlet;
import com.arsdigita.portal.Portlet;
object type WorkspaceDirectoryPortlet extends Portlet {
}

View File

@ -6,7 +6,10 @@
<table name="cms_items"/>
<initializer class="com.arsdigita.cms.Initializer"/>
<initializer class="com.arsdigita.london.util.Initializer"/>
<initializer class="com.arsdigita.london.navigation.Initializer"/>
<!--
<initializer class="com.arsdigita.london.rss.Initializer"/>
-->
</requires>
<provides>
<!--

View File

@ -30,17 +30,17 @@ import com.arsdigita.kernel.ResourceType;
import com.arsdigita.kernel.ResourceTypeConfig;
import com.arsdigita.kernel.ui.ResourceConfigComponent;
import com.arsdigita.kernel.ui.ResourceConfigFormSection;
import com.arsdigita.london.navigation.ApplicationNavigationModel;
import com.arsdigita.london.navigation.DefaultNavigationModel;
// unused import
// import com.arsdigita.london.navigation.ApplicationNavigationModel;
// import com.arsdigita.london.navigation.DefaultNavigationModel;
import com.arsdigita.london.portal.portlet.ApplicationDirectoryPortlet;
import com.arsdigita.london.portal.portlet.ContentDirectoryPortlet;
import com.arsdigita.london.portal.portlet.FlashPortletInitializer;
import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet;
import com.arsdigita.london.portal.portlet.LoginPortlet;
import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet;
// import com.arsdigita.london.navigation.portlet.NavigationDirectoryPortlet;
import com.arsdigita.london.portal.portlet.RSSFeedPortlet;
import com.arsdigita.london.portal.portlet.TimeOfDayPortlet;
import com.arsdigita.london.portal.portlet.WorkspaceDirectoryPortlet;
import com.arsdigita.london.portal.portlet.MyWorkspacesPortlet;
import com.arsdigita.london.portal.portlet.WorkspaceNavigatorPortlet;
import com.arsdigita.london.portal.portlet.WorkspaceSummaryPortlet;
@ -58,6 +58,9 @@ import com.arsdigita.runtime.PDLInitializer;
import com.arsdigita.runtime.RuntimeConfig;
import com.arsdigita.xml.XML;
// import com.arsdigita.london.rss.portlet.WorkspaceDirectoryPortlet;
/**
* Initializes the Portal system
*
@ -115,6 +118,7 @@ public class Initializer extends CompoundInitializer {
}
});
e.getFactory().registerInstantiator(
ApplicationDirectoryPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@ -131,14 +135,6 @@ public class Initializer extends CompoundInitializer {
}
});
e.getFactory().registerInstantiator(
WorkspaceDirectoryPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new WorkspaceDirectoryPortlet(dataObject);
}
});
e.getFactory().registerInstantiator(
FreeformHTMLPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@ -147,7 +143,8 @@ public class Initializer extends CompoundInitializer {
}
});
e.getFactory().registerInstantiator(LoginPortlet.BASE_DATA_OBJECT_TYPE,
e.getFactory().registerInstantiator(
LoginPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new LoginPortlet(dataObject);
@ -155,10 +152,10 @@ public class Initializer extends CompoundInitializer {
});
e.getFactory().registerInstantiator(
TimeOfDayPortlet.BASE_DATA_OBJECT_TYPE,
MyWorkspacesPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new TimeOfDayPortlet(dataObject);
return new MyWorkspacesPortlet(dataObject);
}
});
@ -171,13 +168,22 @@ public class Initializer extends CompoundInitializer {
});
e.getFactory().registerInstantiator(
MyWorkspacesPortlet.BASE_DATA_OBJECT_TYPE,
TimeOfDayPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new MyWorkspacesPortlet(dataObject);
return new TimeOfDayPortlet(dataObject);
}
});
// WorkspaceDirectoryPortlet, imports ccm-ldn-rss
// e.getFactory().registerInstantiator(
// WorkspaceDirectoryPortlet.BASE_DATA_OBJECT_TYPE,
// new ACSObjectInstantiator() {
// public DomainObject doNewInstance(DataObject dataObject) {
// return new WorkspaceDirectoryPortlet(dataObject);
// }
// });
e.getFactory().registerInstantiator(
WorkspaceNavigatorPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@ -278,14 +284,14 @@ public class Initializer extends CompoundInitializer {
}
};
NavigationDirectoryPortlet.registerInstantiator();
NavigationDirectoryPortlet.registerResourceTypeConfig();
// NavigationDirectoryPortlet.registerInstantiator();
// NavigationDirectoryPortlet.registerResourceTypeConfig();
FlashPortletInitializer.initialize();
// import from london.navigation required
// causes horizontal dependency between portal and navigation
ApplicationNavigationModel.register(Workspace.class.getName(),
new DefaultNavigationModel());
// ApplicationNavigationModel.register(Workspace.class.getName(),
// new DefaultNavigationModel());
}
}

View File

@ -28,10 +28,9 @@ import com.arsdigita.london.portal.portlet.ApplicationDirectoryPortlet;
import com.arsdigita.london.portal.portlet.ContentDirectoryPortlet;
import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet;
import com.arsdigita.london.portal.portlet.LoginPortlet;
import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet;
// import com.arsdigita.london.navigation.portlet.NavigationDirectoryPortlet;
import com.arsdigita.london.portal.portlet.RSSFeedPortlet;
import com.arsdigita.london.portal.portlet.TimeOfDayPortlet;
import com.arsdigita.london.portal.portlet.WorkspaceDirectoryPortlet;
import com.arsdigita.portal.PortletType;
import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.util.Assert;
@ -96,14 +95,13 @@ public class Loader extends PackageLoader {
(String) get(m_title));
setupWorkspacePageType();
loadTimeOfDayPortlet();
loadApplicationDirectoryPortlet();
loadContentDirectoryPortlet();
loadRSSFeedPortlet();
loadFreeformHTMLPortlet();
loadLoginPortlet();
loadApplicationDirectoryPortlet();
loadWorkspaceDirectoryPortlet();
NavigationDirectoryPortlet.loadPortletType();
loadRSSFeedPortlet();
loadTimeOfDayPortlet();
// NavigationDirectoryPortlet.loadPortletType();
}
}.run();
}
@ -178,14 +176,15 @@ public class Loader extends PackageLoader {
return type;
}
/**
*
*/
private void loadTimeOfDayPortlet() {
PortletType type = PortletType.createPortletType("Time of Day",
PortletType.WIDE_PROFILE,
TimeOfDayPortlet.BASE_DATA_OBJECT_TYPE);
type.setDescription("Displays the current date and time");
private void loadApplicationDirectoryPortlet() {
PortletType type = PortletType.createPortletType(
"Application Directory", PortletType.WIDE_PROFILE,
ApplicationDirectoryPortlet.BASE_DATA_OBJECT_TYPE);
type.setDescription("Displays a list of applications");
}
private void loadContentDirectoryPortlet() {
@ -195,12 +194,6 @@ public class Loader extends PackageLoader {
type.setDescription("Displays the content directory categories");
}
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 loadFreeformHTMLPortlet() {
PortletType type = PortletType.createPortletType("Freeform HTML",
PortletType.WIDE_PROFILE,
@ -214,17 +207,19 @@ public class Loader extends PackageLoader {
type.setDescription("Display a login form or user details");
}
private void loadApplicationDirectoryPortlet() {
PortletType type = PortletType.createPortletType(
"Application Directory", PortletType.WIDE_PROFILE,
ApplicationDirectoryPortlet.BASE_DATA_OBJECT_TYPE);
type.setDescription("Displays a list of applications");
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 loadWorkspaceDirectoryPortlet() {
PortletType type = PortletType.createPortletType("Workspace Directory",
/**
*
*/
private void loadTimeOfDayPortlet() {
PortletType type = PortletType.createPortletType("Time of Day",
PortletType.WIDE_PROFILE,
WorkspaceDirectoryPortlet.BASE_DATA_OBJECT_TYPE);
type.setDescription("Displays a list of workspaces");
TimeOfDayPortlet.BASE_DATA_OBJECT_TYPE);
type.setDescription("Displays the current date and time");
}
}

View File

@ -1,119 +0,0 @@
/*
* Copyright (C) 2008 Permeance Technologies Pty Ltd. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.london.portal.portlet;
import org.apache.log4j.Logger;
import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.kernel.ResourceType;
import com.arsdigita.kernel.ResourceTypeConfig;
import com.arsdigita.kernel.ui.ResourceConfigFormSection;
import com.arsdigita.london.navigation.Navigation;
import com.arsdigita.london.portal.ui.portlet.NavigationDirectoryPortletEditor;
import com.arsdigita.london.portal.ui.portlet.NavigationDirectoryPortletRenderer;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.portal.Portlet;
import com.arsdigita.portal.PortletType;
public class NavigationDirectoryPortlet extends Portlet
{
private static final Logger s_log = Logger.getLogger(NavigationDirectoryPortlet.class);
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet";
public static final String DEPTH = "depth";
public static final String NAVIGATION = "navigation";
public static void loadPortletType()
{
PortletType type = PortletType.createPortletType("Navigation Directory", PortletType.WIDE_PROFILE,
NavigationDirectoryPortlet.BASE_DATA_OBJECT_TYPE);
type.setDescription("Displays a directory of navigation categories");
s_log.info("Loading portlet type " + type);
}
public static void registerInstantiator()
{
DomainObjectFactory.registerInstantiator(BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator()
{
public DomainObject doNewInstance(DataObject dataObject)
{
return new NavigationDirectoryPortlet(dataObject);
}
});
}
public static void registerResourceTypeConfig()
{
new ResourceTypeConfig(BASE_DATA_OBJECT_TYPE)
{
public ResourceConfigFormSection getCreateFormSection(final ResourceType resType,
final RequestLocal parentAppRL)
{
return new NavigationDirectoryPortletEditor(resType, parentAppRL);
}
public ResourceConfigFormSection getModifyFormSection(final RequestLocal application)
{
return new NavigationDirectoryPortletEditor(application);
}
};
}
public NavigationDirectoryPortlet(DataObject dataObject)
{
super(dataObject);
}
public void setDepth(int depth)
{
set(DEPTH, new Integer(depth));
}
public int getDepth()
{
return ((Integer) get(DEPTH)).intValue();
}
public Navigation getNavigation()
{
return new Navigation((DataObject) get(NAVIGATION));
}
public void setNavigation(Navigation navigation)
{
set(NAVIGATION, navigation);
}
protected AbstractPortletRenderer doGetPortletRenderer()
{
return new NavigationDirectoryPortletRenderer(this);
}
protected String getBaseDataObjectType()
{
return BASE_DATA_OBJECT_TYPE;
}
}

View File

@ -1,99 +0,0 @@
/*
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.arsdigita.london.portal.portlet;
import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.Resource;
import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.london.portal.Workspace;
import com.arsdigita.london.rss.RSSChannel;
import com.arsdigita.london.rss.RSSImage;
import com.arsdigita.london.rss.RSSItem;
import com.arsdigita.london.rss.RSSItemCollection;
import com.arsdigita.london.rss.SimpleRSSItem;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationCollection;
import com.arsdigita.web.URL;
import com.arsdigita.web.Web;
public class WorkspaceDirectoryChannel implements RSSChannel {
private RSSImage m_image;
private Party m_party;
private String m_link;
public WorkspaceDirectoryChannel(Party party, String link, RSSImage image) {
m_image = image;
m_party = party;
m_link = link;
}
public String getTitle() {
return "Workspace Directory";
}
public String getLink() {
return m_link;
}
public String getDescription() {
return "Workspace Directory for "
+ (m_party == null ? "The Public" : m_party.getDisplayName());
}
public RSSImage getImage() {
return m_image;
}
public RSSItemCollection getItems() {
Application current = Web.getContext().getApplication();
ApplicationCollection workspaces = Application
.retrieveAllApplications();
workspaces.addEqualsFilter(ACSObject.OBJECT_TYPE,
Workspace.BASE_DATA_OBJECT_TYPE);
workspaces.addNotEqualsFilter(ACSObject.ID, current.getID());
workspaces.addOrder(Resource.TITLE);
PermissionService.filterObjects(workspaces, PrivilegeDescriptor.READ,
m_party == null ? null : m_party.getOID());
return new WorkspaceItemCollection(workspaces);
}
private class WorkspaceItemCollection implements RSSItemCollection {
private ApplicationCollection m_workspaces;
public WorkspaceItemCollection(ApplicationCollection workspaces) {
m_workspaces = workspaces;
}
public boolean next() {
return m_workspaces.next();
}
public RSSItem getItem() {
Application app = m_workspaces.getApplication();
return new SimpleRSSItem(app.getTitle(), URL.there(app, "/", null)
.toString(), app.getDescription());
}
}
}

View File

@ -1,46 +0,0 @@
/*
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
*
* The contents of this file are subject to the ArsDigita Public
* License (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of
* the License at http://www.arsdigita.com/ADPL.txt
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
*/
package com.arsdigita.london.portal.portlet;
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
import com.arsdigita.london.portal.ui.portlet.WorkspaceDirectoryPortletRenderer;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.portal.Portlet;
/**
* Workspace Directory Portlet - unknown functionality
*
* @version $Id: WorkspaceDirectoryPortlet.java 1174 2006-06-14 14:14:15Z fabrice $
*/
public class WorkspaceDirectoryPortlet extends Portlet {
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.london.portal.portlet.WorkspaceDirectoryPortlet";
public static final String CONTENT = "content";
public WorkspaceDirectoryPortlet(DataObject dataObject) {
super(dataObject);
}
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
protected AbstractPortletRenderer doGetPortletRenderer() {
return new WorkspaceDirectoryPortletRenderer(this);
}
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
*
* The contents of this file are subject to the ArsDigita Public
* License (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of
* the License at http://www.arsdigita.com/ADPL.txt
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
*/
package com.arsdigita.london.portal.ui;
import com.arsdigita.bebop.PageState;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.london.portal.portlet.WorkspaceDirectoryChannel;
import com.arsdigita.london.rss.RSSChannel;
import com.arsdigita.london.rss.ui.RSSComponent;
import com.arsdigita.web.Application;
public class WorkspaceDirectoryComponent extends RSSComponent {
public WorkspaceDirectoryComponent() {
super("portal:workspaceDirectory", PortalConstants.PORTAL_XML_NS);
}
protected RSSChannel getChannel(PageState pageState) {
Application current = (Application) Kernel.getContext().getResource();
WorkspaceDirectoryChannel channel = new WorkspaceDirectoryChannel(
Kernel.getContext().getParty(), current.getPath()
+ "/workspaces.jsp", null);
return channel;
}
}

View File

@ -33,6 +33,10 @@ import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationCollection;
import com.arsdigita.xml.Element;
/**
*
*
*/
public class ApplicationList extends SimpleContainer {
private static final Logger s_log = Logger.getLogger(ApplicationList.class);
@ -41,12 +45,20 @@ public class ApplicationList extends SimpleContainer {
private static final String SELECT = "select";
/**
*
* @param app
*/
public ApplicationList(ApplicationSelectionModel app) {
super("portal:applicationList", PortalConstants.PORTAL_XML_NS);
m_app = app;
}
/**
*
* @param state
*/
public void respond(PageState state) {
String key = state.getControlEventName();
String value = state.getControlEventValue();
@ -62,6 +74,11 @@ public class ApplicationList extends SimpleContainer {
}
}
/**
*
* @param state
* @param parent
*/
public void generateXML(PageState state, Element parent) {
Element content = generateParent(parent);

View File

@ -42,6 +42,12 @@ public class ApplicationSelectionModel extends ACSObjectSelectionModel {
private static final Logger s_log = Logger
.getLogger(ApplicationSelectionModel.class);
/**
* Constructor
*
* @param param
* @param hasDefaultValue
*/
public ApplicationSelectionModel(BigDecimalParameter param,
boolean hasDefaultValue) {
super(param);
@ -49,22 +55,42 @@ public class ApplicationSelectionModel extends ACSObjectSelectionModel {
m_hasDefaultValue = hasDefaultValue;
}
/**
*
* @param hasDefaultValue
*/
public ApplicationSelectionModel(boolean hasDefaultValue) {
this(new BigDecimalParameter(DEFAULT_PARAM_NAME), hasDefaultValue);
}
/**
*
* @param param
*/
public ApplicationSelectionModel(String param) {
this(new BigDecimalParameter(param), false);
}
/**
*
* @param param
* @param hasDefaultValue
*/
public ApplicationSelectionModel(String param, boolean hasDefaultValue) {
this(new BigDecimalParameter(param), hasDefaultValue);
}
/**
*
*/
public ApplicationSelectionModel() {
this(DEFAULT_PARAM_NAME, false);
}
/**
*
* @return
*/
public Application getDefaultApplication() {
Application app = Web.getContext().getApplication();
@ -86,7 +112,6 @@ public class ApplicationSelectionModel extends ACSObjectSelectionModel {
* Override ACSObjectSelectionModel methods to default to the default
* Application
*/
public boolean isSelected(PageState state) {
if (m_hasDefaultValue && !super.isSelected(state)) {
return (getDefaultApplication() != null);
@ -94,6 +119,11 @@ public class ApplicationSelectionModel extends ACSObjectSelectionModel {
return super.isSelected(state);
}
/**
*
* @param state
* @return
*/
public DomainObject getSelectedObject(PageState state) {
if (m_hasDefaultValue && !super.isSelected(state)) {
return getDefaultApplication();
@ -102,6 +132,11 @@ public class ApplicationSelectionModel extends ACSObjectSelectionModel {
return super.getSelectedObject(state);
}
/**
*
* @param state
* @return
*/
public Object getSelectedKey(PageState state) {
if (m_hasDefaultValue && !super.isSelected(state)) {
return getDefaultApplication();
@ -114,6 +149,12 @@ public class ApplicationSelectionModel extends ACSObjectSelectionModel {
return (Application) getSelectedObject(state);
}
/**
* Utility method
*
* @param state
* @param Application
*/
public void setSelectedApplication(PageState state, Application Application) {
setSelectedObject(state, Application);
}

View File

@ -28,6 +28,10 @@ import com.arsdigita.bebop.event.ChangeListener;
import com.arsdigita.london.portal.ui.PortalConstants;
import com.arsdigita.web.Application;
/**
*
*
*/
public class SiteMapPane extends SimpleContainer {
private ApplicationSelectionModel m_app;
@ -38,6 +42,9 @@ public class SiteMapPane extends SimpleContainer {
private static final Logger s_log = Logger.getLogger(SiteMapPane.class);
/**
* Constructor
*/
public SiteMapPane() {
setTag("portal:sitemap");
setNamespace(PortalConstants.PORTAL_XML_NS);
@ -52,6 +59,10 @@ public class SiteMapPane extends SimpleContainer {
add(m_appPane);
}
/**
*
* @param p
*/
public void register(Page p) {
super.register(p);
@ -59,6 +70,9 @@ public class SiteMapPane extends SimpleContainer {
p.setVisibleDefault(m_appPane, false);
}
/**
*
*/
private class ApplicationEditListener implements ChangeListener {
public void stateChanged(ChangeEvent e) {
PageState state = e.getPageState();

View File

@ -26,6 +26,7 @@ import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.portal.PortletConfigFormSection;
import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
@ -39,7 +40,8 @@ import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.kernel.ResourceType;
import com.arsdigita.london.portal.portlet.ContentDirectoryPortlet;
import com.arsdigita.london.portal.ui.PortletConfigFormSection;
// @deprecated use com.arsdigita.bebop.portal.PortletConfigFormSection
// import com.arsdigita.london.portal.ui.PortletConfigFormSection;
import com.arsdigita.london.util.Categorization;
import com.arsdigita.persistence.OID;
import com.arsdigita.portal.Portlet;
@ -47,6 +49,10 @@ import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.web.Application;
import com.arsdigita.web.Web;
/**
*
*
*/
public class ContentDirectoryPortletEditor extends PortletConfigFormSection {
private static final Logger s_log = Logger
@ -58,15 +64,27 @@ public class ContentDirectoryPortletEditor extends PortletConfigFormSection {
private SingleSelect m_depth;
/**
* Constructor
* @param resType
* @param parentAppRL
*/
public ContentDirectoryPortletEditor(ResourceType resType,
RequestLocal parentAppRL) {
super(resType, parentAppRL);
}
/**
*
* @param application
*/
public ContentDirectoryPortletEditor(RequestLocal application) {
super(application);
}
/**
*
*/
public void addWidgets() {
super.addWidgets();
@ -95,6 +113,12 @@ public class ContentDirectoryPortletEditor extends PortletConfigFormSection {
add(m_depth);
}
/**
*
* @param state
* @param portlet
* @throws FormProcessException
*/
public void initWidgets(PageState state, Portlet portlet)
throws FormProcessException {
super.initWidgets(state, portlet);
@ -108,6 +132,12 @@ public class ContentDirectoryPortletEditor extends PortletConfigFormSection {
}
}
/**
*
* @param state
* @param portlet
* @throws FormProcessException
*/
public void processWidgets(PageState state, Portlet portlet)
throws FormProcessException {
super.processWidgets(state, portlet);
@ -127,10 +157,17 @@ public class ContentDirectoryPortletEditor extends PortletConfigFormSection {
myportlet.setRoot(root);
}
/**
*
* @return
*/
protected String getUseContext() {
return null;
}
/**
*
*/
private class CategoryPrintListener implements PrintListener {
public void prepare(PrintEvent e) {
SingleSelect target = (SingleSelect) e.getTarget();

View File

@ -42,10 +42,20 @@ public class ContentDirectoryPortletRenderer extends AbstractPortletRenderer {
private ContentDirectoryPortlet m_portlet;
/**
* Constructor.
*
* @param portlet
*/
public ContentDirectoryPortletRenderer(ContentDirectoryPortlet portlet) {
m_portlet = portlet;
}
/**
*
* @param state
* @param parent
*/
public void generateBodyXML(PageState state, Element parent) {
Element element = parent.newChildElement("portlet:contentDirectory",
PortalConstants.PORTLET_XML_NS);
@ -82,6 +92,14 @@ public class ContentDirectoryPortletRenderer extends AbstractPortletRenderer {
processChildren(element, root, children, 1, m_portlet.getDepth());
}
/**
*
* @param parent
* @param cat
* @param children
* @param depth
* @param maxDepth
*/
public void processChildren(Element parent, Category cat, Map children,
int depth, int maxDepth) {
if (depth <= maxDepth) {
@ -105,6 +123,13 @@ public class ContentDirectoryPortletRenderer extends AbstractPortletRenderer {
}
}
/**
*
* @param cat
* @param depth
* @param childSortKey
* @return
*/
public Element generateCategory(Category cat, int depth,
BigDecimal childSortKey) {
Element el = new Element(depth == 1 ? "portlet:contentDirectoryEntry"
@ -120,6 +145,11 @@ public class ContentDirectoryPortletRenderer extends AbstractPortletRenderer {
return el;
}
/**
*
* @param oid
* @return
*/
public static String redirectURL(OID oid) {
ParameterMap map = new ParameterMap();
map.setParameter("oid", oid.toString());
@ -130,6 +160,9 @@ public class ContentDirectoryPortletRenderer extends AbstractPortletRenderer {
.getServerPort(), "", "", "/redirect/", map)).toString();
}
/**
*
*/
private class CategorySortKeyPair implements Comparable {
private Category m_category;

View File

@ -22,6 +22,7 @@ import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.portal.PortletConfigFormSection;
import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.form.DHTMLEditor;
import com.arsdigita.bebop.form.TextArea;
@ -33,7 +34,8 @@ import com.arsdigita.cms.ui.authoring.TextAssetBody.PageTextForm;
import com.arsdigita.kernel.ResourceType;
import com.arsdigita.london.portal.Workspace;
import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet;
import com.arsdigita.london.portal.ui.PortletConfigFormSection;
// @deprecated use com.arsdigita.bebop.portal.PortletConfigFormSection
// import com.arsdigita.london.portal.ui.PortletConfigFormSection;
import com.arsdigita.portal.Portlet;
public class FreeformHTMLPortletEditor extends PortletConfigFormSection {

View File

@ -1,160 +0,0 @@
/*
* Copyright (C) 2008 Permeance Technologies Pty Ltd. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.london.portal.ui.portlet;
import java.math.BigDecimal;
import java.util.TooManyListenersException;
import org.apache.log4j.Logger;
import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.parameters.IntegerParameter;
import com.arsdigita.cms.TemplateContext;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainCollection;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.kernel.ResourceType;
import com.arsdigita.london.navigation.Navigation;
import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet;
import com.arsdigita.london.portal.ui.PortletConfigFormSection;
import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.portal.Portlet;
import com.arsdigita.util.UncheckedWrapperException;
/**
* Editor for a {@link NavigationDirectoryPortlet}.
*
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
*/
public class NavigationDirectoryPortletEditor extends PortletConfigFormSection
{
private static final Logger s_log = Logger.getLogger(NavigationDirectoryPortletEditor.class);
private SingleSelect m_root;
private SingleSelect m_depth;
public NavigationDirectoryPortletEditor(ResourceType resType, RequestLocal parentAppRL)
{
super(resType, parentAppRL);
}
public NavigationDirectoryPortletEditor(RequestLocal application)
{
super(application);
}
public void addWidgets()
{
super.addWidgets();
try
{
m_root = new SingleSelect(new BigDecimalParameter("navigation"));
m_root.addPrintListener(new CategoryPrintListener());
}
catch (TooManyListenersException ex)
{
throw new UncheckedWrapperException("this cannot happen", ex);
}
m_depth = new SingleSelect(new IntegerParameter("depth"));
m_depth.addOption(new Option("1", "1 Level"));
m_depth.addOption(new Option("2", "2 Levels"));
add(new Label("Navigation:", Label.BOLD), ColumnPanel.RIGHT);
add(m_root);
add(new Label("Depth:", Label.BOLD), ColumnPanel.RIGHT);
add(m_depth);
}
public void initWidgets(PageState state, Portlet portlet) throws FormProcessException
{
super.initWidgets(state, portlet);
if (portlet != null)
{
NavigationDirectoryPortlet myportlet = (NavigationDirectoryPortlet) portlet;
m_root.setValue(state, myportlet.getNavigation().getID());
m_depth.setValue(state, new Integer(myportlet.getDepth()));
}
}
public void processWidgets(PageState state, Portlet portlet) throws FormProcessException
{
super.processWidgets(state, portlet);
NavigationDirectoryPortlet myportlet = (NavigationDirectoryPortlet) portlet;
myportlet.setDepth(((Integer) m_depth.getValue(state)).intValue());
BigDecimal id = (BigDecimal) m_root.getValue(state);
try
{
Navigation root = (Navigation) DomainObjectFactory.newInstance(new OID(Navigation.BASE_DATA_OBJECT_TYPE, id));
myportlet.setNavigation(root);
}
catch (DataObjectNotFoundException ex)
{
throw new UncheckedWrapperException("cannot find category", ex);
}
}
protected String getUseContext()
{
TemplateContext ctx = Navigation.getContext().getTemplateContext();
String context = (ctx == null ? null : ctx.getContext());
return context;
}
private class CategoryPrintListener implements PrintListener
{
public void prepare(PrintEvent e)
{
SingleSelect target = (SingleSelect) e.getTarget();
DomainCollection navigations = new DomainCollection(SessionManager.getSession().retrieve(
Navigation.BASE_DATA_OBJECT_TYPE));
try
{
while (navigations.next())
{
Navigation navigation = (Navigation) navigations.getDomainObject();
target.addOption(new Option(navigation.getID().toString(), navigation.getPath()));
}
}
finally
{
navigations.close();
}
}
}
}

View File

@ -1,175 +0,0 @@
/*
* Copyright (C) 2008 Permeance Technologies Pty Ltd. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.london.portal.ui.portlet;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeSet;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
import com.arsdigita.categorization.Category;
import com.arsdigita.categorization.CategoryCollection;
import com.arsdigita.cms.TemplateContext;
import com.arsdigita.london.navigation.Navigation;
import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet;
import com.arsdigita.london.portal.ui.PortalConstants;
import com.arsdigita.persistence.OID;
import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.URL;
import com.arsdigita.web.Web;
import com.arsdigita.xml.Element;
import com.arsdigita.xml.XML;
/**
* Renders a {@link NavigationDirectoryPortlet}.
*
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
*/
public class NavigationDirectoryPortletRenderer extends AbstractPortletRenderer
{
private final NavigationDirectoryPortlet m_portlet;
public NavigationDirectoryPortletRenderer(NavigationDirectoryPortlet portlet)
{
m_portlet = portlet;
}
public void generateBodyXML(PageState state, Element parent)
{
Element element = parent.newChildElement("portlet:contentDirectory", PortalConstants.PORTLET_XML_NS);
element.addAttribute("id", getIdAttr());
TemplateContext ctx = Navigation.getContext().getTemplateContext();
String context = (ctx == null ? null : ctx.getContext());
Category root = Category.getRootForObject(m_portlet.getNavigation(), context);
if (root == null)
{
root = Category.getRootForObject(m_portlet.getNavigation());
}
if (!root.isEnabled())
{
return;
}
CategoryCollection cats = root.getDescendants();
cats.addEqualsFilter("parents.link.relationType", "child");
cats.addPath("parents.link.sortKey");
cats.addPath("parents.id");
cats.addOrder("parents.link.sortKey");
Map children = new HashMap();
while (cats.next())
{
Category cat = cats.getCategory();
BigDecimal parentID = (BigDecimal) cats.get("parents.id");
TreeSet childList = (TreeSet) children.get(parentID);
if (childList == null)
{
childList = new TreeSet();
children.put(parentID, childList);
}
childList.add(new CategorySortKeyPair(cat, (BigDecimal) cats.get("parents.link.sortKey")));
}
processChildren(element, root, children, 1, m_portlet.getDepth());
}
public void processChildren(Element parent, Category cat, Map children, int depth, int maxDepth)
{
if (depth <= maxDepth)
{
TreeSet c = (TreeSet) children.get(cat.getID());
if (c != null)
{
Iterator i = c.iterator();
while (i.hasNext())
{
CategorySortKeyPair pair = (CategorySortKeyPair) i.next();
Category child = pair.getCategory();
BigDecimal childSortKey = pair.getSortKey();
if (child.isEnabled())
{
Element el = generateCategory(child, depth, childSortKey);
parent.addContent(el);
processChildren(el, child, children, depth + 1, maxDepth);
}
}
}
}
}
public Element generateCategory(Category cat, int depth, BigDecimal childSortKey)
{
Element el = new Element(depth == 1 ? "portlet:contentDirectoryEntry" : "portlet:contentDirectorySubentry",
PortalConstants.PORTLET_XML_NS);
el.addAttribute("id", XML.format(cat.getID()));
el.addAttribute("name", cat.getName());
el.addAttribute("description", cat.getDescription());
el.addAttribute("isAbstract", cat.isAbstract() ? "1" : "0");
el.addAttribute("url", redirectURL(cat.getOID()));
el.addAttribute("sortKey", XML.format(childSortKey));
return el;
}
public static String redirectURL(OID oid)
{
ParameterMap map = new ParameterMap();
map.setParameter("oid", oid.toString());
URL here = Web.getContext().getRequestURL();
return (new URL(here.getScheme(), here.getServerName(), here.getServerPort(), "", "", "/redirect/", map)).toString();
}
private class CategorySortKeyPair implements Comparable
{
private Category m_category;
private BigDecimal m_sortKey;
public CategorySortKeyPair(Category category, BigDecimal sortKey)
{
m_category = category;
m_sortKey = sortKey;
}
public Category getCategory()
{
return m_category;
}
public BigDecimal getSortKey()
{
return m_sortKey;
}
public int compareTo(Object o)
{
return m_sortKey.compareTo(((CategorySortKeyPair) o).m_sortKey);
}
}
}

View File

@ -20,6 +20,7 @@ import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.portal.PortletConfigFormSection;
import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.form.Submit;
import com.arsdigita.bebop.form.TextField;
@ -27,24 +28,41 @@ import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.kernel.ResourceType;
import com.arsdigita.london.portal.portlet.RSSFeedPortlet;
import com.arsdigita.london.portal.ui.PortletConfigFormSection;
// @deprecated use com.arsdigita.bebop.portal.PortletConfigFormSection
// import com.arsdigita.london.portal.ui.PortletConfigFormSection;
import com.arsdigita.portal.Portlet;
/**
*
* @author pb
*/
public class RSSFeedPortletEditorForm extends PortletConfigFormSection {
private TextField m_url;
private Submit m_browse;
/**
*
* @param resType
* @param parentAppRL
*/
public RSSFeedPortletEditorForm(ResourceType resType,
RequestLocal parentAppRL) {
super(resType, parentAppRL);
}
/**
*
* @param application
*/
public RSSFeedPortletEditorForm(RequestLocal application) {
super(application);
}
/**
*
*/
public void addWidgets() {
super.addWidgets();
m_url = new TextField(new StringParameter("url"));
@ -63,14 +81,30 @@ public class RSSFeedPortletEditorForm extends PortletConfigFormSection {
add(panel);
}
/**
*
* @param state
* @return
*/
public boolean isBrowsePressed(PageState state) {
return m_browse.isSelected(state);
}
/**
*
* @param state
* @param url
*/
public void setFeedURL(PageState state, String url) {
m_url.setValue(state, url);
}
/**
*
* @param state
* @param portlet
* @throws FormProcessException
*/
public void initWidgets(PageState state, Portlet portlet)
throws FormProcessException {
super.initWidgets(state, portlet);
@ -81,6 +115,12 @@ public class RSSFeedPortletEditorForm extends PortletConfigFormSection {
}
}
/**
*
* @param state
* @param portlet
* @throws FormProcessException
*/
public void validateWidgets(PageState state, Portlet portlet)
throws FormProcessException {
super.validateWidgets(state, portlet);
@ -88,6 +128,12 @@ public class RSSFeedPortletEditorForm extends PortletConfigFormSection {
RSSFeedPortlet myportlet = (RSSFeedPortlet) portlet;
}
/**
*
* @param state
* @param portlet
* @throws FormProcessException
*/
public void processWidgets(PageState state, Portlet portlet)
throws FormProcessException {
super.processWidgets(state, portlet);

View File

@ -1,50 +0,0 @@
/*
* Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved.
*
* The contents of this file are subject to the ArsDigita Public
* License (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of
* the License at http://www.arsdigita.com/ADPL.txt
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
*/
package com.arsdigita.london.portal.ui.portlet;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.london.portal.portlet.WorkspaceDirectoryChannel;
import com.arsdigita.london.portal.portlet.WorkspaceDirectoryPortlet;
import com.arsdigita.london.portal.ui.PortalConstants;
import com.arsdigita.london.rss.RSSRenderer;
import com.arsdigita.web.Application;
import com.arsdigita.web.URL;
import com.arsdigita.web.Web;
import com.arsdigita.xml.Element;
public class WorkspaceDirectoryPortletRenderer extends AbstractPortletRenderer {
private WorkspaceDirectoryPortlet m_portlet;
public WorkspaceDirectoryPortletRenderer(WorkspaceDirectoryPortlet portlet) {
m_portlet = portlet;
}
protected void generateBodyXML(PageState pageState, Element parentElement) {
Element content = new Element("portlet:workspaceDirectory",
PortalConstants.PORTLET_XML_NS);
Application current = Web.getContext().getApplication();
WorkspaceDirectoryChannel channel = new WorkspaceDirectoryChannel(
Kernel.getContext().getParty(), URL.there(current, "/", null)
.toString(), null);
content.addContent(RSSRenderer.generateXML(channel));
parentElement.addContent(content);
}
}

View File

@ -2,7 +2,7 @@ package com.arsdigita.london.portal.upgrade;
import org.apache.commons.cli.CommandLine;
import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet;
import com.arsdigita.london.navigation.portlet.NavigationTreePortlet;
import com.arsdigita.london.util.Transaction;
import com.arsdigita.packaging.Program;
@ -27,7 +27,7 @@ public class CreateNavigationDirectoryPortlet extends Program
{
protected void doRun()
{
NavigationDirectoryPortlet.loadPortletType();
NavigationTreePortlet.loadPortletType();
}
}.run();
}