Portlet WorkspaceDirectory aus ccm-ldn-portal verschoben, so dass keine Abhängigkeit mehr besteht.
git-svn-id: https://svn.libreccm.org/ccm/trunk@393 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
6488c59df5
commit
7075eddb5b
|
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// 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 {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -18,13 +18,49 @@
|
||||||
|
|
||||||
package com.arsdigita.london.rss;
|
package com.arsdigita.london.rss;
|
||||||
|
|
||||||
|
import com.arsdigita.domain.DomainObjectInstantiator;
|
||||||
|
|
||||||
import com.arsdigita.db.DbHelper;
|
import com.arsdigita.db.DbHelper;
|
||||||
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.kernel.ACSObjectInstantiator;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.pdl.ManifestSource;
|
import com.arsdigita.persistence.pdl.ManifestSource;
|
||||||
import com.arsdigita.persistence.pdl.NameFilter;
|
import com.arsdigita.persistence.pdl.NameFilter;
|
||||||
import com.arsdigita.runtime.CompoundInitializer;
|
import com.arsdigita.runtime.CompoundInitializer;
|
||||||
|
import com.arsdigita.runtime.DomainInitEvent;
|
||||||
import com.arsdigita.runtime.LegacyInitializer;
|
import com.arsdigita.runtime.LegacyInitializer;
|
||||||
import com.arsdigita.runtime.PDLInitializer;
|
import com.arsdigita.runtime.PDLInitializer;
|
||||||
import com.arsdigita.runtime.RuntimeConfig;
|
import com.arsdigita.runtime.RuntimeConfig;
|
||||||
|
import com.arsdigita.london.rss.portlet.WorkspaceDirectoryPortlet;
|
||||||
|
|
||||||
|
// import com.arsdigita.bebop.RequestLocal;
|
||||||
|
// import com.arsdigita.domain.DomainObjectInstantiator;
|
||||||
|
// import com.arsdigita.domain.xml.TraversalHandler;
|
||||||
|
// 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;
|
||||||
|
// 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.portal.portlet.RSSFeedPortlet;
|
||||||
|
// import com.arsdigita.london.portal.portlet.TimeOfDayPortlet;
|
||||||
|
// import com.arsdigita.london.portal.portlet.MyWorkspacesPortlet;
|
||||||
|
// import com.arsdigita.london.portal.portlet.WorkspaceNavigatorPortlet;
|
||||||
|
// import com.arsdigita.london.portal.portlet.WorkspaceSummaryPortlet;
|
||||||
|
// import com.arsdigita.london.portal.ui.admin.WorkspaceConfigFormSection;
|
||||||
|
// import com.arsdigita.london.portal.ui.portlet.ContentDirectoryPortletEditor;
|
||||||
|
// import com.arsdigita.london.portal.ui.portlet.FreeformHTMLPortletEditor;
|
||||||
|
// import com.arsdigita.london.portal.ui.portlet.RSSFeedPortletEditor;
|
||||||
|
// import com.arsdigita.london.portal.ui.portlet.RSSFeedPortletEditorForm;
|
||||||
|
// import com.arsdigita.xml.XML;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CMS initializer.
|
* The CMS initializer.
|
||||||
|
|
@ -45,4 +81,22 @@ public class Initializer extends CompoundInitializer {
|
||||||
|
|
||||||
add(new LegacyInitializer("com/arsdigita/london/rss/enterprise.init"));
|
add(new LegacyInitializer("com/arsdigita/london/rss/enterprise.init"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
public void init(DomainInitEvent e) {
|
||||||
|
|
||||||
|
super.init(e);
|
||||||
|
|
||||||
|
|
||||||
|
e.getFactory().registerInstantiator(
|
||||||
|
WorkspaceDirectoryPortlet.BASE_DATA_OBJECT_TYPE,
|
||||||
|
new ACSObjectInstantiator() {
|
||||||
|
public DomainObject doNewInstance(DataObject dataObject) {
|
||||||
|
return new WorkspaceDirectoryPortlet(dataObject);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,13 @@
|
||||||
|
|
||||||
package com.arsdigita.london.rss;
|
package com.arsdigita.london.rss;
|
||||||
|
|
||||||
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.kernel.KernelExcursion;
|
||||||
import com.arsdigita.loader.PackageLoader;
|
import com.arsdigita.loader.PackageLoader;
|
||||||
|
import com.arsdigita.portal.PortletType;
|
||||||
import com.arsdigita.runtime.ScriptContext;
|
import com.arsdigita.runtime.ScriptContext;
|
||||||
|
import com.arsdigita.london.rss.portlet.WorkspaceDirectoryPortlet;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -29,14 +34,26 @@ import org.apache.log4j.Logger;
|
||||||
* @version $Id: Loader.java 758 2005-09-02 14:26:56Z sskracic $
|
* @version $Id: Loader.java 758 2005-09-02 14:26:56Z sskracic $
|
||||||
*/
|
*/
|
||||||
public class Loader extends PackageLoader {
|
public class Loader extends PackageLoader {
|
||||||
public final static String versionId =
|
|
||||||
"$Id: Loader.java 758 2005-09-02 14:26:56Z sskracic $" +
|
|
||||||
"$Author: sskracic $" +
|
|
||||||
"$DateTime: 2003/10/28 14:24:00 $";
|
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(Loader.class);
|
private static final Logger s_log = Logger.getLogger(Loader.class);
|
||||||
|
|
||||||
public void run(final ScriptContext ctx) {
|
public void run(final ScriptContext ctx) {
|
||||||
// Nada yet
|
|
||||||
|
new KernelExcursion() {
|
||||||
|
public void excurse() {
|
||||||
|
setEffectiveParty(Kernel.getSystemParty());
|
||||||
|
|
||||||
|
loadWorkspaceDirectoryPortlet();
|
||||||
|
}
|
||||||
|
}.run();
|
||||||
|
// Nada yet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadWorkspaceDirectoryPortlet() {
|
||||||
|
PortletType type = PortletType.createPortletType("Workspace Directory",
|
||||||
|
PortletType.WIDE_PROFILE,
|
||||||
|
WorkspaceDirectoryPortlet.BASE_DATA_OBJECT_TYPE);
|
||||||
|
type.setDescription("Displays a list of workspaces");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* 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.rss.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 {
|
||||||
|
|
||||||
|
// XXX Quick Hack: Determine Object Type by method! Take care if the package name changes.
|
||||||
|
private static final String WORKSPACE_OBJECT_TYPE = "com.arsdigita.london.portal.Workspace";
|
||||||
|
|
||||||
|
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_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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* 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.rss.portlet;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
|
||||||
|
import com.arsdigita.london.rss.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* 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.rss.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.london.rss.portlet.WorkspaceDirectoryChannel;
|
||||||
|
// import com.arsdigita.london.portal.ui.PortalConstants;
|
||||||
|
import com.arsdigita.london.rss.RSSChannel;
|
||||||
|
// import com.arsdigita.london.rss.ui.RSSComponent;
|
||||||
|
import com.arsdigita.web.Application;
|
||||||
|
|
||||||
|
public class WorkspaceDirectoryComponent extends RSSComponent {
|
||||||
|
|
||||||
|
public static final String PORTAL_XML_NS = "http://www.uk.arsdigita.com/portal/1.0";
|
||||||
|
|
||||||
|
public WorkspaceDirectoryComponent() {
|
||||||
|
super("portal:workspaceDirectory", 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* 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.rss.ui.portlet;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
|
||||||
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.london.rss.portlet.WorkspaceDirectoryChannel;
|
||||||
|
import com.arsdigita.london.rss.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;
|
||||||
|
|
||||||
|
// XXX Quick HAck! Keep in Sync with portal application!
|
||||||
|
private static final String PORTLET_XML_NS = "http://www.uk.arsdigita.com/portlet/1.0";
|
||||||
|
|
||||||
|
public WorkspaceDirectoryPortletRenderer(WorkspaceDirectoryPortlet portlet) {
|
||||||
|
m_portlet = portlet;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void generateBodyXML(PageState pageState, Element parentElement) {
|
||||||
|
Element content = new Element("portlet:workspaceDirectory",
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue