Reihenfolge der Threads ist nun per Config einstellbar.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1474 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2012-01-28 15:28:52 +00:00
parent e8b1968c12
commit 55657c07e1
4 changed files with 207 additions and 171 deletions

View File

@ -597,7 +597,7 @@ public class Forum extends Application {
}
}
threadsData.addOrder("lastUpdate desc");
threadsData.addOrder(getConfig().getThreadOrder());
return new ThreadCollection(threadsData);
}

View File

@ -46,7 +46,6 @@ import org.apache.log4j.Logger;
public class ForumConfig extends AbstractConfig {
private static final Logger s_log = Logger.getLogger(ForumConfig.class);
private Parameter m_adminEditPosts;
private Parameter m_authorEditPosts;
private Parameter m_authorDeletePosts;
@ -62,6 +61,8 @@ public class ForumConfig extends AbstractConfig {
private Parameter m_useWysiwygEditor;
private Parameter m_rejectionMessage;
private Parameter m_threadPageSize;
private Parameter m_threadOrderField;
private Parameter m_threadOrderDir;
private Parameter m_quickFinish;
private Parameter m_deleteSentSubscriptionNotifications;
@ -122,6 +123,12 @@ public class ForumConfig extends AbstractConfig {
m_threadPageSize = new IntegerParameter(
"com.arsdigita.forum.thread_page_size",
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(
"com.arsdigita.forum.allow_quick_finish",
Parameter.OPTIONAL,
@ -131,8 +138,7 @@ public class ForumConfig extends AbstractConfig {
Parameter.OPTIONAL,
Boolean.FALSE);
m_adapters = new ResourceParameter
("com.arsdigita.forum.traversal_adapters",
m_adapters = new ResourceParameter("com.arsdigita.forum.traversal_adapters",
Parameter.REQUIRED,
"/WEB-INF/resources/forum-adapters.xml");
@ -151,6 +157,8 @@ public class ForumConfig extends AbstractConfig {
register(m_useWysiwygEditor);
register(m_rejectionMessage);
register(m_threadPageSize);
register(m_threadOrderField);
register(m_threadOrderDir);
register(m_quickFinish);
register(m_deleteSentSubscriptionNotifications);
loadInfo();
@ -189,9 +197,9 @@ public class ForumConfig extends AbstractConfig {
}
/**
* Supports prevention of client and middleware caching -
* use in situations where users with different
* permissions share machines
* Supports prevention of client and middleware caching - use in situations
* where users with different permissions share machines
*
* @return
*/
public boolean disableClientPageCaching() {
@ -199,9 +207,9 @@ public class ForumConfig extends AbstractConfig {
}
/**
* if true, disables topic tab for non admin users. Topic
* tab does not access control topic creation, so set this
* to true to maintain control of the topics on the forum.
* if true, disables topic tab for non admin users. Topic tab does not
* access control topic creation, so set this to true to maintain control of
* the topics on the forum.
*
*
*
@ -210,6 +218,7 @@ public class ForumConfig extends AbstractConfig {
public boolean topicCreationByAdminOnly() {
return ((Boolean) get(m_adminOnlyCreateTopics)).booleanValue();
}
public User getDigestUser() {
String email = getDigestUserEmail();
@ -225,10 +234,11 @@ public class ForumConfig extends AbstractConfig {
users.close();
return user;
}
/**
* returns the maximum allowed size (in bytes) of
* image files attached to posts. Any larger
* files are rejected by UI validation
* returns the maximum allowed size (in bytes) of image files attached to
* posts. Any larger files are rejected by UI validation
*
* @return
*/
public long getMaxImageSize() {
@ -239,10 +249,11 @@ public class ForumConfig extends AbstractConfig {
}
return longSize;
}
/**
* returns the maximum allowed size (in bytes) of
* files attached to posts. Any larger
* files are rejected by UI validation
* returns the maximum allowed size (in bytes) of files attached to posts.
* Any larger files are rejected by UI validation
*
* @return
*/
public long getMaxFileSize() {
@ -254,26 +265,26 @@ public class ForumConfig extends AbstractConfig {
return longSize;
}
/**
* if true, alerts tab displays thread alerts for this and all other
* forums. If false, only display thread subscriptions for current
* forum.
* if true, alerts tab displays thread alerts for this and all other forums.
* If false, only display thread subscriptions for current forum.
*
* @return
*/
/*
* If true, the thread alert page lists thread alerts from
* all forums - alerts not from the current forum have
* links to the thread displayed within the context of
* the current forum. Looks weird and needs to be sorted out
* presumably the correct forum needs to be set in the ForumContext
* when a link is selected
* If true, the thread alert page lists thread alerts from all forums -
* alerts not from the current forum have links to the thread displayed
* within the context of the current forum. Looks weird and needs to be
* sorted out presumably the correct forum needs to be set in the
* ForumContext when a link is selected
*/
public boolean showThreadAlertsForAllForums() {
return ((Boolean) get(m_showAllThreadAlerts)).booleanValue();
}
/**
* if true, displays setup and permissions tabs
*
* @return
*/
public boolean showNewTabs() {
@ -285,9 +296,9 @@ public class ForumConfig extends AbstractConfig {
}
/**
* message added to the bottom of the moderation reection email.
* May give details about what the poster can do if not happy
* with rejection
* 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() {
@ -298,6 +309,22 @@ public class ForumConfig extends AbstractConfig {
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();
}
@ -305,5 +332,4 @@ public class ForumConfig extends AbstractConfig {
public boolean deleteNotifications() {
return ((Boolean) get(m_deleteSentSubscriptionNotifications)).booleanValue();
}
}

View File

@ -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.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.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]

View File

@ -18,7 +18,7 @@ forum.ui.no=Nein
forum.ui.thread.newPost=Neuer Beitrag
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.topic.description=Beschreibung