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 $"; 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"; 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 { // Test: temporarly deactivate publishToFile
// List of publish destinations for content types // init com.arsdigita.cms.publishToFile.Initializer {
// Each element is a four-element list in the format // // List of publish destinations for content types
// '{ "content type", "root directory", "shared storage", // // Each element is a four-element list in the format
// "url stub" }'. // // '{ "content type", "root directory", "shared storage",
// "Content type" is the object type of the content type. // // "url stub" }'.
// "Root directory" must be a path to a writable directory, relative // // "Content type" is the object type of the content type.
// to the file-system root. "Shared storage" must be _true_ if the root // // "Root directory" must be a path to a writable directory, relative
// directory is shared NFS storage, _false_ otherwise. "URL stub" // // to the file-system root. "Shared storage" must be _true_ if the root
// must be the path component of the URL from which the live server // // directory is shared NFS storage, _false_ otherwise. "URL stub"
// will serve from this directory. // // must be the path component of the URL from which the live server
destination = { // // will serve from this directory.
{ "com.arsdigita.cms.ContentItem", // destination = {
"data/p2fs", // { "com.arsdigita.cms.ContentItem",
false, // "data/p2fs",
"/p2fs" }, // false,
{ "com.arsdigita.cms.Template", // "/p2fs" },
"webapps/ROOT/packages/content-section/templates", // { "com.arsdigita.cms.Template",
false, // "webapps/ROOT/packages/content-section/templates",
"/templates" } // false,
}; // "/templates" }
// };
// Class which implements PublishToFileListener used to perform //
// additional actions when publishing or unpublishing to the file system. // // Class which implements PublishToFileListener used to perform
publishListener = "com.arsdigita.cms.publishToFile.PublishToFile"; // // additional actions when publishing or unpublishing to the file system.
// publishListener = "com.arsdigita.cms.publishToFile.PublishToFile";
// Queue management parameters. //
// // Queue management parameters.
// Set startupDelay to 0 to disable the processing of the queue //
// Time (seconds) before starting to monitor the // // Set startupDelay to 0 to disable the processing of the queue
// queue after a server start // // Time (seconds) before starting to monitor the
startupDelay = 30; // // queue after a server start
// startupDelay = 30;
// Time (in seconds) between checking if there are entries in the //
// publishToFile queue. // // Time (in seconds) between checking if there are entries in the
// A value <= 0 disables processing the queue on this server. // // publishToFile queue.
pollDelay = 5; // // A value <= 0 disables processing the queue on this server.
// pollDelay = 5;
// Time to wait (seconds) before retrying //
// to process a failed entry // // Time to wait (seconds) before retrying
retryDelay = 120; // // to process a failed entry
// retryDelay = 120;
// Number of queue entries to process at once. //
blockSize = 40; // // Number of queue entries to process at once.
// Number of times a failed queue entry will be // blockSize = 40;
// reprocessed. If processing has failed more than // // Number of times a failed queue entry will be
// that number of times, the entry will be // // reprocessed. If processing has failed more than
// ignored. // // that number of times, the entry will be
maximumFailCount = 10; // // ignored.
// maximumFailCount = 10;
// Method used to select entries for processing. //
// 'QueuedOrder'-in queued order. // // Method used to select entries for processing.
// 'GroupByParent'-group entries according to parent when selecting items // // 'QueuedOrder'-in queued order.
// (allows optimizations if a listener task required for all elements in a folder // // 'GroupByParent'-group entries according to parent when selecting items
// can be done only once for the folder). // // (allows optimizations if a listener task required for all elements in a folder
blockSelectMethod = "GroupByParent"; // // can be done only once for the folder).
} // blockSelectMethod = "GroupByParent";
// }
init com.arsdigita.cms.installer.SectionInitializer { 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.bebop.portal.AbstractPortletRenderer;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator; import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
import com.arsdigita.cms.portlet.ContentItemPortlet; import com.arsdigita.cms.portlet.ContentItemPortlet;
import com.arsdigita.dispatcher.AccessDeniedException;
import com.arsdigita.domain.DomainObjectXMLRenderer; 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; import com.arsdigita.xml.Element;
@ -44,6 +53,29 @@ public class ContentItemPortletRenderer extends AbstractPortletRenderer {
"http://www.arsdigita.com/portlet/1.0"); "http://www.arsdigita.com/portlet/1.0");
ContentItem item = m_portlet.getContentItem(); 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 ) { if( null == item ) {
s_log.warn( "No content item for content item portlet " + s_log.warn( "No content item for content item portlet " +
m_portlet.getOID() ); m_portlet.getOID() );

File diff suppressed because it is too large Load Diff