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-94f89814c4dfmaster
parent
5b5564c570
commit
0171ad1c91
|
|
@ -20,9 +20,10 @@ import com.arsdigita.bebop.table.AbstractTableModelBuilder;
|
||||||
import com.arsdigita.bebop.table.TableModel;
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.Service;
|
||||||
import com.arsdigita.cms.contentassets.FileAttachment;
|
import com.arsdigita.cms.contentassets.FileAttachment;
|
||||||
import com.arsdigita.cms.dispatcher.StreamAsset;
|
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.DataCollection;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.web.ParameterMap;
|
import com.arsdigita.web.ParameterMap;
|
||||||
|
|
@ -120,8 +121,11 @@ public class FileAttachmentModelBuilder extends AbstractTableModelBuilder {
|
||||||
// TODO provide API for asset URL
|
// TODO provide API for asset URL
|
||||||
ParameterMap params = new ParameterMap();
|
ParameterMap params = new ParameterMap();
|
||||||
params.setParameter(StreamAsset.ASSET_ID, _file.getID());
|
params.setParameter(StreamAsset.ASSET_ID, _file.getID());
|
||||||
return URL.there( Utilities.getServiceURL()+"download/asset",
|
// return URL.there( Utilities.getServiceURL()+"download/asset",
|
||||||
params ).getURL();
|
// params ).getURL();
|
||||||
|
return URL
|
||||||
|
.there(Service.getURL()+"/download/asset", params )
|
||||||
|
.getURL();
|
||||||
}else{
|
}else{
|
||||||
return _file.getDescription();
|
return _file.getDescription();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ public class ImageStepDisplay extends SimpleContainer {
|
||||||
container.setBorder( 1 );
|
container.setBorder( 1 );
|
||||||
|
|
||||||
container.add( new ImageDisplay(null) {
|
container.add( new ImageDisplay(null) {
|
||||||
|
@Override
|
||||||
protected void generateImagePropertiesXML( ImageAsset image,
|
protected void generateImagePropertiesXML( ImageAsset image,
|
||||||
PageState state,
|
PageState state,
|
||||||
Element element ) {
|
Element element ) {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import com.arsdigita.cms.contenttypes.util.OrganizationGlobalizationUtil;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ContentItem;
|
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.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
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.ui.authoring.WorkflowLockedComponentAccess;
|
||||||
import com.arsdigita.cms.ImageAsset;
|
import com.arsdigita.cms.ImageAsset;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.Service;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -110,9 +111,13 @@ public class OrganizationImageStep
|
||||||
heightStr = " height=\"" + height.toString() + "\" ";
|
heightStr = " height=\"" + height.toString() + "\" ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String labelStr = "<img src=\"" +
|
||||||
|
// Utilities.getImageURL(image) +
|
||||||
|
// "\" " + widthStr + heightStr + "/>";
|
||||||
String labelStr = "<img src=\"" +
|
String labelStr = "<img src=\"" +
|
||||||
Utilities.getImageURL(image) +
|
Service.getImageURL(image) +
|
||||||
"\" " + widthStr + heightStr + "/>";
|
"\" " + widthStr + heightStr + "/>";
|
||||||
|
|
||||||
return labelStr;
|
return labelStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms;
|
package com.arsdigita.cms;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -87,4 +88,16 @@ public abstract class CMS {
|
||||||
static final void setContext(CMSContext context) {
|
static final void setContext(CMSContext context) {
|
||||||
s_context.set(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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.globalization.Locale;
|
import com.arsdigita.globalization.Locale;
|
||||||
import com.arsdigita.kernel.Group;
|
import com.arsdigita.kernel.Group;
|
||||||
import com.arsdigita.kernel.SiteNode;
|
|
||||||
import com.arsdigita.kernel.permissions.PermissionService;
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
import com.arsdigita.persistence.CompoundFilter;
|
import com.arsdigita.persistence.CompoundFilter;
|
||||||
import com.arsdigita.persistence.DataAssociation;
|
import com.arsdigita.persistence.DataAssociation;
|
||||||
|
|
@ -51,12 +50,13 @@ import com.arsdigita.web.URL;
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
import com.arsdigita.workflow.simple.TaskCollection;
|
import com.arsdigita.workflow.simple.TaskCollection;
|
||||||
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>A content section represents a collection of content that is
|
* <p>A content section represents a collection of content that is
|
||||||
|
|
@ -919,68 +919,30 @@ public class ContentSection extends Application {
|
||||||
//
|
//
|
||||||
// Finding a content section.
|
// Finding a content section.
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks up the section given the SiteNode.
|
* Looks up the section given the SiteNode.
|
||||||
*
|
*
|
||||||
* @param node The site node
|
* @param path
|
||||||
* @return The content section
|
* @return The content section
|
||||||
* @pre ( node != null )
|
* @pre ( path != null )
|
||||||
* @post ( return != null )
|
* @post ( return != null )
|
||||||
*/
|
*/
|
||||||
public static ContentSection getSectionFromNode(SiteNode node)
|
public static ContentSection getSectionForPath(String path)
|
||||||
throws DataObjectNotFoundException {
|
throws DataObjectNotFoundException {
|
||||||
|
|
||||||
return (ContentSection) retrieveApplicationForSiteNode(node);
|
return (ContentSection) retrieveApplicationForPath(path);
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 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.
|
* Get the content section for an item.
|
||||||
*
|
*
|
||||||
* @deprecated use {@link ContentItem#getContentSection} instead
|
|
||||||
*
|
|
||||||
* @pre item != null
|
* @pre item != null
|
||||||
* @post return != null
|
* @post return != null
|
||||||
* @param item A content item
|
* @param item A content item
|
||||||
* @return The content section of an item
|
* @return The content section of an item
|
||||||
|
*
|
||||||
|
* @deprecated use {@link ContentItem#getContentSection} instead
|
||||||
*/
|
*/
|
||||||
public static ContentSection getContentSection(ContentItem item)
|
public static ContentSection getContentSection(ContentItem item)
|
||||||
throws DataObjectNotFoundException {
|
throws DataObjectNotFoundException {
|
||||||
|
|
@ -991,11 +953,11 @@ public class ContentSection extends Application {
|
||||||
/**
|
/**
|
||||||
* Get the content section for a folder.
|
* Get the content section for a folder.
|
||||||
*
|
*
|
||||||
* @deprecated use {@link ContentItem#getContentSection} instead
|
|
||||||
* @pre item != null
|
* @pre item != null
|
||||||
* @post return != null
|
* @post return != null
|
||||||
* @param folder A content folder
|
* @param folder A content folder
|
||||||
* @return The content section of the folder
|
* @return The content section of the folder
|
||||||
|
* @deprecated use {@link ContentItem#getContentSection} instead
|
||||||
*/
|
*/
|
||||||
public static ContentSection getContentSection(Folder folder)
|
public static ContentSection getContentSection(Folder folder)
|
||||||
throws DataObjectNotFoundException {
|
throws DataObjectNotFoundException {
|
||||||
|
|
|
||||||
|
|
@ -138,38 +138,22 @@ public class Loader extends PackageLoader {
|
||||||
public void excurse() {
|
public void excurse() {
|
||||||
setEffectiveParty(Kernel.getSystemParty());
|
setEffectiveParty(Kernel.getSystemParty());
|
||||||
|
|
||||||
// 2 - step 1b) Setup the Workspace package.
|
// Step 1) Setup the CMS Workspace
|
||||||
// loadWorkspacePackage(); // using old stype
|
|
||||||
// new style:
|
|
||||||
ApplicationType appType = loadWorkspaceApplicationType();
|
ApplicationType appType = loadWorkspaceApplicationType();
|
||||||
setupDefaultWorkspaceApplicationInstance(appType);
|
setupDefaultWorkspaceApplicationInstance(appType);
|
||||||
|
|
||||||
// 3 - step 1c) Setup the CMS global services package.
|
// Step 2) Setup the CMS global services
|
||||||
// loadServicePackage(); // using olde style
|
|
||||||
// new style:
|
|
||||||
appType = loadServiceApplicationType();
|
appType = loadServiceApplicationType();
|
||||||
setupDefaultServiceApplicationInstance(appType);
|
setupDefaultServiceApplicationInstance(appType);
|
||||||
|
|
||||||
// 4 - step 1d) Load the content-center page mappings
|
// Step 3) load (cms internal) content type definition(s)
|
||||||
// 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
|
|
||||||
loadContentTypeDefinitions(s_conf.getCTDefFiles());
|
loadContentTypeDefinitions(s_conf.getCTDefFiles());
|
||||||
|
|
||||||
// 6) Load CMS (content section) package application instance
|
// Step 4) Load CMS content section
|
||||||
// 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
|
|
||||||
// Loads content section application type and instance in one step
|
// Loads content section application type and instance in one step
|
||||||
loadContentSection( (String[]) get(m_contentSectionNames) );
|
loadContentSection( (String[]) get(m_contentSectionNames) );
|
||||||
|
|
||||||
// Loading CMS portlets
|
// Step 5) Loading CMS portlets
|
||||||
// Used to be step 7 (last step) in former enterprise.init
|
|
||||||
s_log.debug("CMS.loader going to load portlets");
|
s_log.debug("CMS.loader going to load portlets");
|
||||||
ContentDirectoryPortlet.loadPortletType();
|
ContentDirectoryPortlet.loadPortletType();
|
||||||
ContentItemPortlet.loadPortletType();
|
ContentItemPortlet.loadPortletType();
|
||||||
|
|
@ -277,16 +261,28 @@ public class Loader extends PackageLoader {
|
||||||
// ApplicationType serviceType = appsetup.run();
|
// ApplicationType serviceType = appsetup.run();
|
||||||
// serviceType.save();
|
// serviceType.save();
|
||||||
// ////////////// Current style to create app type ///////////////
|
// ////////////// Current style to create app type ///////////////
|
||||||
/* Create new stype legacy compatible application type */
|
/* Create new type legacy compatible application type */
|
||||||
ApplicationType serviceType = ApplicationType
|
// ApplicationType type = ApplicationType
|
||||||
.createApplicationType(Service.PACKAGE_KEY,
|
// .createApplicationType(Service.PACKAGE_KEY,
|
||||||
Service.INSTANCE_NAME,
|
// Service.INSTANCE_NAME,
|
||||||
Service.BASE_DATA_OBJECT_TYPE);
|
// Service.BASE_DATA_OBJECT_TYPE);
|
||||||
serviceType.setDescription("Services to store global resources and assets.");
|
// type.setDispatcherClass(Service.DISPATCHER_CLASS);
|
||||||
serviceType.setDispatcherClass(Service.DISPATCHER_CLASS);
|
|
||||||
serviceType.save();
|
|
||||||
|
|
||||||
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,
|
// create legacy compatible application instance,
|
||||||
// old-style package key used as url fragment where to install the instance
|
// old-style package key used as url fragment where to install the instance
|
||||||
Service app = (Service) Application.createApplication(
|
Service app = (Service) Application.createApplication(
|
||||||
serviceType, // type
|
serviceType, // type
|
||||||
Service.PACKAGE_KEY, // url fragment
|
Service.PACKAGE_KEY, // url fragment
|
||||||
Service.INSTANCE_NAME,// title
|
"CMS Service Instance", // title
|
||||||
null); // parent
|
null); // parent
|
||||||
app.setDescription("The default CMS service instance.");
|
app.setDescription("The default CMS service instance.");
|
||||||
app.save();
|
app.save();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,15 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms;
|
package com.arsdigita.cms;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.dispatcher.StreamAsset;
|
||||||
|
import com.arsdigita.cms.dispatcher.StreamImage;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
// import com.arsdigita.persistence.DataAssociation;
|
// import com.arsdigita.persistence.DataAssociation;
|
||||||
// import com.arsdigita.persistence.PersistenceException;
|
// import com.arsdigita.persistence.PersistenceException;
|
||||||
import com.arsdigita.web.Application;
|
import com.arsdigita.web.Application;
|
||||||
|
import com.arsdigita.web.URL;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
@ -97,12 +100,66 @@ public class Service extends Application {
|
||||||
return BASE_DATA_OBJECT_TYPE;
|
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.
|
* This is called when the application is created.
|
||||||
*/
|
*/
|
||||||
public static Service create(String urlName,
|
public static Service create(String urlName,
|
||||||
String title,
|
String title,
|
||||||
Application parent) {
|
Application parent) {
|
||||||
|
|
||||||
Service app = (Service) Application.createApplication
|
Service app = (Service) Application.createApplication
|
||||||
(BASE_DATA_OBJECT_TYPE, urlName, title, parent);
|
(BASE_DATA_OBJECT_TYPE, urlName, title, parent);
|
||||||
|
|
@ -112,5 +169,11 @@ public class Service extends Application {
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServletPath() {
|
||||||
|
//return URL.SERVLET_DIR + "/cms-service";
|
||||||
|
return "/templates/servlet/cms-service";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,15 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||||
* URLs of the available services are stored in a XML file which is processed
|
* 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).
|
* 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>
|
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
|
||||||
* @version $Id: ServiceServlet.java 2161 2011-02-02 00:16:13Z pboy $
|
* @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.*/
|
/** Mapping between a relative URL and the class name of a ResourceHandler.*/
|
||||||
private static HashMap s_pageClasses = new HashMap();
|
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();
|
private static SimpleCache s_pages = new SimpleCache();
|
||||||
|
|
||||||
/** List of URLs which require a trailing slash. These are required for
|
/** 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 */
|
/** Path to directory containg ccm-cms template files */
|
||||||
private String m_templatePath;
|
private String m_templatePath;
|
||||||
|
|
||||||
/** Resolvers to find templages (JSP) and other stuff stored in file system.*/
|
/** Resolvers to find templages (JSP) and other stuff stored in file system.*/
|
||||||
private ApplicationFileResolver m_resolver;
|
private ApplicationFileResolver m_resolver;
|
||||||
|
|
||||||
|
|
@ -101,20 +109,21 @@ public class ServiceServlet extends BaseApplicationServlet {
|
||||||
/* Process mapping file. */
|
/* Process mapping file. */
|
||||||
readFromFile(MAP_FILE);
|
readFromFile(MAP_FILE);
|
||||||
|
|
||||||
|
/** Set Template base path for JSP's */
|
||||||
m_templatePath = ContentSection.getConfig().getTemplateRoot();
|
m_templatePath = ContentSection.getConfig().getTemplateRoot();
|
||||||
Assert.exists(m_templatePath, String.class);
|
Assert.exists(m_templatePath, String.class);
|
||||||
Assert.isTrue(m_templatePath.startsWith("/"),
|
Assert.isTrue(m_templatePath.startsWith("/"),
|
||||||
"template-path must start with '/'");
|
"template-path must start with '/'");
|
||||||
Assert.isTrue(!m_templatePath.endsWith("/"),
|
Assert.isTrue(!m_templatePath.endsWith("/"),
|
||||||
"template-path must not end with '/'");
|
"template-path must not end with '/'");
|
||||||
|
/** Set TemplateResolver class */
|
||||||
m_resolver = Web.getConfig().getApplicationFileResolver();
|
m_resolver = Web.getConfig().getApplicationFileResolver();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the (abstract) doService method of BaseApplicationServlet to
|
* Implements the (abstract) doService method of BaseApplicationServlet to
|
||||||
* create the perform the services.
|
* perform the services.
|
||||||
*
|
|
||||||
* @see com.arsdigita.web.BaseApplicationServlet#doService
|
* @see com.arsdigita.web.BaseApplicationServlet#doService
|
||||||
* (HttpServletRequest, HttpServletResponse, Application)
|
* (HttpServletRequest, HttpServletResponse, Application)
|
||||||
*/
|
*/
|
||||||
|
|
@ -152,15 +161,10 @@ public class ServiceServlet extends BaseApplicationServlet {
|
||||||
page.dispatch(sreq, sresp, ctx);
|
page.dispatch(sreq, sresp, ctx);
|
||||||
} else {
|
} else {
|
||||||
// Fall back on the JSP application dispatcher.
|
// Fall back on the JSP application dispatcher.
|
||||||
// m_notFoundHandler.dispatch(request, response, actx);
|
|
||||||
if (s_log.isInfoEnabled()) {
|
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,
|
RequestDispatcher rd = m_resolver.resolve(m_templatePath,
|
||||||
sreq, sresp, app);
|
sreq, sresp, app);
|
||||||
if (rd != null) {
|
if (rd != null) {
|
||||||
|
|
@ -170,7 +174,6 @@ public class ServiceServlet extends BaseApplicationServlet {
|
||||||
sreq = DispatcherHelper.restoreOriginalRequest(sreq);
|
sreq = DispatcherHelper.restoreOriginalRequest(sreq);
|
||||||
rd.forward(sreq,sresp);
|
rd.forward(sreq,sresp);
|
||||||
} else {
|
} else {
|
||||||
// sresp.sendError(404, packageURL + " not found on this server.");
|
|
||||||
sresp.sendError(404, requestUri + " not found on this server.");
|
sresp.sendError(404, requestUri + " not found on this server.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ import com.arsdigita.persistence.OID;
|
||||||
// import com.arsdigita.persistence.PersistenceException;
|
// import com.arsdigita.persistence.PersistenceException;
|
||||||
import com.arsdigita.web.Application;
|
import com.arsdigita.web.Application;
|
||||||
|
|
||||||
|
import com.arsdigita.web.ApplicationCollection;
|
||||||
|
import com.arsdigita.web.ApplicationType;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -107,4 +109,39 @@ public class Workspace extends Application {
|
||||||
return app;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ import com.arsdigita.dispatcher.RequestContext;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.kernel.ACSObjectCache;
|
import com.arsdigita.kernel.ACSObjectCache;
|
||||||
import com.arsdigita.kernel.KernelHelper;
|
import com.arsdigita.kernel.KernelHelper;
|
||||||
import com.arsdigita.kernel.SiteNode;
|
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
import com.arsdigita.web.LoginSignal;
|
import com.arsdigita.web.LoginSignal;
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
|
|
@ -451,8 +450,7 @@ public class CMSDispatcher implements Dispatcher, ChainedDispatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch the current site node from the URL.
|
// Fetch the current site node from the URL.
|
||||||
SiteNode sn = SiteNode.getSiteNode(url);
|
ContentSection section = ContentSection.getSectionForPath(url);
|
||||||
ContentSection section = ContentSection.getSectionFromNode(sn);
|
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import com.arsdigita.bebop.page.PageTransformer;
|
||||||
import com.arsdigita.cms.CMSExcursion;
|
import com.arsdigita.cms.CMSExcursion;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
import com.arsdigita.cms.ContentSectionServlet;
|
||||||
import com.arsdigita.cms.SecurityManager;
|
import com.arsdigita.cms.SecurityManager;
|
||||||
import com.arsdigita.developersupport.DeveloperSupport;
|
import com.arsdigita.developersupport.DeveloperSupport;
|
||||||
import com.arsdigita.dispatcher.RequestContext;
|
import com.arsdigita.dispatcher.RequestContext;
|
||||||
|
|
@ -194,7 +195,8 @@ public class CMSPage extends Page implements ResourceHandler {
|
||||||
*/
|
*/
|
||||||
public ContentSection getContentSection(HttpServletRequest request) {
|
public ContentSection getContentSection(HttpServletRequest request) {
|
||||||
// Resets all content sections associations.
|
// Resets all content sections associations.
|
||||||
return ContentSectionDispatcher.getContentSection(request);
|
// return ContentSectionDispatcher.getContentSection(request);
|
||||||
|
return ContentSectionServlet.getContentSection(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ import com.arsdigita.dispatcher.RequestContext;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.KernelContext;
|
import com.arsdigita.kernel.KernelContext;
|
||||||
import com.arsdigita.kernel.SiteNode;
|
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
import com.arsdigita.sitenode.SiteNodeRequestContext;
|
import com.arsdigita.sitenode.SiteNodeRequestContext;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
|
|
@ -104,9 +103,8 @@ public class ContentSectionDispatcher implements Dispatcher {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Fetch the current site node from the request context;
|
ContentSection section = (ContentSection) ContentSection
|
||||||
SiteNode sn = actx.getSiteNode();
|
.getCurrentApplication(request);
|
||||||
ContentSection section = ContentSection.getSectionFromNode(sn);
|
|
||||||
Assert.exists(section);
|
Assert.exists(section);
|
||||||
|
|
||||||
request.setAttribute(CONTENT_SECTION, section);
|
request.setAttribute(CONTENT_SECTION, section);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.cms.dispatcher;
|
||||||
import com.arsdigita.cms.CMSExcursion;
|
import com.arsdigita.cms.CMSExcursion;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
import com.arsdigita.cms.ContentSectionServlet;
|
||||||
import com.arsdigita.cms.SecurityManager;
|
import com.arsdigita.cms.SecurityManager;
|
||||||
import com.arsdigita.cms.lifecycle.Lifecycle;
|
import com.arsdigita.cms.lifecycle.Lifecycle;
|
||||||
import com.arsdigita.dispatcher.ChainedDispatcher;
|
import com.arsdigita.dispatcher.ChainedDispatcher;
|
||||||
|
|
@ -32,14 +33,17 @@ import com.arsdigita.kernel.Party;
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
import com.arsdigita.versioning.Transaction;
|
import com.arsdigita.versioning.Transaction;
|
||||||
import com.arsdigita.web.LoginSignal;
|
import com.arsdigita.web.LoginSignal;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -129,7 +133,8 @@ public class ItemDispatcher implements ChainedDispatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
final ContentSection section =
|
final ContentSection section =
|
||||||
ContentSectionDispatcher.getContentSection(request);
|
ContentSectionServlet.getContentSection(request);
|
||||||
|
// ContentSectionDispatcher.getContentSection(request);
|
||||||
|
|
||||||
final ContentItem item = getItem(section, url);
|
final ContentItem item = getItem(section, url);
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import com.arsdigita.cms.ContentBundle;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.Folder;
|
import com.arsdigita.cms.Folder;
|
||||||
|
import com.arsdigita.cms.Workspace;
|
||||||
import com.arsdigita.cms.ui.ContentItemPage;
|
import com.arsdigita.cms.ui.ContentItemPage;
|
||||||
import com.arsdigita.cms.util.LanguageUtil;
|
import com.arsdigita.cms.util.LanguageUtil;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
|
@ -245,7 +246,7 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
|
|
||||||
// Determine if we are under the admin UI.
|
// 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;
|
return ContentItem.DRAFT;
|
||||||
} else {
|
} else {
|
||||||
return ContentItem.LIVE;
|
return ContentItem.LIVE;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.Folder;
|
import com.arsdigita.cms.Folder;
|
||||||
|
import com.arsdigita.cms.Workspace;
|
||||||
import com.arsdigita.cms.ui.ContentItemPage;
|
import com.arsdigita.cms.ui.ContentItemPage;
|
||||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
|
|
@ -63,7 +64,7 @@ public class SimpleItemResolver extends AbstractItemResolver implements ItemReso
|
||||||
Logger.getLogger(SimpleItemResolver.class.getName());
|
Logger.getLogger(SimpleItemResolver.class.getName());
|
||||||
|
|
||||||
private static final String ADMIN_PREFIX = "admin";
|
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;
|
private static MasterPage s_masterP = null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,12 @@ import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ImageAsset;
|
import com.arsdigita.cms.ImageAsset;
|
||||||
import com.arsdigita.cms.SecurityManager;
|
import com.arsdigita.cms.SecurityManager;
|
||||||
|
import com.arsdigita.cms.Service;
|
||||||
|
import com.arsdigita.cms.Workspace;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.KernelContext;
|
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 com.arsdigita.kernel.User;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
@ -43,6 +39,8 @@ import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>This class provides many utility functions for the Content Management
|
* <p>This class provides many utility functions for the Content Management
|
||||||
* System.</p>
|
* System.</p>
|
||||||
|
|
@ -63,23 +61,20 @@ public class Utilities {
|
||||||
public static final Logger LOG = Logger.getLogger(Utilities.class);
|
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
|
* @return The URL of the CMS Workspace package
|
||||||
* @deprecated without direct replacement yet, refactor code to use
|
* @deprecated use Workspace.getURL() instead
|
||||||
* legacy free code in com.arsdigita.web
|
|
||||||
*/
|
*/
|
||||||
public static String getWorkspaceURL() {
|
public static String getWorkspaceURL() {
|
||||||
String url = (String) m_cache.get(CMS.WORKSPACE_PACKAGE_KEY);
|
|
||||||
if ( url == null ) {
|
return Workspace.getURL();
|
||||||
url = getSingletonPackageURL(CMS.WORKSPACE_PACKAGE_KEY);
|
|
||||||
m_cache.put(CMS.WORKSPACE_PACKAGE_KEY, url);
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @return The URL of the CMS Services package
|
||||||
|
* @deprecated Use Service.getURL( instead
|
||||||
*/
|
*/
|
||||||
public static String getServiceURL() {
|
public static String getServiceURL() {
|
||||||
String url = (String) m_cache.get(CMS.SERVICE_PACKAGE_KEY);
|
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
|
// file that is maintained by a non cms application eg
|
||||||
// forum, then I can end up with a url that doesn't work
|
// forum, then I can end up with a url that doesn't work
|
||||||
// and so breaks file links everywhere
|
// 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);
|
m_cache.put(CMS.SERVICE_PACKAGE_KEY, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,7 +98,8 @@ public class Utilities {
|
||||||
* @return The logout URL
|
* @return The logout URL
|
||||||
*/
|
*/
|
||||||
public static String getLogoutURL() {
|
public static String getLogoutURL() {
|
||||||
StringBuffer buf = new StringBuffer(getServiceURL());
|
//StringBuffer buf = new StringBuffer(getServiceURL());
|
||||||
|
StringBuilder buf = new StringBuilder(Service.getURL() );
|
||||||
buf.append("logout");
|
buf.append("logout");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
@ -112,6 +109,7 @@ public class Utilities {
|
||||||
*
|
*
|
||||||
* @param asset The binary asset
|
* @param asset The binary asset
|
||||||
* @return the URL which will serve the specified 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) {
|
public static String getAssetURL(BinaryAsset asset) {
|
||||||
return getAssetURL(asset.getID());
|
return getAssetURL(asset.getID());
|
||||||
|
|
@ -122,9 +120,11 @@ public class Utilities {
|
||||||
*
|
*
|
||||||
* @param assetId The asset ID
|
* @param assetId The asset ID
|
||||||
* @return the URL which will serve the specified binary asset
|
* @return the URL which will serve the specified binary asset
|
||||||
|
* @deprecated Use Service.getAssetURL(BigDecimal assetId) instead
|
||||||
*/
|
*/
|
||||||
public static String getAssetURL(BigDecimal assetId) {
|
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("stream/asset?");
|
||||||
buf.append(StreamAsset.ASSET_ID).append("=").append(assetId);
|
buf.append(StreamAsset.ASSET_ID).append("=").append(assetId);
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
|
@ -137,9 +137,11 @@ public class Utilities {
|
||||||
*
|
*
|
||||||
* @param asset The image asset whose image is to be served
|
* @param asset The image asset whose image is to be served
|
||||||
* @return the URL which will serve the specified image asset
|
* @return the URL which will serve the specified image asset
|
||||||
|
* @deprecated Use Service.getImageURL(ImageAsset) instead!
|
||||||
*/
|
*/
|
||||||
public static String getImageURL(ImageAsset asset) {
|
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("stream/image/?");
|
||||||
buf.append(StreamImage.IMAGE_ID).append("=").append(asset.getID());
|
buf.append(StreamImage.IMAGE_ID).append("=").append(asset.getID());
|
||||||
return buf.toString();
|
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
|
* @param key
|
||||||
* @return
|
* @return
|
||||||
* @deprecated without replacement (singleton package is not a supported
|
* // @deprecated without replacement (singleton package is not a supported
|
||||||
* property for legacy free applications.)
|
* property for legacy free applications.)
|
||||||
*/
|
*/
|
||||||
private static String getSingletonPackageURLSansContext(String key) {
|
/* private static String getSingletonPackageURLSansContext(String key) {
|
||||||
PackageType type = null;
|
PackageType type = null;
|
||||||
type = PackageType.findByKey(key);
|
type = PackageType.findByKey(key);
|
||||||
PackageInstanceCollection instances = type.getInstances();
|
PackageInstanceCollection instances = type.getInstances();
|
||||||
|
|
@ -251,7 +208,7 @@ public class Utilities {
|
||||||
|
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the context path of the request. This is typically "/".
|
* Fetch the context path of the request. This is typically "/".
|
||||||
|
|
@ -377,6 +334,7 @@ public class Utilities {
|
||||||
*
|
*
|
||||||
* @param state The page state
|
* @param state The page state
|
||||||
* @return The SecurityManager for the content section
|
* @return The SecurityManager for the content section
|
||||||
|
* @deprecated Use CMS.getSecurityManager(PageState state) instead.
|
||||||
*/
|
*/
|
||||||
public static SecurityManager getSecurityManager(PageState state) {
|
public static SecurityManager getSecurityManager(PageState state) {
|
||||||
ContentSection section = CMS.getContext().getContentSection();
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import com.arsdigita.bebop.page.PageTransformer;
|
||||||
import com.arsdigita.cms.CMSExcursion;
|
import com.arsdigita.cms.CMSExcursion;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
import com.arsdigita.cms.ContentSectionServlet;
|
||||||
import com.arsdigita.cms.SecurityManager;
|
import com.arsdigita.cms.SecurityManager;
|
||||||
import com.arsdigita.developersupport.DeveloperSupport;
|
import com.arsdigita.developersupport.DeveloperSupport;
|
||||||
import com.arsdigita.dispatcher.RequestContext;
|
import com.arsdigita.dispatcher.RequestContext;
|
||||||
|
|
@ -195,7 +196,8 @@ public class CMSApplicationPage extends Page {
|
||||||
*/
|
*/
|
||||||
public ContentSection getContentSection(HttpServletRequest request) {
|
public ContentSection getContentSection(HttpServletRequest request) {
|
||||||
// Resets all content sections associations.
|
// Resets all content sections associations.
|
||||||
return ContentSectionDispatcher.getContentSection(request);
|
// return ContentSectionDispatcher.getContentSection(request);
|
||||||
|
return ContentSectionServlet.getContentSection(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.PageLocations;
|
import com.arsdigita.cms.PageLocations;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
import com.arsdigita.cms.Workspace;
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
|
|
@ -49,6 +49,12 @@ public class ContentItemNavbar extends CMSContainer {
|
||||||
setClassAttr("item");
|
setClassAttr("item");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param state
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public void generateXML(PageState state, Element parent) {
|
public void generateXML(PageState state, Element parent) {
|
||||||
Element element = new Element("cms:breadCrumbTrail", CMS.CMS_XML_NS);
|
Element element = new Element("cms:breadCrumbTrail", CMS.CMS_XML_NS);
|
||||||
|
|
||||||
|
|
@ -57,7 +63,7 @@ public class ContentItemNavbar extends CMSContainer {
|
||||||
ContentType type = item.getContentType();
|
ContentType type = item.getContentType();
|
||||||
|
|
||||||
final String url = URL.there(state.getRequest(),
|
final String url = URL.there(state.getRequest(),
|
||||||
Utilities.getWorkspaceURL()).toString();
|
Workspace.getURL()).toString();
|
||||||
|
|
||||||
element.addAttribute("workspaceURL", url);
|
element.addAttribute("workspaceURL", url);
|
||||||
element.addAttribute("sectionName", section.getName());
|
element.addAttribute("sectionName", section.getName());
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ public class ContentItemRenderer extends DomainObjectRenderer {
|
||||||
* Generate XML for the domain object supplied by the
|
* Generate XML for the domain object supplied by the
|
||||||
* selection model.
|
* selection model.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void generateXML(PageState state, Element parent) {
|
public void generateXML(PageState state, Element parent) {
|
||||||
ContentItem item = ContentSectionDispatcher.getContentItem(state.getRequest());
|
ContentItem item = ContentSectionDispatcher.getContentItem(state.getRequest());
|
||||||
Element e = generateXMLElement(item);
|
Element e = generateXMLElement(item);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import com.arsdigita.bebop.Link;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentSection;
|
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.cms.util.GlobalizationUtil;
|
||||||
import com.arsdigita.ui.UI;
|
import com.arsdigita.ui.UI;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
@ -45,7 +45,7 @@ public class ContentSectionNavbar extends CMSContainer {
|
||||||
setClassAttr("section");
|
setClassAttr("section");
|
||||||
|
|
||||||
String wsUrl = UI.getWorkspaceURL();
|
String wsUrl = UI.getWorkspaceURL();
|
||||||
String csUrl = Utilities.getWorkspaceURL();
|
String csUrl = Workspace.getURL();
|
||||||
|
|
||||||
m_navbar = new DimensionalNavbar();
|
m_navbar = new DimensionalNavbar();
|
||||||
m_navbar.setAlign(DimensionalNavbar.LEFT);
|
m_navbar.setAlign(DimensionalNavbar.LEFT);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ package com.arsdigita.cms.ui;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.SimpleComponent;
|
import com.arsdigita.bebop.SimpleComponent;
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
import com.arsdigita.cms.Workspace;
|
||||||
import com.arsdigita.ui.UI;
|
import com.arsdigita.ui.UI;
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
@ -46,7 +46,7 @@ class GlobalNavigation extends SimpleComponent {
|
||||||
private final String m_helpPath;
|
private final String m_helpPath;
|
||||||
|
|
||||||
GlobalNavigation() {
|
GlobalNavigation() {
|
||||||
m_centerPath = Utilities.getWorkspaceURL();
|
m_centerPath = Workspace.getURL();
|
||||||
m_wspcPath = UI.getWorkspaceURL();
|
m_wspcPath = UI.getWorkspaceURL();
|
||||||
m_signOutPath = UI.getLogoutPageURL();
|
m_signOutPath = UI.getLogoutPageURL();
|
||||||
m_helpPath = "/nowhere"; // We don't have this yet XXX.
|
m_helpPath = "/nowhere"; // We don't have this yet XXX.
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,11 @@ import com.arsdigita.bebop.table.DefaultTableCellRenderer;
|
||||||
import com.arsdigita.bebop.table.TableCellRenderer;
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
import com.arsdigita.bebop.table.TableModel;
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
import com.arsdigita.bebop.table.TableModelBuilder;
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ImageAsset;
|
import com.arsdigita.cms.ImageAsset;
|
||||||
import com.arsdigita.cms.SecurityManager;
|
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.DataObjectNotFoundException;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.mimetypes.MimeType;
|
import com.arsdigita.mimetypes.MimeType;
|
||||||
|
|
@ -163,7 +165,8 @@ public class ImageBrowser extends Table {
|
||||||
boolean isSelected, Object key,
|
boolean isSelected, Object key,
|
||||||
int row, int column) {
|
int row, int column) {
|
||||||
ImageAsset a = (ImageAsset) value;
|
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);
|
Image img = new Image(URL.getDispatcherPath() + url);
|
||||||
img.setBorder("0");
|
img.setBorder("0");
|
||||||
|
|
@ -202,7 +205,8 @@ public class ImageBrowser extends Table {
|
||||||
boolean isSelected, Object key,
|
boolean isSelected, Object key,
|
||||||
int row, int column) {
|
int row, int column) {
|
||||||
boolean canDelete = false;
|
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)) {
|
if (sm.canAccess(state.getRequest(), SecurityManager.DELETE_IMAGES)) {
|
||||||
try {
|
try {
|
||||||
ImageAsset asset = (ImageAsset) DomainObjectFactory.newInstance(new OID(ImageAsset.BASE_DATA_OBJECT_TYPE, (BigDecimal) key));
|
ImageAsset asset = (ImageAsset) DomainObjectFactory.newInstance(new OID(ImageAsset.BASE_DATA_OBJECT_TYPE, (BigDecimal) key));
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,8 @@ import com.arsdigita.bebop.SimpleComponent;
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ImageAsset;
|
import com.arsdigita.cms.ImageAsset;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
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.mimetypes.MimeType;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
|
|
@ -64,6 +65,7 @@ public class ImageDisplay extends SimpleComponent {
|
||||||
return m_item;
|
return m_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void generateXML(PageState state, Element parent) {
|
public void generateXML(PageState state, Element parent) {
|
||||||
if ( isVisible(state) ) {
|
if ( isVisible(state) ) {
|
||||||
|
|
||||||
|
|
@ -89,7 +91,8 @@ public class ImageDisplay extends SimpleComponent {
|
||||||
Element element) {
|
Element element) {
|
||||||
element.addAttribute("name", image.getName());
|
element.addAttribute("name", image.getName());
|
||||||
element.addAttribute("src", URL.getDispatcherPath() +
|
element.addAttribute("src", URL.getDispatcherPath() +
|
||||||
Utilities.getImageURL(image));
|
Service.getImageURL(image));
|
||||||
|
// Utilities.getImageURL(image));
|
||||||
|
|
||||||
BigDecimal width = image.getWidth();
|
BigDecimal width = image.getWidth();
|
||||||
if ( width != null ) {
|
if ( width != null ) {
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ import com.arsdigita.bebop.util.BebopConstants;
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
|
import com.arsdigita.cms.Workspace;
|
||||||
import com.arsdigita.cms.dispatcher.ContentCenterDispatcher;
|
import com.arsdigita.cms.dispatcher.ContentCenterDispatcher;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.web.ParameterMap;
|
import com.arsdigita.web.ParameterMap;
|
||||||
|
|
@ -225,9 +226,7 @@ public class ItemSearchWidget extends FormSection
|
||||||
ItemSearchPage.class.getName());
|
ItemSearchPage.class.getName());
|
||||||
s_log.debug("Search URL stub is: " + searchURL);
|
s_log.debug("Search URL stub is: " + searchURL);
|
||||||
|
|
||||||
searchURL = com.arsdigita.cms.dispatcher.Utilities.
|
searchURL = Workspace.getURL() + searchURL;
|
||||||
getWorkspaceURL()
|
|
||||||
+ searchURL;
|
|
||||||
|
|
||||||
// TODO Not sure what to do when you get a null here
|
// TODO Not sure what to do when you get a null here
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.SectionLocaleCollection;
|
import com.arsdigita.cms.SectionLocaleCollection;
|
||||||
|
import com.arsdigita.cms.Workspace;
|
||||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
|
|
@ -181,7 +182,7 @@ public class SectionConfigurationPage extends CMSPage implements Resettable {
|
||||||
|
|
||||||
DimensionalNavbar dn = new DimensionalNavbar();
|
DimensionalNavbar dn = new DimensionalNavbar();
|
||||||
dn.setDelimiter(" - ");
|
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()));
|
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
|
// 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"));
|
// dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.help")), "help"));
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
package com.arsdigita.cms.ui;
|
package com.arsdigita.cms.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
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.toolbox.ui.ContextBar;
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -37,11 +37,12 @@ class WorkspaceContextBar extends ContextBar {
|
||||||
private static final Logger s_log = Logger.getLogger
|
private static final Logger s_log = Logger.getLogger
|
||||||
(WorkspaceContextBar.class);
|
(WorkspaceContextBar.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
protected List entries(final PageState state) {
|
protected List entries(final PageState state) {
|
||||||
final List entries = super.entries(state);
|
final List entries = super.entries(state);
|
||||||
|
|
||||||
final String centerTitle = lz("cms.ui.content_center");
|
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);
|
final URL url = URL.there(state.getRequest(), centerPath);
|
||||||
|
|
||||||
entries.add(new Entry(centerTitle, url));
|
entries.add(new Entry(centerTitle, url));
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ import com.arsdigita.cms.CMSConfig;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.SecurityManager;
|
import com.arsdigita.cms.SecurityManager;
|
||||||
|
import com.arsdigita.cms.Workspace;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
import com.arsdigita.cms.lifecycle.Lifecycle;
|
import com.arsdigita.cms.lifecycle.Lifecycle;
|
||||||
import com.arsdigita.cms.ui.BaseItemPane;
|
import com.arsdigita.cms.ui.BaseItemPane;
|
||||||
|
|
@ -274,7 +275,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||||
throw new RedirectSignal(
|
throw new RedirectSignal(
|
||||||
URL.there(state.getRequest(),
|
URL.there(state.getRequest(),
|
||||||
Utilities.getWorkspaceURL()), true);
|
Workspace.getURL()), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -361,7 +362,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||||
throw new RedirectSignal(
|
throw new RedirectSignal(
|
||||||
URL.there(state.getRequest(),
|
URL.there(state.getRequest(),
|
||||||
Utilities.getWorkspaceURL()), true);
|
Workspace.getURL()), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -529,7 +530,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||||
throw new RedirectSignal(
|
throw new RedirectSignal(
|
||||||
URL.there(state.getRequest(),
|
URL.there(state.getRequest(),
|
||||||
Utilities.getWorkspaceURL()), true);
|
Workspace.getURL()), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (REPUBLISH_AND_RESET.equals(selected)) {
|
} else if (REPUBLISH_AND_RESET.equals(selected)) {
|
||||||
|
|
@ -564,7 +565,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||||
throw new RedirectSignal(
|
throw new RedirectSignal(
|
||||||
URL.there(state.getRequest(),
|
URL.there(state.getRequest(),
|
||||||
Utilities.getWorkspaceURL()), true);
|
Workspace.getURL()), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (UNPUBLISH.equals(selected)) {
|
} else if (UNPUBLISH.equals(selected)) {
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ import com.arsdigita.cms.CMSConfig;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ContentTypeLifecycleDefinition;
|
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.Lifecycle;
|
||||||
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
||||||
import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection;
|
import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection;
|
||||||
|
|
@ -417,7 +417,7 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||||
throw new RedirectSignal(
|
throw new RedirectSignal(
|
||||||
URL.there(state.getRequest(),
|
URL.there(state.getRequest(),
|
||||||
Utilities.getWorkspaceURL()),
|
Workspace.getURL()),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
|
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSection;
|
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.portlet.TaskPortlet;
|
||||||
import com.arsdigita.cms.ui.ContentItemPage;
|
import com.arsdigita.cms.ui.ContentItemPage;
|
||||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
|
|
@ -63,7 +63,7 @@ public class TaskPortletRenderer extends AbstractPortletRenderer {
|
||||||
protected void generateBodyXML(PageState pageState, Element parentElement) {
|
protected void generateBodyXML(PageState pageState, Element parentElement) {
|
||||||
|
|
||||||
|
|
||||||
final String contentCenter = Utilities.getWorkspaceURL();
|
final String contentCenter = Workspace.getURL();
|
||||||
|
|
||||||
|
|
||||||
Link link = new Link("Content Center", contentCenter);
|
Link link = new Link("Content Center", contentCenter);
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ import com.arsdigita.categorization.Category;
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.CategoryTemplateMapping;
|
import com.arsdigita.cms.CategoryTemplateMapping;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
import com.arsdigita.cms.ContentSectionServlet;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.ContentTypeCollection;
|
import com.arsdigita.cms.ContentTypeCollection;
|
||||||
import com.arsdigita.cms.SectionTemplateMapping;
|
import com.arsdigita.cms.SectionTemplateMapping;
|
||||||
|
|
@ -59,7 +60,6 @@ import com.arsdigita.cms.Template;
|
||||||
import com.arsdigita.cms.TemplateCollection;
|
import com.arsdigita.cms.TemplateCollection;
|
||||||
import com.arsdigita.cms.TemplateManager;
|
import com.arsdigita.cms.TemplateManager;
|
||||||
import com.arsdigita.cms.TemplateManagerFactory;
|
import com.arsdigita.cms.TemplateManagerFactory;
|
||||||
import com.arsdigita.cms.dispatcher.ContentSectionDispatcher;
|
|
||||||
import com.arsdigita.cms.ui.CMSContainer;
|
import com.arsdigita.cms.ui.CMSContainer;
|
||||||
import com.arsdigita.cms.ui.FormSecurityListener;
|
import com.arsdigita.cms.ui.FormSecurityListener;
|
||||||
import com.arsdigita.cms.ui.category.CategoryComponentAccess;
|
import com.arsdigita.cms.ui.category.CategoryComponentAccess;
|
||||||
|
|
@ -157,6 +157,7 @@ public class CategoryTemplates extends CMSContainer {
|
||||||
add(m_assign);
|
add(m_assign);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void register(Page p) {
|
public void register(Page p) {
|
||||||
super.register(p);
|
super.register(p);
|
||||||
|
|
||||||
|
|
@ -183,6 +184,7 @@ public class CategoryTemplates extends CMSContainer {
|
||||||
String useContext) {
|
String useContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void register(Page p) {
|
public void register(Page p) {
|
||||||
super.register(p);
|
super.register(p);
|
||||||
|
|
||||||
|
|
@ -232,6 +234,7 @@ public class CategoryTemplates extends CMSContainer {
|
||||||
new AssignCellRenderer());
|
new AssignCellRenderer());
|
||||||
|
|
||||||
addTableActionListener(new TableActionAdapter() {
|
addTableActionListener(new TableActionAdapter() {
|
||||||
|
@Override
|
||||||
public void cellSelected(TableActionEvent e) {
|
public void cellSelected(TableActionEvent e) {
|
||||||
PageState s = e.getPageState();
|
PageState s = e.getPageState();
|
||||||
TemplatesListing l = (TemplatesListing)e.getSource();
|
TemplatesListing l = (TemplatesListing)e.getSource();
|
||||||
|
|
@ -242,7 +245,8 @@ public class CategoryTemplates extends CMSContainer {
|
||||||
// created statically
|
// created statically
|
||||||
if(c == m_assignCol) {
|
if(c == m_assignCol) {
|
||||||
SectionTemplateMapping m =
|
SectionTemplateMapping m =
|
||||||
(SectionTemplateMapping)getMappingModel().getSelectedObject(s);
|
(SectionTemplateMapping)getMappingModel()
|
||||||
|
.getSelectedObject(s);
|
||||||
assignTemplate(s, m.getTemplate());
|
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
|
* Get all the templates for the given type in the current section
|
||||||
*/
|
*/
|
||||||
protected TemplateCollection getTemplateCollection(PageState s) {
|
protected TemplateCollection getTemplateCollection(PageState s) {
|
||||||
ContentSection sec = ContentSectionDispatcher.getContentSection(s.getRequest());
|
ContentSection sec = ContentSectionServlet.getContentSection(s.getRequest());
|
||||||
Assert.exists(sec, "content section");
|
Assert.exists(sec, "content section");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -298,7 +302,8 @@ public class CategoryTemplates extends CMSContainer {
|
||||||
map.setUseContext(useContext);
|
map.setUseContext(useContext);
|
||||||
map.setTemplate(t);
|
map.setTemplate(t);
|
||||||
}
|
}
|
||||||
map.setContentSection(ContentSectionDispatcher.getContentSection(s.getRequest()));
|
map.setContentSection(ContentSectionServlet
|
||||||
|
.getContentSection(s.getRequest()));
|
||||||
map.save();
|
map.save();
|
||||||
|
|
||||||
m_display.setVisible(s, true);
|
m_display.setVisible(s, true);
|
||||||
|
|
@ -317,7 +322,8 @@ public class CategoryTemplates extends CMSContainer {
|
||||||
m_link.setClassAttr("assignTemplateLink");
|
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,
|
boolean isSelected, Object key,
|
||||||
int row, int column) {
|
int row, int column) {
|
||||||
return m_link;
|
return m_link;
|
||||||
|
|
@ -326,6 +332,9 @@ public class CategoryTemplates extends CMSContainer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
private class AssignForm extends Form {
|
private class AssignForm extends Form {
|
||||||
|
|
||||||
SingleSelect m_type;
|
SingleSelect m_type;
|
||||||
|
|
@ -345,22 +354,24 @@ public class CategoryTemplates extends CMSContainer {
|
||||||
m_type = new SingleSelect(type.getStateParameter());
|
m_type = new SingleSelect(type.getStateParameter());
|
||||||
try {
|
try {
|
||||||
m_type.addPrintListener(new PrintListener() {
|
m_type.addPrintListener(new PrintListener() {
|
||||||
public void prepare(PrintEvent e) {
|
public void prepare(PrintEvent e) {
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
ContentSection section = ContentSectionDispatcher.getContentSection(state.getRequest());
|
ContentSection section = ContentSectionServlet
|
||||||
|
.getContentSection(state
|
||||||
|
.getRequest());
|
||||||
|
|
||||||
SingleSelect target = (SingleSelect)e.getTarget();
|
SingleSelect target = (SingleSelect)e.getTarget();
|
||||||
|
|
||||||
ContentTypeCollection types = section.getContentTypes();
|
ContentTypeCollection types = section.getContentTypes();
|
||||||
types.addOrder(ContentType.LABEL);
|
types.addOrder(ContentType.LABEL);
|
||||||
|
|
||||||
while (types.next()) {
|
while (types.next()) {
|
||||||
ContentType type = types.getContentType();
|
ContentType type = types.getContentType();
|
||||||
target.addOption(new Option(type.getID().toString(),
|
target.addOption(new Option(type.getID().toString(),
|
||||||
type.getLabel()));
|
type.getLabel()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
} catch (TooManyListenersException ex) {
|
} catch (TooManyListenersException ex) {
|
||||||
throw new UncheckedWrapperException("This can never happen", 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
|
// XXX no need for selecting template contexts currently
|
||||||
m_context = new Hidden(context.getStateParameter());
|
m_context = new Hidden(context.getStateParameter());
|
||||||
m_context.setDefaultValue(TemplateManager.PUBLIC_CONTEXT);
|
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(m_context);
|
||||||
|
|
||||||
add(new Submit("Assign template"));
|
add(new Submit("Assign template"));
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import com.arsdigita.bebop.form.Option;
|
||||||
import com.arsdigita.bebop.form.RadioGroup;
|
import com.arsdigita.bebop.form.RadioGroup;
|
||||||
import com.arsdigita.bebop.parameters.BooleanParameter;
|
import com.arsdigita.bebop.parameters.BooleanParameter;
|
||||||
import com.arsdigita.cms.ContentSection;
|
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.ui.ContentItemPage;
|
||||||
import com.arsdigita.cms.workflow.CMSEngine;
|
import com.arsdigita.cms.workflow.CMSEngine;
|
||||||
import com.arsdigita.cms.workflow.CMSTask;
|
import com.arsdigita.cms.workflow.CMSTask;
|
||||||
|
|
@ -39,7 +39,6 @@ import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.Party;
|
import com.arsdigita.kernel.Party;
|
||||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||||
import com.arsdigita.kernel.permissions.PermissionService;
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.web.RedirectSignal;
|
import com.arsdigita.web.RedirectSignal;
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
|
|
@ -206,7 +205,7 @@ public final class TaskFinishForm extends CommentAddForm {
|
||||||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||||
throw new RedirectSignal
|
throw new RedirectSignal
|
||||||
(URL.there(state.getRequest(),
|
(URL.there(state.getRequest(),
|
||||||
Utilities.getWorkspaceURL()),
|
Workspace.getURL()),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
package com.arsdigita.categorization;
|
package com.arsdigita.categorization;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.kernel.SiteNode;
|
// import com.arsdigita.kernel.SiteNode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -34,21 +34,25 @@ public class Categorization {
|
||||||
|
|
||||||
private static List s_categoryListeners = new ArrayList();
|
private static List s_categoryListeners = new ArrayList();
|
||||||
|
|
||||||
|
/* No longer used. Client methods are removed.
|
||||||
public static final String CONTEXT_NAVIGATION = "navigation";
|
public static final String CONTEXT_NAVIGATION = "navigation";
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* A wrapper for {@link Categorization#getGlobalRootCategory(String)
|
* A wrapper for {@link Categorization#getGlobalRootCategory(String)
|
||||||
* getGlobalRootCategory(Categorization.CONTEXT_NAVIGATION)}.
|
* getGlobalRootCategory(Categorization.CONTEXT_NAVIGATION)}.
|
||||||
* @see #getGlobalRootCategory()
|
* @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);
|
return getGlobalRootCategory(CONTEXT_NAVIGATION);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @see Category#getRootForObject(com.arsdigita.kernel.ACSObject)
|
* @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 change this impl.
|
||||||
// XXX support context
|
// XXX support context
|
||||||
Category root = Category.getRootForObject(
|
Category root = Category.getRootForObject(
|
||||||
|
|
@ -56,7 +60,7 @@ public class Categorization {
|
||||||
);
|
);
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public static void addCategoryListener(CategoryListener cl) {
|
public static void addCategoryListener(CategoryListener cl) {
|
||||||
s_categoryListeners.add(cl);
|
s_categoryListeners.add(cl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,11 @@ public class ApplicationPatternGenerator implements PatternGenerator {
|
||||||
// legacy-compatible applications but package-type apps. content-center
|
// legacy-compatible applications but package-type apps. content-center
|
||||||
// and cms-service are 2 examples. Code can be eliminated when all apps
|
// and cms-service are 2 examples. Code can be eliminated when all apps
|
||||||
// will use web.Application for loading and instantiation.
|
// 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.");
|
"<< not found. Trying SiteNodes instead.");
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,9 @@ import com.arsdigita.web.Web;
|
||||||
import com.arsdigita.util.StringUtils;
|
import com.arsdigita.util.StringUtils;
|
||||||
|
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.sitenode.SiteNodeRequestContext;
|
|
||||||
import com.arsdigita.kernel.SiteNode;
|
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
|
|
||||||
|
import com.arsdigita.web.Application;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -140,14 +139,27 @@ public class URLPatternGenerator implements PatternGenerator {
|
||||||
return url.substring(base.length()-1);
|
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() {
|
private String getBasePath() {
|
||||||
SiteNodeRequestContext ctx = (SiteNodeRequestContext)
|
|
||||||
DispatcherHelper.getRequestContext(Web.getRequest());
|
|
||||||
|
|
||||||
SiteNode node = ctx.getSiteNode();
|
// OLD code using kernel.SiteNode etc which is deprecatged and no longer
|
||||||
Assert.exists(node, SiteNode.class);
|
// available
|
||||||
return node.getURL();
|
// SiteNodeRequestContext ctx = (SiteNodeRequestContext)
|
||||||
|
// DispatcherHelper.getRequestContext(Web.getRequest());
|
||||||
|
// 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,24 +24,20 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.SimpleComponent;
|
import com.arsdigita.bebop.SimpleComponent;
|
||||||
import com.arsdigita.bebop.SimpleContainer;
|
import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.kernel.User;
|
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.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.web.URL;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reusable Bebop component to display the primary attributes of the
|
* A reusable Bebop component to display the primary attributes of the
|
||||||
* currently logged in user. Users can extend this class to provide
|
* 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)}
|
* UserInfo#register(Page)} and {@link UserInfo#getUser(PageState)}
|
||||||
* methods.
|
* methods.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @author Michael Bryzek
|
* @author Michael Bryzek
|
||||||
* @author Roger Hsueh
|
* @author Roger Hsueh
|
||||||
* @author Sameer Ajmani
|
* @author Sameer Ajmani
|
||||||
|
* @author Peter Boy (refactored to eliminate old type kernel.Package* / SiteNode)
|
||||||
* @since 2001-06-01
|
* @since 2001-06-01
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @version $Id: UserInfo.java 287 2005-02-22 00:29:02Z sskracic $
|
* @version $Id: UserInfo.java 287 2005-02-22 00:29:02Z sskracic $
|
||||||
*
|
*/
|
||||||
**/
|
|
||||||
public class UserInfo extends SimpleContainer {
|
public class UserInfo extends SimpleContainer {
|
||||||
|
|
||||||
|
/** Logger instance for debugging support */
|
||||||
private static final Logger s_log =
|
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
|
/** Holds a list of content centers (Application instances) that exist
|
||||||
on this installation */
|
* 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;
|
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 =
|
private UserAuthenticationListener m_listener =
|
||||||
new UserAuthenticationListener();
|
new UserAuthenticationListener();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
@ -86,101 +80,107 @@ public class UserInfo extends SimpleContainer {
|
||||||
list.add(new DynamicLink("login.userInfo.changePasswordLink",
|
list.add(new DynamicLink("login.userInfo.changePasswordLink",
|
||||||
UI.getRecoverPasswordPageURL()));
|
UI.getRecoverPasswordPageURL()));
|
||||||
add(list);
|
add(list);
|
||||||
|
|
||||||
// add user info text
|
// add user info text
|
||||||
add(new SimpleComponent() {
|
add(new SimpleComponent() {
|
||||||
@Override
|
@Override
|
||||||
public void generateXML(PageState state, Element parent) {
|
public void generateXML(PageState state, Element parent) {
|
||||||
if (!isLoggedIn(state)) {
|
if (!isLoggedIn(state)) {
|
||||||
s_log.debug("user is not logged in, so no XML generated");
|
s_log.debug("user is not logged in, so no XML generated");
|
||||||
return;
|
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
|
// If application type CMS Workspace is installed:
|
||||||
("subsite:userInfo", SubsiteDispatcher.SUBSITE_NS_URI);
|
if (objectType != null) {
|
||||||
|
|
||||||
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!
|
|
||||||
// retrieve all packages of type content-center
|
// retrieve all packages of type content-center
|
||||||
// works because there may be only one.
|
// works because there may be only one.
|
||||||
DataCollection dc = SessionManager.getSession().retrieve
|
ApplicationCollection workspaceInstances = Application
|
||||||
(PackageType.BASE_DATA_OBJECT_TYPE);
|
.retrieveAllApplications(objectType);
|
||||||
dc.addEqualsFilter("packageKey", "content-center");
|
|
||||||
|
|
||||||
if (dc.next()) {
|
// step through collection of instances of type Workspace
|
||||||
// works because there may be only one entry of
|
// generally there is only a single instance, but obviously
|
||||||
// package type content-center
|
// code takes care provided therfe is an instance for
|
||||||
PackageType pt = new PackageType(dc.getDataObject());
|
// each subsite.
|
||||||
dc.close();
|
while (workspaceInstances.next()) {
|
||||||
|
// retrieve one Workspace instance of collection
|
||||||
PackageInstanceCollection collection = pt.getInstances();
|
Application workspaceInstance = (Application)
|
||||||
while (collection.next()) {
|
workspaceInstances.getApplication();
|
||||||
PackageInstance instance = collection.getPackageInstance();
|
// Add Workspace instance to internal map
|
||||||
instance.disconnect();
|
m_contentCenters.add(workspaceInstance);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
* @pre p != null
|
||||||
**/
|
**/
|
||||||
|
@Override
|
||||||
public void register(Page p) {
|
public void register(Page p) {
|
||||||
super.register(p);
|
super.register(p);
|
||||||
p.addRequestListener(m_listener);
|
p.addRequestListener(m_listener);
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
package com.arsdigita.cms.docmgr;
|
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.ContentSection;
|
||||||
import com.arsdigita.cms.ContentSectionCollection;
|
import com.arsdigita.cms.ContentSectionCollection;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
|
@ -24,22 +22,18 @@ import com.arsdigita.kernel.Group;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.KernelExcursion;
|
import com.arsdigita.kernel.KernelExcursion;
|
||||||
import com.arsdigita.kernel.Party;
|
import com.arsdigita.kernel.Party;
|
||||||
import com.arsdigita.kernel.SiteNode;
|
|
||||||
import com.arsdigita.kernel.User;
|
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.PermissionService;
|
||||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
// import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||||
import com.arsdigita.persistence.DataObject;
|
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.persistence.Session;
|
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
|
||||||
import com.arsdigita.web.Application;
|
import com.arsdigita.web.Application;
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
import com.arsdigita.web.ApplicationCollection;
|
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,12 @@ import com.arsdigita.cms.ContentBundle;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.Folder;
|
import com.arsdigita.cms.Folder;
|
||||||
|
import com.arsdigita.cms.Workspace;
|
||||||
import com.arsdigita.cms.dispatcher.AbstractItemResolver;
|
import com.arsdigita.cms.dispatcher.AbstractItemResolver;
|
||||||
import com.arsdigita.cms.dispatcher.CMSDispatcher;
|
import com.arsdigita.cms.dispatcher.CMSDispatcher;
|
||||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
import com.arsdigita.cms.dispatcher.MasterPage;
|
import com.arsdigita.cms.dispatcher.MasterPage;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
|
||||||
import com.arsdigita.cms.ui.ContentItemPage;
|
import com.arsdigita.cms.ui.ContentItemPage;
|
||||||
import com.arsdigita.cms.util.LanguageUtil;
|
import com.arsdigita.cms.util.LanguageUtil;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
|
@ -58,16 +58,17 @@ import com.arsdigita.web.Web;
|
||||||
* Created Mon Jan 20 14:30:03 2003.
|
* Created Mon Jan 20 14:30:03 2003.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:mhanisch@redhat.com">Michael Hanisch</a>
|
* @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
|
private static final Logger s_log = Logger.getLogger
|
||||||
(MultilingualDocumentResolver.class);
|
(MultilingualDocumentResolver.class);
|
||||||
|
|
||||||
private static MasterPage s_masterP = null;
|
private static MasterPage s_masterP = null;
|
||||||
private static final String ADMIN_PREFIX = "admin";
|
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
|
* 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.
|
// will have deal with 'foo' folder.
|
||||||
|
|
||||||
String name = index > 0 ? url.substring(0, index) : "";
|
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) : "";
|
url = index + 1 < len ? url.substring(index + 1) : "";
|
||||||
|
|
||||||
return getItemFromLiveURL(url, parentFolder);
|
return getItemFromLiveURL(url, parentFolder);
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@ import org.apache.log4j.Logger;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.Folder;
|
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.Domain;
|
||||||
import com.arsdigita.london.terms.Term;
|
import com.arsdigita.london.terms.Term;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
|
|
@ -54,21 +52,11 @@ public class TermItemBuilder {
|
||||||
|
|
||||||
Term term = m_domain.getTerm(id);
|
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;
|
ContentSection section = null;
|
||||||
section = ContentSection.getSectionFromNode(node);
|
section = ContentSection.getSectionForPath(path);
|
||||||
|
|
||||||
String[] bits = StringUtils.split(
|
String[] bits = StringUtils.split(
|
||||||
path.substring(node.getURL().length(),
|
path.substring(section.getURL().length(),
|
||||||
path.length()),
|
path.length()),
|
||||||
'/');
|
'/');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,11 @@
|
||||||
<servlet-class>com.arsdigita.cms.ContentSectionServlet</servlet-class>
|
<servlet-class>com.arsdigita.cms.ContentSectionServlet</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>cms-service</servlet-name>
|
||||||
|
<servlet-class>com.arsdigita.cms.ServiceServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>content-type-xsl</servlet-name>
|
<servlet-name>content-type-xsl</servlet-name>
|
||||||
<servlet-class>com.arsdigita.cms.dispatcher.ContentTypeXSLServlet</servlet-class>
|
<servlet-class>com.arsdigita.cms.dispatcher.ContentTypeXSLServlet</servlet-class>
|
||||||
|
|
@ -178,7 +183,6 @@
|
||||||
<servlet-class>com.arsdigita.cms.dispatcher.TemplateXSLServlet</servlet-class>
|
<servlet-class>com.arsdigita.cms.dispatcher.TemplateXSLServlet</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>TextOnlyServlet</servlet-name>
|
<servlet-name>TextOnlyServlet</servlet-name>
|
||||||
<display-name>Text Only Servlet</display-name>
|
<display-name>Text Only Servlet</display-name>
|
||||||
|
|
@ -501,6 +505,11 @@
|
||||||
<url-pattern>/themes/servlet/content-section/*</url-pattern>
|
<url-pattern>/themes/servlet/content-section/*</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>cms-service</servlet-name>
|
||||||
|
<url-pattern>/templates/servlet/cms-service/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>content-item-xsl</servlet-name>
|
<servlet-name>content-item-xsl</servlet-name>
|
||||||
<url-pattern>/templates/servlet/content-item/*</url-pattern>
|
<url-pattern>/templates/servlet/content-item/*</url-pattern>
|
||||||
|
|
|
||||||
|
|
@ -101,21 +101,31 @@ public class Survey extends ACSObject {
|
||||||
return survey;
|
return survey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SurveyCollection retrieveByPackage(PackageInstance pack) {
|
/**
|
||||||
DataCollection surveys =
|
* Retrieves a SurveyCollection of all Surveys ever created, sorted by
|
||||||
SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
|
* its start date.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static SurveyCollection retrieveAll() {
|
||||||
|
|
||||||
/*
|
DataCollection surveys = SessionManager.getSession()
|
||||||
|
.retrieve(BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
||||||
|
/*
|
||||||
surveys.addEqualsFilter(PACKAGE_INSTANCE + "." + ACSObject.ID,
|
surveys.addEqualsFilter(PACKAGE_INSTANCE + "." + ACSObject.ID,
|
||||||
pack.getID());
|
pack.getID());
|
||||||
*/
|
*/
|
||||||
surveys.addOrder(START_DATE);
|
surveys.addOrder(START_DATE);
|
||||||
|
return new SurveyCollection(surveys);
|
||||||
return new SurveyCollection(surveys);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public ResponseCollection getResponses() {
|
public ResponseCollection getResponses() {
|
||||||
return Response.retrieveBySurvey(this);
|
return Response.retrieveBySurvey(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseCollection getUserResponses(User user) {
|
public ResponseCollection getUserResponses(User user) {
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,12 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.SimpleContainer;
|
import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.bebop.event.PrintListener;
|
import com.arsdigita.bebop.event.PrintListener;
|
||||||
import com.arsdigita.bebop.event.PrintEvent;
|
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.UI;
|
||||||
import com.arsdigita.ui.login.UserAuthenticationListener;
|
import com.arsdigita.ui.login.UserAuthenticationListener;
|
||||||
|
|
||||||
|
import com.arsdigita.web.Application;
|
||||||
|
import com.arsdigita.web.Web;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -109,16 +111,24 @@ public abstract class SimpleSurveyPanel extends SimpleContainer {
|
||||||
|
|
||||||
public abstract String getRelativeURL();
|
public abstract String getRelativeURL();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static String getSubsiteURL(HttpServletRequest request) {
|
public static String getSubsiteURL(HttpServletRequest request) {
|
||||||
|
|
||||||
// Get the SiteNode from the request URI
|
// Get the SiteNode from the request URI
|
||||||
SiteNode siteNode;
|
// SiteNode siteNode;
|
||||||
try {
|
// try {
|
||||||
siteNode = SiteNode.getSiteNode(request.getRequestURI(), true);
|
// siteNode = SiteNode.getSiteNode(request.getRequestURI(), true);
|
||||||
} catch (com.arsdigita.domain.DataObjectNotFoundException e) {
|
// } catch (com.arsdigita.domain.DataObjectNotFoundException e) {
|
||||||
throw new com.arsdigita.util.UncheckedWrapperException(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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import java.util.Date;
|
||||||
|
|
||||||
import com.arsdigita.persistence.Filter;
|
import com.arsdigita.persistence.Filter;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.kernel.PackageInstance;
|
|
||||||
import com.arsdigita.bebop.Table;
|
import com.arsdigita.bebop.Table;
|
||||||
import com.arsdigita.bebop.table.TableModelBuilder;
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
import com.arsdigita.bebop.table.TableModel;
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
|
|
@ -37,8 +36,6 @@ import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
import com.arsdigita.formbuilder.PersistentForm;
|
import com.arsdigita.formbuilder.PersistentForm;
|
||||||
|
|
||||||
import com.arsdigita.simplesurvey.SimpleSurveyUtil;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
|
|
||||||
import com.arsdigita.simplesurvey.Survey;
|
import com.arsdigita.simplesurvey.Survey;
|
||||||
|
|
@ -74,28 +71,27 @@ public class SurveyTable extends Table {
|
||||||
private static class SurveyTableModelBuilder extends LockableImpl
|
private static class SurveyTableModelBuilder extends LockableImpl
|
||||||
implements TableModelBuilder {
|
implements TableModelBuilder {
|
||||||
|
|
||||||
private Class m_surveyClass;
|
private Class m_surveyClass;
|
||||||
|
|
||||||
public SurveyTableModelBuilder(Class surveyClass) {
|
public SurveyTableModelBuilder(Class surveyClass) {
|
||||||
m_surveyClass = surveyClass;
|
m_surveyClass = surveyClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TableModel makeModel(Table l, PageState pageState) {
|
public TableModel makeModel(Table l, PageState pageState) {
|
||||||
PackageInstance pack = SimpleSurveyUtil.getPackageInstance(pageState);
|
|
||||||
SurveyCollection surveys =
|
|
||||||
Survey.retrieveByPackage(pack);
|
|
||||||
|
|
||||||
surveys.addEqualsFilter(ACSObject.DEFAULT_DOMAIN_CLASS,
|
SurveyCollection surveys = Survey.retrieveAll();
|
||||||
m_surveyClass.getName());
|
|
||||||
|
|
||||||
Date currentDate = new Date();
|
surveys.addEqualsFilter(ACSObject.DEFAULT_DOMAIN_CLASS,
|
||||||
Filter startFilter = surveys.addFilter("startDate < :startDate");
|
m_surveyClass.getName());
|
||||||
startFilter.set("startDate", currentDate);
|
|
||||||
Filter endFilter = surveys.addFilter("endDate > :endDate");
|
|
||||||
endFilter.set("endDate", currentDate);
|
|
||||||
|
|
||||||
return new AdminSurveyTableModel(surveys);
|
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 {
|
private class SurveyCellRenderer implements TableCellRenderer {
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ public class AdminSurveyTable extends Table {
|
||||||
public TableModel makeModel(Table l, PageState pageState) {
|
public TableModel makeModel(Table l, PageState pageState) {
|
||||||
PackageInstance pack = SimpleSurveyUtil.getPackageInstance(pageState);
|
PackageInstance pack = SimpleSurveyUtil.getPackageInstance(pageState);
|
||||||
SurveyCollection surveys =
|
SurveyCollection surveys =
|
||||||
Survey.retrieveByPackage(pack);
|
Survey.retrieveAll();
|
||||||
|
|
||||||
surveys.addEqualsFilter(ACSObject.DEFAULT_DOMAIN_CLASS,
|
surveys.addEqualsFilter(ACSObject.DEFAULT_DOMAIN_CLASS,
|
||||||
m_surveyClass.getName());
|
m_surveyClass.getName());
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,9 @@ import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.categorization.CategoryCollection;
|
import com.arsdigita.categorization.CategoryCollection;
|
||||||
import com.arsdigita.cms.ContentBundle;
|
import com.arsdigita.cms.ContentBundle;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
import com.arsdigita.cms.ContentSectionServlet;
|
||||||
import com.arsdigita.cms.SecurityManager;
|
import com.arsdigita.cms.SecurityManager;
|
||||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||||
import com.arsdigita.cms.dispatcher.ContentSectionDispatcher;
|
|
||||||
import com.arsdigita.cms.lifecycle.Lifecycle;
|
import com.arsdigita.cms.lifecycle.Lifecycle;
|
||||||
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
||||||
import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection;
|
import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection;
|
||||||
|
|
@ -233,7 +233,8 @@ public class WebpageCMSEditorPage extends CMSPage implements WebpageConstants {
|
||||||
s_log.debug("init");
|
s_log.debug("init");
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
HttpServletRequest request = state.getRequest();
|
HttpServletRequest request = state.getRequest();
|
||||||
ContentSection section = ContentSectionDispatcher.getContentSection(request);
|
// ContentSection section = ContentSectionDispatcher.getContentSection(request);
|
||||||
|
ContentSection section = ContentSectionServlet.getContentSection(request);
|
||||||
|
|
||||||
Webpage webpage = null;
|
Webpage webpage = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -344,7 +345,8 @@ public class WebpageCMSEditorPage extends CMSPage implements WebpageConstants {
|
||||||
s_log.debug("process");
|
s_log.debug("process");
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
HttpServletRequest request = state.getRequest();
|
HttpServletRequest request = state.getRequest();
|
||||||
ContentSection section = ContentSectionDispatcher.getContentSection(request);
|
// ContentSection section = ContentSectionDispatcher.getContentSection(request);
|
||||||
|
ContentSection section = ContentSectionServlet.getContentSection(request);
|
||||||
|
|
||||||
if (m_save.isSelected(state)) {
|
if (m_save.isSelected(state)) {
|
||||||
Webpage webpage = null;
|
Webpage webpage = null;
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
import com.arsdigita.cms.ContentSectionServlet;
|
||||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||||
import com.arsdigita.cms.dispatcher.ContentItemDispatcher;
|
import com.arsdigita.cms.dispatcher.ContentItemDispatcher;
|
||||||
import com.arsdigita.cms.dispatcher.ContentSectionDispatcher;
|
|
||||||
import com.arsdigita.cms.dispatcher.XMLGenerator;
|
import com.arsdigita.cms.dispatcher.XMLGenerator;
|
||||||
//import com.arsdigita.cms.ui.ContentSectionComponent;
|
//import com.arsdigita.cms.ui.ContentSectionComponent;
|
||||||
import com.arsdigita.cms.webpage.Webpage;
|
import com.arsdigita.cms.webpage.Webpage;
|
||||||
|
|
@ -49,13 +49,14 @@ public class WebpagePreviewPage extends CMSPage {
|
||||||
|
|
||||||
protected XMLGenerator getXMLGenerator(PageState ps) {
|
protected XMLGenerator getXMLGenerator(PageState ps) {
|
||||||
HttpServletRequest request = ps.getRequest();
|
HttpServletRequest request = ps.getRequest();
|
||||||
ContentSection section = ContentSectionDispatcher.getContentSection(request);
|
// ContentSection section = ContentSectionDispatcher.getContentSection(request);
|
||||||
|
ContentSection section = ContentSectionServlet.getContentSection(request);
|
||||||
Assert.exists(section, ContentSection.class);
|
Assert.exists(section, ContentSection.class);
|
||||||
return section.getXMLGenerator();
|
return section.getXMLGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentItem getContentItem(HttpServletRequest request) {
|
public ContentItem getContentItem(HttpServletRequest request) {
|
||||||
ContentSection section = ContentSectionDispatcher.getContentSection(request);
|
ContentSection section = ContentSectionServlet.getContentSection(request);
|
||||||
|
|
||||||
Webpage webpage = null;
|
Webpage webpage = null;
|
||||||
ContentItem item = ContentItemDispatcher.getContentItem(request);
|
ContentItem item = ContentItemDispatcher.getContentItem(request);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue