Index: lams_tool_forum/db/model/forum.clay =================================================================== diff -u -rf88a2a4d76c8b1b50ef5a09a64c0564cc929cf11 -rdc2c4669a29d722cfee09e59636ea9677dcdf64d --- lams_tool_forum/db/model/forum.clay (.../forum.clay) (revision f88a2a4d76c8b1b50ef5a09a64c0564cc929cf11) +++ lams_tool_forum/db/model/forum.clay (.../forum.clay) (revision dc2c4669a29d722cfee09e59636ea9677dcdf64d) @@ -14,7 +14,7 @@ - + @@ -140,7 +140,7 @@
- + @@ -332,7 +332,7 @@
- + @@ -390,7 +390,7 @@
- + @@ -411,6 +411,12 @@ + + + + + + @@ -495,7 +501,7 @@ - + @@ -521,32 +527,19 @@ - - - - - - - - - - - - - - + - + @@ -562,18 +555,11 @@ - + - - - - - - - @@ -601,23 +587,19 @@ - + - - - -
- + @@ -710,7 +692,7 @@
- + Index: lams_tool_forum/db/sql/create_lams_tool_forum.sql =================================================================== diff -u -rf88a2a4d76c8b1b50ef5a09a64c0564cc929cf11 -rdc2c4669a29d722cfee09e59636ea9677dcdf64d --- lams_tool_forum/db/sql/create_lams_tool_forum.sql (.../create_lams_tool_forum.sql) (revision f88a2a4d76c8b1b50ef5a09a64c0564cc929cf11) +++ lams_tool_forum/db/sql/create_lams_tool_forum.sql (.../create_lams_tool_forum.sql) (revision dc2c4669a29d722cfee09e59636ea9677dcdf64d) @@ -5,12 +5,6 @@ drop table if exists tl_lafrum11_message; drop table if exists tl_lafrum11_message_seq; drop table if exists tl_lafrum11_tool_session; -drop table if exists tl_lafrum11_attachment; -drop table if exists tl_lafrum11_forum; -drop table if exists tl_lafrum11_forum_user; -drop table if exists tl_lafrum11_message; -drop table if exists tl_lafrum11_message_seq; -drop table if exists tl_lafrum11_tool_session; create table tl_lafrum11_attachment ( uid bigint not null auto_increment, file_version_id bigint, @@ -51,6 +45,7 @@ create table tl_lafrum11_message ( uid bigint not null auto_increment, create_date datetime, + last_reply_date datetime, update_date datetime, create_by bigint, modified_by bigint, @@ -59,9 +54,8 @@ is_authored bit, is_anonymous bit, forum_session_uid bigint, - user_uid bigint, - forum_uid bigint, parent_uid bigint, + forum_uid bigint, primary key (uid) ); create table tl_lafrum11_message_seq ( @@ -85,12 +79,12 @@ alter table tl_lafrum11_message add index FK4A6067E8E42F4351 (create_by), add constraint FK4A6067E8E42F4351 foreign key (create_by) references tl_lafrum11_forum_user (uid); alter table tl_lafrum11_message add index FK4A6067E8131CE31E (forum_uid), add constraint FK4A6067E8131CE31E foreign key (forum_uid) references tl_lafrum11_forum (uid); alter table tl_lafrum11_message add index FK4A6067E824089E4D (parent_uid), add constraint FK4A6067E824089E4D foreign key (parent_uid) references tl_lafrum11_message (uid); -alter table tl_lafrum11_message add index FK4A6067E8C6FF3C72 (forum_session_uid), add constraint FK4A6067E8C6FF3C72 foreign key (forum_session_uid) references tl_lafrum11_tool_session (uid); +alter table tl_lafrum11_message add index FK4A6067E89357B45B (forum_session_uid), add constraint FK4A6067E89357B45B foreign key (forum_session_uid) references tl_lafrum11_tool_session (uid); alter table tl_lafrum11_message add index FK4A6067E8647A7264 (modified_by), add constraint FK4A6067E8647A7264 foreign key (modified_by) references tl_lafrum11_forum_user (uid); -alter table tl_lafrum11_message add index FK4A6067E8B0A7E6B3 (user_uid), add constraint FK4A6067E8B0A7E6B3 foreign key (user_uid) references tl_lafrum11_forum_user (uid); alter table tl_lafrum11_message_seq add index FKD2C71F88FE939F2A (message_uid), add constraint FKD2C71F88FE939F2A foreign key (message_uid) references tl_lafrum11_message (uid); alter table tl_lafrum11_message_seq add index FKD2C71F8845213B4D (root_message_uid), add constraint FKD2C71F8845213B4D foreign key (root_message_uid) references tl_lafrum11_message (uid); alter table tl_lafrum11_tool_session add index FK5A04D7AE131CE31E (forum_uid), add constraint FK5A04D7AE131CE31E foreign key (forum_uid) references tl_lafrum11_forum (uid); INSERT INTO tl_lafrum11_forum (title,instructions,online_instructions,offline_instructions,content_id,allow_anonym,run_offline,lock_on_finished,content_in_use,define_later,allow_edit,allow_rich_editor) VALUES("LAMS Forum","Instruction","Online instruction","Offline instruction",1,0,0,0,0,0,0,0); +INSERT INTO tl_lafrum11_tool_session (forum_uid,session_id,status) VALUES(1,1,0); SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file Index: lams_tool_forum/db/sql/table-schema.sql =================================================================== diff -u -rf88a2a4d76c8b1b50ef5a09a64c0564cc929cf11 -rdc2c4669a29d722cfee09e59636ea9677dcdf64d --- lams_tool_forum/db/sql/table-schema.sql (.../table-schema.sql) (revision f88a2a4d76c8b1b50ef5a09a64c0564cc929cf11) +++ lams_tool_forum/db/sql/table-schema.sql (.../table-schema.sql) (revision dc2c4669a29d722cfee09e59636ea9677dcdf64d) @@ -3,9 +3,8 @@ alter table tl_lafrum11_message drop foreign key FK4A6067E8E42F4351; alter table tl_lafrum11_message drop foreign key FK4A6067E8131CE31E; alter table tl_lafrum11_message drop foreign key FK4A6067E824089E4D; -alter table tl_lafrum11_message drop foreign key FK4A6067E8C6FF3C72; +alter table tl_lafrum11_message drop foreign key FK4A6067E89357B45B; alter table tl_lafrum11_message drop foreign key FK4A6067E8647A7264; -alter table tl_lafrum11_message drop foreign key FK4A6067E8B0A7E6B3; alter table tl_lafrum11_message_seq drop foreign key FKD2C71F88FE939F2A; alter table tl_lafrum11_message_seq drop foreign key FKD2C71F8845213B4D; alter table tl_lafrum11_tool_session drop foreign key FK5A04D7AE131CE31E; @@ -55,6 +54,7 @@ create table tl_lafrum11_message ( uid bigint not null auto_increment, create_date datetime, + last_reply_date datetime, update_date datetime, create_by bigint, modified_by bigint, @@ -63,9 +63,8 @@ is_authored bit, is_anonymous bit, forum_session_uid bigint, - user_uid bigint, - forum_uid bigint, parent_uid bigint, + forum_uid bigint, primary key (uid) ); create table tl_lafrum11_message_seq ( @@ -89,9 +88,8 @@ alter table tl_lafrum11_message add index FK4A6067E8E42F4351 (create_by), add constraint FK4A6067E8E42F4351 foreign key (create_by) references tl_lafrum11_forum_user (uid); alter table tl_lafrum11_message add index FK4A6067E8131CE31E (forum_uid), add constraint FK4A6067E8131CE31E foreign key (forum_uid) references tl_lafrum11_forum (uid); alter table tl_lafrum11_message add index FK4A6067E824089E4D (parent_uid), add constraint FK4A6067E824089E4D foreign key (parent_uid) references tl_lafrum11_message (uid); -alter table tl_lafrum11_message add index FK4A6067E8C6FF3C72 (forum_session_uid), add constraint FK4A6067E8C6FF3C72 foreign key (forum_session_uid) references tl_lafrum11_tool_session (uid); +alter table tl_lafrum11_message add index FK4A6067E89357B45B (forum_session_uid), add constraint FK4A6067E89357B45B foreign key (forum_session_uid) references tl_lafrum11_tool_session (uid); alter table tl_lafrum11_message add index FK4A6067E8647A7264 (modified_by), add constraint FK4A6067E8647A7264 foreign key (modified_by) references tl_lafrum11_forum_user (uid); -alter table tl_lafrum11_message add index FK4A6067E8B0A7E6B3 (user_uid), add constraint FK4A6067E8B0A7E6B3 foreign key (user_uid) references tl_lafrum11_forum_user (uid); alter table tl_lafrum11_message_seq add index FKD2C71F88FE939F2A (message_uid), add constraint FKD2C71F88FE939F2A foreign key (message_uid) references tl_lafrum11_message (uid); alter table tl_lafrum11_message_seq add index FKD2C71F8845213B4D (root_message_uid), add constraint FKD2C71F8845213B4D foreign key (root_message_uid) references tl_lafrum11_message (uid); alter table tl_lafrum11_tool_session add index FK5A04D7AE131CE31E (forum_uid), add constraint FK5A04D7AE131CE31E foreign key (forum_uid) references tl_lafrum11_forum (uid); Index: lams_tool_forum/src/java/forumApplicationContext.xml =================================================================== diff -u -rcff06c3c3492ed5b4efc013a3e4d8b0f50933b93 -rdc2c4669a29d722cfee09e59636ea9677dcdf64d --- lams_tool_forum/src/java/forumApplicationContext.xml (.../forumApplicationContext.xml) (revision cff06c3c3492ed5b4efc013a3e4d8b0f50933b93) +++ lams_tool_forum/src/java/forumApplicationContext.xml (.../forumApplicationContext.xml) (revision dc2c4669a29d722cfee09e59636ea9677dcdf64d) @@ -38,13 +38,23 @@ - + + + + + + + + + + + @@ -65,6 +75,12 @@ + + + + + + Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java =================================================================== diff -u -rcff06c3c3492ed5b4efc013a3e4d8b0f50933b93 -rdc2c4669a29d722cfee09e59636ea9677dcdf64d --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java (.../ForumService.java) (revision cff06c3c3492ed5b4efc013a3e4d8b0f50933b93) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java (.../ForumService.java) (revision dc2c4669a29d722cfee09e59636ea9677dcdf64d) @@ -51,7 +51,7 @@ import org.lamsfoundation.lams.tool.forum.persistence.MessageSeqDao; import org.lamsfoundation.lams.tool.forum.util.ForumConstants; import org.lamsfoundation.lams.tool.forum.util.ForumToolContentHandler; -import org.lamsfoundation.lams.tool.forum.util.LastReplayDateComparator; +import org.lamsfoundation.lams.tool.forum.util.DateComparator; import org.lamsfoundation.lams.tool.forum.util.TopicComparator; import org.lamsfoundation.lams.usermanagement.User; @@ -70,7 +70,7 @@ private MessageDao messageDao; private MessageSeqDao messageSeqDao; private ForumUserDao forumUserDao; - private ForumToolSessionDao toolSessionDao; + private ForumToolSessionDao forumToolSessionDao; //system level handler and service private ForumToolContentHandler toolContentHandler; @@ -409,7 +409,7 @@ //sorted by last post date Message msg; - SortedMap map = new TreeMap(new LastReplayDateComparator()); + SortedMap map = new TreeMap(new DateComparator()); Iterator iter = topicsBySession.iterator(); while(iter.hasNext()){ msg = (Message) iter.next(); @@ -448,7 +448,7 @@ } public ForumToolSession getSessionBySessionId(Long sessionId) { - return toolSessionDao.getBySessionId(sessionId); + return forumToolSessionDao.getBySessionId(sessionId); } /** @@ -469,4 +469,20 @@ } return msgDtoList; } + + public MessageSeqDao getMessageSeqDao() { + return messageSeqDao; + } + + public void setMessageSeqDao(MessageSeqDao messageSeqDao) { + this.messageSeqDao = messageSeqDao; + } + + public ForumToolSessionDao getForumToolSessionDao() { + return forumToolSessionDao; + } + + public void setForumToolSessionDao(ForumToolSessionDao forumToolSessionDao) { + this.forumToolSessionDao = forumToolSessionDao; + } } Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/DateComparator.java =================================================================== diff -u --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/DateComparator.java (revision 0) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/DateComparator.java (revision dc2c4669a29d722cfee09e59636ea9677dcdf64d) @@ -0,0 +1,40 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *This program is free software; you can redistribute it and/or modify + *it under the terms of the GNU General Public License as published by + *the Free Software Foundation; either version 2 of the License, or + *(at your option) any later version. + * + *This program is distributed in the hope that it will be useful, + *but WITHOUT ANY WARRANTY; without even the implied warranty of + *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + *GNU General Public License for more details. + * + *You should have received a copy of the GNU General Public License + *along with this program; if not, write to the Free Software + *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + *USA + * + *http://www.gnu.org/licenses/gpl.txt + */ +package org.lamsfoundation.lams.tool.forum.util; + +import java.util.Comparator; +import java.util.Date; + +import org.apache.log4j.Logger; + +public class DateComparator implements Comparator { + + private static final Logger log = Logger.getLogger(DateComparator.class); + + public int compare(Object arg0, Object arg1) { + if(!(arg0 instanceof Date) || !(arg1 instanceof Date)){ + log.error("Topic is not Date instance."); + return 0; + } + return ((Date)arg0).after(((Date)arg0))?1:-1; + } + +} Fisheye: Tag dc2c4669a29d722cfee09e59636ea9677dcdf64d refers to a dead (removed) revision in file `lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/LastReplayDateComparator.java'. Fisheye: No comparison available. Pass `N' to diff?