CMS Service ist jetzt legacy free. Hoffentlich habe ich alle Verwendungen von SiteNodes gefunden.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1520 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2012-02-25 00:51:01 +00:00
parent 5b5564c570
commit 0171ad1c91
45 changed files with 528 additions and 443 deletions

View File

@ -20,9 +20,10 @@ import com.arsdigita.bebop.table.AbstractTableModelBuilder;
import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.Service;
import com.arsdigita.cms.contentassets.FileAttachment;
import com.arsdigita.cms.dispatcher.StreamAsset;
import com.arsdigita.cms.dispatcher.Utilities;
// import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.web.ParameterMap;
@ -120,8 +121,11 @@ public class FileAttachmentModelBuilder extends AbstractTableModelBuilder {
// TODO provide API for asset URL
ParameterMap params = new ParameterMap();
params.setParameter(StreamAsset.ASSET_ID, _file.getID());
return URL.there( Utilities.getServiceURL()+"download/asset",
params ).getURL();
// return URL.there( Utilities.getServiceURL()+"download/asset",
// params ).getURL();
return URL
.there(Service.getURL()+"/download/asset", params )
.getURL();
}else{
return _file.getDescription();
}

View File

@ -140,6 +140,7 @@ public class ImageStepDisplay extends SimpleContainer {
container.setBorder( 1 );
container.add( new ImageDisplay(null) {
@Override
protected void generateImagePropertiesXML( ImageAsset image,
PageState state,
Element element ) {

View File

@ -23,7 +23,7 @@ import com.arsdigita.cms.contenttypes.util.OrganizationGlobalizationUtil;
import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.dispatcher.Utilities;
// import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
@ -33,6 +33,7 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import com.arsdigita.cms.ui.authoring.WorkflowLockedComponentAccess;
import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.Service;
import java.math.BigDecimal;
@ -110,9 +111,13 @@ public class OrganizationImageStep
heightStr = " height=\"" + height.toString() + "\" ";
}
// String labelStr = "<img src=\"" +
// Utilities.getImageURL(image) +
// "\" " + widthStr + heightStr + "/>";
String labelStr = "<img src=\"" +
Utilities.getImageURL(image) +
"\" " + widthStr + heightStr + "/>";
Service.getImageURL(image) +
"\" " + widthStr + heightStr + "/>";
return labelStr;
}
}

View File

@ -18,6 +18,7 @@
*/
package com.arsdigita.cms;
import com.arsdigita.bebop.PageState;
import org.apache.log4j.Logger;
/**
@ -87,4 +88,16 @@ public abstract class CMS {
static final void setContext(CMSContext context) {
s_context.set(context);
}
/**
* Fetch the security manager.
*
* @param state The page state
* @return The SecurityManager for the content section
*/
public static SecurityManager getSecurityManager(PageState state) {
ContentSection section = CMS.getContext().getContentSection();
return new SecurityManager(section);
}
}

View File

@ -33,7 +33,6 @@ import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.globalization.Locale;
import com.arsdigita.kernel.Group;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.persistence.CompoundFilter;
import com.arsdigita.persistence.DataAssociation;
@ -51,12 +50,13 @@ import com.arsdigita.web.URL;
import com.arsdigita.web.Web;
import com.arsdigita.workflow.simple.TaskCollection;
import com.arsdigita.workflow.simple.WorkflowTemplate;
import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.StringTokenizer;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
/**
* <p>A content section represents a collection of content that is
@ -919,68 +919,30 @@ public class ContentSection extends Application {
//
// Finding a content section.
//
/**
* Looks up the section given the SiteNode.
*
* @param node The site node
* @param path
* @return The content section
* @pre ( node != null )
* @pre ( path != null )
* @post ( return != null )
*/
public static ContentSection getSectionFromNode(SiteNode node)
public static ContentSection getSectionForPath(String path)
throws DataObjectNotFoundException {
return (ContentSection) retrieveApplicationForSiteNode(node);
// BigDecimal sectionId = null;
//
// PackageInstance pkg = node.getPackageInstance();
// if ( pkg == null ) {
// throw new DataObjectNotFoundException(
// "No package instance for node_id=" + node.getID().toString());
// }
//
// return getSectionFromPackage(pkg);
return (ContentSection) retrieveApplicationForPath(path);
}
// /**
// * Looks up the section given the PackageInstance.
// *
// * @param pkg The package instance
// * @return The content section ID
// * @pre ( pkg != null )
// * @post ( return != null )
// */
// public static ContentSection getSectionFromPackage(PackageInstance pkg)
// throws DataObjectNotFoundException {
//
// ContentSection section = null;
//
// final String query = "com.arsdigita.cms.getSectionFromPackage";
// DataQuery dq = SessionManager.getSession().retrieveQuery(query);
// dq.setParameter("packageId", pkg.getID());
// if ( dq.next() ) {
// DataObject dobj = (DataObject) dq.get("section");
// if ( dobj != null ) {
// section = (ContentSection) DomainObjectFactory.newInstance(dobj);
// }
// dq.close();
// } else {
// throw new DataObjectNotFoundException(
// "Failed to fetch a content section for the current package " +
// "instance. [package_id =" + pkg.getID().toString() + "]");
// }
// return section;
// }
/**
* Get the content section for an item.
*
* @deprecated use {@link ContentItem#getContentSection} instead
*
* @pre item != null
* @post return != null
* @param item A content item
* @return The content section of an item
*
* @deprecated use {@link ContentItem#getContentSection} instead
*/
public static ContentSection getContentSection(ContentItem item)
throws DataObjectNotFoundException {
@ -991,11 +953,11 @@ public class ContentSection extends Application {
/**
* Get the content section for a folder.
*
* @deprecated use {@link ContentItem#getContentSection} instead
* @pre item != null
* @post return != null
* @param folder A content folder
* @return The content section of the folder
* @deprecated use {@link ContentItem#getContentSection} instead
*/
public static ContentSection getContentSection(Folder folder)
throws DataObjectNotFoundException {

View File

@ -138,38 +138,22 @@ public class Loader extends PackageLoader {
public void excurse() {
setEffectiveParty(Kernel.getSystemParty());
// 2 - step 1b) Setup the Workspace package.
// loadWorkspacePackage(); // using old stype
// new style:
// Step 1) Setup the CMS Workspace
ApplicationType appType = loadWorkspaceApplicationType();
setupDefaultWorkspaceApplicationInstance(appType);
// 3 - step 1c) Setup the CMS global services package.
// loadServicePackage(); // using olde style
// new style:
// Step 2) Setup the CMS global services
appType = loadServiceApplicationType();
setupDefaultServiceApplicationInstance(appType);
// 4 - step 1d) Load the content-center page mappings
// Wrong! Is Initializer task, must be done each startup, in
// any way not a Loader task. It is here for reference
// purpose during migration of the whole CMS to new style.
// loadContentCenterMapping(s_conf.getContentCenterMap() );
// 5) load (cms internal) content type definition(s)
// Used to be step 2 in former enterprise.init file
// Step 3) load (cms internal) content type definition(s)
loadContentTypeDefinitions(s_conf.getCTDefFiles());
// 6) Load CMS (content section) package application instance
// Used to be step 4 in former enterprise.init file
// (step 3 being initialize publishToFile, not to handle in Loader)
// Implemented by
// com.arsdigita.cms.installer.SectionInitializer
// Step 4) Load CMS content section
// Loads content section application type and instance in one step
loadContentSection( (String[]) get(m_contentSectionNames) );
// Loading CMS portlets
// Used to be step 7 (last step) in former enterprise.init
// Step 5) Loading CMS portlets
s_log.debug("CMS.loader going to load portlets");
ContentDirectoryPortlet.loadPortletType();
ContentItemPortlet.loadPortletType();
@ -277,16 +261,28 @@ public class Loader extends PackageLoader {
// ApplicationType serviceType = appsetup.run();
// serviceType.save();
// ////////////// Current style to create app type ///////////////
/* Create new stype legacy compatible application type */
ApplicationType serviceType = ApplicationType
.createApplicationType(Service.PACKAGE_KEY,
Service.INSTANCE_NAME,
Service.BASE_DATA_OBJECT_TYPE);
serviceType.setDescription("Services to store global resources and assets.");
serviceType.setDispatcherClass(Service.DISPATCHER_CLASS);
serviceType.save();
/* Create new type legacy compatible application type */
// ApplicationType type = ApplicationType
// .createApplicationType(Service.PACKAGE_KEY,
// Service.INSTANCE_NAME,
// Service.BASE_DATA_OBJECT_TYPE);
// type.setDispatcherClass(Service.DISPATCHER_CLASS);
return serviceType;
/* Create new type legacy free application type
* NOTE: The wording in the title parameter of ApplicationType
* determines the name of the subdirectory for the XSL stylesheets.
* It gets "urlized", i.e. trimming leading and trailing blanks and
* replacing blanks between words and illegal characters with an
* hyphen and converted to lower case.
* "Content Section" will become "content-section". */
ApplicationType type = new ApplicationType(
Service.INSTANCE_NAME,
Service.BASE_DATA_OBJECT_TYPE );
type.setDescription("Services to store global resources and assets.");
type.save();
return type;
}
@ -299,10 +295,10 @@ public class Loader extends PackageLoader {
// create legacy compatible application instance,
// old-style package key used as url fragment where to install the instance
Service app = (Service) Application.createApplication(
serviceType, // type
Service.PACKAGE_KEY, // url fragment
Service.INSTANCE_NAME,// title
null); // parent
serviceType, // type
Service.PACKAGE_KEY, // url fragment
"CMS Service Instance", // title
null); // parent
app.setDescription("The default CMS service instance.");
app.save();

View File

@ -18,12 +18,15 @@
*/
package com.arsdigita.cms;
import com.arsdigita.cms.dispatcher.StreamAsset;
import com.arsdigita.cms.dispatcher.StreamImage;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
// import com.arsdigita.persistence.DataAssociation;
// import com.arsdigita.persistence.PersistenceException;
import com.arsdigita.web.Application;
import com.arsdigita.web.URL;
import java.math.BigDecimal;
@ -97,12 +100,66 @@ public class Service extends Application {
return BASE_DATA_OBJECT_TYPE;
}
public static String getURL() {
return "/" + PACKAGE_KEY + "/";
}
/**
* Constuct a URL which serves a binary asset.
*
* @param asset The binary asset
* @return the URL which will serve the specified binary asset
*/
public static String getAssetURL(BinaryAsset asset) {
return getAssetURL(asset.getID());
}
/**
* Constuct a URL which serves a binary asset.
*
* @param assetId The asset ID
* @return the URL which will serve the specified binary asset
*/
public static String getAssetURL(BigDecimal assetId) {
StringBuilder buf = new StringBuilder(Service.getURL() );
buf.append("stream/asset?");
buf.append(StreamAsset.ASSET_ID).append("=").append(assetId);
return buf.toString();
}
/**
* Constuct a URL which serves an image.
*
* @param asset The image asset whose image is to be served
* @return the URL which will serve the specified image asset
*/
public static String getImageURL(ImageAsset asset) {
StringBuilder buf = new StringBuilder(Service.getURL() );
buf.append("stream/image/?");
buf.append(StreamImage.IMAGE_ID).append("=").append(asset.getID());
return buf.toString();
}
/**
* The URL to log out.
* @return The logout URL
*/
public static String getLogoutURL() {
StringBuilder buf = new StringBuilder(Service.getURL() );
buf.append("logout");
return buf.toString();
}
/**
* This is called when the application is created.
*/
public static Service create(String urlName,
String title,
Application parent) {
String title,
Application parent) {
Service app = (Service) Application.createApplication
(BASE_DATA_OBJECT_TYPE, urlName, title, parent);
@ -112,5 +169,11 @@ public class Service extends Application {
return app;
}
@Override
public String getServletPath() {
//return URL.SERVLET_DIR + "/cms-service";
return "/templates/servlet/cms-service";
}
}

View File

@ -51,6 +51,15 @@ import org.xml.sax.helpers.DefaultHandler;
* URLs of the available services are stored in a XML file which is processed
* into a cache of services on a request by request basis (lazy loading).
*
* ServiceServlet is called by BaseApplicationServlet which has determined that
* ServiceServlet is associated with a request URL.
*
* The CMS Service determines whether a <tt>Page</tt> has been registered to
* the URL and if so passes the request to that page.
*
* If no <tt>Page</tt> is registered to the URL, then the CMS Service hands
* the request to the TemplateResolver to find an appropriate JSP file.
*
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
* @version $Id: ServiceServlet.java 2161 2011-02-02 00:16:13Z pboy $
*/
@ -68,9 +77,7 @@ public class ServiceServlet extends BaseApplicationServlet {
/** Mapping between a relative URL and the class name of a ResourceHandler.*/
private static HashMap s_pageClasses = new HashMap();
/**
* Instantiated ResourceHandler cache. This allows for lazy loading.
*/
/** Instantiated ResourceHandler cache. This allows for lazy loading. */
private static SimpleCache s_pages = new SimpleCache();
/** List of URLs which require a trailing slash. These are required for
@ -80,6 +87,7 @@ public class ServiceServlet extends BaseApplicationServlet {
/** Path to directory containg ccm-cms template files */
private String m_templatePath;
/** Resolvers to find templages (JSP) and other stuff stored in file system.*/
private ApplicationFileResolver m_resolver;
@ -101,20 +109,21 @@ public class ServiceServlet extends BaseApplicationServlet {
/* Process mapping file. */
readFromFile(MAP_FILE);
/** Set Template base path for JSP's */
m_templatePath = ContentSection.getConfig().getTemplateRoot();
Assert.exists(m_templatePath, String.class);
Assert.isTrue(m_templatePath.startsWith("/"),
"template-path must start with '/'");
Assert.isTrue(!m_templatePath.endsWith("/"),
"template-path must not end with '/'");
/** Set TemplateResolver class */
m_resolver = Web.getConfig().getApplicationFileResolver();
}
/**
* Implements the (abstract) doService method of BaseApplicationServlet to
* create the perform the services.
*
* perform the services.
* @see com.arsdigita.web.BaseApplicationServlet#doService
* (HttpServletRequest, HttpServletResponse, Application)
*/
@ -152,15 +161,10 @@ public class ServiceServlet extends BaseApplicationServlet {
page.dispatch(sreq, sresp, ctx);
} else {
// Fall back on the JSP application dispatcher.
// m_notFoundHandler.dispatch(request, response, actx);
if (s_log.isInfoEnabled()) {
s_log.info("NOT serving content item");
s_log.info("NO page registered to serve the requst url.");
}
/* Store content section in http request to make it available
* or admin index,jsp */
// sreq.setAttribute(CONTENT_SECTION, section);
RequestDispatcher rd = m_resolver.resolve(m_templatePath,
sreq, sresp, app);
if (rd != null) {
@ -170,7 +174,6 @@ public class ServiceServlet extends BaseApplicationServlet {
sreq = DispatcherHelper.restoreOriginalRequest(sreq);
rd.forward(sreq,sresp);
} else {
// sresp.sendError(404, packageURL + " not found on this server.");
sresp.sendError(404, requestUri + " not found on this server.");
}

View File

@ -25,6 +25,8 @@ import com.arsdigita.persistence.OID;
// import com.arsdigita.persistence.PersistenceException;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationCollection;
import com.arsdigita.web.ApplicationType;
import java.math.BigDecimal;
import org.apache.log4j.Logger;
@ -107,4 +109,39 @@ public class Workspace extends Application {
return app;
}
/**
* Returns an instance of the Workspace application. There must not more
* than one instance exist. May return null.
*/
public static Application getInstance() {
ApplicationType workspaceType = ApplicationType.
retrieveApplicationTypeForApplication(BASE_DATA_OBJECT_TYPE);
if ( workspaceType == null ) { return null; }
ApplicationCollection apps = Application.retrieveAllApplications();
apps.addEqualsFilter("resourceType.id", workspaceType.getID());
if ( !apps.next() ) { return null; }
Application result = apps.getApplication();
apps.close();
return result;
}
/**
* Fetch the location (URL) of the CMS Workspace. There must not more than
* one instance exist.
*
* @return The URL of the CMS Workspace (currently including trailing slash)
*/
public static String getURL() {
Application app = Workspace.getInstance();
if (app == null) {
return null;
} else {
String url = (String) app.getPrimaryURL();
return url;
}
}
}

View File

@ -32,7 +32,6 @@ import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.ACSObjectCache;
import com.arsdigita.kernel.KernelHelper;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.User;
import com.arsdigita.web.LoginSignal;
import com.arsdigita.web.URL;
@ -451,8 +450,7 @@ public class CMSDispatcher implements Dispatcher, ChainedDispatcher {
}
// Fetch the current site node from the URL.
SiteNode sn = SiteNode.getSiteNode(url);
ContentSection section = ContentSection.getSectionFromNode(sn);
ContentSection section = ContentSection.getSectionForPath(url);
return section;
}

View File

@ -27,6 +27,7 @@ import com.arsdigita.bebop.page.PageTransformer;
import com.arsdigita.cms.CMSExcursion;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionServlet;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.developersupport.DeveloperSupport;
import com.arsdigita.dispatcher.RequestContext;
@ -194,7 +195,8 @@ public class CMSPage extends Page implements ResourceHandler {
*/
public ContentSection getContentSection(HttpServletRequest request) {
// Resets all content sections associations.
return ContentSectionDispatcher.getContentSection(request);
// return ContentSectionDispatcher.getContentSection(request);
return ContentSectionServlet.getContentSection(request);
}
/**

View File

@ -27,7 +27,6 @@ import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelContext;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.User;
import com.arsdigita.sitenode.SiteNodeRequestContext;
import com.arsdigita.util.Assert;
@ -104,9 +103,8 @@ public class ContentSectionDispatcher implements Dispatcher {
try {
// Fetch the current site node from the request context;
SiteNode sn = actx.getSiteNode();
ContentSection section = ContentSection.getSectionFromNode(sn);
ContentSection section = (ContentSection) ContentSection
.getCurrentApplication(request);
Assert.exists(section);
request.setAttribute(CONTENT_SECTION, section);

View File

@ -21,6 +21,7 @@ package com.arsdigita.cms.dispatcher;
import com.arsdigita.cms.CMSExcursion;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionServlet;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.lifecycle.Lifecycle;
import com.arsdigita.dispatcher.ChainedDispatcher;
@ -32,14 +33,17 @@ import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.User;
import com.arsdigita.versioning.Transaction;
import com.arsdigita.web.LoginSignal;
import java.io.IOException;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
/**
@ -129,7 +133,8 @@ public class ItemDispatcher implements ChainedDispatcher {
}
final ContentSection section =
ContentSectionDispatcher.getContentSection(request);
ContentSectionServlet.getContentSection(request);
// ContentSectionDispatcher.getContentSection(request);
final ContentItem item = getItem(section, url);
if (item == null) {

View File

@ -24,6 +24,7 @@ import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Folder;
import com.arsdigita.cms.Workspace;
import com.arsdigita.cms.ui.ContentItemPage;
import com.arsdigita.cms.util.LanguageUtil;
import com.arsdigita.domain.DomainObjectFactory;
@ -245,7 +246,7 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
// Determine if we are under the admin UI.
if (url.startsWith(ADMIN_PREFIX) || url.startsWith(Utilities.getWorkspaceURL())) {
if (url.startsWith(ADMIN_PREFIX) || url.startsWith(Workspace.getURL())) {
return ContentItem.DRAFT;
} else {
return ContentItem.LIVE;

View File

@ -24,6 +24,7 @@ import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Folder;
import com.arsdigita.cms.Workspace;
import com.arsdigita.cms.ui.ContentItemPage;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.dispatcher.DispatcherHelper;
@ -63,7 +64,7 @@ public class SimpleItemResolver extends AbstractItemResolver implements ItemReso
Logger.getLogger(SimpleItemResolver.class.getName());
private static final String ADMIN_PREFIX = "admin";
private static final String WORKSPACE_PREFIX = Utilities.getWorkspaceURL();
private static final String WORKSPACE_PREFIX = Workspace.getURL();
private static MasterPage s_masterP = null;

View File

@ -24,16 +24,12 @@ import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.Service;
import com.arsdigita.cms.Workspace;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelContext;
import com.arsdigita.kernel.PackageInstance;
import com.arsdigita.kernel.PackageInstanceCollection;
import com.arsdigita.kernel.PackageType;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.SiteNodeCollection;
import com.arsdigita.kernel.User;
import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -43,6 +39,8 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
/**
* <p>This class provides many utility functions for the Content Management
* System.</p>
@ -63,23 +61,20 @@ public class Utilities {
public static final Logger LOG = Logger.getLogger(Utilities.class);
/**
* Fetch the location of the CMS Workspace package. Caches the result.
* Fetch the location of the CMS Workspace package.
* @return The URL of the CMS Workspace package
* @deprecated without direct replacement yet, refactor code to use
* legacy free code in com.arsdigita.web
* @deprecated use Workspace.getURL() instead
*/
public static String getWorkspaceURL() {
String url = (String) m_cache.get(CMS.WORKSPACE_PACKAGE_KEY);
if ( url == null ) {
url = getSingletonPackageURL(CMS.WORKSPACE_PACKAGE_KEY);
m_cache.put(CMS.WORKSPACE_PACKAGE_KEY, url);
}
return url;
return Workspace.getURL();
}
/**
* Fetch the location of the CMS Services package. Caches the result.
* Fetch the location (URL) of the CMS Services package. Caches the result.
* @return The URL of the CMS Services package
* @deprecated Use Service.getURL( instead
*/
public static String getServiceURL() {
String url = (String) m_cache.get(CMS.SERVICE_PACKAGE_KEY);
@ -90,7 +85,8 @@ public class Utilities {
// file that is maintained by a non cms application eg
// forum, then I can end up with a url that doesn't work
// and so breaks file links everywhere
url = getSingletonPackageURLSansContext(CMS.SERVICE_PACKAGE_KEY);
// url = getSingletonPackageURLSansContext(CMS.SERVICE_PACKAGE_KEY);
url = Service.getURL();
m_cache.put(CMS.SERVICE_PACKAGE_KEY, url);
}
@ -102,7 +98,8 @@ public class Utilities {
* @return The logout URL
*/
public static String getLogoutURL() {
StringBuffer buf = new StringBuffer(getServiceURL());
//StringBuffer buf = new StringBuffer(getServiceURL());
StringBuilder buf = new StringBuilder(Service.getURL() );
buf.append("logout");
return buf.toString();
}
@ -112,6 +109,7 @@ public class Utilities {
*
* @param asset The binary asset
* @return the URL which will serve the specified binary asset
* @deprecated Use Service.getAssetURL(BinaryAsset asset) instead
*/
public static String getAssetURL(BinaryAsset asset) {
return getAssetURL(asset.getID());
@ -122,9 +120,11 @@ public class Utilities {
*
* @param assetId The asset ID
* @return the URL which will serve the specified binary asset
* @deprecated Use Service.getAssetURL(BigDecimal assetId) instead
*/
public static String getAssetURL(BigDecimal assetId) {
StringBuffer buf = new StringBuffer(getServiceURL());
// StringBuffer buf = new StringBuffer(getServiceURL());
StringBuilder buf = new StringBuilder(Service.getURL() );
buf.append("stream/asset?");
buf.append(StreamAsset.ASSET_ID).append("=").append(assetId);
return buf.toString();
@ -137,9 +137,11 @@ public class Utilities {
*
* @param asset The image asset whose image is to be served
* @return the URL which will serve the specified image asset
* @deprecated Use Service.getImageURL(ImageAsset) instead!
*/
public static String getImageURL(ImageAsset asset) {
StringBuffer buf = new StringBuffer(getServiceURL());
// StringBuffer buf = new StringBuffer(getServiceURL());
StringBuilder buf = new StringBuilder(Service.getURL() );
buf.append("stream/image/?");
buf.append(StreamImage.IMAGE_ID).append("=").append(asset.getID());
return buf.toString();
@ -165,59 +167,14 @@ public class Utilities {
}
/**
* Fetches the URL of a mounted instance of a package.
* @param key The package key
* @return The URL where the package is mounted
* @deprecated without direct replacement yet
*/
private static String getSingletonPackageURL(String key) {
PackageType type = null;
type = PackageType.findByKey(key);
PackageInstanceCollection instances = type.getInstances();
PackageInstance instance = null;
if ( !instances.next() ) {
instances.close();
throw new RuntimeException(
"Failed to locate an instance of the singleton package: " + key);
} else {
instance = instances.getPackageInstance();
instances.close();
}
SiteNodeCollection nodes = instance.getMountPoints();
SiteNode node = null;
if ( !nodes.next() ) {
nodes.close();
throw new RuntimeException(
"Failed to locate a mountpoint for the singleton package: " + key);
} else {
node = nodes.getSiteNode();
nodes.close();
}
StringBuffer url = new StringBuffer();
String context = getWebappContext();
if (context != null) {
url.append(context);
}
url.append(SiteNode.getRootSiteNode().getURL())
.append(node.getURL().substring(1));
LOG.debug("Single package url for " + key + " is " + url);
return url.toString();
}
/**
*
* @param key
* @return
* @deprecated without replacement (singleton package is not a supported
* // @deprecated without replacement (singleton package is not a supported
* property for legacy free applications.)
*/
private static String getSingletonPackageURLSansContext(String key) {
/* private static String getSingletonPackageURLSansContext(String key) {
PackageType type = null;
type = PackageType.findByKey(key);
PackageInstanceCollection instances = type.getInstances();
@ -251,7 +208,7 @@ public class Utilities {
return url.toString();
}
*/
/**
* Fetch the context path of the request. This is typically "/".
@ -377,6 +334,7 @@ public class Utilities {
*
* @param state The page state
* @return The SecurityManager for the content section
* @deprecated Use CMS.getSecurityManager(PageState state) instead.
*/
public static SecurityManager getSecurityManager(PageState state) {
ContentSection section = CMS.getContext().getContentSection();

View File

@ -28,6 +28,7 @@ import com.arsdigita.bebop.page.PageTransformer;
import com.arsdigita.cms.CMSExcursion;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionServlet;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.developersupport.DeveloperSupport;
import com.arsdigita.dispatcher.RequestContext;
@ -195,7 +196,8 @@ public class CMSApplicationPage extends Page {
*/
public ContentSection getContentSection(HttpServletRequest request) {
// Resets all content sections associations.
return ContentSectionDispatcher.getContentSection(request);
// return ContentSectionDispatcher.getContentSection(request);
return ContentSectionServlet.getContentSection(request);
}
/**

View File

@ -25,7 +25,7 @@ import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.PageLocations;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.Workspace;
import com.arsdigita.web.URL;
import com.arsdigita.xml.Element;
@ -49,6 +49,12 @@ public class ContentItemNavbar extends CMSContainer {
setClassAttr("item");
}
/**
*
* @param state
* @param parent
*/
@Override
public void generateXML(PageState state, Element parent) {
Element element = new Element("cms:breadCrumbTrail", CMS.CMS_XML_NS);
@ -57,7 +63,7 @@ public class ContentItemNavbar extends CMSContainer {
ContentType type = item.getContentType();
final String url = URL.there(state.getRequest(),
Utilities.getWorkspaceURL()).toString();
Workspace.getURL()).toString();
element.addAttribute("workspaceURL", url);
element.addAttribute("sectionName", section.getName());

View File

@ -53,6 +53,7 @@ public class ContentItemRenderer extends DomainObjectRenderer {
* Generate XML for the domain object supplied by the
* selection model.
*/
@Override
public void generateXML(PageState state, Element parent) {
ContentItem item = ContentSectionDispatcher.getContentItem(state.getRequest());
Element e = generateXMLElement(item);

View File

@ -24,7 +24,7 @@ import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.Workspace;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.ui.UI;
import com.arsdigita.xml.Element;
@ -45,7 +45,7 @@ public class ContentSectionNavbar extends CMSContainer {
setClassAttr("section");
String wsUrl = UI.getWorkspaceURL();
String csUrl = Utilities.getWorkspaceURL();
String csUrl = Workspace.getURL();
m_navbar = new DimensionalNavbar();
m_navbar.setAlign(DimensionalNavbar.LEFT);

View File

@ -21,7 +21,7 @@ package com.arsdigita.cms.ui;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleComponent;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.Workspace;
import com.arsdigita.ui.UI;
import com.arsdigita.web.URL;
import com.arsdigita.xml.Element;
@ -46,7 +46,7 @@ class GlobalNavigation extends SimpleComponent {
private final String m_helpPath;
GlobalNavigation() {
m_centerPath = Utilities.getWorkspaceURL();
m_centerPath = Workspace.getURL();
m_wspcPath = UI.getWorkspaceURL();
m_signOutPath = UI.getLogoutPageURL();
m_helpPath = "/nowhere"; // We don't have this yet XXX.

View File

@ -30,9 +30,11 @@ import com.arsdigita.bebop.table.DefaultTableCellRenderer;
import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.Service;
// import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.mimetypes.MimeType;
@ -163,7 +165,8 @@ public class ImageBrowser extends Table {
boolean isSelected, Object key,
int row, int column) {
ImageAsset a = (ImageAsset) value;
String url = Utilities.getImageURL(a);
// String url = Utilities.getImageURL(a);
String url = Service.getImageURL(a);
Image img = new Image(URL.getDispatcherPath() + url);
img.setBorder("0");
@ -202,7 +205,8 @@ public class ImageBrowser extends Table {
boolean isSelected, Object key,
int row, int column) {
boolean canDelete = false;
SecurityManager sm = Utilities.getSecurityManager(state);
// SecurityManager sm = Utilities.getSecurityManager(state);
SecurityManager sm = CMS.getSecurityManager(state);
if (sm.canAccess(state.getRequest(), SecurityManager.DELETE_IMAGES)) {
try {
ImageAsset asset = (ImageAsset) DomainObjectFactory.newInstance(new OID(ImageAsset.BASE_DATA_OBJECT_TYPE, (BigDecimal) key));

View File

@ -23,7 +23,8 @@ import com.arsdigita.bebop.SimpleComponent;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.Service;
// import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.mimetypes.MimeType;
import com.arsdigita.util.Assert;
import com.arsdigita.web.URL;
@ -64,6 +65,7 @@ public class ImageDisplay extends SimpleComponent {
return m_item;
}
@Override
public void generateXML(PageState state, Element parent) {
if ( isVisible(state) ) {
@ -89,7 +91,8 @@ public class ImageDisplay extends SimpleComponent {
Element element) {
element.addAttribute("name", image.getName());
element.addAttribute("src", URL.getDispatcherPath() +
Utilities.getImageURL(image));
Service.getImageURL(image));
// Utilities.getImageURL(image));
BigDecimal width = image.getWidth();
if ( width != null ) {

View File

@ -38,6 +38,7 @@ import com.arsdigita.bebop.util.BebopConstants;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.Workspace;
import com.arsdigita.cms.dispatcher.ContentCenterDispatcher;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.web.ParameterMap;
@ -225,9 +226,7 @@ public class ItemSearchWidget extends FormSection
ItemSearchPage.class.getName());
s_log.debug("Search URL stub is: " + searchURL);
searchURL = com.arsdigita.cms.dispatcher.Utilities.
getWorkspaceURL()
+ searchURL;
searchURL = Workspace.getURL() + searchURL;
// TODO Not sure what to do when you get a null here

View File

@ -48,6 +48,7 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.SectionLocaleCollection;
import com.arsdigita.cms.Workspace;
import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.util.GlobalizationUtil;
@ -181,7 +182,7 @@ public class SectionConfigurationPage extends CMSPage implements Resettable {
DimensionalNavbar dn = new DimensionalNavbar();
dn.setDelimiter(" - ");
dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.my_workspace")), Utilities.getWorkspaceURL()));
dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.my_workspace")), Workspace.getURL()));
dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.sign_out")), Utilities.getLogoutURL()));
// FIXME: Write online help, for the time being, do not offer a link
// dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.help")), "help"));

View File

@ -19,7 +19,7 @@
package com.arsdigita.cms.ui;
import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.Workspace;
import com.arsdigita.toolbox.ui.ContextBar;
import com.arsdigita.web.URL;
import org.apache.log4j.Logger;
@ -37,11 +37,12 @@ class WorkspaceContextBar extends ContextBar {
private static final Logger s_log = Logger.getLogger
(WorkspaceContextBar.class);
@Override
protected List entries(final PageState state) {
final List entries = super.entries(state);
final String centerTitle = lz("cms.ui.content_center");
final String centerPath = Utilities.getWorkspaceURL();
final String centerPath = Workspace.getURL();
final URL url = URL.there(state.getRequest(), centerPath);
entries.add(new Entry(centerTitle, url));

View File

@ -46,6 +46,7 @@ import com.arsdigita.cms.CMSConfig;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.Workspace;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.lifecycle.Lifecycle;
import com.arsdigita.cms.ui.BaseItemPane;
@ -274,7 +275,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal(
URL.there(state.getRequest(),
Utilities.getWorkspaceURL()), true);
Workspace.getURL()), true);
}
}
}
@ -361,7 +362,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal(
URL.there(state.getRequest(),
Utilities.getWorkspaceURL()), true);
Workspace.getURL()), true);
}
}
}
@ -529,7 +530,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal(
URL.there(state.getRequest(),
Utilities.getWorkspaceURL()), true);
Workspace.getURL()), true);
}
}
} else if (REPUBLISH_AND_RESET.equals(selected)) {
@ -564,7 +565,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal(
URL.there(state.getRequest(),
Utilities.getWorkspaceURL()), true);
Workspace.getURL()), true);
}
}
} else if (UNPUBLISH.equals(selected)) {

View File

@ -54,7 +54,7 @@ import com.arsdigita.cms.CMSConfig;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentTypeLifecycleDefinition;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.Workspace;
import com.arsdigita.cms.lifecycle.Lifecycle;
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection;
@ -417,7 +417,7 @@ class ItemLifecycleSelectForm extends BaseForm {
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal(
URL.there(state.getRequest(),
Utilities.getWorkspaceURL()),
Workspace.getURL()),
true);
}
}

View File

@ -23,7 +23,7 @@ import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.Workspace;
import com.arsdigita.cms.portlet.TaskPortlet;
import com.arsdigita.cms.ui.ContentItemPage;
import com.arsdigita.cms.util.GlobalizationUtil;
@ -63,7 +63,7 @@ public class TaskPortletRenderer extends AbstractPortletRenderer {
protected void generateBodyXML(PageState pageState, Element parentElement) {
final String contentCenter = Utilities.getWorkspaceURL();
final String contentCenter = Workspace.getURL();
Link link = new Link("Content Center", contentCenter);

View File

@ -51,6 +51,7 @@ import com.arsdigita.categorization.Category;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.CategoryTemplateMapping;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionServlet;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentTypeCollection;
import com.arsdigita.cms.SectionTemplateMapping;
@ -59,7 +60,6 @@ import com.arsdigita.cms.Template;
import com.arsdigita.cms.TemplateCollection;
import com.arsdigita.cms.TemplateManager;
import com.arsdigita.cms.TemplateManagerFactory;
import com.arsdigita.cms.dispatcher.ContentSectionDispatcher;
import com.arsdigita.cms.ui.CMSContainer;
import com.arsdigita.cms.ui.FormSecurityListener;
import com.arsdigita.cms.ui.category.CategoryComponentAccess;
@ -157,6 +157,7 @@ public class CategoryTemplates extends CMSContainer {
add(m_assign);
}
@Override
public void register(Page p) {
super.register(p);
@ -183,6 +184,7 @@ public class CategoryTemplates extends CMSContainer {
String useContext) {
}
@Override
public void register(Page p) {
super.register(p);
@ -232,6 +234,7 @@ public class CategoryTemplates extends CMSContainer {
new AssignCellRenderer());
addTableActionListener(new TableActionAdapter() {
@Override
public void cellSelected(TableActionEvent e) {
PageState s = e.getPageState();
TemplatesListing l = (TemplatesListing)e.getSource();
@ -242,7 +245,8 @@ public class CategoryTemplates extends CMSContainer {
// created statically
if(c == m_assignCol) {
SectionTemplateMapping m =
(SectionTemplateMapping)getMappingModel().getSelectedObject(s);
(SectionTemplateMapping)getMappingModel()
.getSelectedObject(s);
assignTemplate(s, m.getTemplate());
}
}
@ -253,7 +257,7 @@ public class CategoryTemplates extends CMSContainer {
* Get all the templates for the given type in the current section
*/
protected TemplateCollection getTemplateCollection(PageState s) {
ContentSection sec = ContentSectionDispatcher.getContentSection(s.getRequest());
ContentSection sec = ContentSectionServlet.getContentSection(s.getRequest());
Assert.exists(sec, "content section");
/*
@ -298,7 +302,8 @@ public class CategoryTemplates extends CMSContainer {
map.setUseContext(useContext);
map.setTemplate(t);
}
map.setContentSection(ContentSectionDispatcher.getContentSection(s.getRequest()));
map.setContentSection(ContentSectionServlet
.getContentSection(s.getRequest()));
map.save();
m_display.setVisible(s, true);
@ -317,7 +322,8 @@ public class CategoryTemplates extends CMSContainer {
m_link.setClassAttr("assignTemplateLink");
}
public Component getComponent(Table table, PageState state, Object value,
public Component getComponent(Table table, PageState state,
Object value,
boolean isSelected, Object key,
int row, int column) {
return m_link;
@ -326,6 +332,9 @@ public class CategoryTemplates extends CMSContainer {
}
/**
*
*/
private class AssignForm extends Form {
SingleSelect m_type;
@ -345,22 +354,24 @@ public class CategoryTemplates extends CMSContainer {
m_type = new SingleSelect(type.getStateParameter());
try {
m_type.addPrintListener(new PrintListener() {
public void prepare(PrintEvent e) {
PageState state = e.getPageState();
ContentSection section = ContentSectionDispatcher.getContentSection(state.getRequest());
public void prepare(PrintEvent e) {
PageState state = e.getPageState();
ContentSection section = ContentSectionServlet
.getContentSection(state
.getRequest());
SingleSelect target = (SingleSelect)e.getTarget();
SingleSelect target = (SingleSelect)e.getTarget();
ContentTypeCollection types = section.getContentTypes();
types.addOrder(ContentType.LABEL);
ContentTypeCollection types = section.getContentTypes();
types.addOrder(ContentType.LABEL);
while (types.next()) {
ContentType type = types.getContentType();
target.addOption(new Option(type.getID().toString(),
type.getLabel()));
}
while (types.next()) {
ContentType type = types.getContentType();
target.addOption(new Option(type.getID().toString(),
type.getLabel()));
}
});
}
});
} catch (TooManyListenersException ex) {
throw new UncheckedWrapperException("This can never happen", ex);
}
@ -369,30 +380,7 @@ public class CategoryTemplates extends CMSContainer {
// XXX no need for selecting template contexts currently
m_context = new Hidden(context.getStateParameter());
m_context.setDefaultValue(TemplateManager.PUBLIC_CONTEXT);
/*
m_context = new SingleSelect(context.getStateParameter());
try {
m_context.addPrintListener(new PrintListener() {
public void prepare(PrintEvent e) {
PageState state = e.getPageState();
SingleSelect target = (SingleSelect)e.getTarget();
TemplateContextCollection contexts = TemplateContext.retrieveAll();
contexts.addOrder(TemplateContext.LABEL);
while (contexts.next()) {
TemplateContext type = contexts.getTemplateContext();
target.addOption(new Option(type.getContext(),
type.getLabel()));
}
context.setSelectedKey(state, TemplateManager.PUBLIC_CONTEXT);
}
});
} catch (TooManyListenersException ex) {
throw new UncheckedWrapperException("This can never happen", ex);
}
*/
add(m_context);
add(new Submit("Assign template"));

View File

@ -30,7 +30,7 @@ import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.RadioGroup;
import com.arsdigita.bebop.parameters.BooleanParameter;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.Workspace;
import com.arsdigita.cms.ui.ContentItemPage;
import com.arsdigita.cms.workflow.CMSEngine;
import com.arsdigita.cms.workflow.CMSTask;
@ -39,7 +39,6 @@ import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.permissions.PermissionDescriptor;
import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.web.RedirectSignal;
import com.arsdigita.web.URL;
import com.arsdigita.web.Web;
@ -206,7 +205,7 @@ public final class TaskFinishForm extends CommentAddForm {
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal
(URL.there(state.getRequest(),
Utilities.getWorkspaceURL()),
Workspace.getURL()),
true);
}

View File

@ -19,7 +19,7 @@
package com.arsdigita.categorization;
import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.SiteNode;
// import com.arsdigita.kernel.SiteNode;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -34,21 +34,25 @@ public class Categorization {
private static List s_categoryListeners = new ArrayList();
/* No longer used. Client methods are removed.
public static final String CONTEXT_NAVIGATION = "navigation";
*/
/**
* A wrapper for {@link Categorization#getGlobalRootCategory(String)
* getGlobalRootCategory(Categorization.CONTEXT_NAVIGATION)}.
* @see #getGlobalRootCategory()
**/
public static Category getGlobalRootCategory() {
/* No longer used. Removed because we no longer support old type applications
and SiteNode
public static Category getGlobalRootCategory() {
return getGlobalRootCategory(CONTEXT_NAVIGATION);
}
*/
/**
* @see Category#getRootForObject(com.arsdigita.kernel.ACSObject)
**/
public static Category getGlobalRootCategory(String context) {
/* Not use anymore. We no longer support old type applications and SiteNode
private static Category getGlobalRootCategory(String context) {
// XXX change this impl.
// XXX support context
Category root = Category.getRootForObject(
@ -56,7 +60,7 @@ public class Categorization {
);
return root;
}
*/
public static void addCategoryListener(CategoryListener cl) {
s_categoryListeners.add(cl);
}

View File

@ -67,7 +67,11 @@ public class ApplicationPatternGenerator implements PatternGenerator {
// legacy-compatible applications but package-type apps. content-center
// and cms-service are 2 examples. Code can be eliminated when all apps
// will use web.Application for loading and instantiation.
s_log.warn("ApplicationType for >>" +key +
// UPDATE
// CMS had been migrated. It is only necessary for the root package,
// which is "Main Site" = acs-subsite which is used by some login
// redirects.
s_log.debug("ApplicationType for >>" +key +
"<< not found. Trying SiteNodes instead.");

View File

@ -23,10 +23,9 @@ import com.arsdigita.web.Web;
import com.arsdigita.util.StringUtils;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.sitenode.SiteNodeRequestContext;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.util.Assert;
import com.arsdigita.web.Application;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
@ -140,14 +139,27 @@ public class URLPatternGenerator implements PatternGenerator {
return url.substring(base.length()-1);
}
// XXX fix me, why can't we get this from Web.getConfig.getRequestURL
/**
* Provides the base URL of the application in the current Web request
* (i.e. application's PrimaryURL)
*
* XXX fix me, why can't we get this from Web.getConfig.getRequestURL
*
* @return primary url of an application
*/
private String getBasePath() {
SiteNodeRequestContext ctx = (SiteNodeRequestContext)
DispatcherHelper.getRequestContext(Web.getRequest());
// OLD code using kernel.SiteNode etc which is deprecatged and no longer
// available
// SiteNodeRequestContext ctx = (SiteNodeRequestContext)
// DispatcherHelper.getRequestContext(Web.getRequest());
// SiteNode node = ctx.getSiteNode();
// Assert.exists(node, SiteNode.class);
// return node.getURL();
SiteNode node = ctx.getSiteNode();
Assert.exists(node, SiteNode.class);
return node.getURL();
// retrieve the application of the request
Application app = Web.getContext().getApplication();
return app.getPrimaryURL();
}
}

View File

@ -24,24 +24,20 @@ import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleComponent;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.PackageInstanceCollection;
import com.arsdigita.kernel.PackageInstance;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.SiteNodeCollection;
import com.arsdigita.kernel.PackageType;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.ui.UI;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationCollection;
import com.arsdigita.web.ApplicationType;
import com.arsdigita.web.ApplicationTypeCollection;
import com.arsdigita.web.URL;
import com.arsdigita.xml.Element;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
import java.util.Iterator;
import org.apache.log4j.Logger;
/**
* A reusable Bebop component to display the primary attributes of the
* currently logged in user. Users can extend this class to provide
@ -49,29 +45,27 @@ import org.apache.log4j.Logger;
* UserInfo#register(Page)} and {@link UserInfo#getUser(PageState)}
* methods.
*
*
* @author Michael Bryzek
* @author Roger Hsueh
* @author Sameer Ajmani
* @author Peter Boy (refactored to eliminate old type kernel.Package* / SiteNode)
* @since 2001-06-01
* @version 1.0
* @version $Id: UserInfo.java 287 2005-02-22 00:29:02Z sskracic $
*
**/
*/
public class UserInfo extends SimpleContainer {
/** Logger instance for debugging support */
private static final Logger s_log =
Logger.getLogger(UserInfo.class.getName());
Logger.getLogger(UserInfo.class.getName());
/** m_contentCenters holds a list of content centers that exist
on this installation */
/** Holds a list of content centers (Application instances) that exist
* on this installation. Usually there is only ONE installed, but obviously
* care is taken that one content-center may be installed per subsite. */
private List m_contentCenters;
/** m_centerSiteNodes contains a mapping of content centers to the
site nodes where they are mounted. */
private HashMap m_centerSiteNodes;
private UserAuthenticationListener m_listener =
new UserAuthenticationListener();
new UserAuthenticationListener();
/**
* Constructor.
@ -86,101 +80,107 @@ public class UserInfo extends SimpleContainer {
list.add(new DynamicLink("login.userInfo.changePasswordLink",
UI.getRecoverPasswordPageURL()));
add(list);
// add user info text
add(new SimpleComponent() {
@Override
public void generateXML(PageState state, Element parent) {
if (!isLoggedIn(state)) {
s_log.debug("user is not logged in, so no XML generated");
return;
public void generateXML(PageState state, Element parent) {
if (!isLoggedIn(state)) {
s_log.debug("user is not logged in, so no XML generated");
return;
}
User user = getUser(state);
Element userElement = new Element("subsite:userInfo",
SubsiteDispatcher.SUBSITE_NS_URI);
// check if Content-Center (CMS Workspace) is installed and
// instantiated, if so collect all instantiated workspace apps.
if (m_contentCenters == null) {
m_contentCenters = new ArrayList();
ApplicationTypeCollection
appTypes = ApplicationType
.retrieveAllApplicationTypes();
appTypes.addEqualsFilter("title", "Content Center");
String objectType;
if (appTypes.next()) {
objectType = appTypes.getApplicationObjectType();
} else {
objectType = null;
}
User user = getUser(state);
Element userElement = new Element
("subsite:userInfo", SubsiteDispatcher.SUBSITE_NS_URI);
if (m_contentCenters == null) {
m_contentCenters = new ArrayList();
m_centerSiteNodes = new HashMap();
// XXX has to refactored!
// used old style packageType to retrieve a list of installed
// content-centers. Odd, there may exist only one content-center per
// installation!
// Currently (version 6.6.0 2011-02-06) content-center = workspace
// exists as legacy application only, not as legacy compatible application!
// If application type CMS Workspace is installed:
if (objectType != null) {
// retrieve all packages of type content-center
// works because there may be only one.
DataCollection dc = SessionManager.getSession().retrieve
(PackageType.BASE_DATA_OBJECT_TYPE);
dc.addEqualsFilter("packageKey", "content-center");
ApplicationCollection workspaceInstances = Application
.retrieveAllApplications(objectType);
if (dc.next()) {
// works because there may be only one entry of
// package type content-center
PackageType pt = new PackageType(dc.getDataObject());
dc.close();
PackageInstanceCollection collection = pt.getInstances();
while (collection.next()) {
PackageInstance instance = collection.getPackageInstance();
instance.disconnect();
m_contentCenters.add(instance);
SiteNodeCollection nodes = instance.getMountPoints();
ArrayList list = new ArrayList();
while (nodes.next()) {
SiteNode sn = nodes.getSiteNode();
sn.disconnect();
list.add(sn);
}
m_centerSiteNodes.put(instance, list);
}
// step through collection of instances of type Workspace
// generally there is only a single instance, but obviously
// code takes care provided therfe is an instance for
// each subsite.
while (workspaceInstances.next()) {
// retrieve one Workspace instance of collection
Application workspaceInstance = (Application)
workspaceInstances.getApplication();
// Add Workspace instance to internal map
m_contentCenters.add(workspaceInstance);
}
}
if (m_contentCenters.size() > 0) {
Element center;
Element nodeURL;
List nodes;
Iterator nodesIterator;
Element contentCenters = userElement.newChildElement
("subsite:contentCenters", SubsiteDispatcher.SUBSITE_NS_URI);
Iterator centers = m_contentCenters.iterator();
while (centers.hasNext()) {
PackageInstance instance = (PackageInstance) centers.next();
center = contentCenters.newChildElement
("subsite:center", SubsiteDispatcher.SUBSITE_NS_URI);
center.addAttribute("name", instance.getName());
nodes = (List)m_centerSiteNodes.get(instance);
if (nodes != null) {
nodesIterator = nodes.iterator();
while (nodesIterator.hasNext()) {
SiteNode node = (SiteNode) nodesIterator.next();
nodeURL = center.newChildElement
("subsite:url", SubsiteDispatcher.SUBSITE_NS_URI);
final URL url = URL.there
(state.getRequest(), node.getURL());
nodeURL.setText(url.toString());
}
}
}
}
userElement.addAttribute("id",
user.getID().toString());
userElement.addAttribute
("email",
user.getPrimaryEmail().getEmailAddress());
userElement.addAttribute("name", user.getName());
userElement.addAttribute("screenName",
user.getScreenName());
userElement.addAttribute("URI", user.getURI());
parent.addContent(userElement);
}
});
// work on the list of installed (instantiated)
// workspaces (content-centers) if any and add some attributes
// to XML generator
if (m_contentCenters.size() > 0) {
Element center;
Element workspaceURL;
Element contentCenters = userElement.newChildElement
("subsite:contentCenters",
SubsiteDispatcher.SUBSITE_NS_URI);
// step through instantiated workspaces (content-centers)
Iterator centers = m_contentCenters.iterator();
while (centers.hasNext()) {
Application workspaceInstance = (Application)centers.next();
// for each instance of Workspace = for each installed
// (instantiated) Workspace application:
// Add an Element
center = contentCenters.newChildElement
("subsite:center",
SubsiteDispatcher.SUBSITE_NS_URI);
// Add attribute name = URL without trailing/leading "/"
center.addAttribute("name", workspaceInstance.getTitle());
workspaceURL = center.newChildElement(
"subsite:url",
SubsiteDispatcher.SUBSITE_NS_URI);
// get URL of Workspace application (instance)
final URL url = URL.there(state.getRequest(),
workspaceInstance.getPath());
workspaceURL.setText(url.toString());
}
}
// in any case: add basic user attributes
userElement.addAttribute("id", user.getID().toString());
userElement.addAttribute("email",user.getPrimaryEmail()
.getEmailAddress());
userElement.addAttribute("name", user.getName());
userElement.addAttribute("screenName",user.getScreenName());
userElement.addAttribute("URI", user.getURI());
parent.addContent(userElement);
}
});
}
/**
@ -191,6 +191,7 @@ public class UserInfo extends SimpleContainer {
*
* @pre p != null
**/
@Override
public void register(Page p) {
super.register(p);
p.addRequestListener(m_listener);

View File

@ -15,8 +15,6 @@
package com.arsdigita.cms.docmgr;
import com.arsdigita.cms.docmgr.installer.Initializer;
import com.arsdigita.cms.docmgr.util.GlobalizationUtil;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionCollection;
import com.arsdigita.domain.DataObjectNotFoundException;
@ -24,22 +22,18 @@ import com.arsdigita.kernel.Group;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.permissions.PermissionDescriptor;
// import com.arsdigita.kernel.permissions.PermissionDescriptor;
import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.persistence.DataObject;
// import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.Session;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.web.Application;
import com.arsdigita.web.Web;
import com.arsdigita.web.ApplicationCollection;
import com.arsdigita.util.Assert;
import java.math.BigDecimal;

View File

@ -32,12 +32,12 @@ import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Folder;
import com.arsdigita.cms.Workspace;
import com.arsdigita.cms.dispatcher.AbstractItemResolver;
import com.arsdigita.cms.dispatcher.CMSDispatcher;
import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.MasterPage;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.ui.ContentItemPage;
import com.arsdigita.cms.util.LanguageUtil;
import com.arsdigita.domain.DomainObjectFactory;
@ -58,16 +58,17 @@ import com.arsdigita.web.Web;
* Created Mon Jan 20 14:30:03 2003.
*
* @author <a href="mailto:mhanisch@redhat.com">Michael Hanisch</a>
* @version $Id: //apps/docmgr-cms/dev/src/com/arsdigita/cms/docmgr/dispatcher/MultilingualDocumentResolver.java#1 $
* @version $Id: MultilingualDocumentResolver.java#1 $
*/
public class MultilingualDocumentResolver extends AbstractItemResolver implements ItemResolver {
public class MultilingualDocumentResolver extends AbstractItemResolver
implements ItemResolver {
private static final Logger s_log = Logger.getLogger
(MultilingualDocumentResolver.class);
private static MasterPage s_masterP = null;
private static final String ADMIN_PREFIX = "admin";
private static final String WORKSPACE_PREFIX = Utilities.getWorkspaceURL();
private static final String WORKSPACE_PREFIX = Workspace.getURL();
/**
* The string identifying an item's ID in the query string of a
@ -727,7 +728,8 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement
// will have deal with 'foo' folder.
String name = index > 0 ? url.substring(0, index) : "";
parentFolder = name != "" ? (Folder) parentFolder.getItem(name, true) : parentFolder;
parentFolder = name != "" ? (Folder) parentFolder.getItem(name, true)
: parentFolder;
url = index + 1 < len ? url.substring(index + 1) : "";
return getItemFromLiveURL(url, parentFolder);

View File

@ -25,8 +25,6 @@ import org.apache.log4j.Logger;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Folder;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.london.terms.Domain;
import com.arsdigita.london.terms.Term;
import com.arsdigita.util.Assert;
@ -53,22 +51,12 @@ public class TermItemBuilder {
Assert.exists(path, String.class);
Term term = m_domain.getTerm(id);
SiteNode node = null;
try {
s_log.debug(String.format("Trying to get SiteNode for path '%s",
path));
node = SiteNode.getSiteNode(path);
} catch (DataObjectNotFoundException ex) {
s_log.error("Couldn't fetch sitenode for " + path);
return;
}
ContentSection section = null;
section = ContentSection.getSectionFromNode(node);
section = ContentSection.getSectionForPath(path);
String[] bits = StringUtils.split(
path.substring(node.getURL().length(),
path.substring(section.getURL().length(),
path.length()),
'/');

View File

@ -163,6 +163,11 @@
<servlet-class>com.arsdigita.cms.ContentSectionServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>cms-service</servlet-name>
<servlet-class>com.arsdigita.cms.ServiceServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>content-type-xsl</servlet-name>
<servlet-class>com.arsdigita.cms.dispatcher.ContentTypeXSLServlet</servlet-class>
@ -178,7 +183,6 @@
<servlet-class>com.arsdigita.cms.dispatcher.TemplateXSLServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>TextOnlyServlet</servlet-name>
<display-name>Text Only Servlet</display-name>
@ -501,6 +505,11 @@
<url-pattern>/themes/servlet/content-section/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>cms-service</servlet-name>
<url-pattern>/templates/servlet/cms-service/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>content-item-xsl</servlet-name>
<url-pattern>/templates/servlet/content-item/*</url-pattern>

View File

@ -101,21 +101,31 @@ public class Survey extends ACSObject {
return survey;
}
public static SurveyCollection retrieveByPackage(PackageInstance pack) {
DataCollection surveys =
SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
/**
* Retrieves a SurveyCollection of all Surveys ever created, sorted by
* its start date.
*
* @return
*/
public static SurveyCollection retrieveAll() {
DataCollection surveys = SessionManager.getSession()
.retrieve(BASE_DATA_OBJECT_TYPE);
/*
/*
surveys.addEqualsFilter(PACKAGE_INSTANCE + "." + ACSObject.ID,
pack.getID());
pack.getID());
*/
surveys.addOrder(START_DATE);
return new SurveyCollection(surveys);
return new SurveyCollection(surveys);
}
/**
*
* @return
*/
public ResponseCollection getResponses() {
return Response.retrieveBySurvey(this);
return Response.retrieveBySurvey(this);
}
public ResponseCollection getUserResponses(User user) {

View File

@ -29,10 +29,12 @@ import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.kernel.SiteNode;
// import com.arsdigita.kernel.SiteNode;
import com.arsdigita.ui.UI;
import com.arsdigita.ui.login.UserAuthenticationListener;
import com.arsdigita.web.Application;
import com.arsdigita.web.Web;
import javax.servlet.http.HttpServletRequest;
@ -109,16 +111,24 @@ public abstract class SimpleSurveyPanel extends SimpleContainer {
public abstract String getRelativeURL();
/**
*
* @param request
* @return
*/
public static String getSubsiteURL(HttpServletRequest request) {
// Get the SiteNode from the request URI
SiteNode siteNode;
try {
siteNode = SiteNode.getSiteNode(request.getRequestURI(), true);
} catch (com.arsdigita.domain.DataObjectNotFoundException e) {
throw new com.arsdigita.util.UncheckedWrapperException(e);
}
// Get the SiteNode from the request URI
// SiteNode siteNode;
// try {
// siteNode = SiteNode.getSiteNode(request.getRequestURI(), true);
// } catch (com.arsdigita.domain.DataObjectNotFoundException e) {
// throw new com.arsdigita.util.UncheckedWrapperException(e);
// }
// return siteNode.getURL();
return siteNode.getURL();
// Application app = Web.getContext().getApplication();
Application thisApp = Application.getCurrentApplication(request);
return thisApp.getPrimaryURL();
}
}

View File

@ -28,7 +28,6 @@ import java.util.Date;
import com.arsdigita.persistence.Filter;
import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.PackageInstance;
import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.bebop.table.TableModel;
@ -37,8 +36,6 @@ import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.util.LockableImpl;
import com.arsdigita.formbuilder.PersistentForm;
import com.arsdigita.simplesurvey.SimpleSurveyUtil;
import com.arsdigita.bebop.Component;
import com.arsdigita.simplesurvey.Survey;
@ -74,28 +71,27 @@ public class SurveyTable extends Table {
private static class SurveyTableModelBuilder extends LockableImpl
implements TableModelBuilder {
private Class m_surveyClass;
private Class m_surveyClass;
public SurveyTableModelBuilder(Class surveyClass) {
m_surveyClass = surveyClass;
}
public SurveyTableModelBuilder(Class surveyClass) {
m_surveyClass = surveyClass;
}
public TableModel makeModel(Table l, PageState pageState) {
PackageInstance pack = SimpleSurveyUtil.getPackageInstance(pageState);
SurveyCollection surveys =
Survey.retrieveByPackage(pack);
surveys.addEqualsFilter(ACSObject.DEFAULT_DOMAIN_CLASS,
m_surveyClass.getName());
Date currentDate = new Date();
Filter startFilter = surveys.addFilter("startDate < :startDate");
startFilter.set("startDate", currentDate);
Filter endFilter = surveys.addFilter("endDate > :endDate");
endFilter.set("endDate", currentDate);
return new AdminSurveyTableModel(surveys);
}
public TableModel makeModel(Table l, PageState pageState) {
SurveyCollection surveys = Survey.retrieveAll();
surveys.addEqualsFilter(ACSObject.DEFAULT_DOMAIN_CLASS,
m_surveyClass.getName());
Date currentDate = new Date();
Filter startFilter = surveys.addFilter("startDate < :startDate");
startFilter.set("startDate", currentDate);
Filter endFilter = surveys.addFilter("endDate > :endDate");
endFilter.set("endDate", currentDate);
return new AdminSurveyTableModel(surveys);
}
}
private class SurveyCellRenderer implements TableCellRenderer {

View File

@ -92,7 +92,7 @@ public class AdminSurveyTable extends Table {
public TableModel makeModel(Table l, PageState pageState) {
PackageInstance pack = SimpleSurveyUtil.getPackageInstance(pageState);
SurveyCollection surveys =
Survey.retrieveByPackage(pack);
Survey.retrieveAll();
surveys.addEqualsFilter(ACSObject.DEFAULT_DOMAIN_CLASS,
m_surveyClass.getName());

View File

@ -37,9 +37,9 @@ import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.categorization.CategoryCollection;
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionServlet;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.dispatcher.ContentSectionDispatcher;
import com.arsdigita.cms.lifecycle.Lifecycle;
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection;
@ -233,7 +233,8 @@ public class WebpageCMSEditorPage extends CMSPage implements WebpageConstants {
s_log.debug("init");
PageState state = e.getPageState();
HttpServletRequest request = state.getRequest();
ContentSection section = ContentSectionDispatcher.getContentSection(request);
// ContentSection section = ContentSectionDispatcher.getContentSection(request);
ContentSection section = ContentSectionServlet.getContentSection(request);
Webpage webpage = null;
try {
@ -344,7 +345,8 @@ public class WebpageCMSEditorPage extends CMSPage implements WebpageConstants {
s_log.debug("process");
PageState state = e.getPageState();
HttpServletRequest request = state.getRequest();
ContentSection section = ContentSectionDispatcher.getContentSection(request);
// ContentSection section = ContentSectionDispatcher.getContentSection(request);
ContentSection section = ContentSectionServlet.getContentSection(request);
if (m_save.isSelected(state)) {
Webpage webpage = null;

View File

@ -9,9 +9,9 @@ import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionServlet;
import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.dispatcher.ContentItemDispatcher;
import com.arsdigita.cms.dispatcher.ContentSectionDispatcher;
import com.arsdigita.cms.dispatcher.XMLGenerator;
//import com.arsdigita.cms.ui.ContentSectionComponent;
import com.arsdigita.cms.webpage.Webpage;
@ -49,13 +49,14 @@ public class WebpagePreviewPage extends CMSPage {
protected XMLGenerator getXMLGenerator(PageState ps) {
HttpServletRequest request = ps.getRequest();
ContentSection section = ContentSectionDispatcher.getContentSection(request);
// ContentSection section = ContentSectionDispatcher.getContentSection(request);
ContentSection section = ContentSectionServlet.getContentSection(request);
Assert.exists(section, ContentSection.class);
return section.getXMLGenerator();
}
public ContentItem getContentItem(HttpServletRequest request) {
ContentSection section = ContentSectionDispatcher.getContentSection(request);
ContentSection section = ContentSectionServlet.getContentSection(request);
Webpage webpage = null;
ContentItem item = ContentItemDispatcher.getContentItem(request);