|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.locomotive.loco.handler.GenericHandler | +--org.locomotive.module.discuss.DiscussionHandler
This class is the main handler class for The Locomotive Discussion system. The Locomotive Discussion system is a simple three-level web-based conferencing system for hosting non-threaded discussions. This particular class directs the appropriate requests to the appropriate Handlers and provides a number of utility methods for use by those handlers. The templates used for the various URL's handled by this class are listed under the handleRequest method.
handleRequest
Field Summary | |
protected static DiscussionLib |
lib
|
static int |
numPostsToDisplay
SET THIS TO DETERMINE THE NUMBER OF POSTS TO DISPLAY ON THE PAGE |
Fields inherited from class org.locomotive.loco.handler.GenericHandler |
already_displayed_page,
conn,
DEBUG,
ERROR,
form_data,
handler_uri,
hd,
NORMAL,
session,
steam_vars,
url_tokens,
user,
WARNING |
Constructor Summary | |
DiscussionHandler()
|
Method Summary | |
protected void |
addPost()
This method handles adding a post to a topic. |
protected void |
addTopic()
This method handles adding a topic to a category. |
void |
handleRequest(HandlerData hd_in)
The main method to call for this Handler. |
boolean |
init(Log log)
The required init method, as defined in org.locomotive.loco.Handler. |
protected static void |
insertTemplate(HandlerData hd,
java.lang.String key)
evaluate a template using the template path from the template hash and flush the template through hd.resp. |
protected SortableTable |
permPruneCategoriesTable(SortableTable categoriesTable)
Permission prune the categories table, removing the categories for which this user does not have read permission. |
protected SortableTable |
permPruneTopicsTable(SortableTable topicsTable)
|
protected void |
showCategory()
This method displays the Discussion cateogory page, which shows a list of the topics in that category. |
protected void |
showDefault()
This method displays the default Discussion Page, which contains a list of categories to choose from along with choices on where to go. |
protected void |
showSummary()
This method shows a summary of posts for a given topic. |
protected void |
showTopic()
This method displays the topic page, which contains a set of the posts for that topic. |
boolean |
shutdown(Log log)
The required shutdown method, as defined in org.locomotive.loco.Handler. |
Methods inherited from class org.locomotive.loco.handler.GenericHandler |
displayPage,
displayString,
handleException,
log,
logEvent,
sayBadURL |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected static DiscussionLib lib
public static final int numPostsToDisplay
Constructor Detail |
public DiscussionHandler()
Method Detail |
public void handleRequest(HandlerData hd_in)
Token Method Template CMCAT showCategory() discuss/community/comm_disc.tmpl CMTOP showTopic() discuss/community/comm_disc_topic.tmpl POST addPost() discuss/community/comm_disc_topic.tmpl TOPIC addTopic() discuss/community/comm_disc_topic_new.tmpl SUMMARY showSummary() discuss/community/comm_disc_topic_sum.tmpl Admin see handleAdminHandler() [no token] showDefault() discuss/community/comm_section.tmpl
protected void showDefault()
Puts the following subs into the environment:
categories_table SortableTable with columns: id, title, description num_posts_to_display the number of posts to display on the topics page
protected void showCategory()
Puts the following subs into the environment:
navigation the html for the navigation sidebar category_info SortableTable with columns: id, title, description, topic_count, post_count, last_post_date topics_table SortableTable with columns: topicid, communityid, topicname, post_count, last_post_date num_posts_to_display the number of posts to display on the topics page
protected void showTopic()
Community?CMTOP+<topicID>+<numberOfPostsToDisplay>+<postStartNum>where the topicID is the unique topic id number for the topic whose posts the page show display, the postStartNum is the post number to start on, and the numberOfPostsToDisplay is the number of posts to display on the page.
Note that this method displays the posts in descending order, so that a URL of Community?CMTOP+2+10+192 would display posts 183 to 192 from top to bottom on the first page, and the URL of Community?CMTOP+2+10+182 would display posts 173 to 182 from the top to the bottom of the page.
The defaults for these values are the latest post for postStartNum, and 10 for numberOfPostsToDisplay, so the URL Community?CMTOP+2 evaluates to Community?CMTOP+2+10+192, if 192 is the number of the latest post.
This method also inserts into steam_vars an array of urls to all the pages that would be generated to see all the posts for the current topic, at the current numberOfPostsToDisplay token. Thus, the first example above would provide an array of 20 urls which would point to each page needed to display all the posts. Note that The page designer, using the [loop ] expression, can display as many or all of these as he or she would like. See the steam documentation for more on this.
Puts the following subs into the environment:
navigation the html for the navigation sidebar category_info SortableTable with columns: id, title, description, topic_count, post_count, last_post_date topic_info SortableTable with columns: topicid, communityid, topicname, post_count, last_post_date post_table SortableTable with columns: postid, posttitle, postbody, postauthorfn, postauthorln, postemail, postdate post_links Array of strings that provide the links to each page of posts num_posts_to_display the number of posts to display on the topics page
protected void addTopic()
Puts the following subs into the environment:
category_info SortableTable with columns: id, title, description, topic_count, post_count, last_post_date topic_info SortableTable with columns: topicid, communityid, topicname, post_count, last_post_date, error_msg Message if topic could not be added num_posts_to_display the number of posts to display on the topics page
protected void addPost()
Puts the following subs into the environment:
These are added only if there was an error adding the post: error_msg an error explaining why post could not be added post_title title entered for the failed post post_body body entered for the failed post firstname first name entered the for the failed post lastname last name entered for the failed post email email entered for the failed post num_posts_to_display the number of posts to display on the topics page
protected void showSummary()
Community?SUMMARY+<topicID>+<displayOrder>The order token may be either DATE, POST, or AUTHOR. Thus an example summary URL might look like: Community?SUMMARY+174+AUTHOR.
Puts the following subs into the environment:
navigation the html for the navigation sidebar post_summaries SortableTable with columns: postid, posttitle, postauthorfn, postauthorln, postemail, postdate topic_info SortableTable with columns: topicid, communityid, topicname category_info SortableTable with columns: id, title, description, topic_count, post_count, last_post_date post_links an array containing the post numbers to show at the bottom of the topics page when the links for each post are followed num_posts_to_display the number of posts to display on the topics page
protected static void insertTemplate(HandlerData hd, java.lang.String key)
key
- the key to use to get the template path from the hashprotected SortableTable permPruneCategoriesTable(SortableTable categoriesTable)
categoriesTable
- SortableTable containing the categoriesprotected SortableTable permPruneTopicsTable(SortableTable topicsTable)
public boolean init(Log log)
org.locomotive.loco.Handler
public boolean shutdown(Log log)
org.locomotive.loco.Handler#shutdown
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |