Modul ccm-portalserver Portal /ccm/administration gefixt, einschl. Verwaltung von Applications, alle Module legacy free, PersonalPortalSite noch fehlerhaft bei einer Abfrage. Update Skript nicht erforderlich, da Modul bisher nicht verwendet.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1528 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2012-03-02 08:14:45 +00:00
parent e7e1e73e97
commit 150ce9cdad
31 changed files with 1302 additions and 241 deletions

View File

@ -26,7 +26,6 @@ import com.arsdigita.persistence.SessionManager;
import com.arsdigita.web.*;
import com.arsdigita.kernel.*;
// unused import com.arsdigita.sitenode.*;
import com.arsdigita.bookmarks.*;
import com.arsdigita.bookmarks.ui.*;
// unused import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.domain.DomainObject;

View File

@ -48,10 +48,6 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
// We need NonEscapedTableCellRenderer
// Currently part of (thisPackage) Dispatcher.java
// When the class will we deleted we must copy first!
/**
* Web Developer Support Application Servlet class, central entry point to
* create and process the applications UI.

View File

@ -226,8 +226,8 @@ public class Assert {
* <code>object</code>
* @throws AssertionError if the object is null
*/
public static final void exists(final Object object,
final Class clacc) {
public static void exists(final Object object,
final Class clacc) {
if (object == null) {
final String message = clacc.getName() + " is null";
@ -245,8 +245,8 @@ public class Assert {
*
* @throws AssertionError if the object is null
*/
public static final void exists(final Object object,
final String label) {
public static void exists(final Object object,
final String label) {
if (object == null) {
final String message =
label != null && label.trim().length() > 0

View File

@ -20,7 +20,6 @@
package com.arsdigita.portalserver;
// import com.arsdigita.db.*;
import com.arsdigita.domain.*;
import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.kernel.Kernel;
@ -138,7 +137,8 @@ public class Loader extends PackageLoader {
private void loadPortalSiteApplicationType() {
/* First try: create a new style, legacy compatible application */
/* ApplicationType type = ApplicationType.createApplicationType(
/*
ApplicationType type = ApplicationType.createApplicationType(
"portalsite",
"Portal Site",
PortalSite.BASE_DATA_OBJECT_TYPE);
@ -146,6 +146,7 @@ public class Loader extends PackageLoader {
// modified to be able to create a legacy free app type.
type.setDispatcherClass
("com.arsdigita.portalserver.ui.PortalDispatcher");
*/
// Try: new style legacy free application
@ -229,16 +230,23 @@ public class Loader extends PackageLoader {
// in applications mit primary_url=/portal-admin/
// in acs_object mit default_domain_class=c.ad.ps.admin.PSAdmin und
// object_type=c.ad.admin.CWAdmin, ebenfalls wg. BASE_DATA_OBJ_TYPE
/*
ApplicationType type = ApplicationType.createApplicationType(
"portal-admin",
"Portal Server Site Administration",
PSAdmin.BASE_DATA_OBJECT_TYPE);
type.setDescription ("Displays common administration tasks.");
// Current code requires an apps specific dispatcher class. Has to be
// modified to be able to create a legacy free app type.
type.setDispatcherClass
("com.arsdigita.portalserver.admin.ui.Dispatcher");
*/
// Try: new style legacy free application
ApplicationType type = new
ApplicationType("Portal Admin", // title
PSAdmin.BASE_DATA_OBJECT_TYPE );
type.setDescription ("Displays common administration tasks.");
type.save();
}
@ -251,6 +259,7 @@ public class Loader extends PackageLoader {
private void loadPortalCreatorApplicationType() {
// formerly private ApplicationType setupPortalCreator() { in ui.admin.Initializer
/*
ApplicationType type = ApplicationType.createApplicationType(
"portal-create",
"Portal Creator",
@ -260,6 +269,16 @@ public class Loader extends PackageLoader {
// modified to be able to create a legacy free app type.
type.setDispatcherClass
("com.arsdigita.portalserver.ui.admin.PortalCreateDispatcher");
*/
// Try: new style legacy free application
ApplicationType type = new
ApplicationType("Portal Creator", // title
PortalCreator.BASE_DATA_OBJECT_TYPE );
type.setDescription ("Creates portals.");
type.save();
}
@ -270,16 +289,17 @@ public class Loader extends PackageLoader {
private void loadPortalSitemapApplicationType() {
// formerly private ApplicationType setupPortalSitemapper() {
/*
ApplicationType type = ApplicationType.createApplicationType(
"portal-sitemap",
"Portal Site Map",
PortalSiteMap.BASE_DATA_OBJECT_TYPE);
type.setDescription ("Displays and manages Portals.");
// Current code requires an apps specific dispatcher class. Has to be
// modified to be able to create a legacy free app type.
type.setDispatcherClass
("com.arsdigita.portalserver.ui.admin.PortalSiteMapDispatcher");
*/
/* ApplicationSetup setup = new ApplicationSetup(s_log);
setup.setApplicationObjectType(PortalSiteMap.BASE_DATA_OBJECT_TYPE);
setup.setTitle("Portal Site Map");
@ -298,7 +318,16 @@ public class Loader extends PackageLoader {
setup.run(); */
// return setup.run();
}
// Try: new style legacy free application
ApplicationType type = new
ApplicationType("Portal SiteMap", // title
PortalSiteMap.BASE_DATA_OBJECT_TYPE );
type.setDescription ("Displays and manages Portals.");
type.save();
}
/* FORMERLY personal.Initializer */
@ -311,7 +340,7 @@ public class Loader extends PackageLoader {
private void loadPersonalPortalCreatorApplicationType() {
// private ApplicationType loadPersonalPortalCreatorApplicationType() {
// formerly private ApplicationType setupPersonalPortalCreatorApplication() {
/*
ApplicationType type = ApplicationType.createApplicationType(
"personal-portal-creator",
"Personal Portal Creator",
@ -321,67 +350,41 @@ public class Loader extends PackageLoader {
// modified to be able to create a legacy free app type.
type.setDispatcherClass
("com.arsdigita.portalserver.personal.PersonalPortalCreatorDispatcher");
*/
// return type;
// Try: new style legacy free application
ApplicationType type = new
ApplicationType("Personal Portal Creator", // title
PersonalPortalCreator.BASE_DATA_OBJECT_TYPE );
/* ApplicationSetup setup = new ApplicationSetup(s_log);
type.setDescription ("Displays and manages Portals.");
type.save();
setup.setApplicationObjectType
(PersonalPortalCreator.BASE_DATA_OBJECT_TYPE);
setup.setKey("personal-portal-creator");
setup.setTitle("Personal Portal Creator");
setup.setDescription("Responsible for creating personal portals.");
// db based stylesheets nolonger used
// setup.setStylesheet("/packages/portalserver/xsl/portalserver.xsl");
setup.setDispatcherClass
("com.arsdigita.portalserver.personal.PersonalPortalCreatorDispatcher");
setup.setPortalApplication(false);
setup.setInstantiator(new ACSObjectInstantiator() {
@Override
protected DomainObject doNewInstance(DataObject dataObject) {
return new PersonalPortalCreator(dataObject);
}
});
return setup.run(); */
}
}
private void loadPersonalPortalApplicationType() {
// private ApplicationType loadPersonalPortalApplicationType() {
// formerly private ApplicationType setupPersonalPortalApplication() {
/*
ApplicationType type = ApplicationType.createApplicationType(
"personal-portal",
"Personal Portal",
PersonalPortal.BASE_DATA_OBJECT_TYPE);
type.setDescription ("A portal for an individual.");
// Current code requires an apps specific dispatcher class. Has to be
// modified to be able to create a legacy free app type.
type.setDispatcherClass
("com.arsdigita.portalserver.personal.PersonalPortalDispatcher");
*/
// Try: new style legacy free application
ApplicationType type = new
ApplicationType("Personal Portal", // title
PersonalPortal.BASE_DATA_OBJECT_TYPE );
type.setDescription ("A portal for an individual.");
type.save();
/* ApplicationSetup setup = new ApplicationSetup(s_log);
setup.setApplicationObjectType(PersonalPortal.BASE_DATA_OBJECT_TYPE);
setup.setKey("personal-portal");
setup.setTitle("Personal Portal");
setup.setDescription("A portal for an individual.");
// setup.setStylesheet("/packages/portalserver/xsl/portalserver.xsl");
setup.setDispatcherClass
("com.arsdigita.portalserver.personal.PersonalPortalDispatcher");
setup.setPortalApplication(false);
setup.setInstantiator(new ACSObjectInstantiator() {
@Override
protected DomainObject doNewInstance(DataObject dataObject) {
return new PersonalPortal(dataObject);
}
});
ApplicationType type = setup.run();
// XXX This must go after setup.run(). Need more elegant approach.
/* // XXX This must go after setup.run(). Need more elegant approach.
// pboy: uses ResourceType.registerResourceTypeConfig() which registers
// in a hash map. Therefore: not suitable for a loader, may have to be
// moved into initializer!

View File

@ -472,16 +472,15 @@ public class PortalSite extends Application {
* @return
*/
public static PortalSiteCollection getRootPortalSites() {
DataQuery query = SessionManager.getSession().retrieveQuery
("com.arsdigita.workspace.rootWorkspaces");
DataCollection collection =
new DataQueryDataCollectionAdapter(query, "workspace");
query.close();
PortalSiteCollection psc = new PortalSiteCollection(collection);
psc.filterForUnarchived();
return psc;

View File

@ -19,13 +19,12 @@
package com.arsdigita.portalserver;
import com.arsdigita.bebop.Page;
import com.arsdigita.persistence.TransactionContext;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.portalserver.ui.PortalHomePage;
import com.arsdigita.portalserver.ui.PortalParticipants;
import com.arsdigita.portalserver.ui.admin.PortalAdminPage;
import com.arsdigita.templating.PresentationManager;
import com.arsdigita.templating.Templating;
import com.arsdigita.util.Assert;
import com.arsdigita.web.Application;
import com.arsdigita.web.BaseApplicationServlet;
import com.arsdigita.xml.Document;
@ -39,46 +38,33 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
// ////////////////////////////////////////////////////////////////////////////
//
// UNKNOWN whether this is unfinished work in progress or really used in some
// way.
//
// Might be a first shot to replace ui.PortalDispatcher by a new legacy free
// servlet because it uses the same pages (PortalHomePage, PortalParticipants
// but additionally a PortalAdminPage (from package c.ad.ps.ui.admin)
// On the other hand this is the same as m_portalsiteAdminDispatcher of
// PortalDispatcher
//
// ////////////////////////////////////////////////////////////////////////////
/**
* Portal Site Application Servlet class, central entry point to create and
* process the applications UI.
*
* @author Justin Ross &lt;<a href="mailto:jross@redhat.com">jross@redhat.com</a>&gt;
* @version $Id: PortalServlet.java pboy $
* @author Peter Boy <a href="mailto:pboy@zes.uni-bremen.de">
* @version $Id: PortalSiteServlet.java pboy $
*/
public class PortalServlet extends BaseApplicationServlet {
public class PortalSiteServlet extends BaseApplicationServlet {
private static final Logger s_log = Logger.getLogger
(PortalServlet.class);
private static final Logger s_log = Logger.getLogger(PortalSiteServlet.class);
private static final PresentationManager s_presManager =
Templating.getPresentationManager();
Templating.getPresentationManager();
private static Page s_homePage = new PortalHomePage();
private static Page s_particPage = PortalParticipants.createPage();
private static Page s_adminPage = null;
static {
// TransactionContext ctx = SessionManager.getSession().getTransactionContext();
// ctx.beginTxn();
s_adminPage = new PortalAdminPage();
// ctx.commitTxn();
}
private static Page s_adminPage = s_adminPage = new PortalAdminPage();
/**
*
* @param sreq
* @param sresp
* @param app
* @throws ServletException
* @throws IOException
*/
public void doService(HttpServletRequest sreq,
HttpServletResponse sresp,
Application app)
@ -86,12 +72,21 @@ public class PortalServlet extends BaseApplicationServlet {
s_log.debug("PortalServlet.doService called for request '" +
sreq.getRequestURI() + "'");
String path = sreq.getServletPath();
String pathInfo = sreq.getPathInfo();
Assert.exists(pathInfo, "String pathInfo");
if (pathInfo.length() > 1 && pathInfo.endsWith("/")) {
/* NOTE: ServletAPI specifies, pathInfo may be empty or will
* start with a '/' character. It currently carries a
* trailing '/' if a "virtual" page, i.e. not a real jsp, but
* result of a servlet mapping. But Application requires url
* NOT to end with a trailing '/' for legacy free applications. */
pathInfo = pathInfo.substring(0, pathInfo.length()-1);
}
Document doc = null;
if (path.endsWith("participants")) {
if (pathInfo.endsWith("participants")) {
doc = s_particPage.buildDocument(sreq, sresp);
} else if (path.endsWith("admin")) {
} else if (pathInfo.endsWith("admin")) {
doc = s_adminPage.buildDocument(sreq, sresp);
} else {
doc = s_homePage.buildDocument(sreq, sresp);

View File

@ -16,9 +16,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.portalserver.admin.ui;
package com.arsdigita.portalserver.admin;
// import com.arsdigita.bebop.*;
import com.arsdigita.portalserver.admin.PSAdminPage;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.page.BebopMapDispatcher;
import java.util.*;
@ -36,7 +37,7 @@ public class Dispatcher extends BebopMapDispatcher {
public Dispatcher() {
Map m = new HashMap();
Page index = new AdminPage();
Page index = new PSAdminPage();
index.lock();
m.put("", index);
m.put("index.jsp", index);

View File

@ -21,6 +21,7 @@ package com.arsdigita.portalserver.admin;
// import com.arsdigita.portalserver.*;
import com.arsdigita.web.Application;
import com.arsdigita.persistence.*;
import com.arsdigita.web.URL;
import org.apache.log4j.Logger;
/**
@ -36,6 +37,7 @@ import org.apache.log4j.Logger;
*/
public class PSAdmin extends Application {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(PSAdmin.class);
public static final String BASE_DATA_OBJECT_TYPE =
@ -49,4 +51,44 @@ public class PSAdmin extends Application {
public PSAdmin(DataObject dataObject) {
super(dataObject);
}
/**
* Returns the path name of the location of the applications servlet/JSP.
*
* Application implementations may overwrite this method to provide an
* application specific location, especially if an application (module) is
* to be installed along with others in one context.
*
* If you install the module into its own context you may use a standard
* location. In most cases though all modules (applications) of an
* webapplication should be installed into one context.
*
* Frequently it is a symbolic name/path, which will be mapped in the web.xml
* to the real location in the file system. Example:
* <servlet>
* <servlet-name>applicationName-files</servlet-name>
* <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>
* <init-param>
* <param-name>template-path</param-name>
* <param-value>/templates/ccm-applicationName</param-value>
* </init-param>
* </servlet>
*
* <servlet-mapping>
* <servlet-name>applicationName-files</servlet-name>
* <url-pattern>/ccm-applicationName/files/*</url-pattern>
* </servlet-mapping>
*
* NOTE: According to Servlet API the path always starts with a leading '/'
* and includes either the servlet name or a path to the servlet, but does
* not include any extra path information or a query string. Returns an
* empry string ("") is the servlet used was matched using the "/*" pattern.
*
* @return path name to the applications servlet/JSP
*/
@Override
public String getServletPath() {
return URL.SERVLET_DIR + "/psadmin";
}
}

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.portalserver.admin.ui;
package com.arsdigita.portalserver.admin;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationCollection;
@ -32,14 +32,14 @@ import com.arsdigita.xml.Document;
import com.arsdigita.xml.Element;
/**
* AdminPage
* PSAdminPage
* -
* This class is the UI component for Portal-admin.
*
* @author <a href="mailto:rhs@mit.edu">rhs@mit.edu</a>
* @version $Revision: #8 $ $Date: 2004/08/17 $
*/
class AdminPage extends PortalPage {
class PSAdminPage extends PortalPage {
public static final String versionId =
"$Id: //portalserver/dev/src/com/arsdigita/portalserver/admin/ui/AdminPage.java#8 $" +
"$Author: dennis $" +
@ -48,7 +48,7 @@ class AdminPage extends PortalPage {
BoxPanel m_bpanel;
private static Logger s_log = Logger.getLogger
(AdminPage.class.getName());
(PSAdminPage.class.getName());
private RequestLocal m_children = new RequestLocal() {
public Object initialValue(PageState ps) {
@ -58,7 +58,7 @@ class AdminPage extends PortalPage {
}
};
public AdminPage() {
public PSAdminPage() {
getHeader().setIdAttr("admin");
}

View File

@ -0,0 +1,98 @@
/*
* Copyright (C) 2012 Peter Boy 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.portalserver.admin;
import com.arsdigita.bebop.Page;
import com.arsdigita.templating.PresentationManager;
import com.arsdigita.templating.Templating;
import com.arsdigita.util.Assert;
import com.arsdigita.web.Application;
import com.arsdigita.web.BaseApplicationServlet;
import com.arsdigita.xml.Document;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
/**
*
* @author pb
*/
public class PSAdminServlet extends BaseApplicationServlet {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(PSAdminServlet.class);
private static final PresentationManager s_presManager =
Templating.getPresentationManager();
/** Page object to hold the PortalSite Admin page */
private static Page s_psAdminPage;
/**
* User extension point, initialize PortalCreator (index) page and add
* authentication check.
*
* @throws ServletException
*/
@Override
public void doInit() throws ServletException {
s_psAdminPage = new PSAdminPage();
s_psAdminPage.lock();
}
/**
*
* @param sreq
* @param sresp
* @param app
* @throws ServletException
* @throws IOException
*/
public void doService(HttpServletRequest sreq,
HttpServletResponse sresp,
Application app)
throws ServletException, IOException {
s_log.debug("PortalServlet.doService called for request '" +
sreq.getRequestURI() + "'");
String pathInfo = sreq.getPathInfo();
Assert.exists(pathInfo, "String pathInfo");
if (pathInfo.length() > 1 && pathInfo.endsWith("/")) {
/* NOTE: ServletAPI specifies, pathInfo may be empty or will
* start with a '/' character. It currently carries a
* trailing '/' if a "virtual" page, i.e. not a real jsp, but
* result of a servlet mapping. But Application requires url
* NOT to end with a trailing '/' for legacy free applications. */
pathInfo = pathInfo.substring(0, pathInfo.length()-1);
}
Document doc = null;
doc = s_psAdminPage.buildDocument(sreq, sresp);
s_presManager.servePage(doc, sreq, sresp);
}
}

View File

@ -28,9 +28,11 @@ import com.arsdigita.persistence.DataObject;
* @version $Revision #1 $DateTime: 2004/08/17 23:19:25 $
*/
public class MyItemsApplication extends Application {
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.workspace.personal.MyItemsApplication";
@Override
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}

View File

@ -36,56 +36,86 @@ import com.arsdigita.kernel.Party;
import com.arsdigita.util.Assert;
import com.arsdigita.xml.Element;
/**
*
*
*/
public class MyPortalsPortlet extends AppPortlet {
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.workspace.personal.MyWorkspacesPortlet";
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.workspace.personal.MyWorkspacesPortlet";
/**
*
* @return
*/
@Override
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
/**
*
* @param dataObject
*/
public MyPortalsPortlet(DataObject dataObject) {
super(dataObject);
}
@Override
protected AbstractPortletRenderer doGetPortletRenderer() {
return new MyPortalsPortletRenderer(this);
}
/**
*
* @param party
* @return
*/
protected DataQuery getMyPortalsDataQuery(Party party) {
// Assert.assertTrue
Assert.isTrue
(!isNew(),
"You must save this portlet before you call " +
"getMyPortalsDataQuery(User) on it.");
DataQuery query = SessionManager.getSession().retrieveQuery
("com.arsdigita.workspace.personal.MyWorkspaces");
("com.arsdigita.workspace.personal.MyWorkspaces");
// Assert.assertNotNull(query, "query");
Assert.exists(query, "query");
query.setParameter("userID", party.getID());
Application parent = getParentApplication();
// Assert.assertNotNull(parent, "parent");
Assert.exists(parent, "parent");
query.setParameter
("personalWorkspaceID", getParentApplication().getID());
query.setParameter("personalWorkspaceID", getParentApplication().getID());
return query;
}
}
/**
*
*
*/
class MyPortalsPortletRenderer extends AbstractPortletRenderer {
private MyPortalsPortlet m_portlet;
/**
* Constructor
* @param portlet
*/
public MyPortalsPortletRenderer(MyPortalsPortlet portlet) {
m_portlet = portlet;
}
/**
*
* @param pageState
* @param parent
*/
protected void generateBodyXML(PageState pageState, Element parent) {
Party party = Kernel.getContext().getParty();
@ -107,8 +137,6 @@ class MyPortalsPortletRenderer extends AbstractPortletRenderer {
title = (String) query.get("title");
primaryURL = (String) query.get("primaryURL");
// Assert.assertNotNull(title, "title");
// Assert.assertNotNull(primaryURL, "primaryURL");
Assert.exists(title, "title");
Assert.exists(primaryURL, "primaryURL");

View File

@ -25,6 +25,7 @@ import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.kernel.User;
import com.arsdigita.util.Assert;
import com.arsdigita.web.URL;
/**
* <p><strong>Experimental</strong></p>
@ -37,6 +38,11 @@ public class PersonalPortal extends PortalSite {
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.workspace.personal.PersonalWorkspace";
/**
*
* @return
*/
@Override
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
@ -46,21 +52,33 @@ public class PersonalPortal extends PortalSite {
super(dataObject);
}
/**
*
* @param user
* @param parent
* @return
*/
public static PersonalPortal createPersonalPortal
(User user, Application parent) {
// Assert.assertNotNull(user, "user");
Assert.exists(user, "user");
PersonalPortal portal = (PersonalPortal)
Application.createApplication
(BASE_DATA_OBJECT_TYPE, user.getID().toString(),
"Personal Portal", parent);
Application.createApplication
(BASE_DATA_OBJECT_TYPE,
user.getID().toString(),
"Personal Portal",
parent);
portal.setOwningUser(user);
return portal;
}
/**
*
* @param user
* @return
*/
public static PersonalPortal createPersonalPortal(User user) {
Application parent = Application.retrieveApplicationForPath
("/personal-portal/");
@ -71,7 +89,11 @@ public class PersonalPortal extends PortalSite {
return PersonalPortal.createPersonalPortal(user, parent);
}
// Can return null.
/**
*
* @param user
* @return (Can return null.)
*/
public static PersonalPortal retrievePersonalPortal(User user) {
DataCollection portals = SessionManager.getSession().retrieve
(BASE_DATA_OBJECT_TYPE);
@ -90,19 +112,66 @@ public class PersonalPortal extends PortalSite {
return portal;
}
/**
*
* @param user
*/
private void setOwningUser(User user) {
// Assert.assertNotNull(user, "user");
Assert.exists(user, "user");
setAssociation("user", user);
}
/**
*
* @return
*/
public User getOwningUser() {
DataObject dataObject = (DataObject) get("user");
// Assert.assertNotNull(dataObject, "dataObject");
Assert.exists(dataObject, "dataObject");
return User.retrieve(dataObject);
}
/**
* Returns the path name of the location of the applications servlet/JSP.
*
* Application implementations may overwrite this method to provide an
* application specific location, especially if an application (module) is
* to be installed along with others in one context.
*
* If you install the module into its own context you may use a standard
* location. In most cases though all modules (applications) of an
* webapplication should be installed into one context.
*
* Frequently it is a symbolic name/path, which will be mapped in the web.xml
* to the real location in the file system. Example:
* <servlet>
* <servlet-name>applicationName-files</servlet-name>
* <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>
* <init-param>
* <param-name>template-path</param-name>
* <param-value>/templates/ccm-applicationName</param-value>
* </init-param>
* </servlet>
*
* <servlet-mapping>
* <servlet-name>applicationName-files</servlet-name>
* <url-pattern>/ccm-applicationName/files/*</url-pattern>
* </servlet-mapping>
*
* NOTE: According to Servlet API the path always starts with a leading '/'
* and includes either the servlet name or a path to the servlet, but does
* not include any extra path information or a query string. Returns an
* empry string ("") is the servlet used was matched using the "/*" pattern.
*
* @return path name to the applications servlet/JSP
*/
@Override
public String getServletPath() {
return URL.SERVLET_DIR + "/personal-portal";
}
}

View File

@ -47,7 +47,7 @@ public class PersonalPortalConfig extends ResourceTypeConfig {
}
public void configureApplication(Application application) {
// Assert.assertTrue(application instanceof PersonalPortal);
Assert.isTrue(application instanceof PersonalPortal);
PersonalPortal portal = (PersonalPortal) application;
@ -61,22 +61,23 @@ public class PersonalPortalConfig extends ResourceTypeConfig {
Portlet portlet = null;
portlet = Portlet.createPortlet
(MyPortalsPortlet.BASE_DATA_OBJECT_TYPE, portal);
portlet = Portlet.createPortlet(MyPortalsPortlet.BASE_DATA_OBJECT_TYPE,
portal);
tab.addPortlet(portlet, 1);
tab.setPortalSite(portal);
tab.save();
portal.addPortalTab(tab);
portal.addMember(portal.getOwningUser());
portal.save();
// Permissions
PermissionDescriptor perm = new PermissionDescriptor
(PrivilegeDescriptor.ADMIN, portal, portal.getOwningUser());
(PrivilegeDescriptor.ADMIN,
portal,
portal.getOwningUser());
PermissionService.grantPermission(perm);
}
}

View File

@ -20,6 +20,7 @@ package com.arsdigita.portalserver.personal;
import com.arsdigita.web.Application;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.web.URL;
/**
* <p><strong>Experimental</strong></p>
@ -36,12 +37,62 @@ public class PersonalPortalCreator extends Application {
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.workspace.personal.PersonalWorkspaceCreator";
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
/**
* Constructor
*
* @param dataObject
*/
// protected PersonalPortalCreator(DataObject dataObject) {
public PersonalPortalCreator(DataObject dataObject) {
super(dataObject);
}
/**
*
* @return
*/
@Override
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
/**
* Returns the path name of the location of the applications servlet/JSP.
*
* Application implementations may overwrite this method to provide an
* application specific location, especially if an application (module) is
* to be installed along with others in one context.
*
* If you install the module into its own context you may use a standard
* location. In most cases though all modules (applications) of an
* webapplication should be installed into one context.
*
* Frequently it is a symbolic name/path, which will be mapped in the web.xml
* to the real location in the file system. Example:
* <servlet>
* <servlet-name>applicationName-files</servlet-name>
* <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>
* <init-param>
* <param-name>template-path</param-name>
* <param-value>/templates/ccm-applicationName</param-value>
* </init-param>
* </servlet>
*
* <servlet-mapping>
* <servlet-name>applicationName-files</servlet-name>
* <url-pattern>/ccm-applicationName/files/*</url-pattern>
* </servlet-mapping>
*
* NOTE: According to Servlet API the path always starts with a leading '/'
* and includes either the servlet name or a path to the servlet, but does
* not include any extra path information or a query string. Returns an
* empry string ("") is the servlet used was matched using the "/*" pattern.
*
* @return path name to the applications servlet/JSP
*/
@Override
public String getServletPath() {
return URL.SERVLET_DIR + "/personal-portal-creator";
}
}

View File

@ -128,11 +128,11 @@ public class PersonalPortalCreatorDispatcher implements Dispatcher {
return page;
}
public void dispatch
(HttpServletRequest request, HttpServletResponse response,
RequestContext context)
throws IOException, ServletException {
// Assert.assertTrue(context instanceof SiteNodeRequestContext);
public void dispatch(HttpServletRequest request,
HttpServletResponse response,
RequestContext context)
throws IOException, ServletException {
Assert.isTrue(context instanceof SiteNodeRequestContext);
// XXX has to be replaced by a way NOT built upon SiteNode*
@ -183,12 +183,14 @@ public class PersonalPortalCreatorDispatcher implements Dispatcher {
if (m_introDispatcher == null) {
m_introDispatcher = new PageDispatcher(buildIntroPage());
}
// Assert.assertNotNull(m_introDispatcher, "m_introDispatcher");
Assert.exists(m_introDispatcher, "m_introDispatcher");
DispatcherHelper.sendRedirect
(request, response, snrc.getOriginalURL());
// Don't understand: Above we create a new PageDisüpatcher but don't
// call it's dispatch() method.
// What does the sendRedirect here?
DispatcherHelper.sendRedirect(request,
response,
snrc.getOriginalURL());
// The following does not work because I need to be able to
// reset the RequestContext before I invoke it. Otherwise,

View File

@ -0,0 +1,243 @@
/*
* Copyright (C) 2012 Peter Boy 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.portalserver.personal;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageFactory;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.kernel.ResourceTypeConfig;
import com.arsdigita.kernel.User;
import com.arsdigita.templating.PresentationManager;
import com.arsdigita.templating.Templating;
import com.arsdigita.ui.login.UserAuthenticationListener;
import com.arsdigita.util.Assert;
import com.arsdigita.web.Application;
import com.arsdigita.web.BaseApplicationServlet;
import com.arsdigita.xml.Document;
import java.io.IOException;
import java.math.BigDecimal;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
/**
*
* @author pb
*/
public class PersonalPortalCreatorServlet extends BaseApplicationServlet {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(
PersonalPortalCreatorServlet.class);
private static final String XSL_HOOK = "portal-sitemap";
private static final PresentationManager s_presManager =
Templating.getPresentationManager();
private static Page s_introPage ;
/**
* User extension point, do some initializing
*
* @throws ServletException
*/
@Override
public void doInit() throws ServletException {
s_log.debug("PortalSiteMapServlet doInit() initialization executing!");
// do nothing for now.
s_introPage = buildIntroPage();
}
/**
*
* @param sreq
* @param sresp
* @param app
* @throws ServletException
* @throws IOException
*/
public void doService(HttpServletRequest sreq,
HttpServletResponse sresp,
Application app)
throws ServletException, IOException {
s_log.debug("PortalSiteMApServlet.doService called for request '" +
sreq.getRequestURI() + "'");
/* NOTE:
* Resolves currently to SiteNodeRequestContext which will be removed.*/
RequestContext ctx = DispatcherHelper.getRequestContext();
/* Problem: what application is treated as parent? We assume it is the
* application of the current request, so we get is as parameter.
* The original dispatcher class uses the current context to determine
* the parent application which should provide the same result. */
// final Application parent = getApplication(ctx);
final Application parent = app;
BigDecimal userID = scanUserID(sreq);
if (userID == null) {
s_log.warn
("Failed to read a user ID from a personal-portal link.");
} else {
final User user = getUser(userID);
PersonalPortal portal = PersonalPortal.retrievePersonalPortal(user);
if (portal == null) {
// This is what we expect to happen so we have to create a new
// PersonalPortal for that user.
KernelExcursion rootExcursion = new KernelExcursion() {
protected void excurse() {
setParty(Kernel.getSystemParty());
PersonalPortal ps = PersonalPortal
.createPersonalPortal(user, parent);
Assert.exists(ps, "portal");
configurePortal(ps);
ps.save();
}
};
rootExcursion.run();
} else {
// There's a problem. We should never get here if the
// portal already exists, since the site node
// dispatcher will go to an existing portal
// directly, skipping this dispatcher.
s_log.error("PersonalPortalCreator invoked when the portalsite " +
"already exists.", new IllegalStateException());
}
}
/* After crfeation of a new PersonalPortal show intro page. */
Document doc = null;
doc = s_introPage.buildDocument(sreq, sresp);
s_presManager.servePage(doc, sreq, sresp);
}
/**
*
* @return
*/
private Page buildIntroPage() {
Page page = new Page("", new SimpleContainer());
page.lock();
return page;
}
/**
* Has to be replaced by a way not to use SiteNode / SiteNodeRequestContext
* @param snrc
* @return
*/
private Application getApplication(RequestContext ctx) {
// SiteNode siteNode = snrc.getSiteNode();
// Application parent = Application.retrieveApplicationForSiteNode
// (siteNode);
// Assert.exists(parent, "parent");
// return parent;
return null;
}
/**
* Scan the ServletRequest for the userId part.
* We expect something like "1023/"
* @param sreq
* @return UserId as BigDecimal
*/
private BigDecimal scanUserID(HttpServletRequest sreq) {
String url = sreq.getPathInfo();
int delimIndex = url.indexOf("/");
try {
if (delimIndex == -1) {
return new BigDecimal(url);
} else {
return new BigDecimal(url.substring(0, delimIndex));
}
} catch (NumberFormatException nfe) {
return null;
} catch (IndexOutOfBoundsException iobe) {
// BigDecimal(String) fails to validate its input. An
// empty string makes it bomb, throwing this exception.
return null;
}
}
/**
* Retrieve the user object based on userId.
*
* @param userID
* @return User object
*/
private User getUser(BigDecimal userID) {
User user = null;
try {
user = User.retrieve(userID);
} catch (DataObjectNotFoundException nfe) {
s_log.error
("Failed to retrieve user " + userID + ".",
new IllegalStateException());
}
// Assert.assertNotNull(user, "user");
Assert.exists(user, "user");
return user;
}
/**
*
* @param portal
*/
private void configurePortal(PersonalPortal portal) {
ResourceTypeConfig config = portal.getApplicationType().getConfig();
Assert.exists(config, "config");
config.configureResource(portal);
}
}

View File

@ -74,7 +74,9 @@ public class PersonalPortalDispatcher extends PortalDispatcher {
if (remainingURLPart.startsWith(PORTAL_ADMIN_PAGE)) {
if (m_portalAdminDispatcher == null) {
PortalAdminPage page = new PortalAdminPage() {
@Override
protected void buildContextBar() {
DimensionalNavbar navbar = new DimensionalNavbar();

View File

@ -42,15 +42,19 @@ import com.arsdigita.bebop.Container;
* <p><strong>Experimental</strong></p>
*
* @author <a href="mailto:justin@arsdigita.com">Justin Ross</a>
* @version $Id: //portalserver/dev/src/com/arsdigita/portalserver/personal/PersonalPortalHomePage.java#8 $
* @version $Id: PersonalPortalHomePage.java#8 $
*/
public class PersonalPortalHomePage extends PortalHomePage {
public static final String versionId =
"$Id: //portalserver/dev/src/com/arsdigita/portalserver/personal/PersonalPortalHomePage.java#8 $" +
"$Author: dennis $" +
"$DateTime: 2004/08/17 23:19:25 $";
/**
* Constructor
*/
public PersonalPortalHomePage() {
super();
}
private final RequestLocal m_adminPermission = new RequestLocal() {
@Override
protected Object initialValue(PageState state) {
UniversalPermissionDescriptor descriptor =
new UniversalPermissionDescriptor
@ -65,10 +69,7 @@ public class PersonalPortalHomePage extends PortalHomePage {
}
};
public PersonalPortalHomePage() {
super();
}
@Override
protected void buildHeader(Container header) {
// Add a link to edit profile.
Link profileLink = new Link( new Label(GlobalizationUtil.globalize("cw.workspace.personal.edit_your_profile")), "/register/edit-profile");
@ -84,6 +85,7 @@ public class PersonalPortalHomePage extends PortalHomePage {
// the Portal admin page.
Link adminLink = new Link( new Label(GlobalizationUtil.globalize("cw.workspace.personal.site_administration")), "/portal-admin/") {
@Override
public boolean isVisible(PageState state) {
Boolean bool = (Boolean) m_adminPermission.get(state);
return bool.booleanValue();
@ -96,6 +98,7 @@ public class PersonalPortalHomePage extends PortalHomePage {
super.buildHeader(header);
}
@Override
protected void buildTitle() {
class TitlePrintListener implements PrintListener {
public void prepare(PrintEvent e) {
@ -128,6 +131,7 @@ public class PersonalPortalHomePage extends PortalHomePage {
setTitle(new Label(new TitlePrintListener()));
}
@Override
protected void buildContextBar() {
DimensionalNavbar navbar = new DimensionalNavbar();

View File

@ -0,0 +1,111 @@
/*
* Copyright (C) 2002-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.portalserver.personal;
import com.arsdigita.bebop.DimensionalNavbar;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Page;
import com.arsdigita.portalserver.ui.PortalParticipants;
import com.arsdigita.portalserver.ui.admin.PortalAdminPage;
import com.arsdigita.portalserver.util.GlobalizationUtil;
import com.arsdigita.templating.PresentationManager;
import com.arsdigita.templating.Templating;
import com.arsdigita.util.Assert;
import com.arsdigita.web.Application;
import com.arsdigita.web.BaseApplicationServlet;
import com.arsdigita.xml.Document;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
/**
*
* @author pb
* @version $Id: PersonalPortalServlet.java pboy $
*/
public class PersonalPortalServlet extends BaseApplicationServlet {
private static final Logger s_log = Logger.getLogger(PersonalPortalServlet.class);
private static final PresentationManager s_presManager =
Templating.getPresentationManager();
private static Page s_homePage = new PersonalPortalHomePage();
private static Page s_particPage = PortalParticipants.createPage();
private static Page s_adminPage = s_adminPage = new PortalAdminPage() {
@Override
protected void buildContextBar() {
DimensionalNavbar navbar = new DimensionalNavbar();
navbar.setClassAttr("portalNavbar");
navbar.add(new Link(new PersonalPortalLinkPrinter()));
navbar.add(new Label(GlobalizationUtil
.globalize(
"cw.workspace.personal.configure_workspace")));
getHeader().add(navbar);
}
};
/**
*
* @param sreq
* @param sresp
* @param app
* @throws ServletException
* @throws IOException
*/
public void doService(HttpServletRequest sreq,
HttpServletResponse sresp,
Application app)
throws ServletException, IOException {
s_log.debug("PortalServlet.doService called for request '" +
sreq.getRequestURI() + "'");
String pathInfo = sreq.getPathInfo();
Assert.exists(pathInfo, "String pathInfo");
if (pathInfo.length() > 1 && pathInfo.endsWith("/")) {
/* NOTE: ServletAPI specifies, pathInfo may be empty or will
* start with a '/' character. It currently carries a
* trailing '/' if a "virtual" page, i.e. not a real jsp, but
* result of a servlet mapping. But Application requires url
* NOT to end with a trailing '/' for legacy free applications. */
pathInfo = pathInfo.substring(0, pathInfo.length()-1);
}
Document doc = null;
if (pathInfo.endsWith("participants")) {
doc = s_particPage.buildDocument(sreq, sresp);
} else if (pathInfo.endsWith("admin")) {
doc = s_adminPage.buildDocument(sreq, sresp);
} else {
doc = s_homePage.buildDocument(sreq, sresp);
}
s_presManager.servePage(doc, sreq, sresp);
}
}

View File

@ -33,6 +33,7 @@ import java.io.IOException;
import org.apache.log4j.Logger;
/**
* Dispatcher for the PortalSite ApplicationType
* <p><strong>Experimental</strong></p>
*
* @author <a href="mailto:justin@arsdigita.com">Justin Ross</a>

View File

@ -21,7 +21,6 @@ package com.arsdigita.portalserver.ui;
import com.arsdigita.portalserver.util.GlobalizationUtil;
import com.arsdigita.web.ApplicationCollection;
import com.arsdigita.portalserver.PortalSite;
import com.arsdigita.portalserver.LoggedInLinkWrapper;
import com.arsdigita.portalserver.PortalPage;
@ -45,7 +44,6 @@ import com.arsdigita.bebop.event.RequestListener;
import com.arsdigita.bebop.event.RequestEvent;
import com.arsdigita.bebop.event.ChangeListener;
import com.arsdigita.bebop.event.ChangeEvent;
import com.arsdigita.bebop.portal.Portal;
import com.arsdigita.bebop.portal.PortalModel;
import com.arsdigita.bebop.portal.PortalModelBuilder;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
@ -75,6 +73,7 @@ public class PortalHomePage extends PortalPage {
List m_tabs;
private RequestLocal m_hasAdmin = new RequestLocal() {
@Override
public Object initialValue(PageState ps) {
PortalSite psite =
PortalSite.getCurrentPortalSite(ps.getRequest());
@ -146,6 +145,7 @@ public class PortalHomePage extends PortalPage {
header.add(adminLink);
class SearchComponent extends SimpleContainer {
@Override
public void generateXML(PageState state, Element parent) {
/*XXXjbp - *************************************************
****This needs to be modified to use core search***********
@ -392,10 +392,10 @@ public class PortalHomePage extends PortalPage {
private class CookieChangeListener implements ChangeListener {
public void stateChanged(ChangeEvent e) {
PageState ps = e.getPageState();
PortalSite psite = getPortalSite(ps);
// Assert.assertNotNull(psite, "workspace");
PageState ps = e.getPageState();
PortalSite psite = getPortalSite(ps);
Assert.exists(psite, "workspace");
HttpServletResponse response = ps.getResponse();
@ -403,10 +403,8 @@ public class PortalHomePage extends PortalPage {
String tabName = (String)m_tabs.getSelectedKey(ps);
Cookie cookie = new Cookie(cookieNameString,tabName);
cookie.setMaxAge(36000);
cookie.setComment(
"This cookie returns you to the tab you " +
"had open when you last visited this portal."
);
cookie.setComment("This cookie returns you to the tab you " +
"had open when you last visited this portal.");
response.addCookie(cookie);
}
}

View File

@ -20,6 +20,8 @@ package com.arsdigita.portalserver.ui.admin;
import com.arsdigita.web.Application;
import com.arsdigita.persistence.*;
import com.arsdigita.web.URL;
import org.apache.log4j.Logger;
/**
@ -27,24 +29,72 @@ import org.apache.log4j.Logger;
*
* @author <a href="mailto:rhs@mit.edu">rhs@mit.edu</a>
* @version $Revision: #5 $ $Date: 2004/08/17 $
* @version $Id: PortalCreator.java#5 $
*/
public class PortalCreator extends Application {
public static final String versionId =
"$Id: //portalserver/dev/src/com/arsdigita/portalserver/ui/admin/PortalCreator.java#5 $" +
"$Author: dennis $" +
"$DateTime: 2004/08/17 23:19:25 $";
private static final Logger s_log = Logger.getLogger
(PortalCreator.class);
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(PortalCreator.class);
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.workspace.ui.WorkspaceCreator";
"com.arsdigita.workspace.ui.WorkspaceCreator";
/**
* Constructor
*
* @param dataObject
*/
public PortalCreator(DataObject dataObject) {
super(dataObject);
}
/**
*
* @return
*/
@Override
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
public PortalCreator(DataObject dataObject) {
super(dataObject);
/**
* Returns the path name of the location of the applications servlet/JSP.
*
* Application implementations may overwrite this method to provide an
* application specific location, especially if an application (module) is
* to be installed along with others in one context.
*
* If you install the module into its own context you may use a standard
* location. In most cases though all modules (applications) of an
* webapplication should be installed into one context.
*
* Frequently it is a symbolic name/path, which will be mapped in the web.xml
* to the real location in the file system. Example:
* <servlet>
* <servlet-name>applicationName-files</servlet-name>
* <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>
* <init-param>
* <param-name>template-path</param-name>
* <param-value>/templates/ccm-applicationName</param-value>
* </init-param>
* </servlet>
*
* <servlet-mapping>
* <servlet-name>applicationName-files</servlet-name>
* <url-pattern>/ccm-applicationName/files/*</url-pattern>
* </servlet-mapping>
*
* NOTE: According to Servlet API the path always starts with a leading '/'
* and includes either the servlet name or a path to the servlet, but does
* not include any extra path information or a query string. Returns an
* empry string ("") is the servlet used was matched using the "/*" pattern.
*
* @return path name to the applications servlet/JSP
*/
@Override
public String getServletPath() {
return URL.SERVLET_DIR + "/portal-creator";
}
}

View File

@ -0,0 +1,100 @@
/*
* Copyright (C) 2012 Peter Boy 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.portalserver.ui.admin;
import com.arsdigita.bebop.Page;
import com.arsdigita.templating.PresentationManager;
import com.arsdigita.templating.Templating;
import com.arsdigita.ui.login.UserAuthenticationListener;
import com.arsdigita.util.Assert;
import com.arsdigita.web.Application;
import com.arsdigita.web.BaseApplicationServlet;
import com.arsdigita.xml.Document;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
/**
*
* @author pb
*/
public class PortalCreatorServlet extends BaseApplicationServlet {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(PortalCreatorServlet.class);
private static final PresentationManager s_presManager =
Templating.getPresentationManager();
private static Page s_prtlCreatePage ;
/**
* User extension point, initialize PortalCreator (index) page and add
* authentication check.
*
* @throws ServletException
*/
@Override
public void doInit() throws ServletException {
s_prtlCreatePage = new PortalCreatePage();
s_prtlCreatePage.addRequestListener(new UserAuthenticationListener());
s_prtlCreatePage.lock();
}
/**
*
* @param sreq
* @param sresp
* @param app
* @throws ServletException
* @throws IOException
*/
public void doService(HttpServletRequest sreq,
HttpServletResponse sresp,
Application app)
throws ServletException, IOException {
s_log.debug("PortalCreatorServlet.doService called for request '" +
sreq.getRequestURI() + "'");
String pathInfo = sreq.getPathInfo();
Assert.exists(pathInfo, "String pathInfo");
if (pathInfo.length() > 1 && pathInfo.endsWith("/")) {
/* NOTE: ServletAPI specifies, pathInfo may be empty or will
* start with a '/' character. It currently carries a
* trailing '/' if a "virtual" page, i.e. not a real jsp, but
* result of a servlet mapping. But Application requires url
* NOT to end with a trailing '/' for legacy free applications. */
pathInfo = pathInfo.substring(0, pathInfo.length()-1);
}
Document doc = null;
doc = s_prtlCreatePage.buildDocument(sreq, sresp);
s_presManager.servePage(doc, sreq, sresp);
}
}

View File

@ -20,6 +20,8 @@ package com.arsdigita.portalserver.ui.admin;
import com.arsdigita.web.Application;
import com.arsdigita.persistence.*;
import com.arsdigita.web.URL;
import org.apache.log4j.Logger;
/**
@ -29,17 +31,65 @@ import org.apache.log4j.Logger;
*/
public class PortalSiteMap extends Application {
private static final Logger s_log = Logger.getLogger
(PortalSiteMap.class);
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(PortalSiteMap.class);
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.workspace.ui.PortalSiteMap";
"com.arsdigita.workspace.ui.PortalSiteMap";
/**
* Constgructor
* @param dataObject
*/
public PortalSiteMap(DataObject dataObject) {
super(dataObject);
}
/**
*
* @return
*/
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
public PortalSiteMap(DataObject dataObject) {
super(dataObject);
/**
* Returns the path name of the location of the applications servlet/JSP.
*
* Application implementations may overwrite this method to provide an
* application specific location, especially if an application (module) is
* to be installed along with others in one context.
*
* If you install the module into its own context you may use a standard
* location. In most cases though all modules (applications) of an
* webapplication should be installed into one context.
*
* Frequently it is a symbolic name/path, which will be mapped in the web.xml
* to the real location in the file system. Example:
* <servlet>
* <servlet-name>applicationName-files</servlet-name>
* <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>
* <init-param>
* <param-name>template-path</param-name>
* <param-value>/templates/ccm-applicationName</param-value>
* </init-param>
* </servlet>
*
* <servlet-mapping>
* <servlet-name>applicationName-files</servlet-name>
* <url-pattern>/ccm-applicationName/files/*</url-pattern>
* </servlet-mapping>
*
* NOTE: According to Servlet API the path always starts with a leading '/'
* and includes either the servlet name or a path to the servlet, but does
* not include any extra path information or a query string. Returns an
* empry string ("") is the servlet used was matched using the "/*" pattern.
*
* @return path name to the applications servlet/JSP
*/
@Override
public String getServletPath() {
return URL.SERVLET_DIR + "/portal-sitemap";
}
}

View File

@ -0,0 +1,116 @@
/*
* Copyright (C) 2012 Peter Boy 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.portalserver.ui.admin;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageFactory;
import com.arsdigita.templating.PresentationManager;
import com.arsdigita.templating.Templating;
import com.arsdigita.ui.login.UserAuthenticationListener;
import com.arsdigita.util.Assert;
import com.arsdigita.web.Application;
import com.arsdigita.web.BaseApplicationServlet;
import com.arsdigita.xml.Document;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
/**
*
* @author pb
*/
public class PortalSiteMapServlet extends BaseApplicationServlet {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(PortalSiteMapServlet.class);
private static final String XSL_HOOK = "portal-sitemap";
private static final PresentationManager s_presManager =
Templating.getPresentationManager();
private static Page s_indexPage = buildSiteMapPage();
/**
* User extension point, do some initializing
*
* @throws ServletException
*/
@Override
public void doInit() throws ServletException {
s_log.debug("PortalSiteMapServlet doInit() initialization executing!");
// do nothing for now.
}
/**
*
* @param sreq
* @param sresp
* @param app
* @throws ServletException
* @throws IOException
*/
public void doService(HttpServletRequest sreq,
HttpServletResponse sresp,
Application app)
throws ServletException, IOException {
s_log.debug("PortalSiteMApServlet.doService called for request '" +
sreq.getRequestURI() + "'");
String pathInfo = sreq.getPathInfo();
Assert.exists(pathInfo, "String pathInfo");
if (pathInfo.length() > 1 && pathInfo.endsWith("/")) {
/* NOTE: ServletAPI specifies, pathInfo may be empty or will
* start with a '/' character. It currently carries a
* trailing '/' if a "virtual" page, i.e. not a real jsp, but
* result of a servlet mapping. But Application requires url
* NOT to end with a trailing '/' for legacy free applications. */
pathInfo = pathInfo.substring(0, pathInfo.length()-1);
}
Document doc = null;
doc = s_indexPage.buildDocument(sreq, sresp);
s_presManager.servePage(doc, sreq, sresp);
}
/**
*
* @return
*/
static Page buildSiteMapPage() {
Page page = PageFactory.buildPage(XSL_HOOK, "Portal Site Map");
PortalSiteMapPanel sitemapPanel = new PortalSiteMapPanel(page);
page.add(sitemapPanel);
page.addRequestListener(new UserAuthenticationListener());
page.lock();
return page;
}
}

View File

@ -7,12 +7,63 @@
<!-- Servlets for the portalserver applications -->
<servlet>
<servlet-name>portalsite</servlet-name>
<servlet-class>com.arsdigita.portalserver.PortalServlet</servlet-class>
<servlet-class>com.arsdigita.portalserver.PortalSiteServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>portalsite-admin</servlet-name>
<servlet-class>com.arsdigita.portalserver.admin.PSAdminServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>portal-creator</servlet-name>
<servlet-class>com.arsdigita.portalserver.ui.admin.PortalCreatorServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>portal-sitemap</servlet-name>
<servlet-class>com.arsdigita.portalserver.ui.admin.PortalSiteMapServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>portal-personalportal</servlet-name>
<servlet-class>com.arsdigita.portalserver.personal.PersonalPortalServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>portal-personalportal</servlet-name>
<servlet-class>com.arsdigita.portalserver.personal.PersonalPortalCreatorServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>portalsite</servlet-name>
<url-pattern>/templates/servlet/portalsite/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>portalsite-admin</servlet-name>
<url-pattern>/templates/servlet/psadmin/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>portal-creator</servlet-name>
<url-pattern>/templates/servlet/portal-creator/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>portal-sitemap</servlet-name>
<url-pattern>/templates/servlet/portal-sitemap/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>portal-personalportal</servlet-name>
<url-pattern>/templates/servlet/personal-portal/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>portal-personalportal</servlet-name>
<url-pattern>/templates/servlet/personal-portal-creator/*</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -1,6 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:include href="../../../packages/portalserver/xsl/portalserver.xsl"/>
</xsl:stylesheet>

View File

@ -1,14 +1,13 @@
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
xmlns:portalserver="http://www.redhat.com/portalserver/1.0"
xmlns:portlet="http://www.arsdigita.com/portlet/1.0"
xmlns:km="http://www.arsdigita.com/km/1.0"
xmlns:deditor="http://www.arsdigita.com/deditor/1.0"
xmlns:admin="http://www.arsdigita.com/admin-ui/1.0"
xmlns:cms="http://www.arsdigita.com/cms/1.0">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
xmlns:portalserver="http://www.redhat.com/portalserver/1.0"
xmlns:portlet="http://www.arsdigita.com/portlet/1.0"
xmlns:km="http://www.arsdigita.com/km/1.0"
xmlns:deditor="http://www.arsdigita.com/deditor/1.0"
xmlns:admin="http://www.arsdigita.com/admin-ui/1.0"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
version="1.0">
<!-- The order of imports below is important. Please don't change
them without appropriate testing. -->
@ -17,23 +16,31 @@
<xsl:import href="../../categorization/xsl/categorization.xsl"/>
<xsl:import href="../../bebop/xsl/DimensionalNavbar.xsl"/>
<xsl:import href="../../toolbox/xsl/ControlBar.xsl"/>
<!--
<xsl:import href="../../portlets/xsl/freeform-html-portlet.xsl"/>
<!-- <xsl:import href="../../portlets/xsl/time-of-day-portlet.xsl"/> -->
<xsl:import href="../../portlets/xsl/time-of-day-portlet.xsl"/>
<xsl:import href="../../portlets/xsl/rss-feed-portlet.xsl"/>
-->
<xsl:output method="html" indent="yes"/>
<xsl:param name="internal-theme"/>
<!-- Currently not used here
<xsl:param name="contextPath"/>
-->
<!--
<xsl:variable name="image-dir">{$internal-theme}/images/portalserver</xsl:variable>
<xsl:variable name="css-dir">{$internal-theme}/css/portalserver</xsl:variable>
<xsl:variable name="image-dir">/themes/heirloom/images/portalserver</xsl:variable>
-->
<xsl:template match="bebop:page[@class='portalserver']">
<html>
<head>
<title><xsl:value-of select="bebop:title"/></title>
<link href="{$css-dir}/portalserver.css" rel="stylesheet" type="text/css"/>
<link href="{$internal-theme}/css/portalserver/portalserver.css"
rel="stylesheet" type="text/css"/>
<xsl:for-each select="bebop:stylesheet">
<link href="{@href}" rel="stylesheet" type="{@type}"/>
</xsl:for-each>
@ -62,7 +69,8 @@
<html>
<head>
<title><xsl:value-of select="bebop:title"/></title>
<link href="{$css-dir}/portalserver.css" rel="stylesheet" type="text/css"/>
<link href="{$internal-theme}/css/portalserver/portalserver.css"
rel="stylesheet" type="text/css"/>
<xsl:for-each select="bebop:stylesheet">
<link href="{@href}" rel="stylesheet" type="{@type}"/>
</xsl:for-each>
@ -275,7 +283,8 @@
<xsl:template match="bebop:link[@class = 'W']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/cw/W_off.png" border="0" width="70" height ="30">
<img src ="{$internal-theme}/images/portalserver/cw/W_off.png" border="0"
width="70" height ="30">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>
@ -285,7 +294,8 @@
<xsl:template match="bebop:link[@class = 'NW']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/cw/NW_off.png" border="0" width="70" height ="30">
<img src ="{$internal-theme}/images/portalserver/cw/NW_off.png" border="0"
width="70" height ="30">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>
@ -295,7 +305,8 @@
<xsl:template match="bebop:link[@class = 'WN']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/cw/WN_off.png" border="0" width="70" height ="30">
<img src ="{$internal-theme}/images/portalserver/cw/WN_off.png" border="0"
width="70" height ="30">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>
@ -305,7 +316,8 @@
<xsl:template match="bebop:link[@class = 'NWN']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/cw/NWN_off.png" border="0" width="70" height ="30">
<img src ="{$internal-theme}/images/portalserver/cw/NWN_off.png" border="0"
width="70" height ="30">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>
@ -315,7 +327,8 @@
<xsl:template match="bebop:link[@class = 'NNN']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/cw/NNN_off.png" border="0" width="70" height ="30">
<img src ="{$internal-theme}/images/portalserver/cw/NNN_off.png" border="0"
width="70" height ="30">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>
@ -325,7 +338,8 @@
<xsl:template match="bebop:label[@class = 'W']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/cw/W_on.png" border="0" width="70" height ="30">
<img src ="{$internal-theme}/images/portalserver/cw/W_on.png" border="0"
width="70" height ="30">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>
@ -335,7 +349,8 @@
<xsl:template match="bebop:label[@class = 'NW']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/cw/NW_on.png" border="0" width="70" height ="30">
<img src ="{$internal-theme}/images/portalserver/cw/NW_on.png" border="0"
width="70" height ="30">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>
@ -345,7 +360,8 @@
<xsl:template match="bebop:label[@class = 'WN']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/cw/WN_on.png" border="0" width="70" height ="30">
<img src ="{$internal-theme}/images/portalserver/cw/WN_on.png" border="0"
width="70" height ="30">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>
@ -355,7 +371,8 @@
<xsl:template match="bebop:label[@class = 'NWN']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/cw/NWN_on.png" border="0" width="70" height ="30">
<img src ="{$internal-theme}/images/portalserver/cw/NWN_on.png" border="0"
width="70" height ="30">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>
@ -365,7 +382,8 @@
<xsl:template match="bebop:label[@class = 'NNN']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/cw/NNN_on.png" border="0" width="70" height ="30">
<img src ="{$internal-theme}/images/portalserver/cw/NNN_on.png" border="0"
width="70" height ="30">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>
@ -391,7 +409,8 @@
<tr><td><xsl:apply-templates select="bebop:cell[2]"/></td></tr>
</table>
</td>
<td class="inactiveTabColor" width="2"><img src="{$internal-theme}/images/spacer.gif" width="2"/></td>
<td class="inactiveTabColor" width="2">
<img src="{$internal-theme}/images/spacer.gif" width="2"/></td>
<td class="splitPanelRight">
<table width="100%" cellspacing="4" cellpadding="0" border="0">
<tr><td><xsl:apply-templates select="bebop:cell[3]"/></td></tr>
@ -411,7 +430,9 @@
</table>
</td>
</tr>
<tr><td colspan="3" class="inactiveTabColor" height="2"><img src="{$internal-theme}/images/spacer.gif" height="2"/></td></tr>
<tr><td colspan="3" class="inactiveTabColor" height="2">
<img src="{$internal-theme}/images/spacer.gif" height="2"/></td>
</tr>
</xsl:if>
<tr>
<td width="35%">
@ -419,7 +440,8 @@
<tr><td><xsl:apply-templates select="bebop:cell[2]"/></td></tr>
</table>
</td>
<td class="inactiveTabColor" width="2"><img src="{$internal-theme}/images/spacer.gif" width="2"/></td>
<td class="inactiveTabColor" width="2">
<img src="{$internal-theme}/images/spacer.gif" width="2"/></td>
<td width="65%">
<table width="100%" cellspacing="4" cellpadding="0" border="0">
<tr><td><xsl:apply-templates select="bebop:cell[3]"/></td></tr>
@ -452,7 +474,8 @@
<tr height="3"><td></td></tr>
<tr height="23">
<td class="tabBeginningOff"><xsl:text>&#160;&#160;</xsl:text></td>
<td class="inactiveTab" nowrap="nowrap"><a href="{@href}"><xsl:apply-templates select="bebop:label"/></a>
<td class="inactiveTab" nowrap="nowrap">
<a href="{@href}"><xsl:apply-templates select="bebop:label"/></a>
</td>
<td class="tabEndOff"><xsl:text>&#160;&#160;</xsl:text></td>
</tr>
@ -511,7 +534,8 @@
<xsl:apply-templates select="."/>
</xsl:for-each>
</td>
<td class="columnSeparator"><img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="columnSeparator">
<img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="wideColumn">
<xsl:for-each select="bebop:portlet[@cellNumber = '2']">
<xsl:apply-templates select="."/>
@ -553,7 +577,8 @@
<xsl:apply-templates select="."/>
</xsl:for-each>
</td>
<td class="columnSeparator"><img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="columnSeparator">
<img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="wideColumn">
<xsl:for-each select="bebop:portlet[@cellNumber = '2']">
<xsl:apply-templates select="."/>
@ -578,7 +603,8 @@
<xsl:apply-templates select="."/>
</xsl:for-each>
</td>
<td class="columnSeparator"><img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="columnSeparator">
<img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="narrowColumn">
<xsl:for-each select="bebop:portlet[@cellNumber = '2']">
<xsl:apply-templates select="."/>
@ -603,13 +629,15 @@
<xsl:apply-templates select="."/>
</xsl:for-each>
</td>
<td class="columnSeparator"><img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="columnSeparator">
<img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="wideColumn">
<xsl:for-each select="bebop:portlet[@cellNumber = '2']">
<xsl:apply-templates select="."/>
</xsl:for-each>
</td>
<td class="columnSeparator"><img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="columnSeparator">
<img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="narrowColumnRight">
<xsl:for-each select="bebop:portlet[@cellNumber = '3']">
<xsl:apply-templates select="."/>
@ -634,13 +662,15 @@
<xsl:apply-templates select="."/>
</xsl:for-each>
</td>
<td class="columnSeparator"><img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="columnSeparator">
<img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="narrowColumnCenter">
<xsl:for-each select="bebop:portlet[@cellNumber = '2']">
<xsl:apply-templates select="."/>
</xsl:for-each>
</td>
<td class="columnSeparator"><img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="columnSeparator">
<img src="{$internal-theme}/images/spacer.gif" width="5"/></td>
<td class="narrowColumnRight">
<xsl:for-each select="bebop:portlet[@cellNumber = '3']">
<xsl:apply-templates select="."/>
@ -653,44 +683,69 @@
</xsl:template>
<xsl:template match="bebop:portlet">
<table class="portlet" cellspacing="0"> <!-- IE5.5 ignores border-spacing CSS prop, so cellspacing attr is necesssary -->
<table class="portlet" cellspacing="0">
<!-- IE5.5 ignores border-spacing CSS prop, so cellspacing attr is necesssary -->
<tr>
<td class="portletHeader"><xsl:value-of select="@title"/></td>
<td class="portletIcon">
<xsl:choose>
<xsl:when test="@configure">
<xsl:if test="@leftURL">
<a href="{@leftURL}"><img src="{$image-dir}/Left16.gif" width="16" height="16" alt="Move Portlet left" align="bottom" border="0"/></a>
<a href="{@leftURL}">
<img src="{$internal-theme}/images/portalserver/Left16.gif"
width="16" height="16" alt="Move Portlet left" align="bottom"
border="0"/>
</a>
</xsl:if>
<xsl:if test="@prevURL">
<a href="{@prevURL}"><img src="{$image-dir}/Up16.gif" width="16" height="16" alt="Move Portlet Up" align="bottom" border="0"/></a>
<a href="{@prevURL}">
<img src="{$internal-theme}/images/portalserver/Up16.gif"
width="16" height="16" alt="Move Portlet Up"
align="bottom" border="0"/></a>
</xsl:if>
<xsl:if test="@nextURL">
<a href="{@nextURL}"><img src="{$image-dir}/Down16.gif" width="16" height="16" alt="Move Portlet Down" align="bottom" border="0"/></a>
<a href="{@nextURL}">
<img src="{$internal-theme}/images/portalserver/Down16.gif"
width="16" height="16" alt="Move Portlet Down"
align="bottom" border="0"/></a>
</xsl:if>
<xsl:if test="@rightURL">
<a href="{@rightURL}"><img src="{$image-dir}/Right16.gif" width="16" height="16" alt="Move Portlet right" align="bottom" border="0"/></a>
<a href="{@rightURL}">
<img src="{$internal-theme}/images/portalserver/Right16.gif"
width="16" height="16" alt="Move Portlet right"
align="bottom" border="0"/></a>
</xsl:if>
<xsl:if test="@cfgURL">
<a href="{@cfgURL}"><img src="{$image-dir}/Edit16.gif" width="16" height="16" alt="Customize Portlet" align="bottom" border="0"/></a>
<a href="{@cfgURL}">
<img src="{$internal-theme}/images/portalserver/Edit16.gif"
width="16" height="16" alt="Customize Portlet"
align="bottom" border="0"/></a>
</xsl:if>
<a href="{@delURL}" onclick="return confirm('Are you sure you want to delete this portlet?')"><img src="{$image-dir}/Delete16.gif" width="16" height="16" alt="Remove Portlet" align="bottom" border="0"/></a>
<a href="{@delURL}"
onclick="return confirm('Are you sure you want to delete this portlet?')">
<img src="{$internal-theme}/images/portalserver/Delete16.gif"
width="16" height="16" alt="Remove Portlet"
align="bottom" border="0"/></a>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@applicationlink">
<a href="{@applicationlink}"><img src="{$image-dir}/ZoomIn16.gif" width="16" height="16" alt="Zoom In" align="bottom" border="0"/></a>
<a href="{@applicationlink}">
<img src="{$internal-theme}/images/portalserver/ZoomIn16.gif"
width="16" height="16" alt="Zoom In"
align="bottom" border="0"/></a>
</xsl:when>
<xsl:otherwise>
<!-- replace with grayed out button -->
<img src="{$internal-theme}/images/spacer.gif" width="16" height="16" align="bottom" border="0"/>
<img src="{$internal-theme}/images/spacer.gif"
width="16" height="16" align="bottom" border="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
@ -760,7 +815,8 @@
</td></tr>
</xsl:if>
<tr>
<xsl:variable name="portletCount" select="count(portalserver:appsDisplayAppPortlet)"/>
<xsl:variable name="portletCount"
select="count(portalserver:appsDisplayAppPortlet)"/>
<td rowspan="{$portletCount}">
<xsl:apply-templates select="bebop:link[1]"/>
</td>
@ -778,7 +834,10 @@
<xsl:when test="$portletCount > 0">
<td class="numeric">1.</td>
<td><xsl:value-of select="portalserver:appsDisplayAppPortlet[1]/@name"/></td>
<td class="icon"><xsl:apply-templates select="portalserver:appsDisplayAppPortlet[1]/bebop:link"/></td>
<td class="icon">
<xsl:apply-templates
select="portalserver:appsDisplayAppPortlet[1]/bebop:link"/>
</td>
</xsl:when>
<xsl:otherwise>
<td class="numeric"><xsl:text>&#160;</xsl:text></td>
@ -840,7 +899,8 @@
<xsl:template match="bebop:link[@class = 'shiftleft']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/Up16.gif" border="0" width="16" height ="16">
<img src ="{$internal-theme}/images/portalserver/Up16.gif" border="0"
width="16" height ="16">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>
@ -850,7 +910,8 @@
<xsl:template match="bebop:link[@class = 'shiftright']">
<a href="{@href}" onclick="{@onclick}">
<img src ="{$image-dir}/Down16.gif" border="0" width="16" height ="16">
<img src ="{$internal-theme}/images/portalserver/Down16.gif" border="0"
width="16" height ="16">
<xsl:attribute name="alt">
<xsl:apply-templates/>
</xsl:attribute>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
xmlns:ui="http://www.arsdigita.com/ui/1.0">
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
xmlns:ui="http://www.arsdigita.com/ui/1.0">
<!--
A convenient collection of UI XSL templates

View File

@ -97,12 +97,6 @@ public class Initializer extends CompoundInitializer {
"WebLogs", "http://www.undp.org/weblog");
s_log.debug("Just added package type WebLog ");
// Old style StylesheetResolver where location of stylesheets are stored
// in db and as well as mappings to applications.
// New style is pattern based, see cpom.arsdigita.templating
// Stylesheet entitySheet = Stylesheet
// .createStylesheet("/packages/weblog/xsl/weblog.xsl");
// entityType.addStylesheet(entitySheet);
entityType.setDispatcherClass(WebLogDispatcher.class.getName());