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-ldn-subsite" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-forum" 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"/> <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-rss" version="6.6.0" relation="ge"/>
-->
<ccm:requires name="ccm-ldn-util" version="6.6.0" relation="ge"/> <ccm:requires name="ccm-ldn-util" version="6.6.0" relation="ge"/>
</ccm:dependencies> </ccm:dependencies>
<ccm:contacts> <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"/> <table name="cms_items"/>
<initializer class="com.arsdigita.cms.Initializer"/> <initializer class="com.arsdigita.cms.Initializer"/>
<initializer class="com.arsdigita.london.util.Initializer"/> <initializer class="com.arsdigita.london.util.Initializer"/>
<initializer class="com.arsdigita.london.navigation.Initializer"/>
<!--
<initializer class="com.arsdigita.london.rss.Initializer"/> <initializer class="com.arsdigita.london.rss.Initializer"/>
-->
</requires> </requires>
<provides> <provides>
<!-- <!--

View File

@ -30,17 +30,17 @@ import com.arsdigita.kernel.ResourceType;
import com.arsdigita.kernel.ResourceTypeConfig; import com.arsdigita.kernel.ResourceTypeConfig;
import com.arsdigita.kernel.ui.ResourceConfigComponent; import com.arsdigita.kernel.ui.ResourceConfigComponent;
import com.arsdigita.kernel.ui.ResourceConfigFormSection; import com.arsdigita.kernel.ui.ResourceConfigFormSection;
import com.arsdigita.london.navigation.ApplicationNavigationModel; // unused import
import com.arsdigita.london.navigation.DefaultNavigationModel; // 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.ApplicationDirectoryPortlet;
import com.arsdigita.london.portal.portlet.ContentDirectoryPortlet; import com.arsdigita.london.portal.portlet.ContentDirectoryPortlet;
import com.arsdigita.london.portal.portlet.FlashPortletInitializer; import com.arsdigita.london.portal.portlet.FlashPortletInitializer;
import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet; import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet;
import com.arsdigita.london.portal.portlet.LoginPortlet; 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.RSSFeedPortlet;
import com.arsdigita.london.portal.portlet.TimeOfDayPortlet; 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.MyWorkspacesPortlet;
import com.arsdigita.london.portal.portlet.WorkspaceNavigatorPortlet; import com.arsdigita.london.portal.portlet.WorkspaceNavigatorPortlet;
import com.arsdigita.london.portal.portlet.WorkspaceSummaryPortlet; import com.arsdigita.london.portal.portlet.WorkspaceSummaryPortlet;
@ -58,6 +58,9 @@ import com.arsdigita.runtime.PDLInitializer;
import com.arsdigita.runtime.RuntimeConfig; import com.arsdigita.runtime.RuntimeConfig;
import com.arsdigita.xml.XML; import com.arsdigita.xml.XML;
// import com.arsdigita.london.rss.portlet.WorkspaceDirectoryPortlet;
/** /**
* Initializes the Portal system * Initializes the Portal system
* *
@ -88,8 +91,8 @@ public class Initializer extends CompoundInitializer {
super.init(e); super.init(e);
XML.parse(Workspace.getConfig().getTraversalAdapters(), XML.parse(Workspace.getConfig().getTraversalAdapters(),
new TraversalHandler()); new TraversalHandler());
e.getFactory().registerInstantiator( e.getFactory().registerInstantiator(
Workspace.BASE_DATA_OBJECT_TYPE, Workspace.BASE_DATA_OBJECT_TYPE,
@ -115,6 +118,7 @@ public class Initializer extends CompoundInitializer {
} }
}); });
e.getFactory().registerInstantiator( e.getFactory().registerInstantiator(
ApplicationDirectoryPortlet.BASE_DATA_OBJECT_TYPE, ApplicationDirectoryPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() { 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( e.getFactory().registerInstantiator(
FreeformHTMLPortlet.BASE_DATA_OBJECT_TYPE, FreeformHTMLPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() { 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() { new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) { public DomainObject doNewInstance(DataObject dataObject) {
return new LoginPortlet(dataObject); return new LoginPortlet(dataObject);
@ -155,11 +152,11 @@ public class Initializer extends CompoundInitializer {
}); });
e.getFactory().registerInstantiator( e.getFactory().registerInstantiator(
TimeOfDayPortlet.BASE_DATA_OBJECT_TYPE, MyWorkspacesPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() { new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) { public DomainObject doNewInstance(DataObject dataObject) {
return new TimeOfDayPortlet(dataObject); return new MyWorkspacesPortlet(dataObject);
} }
}); });
e.getFactory().registerInstantiator( e.getFactory().registerInstantiator(
@ -171,13 +168,22 @@ public class Initializer extends CompoundInitializer {
}); });
e.getFactory().registerInstantiator( e.getFactory().registerInstantiator(
MyWorkspacesPortlet.BASE_DATA_OBJECT_TYPE, TimeOfDayPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() { new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) { 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( e.getFactory().registerInstantiator(
WorkspaceNavigatorPortlet.BASE_DATA_OBJECT_TYPE, WorkspaceNavigatorPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() { new ACSObjectInstantiator() {
@ -278,14 +284,14 @@ public class Initializer extends CompoundInitializer {
} }
}; };
NavigationDirectoryPortlet.registerInstantiator(); // NavigationDirectoryPortlet.registerInstantiator();
NavigationDirectoryPortlet.registerResourceTypeConfig(); // NavigationDirectoryPortlet.registerResourceTypeConfig();
FlashPortletInitializer.initialize(); FlashPortletInitializer.initialize();
// import from london.navigation required // import from london.navigation required
// causes horizontal dependency between portal and navigation // causes horizontal dependency between portal and navigation
ApplicationNavigationModel.register(Workspace.class.getName(), // ApplicationNavigationModel.register(Workspace.class.getName(),
new DefaultNavigationModel()); // 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.ContentDirectoryPortlet;
import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet; import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet;
import com.arsdigita.london.portal.portlet.LoginPortlet; 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.RSSFeedPortlet;
import com.arsdigita.london.portal.portlet.TimeOfDayPortlet; import com.arsdigita.london.portal.portlet.TimeOfDayPortlet;
import com.arsdigita.london.portal.portlet.WorkspaceDirectoryPortlet;
import com.arsdigita.portal.PortletType; import com.arsdigita.portal.PortletType;
import com.arsdigita.runtime.ScriptContext; import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
@ -96,14 +95,13 @@ public class Loader extends PackageLoader {
(String) get(m_title)); (String) get(m_title));
setupWorkspacePageType(); setupWorkspacePageType();
loadTimeOfDayPortlet(); loadApplicationDirectoryPortlet();
loadContentDirectoryPortlet(); loadContentDirectoryPortlet();
loadRSSFeedPortlet();
loadFreeformHTMLPortlet(); loadFreeformHTMLPortlet();
loadLoginPortlet(); loadLoginPortlet();
loadApplicationDirectoryPortlet(); loadRSSFeedPortlet();
loadWorkspaceDirectoryPortlet(); loadTimeOfDayPortlet();
NavigationDirectoryPortlet.loadPortletType(); // NavigationDirectoryPortlet.loadPortletType();
} }
}.run(); }.run();
} }
@ -178,15 +176,16 @@ public class Loader extends PackageLoader {
return type; return type;
} }
/**
/**
* *
*/ */
private void loadTimeOfDayPortlet() { private void loadApplicationDirectoryPortlet() {
PortletType type = PortletType.createPortletType("Time of Day", PortletType type = PortletType.createPortletType(
PortletType.WIDE_PROFILE, "Application Directory", PortletType.WIDE_PROFILE,
TimeOfDayPortlet.BASE_DATA_OBJECT_TYPE); ApplicationDirectoryPortlet.BASE_DATA_OBJECT_TYPE);
type.setDescription("Displays the current date and time"); type.setDescription("Displays a list of applications");
} }
private void loadContentDirectoryPortlet() { private void loadContentDirectoryPortlet() {
PortletType type = PortletType.createPortletType("Content Directory", PortletType type = PortletType.createPortletType("Content Directory",
@ -195,12 +194,6 @@ public class Loader extends PackageLoader {
type.setDescription("Displays the content directory categories"); 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() { private void loadFreeformHTMLPortlet() {
PortletType type = PortletType.createPortletType("Freeform HTML", PortletType type = PortletType.createPortletType("Freeform HTML",
PortletType.WIDE_PROFILE, PortletType.WIDE_PROFILE,
@ -214,17 +207,19 @@ public class Loader extends PackageLoader {
type.setDescription("Display a login form or user details"); type.setDescription("Display a login form or user details");
} }
private void loadApplicationDirectoryPortlet() { private void loadRSSFeedPortlet() {
PortletType type = PortletType.createPortletType( PortletType type = PortletType.createPortletType("RSS Feed",
"Application Directory", PortletType.WIDE_PROFILE, PortletType.WIDE_PROFILE, RSSFeedPortlet.BASE_DATA_OBJECT_TYPE);
ApplicationDirectoryPortlet.BASE_DATA_OBJECT_TYPE); type.setDescription("Displays an RSS Feed");
type.setDescription("Displays a list of applications");
} }
private void loadWorkspaceDirectoryPortlet() { /**
PortletType type = PortletType.createPortletType("Workspace Directory", *
*/
private void loadTimeOfDayPortlet() {
PortletType type = PortletType.createPortletType("Time of Day",
PortletType.WIDE_PROFILE, PortletType.WIDE_PROFILE,
WorkspaceDirectoryPortlet.BASE_DATA_OBJECT_TYPE); TimeOfDayPortlet.BASE_DATA_OBJECT_TYPE);
type.setDescription("Displays a list of workspaces"); 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.web.ApplicationCollection;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
/**
*
*
*/
public class ApplicationList extends SimpleContainer { public class ApplicationList extends SimpleContainer {
private static final Logger s_log = Logger.getLogger(ApplicationList.class); private static final Logger s_log = Logger.getLogger(ApplicationList.class);
@ -41,13 +45,21 @@ public class ApplicationList extends SimpleContainer {
private static final String SELECT = "select"; private static final String SELECT = "select";
public ApplicationList(ApplicationSelectionModel app) { /**
*
* @param app
*/
public ApplicationList(ApplicationSelectionModel app) {
super("portal:applicationList", PortalConstants.PORTAL_XML_NS); super("portal:applicationList", PortalConstants.PORTAL_XML_NS);
m_app = app; m_app = app;
} }
public void respond(PageState state) { /**
*
* @param state
*/
public void respond(PageState state) {
String key = state.getControlEventName(); String key = state.getControlEventName();
String value = state.getControlEventValue(); String value = state.getControlEventValue();
@ -62,7 +74,12 @@ public class ApplicationList extends SimpleContainer {
} }
} }
public void generateXML(PageState state, Element parent) { /**
*
* @param state
* @param parent
*/
public void generateXML(PageState state, Element parent) {
Element content = generateParent(parent); Element content = generateParent(parent);
ApplicationCollection apps = Application.retrieveAllApplications(); ApplicationCollection apps = Application.retrieveAllApplications();

View File

@ -42,30 +42,56 @@ public class ApplicationSelectionModel extends ACSObjectSelectionModel {
private static final Logger s_log = Logger private static final Logger s_log = Logger
.getLogger(ApplicationSelectionModel.class); .getLogger(ApplicationSelectionModel.class);
public ApplicationSelectionModel(BigDecimalParameter param, /**
boolean hasDefaultValue) { * Constructor
*
* @param param
* @param hasDefaultValue
*/
public ApplicationSelectionModel(BigDecimalParameter param,
boolean hasDefaultValue) {
super(param); super(param);
m_hasDefaultValue = hasDefaultValue; m_hasDefaultValue = hasDefaultValue;
} }
public ApplicationSelectionModel(boolean hasDefaultValue) { /**
*
* @param hasDefaultValue
*/
public ApplicationSelectionModel(boolean hasDefaultValue) {
this(new BigDecimalParameter(DEFAULT_PARAM_NAME), hasDefaultValue); this(new BigDecimalParameter(DEFAULT_PARAM_NAME), hasDefaultValue);
} }
public ApplicationSelectionModel(String param) { /**
*
* @param param
*/
public ApplicationSelectionModel(String param) {
this(new BigDecimalParameter(param), false); this(new BigDecimalParameter(param), false);
} }
public ApplicationSelectionModel(String param, boolean hasDefaultValue) { /**
*
* @param param
* @param hasDefaultValue
*/
public ApplicationSelectionModel(String param, boolean hasDefaultValue) {
this(new BigDecimalParameter(param), hasDefaultValue); this(new BigDecimalParameter(param), hasDefaultValue);
} }
public ApplicationSelectionModel() { /**
*
*/
public ApplicationSelectionModel() {
this(DEFAULT_PARAM_NAME, false); this(DEFAULT_PARAM_NAME, false);
} }
public Application getDefaultApplication() { /**
*
* @return
*/
public Application getDefaultApplication() {
Application app = Web.getContext().getApplication(); Application app = Web.getContext().getApplication();
// XXX just in case // XXX just in case
@ -86,7 +112,6 @@ public class ApplicationSelectionModel extends ACSObjectSelectionModel {
* Override ACSObjectSelectionModel methods to default to the default * Override ACSObjectSelectionModel methods to default to the default
* Application * Application
*/ */
public boolean isSelected(PageState state) { public boolean isSelected(PageState state) {
if (m_hasDefaultValue && !super.isSelected(state)) { if (m_hasDefaultValue && !super.isSelected(state)) {
return (getDefaultApplication() != null); return (getDefaultApplication() != null);
@ -94,7 +119,12 @@ public class ApplicationSelectionModel extends ACSObjectSelectionModel {
return super.isSelected(state); return super.isSelected(state);
} }
public DomainObject getSelectedObject(PageState state) { /**
*
* @param state
* @return
*/
public DomainObject getSelectedObject(PageState state) {
if (m_hasDefaultValue && !super.isSelected(state)) { if (m_hasDefaultValue && !super.isSelected(state)) {
return getDefaultApplication(); return getDefaultApplication();
} }
@ -102,7 +132,12 @@ public class ApplicationSelectionModel extends ACSObjectSelectionModel {
return super.getSelectedObject(state); return super.getSelectedObject(state);
} }
public Object getSelectedKey(PageState state) { /**
*
* @param state
* @return
*/
public Object getSelectedKey(PageState state) {
if (m_hasDefaultValue && !super.isSelected(state)) { if (m_hasDefaultValue && !super.isSelected(state)) {
return getDefaultApplication(); return getDefaultApplication();
} }
@ -114,7 +149,13 @@ public class ApplicationSelectionModel extends ACSObjectSelectionModel {
return (Application) getSelectedObject(state); return (Application) getSelectedObject(state);
} }
public void setSelectedApplication(PageState state, Application Application) { /**
* Utility method
*
* @param state
* @param Application
*/
public void setSelectedApplication(PageState state, Application Application) {
setSelectedObject(state, 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.london.portal.ui.PortalConstants;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
/**
*
*
*/
public class SiteMapPane extends SimpleContainer { public class SiteMapPane extends SimpleContainer {
private ApplicationSelectionModel m_app; private ApplicationSelectionModel m_app;
@ -38,7 +42,10 @@ public class SiteMapPane extends SimpleContainer {
private static final Logger s_log = Logger.getLogger(SiteMapPane.class); private static final Logger s_log = Logger.getLogger(SiteMapPane.class);
public SiteMapPane() { /**
* Constructor
*/
public SiteMapPane() {
setTag("portal:sitemap"); setTag("portal:sitemap");
setNamespace(PortalConstants.PORTAL_XML_NS); setNamespace(PortalConstants.PORTAL_XML_NS);
@ -52,14 +59,21 @@ public class SiteMapPane extends SimpleContainer {
add(m_appPane); add(m_appPane);
} }
public void register(Page p) { /**
*
* @param p
*/
public void register(Page p) {
super.register(p); super.register(p);
p.addGlobalStateParam(m_app.getStateParameter()); p.addGlobalStateParam(m_app.getStateParameter());
p.setVisibleDefault(m_appPane, false); p.setVisibleDefault(m_appPane, false);
} }
private class ApplicationEditListener implements ChangeListener { /**
*
*/
private class ApplicationEditListener implements ChangeListener {
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
PageState state = e.getPageState(); PageState state = e.getPageState();

View File

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

View File

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

View File

@ -22,6 +22,7 @@ import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.portal.PortletConfigFormSection;
import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.form.DHTMLEditor; import com.arsdigita.bebop.form.DHTMLEditor;
import com.arsdigita.bebop.form.TextArea; 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.kernel.ResourceType;
import com.arsdigita.london.portal.Workspace; import com.arsdigita.london.portal.Workspace;
import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet; 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; import com.arsdigita.portal.Portlet;
public class FreeformHTMLPortletEditor extends PortletConfigFormSection { 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.FormProcessException;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.portal.PortletConfigFormSection;
import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.form.Submit; import com.arsdigita.bebop.form.Submit;
import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.form.TextField;
@ -27,25 +28,42 @@ import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.kernel.ResourceType; import com.arsdigita.kernel.ResourceType;
import com.arsdigita.london.portal.portlet.RSSFeedPortlet; 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; import com.arsdigita.portal.Portlet;
/**
*
* @author pb
*/
public class RSSFeedPortletEditorForm extends PortletConfigFormSection { public class RSSFeedPortletEditorForm extends PortletConfigFormSection {
private TextField m_url; private TextField m_url;
private Submit m_browse; private Submit m_browse;
public RSSFeedPortletEditorForm(ResourceType resType, /**
*
* @param resType
* @param parentAppRL
*/
public RSSFeedPortletEditorForm(ResourceType resType,
RequestLocal parentAppRL) { RequestLocal parentAppRL) {
super(resType, parentAppRL); super(resType, parentAppRL);
} }
public RSSFeedPortletEditorForm(RequestLocal application) { /**
*
* @param application
*/
public RSSFeedPortletEditorForm(RequestLocal application) {
super(application); super(application);
} }
public void addWidgets() { /**
*
*/
public void addWidgets() {
super.addWidgets(); super.addWidgets();
m_url = new TextField(new StringParameter("url")); m_url = new TextField(new StringParameter("url"));
m_url.setSize(50); m_url.setSize(50);
@ -63,15 +81,31 @@ public class RSSFeedPortletEditorForm extends PortletConfigFormSection {
add(panel); add(panel);
} }
public boolean isBrowsePressed(PageState state) { /**
*
* @param state
* @return
*/
public boolean isBrowsePressed(PageState state) {
return m_browse.isSelected(state); return m_browse.isSelected(state);
} }
public void setFeedURL(PageState state, String url) { /**
*
* @param state
* @param url
*/
public void setFeedURL(PageState state, String url) {
m_url.setValue(state, url); m_url.setValue(state, url);
} }
public void initWidgets(PageState state, Portlet portlet) /**
*
* @param state
* @param portlet
* @throws FormProcessException
*/
public void initWidgets(PageState state, Portlet portlet)
throws FormProcessException { throws FormProcessException {
super.initWidgets(state, portlet); super.initWidgets(state, portlet);
@ -81,14 +115,26 @@ public class RSSFeedPortletEditorForm extends PortletConfigFormSection {
} }
} }
public void validateWidgets(PageState state, Portlet portlet) /**
*
* @param state
* @param portlet
* @throws FormProcessException
*/
public void validateWidgets(PageState state, Portlet portlet)
throws FormProcessException { throws FormProcessException {
super.validateWidgets(state, portlet); super.validateWidgets(state, portlet);
RSSFeedPortlet myportlet = (RSSFeedPortlet) portlet; RSSFeedPortlet myportlet = (RSSFeedPortlet) portlet;
} }
public void processWidgets(PageState state, Portlet portlet) /**
*
* @param state
* @param portlet
* @throws FormProcessException
*/
public void processWidgets(PageState state, Portlet portlet)
throws FormProcessException { throws FormProcessException {
super.processWidgets(state, portlet); 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 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.london.util.Transaction;
import com.arsdigita.packaging.Program; import com.arsdigita.packaging.Program;
@ -27,7 +27,7 @@ public class CreateNavigationDirectoryPortlet extends Program
{ {
protected void doRun() protected void doRun()
{ {
NavigationDirectoryPortlet.loadPortletType(); NavigationTreePortlet.loadPortletType();
} }
}.run(); }.run();
} }

View File

@ -4,7 +4,7 @@
xmlns:show="/WEB-INF/bebop-show.tld" xmlns:show="/WEB-INF/bebop-show.tld"
version="1.2"> version="1.2">
<%-- This page is used by class in method getChannel(PageState pageState) <%-- This page is used by class in method getChannel(PageState pageState)
com.arsdigita.london.portal.ui.WorkspaceDirectoryComponent --%> com.arsdigita.london.portal.ui.WorkspaceDirectoryComponent --%>
<jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/> <jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/>