Index: lams_tool_forum/build.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/build.properties,v diff -u -r1.24.8.3 -r1.24.8.4 --- lams_tool_forum/build.properties 3 Mar 2011 19:43:35 -0000 1.24.8.3 +++ lams_tool_forum/build.properties 11 Apr 2011 05:18:15 -0000 1.24.8.4 @@ -9,7 +9,7 @@ ### project properties ### signature=lafrum11 project.displayname = lams forum tool -tool.version=20110228 +tool.version=20110408 # hide tool option hideTool=false Index: lams_tool_forum/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/conf/language/lams/ApplicationResources.properties,v diff -u -r1.31.4.3.2.8 -r1.31.4.3.2.9 --- lams_tool_forum/conf/language/lams/ApplicationResources.properties 3 Mar 2011 22:54:02 -0000 1.31.4.3.2.8 +++ lams_tool_forum/conf/language/lams/ApplicationResources.properties 11 Apr 2011 05:18:15 -0000 1.31.4.3.2.9 @@ -224,6 +224,16 @@ label.authoring.basic.do.you.want.to.delete =Do you really want to delete this topic? label.learning.number.of.votes ={0} / {1} votes label.authoring.advance.allow.rate.postings =Allow learners to rate each other's postings +monitor.summary.date.restriction =Date restriction +monitor.summary.when.date.restriction.is.set =Students will not be able to post messages after the set date and time. +monitor.summary.after.date =Date/time: +monitor.summary.set.restriction =Set restriction +monitor.summary.unset.restriction =Remove restriction +authoring.info.teacher.set.restriction =The teacher has set a restriction for posting message from {0}. +monitor.summary.notification =Notification +monitor.summary.date.restriction.set =Date restriction has been set +monitor.summary.date.restriction.removed =Date restriction has been removed + #======= End labels: Exported 218 labels for en AU ===== Index: lams_tool_forum/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/conf/language/lams/ApplicationResources_en_AU.properties,v diff -u -r1.28.4.3.2.8 -r1.28.4.3.2.9 --- lams_tool_forum/conf/language/lams/ApplicationResources_en_AU.properties 3 Mar 2011 22:54:02 -0000 1.28.4.3.2.8 +++ lams_tool_forum/conf/language/lams/ApplicationResources_en_AU.properties 11 Apr 2011 05:18:15 -0000 1.28.4.3.2.9 @@ -224,6 +224,15 @@ label.authoring.basic.do.you.want.to.delete =Do you really want to delete this topic? label.learning.number.of.votes ={0} / {1} votes label.authoring.advance.allow.rate.postings =Allow learners to rate each other's postings +monitor.summary.date.restriction =Date restriction +monitor.summary.when.date.restriction.is.set =Students will not be able to post messages after the set date and time. +monitor.summary.after.date =Date/time: +monitor.summary.set.restriction =Set restriction +monitor.summary.unset.restriction =Remove restriction +authoring.info.teacher.set.restriction =The teacher has set a restriction for posting message from {0}. +monitor.summary.notification =Notification +monitor.summary.date.restriction.set =Date restriction has been set +monitor.summary.date.restriction.removed =Date restriction has been removed #======= End labels: Exported 218 labels for en AU ===== Index: lams_tool_forum/conf/xdoclet/struts-actions.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/conf/xdoclet/struts-actions.xml,v diff -u -r1.47.8.2 -r1.47.8.3 --- lams_tool_forum/conf/xdoclet/struts-actions.xml 3 Mar 2011 19:43:34 -0000 1.47.8.2 +++ lams_tool_forum/conf/xdoclet/struts-actions.xml 11 Apr 2011 05:18:16 -0000 1.47.8.3 @@ -395,6 +395,11 @@ parameter="viewReflection"> + + + Index: lams_tool_forum/db/sql/create_lams_tool_forum.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/db/sql/create_lams_tool_forum.sql,v diff -u -r1.33.8.3 -r1.33.8.4 --- lams_tool_forum/db/sql/create_lams_tool_forum.sql 3 Mar 2011 19:43:34 -0000 1.33.8.3 +++ lams_tool_forum/db/sql/create_lams_tool_forum.sql 11 Apr 2011 05:18:16 -0000 1.33.8.4 @@ -50,6 +50,7 @@ notify_learners_on_forum_posting tinyint DEFAULT 0, notify_teachers_on_forum_posting tinyint DEFAULT 0, mark_release_notify tinyint DEFAULT 0, + submission_deadline datetime, primary key (uid) )TYPE=InnoDB; create table tl_lafrum11_forum_user ( Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dbupdates/patch20110228_updateTo236.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dbupdates/patch20110228_updateTo236.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dbupdates/patch20110228_updateTo236.sql 3 Mar 2011 19:41:21 -0000 1.1.2.1 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dbupdates/patch20110228_updateTo236.sql 11 Apr 2011 05:18:14 -0000 1.1.2.2 @@ -25,6 +25,11 @@ UPDATE lams_tool SET tool_version = "20110228" WHERE tool_signature = "lafrum11"; +-- LDEV-2657 +alter table tl_lafrum11_forum add column submission_deadline datetime default null; + +UPDATE lams_tool SET tool_version = "20110408" WHERE tool_signature = "lafrum11"; + ----------------------Put all sql statements above here------------------------- -- If there were no errors, commit and restore autocommit to on Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Forum.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Forum.java,v diff -u -r1.31.10.2 -r1.31.10.3 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Forum.java 3 Mar 2011 19:41:21 -0000 1.31.10.2 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Forum.java 11 Apr 2011 05:18:15 -0000 1.31.10.3 @@ -109,6 +109,8 @@ private boolean notifyLearnersOnForumPosting; private boolean notifyTeachersOnForumPosting; + + private Date submissionDeadline; // conditions private Set conditions = new TreeSet(new TextSearchConditionComparator()); @@ -663,4 +665,16 @@ public void setConditions(Set conditions) { this.conditions = conditions; } + + /** + * @hibernate.property column="submission_deadline" + * @return date submissionDeadline + */ + public Date getSubmissionDeadline() { + return submissionDeadline; + } + + public void setSubmissionDeadline(Date submissionDeadline) { + this.submissionDeadline = submissionDeadline; + } } Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java,v diff -u -r1.52.4.1.2.2 -r1.52.4.1.2.3 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java 3 Mar 2011 19:41:21 -0000 1.52.4.1.2.2 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java 11 Apr 2011 05:18:16 -0000 1.52.4.1.2.3 @@ -101,6 +101,12 @@ public static final String ATTR_USER_FINISHED = "userFinished"; + // for submission deadline LDEV-2657 + + public static final String ATTR_SUBMISSION_DEADLINE = "submissionDeadline"; + + public static final String ATTR_IS_SUBMISSION_DEADLINE_PASSED = "isSubmissionDeadlinePassed"; + // used in monitoring public static final String TITLE = "title"; Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java,v diff -u -r1.65.8.5 -r1.65.8.6 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java 24 Mar 2011 16:29:51 -0000 1.65.8.5 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java 11 Apr 2011 05:18:14 -0000 1.65.8.6 @@ -76,6 +76,7 @@ import org.lamsfoundation.lams.tool.forum.web.forms.ReflectionForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; @@ -196,12 +197,16 @@ LearningAction.log.error("Failed on getting session by given sessionID:" + sessionId); throw new Exception("Failed on getting session by given sessionID:" + sessionId); } - + + // get session from shared session. + HttpSession ss = SessionManager.getSession(); + + Forum forum = session.getForum(); //lock on finish ForumUser forumUser = getCurrentUser(request, sessionId); boolean lock = forum.getLockWhenFinished() && forumUser.isSessionFinished(); - + //set some option flag to HttpSession // if allowRichEditor = true then don't restrict the number of chars // if isLimitedInput = false then don't restrict the number of chars @@ -226,6 +231,7 @@ sessionMap.put(ForumConstants.ATTR_FORUM_INSTRCUTION, forum.getInstructions()); sessionMap.put(ForumConstants.ATTR_MINIMUM_REPLY, forum.getMinimumReply()); sessionMap.put(ForumConstants.ATTR_MAXIMUM_REPLY, forum.getMaximumReply()); + // Should we show the reflection or not? We shouldn't show it when the screen is accessed // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen. @@ -293,6 +299,24 @@ forumUser.getUserId().longValue(), IEventNotificationService.DELIVERY_METHOD_MAIL, IEventNotificationService.PERIODICITY_SINGLE); } + + // check if there is submission deadline + Date submissionDeadline = forum.getSubmissionDeadline(); + if (submissionDeadline != null) { + + sessionMap.put(ForumConstants.ATTR_SUBMISSION_DEADLINE, forum.getSubmissionDeadline()); + + UserDTO learnerDto = (UserDTO) ss.getAttribute(AttributeNames.USER); + TimeZone learnerTimeZone = learnerDto.getTimeZone(); + Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, submissionDeadline); + Date currentLearnerDate = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, new Date()); + + //calculate whether submission deadline has passed, and if so forward to "runOffline" + if (currentLearnerDate.after(tzSubmissionDeadline)) { + return mapping.findForward("runOffline"); + } + + } return mapping.findForward("success"); } Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/MonitoringAction.java,v diff -u -r1.39.6.3.4.2 -r1.39.6.3.4.3 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/MonitoringAction.java 24 Mar 2011 16:29:51 -0000 1.39.6.3.4.2 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/MonitoringAction.java 11 Apr 2011 05:18:14 -0000 1.39.6.3.4.3 @@ -32,6 +32,7 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.Date; +import java.util.TimeZone; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -40,6 +41,7 @@ import java.util.TreeMap; import java.util.TreeSet; +import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -71,14 +73,17 @@ import org.lamsfoundation.lams.tool.forum.util.ForumWebUtils; import org.lamsfoundation.lams.tool.forum.web.forms.ForumForm; import org.lamsfoundation.lams.tool.forum.web.forms.MarkForm; +import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.util.MessageService; import org.lamsfoundation.lams.util.NumberUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; +import org.lamsfoundation.lams.web.session.SessionManager; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; + public class MonitoringAction extends Action { private static Logger log = Logger.getLogger(MonitoringAction.class); @@ -168,6 +173,11 @@ if (param.equals("viewReflection")) { return viewReflection(mapping, form, request, response); } + + // **************** Date restriction ***************** + if (param.equals("setSubmissionDeadline")) { + return setSubmissionDeadline(mapping, form, request, response); + } return mapping.findForward("error"); } @@ -210,13 +220,28 @@ Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); forumService = getForumService(); + + // get session from shared session. + HttpSession ss = SessionManager.getSession(); + List sessionsList = forumService.getSessionsByContentId(toolContentID); // A forum clone required for listing the advanced options LDEV-1662 Forum forumClone = null; + // check if there is submission deadline + Date submissionDeadline = forumService.getForumByContentId(toolContentID).getSubmissionDeadline(); + + if (submissionDeadline != null) { + org.lamsfoundation.lams.usermanagement.dto.UserDTO learnerDto = (org.lamsfoundation.lams.usermanagement.dto.UserDTO) ss.getAttribute(AttributeNames.USER); + TimeZone learnerTimeZone = learnerDto.getTimeZone(); + Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, submissionDeadline); + request.setAttribute(ForumConstants.ATTR_SUBMISSION_DEADLINE, tzSubmissionDeadline.getTime()); + } + + Map sessionUsersMap = new TreeMap(this.new SessionDTOComparator()); - // build a map with all users in the submitFilesSessionList + // build a map with all users in the forumSessionList Iterator it = sessionsList.iterator(); while (it.hasNext()) { SessionDTO sessionDto = new SessionDTO(); @@ -225,6 +250,7 @@ if (forumClone == null) { forumClone = (Forum) fts.getForum().clone(); + MonitoringAction.log.info(forumClone.toString()); request.setAttribute("forum", forumClone); } @@ -793,7 +819,40 @@ } } + + /** + * Set Submission Deadline + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + public ActionForward setSubmissionDeadline(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + forumService = getForumService(); + + Long contentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); + Forum forum = forumService.getForumByContentId(contentID); + + Long dateParameter = WebUtil.readLongParam(request, ForumConstants.ATTR_SUBMISSION_DEADLINE, true); + Date tzSubmissionDeadline = null; + if (dateParameter != null) { + Date submissionDeadline = new Date(dateParameter); + HttpSession ss = SessionManager.getSession(); + org.lamsfoundation.lams.usermanagement.dto.UserDTO teacher = (org.lamsfoundation.lams.usermanagement.dto.UserDTO) ss.getAttribute(AttributeNames.USER); + TimeZone teacherTimeZone = teacher.getTimeZone(); + tzSubmissionDeadline = DateUtil.convertFromTimeZoneToDefault(teacherTimeZone, submissionDeadline); + } + forum.setSubmissionDeadline(tzSubmissionDeadline); + forumService.updateForum(forum); + return null; + } + + + // ========================================================================================== // Utility methods // ========================================================================================== Index: lams_tool_forum/web/common/tabbedheader.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/common/tabbedheader.jsp,v diff -u -r1.2 -r1.2.12.1 --- lams_tool_forum/web/common/tabbedheader.jsp 1 Oct 2006 22:33:21 -0000 1.2 +++ lams_tool_forum/web/common/tabbedheader.jsp 11 Apr 2011 05:18:17 -0000 1.2.12.1 @@ -30,7 +30,6 @@ - <%@ include file="/common/fckeditorheader.jsp"%> Index: lams_tool_forum/web/jsps/learning/runoffline.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/Attic/runoffline.jsp,v diff -u -r1.13.8.1 -r1.13.8.2 --- lams_tool_forum/web/jsps/learning/runoffline.jsp 14 Sep 2009 05:23:09 -0000 1.13.8.1 +++ lams_tool_forum/web/jsps/learning/runoffline.jsp 11 Apr 2011 05:18:15 -0000 1.13.8.2 @@ -7,9 +7,20 @@ -

- -

+ + +

+ +

+
+ +
+ + + +
+
+
Index: lams_tool_forum/web/jsps/learning/viewforum.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/viewforum.jsp,v diff -u -r1.30.4.1.4.1 -r1.30.4.1.4.2 --- lams_tool_forum/web/jsps/learning/viewforum.jsp 14 Sep 2009 05:23:09 -0000 1.30.4.1.4.1 +++ lams_tool_forum/web/jsps/learning/viewforum.jsp 11 Apr 2011 05:18:15 -0000 1.30.4.1.4.2 @@ -13,6 +13,13 @@
+ +
+ + + +
+
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_forum/web/jsps/monitoring/daterestriction.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_forum/web/jsps/monitoring/summary.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/monitoring/summary.jsp,v diff -u -r1.15.10.2 -r1.15.10.3 --- lams_tool_forum/web/jsps/monitoring/summary.jsp 3 Mar 2011 19:43:35 -0000 1.15.10.2 +++ lams_tool_forum/web/jsps/monitoring/summary.jsp 11 Apr 2011 05:18:16 -0000 1.15.10.3 @@ -3,7 +3,30 @@ - + + + + + + + + + + + + + + -

+

@@ -293,6 +382,8 @@ +<%@include file="daterestriction.jsp"%> +