Verschiedene Formatierungen und Dokumentationsergänzungen.
git-svn-id: https://svn.libreccm.org/ccm/trunk@542 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
5424b1ea64
commit
1804c32331
|
|
@ -115,7 +115,10 @@ public class PrivilegeDescriptor {
|
|||
priv.set("privilege", name);
|
||||
priv.save();
|
||||
addChildPrivilege(ADMIN_NAME, name);
|
||||
PrivilegeDescriptor desc = new PrivilegeDescriptor(name);
|
||||
// Constructor PrivilegeDescriptor is deprecated and should be
|
||||
// replace the class method get(name)
|
||||
// PrivilegeDescriptor desc = new PrivilegeDescriptor(name);
|
||||
PrivilegeDescriptor desc = get(name);
|
||||
put(desc);
|
||||
return desc;
|
||||
}
|
||||
|
|
@ -145,7 +148,6 @@ public class PrivilegeDescriptor {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Given a privilege name, returns a privilege descriptor or null
|
||||
* if the privilege does not exist on the system.
|
||||
*
|
||||
|
|
@ -159,19 +161,17 @@ public class PrivilegeDescriptor {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns a collection of privilege descriptors for every privilege in
|
||||
* the system.
|
||||
* @return a collection of privilege descriptors.
|
||||
*
|
||||
* @see #get(String)
|
||||
*
|
||||
* @return a collection of privilege descriptors.
|
||||
*/
|
||||
public static Collection getAll() {
|
||||
return s_privs.values();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Deletes the privilege described by this from the system.
|
||||
*
|
||||
* @exception PersistenceException when there is a persistence
|
||||
|
|
@ -185,9 +185,9 @@ public class PrivilegeDescriptor {
|
|||
OID oid = new OID("com.arsdigita.kernel.permissions.Privilege",
|
||||
m_name);
|
||||
|
||||
DataObject priv = SessionManager.getSession()
|
||||
.retrieve(oid);
|
||||
DataObject priv = SessionManager.getSession().retrieve(oid);
|
||||
priv.delete();
|
||||
|
||||
s_privs.remove(m_name);
|
||||
}
|
||||
|
||||
|
|
@ -201,14 +201,11 @@ public class PrivilegeDescriptor {
|
|||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
*
|
||||
* Returns the display name for the privilege, or just the
|
||||
* privilege name if no display name is defined.
|
||||
*
|
||||
* @return the display name
|
||||
*/
|
||||
|
||||
public String getDisplayName() {
|
||||
if (m_displayName != null) {
|
||||
return m_displayName;
|
||||
|
|
@ -261,8 +258,8 @@ public class PrivilegeDescriptor {
|
|||
* Create a new privilege descriptor for use with PermissionDescriptor
|
||||
* and PermissionService.
|
||||
*
|
||||
* @deprecated see #get
|
||||
* @param name The name of the privilege.
|
||||
* @deprecated see #get
|
||||
**/
|
||||
public PrivilegeDescriptor(String name) {
|
||||
m_name = name;
|
||||
|
|
@ -281,9 +278,8 @@ public class PrivilegeDescriptor {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Puts a privilege descriptor into the internal cache that is
|
||||
* used by the get method. The put method supports extendibility by allowing
|
||||
* Puts a privilege descriptor into the internal cache that is used by
|
||||
* the get method. The put method supports extendibility by allowing
|
||||
* subclasses to be returned by the get method.
|
||||
*/
|
||||
protected static void put(PrivilegeDescriptor privDesc) {
|
||||
|
|
@ -291,7 +287,6 @@ public class PrivilegeDescriptor {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the list of privilege names that imply this privilege.
|
||||
* @return a collection of the privilege names that imply this privilege.
|
||||
*/
|
||||
|
|
@ -349,5 +344,4 @@ public class PrivilegeDescriptor {
|
|||
privs.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,13 @@ public class Application extends Resource {
|
|||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Application instance encapsulating the given data object.
|
||||
* @see com.arsdigita.persistence.Session#retrieve(String)
|
||||
*
|
||||
* @param dataObject The data object to encapsulate in the Forum instance
|
||||
* (new domain object).
|
||||
*/
|
||||
protected Application(DataObject dataObject) {
|
||||
super(dataObject);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ import com.arsdigita.web.Application;
|
|||
/**
|
||||
* Main domain class of a forum application representing a discussion forum.
|
||||
*
|
||||
* It manages creation of new forum instances and provides getters and setters
|
||||
* for instance specific configuration options.
|
||||
*
|
||||
* XXX: Forum knows about <i>threads</i> which groups a set of posts to the same
|
||||
* subject, and <i>topics</i> which group a set of threads about the same general
|
||||
* theme. Currently Forum uses <i>catgegory</i> as synonym for topic, which may be
|
||||
|
|
@ -63,7 +66,6 @@ import com.arsdigita.web.Application;
|
|||
* @version $Revision: 1.7 $
|
||||
* @version $Id: Forum.java 1628 2007-09-17 08:10:40Z chrisg23 $
|
||||
*/
|
||||
|
||||
public class Forum extends Application {
|
||||
|
||||
/** Private logger instance for debugging purpose */
|
||||
|
|
@ -135,21 +137,48 @@ public class Forum extends Application {
|
|||
private static final String ANONYMOUS_POSTS = "anonymousPostsAllowed";
|
||||
|
||||
/**
|
||||
* Creates a new Forum instance encapsulating the given data object.
|
||||
* @see com.arsdigita.persistence.Session#retrieve(String)
|
||||
*
|
||||
* @param data
|
||||
* @param data The data object to encapsulate in the Forum instance
|
||||
* (new domain object).
|
||||
*/
|
||||
public Forum(DataObject data) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* The contained <code>DataObject</code> is retrieved from the
|
||||
* persistent storage mechanism with an OID specified by <i>oid</i>.
|
||||
*
|
||||
* @param oid The <code>OID</code> for the retrieved
|
||||
* <code>DataObject</code>.
|
||||
*
|
||||
* @exception DataObjectNotFoundException Thrown if we cannot
|
||||
* retrieve a data object for the specified OID
|
||||
*/
|
||||
public Forum(OID oid) throws DataObjectNotFoundException {
|
||||
super(oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a Forum instance (its contained DataObject) based on its
|
||||
* internal id which is used to search for the OID.
|
||||
*
|
||||
* @param id
|
||||
* @throws DataObjectNotFoundException
|
||||
*/
|
||||
public Forum(BigDecimal id) throws DataObjectNotFoundException {
|
||||
super(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param urlName of the forum to be created
|
||||
* @param title of forum to be created
|
||||
* @param parent object of forum to be created
|
||||
* @return
|
||||
*/
|
||||
public static Forum create(String urlName, String title,
|
||||
Application parent) {
|
||||
return create(urlName, title, parent, false);
|
||||
|
|
@ -159,8 +188,8 @@ public class Forum extends Application {
|
|||
* This method should be used to create a new Forum object everywhere
|
||||
* except in the constructor of a subclass of Forum.
|
||||
* This will by default create a new Category which will be the root
|
||||
* category for the Forum in the event that the Forum should be
|
||||
* categorized.
|
||||
* category for the Forum in the event that the Forum should be categorized.
|
||||
*
|
||||
* This also sets up instant and daily subscriptions on the Forum.
|
||||
* The default for moderation is false.
|
||||
*
|
||||
|
|
@ -170,8 +199,10 @@ public class Forum extends Application {
|
|||
public static Forum create(String urlName, String title,
|
||||
Application parent, boolean moderated) {
|
||||
s_log.debug("creating forum " + title);
|
||||
Forum forum = (Forum) Application.createApplication
|
||||
(BASE_DATA_OBJECT_TYPE, urlName, title, parent, true);
|
||||
|
||||
Forum forum = (Forum) Application.createApplication(BASE_DATA_OBJECT_TYPE,
|
||||
urlName,
|
||||
title, parent, true);
|
||||
|
||||
forum.setModerated(moderated);
|
||||
// default settings ensure legacy forum users do not
|
||||
|
|
@ -217,10 +248,8 @@ public class Forum extends Application {
|
|||
/**
|
||||
* @return introduction
|
||||
*/
|
||||
|
||||
public String getIntroduction() {
|
||||
return (String) get(INTRODUCTION);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -239,6 +268,7 @@ public class Forum extends Application {
|
|||
*
|
||||
*/
|
||||
private void createGroups() {
|
||||
|
||||
Group administrators = new Group();
|
||||
administrators.setName(getTitle() + " Administrators");
|
||||
setAssociation(ADMIN_GROUP, administrators);
|
||||
|
|
@ -259,9 +289,9 @@ public class Forum extends Application {
|
|||
moderators.setPrimaryEmail(new EmailAddress(email));
|
||||
|
||||
// chris.gilbert@westsussex.gov.uk create additional groups for privilege
|
||||
// assignment - could have assigned privileges directly without having associated
|
||||
// groups, but this reduces rows in the (already enormous) dnm_permissions
|
||||
// table
|
||||
// assignment - could have assigned privileges directly without having
|
||||
// associated groups, but this reduces rows in the (already enormous)
|
||||
// dnm_permissions table
|
||||
Group threadCreators = new Group();
|
||||
threadCreators.setName(getTitle() + " Thread Creators");
|
||||
setAssociation(THREAD_CREATE_GROUP, threadCreators);
|
||||
|
|
@ -274,7 +304,8 @@ public class Forum extends Application {
|
|||
forumReaders.setName(getTitle() + " Readers");
|
||||
setAssociation(READ_GROUP, forumReaders);
|
||||
|
||||
Group container = getGroup();
|
||||
Group container = getGroup(); // Application.getGroup(): get group
|
||||
// associated with this application
|
||||
|
||||
container.addSubgroup(administrators);
|
||||
container.addSubgroup(moderators);
|
||||
|
|
@ -286,8 +317,6 @@ public class Forum extends Application {
|
|||
container.addSubgroup(threadSubscriptions);
|
||||
container.save();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -315,28 +344,32 @@ public class Forum extends Application {
|
|||
super.beforeSave();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void afterSave() {
|
||||
|
||||
if (m_wasNew) {
|
||||
PermissionService.setContext(getRootCategory(), this);
|
||||
createGroups();
|
||||
if (getAdminGroup() != null) {
|
||||
PermissionService.grantPermission(
|
||||
new PermissionDescriptor(
|
||||
PermissionService.grantPermission( new PermissionDescriptor(
|
||||
PrivilegeDescriptor.ADMIN,
|
||||
this,
|
||||
getAdminGroup()));
|
||||
s_log.debug(
|
||||
"Current user : "
|
||||
s_log.debug("Current user : "
|
||||
+ Kernel.getContext().getParty().getPrimaryEmail()
|
||||
+ " class is "
|
||||
+ Kernel.getContext().getParty().getClass());
|
||||
|
||||
//
|
||||
// chris.gilbert@westsussex.gov.uk Original plan was that creator of forum
|
||||
// is administrator by default, but party from Kernel at this point in code is
|
||||
// acs-system-party - creation must happen in a KernelExcersion somewhere
|
||||
// though I can't immediately see where.
|
||||
// as a consequence, code below justs causes a classcast exception,
|
||||
// chris.gilbert@westsussex.gov.uk Original plan was that
|
||||
// creator of forum is administrator by default,
|
||||
// but party from Kernel at this point in code is
|
||||
// acs-system-party - creation must happen in a KernelExcersion
|
||||
// somewhere though I can't immediately see where.
|
||||
// As a consequence, code below justs causes a classcast exception,
|
||||
//
|
||||
// revisit, but in meantime, only site admin can administer new forum
|
||||
// until forum admin permissions set in UI
|
||||
|
|
@ -346,20 +379,23 @@ public class Forum extends Application {
|
|||
// if (creator != null) {
|
||||
// getAdminGroup().addMember(creator);
|
||||
// }
|
||||
///
|
||||
//
|
||||
}
|
||||
|
||||
if (getModerationGroup() != null ) {
|
||||
PermissionService.grantPermission(
|
||||
new PermissionDescriptor(
|
||||
PrivilegeDescriptor.get(FORUM_MODERATION_PRIVILEGE),
|
||||
PrivilegeDescriptor.get(
|
||||
FORUM_MODERATION_PRIVILEGE),
|
||||
this,
|
||||
getModerationGroup()));
|
||||
}
|
||||
|
||||
if (getThreadCreateGroup() != null) {
|
||||
PermissionService.grantPermission(
|
||||
new PermissionDescriptor(
|
||||
PrivilegeDescriptor.get(CREATE_THREAD_PRIVILEGE),
|
||||
PrivilegeDescriptor.get(
|
||||
CREATE_THREAD_PRIVILEGE),
|
||||
this,
|
||||
getThreadCreateGroup()));
|
||||
// chris.gilbert@westsussex.gov.uk
|
||||
|
|
@ -373,7 +409,8 @@ public class Forum extends Application {
|
|||
if (getThreadResponderGroup() != null) {
|
||||
PermissionService.grantPermission(
|
||||
new PermissionDescriptor(
|
||||
PrivilegeDescriptor.get(RESPOND_TO_THREAD_PRIVILEGE),
|
||||
PrivilegeDescriptor.get(
|
||||
RESPOND_TO_THREAD_PRIVILEGE),
|
||||
this,
|
||||
getThreadResponderGroup()));
|
||||
}
|
||||
|
|
@ -385,6 +422,7 @@ public class Forum extends Application {
|
|||
this,
|
||||
getReadGroup()));
|
||||
}
|
||||
|
||||
KernelExcursion excursion = new KernelExcursion() {
|
||||
protected void excurse() {
|
||||
setParty(Kernel.getSystemParty());
|
||||
|
|
@ -404,7 +442,7 @@ public class Forum extends Application {
|
|||
}
|
||||
};
|
||||
excursion.run();
|
||||
}
|
||||
} //if mWasNew
|
||||
|
||||
DataCollection subs = null;
|
||||
try {
|
||||
|
|
@ -426,10 +464,9 @@ public class Forum extends Application {
|
|||
// don't want to inherit permissions of portal,
|
||||
// as public users have 'READ' privilege on this
|
||||
// and so get shown postings in search results.
|
||||
//
|
||||
//
|
||||
// super.afterSave();
|
||||
}
|
||||
|
||||
} //Method afterSave()
|
||||
|
||||
protected String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
|
|
@ -749,6 +786,7 @@ public class Forum extends Application {
|
|||
Assert.exists(dObj, DataObject.class);
|
||||
return (Group) DomainObjectFactory.newInstance(dObj);
|
||||
}
|
||||
|
||||
/** Returns the moderator group. Null if it doesn't exist */
|
||||
public Group getModerationGroup() {
|
||||
DataObject dObj = (DataObject) get( MODERATION_GROUP );
|
||||
|
|
@ -800,16 +838,10 @@ public class Forum extends Application {
|
|||
// have the same expiration policy.
|
||||
DataAssociationCursor posts = getPosts().cursor();
|
||||
while (posts.next()) {
|
||||
Post post =
|
||||
(Post) DomainObjectFactory.newInstance(posts.getDataObject());
|
||||
if (post
|
||||
.getThread()
|
||||
.getRootMessage()
|
||||
.getID()
|
||||
Post post = (Post) DomainObjectFactory.newInstance(posts.getDataObject());
|
||||
if (post.getThread().getRootMessage().getID()
|
||||
.equals(post.getID())) {
|
||||
|
||||
s_log.debug(
|
||||
"Resetting expiration lifecycle for " + post.getOID());
|
||||
s_log.debug("Resetting expiration lifecycle for " + post.getOID());
|
||||
post.setLifecycle(newLife);
|
||||
}
|
||||
}
|
||||
|
|
@ -847,6 +879,7 @@ public class Forum extends Application {
|
|||
PermissionService.grantPermission(
|
||||
new PermissionDescriptor(PrivilegeDescriptor.ADMIN, this, group));
|
||||
}
|
||||
|
||||
/**
|
||||
* method required for upgrade - normally groups are set during
|
||||
* forum creation and so there is no need to invoke a setter
|
||||
|
|
@ -861,6 +894,7 @@ public class Forum extends Application {
|
|||
this,
|
||||
group));
|
||||
}
|
||||
|
||||
/**
|
||||
* method required for upgrade - normally groups are set during forum
|
||||
* creation and so there is no need to invoke a setter
|
||||
|
|
@ -875,6 +909,7 @@ public class Forum extends Application {
|
|||
this,
|
||||
group));
|
||||
}
|
||||
|
||||
/**
|
||||
* method required for upgrade - normally groups are set during forum
|
||||
* creation and so creation and so there is no need to invoke a setter
|
||||
|
|
@ -884,7 +919,8 @@ public class Forum extends Application {
|
|||
public void setReaderGroup(Group group) {
|
||||
setAssociation(READ_GROUP, group);
|
||||
PermissionService.grantPermission(
|
||||
new PermissionDescriptor(PrivilegeDescriptor.READ, this, group));
|
||||
new PermissionDescriptor(
|
||||
PrivilegeDescriptor.READ, this, group));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -936,14 +972,20 @@ public class Forum extends Application {
|
|||
getThreadCreateGroup().setName(title + " Thread Creators");
|
||||
getThreadResponderGroup().setName(title + " Thread Responders");
|
||||
getReadGroup().setName(title + " Readers");
|
||||
|
||||
DataCollection subscriptions = getSubscriptions();
|
||||
while (subscriptions.next()) {
|
||||
ForumSubscription subscription = (ForumSubscription)DomainObjectFactory.newInstance(subscriptions.getDataObject());
|
||||
ForumSubscription
|
||||
subscription = (ForumSubscription)DomainObjectFactory.
|
||||
newInstance(subscriptions.getDataObject());
|
||||
subscription.getGroup().setName(subscription.getGroupName(this));
|
||||
}
|
||||
|
||||
ThreadCollection threads = getThreads();
|
||||
while (threads.next()) {
|
||||
ThreadSubscription threadSub = ThreadSubscription.getThreadSubscription(threads.getMessageThread());
|
||||
ThreadSubscription threadSub = ThreadSubscription.
|
||||
getThreadSubscription(
|
||||
threads.getMessageThread());
|
||||
threadSub.getGroup().setName(threadSub.getSubscriptionGroupName(this));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,11 @@ public class ForumPageBuilder implements PageBuilder, Constants {
|
|||
page.add(forumComp);
|
||||
BigDecimalParameter topic = new BigDecimalParameter(TOPIC_PARAM);
|
||||
page.addGlobalStateParam(topic);
|
||||
// adds primitive READ descriptor, should be FORUM_READ instead in order
|
||||
// to allow forum specific READ access and forums not accessible to
|
||||
// the public, not logged-in user.
|
||||
// PrivilegeDescriptor.get(RESPOND_TO_THREAD_PRIVILEGE)
|
||||
// PrivilegeDescriptor.get(FORUM_READ_PRIVILEGE)
|
||||
page.addRequestListener(
|
||||
new ApplicationAuthenticationListener(PrivilegeDescriptor.READ));
|
||||
page.addRequestListener(new ForumPageRequestListener(topic, forumComp));
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public class Initializer extends CompoundInitializer {
|
|||
}
|
||||
});
|
||||
e.getFactory().registerInstantiator( // OOPS: inbox commented out in
|
||||
"com.arsdigita.forum.Inbox", // Forum loader!
|
||||
"com.arsdigita.forum.Inbox", // Forum loader! see Inbox.pdl
|
||||
new ACSObjectInstantiator() {
|
||||
public DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new Forum(dataObject);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class Loader extends PackageLoader {
|
|||
|
||||
setupPrivileges();
|
||||
setupForumAppType();
|
||||
//setupInboxAppType();
|
||||
//setupInboxAppType(); //TODO: why it is commented out?
|
||||
setupRecentPostingsPortletType();
|
||||
setupMyForumsPortletType();
|
||||
setupDigestUser();
|
||||
|
|
@ -87,7 +87,7 @@ public class Loader extends PackageLoader {
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO: What is it for? Execution is currently commented out.
|
||||
* @return
|
||||
*/
|
||||
private static ApplicationType setupInboxAppType() {
|
||||
|
|
@ -151,7 +151,6 @@ public class Loader extends PackageLoader {
|
|||
users.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -165,7 +164,7 @@ public class Loader extends PackageLoader {
|
|||
Forum.CREATE_THREAD_PRIVILEGE);
|
||||
PrivilegeDescriptor.createPrivilege(
|
||||
Forum.RESPOND_TO_THREAD_PRIVILEGE);
|
||||
|
||||
// Establich privilege hierarchie, eg. moderation includes createThread
|
||||
PrivilegeDescriptor.addChildPrivilege(
|
||||
Forum.FORUM_MODERATION_PRIVILEGE,
|
||||
Forum.CREATE_THREAD_PRIVILEGE);
|
||||
|
|
@ -174,7 +173,7 @@ public class Loader extends PackageLoader {
|
|||
Forum.RESPOND_TO_THREAD_PRIVILEGE);
|
||||
PrivilegeDescriptor.addChildPrivilege(
|
||||
Forum.RESPOND_TO_THREAD_PRIVILEGE,
|
||||
PrivilegeDescriptor.READ.getName());
|
||||
PrivilegeDescriptor.READ.getName()); // general read privilege
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,9 +81,9 @@ import com.arsdigita.util.Assert;
|
|||
* <li> Submitter edits already approved message (notify admin)
|
||||
* status changes to 'reapprove'</li>
|
||||
*
|
||||
* <li> -> Admin moderates, change state to 'approve',
|
||||
*'supressed', or 'rejected' depending on whether they want to hide
|
||||
*the entire thread or just the content of the message.</li>
|
||||
* <li> -> Admin moderates, change state to 'approve','supressed', or
|
||||
* 'rejected' depending on whether they want to hide the entire
|
||||
* thread or just the content of the message.</li>
|
||||
*
|
||||
* <li> -> APPROVED new version of message goes live</li>
|
||||
*
|
||||
|
|
@ -113,7 +113,6 @@ import com.arsdigita.util.Assert;
|
|||
* @author Kevin Scaldeferri (kevin@arsdigita.com)
|
||||
* @author Nobuko Asakai (nasakai@redhat.com)
|
||||
*/
|
||||
|
||||
public class Post extends ThreadedMessage {
|
||||
private static final Logger s_log = Logger.getLogger(Post.class);
|
||||
|
||||
|
|
@ -155,7 +154,6 @@ public class Post extends ThreadedMessage {
|
|||
* The base DomainObject is Post which extends ThreadedMessage. In
|
||||
* other words, all bboard messages are ThreadedMessages.
|
||||
*/
|
||||
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.forum.Post";
|
||||
|
||||
|
|
@ -192,6 +190,10 @@ public class Post extends ThreadedMessage {
|
|||
return post;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
|
@ -229,7 +231,6 @@ public class Post extends ThreadedMessage {
|
|||
* post to the forum. Additionally create a lifecycle if required for a new
|
||||
* root post
|
||||
*/
|
||||
|
||||
protected void afterSave() {
|
||||
super.afterSave();
|
||||
Forum forum = getForum();
|
||||
|
|
@ -238,14 +239,14 @@ public class Post extends ThreadedMessage {
|
|||
|
||||
s_log.info("Setting context for " + getOID() + " to " + root.getOID());
|
||||
PermissionService.setContext(this, root);
|
||||
s_log.info(
|
||||
"Setting context for " + root.getOID() + " to " +
|
||||
s_log.info( "Setting context for " + root.getOID() + " to " +
|
||||
forum.getOID());
|
||||
PermissionService.setContext(root, forum);
|
||||
// originally this was created in beforeSave, but this was when only noticeboard
|
||||
// (reply disabled) forums could have a lifecycle. Now that all forums may
|
||||
// have a lifecycle on root posts, the method needs to be here in order
|
||||
// for persistence to work when users are replying to posts chris.gilbert@westsussex.gov.uk
|
||||
// originally this was created in beforeSave, but this was when only
|
||||
// noticeboard (reply disabled) forums could have a lifecycle. Now that
|
||||
// all forums may have a lifecycle on root posts, the method needs to be
|
||||
// here in order for persistence to work when users are replying to
|
||||
// posts (chris.gilbert@westsussex.gov.uk)
|
||||
|
||||
if (m_wasNew) {
|
||||
if (getRoot() == null && forum.getExpireAfter() > 0) {
|
||||
|
|
@ -271,7 +272,7 @@ public class Post extends ThreadedMessage {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
} // Method afterSave()
|
||||
|
||||
/**
|
||||
* Sends out the notifications for any subscriptions to the forum
|
||||
|
|
@ -322,7 +323,8 @@ public class Post extends ThreadedMessage {
|
|||
subscriptions.getDataObject());
|
||||
s_log.debug("notification to " + subscription.getOID());
|
||||
|
||||
subscription.sendNotification(Post.this, Forum.getConfig().deleteNotifications());
|
||||
subscription.sendNotification(Post.this, Forum.getConfig()
|
||||
.deleteNotifications());
|
||||
}
|
||||
|
||||
s_log.debug("Sending thread level subsriptions");
|
||||
|
|
@ -493,10 +495,10 @@ public class Post extends ThreadedMessage {
|
|||
* on the forum is not cached.
|
||||
*/
|
||||
public boolean canEdit(Party party) {
|
||||
Party author = getFrom();
|
||||
// cg added - for anonymous posts, don't allow editing, else everyone could edit everyone else's posts
|
||||
return (
|
||||
!author.equals(Kernel.getPublicUser())
|
||||
Party author = getFrom(); //determin sender / author of message
|
||||
// cg added - for anonymous posts, don't allow editing, else everyone
|
||||
// could edit everyone else's posts
|
||||
return ( !author.equals(Kernel.getPublicUser())
|
||||
&& Forum.getConfig().canAuthorEditPosts()
|
||||
&& author.equals(party) )
|
||||
|| getForum().canEdit(party);
|
||||
|
|
|
|||
|
|
@ -51,16 +51,19 @@ public class ThreadPageBuilder implements PageBuilder, Constants {
|
|||
* @return
|
||||
*/
|
||||
public Page buildPage() {
|
||||
|
||||
Page threadPage = PageFactory.buildPage(Constants.FORUM_XML_PREFIX,
|
||||
"Threads", "forumThreadPage");
|
||||
//Output the title in an easy to find place
|
||||
threadPage.add(new SimpleComponent(){
|
||||
|
||||
public void generateXML(PageState state, Element parent) {
|
||||
Element nameElement = parent.newChildElement(
|
||||
Constants.FORUM_XML_PREFIX + ":name",
|
||||
Constants.FORUM_XML_NS);
|
||||
nameElement.setText(ForumContext.getContext(state).getForum().
|
||||
getTitle());
|
||||
nameElement.setText(ForumContext.getContext(state)
|
||||
.getForum().getTitle());
|
||||
|
||||
Element introductionElement = parent.newChildElement(
|
||||
Constants.FORUM_XML_PREFIX +
|
||||
":introduction",
|
||||
|
|
@ -72,14 +75,15 @@ public class ThreadPageBuilder implements PageBuilder, Constants {
|
|||
});
|
||||
//
|
||||
threadPage.add(new DiscussionThreadSimpleView());
|
||||
|
||||
// Register the thread id parameter as a global state parameter.
|
||||
BigDecimalParameter threadID = new BigDecimalParameter(THREAD_PARAM);
|
||||
threadPage.addGlobalStateParam(threadID);
|
||||
// Basic PrivilegeDescriptor.READ allows general read access to the public
|
||||
// Should be FORUM_READ instead!
|
||||
threadPage.addRequestListener(
|
||||
new ApplicationAuthenticationListener(PrivilegeDescriptor.READ));
|
||||
|
||||
threadPage.addRequestListener
|
||||
(new ThreadPageRequestListener(threadID));
|
||||
threadPage.addRequestListener(new ThreadPageRequestListener(threadID));
|
||||
return threadPage;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,19 @@
|
|||
<body>
|
||||
|
||||
<p>
|
||||
The forum package provides discussion forums in which users can post and
|
||||
reply to messages. Additionally, users may register for notifications of
|
||||
new posts to the system.
|
||||
The forum package provides electronic bulletin board where users can post and
|
||||
reply to messages. It is highly integrated with ccm systems user and permission
|
||||
administration as well as search feature. More than one instance of a forum is
|
||||
supported, each with its own set f configuration. There exists a enhancement
|
||||
package forum-categorized which allows a forum to be integrated into navigation
|
||||
system.
|
||||
</p>
|
||||
<p>Several features and funcionality may be configured (some system wide, most of
|
||||
them on a per forum base), among others:</p>
|
||||
<ul>
|
||||
<li>Reply functionality may be disabled so it is just a noticeboard.</li>
|
||||
<li>Users may register for notifications of new posts to the system</li>
|
||||
</ul>
|
||||
<p>
|
||||
<i>Forum.java</i> is the main domain class.
|
||||
</p>
|
||||
|
|
|
|||
Loading…
Reference in New Issue