incorporate several APLAWS patches for ccm-cms:

r1710:	CONTENT_ITEM constant is now public, so ajax components can set up the context.
r1711:	Upgraded web/assets/prototype.js to 1.6.0 from http://www.prototypejs.org/ 
r1729:	Added canPublish and canEdit attributes similar to normal content output.
r1731:	Content item portlet now checks read permissions.



git-svn-id: https://svn.libreccm.org/ccm/trunk@61 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2008-12-20 21:02:43 +00:00
parent 3521640c08
commit 830a4cc875
4 changed files with 3629 additions and 1193 deletions

View File

@ -45,7 +45,7 @@ public class ContentSectionDispatcher implements Dispatcher {
public static final String versionId = "$Id: ContentSectionDispatcher.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $";
static final String CONTENT_ITEM = "com.arsdigita.cms.dispatcher.item";
public static final String CONTENT_ITEM = "com.arsdigita.cms.dispatcher.item";
static final String CONTENT_SECTION = "com.arsdigita.cms.dispatcher.section";

View File

@ -15,63 +15,64 @@ init com.arsdigita.cms.installer.xml.ContentTypeInitializer {
};
}
init com.arsdigita.cms.publishToFile.Initializer {
// List of publish destinations for content types
// Each element is a four-element list in the format
// '{ "content type", "root directory", "shared storage",
// "url stub" }'.
// "Content type" is the object type of the content type.
// "Root directory" must be a path to a writable directory, relative
// to the file-system root. "Shared storage" must be _true_ if the root
// directory is shared NFS storage, _false_ otherwise. "URL stub"
// must be the path component of the URL from which the live server
// will serve from this directory.
destination = {
{ "com.arsdigita.cms.ContentItem",
"data/p2fs",
false,
"/p2fs" },
{ "com.arsdigita.cms.Template",
"webapps/ROOT/packages/content-section/templates",
false,
"/templates" }
};
// Class which implements PublishToFileListener used to perform
// additional actions when publishing or unpublishing to the file system.
publishListener = "com.arsdigita.cms.publishToFile.PublishToFile";
// Queue management parameters.
// Set startupDelay to 0 to disable the processing of the queue
// Time (seconds) before starting to monitor the
// queue after a server start
startupDelay = 30;
// Time (in seconds) between checking if there are entries in the
// publishToFile queue.
// A value <= 0 disables processing the queue on this server.
pollDelay = 5;
// Time to wait (seconds) before retrying
// to process a failed entry
retryDelay = 120;
// Number of queue entries to process at once.
blockSize = 40;
// Number of times a failed queue entry will be
// reprocessed. If processing has failed more than
// that number of times, the entry will be
// ignored.
maximumFailCount = 10;
// Method used to select entries for processing.
// 'QueuedOrder'-in queued order.
// 'GroupByParent'-group entries according to parent when selecting items
// (allows optimizations if a listener task required for all elements in a folder
// can be done only once for the folder).
blockSelectMethod = "GroupByParent";
}
// Test: temporarly deactivate publishToFile
// init com.arsdigita.cms.publishToFile.Initializer {
// // List of publish destinations for content types
// // Each element is a four-element list in the format
// // '{ "content type", "root directory", "shared storage",
// // "url stub" }'.
// // "Content type" is the object type of the content type.
// // "Root directory" must be a path to a writable directory, relative
// // to the file-system root. "Shared storage" must be _true_ if the root
// // directory is shared NFS storage, _false_ otherwise. "URL stub"
// // must be the path component of the URL from which the live server
// // will serve from this directory.
// destination = {
// { "com.arsdigita.cms.ContentItem",
// "data/p2fs",
// false,
// "/p2fs" },
// { "com.arsdigita.cms.Template",
// "webapps/ROOT/packages/content-section/templates",
// false,
// "/templates" }
// };
//
// // Class which implements PublishToFileListener used to perform
// // additional actions when publishing or unpublishing to the file system.
// publishListener = "com.arsdigita.cms.publishToFile.PublishToFile";
//
// // Queue management parameters.
//
// // Set startupDelay to 0 to disable the processing of the queue
// // Time (seconds) before starting to monitor the
// // queue after a server start
// startupDelay = 30;
//
// // Time (in seconds) between checking if there are entries in the
// // publishToFile queue.
// // A value <= 0 disables processing the queue on this server.
// pollDelay = 5;
//
// // Time to wait (seconds) before retrying
// // to process a failed entry
// retryDelay = 120;
//
// // Number of queue entries to process at once.
// blockSize = 40;
// // Number of times a failed queue entry will be
// // reprocessed. If processing has failed more than
// // that number of times, the entry will be
// // ignored.
// maximumFailCount = 10;
//
// // Method used to select entries for processing.
// // 'QueuedOrder'-in queued order.
// // 'GroupByParent'-group entries according to parent when selecting items
// // (allows optimizations if a listener task required for all elements in a folder
// // can be done only once for the folder).
// blockSelectMethod = "GroupByParent";
// }
init com.arsdigita.cms.installer.SectionInitializer {

View File

@ -22,9 +22,18 @@ import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
import com.arsdigita.cms.portlet.ContentItemPortlet;
import com.arsdigita.dispatcher.AccessDeniedException;
import com.arsdigita.domain.DomainObjectXMLRenderer;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.permissions.PermissionDescriptor;
import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.web.LoginSignal;
import com.arsdigita.web.Web;
import com.arsdigita.xml.Element;
@ -42,8 +51,31 @@ public class ContentItemPortletRenderer extends AbstractPortletRenderer {
Element parent) {
Element content = parent.newChildElement("portlet:contentItem",
"http://www.arsdigita.com/portlet/1.0");
ContentItem item = m_portlet.getContentItem();
Party currentParty = Kernel.getContext().getParty();
if (currentParty == null) {
currentParty = Kernel.getPublicUser();
}
PermissionDescriptor read = new PermissionDescriptor(PrivilegeDescriptor.get(SecurityManager.CMS_READ_ITEM), item, currentParty);
if (!PermissionService.checkPermission(read)) {
if (Web.getUserContext().isLoggedIn()) {
throw new AccessDeniedException("User does cannot read content item " + item.getName());
}
throw new LoginSignal(Web.getRequest());
}
PermissionDescriptor edit = new PermissionDescriptor(PrivilegeDescriptor.get(SecurityManager.CMS_EDIT_ITEM), item, currentParty);
if (PermissionService.checkPermission(edit)) {
content.addAttribute("canEdit", "true");
}
PermissionDescriptor publish = new PermissionDescriptor(PrivilegeDescriptor.get(SecurityManager.CMS_PUBLISH), item, currentParty);
if (PermissionService.checkPermission(publish)) {
content.addAttribute("canPublish", "true");
}
if( null == item ) {
s_log.warn( "No content item for content item portlet " +
m_portlet.getOID() );

File diff suppressed because it is too large Load Diff