Zugriff auf eine Forum-Instanz kann jetzt beschränkt werden.
git-svn-id: https://svn.libreccm.org/ccm/trunk@1128 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
b6f6ad9127
commit
596707a5e5
|
|
@ -63,6 +63,7 @@ import com.arsdigita.web.Application;
|
||||||
*
|
*
|
||||||
* @author Kevin Scaldeferri (kevin@arsdigita.com)
|
* @author Kevin Scaldeferri (kevin@arsdigita.com)
|
||||||
* @author chrisg23
|
* @author chrisg23
|
||||||
|
* @author Jens Pelzetter (jensp)
|
||||||
* @version $Revision: 1.7 $
|
* @version $Revision: 1.7 $
|
||||||
* @version $Id: Forum.java 1628 2007-09-17 08:10:40Z chrisg23 $
|
* @version $Id: Forum.java 1628 2007-09-17 08:10:40Z chrisg23 $
|
||||||
*/
|
*/
|
||||||
|
|
@ -70,15 +71,13 @@ public class Forum extends Application {
|
||||||
|
|
||||||
/** Private logger instance for debugging purpose */
|
/** Private logger instance for debugging purpose */
|
||||||
private static final Logger s_log = Logger.getLogger(Forum.class);
|
private static final Logger s_log = Logger.getLogger(Forum.class);
|
||||||
|
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.forum.Forum";
|
"com.arsdigita.forum.Forum";
|
||||||
public static final String PACKAGE_TYPE = "forum";
|
public static final String PACKAGE_TYPE = "forum";
|
||||||
|
|
||||||
public static final String THREAD_SUBSCRIPTION_GROUPS_NAME =
|
public static final String THREAD_SUBSCRIPTION_GROUPS_NAME =
|
||||||
"Thread Subscription Groups";
|
"Thread Subscription Groups";
|
||||||
|
|
||||||
private static final ForumConfig s_config = new ForumConfig();
|
private static final ForumConfig s_config = new ForumConfig();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_log.debug("Static initalizer starting...");
|
s_log.debug("Static initalizer starting...");
|
||||||
s_config.load();
|
s_config.load();
|
||||||
|
|
@ -88,8 +87,6 @@ public class Forum extends Application {
|
||||||
public static ForumConfig getConfig() {
|
public static ForumConfig getConfig() {
|
||||||
return s_config;
|
return s_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////
|
//////
|
||||||
//Forum specific privileges
|
//Forum specific privileges
|
||||||
/////
|
/////
|
||||||
|
|
@ -111,7 +108,6 @@ public class Forum extends Application {
|
||||||
// groups of users for their internal use and to provide private forums
|
// groups of users for their internal use and to provide private forums
|
||||||
// for logged in users only (no public read access).
|
// for logged in users only (no public read access).
|
||||||
public static final String FORUM_READ_PRIVILEGE = "forum_read";
|
public static final String FORUM_READ_PRIVILEGE = "forum_read";
|
||||||
|
|
||||||
///////
|
///////
|
||||||
// pdl forum attribute/association names
|
// pdl forum attribute/association names
|
||||||
///////
|
///////
|
||||||
|
|
@ -120,18 +116,17 @@ public class Forum extends Application {
|
||||||
private static final String MODERATION = "isModerated";
|
private static final String MODERATION = "isModerated";
|
||||||
private static final String PUBLIC = "isPublic";
|
private static final String PUBLIC = "isPublic";
|
||||||
private static final String NOTICEBOARD = "isNoticeboard";
|
private static final String NOTICEBOARD = "isNoticeboard";
|
||||||
|
|
||||||
private static final String ADMIN_GROUP = "adminGroup";
|
private static final String ADMIN_GROUP = "adminGroup";
|
||||||
private static final String MODERATION_GROUP = "moderationGroup";
|
private static final String MODERATION_GROUP = "moderationGroup";
|
||||||
private static final String THREAD_CREATE_GROUP = "threadCreateGroup";
|
private static final String THREAD_CREATE_GROUP = "threadCreateGroup";
|
||||||
private static final String THREAD_RESPONDER_GROUP = "threadRespondGroup";
|
private static final String THREAD_RESPONDER_GROUP = "threadRespondGroup";
|
||||||
private static final String READ_GROUP = "readGroup";
|
private static final String READ_GROUP = "readGroup";
|
||||||
|
|
||||||
private static final String CATEGORY = "category";
|
private static final String CATEGORY = "category";
|
||||||
private static final String EXPIRE_AFTER = "expireAfter";
|
private static final String EXPIRE_AFTER = "expireAfter";
|
||||||
private static final String LIFECYCLE_DEFINITION = "lifecycleDefinition";
|
private static final String LIFECYCLE_DEFINITION = "lifecycleDefinition";
|
||||||
// additional attributes added chris.gilbert@westsussex.gov.uk
|
// additional attributes added chris.gilbert@westsussex.gov.uk
|
||||||
private static final String ALLOW_FILE_ATTACHMENTS = "fileAttachmentsAllowed";
|
private static final String ALLOW_FILE_ATTACHMENTS =
|
||||||
|
"fileAttachmentsAllowed";
|
||||||
private static final String ALLOW_IMAGE_UPLOADS = "imageUploadsAllowed";
|
private static final String ALLOW_IMAGE_UPLOADS = "imageUploadsAllowed";
|
||||||
private static final String AUTOSUBSCRIBE_THREAD_STARTER =
|
private static final String AUTOSUBSCRIBE_THREAD_STARTER =
|
||||||
"autoSubscribeThreadStarter";
|
"autoSubscribeThreadStarter";
|
||||||
|
|
@ -203,7 +198,8 @@ public class Forum extends Application {
|
||||||
Application parent, boolean moderated) {
|
Application parent, boolean moderated) {
|
||||||
s_log.debug("creating forum " + title);
|
s_log.debug("creating forum " + title);
|
||||||
|
|
||||||
Forum forum = (Forum) Application.createApplication(BASE_DATA_OBJECT_TYPE,
|
Forum forum = (Forum) Application.createApplication(
|
||||||
|
BASE_DATA_OBJECT_TYPE,
|
||||||
urlName,
|
urlName,
|
||||||
title, parent, true);
|
title, parent, true);
|
||||||
|
|
||||||
|
|
@ -237,8 +233,7 @@ public class Forum extends Application {
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
return createRootCategory();
|
return createRootCategory();
|
||||||
} else {
|
} else {
|
||||||
return (Category)DomainObjectFactory
|
return (Category) DomainObjectFactory.newInstance(category);
|
||||||
.newInstance(category);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -288,8 +283,8 @@ public class Forum extends Application {
|
||||||
// NPE when trying to retrieve sender's email address, thus stopping any
|
// NPE when trying to retrieve sender's email address, thus stopping any
|
||||||
// further message processing.
|
// further message processing.
|
||||||
// Actually, the only hack involved is making the email address unique.
|
// Actually, the only hack involved is making the email address unique.
|
||||||
String email = "forum-moderator-" + getID() + "-" +
|
String email = "forum-moderator-" + getID() + "-" + moderators.getID()
|
||||||
moderators.getID() + "@" + s_config.getReplyHostName();
|
+ "@" + s_config.getReplyHostName();
|
||||||
moderators.setPrimaryEmail(new EmailAddress(email));
|
moderators.setPrimaryEmail(new EmailAddress(email));
|
||||||
|
|
||||||
// chris.gilbert@westsussex.gov.uk create additional groups for privilege
|
// chris.gilbert@westsussex.gov.uk create additional groups for privilege
|
||||||
|
|
@ -340,7 +335,6 @@ public class Forum extends Application {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean m_wasNew;
|
private boolean m_wasNew;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -426,9 +420,14 @@ public class Forum extends Application {
|
||||||
PrivilegeDescriptor.READ,
|
PrivilegeDescriptor.READ,
|
||||||
this,
|
this,
|
||||||
getReadGroup()));
|
getReadGroup()));
|
||||||
|
PermissionService.grantPermission(new PermissionDescriptor(
|
||||||
|
PrivilegeDescriptor.get(FORUM_READ_PRIVILEGE),
|
||||||
|
this,
|
||||||
|
getReadGroup()));
|
||||||
}
|
}
|
||||||
|
|
||||||
KernelExcursion excursion = new KernelExcursion() {
|
KernelExcursion excursion = new KernelExcursion() {
|
||||||
|
|
||||||
protected void excurse() {
|
protected void excurse() {
|
||||||
setParty(Kernel.getSystemParty());
|
setParty(Kernel.getSystemParty());
|
||||||
// FIXME
|
// FIXME
|
||||||
|
|
@ -477,12 +476,12 @@ public class Forum extends Application {
|
||||||
return BASE_DATA_OBJECT_TYPE;
|
return BASE_DATA_OBJECT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the Subscriptions associated with this Forum.
|
* Gets all the Subscriptions associated with this Forum.
|
||||||
*/
|
*/
|
||||||
public DataCollection getAllSubscriptions() {
|
public DataCollection getAllSubscriptions() {
|
||||||
DataAssociationCursor dac = ((DataAssociation) get(SUBSCRIPTIONS)).cursor();
|
DataAssociationCursor dac = ((DataAssociation) get(SUBSCRIPTIONS)).
|
||||||
|
cursor();
|
||||||
return dac;
|
return dac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -561,8 +560,7 @@ public class Forum extends Application {
|
||||||
public ThreadCollection getThreads(Party party) {
|
public ThreadCollection getThreads(Party party) {
|
||||||
ThreadCollection threads = getThreads();
|
ThreadCollection threads = getThreads();
|
||||||
|
|
||||||
if (isModerated() &&
|
if (isModerated() && !canModerate(party)) {
|
||||||
!canModerate(party)) {
|
|
||||||
s_log.debug("Only showing approved threads");
|
s_log.debug("Only showing approved threads");
|
||||||
threads.filterUnapproved(party);
|
threads.filterUnapproved(party);
|
||||||
}
|
}
|
||||||
|
|
@ -570,14 +568,12 @@ public class Forum extends Application {
|
||||||
return threads;
|
return threads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a ThreadCollection of the threads in a specific Category.
|
* Gets a ThreadCollection of the threads in a specific Category.
|
||||||
*/
|
*/
|
||||||
public ThreadCollection getThreads(BigDecimal categoryID) {
|
public ThreadCollection getThreads(BigDecimal categoryID) {
|
||||||
|
|
||||||
DataCollection threadsData
|
DataCollection threadsData = SessionManager.getSession().retrieve(
|
||||||
= SessionManager.getSession().retrieve(
|
|
||||||
MessageThread.BASE_DATA_OBJECT_TYPE);
|
MessageThread.BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -586,11 +582,13 @@ public class Forum extends Application {
|
||||||
if (categoryID != null) {
|
if (categoryID != null) {
|
||||||
// XXX bad dep on ui package
|
// XXX bad dep on ui package
|
||||||
if (categoryID.equals(com.arsdigita.forum.ui.Constants.TOPIC_NONE)) {
|
if (categoryID.equals(com.arsdigita.forum.ui.Constants.TOPIC_NONE)) {
|
||||||
Filter f = threadsData.addNotInSubqueryFilter
|
Filter f =
|
||||||
("root.id", "com.arsdigita.forum.uncategoryObject");
|
threadsData.addNotInSubqueryFilter("root.id",
|
||||||
|
"com.arsdigita.forum.uncategoryObject");
|
||||||
} else {
|
} else {
|
||||||
Filter f = threadsData.addInSubqueryFilter
|
Filter f =
|
||||||
("root.id", "com.arsdigita.forum.categoryObject");
|
threadsData.addInSubqueryFilter("root.id",
|
||||||
|
"com.arsdigita.forum.categoryObject");
|
||||||
f.set("categoryID", categoryID);
|
f.set("categoryID", categoryID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -609,8 +607,7 @@ public class Forum extends Application {
|
||||||
Party party) {
|
Party party) {
|
||||||
ThreadCollection threads = getThreads(categoryID);
|
ThreadCollection threads = getThreads(categoryID);
|
||||||
|
|
||||||
if (isModerated() &&
|
if (isModerated() && !canModerate(party)) {
|
||||||
!canModerate(party)) {
|
|
||||||
s_log.debug("Only showing approved threads");
|
s_log.debug("Only showing approved threads");
|
||||||
threads.filterUnapproved(party);
|
threads.filterUnapproved(party);
|
||||||
}
|
}
|
||||||
|
|
@ -631,6 +628,7 @@ public class Forum extends Application {
|
||||||
s_log.debug("Creating subscriptions!");
|
s_log.debug("Creating subscriptions!");
|
||||||
|
|
||||||
new KernelExcursion() {
|
new KernelExcursion() {
|
||||||
|
|
||||||
protected void excurse() {
|
protected void excurse() {
|
||||||
setParty(Kernel.getSystemParty());
|
setParty(Kernel.getSystemParty());
|
||||||
|
|
||||||
|
|
@ -660,8 +658,8 @@ public class Forum extends Application {
|
||||||
*/
|
*/
|
||||||
public DataQuery getCategories() {
|
public DataQuery getCategories() {
|
||||||
Session session = SessionManager.getSession();
|
Session session = SessionManager.getSession();
|
||||||
DataQuery query = session.retrieveQuery
|
DataQuery query = session.retrieveQuery(
|
||||||
("com.arsdigita.forum.getCategorizationSummary");
|
"com.arsdigita.forum.getCategorizationSummary");
|
||||||
query.setParameter("forumID", getID());
|
query.setParameter("forumID", getID());
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
@ -673,8 +671,8 @@ public class Forum extends Application {
|
||||||
*/
|
*/
|
||||||
public DataQuery getEmptyCategories() {
|
public DataQuery getEmptyCategories() {
|
||||||
Session session = SessionManager.getSession();
|
Session session = SessionManager.getSession();
|
||||||
DataQuery query = session.retrieveQuery
|
DataQuery query = session.retrieveQuery(
|
||||||
("com.arsdigita.forum.getUnusedCategories");
|
"com.arsdigita.forum.getUnusedCategories");
|
||||||
query.setParameter("forumID", getID());
|
query.setParameter("forumID", getID());
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
@ -686,8 +684,8 @@ public class Forum extends Application {
|
||||||
*/
|
*/
|
||||||
public DataQuery getUnCategory() {
|
public DataQuery getUnCategory() {
|
||||||
Session session = SessionManager.getSession();
|
Session session = SessionManager.getSession();
|
||||||
DataQuery query = session.retrieveQuery
|
DataQuery query = session.retrieveQuery(
|
||||||
("com.arsdigita.forum.getUncategorizedSummary");
|
"com.arsdigita.forum.getUncategorizedSummary");
|
||||||
query.setParameter("forumID", getID());
|
query.setParameter("forumID", getID());
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
@ -697,8 +695,9 @@ public class Forum extends Application {
|
||||||
DataAssociationCursor cursor =
|
DataAssociationCursor cursor =
|
||||||
root.getRelatedCategories(Category.CHILD);
|
root.getRelatedCategories(Category.CHILD);
|
||||||
|
|
||||||
Filter f = cursor.addInSubqueryFilter
|
Filter f =
|
||||||
("id", "com.arsdigita.forum.filledCategories");
|
cursor.addInSubqueryFilter("id",
|
||||||
|
"com.arsdigita.forum.filledCategories");
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -721,8 +720,8 @@ public class Forum extends Application {
|
||||||
* checks if the user can edit posts in this forum
|
* checks if the user can edit posts in this forum
|
||||||
*/
|
*/
|
||||||
public boolean canEdit(Party party) {
|
public boolean canEdit(Party party) {
|
||||||
return (getConfig().canAdminEditPosts() &&
|
return (getConfig().canAdminEditPosts() && PermissionService.
|
||||||
PermissionService.checkPermission(
|
checkPermission(
|
||||||
new PermissionDescriptor(PrivilegeDescriptor.EDIT,
|
new PermissionDescriptor(PrivilegeDescriptor.EDIT,
|
||||||
this,
|
this,
|
||||||
party)));
|
party)));
|
||||||
|
|
@ -750,14 +749,12 @@ public class Forum extends Application {
|
||||||
*/
|
*/
|
||||||
public void setModerated(boolean moderate) {
|
public void setModerated(boolean moderate) {
|
||||||
Boolean old = (Boolean) get(MODERATION);
|
Boolean old = (Boolean) get(MODERATION);
|
||||||
if (Boolean.TRUE.equals(old) &&
|
if (Boolean.TRUE.equals(old) && !moderate) {
|
||||||
!moderate) {
|
|
||||||
|
|
||||||
DataAssociationCursor posts = getPosts().cursor();
|
DataAssociationCursor posts = getPosts().cursor();
|
||||||
posts.addEqualsFilter(Post.STATUS, Post.PENDING);
|
posts.addEqualsFilter(Post.STATUS, Post.PENDING);
|
||||||
while (posts.next()) {
|
while (posts.next()) {
|
||||||
Post post
|
Post post = (Post) DomainObjectFactory.newInstance(
|
||||||
= (Post)DomainObjectFactory.newInstance(
|
|
||||||
posts.getDataObject());
|
posts.getDataObject());
|
||||||
post.setStatus(Post.APPROVED);
|
post.setStatus(Post.APPROVED);
|
||||||
post.save();
|
post.save();
|
||||||
|
|
@ -853,10 +850,11 @@ public class Forum extends Application {
|
||||||
// have the same expiration policy.
|
// have the same expiration policy.
|
||||||
DataAssociationCursor posts = getPosts().cursor();
|
DataAssociationCursor posts = getPosts().cursor();
|
||||||
while (posts.next()) {
|
while (posts.next()) {
|
||||||
Post post = (Post) DomainObjectFactory.newInstance(posts.getDataObject());
|
Post post = (Post) DomainObjectFactory.newInstance(posts.
|
||||||
if (post.getThread().getRootMessage().getID()
|
getDataObject());
|
||||||
.equals(post.getID())) {
|
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);
|
post.setLifecycle(newLife);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -944,6 +942,7 @@ public class Forum extends Application {
|
||||||
public boolean allowFileAttachments() {
|
public boolean allowFileAttachments() {
|
||||||
return ((Boolean) get(ALLOW_FILE_ATTACHMENTS)).booleanValue();
|
return ((Boolean) get(ALLOW_FILE_ATTACHMENTS)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean allowImageUploads() {
|
public boolean allowImageUploads() {
|
||||||
return ((Boolean) get(ALLOW_IMAGE_UPLOADS)).booleanValue();
|
return ((Boolean) get(ALLOW_IMAGE_UPLOADS)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
@ -955,6 +954,7 @@ public class Forum extends Application {
|
||||||
public boolean noCategoryPostsAllowed() {
|
public boolean noCategoryPostsAllowed() {
|
||||||
return ((Boolean) get(NO_CATEGORY_POSTS)).booleanValue();
|
return ((Boolean) get(NO_CATEGORY_POSTS)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean anonymousPostsAllowed() {
|
public boolean anonymousPostsAllowed() {
|
||||||
return ((Boolean) get(ANONYMOUS_POSTS)).booleanValue();
|
return ((Boolean) get(ANONYMOUS_POSTS)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
@ -962,9 +962,11 @@ public class Forum extends Application {
|
||||||
public void setAllowFileAttachments(boolean allow) {
|
public void setAllowFileAttachments(boolean allow) {
|
||||||
set(ALLOW_FILE_ATTACHMENTS, new Boolean(allow));
|
set(ALLOW_FILE_ATTACHMENTS, new Boolean(allow));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAllowImageUploads(boolean allow) {
|
public void setAllowImageUploads(boolean allow) {
|
||||||
set(ALLOW_IMAGE_UPLOADS, new Boolean(allow));
|
set(ALLOW_IMAGE_UPLOADS, new Boolean(allow));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoSubscribeThreadCreator(boolean subscribe) {
|
public void setAutoSubscribeThreadCreator(boolean subscribe) {
|
||||||
set(AUTOSUBSCRIBE_THREAD_STARTER, new Boolean(subscribe));
|
set(AUTOSUBSCRIBE_THREAD_STARTER, new Boolean(subscribe));
|
||||||
}
|
}
|
||||||
|
|
@ -990,8 +992,8 @@ public class Forum extends Application {
|
||||||
|
|
||||||
DataCollection subscriptions = getSubscriptions();
|
DataCollection subscriptions = getSubscriptions();
|
||||||
while (subscriptions.next()) {
|
while (subscriptions.next()) {
|
||||||
ForumSubscription
|
ForumSubscription subscription =
|
||||||
subscription = (ForumSubscription)DomainObjectFactory.
|
(ForumSubscription) DomainObjectFactory.
|
||||||
newInstance(subscriptions.getDataObject());
|
newInstance(subscriptions.getDataObject());
|
||||||
subscription.getGroup().setName(subscription.getGroupName(this));
|
subscription.getGroup().setName(subscription.getGroupName(this));
|
||||||
}
|
}
|
||||||
|
|
@ -1001,7 +1003,8 @@ public class Forum extends Application {
|
||||||
ThreadSubscription threadSub = ThreadSubscription.
|
ThreadSubscription threadSub = ThreadSubscription.
|
||||||
getThreadSubscription(
|
getThreadSubscription(
|
||||||
threads.getMessageThread());
|
threads.getMessageThread());
|
||||||
threadSub.getGroup().setName(threadSub.getSubscriptionGroupName(this));
|
threadSub.getGroup().setName(threadSub.getSubscriptionGroupName(
|
||||||
|
this));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1016,7 +1019,6 @@ public class Forum extends Application {
|
||||||
// public String getContextPath() {
|
// public String getContextPath() {
|
||||||
// return "/ccm-forum";
|
// return "/ccm-forum";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the path name of the location of the applications servlet/JSP.
|
* Returns the path name of the location of the applications servlet/JSP.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.forum;
|
package com.arsdigita.forum;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.forum.portlet.MyForumsPortlet;
|
import com.arsdigita.forum.portlet.MyForumsPortlet;
|
||||||
import com.arsdigita.forum.portlet.RecentPostingsPortlet;
|
import com.arsdigita.forum.portlet.RecentPostingsPortlet;
|
||||||
import com.arsdigita.kernel.EmailAddress;
|
import com.arsdigita.kernel.EmailAddress;
|
||||||
|
|
@ -38,7 +37,6 @@ import com.arsdigita.web.ApplicationType;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loader executes nonrecurring at install time and loads (installs and
|
* Loader executes nonrecurring at install time and loads (installs and
|
||||||
* initializes) the Forum module.
|
* initializes) the Forum module.
|
||||||
|
|
@ -57,6 +55,7 @@ public class Loader extends PackageLoader {
|
||||||
|
|
||||||
public void run(final ScriptContext ctx) {
|
public void run(final ScriptContext ctx) {
|
||||||
new KernelExcursion() {
|
new KernelExcursion() {
|
||||||
|
|
||||||
public void excurse() {
|
public void excurse() {
|
||||||
setEffectiveParty(Kernel.getSystemParty());
|
setEffectiveParty(Kernel.getSystemParty());
|
||||||
|
|
||||||
|
|
@ -77,23 +76,22 @@ public class Loader extends PackageLoader {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static ApplicationType setupForumAppType() {
|
private static ApplicationType setupForumAppType() {
|
||||||
ApplicationType type = ApplicationType
|
ApplicationType type =
|
||||||
.createApplicationType(Forum.PACKAGE_TYPE,
|
ApplicationType.createApplicationType(Forum.PACKAGE_TYPE,
|
||||||
"Discussion Forum Application",
|
"Discussion Forum Application",
|
||||||
Forum.BASE_DATA_OBJECT_TYPE);
|
Forum.BASE_DATA_OBJECT_TYPE);
|
||||||
type.setDescription("An electronic bulletin board system.");
|
type.setDescription("An electronic bulletin board system.");
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: What is it for? Execution is currently commented out.
|
* TODO: What is it for? Execution is currently commented out.
|
||||||
* Referenced class com.arsdigita.forum.Inbox does not exist.
|
* Referenced class com.arsdigita.forum.Inbox does not exist.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static ApplicationType setupInboxAppType() {
|
private static ApplicationType setupInboxAppType() {
|
||||||
ApplicationType type = ApplicationType
|
ApplicationType type =
|
||||||
.createApplicationType(Forum.PACKAGE_TYPE,
|
ApplicationType.createApplicationType(Forum.PACKAGE_TYPE,
|
||||||
"Inbox",
|
"Inbox",
|
||||||
"com.arsdigita.forum.Inbox");
|
"com.arsdigita.forum.Inbox");
|
||||||
type.setDescription("Inbox");
|
type.setDescription("Inbox");
|
||||||
|
|
@ -105,14 +103,15 @@ public class Loader extends PackageLoader {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static AppPortletType setupRecentPostingsPortletType() {
|
public static AppPortletType setupRecentPostingsPortletType() {
|
||||||
AppPortletType type = AppPortletType
|
AppPortletType type =
|
||||||
.createAppPortletType("Recent Forum Postings",
|
AppPortletType.createAppPortletType(
|
||||||
|
"Recent Forum Postings",
|
||||||
PortletType.WIDE_PROFILE,
|
PortletType.WIDE_PROFILE,
|
||||||
RecentPostingsPortlet.BASE_DATA_OBJECT_TYPE);
|
RecentPostingsPortlet.BASE_DATA_OBJECT_TYPE);
|
||||||
type.setProviderApplicationType(Forum.BASE_DATA_OBJECT_TYPE);
|
type.setProviderApplicationType(Forum.BASE_DATA_OBJECT_TYPE);
|
||||||
type.setPortalApplication(true);
|
type.setPortalApplication(true);
|
||||||
type.setDescription("Displays the most recent postings " +
|
type.setDescription("Displays the most recent postings "
|
||||||
"to the bulletin board.");
|
+ "to the bulletin board.");
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,8 +121,8 @@ public class Loader extends PackageLoader {
|
||||||
"My Forums",
|
"My Forums",
|
||||||
PortletType.WIDE_PROFILE,
|
PortletType.WIDE_PROFILE,
|
||||||
MyForumsPortlet.BASE_DATA_OBJECT_TYPE);
|
MyForumsPortlet.BASE_DATA_OBJECT_TYPE);
|
||||||
type.setDescription("Lists forums that user has access to, " + "" +
|
type.setDescription("Lists forums that user has access to, " + ""
|
||||||
" with last posting date");
|
+ " with last posting date");
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
@ -159,22 +158,18 @@ public class Loader extends PackageLoader {
|
||||||
*/
|
*/
|
||||||
public static void setupPrivileges() {
|
public static void setupPrivileges() {
|
||||||
|
|
||||||
PrivilegeDescriptor.createPrivilege(
|
PrivilegeDescriptor.createPrivilege(Forum.FORUM_READ_PRIVILEGE);
|
||||||
Forum.FORUM_MODERATION_PRIVILEGE);
|
PrivilegeDescriptor.createPrivilege(Forum.FORUM_MODERATION_PRIVILEGE);
|
||||||
PrivilegeDescriptor.createPrivilege(
|
PrivilegeDescriptor.createPrivilege(Forum.CREATE_THREAD_PRIVILEGE);
|
||||||
Forum.CREATE_THREAD_PRIVILEGE);
|
PrivilegeDescriptor.createPrivilege(Forum.RESPOND_TO_THREAD_PRIVILEGE);
|
||||||
PrivilegeDescriptor.createPrivilege(
|
|
||||||
Forum.RESPOND_TO_THREAD_PRIVILEGE);
|
|
||||||
// Establich privilege hierarchie, eg. moderation includes createThread
|
// Establich privilege hierarchie, eg. moderation includes createThread
|
||||||
PrivilegeDescriptor.addChildPrivilege(
|
PrivilegeDescriptor.addChildPrivilege(Forum.FORUM_MODERATION_PRIVILEGE,
|
||||||
Forum.FORUM_MODERATION_PRIVILEGE,
|
|
||||||
Forum.CREATE_THREAD_PRIVILEGE);
|
Forum.CREATE_THREAD_PRIVILEGE);
|
||||||
PrivilegeDescriptor.addChildPrivilege(
|
PrivilegeDescriptor.addChildPrivilege(Forum.CREATE_THREAD_PRIVILEGE,
|
||||||
Forum.CREATE_THREAD_PRIVILEGE,
|
|
||||||
Forum.RESPOND_TO_THREAD_PRIVILEGE);
|
Forum.RESPOND_TO_THREAD_PRIVILEGE);
|
||||||
PrivilegeDescriptor.addChildPrivilege(
|
PrivilegeDescriptor.addChildPrivilege(Forum.RESPOND_TO_THREAD_PRIVILEGE,
|
||||||
Forum.RESPOND_TO_THREAD_PRIVILEGE,
|
|
||||||
PrivilegeDescriptor.READ.getName()); // general read privilege
|
PrivilegeDescriptor.READ.getName()); // general read privilege
|
||||||
|
PrivilegeDescriptor.addChildPrivilege(Forum.RESPOND_TO_THREAD_PRIVILEGE,
|
||||||
|
Forum.FORUM_READ_PRIVILEGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,13 +55,13 @@ import com.arsdigita.xml.Element;
|
||||||
*
|
*
|
||||||
* @author Kevin Scaldeferri (kevin@arsdigita.com)
|
* @author Kevin Scaldeferri (kevin@arsdigita.com)
|
||||||
* @author Chris Gilbert (chrisg23)
|
* @author Chris Gilbert (chrisg23)
|
||||||
|
* @author Jens Pelzetter (jensp)
|
||||||
* @version $Revision: 1.3 $ $Author: chrisg23 $ $Date: 2006/03/09 13:48:15 $
|
* @version $Revision: 1.3 $ $Author: chrisg23 $ $Date: 2006/03/09 13:48:15 $
|
||||||
*/
|
*/
|
||||||
public class ForumUserCompactView extends ModalContainer implements Constants {
|
public class ForumUserCompactView extends ModalContainer implements Constants {
|
||||||
|
|
||||||
/** Private logger instance for debugging purpose. */
|
/** Private logger instance for debugging purpose. */
|
||||||
private static Logger s_log = Logger.getLogger(ForumUserCompactView.class);
|
private static Logger s_log = Logger.getLogger(ForumUserCompactView.class);
|
||||||
|
|
||||||
// Denotes the 6 panels of the user interface, also used as marker to store
|
// Denotes the 6 panels of the user interface, also used as marker to store
|
||||||
// and select the active panel
|
// and select the active panel
|
||||||
/** Denotation of the 'threads' forum mode */
|
/** Denotation of the 'threads' forum mode */
|
||||||
|
|
@ -79,7 +79,6 @@ public class ForumUserCompactView extends ModalContainer implements Constants {
|
||||||
public static final String MODE_SETUP = "setup";
|
public static final String MODE_SETUP = "setup";
|
||||||
/** Holds the current active mode */
|
/** Holds the current active mode */
|
||||||
private StringParameter m_mode;
|
private StringParameter m_mode;
|
||||||
|
|
||||||
/** Object containing the threads panel (main working panel for users) */
|
/** Object containing the threads panel (main working panel for users) */
|
||||||
private ThreadsPanel m_threadsView;
|
private ThreadsPanel m_threadsView;
|
||||||
/** Object containing the topics panel */
|
/** Object containing the topics panel */
|
||||||
|
|
@ -167,7 +166,8 @@ public class ForumUserCompactView extends ModalContainer implements Constants {
|
||||||
Forum forum, String mode) {
|
Forum forum, String mode) {
|
||||||
|
|
||||||
PermissionDescriptor forumAdmin =
|
PermissionDescriptor forumAdmin =
|
||||||
new PermissionDescriptor(PrivilegeDescriptor.ADMIN, forum, party);
|
new PermissionDescriptor(PrivilegeDescriptor.ADMIN,
|
||||||
|
forum, party);
|
||||||
|
|
||||||
PermissionService.assertPermission(forumAdmin);
|
PermissionService.assertPermission(forumAdmin);
|
||||||
|
|
||||||
|
|
@ -249,13 +249,24 @@ public class ForumUserCompactView extends ModalContainer implements Constants {
|
||||||
protected void generateModes(PageState state, Element content,
|
protected void generateModes(PageState state, Element content,
|
||||||
Party party, Forum forum) {
|
Party party, Forum forum) {
|
||||||
|
|
||||||
PermissionDescriptor permission =
|
PermissionDescriptor permission = new PermissionDescriptor(
|
||||||
new PermissionDescriptor(PrivilegeDescriptor.ADMIN, forum, party);
|
PrivilegeDescriptor.ADMIN,
|
||||||
|
forum,
|
||||||
|
party);
|
||||||
|
PermissionDescriptor readPermission = new PermissionDescriptor(
|
||||||
|
PrivilegeDescriptor.get(Forum.FORUM_READ_PRIVILEGE),
|
||||||
|
forum,
|
||||||
|
party);
|
||||||
|
|
||||||
|
|
||||||
// currently thread panel is always shown. If read access should be
|
// currently thread panel is always shown. If read access should be
|
||||||
// bound to logged in users, additional logic is required here.
|
// bound to logged in users, additional logic is required here.
|
||||||
|
// jensp 2011-10-02: Additional logic added
|
||||||
|
if (!forum.isPublic()
|
||||||
|
&& PermissionService.checkPermission(readPermission)) {
|
||||||
generateModeXML(state, content, MODE_THREADS,
|
generateModeXML(state, content, MODE_THREADS,
|
||||||
Text.gz("forum.ui.modeThreads"));
|
Text.gz("forum.ui.modeThreads"));
|
||||||
|
}
|
||||||
// topics panel is always shoen as well if not restricted to admins.
|
// topics panel is always shoen as well if not restricted to admins.
|
||||||
if (!Forum.getConfig().topicCreationByAdminOnly()) {
|
if (!Forum.getConfig().topicCreationByAdminOnly()) {
|
||||||
generateModeXML(state, content, MODE_TOPICS,
|
generateModeXML(state, content, MODE_TOPICS,
|
||||||
|
|
@ -348,7 +359,8 @@ public class ForumUserCompactView extends ModalContainer implements Constants {
|
||||||
}
|
}
|
||||||
|
|
||||||
Element content =
|
Element content =
|
||||||
parent.newChildElement(FORUM_XML_PREFIX + ":forumMode", FORUM_XML_NS);
|
parent.newChildElement(FORUM_XML_PREFIX + ":forumMode",
|
||||||
|
FORUM_XML_NS);
|
||||||
|
|
||||||
state.setControlEvent(this, "mode", mode);
|
state.setControlEvent(this, "mode", mode);
|
||||||
|
|
||||||
|
|
@ -376,7 +388,4 @@ public class ForumUserCompactView extends ModalContainer implements Constants {
|
||||||
current.equals(mode) ? "1" : "0");
|
current.equals(mode) ? "1" : "0");
|
||||||
state.clearControlEvent();
|
state.clearControlEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue