Forum
Reihenfolge der Threads ist nun per Config einstellbar. git-svn-id: https://svn.libreccm.org/ccm/trunk@1474 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
e8b1968c12
commit
55657c07e1
|
|
@ -597,7 +597,7 @@ public class Forum extends Application {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
threadsData.addOrder("lastUpdate desc");
|
threadsData.addOrder(getConfig().getThreadOrder());
|
||||||
|
|
||||||
return new ThreadCollection(threadsData);
|
return new ThreadCollection(threadsData);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ import org.apache.log4j.Logger;
|
||||||
public class ForumConfig extends AbstractConfig {
|
public class ForumConfig extends AbstractConfig {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(ForumConfig.class);
|
private static final Logger s_log = Logger.getLogger(ForumConfig.class);
|
||||||
|
|
||||||
private Parameter m_adminEditPosts;
|
private Parameter m_adminEditPosts;
|
||||||
private Parameter m_authorEditPosts;
|
private Parameter m_authorEditPosts;
|
||||||
private Parameter m_authorDeletePosts;
|
private Parameter m_authorDeletePosts;
|
||||||
|
|
@ -62,79 +61,86 @@ public class ForumConfig extends AbstractConfig {
|
||||||
private Parameter m_useWysiwygEditor;
|
private Parameter m_useWysiwygEditor;
|
||||||
private Parameter m_rejectionMessage;
|
private Parameter m_rejectionMessage;
|
||||||
private Parameter m_threadPageSize;
|
private Parameter m_threadPageSize;
|
||||||
|
private Parameter m_threadOrderField;
|
||||||
|
private Parameter m_threadOrderDir;
|
||||||
private Parameter m_quickFinish;
|
private Parameter m_quickFinish;
|
||||||
private Parameter m_deleteSentSubscriptionNotifications;
|
private Parameter m_deleteSentSubscriptionNotifications;
|
||||||
|
|
||||||
public ForumConfig() {
|
public ForumConfig() {
|
||||||
|
|
||||||
m_adminEditPosts = new BooleanParameter(
|
m_adminEditPosts = new BooleanParameter(
|
||||||
"com.arsdigita.forum.admin_can_edit_posts",
|
"com.arsdigita.forum.admin_can_edit_posts",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
Boolean.TRUE);
|
Boolean.TRUE);
|
||||||
m_authorEditPosts = new BooleanParameter(
|
m_authorEditPosts = new BooleanParameter(
|
||||||
"com.arsdigita.forum.author_can_edit_posts",
|
"com.arsdigita.forum.author_can_edit_posts",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
Boolean.TRUE);
|
Boolean.TRUE);
|
||||||
m_authorDeletePosts = new BooleanParameter(
|
m_authorDeletePosts = new BooleanParameter(
|
||||||
"com.arsdigita.forum.author_can_delete_posts",
|
"com.arsdigita.forum.author_can_delete_posts",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
Boolean.TRUE);
|
Boolean.TRUE);
|
||||||
m_replyHostName = new StringParameter(
|
m_replyHostName = new StringParameter(
|
||||||
"com.arsdigita.forum.reply_host_name",
|
"com.arsdigita.forum.reply_host_name",
|
||||||
Parameter.OPTIONAL,
|
Parameter.OPTIONAL,
|
||||||
null);
|
null);
|
||||||
m_digestUserEmail = new StringParameter(
|
m_digestUserEmail = new StringParameter(
|
||||||
"com.arsdigita.forum.digest_user_email",
|
"com.arsdigita.forum.digest_user_email",
|
||||||
Parameter.OPTIONAL,
|
Parameter.OPTIONAL,
|
||||||
null);
|
null);
|
||||||
m_disablePageCaching = new BooleanParameter (
|
m_disablePageCaching = new BooleanParameter(
|
||||||
"com.arsdigita.forum.disable_page_caching",
|
"com.arsdigita.forum.disable_page_caching",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
Boolean.FALSE);
|
Boolean.FALSE);
|
||||||
|
|
||||||
m_adminOnlyCreateTopics = new BooleanParameter (
|
m_adminOnlyCreateTopics = new BooleanParameter(
|
||||||
"com.arsdigita.forum.admin_only_to_create_topics",
|
"com.arsdigita.forum.admin_only_to_create_topics",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
Boolean.FALSE);
|
Boolean.FALSE);
|
||||||
m_maxImageSize = new IntegerParameter (
|
m_maxImageSize = new IntegerParameter(
|
||||||
"com.arsdigita.forum.maximum_image_size",
|
"com.arsdigita.forum.maximum_image_size",
|
||||||
Parameter.OPTIONAL, null);
|
Parameter.OPTIONAL, null);
|
||||||
m_maxFileSize = new IntegerParameter (
|
m_maxFileSize = new IntegerParameter(
|
||||||
"com.arsdigita.forum.maximum_file_size",
|
"com.arsdigita.forum.maximum_file_size",
|
||||||
Parameter.OPTIONAL, null);
|
Parameter.OPTIONAL, null);
|
||||||
|
|
||||||
m_showNewTabs = new BooleanParameter(
|
m_showNewTabs = new BooleanParameter(
|
||||||
"com.arsdigita.forum.show_new_tabs",
|
"com.arsdigita.forum.show_new_tabs",
|
||||||
Parameter.OPTIONAL,
|
Parameter.OPTIONAL,
|
||||||
Boolean.FALSE);
|
Boolean.FALSE);
|
||||||
m_showAllThreadAlerts = new BooleanParameter(
|
m_showAllThreadAlerts = new BooleanParameter(
|
||||||
"com.arsdigita.forum.show_all_forum_thread_alerts",
|
"com.arsdigita.forum.show_all_forum_thread_alerts",
|
||||||
Parameter.OPTIONAL,
|
Parameter.OPTIONAL,
|
||||||
Boolean.TRUE);
|
Boolean.TRUE);
|
||||||
m_useWysiwygEditor = new BooleanParameter(
|
m_useWysiwygEditor = new BooleanParameter(
|
||||||
"com.arsdigita.forum.use_wysiwyg_editor",
|
"com.arsdigita.forum.use_wysiwyg_editor",
|
||||||
Parameter.OPTIONAL,
|
Parameter.OPTIONAL,
|
||||||
Boolean.FALSE);
|
Boolean.FALSE);
|
||||||
m_rejectionMessage = new StringParameter(
|
m_rejectionMessage = new StringParameter(
|
||||||
"com.arsdigita.forum.rejection_form_message.example",
|
"com.arsdigita.forum.rejection_form_message.example",
|
||||||
Parameter.OPTIONAL,
|
Parameter.OPTIONAL,
|
||||||
null);
|
null);
|
||||||
m_threadPageSize = new IntegerParameter (
|
m_threadPageSize = new IntegerParameter(
|
||||||
"com.arsdigita.forum.thread_page_size",
|
"com.arsdigita.forum.thread_page_size",
|
||||||
Parameter.REQUIRED, new Integer(10));
|
Parameter.REQUIRED, new Integer(10));
|
||||||
|
m_threadOrderField = new StringParameter(
|
||||||
|
"com.arsdigita.forum.thread_order_field",
|
||||||
|
Parameter.REQUIRED, new String("lastUpdate"));
|
||||||
|
m_threadOrderDir = new StringParameter(
|
||||||
|
"com.arsdigita.forum.thread_order_dir",
|
||||||
|
Parameter.REQUIRED, new String("desc"));
|
||||||
m_quickFinish = new BooleanParameter(
|
m_quickFinish = new BooleanParameter(
|
||||||
"com.arsdigita.forum.allow_quick_finish",
|
"com.arsdigita.forum.allow_quick_finish",
|
||||||
Parameter.OPTIONAL,
|
Parameter.OPTIONAL,
|
||||||
Boolean.FALSE);
|
Boolean.FALSE);
|
||||||
m_deleteSentSubscriptionNotifications = new BooleanParameter(
|
m_deleteSentSubscriptionNotifications = new BooleanParameter(
|
||||||
"com.arsdigita.forum.delete_sent_subscription_notifications",
|
"com.arsdigita.forum.delete_sent_subscription_notifications",
|
||||||
Parameter.OPTIONAL,
|
Parameter.OPTIONAL,
|
||||||
Boolean.FALSE);
|
Boolean.FALSE);
|
||||||
|
|
||||||
m_adapters = new ResourceParameter
|
m_adapters = new ResourceParameter("com.arsdigita.forum.traversal_adapters",
|
||||||
("com.arsdigita.forum.traversal_adapters",
|
Parameter.REQUIRED,
|
||||||
Parameter.REQUIRED,
|
"/WEB-INF/resources/forum-adapters.xml");
|
||||||
"/WEB-INF/resources/forum-adapters.xml");
|
|
||||||
|
|
||||||
register(m_digestUserEmail);
|
register(m_digestUserEmail);
|
||||||
register(m_adminEditPosts);
|
register(m_adminEditPosts);
|
||||||
|
|
@ -151,29 +157,31 @@ public class ForumConfig extends AbstractConfig {
|
||||||
register(m_useWysiwygEditor);
|
register(m_useWysiwygEditor);
|
||||||
register(m_rejectionMessage);
|
register(m_rejectionMessage);
|
||||||
register(m_threadPageSize);
|
register(m_threadPageSize);
|
||||||
|
register(m_threadOrderField);
|
||||||
|
register(m_threadOrderDir);
|
||||||
register(m_quickFinish);
|
register(m_quickFinish);
|
||||||
register(m_deleteSentSubscriptionNotifications);
|
register(m_deleteSentSubscriptionNotifications);
|
||||||
loadInfo();
|
loadInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream getTraversalAdapters() {
|
InputStream getTraversalAdapters() {
|
||||||
return (InputStream)get(m_adapters);
|
return (InputStream) get(m_adapters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canAdminEditPosts() {
|
public boolean canAdminEditPosts() {
|
||||||
return ((Boolean)get(m_adminEditPosts)).booleanValue();
|
return ((Boolean) get(m_adminEditPosts)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canAuthorEditPosts() {
|
public boolean canAuthorEditPosts() {
|
||||||
return ((Boolean)get(m_authorEditPosts)).booleanValue();
|
return ((Boolean) get(m_authorEditPosts)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean canAuthorDeletePosts() {
|
boolean canAuthorDeletePosts() {
|
||||||
return ((Boolean)get(m_authorDeletePosts)).booleanValue();
|
return ((Boolean) get(m_authorDeletePosts)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDigestUserEmail() {
|
public String getDigestUserEmail() {
|
||||||
String email = (String)get(m_digestUserEmail);
|
String email = (String) get(m_digestUserEmail);
|
||||||
if (email == null) {
|
if (email == null) {
|
||||||
email = "forum-robot@" + Web.getConfig().getServer().getName();
|
email = "forum-robot@" + Web.getConfig().getServer().getName();
|
||||||
}
|
}
|
||||||
|
|
@ -181,7 +189,7 @@ public class ForumConfig extends AbstractConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReplyHostName() {
|
public String getReplyHostName() {
|
||||||
String hostName = (String)get(m_replyHostName);
|
String hostName = (String) get(m_replyHostName);
|
||||||
if (hostName == null) {
|
if (hostName == null) {
|
||||||
hostName = Web.getConfig().getServer().getName();
|
hostName = Web.getConfig().getServer().getName();
|
||||||
}
|
}
|
||||||
|
|
@ -189,33 +197,34 @@ public class ForumConfig extends AbstractConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supports prevention of client and middleware caching -
|
* Supports prevention of client and middleware caching - use in situations
|
||||||
* use in situations where users with different
|
* where users with different permissions share machines
|
||||||
* permissions share machines
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean disableClientPageCaching () {
|
public boolean disableClientPageCaching() {
|
||||||
return ((Boolean)get(m_disablePageCaching)).booleanValue();
|
return ((Boolean) get(m_disablePageCaching)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* if true, disables topic tab for non admin users. Topic
|
* if true, disables topic tab for non admin users. Topic tab does not
|
||||||
* tab does not access control topic creation, so set this
|
* access control topic creation, so set this to true to maintain control of
|
||||||
* to true to maintain control of the topics on the forum.
|
* the topics on the forum.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean topicCreationByAdminOnly () {
|
public boolean topicCreationByAdminOnly() {
|
||||||
return ((Boolean)get(m_adminOnlyCreateTopics)).booleanValue();
|
return ((Boolean) get(m_adminOnlyCreateTopics)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getDigestUser() {
|
public User getDigestUser() {
|
||||||
String email = getDigestUserEmail();
|
String email = getDigestUserEmail();
|
||||||
|
|
||||||
UserCollection users = User.retrieveAll();
|
UserCollection users = User.retrieveAll();
|
||||||
users.addEqualsFilter("primaryEmail",
|
users.addEqualsFilter("primaryEmail",
|
||||||
email);
|
email);
|
||||||
|
|
||||||
if (!users.next()) {
|
if (!users.next()) {
|
||||||
throw new RuntimeException("cannot find user " + email);
|
throw new RuntimeException("cannot find user " + email);
|
||||||
|
|
@ -225,85 +234,102 @@ public class ForumConfig extends AbstractConfig {
|
||||||
users.close();
|
users.close();
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the maximum allowed size (in bytes) of
|
* returns the maximum allowed size (in bytes) of image files attached to
|
||||||
* image files attached to posts. Any larger
|
* posts. Any larger files are rejected by UI validation
|
||||||
* files are rejected by UI validation
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public long getMaxImageSize() {
|
public long getMaxImageSize() {
|
||||||
Integer size = (Integer)get(m_maxImageSize);
|
Integer size = (Integer) get(m_maxImageSize);
|
||||||
long longSize = Long.MAX_VALUE;
|
long longSize = Long.MAX_VALUE;
|
||||||
if (size != null) {
|
if (size != null) {
|
||||||
longSize = size.longValue();
|
longSize = size.longValue();
|
||||||
}
|
}
|
||||||
return longSize;
|
return longSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the maximum allowed size (in bytes) of
|
* returns the maximum allowed size (in bytes) of files attached to posts.
|
||||||
* files attached to posts. Any larger
|
* Any larger files are rejected by UI validation
|
||||||
* files are rejected by UI validation
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public long getMaxFileSize() {
|
public long getMaxFileSize() {
|
||||||
Integer size = (Integer)get(m_maxFileSize);
|
Integer size = (Integer) get(m_maxFileSize);
|
||||||
long longSize = Long.MAX_VALUE;
|
long longSize = Long.MAX_VALUE;
|
||||||
if (size != null) {
|
if (size != null) {
|
||||||
longSize = size.longValue();
|
longSize = size.longValue();
|
||||||
}
|
}
|
||||||
return longSize;
|
return longSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* if true, alerts tab displays thread alerts for this and all other
|
* if true, alerts tab displays thread alerts for this and all other forums.
|
||||||
* forums. If false, only display thread subscriptions for current
|
* If false, only display thread subscriptions for current forum.
|
||||||
* forum.
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* If true, the thread alert page lists thread alerts from
|
* If true, the thread alert page lists thread alerts from all forums -
|
||||||
* all forums - alerts not from the current forum have
|
* alerts not from the current forum have links to the thread displayed
|
||||||
* links to the thread displayed within the context of
|
* within the context of the current forum. Looks weird and needs to be
|
||||||
* the current forum. Looks weird and needs to be sorted out
|
* sorted out presumably the correct forum needs to be set in the
|
||||||
* presumably the correct forum needs to be set in the ForumContext
|
* ForumContext when a link is selected
|
||||||
* when a link is selected
|
|
||||||
*/
|
*/
|
||||||
public boolean showThreadAlertsForAllForums () {
|
public boolean showThreadAlertsForAllForums() {
|
||||||
return ((Boolean)get(m_showAllThreadAlerts)).booleanValue();
|
return ((Boolean) get(m_showAllThreadAlerts)).booleanValue();
|
||||||
}
|
|
||||||
/**
|
|
||||||
* if true, displays setup and permissions tabs
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean showNewTabs () {
|
|
||||||
return ((Boolean)get(m_showNewTabs)).booleanValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean useWysiwygEditor () {
|
|
||||||
return ((Boolean)get(m_useWysiwygEditor)).booleanValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message added to the bottom of the moderation reection email.
|
* if true, displays setup and permissions tabs
|
||||||
* May give details about what the poster can do if not happy
|
*
|
||||||
* with rejection
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getRejectionMessage () {
|
public boolean showNewTabs() {
|
||||||
return (String)get(m_rejectionMessage);
|
return ((Boolean) get(m_showNewTabs)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getThreadPageSize () {
|
public boolean useWysiwygEditor() {
|
||||||
return ((Integer)get(m_threadPageSize)).intValue();
|
return ((Boolean) get(m_useWysiwygEditor)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean quickFinishAllowed () {
|
/**
|
||||||
return ((Boolean)get(m_quickFinish)).booleanValue();
|
* message added to the bottom of the moderation reection email. May give
|
||||||
|
* details about what the poster can do if not happy with rejection
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getRejectionMessage() {
|
||||||
|
return (String) get(m_rejectionMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean deleteNotifications () {
|
public int getThreadPageSize() {
|
||||||
return ((Boolean)get(m_deleteSentSubscriptionNotifications)).booleanValue();
|
return ((Integer) get(m_threadPageSize)).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getThreadOrder() {
|
||||||
|
String field = (String) get(m_threadOrderField);
|
||||||
|
String dir = (String) get(m_threadOrderDir);
|
||||||
|
|
||||||
|
// Test for validity
|
||||||
|
if(!field.equals("lastUpdate") && !field.equals("root.sent")) {
|
||||||
|
field = "lastUpdate"; // Default behaviour
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!dir.equals("asc") && !dir.equals("desc")) {
|
||||||
|
dir = "desc"; // Default behaviour
|
||||||
|
}
|
||||||
|
|
||||||
|
return field + " " + dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean quickFinishAllowed() {
|
||||||
|
return ((Boolean) get(m_quickFinish)).booleanValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean deleteNotifications() {
|
||||||
|
return ((Boolean) get(m_deleteSentSubscriptionNotifications)).booleanValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,16 @@ com.arsdigita.forum.thread_page_size.purpose=balance page loading time against n
|
||||||
com.arsdigita.forum.thread_page_size.format=[integer]
|
com.arsdigita.forum.thread_page_size.format=[integer]
|
||||||
com.arsdigita.forum.thread_page_size.example=10
|
com.arsdigita.forum.thread_page_size.example=10
|
||||||
|
|
||||||
|
com.arsdigita.forum.thread_order_field.title=Thread list order field
|
||||||
|
com.arsdigita.forum.thread_order_field.purpose=Define field by which the thread list will be orderd
|
||||||
|
com.arsdigita.forum.thread_order_field.format=[string]
|
||||||
|
com.arsdigita.forum.thread_order_field.example=lastUpdate|root.sent
|
||||||
|
|
||||||
|
com.arsdigita.forum.thread_order_dir.title=Thread list order direction
|
||||||
|
com.arsdigita.forum.thread_order_dir.purpose=Ascending or descending sort order
|
||||||
|
com.arsdigita.forum.thread_order_dir.format=[string]
|
||||||
|
com.arsdigita.forum.thread_order_dir.example=asc|desc
|
||||||
|
|
||||||
com.arsdigita.forum.allow_quick_finish.title=Allow quick finish on posts
|
com.arsdigita.forum.allow_quick_finish.title=Allow quick finish on posts
|
||||||
com.arsdigita.forum.allow_quick_finish.purpose=To give users the option of omitting post steps if they have a quick text post
|
com.arsdigita.forum.allow_quick_finish.purpose=To give users the option of omitting post steps if they have a quick text post
|
||||||
com.arsdigita.forum.allow_quick_finish.format=[boolean]
|
com.arsdigita.forum.allow_quick_finish.format=[boolean]
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ forum.ui.no=Nein
|
||||||
|
|
||||||
forum.ui.thread.newPost=Neuer Beitrag
|
forum.ui.thread.newPost=Neuer Beitrag
|
||||||
forum.ui.thread.subscribe=Beitrag abonnieren
|
forum.ui.thread.subscribe=Beitrag abonnieren
|
||||||
forum.ui.thread.unsubscribe=Beitrag Abonoment stornieren
|
forum.ui.thread.unsubscribe=Beitrag Abonnement stornieren
|
||||||
forum.ui.thread.viewAll=Alle Beitr\u00e4ge
|
forum.ui.thread.viewAll=Alle Beitr\u00e4ge
|
||||||
|
|
||||||
forum.ui.topic.description=Beschreibung
|
forum.ui.topic.description=Beschreibung
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue