Index: lams_tool_doku/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r5563dc18a8b8d19478fb804c8beef31e63bd249b -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_doku/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 5563dc18a8b8d19478fb804c8beef31e63bd249b) +++ lams_tool_doku/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -129,3 +129,14 @@ label.gallery.walk.state.started = started label.gallery.walk.state.finished = finished label.gallery.walk.state.learner.edit.enabled = , learners can modify answers +monitor.summary.date.restriction = Date and time restriction +monitor.summary.when.date.restriction.is.set = If a date and time restriction is set, learners will not be able to submit assignments after this date. +monitor.summary.after.date = Date and 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 submission from {0}. +label.sorry.the.deadline.has.passed = Sorry, the deadline to participate in this activity has passed. Please contact your teacher for further details. +monitor.summary.notification = Notification +monitor.summary.date.restriction.set = Date availability has been set +monitor.summary.date.restriction.removed = Date availability has been removed + Index: lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/DokumaranConstants.java =================================================================== diff -u -r0ebaba46f0ce87b5138e8e70cc1965887c1c7787 -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/DokumaranConstants.java (.../DokumaranConstants.java) (revision 0ebaba46f0ce87b5138e8e70cc1965887c1c7787) +++ lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/DokumaranConstants.java (.../DokumaranConstants.java) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -56,23 +56,23 @@ public static final String ATTR_TOOL_SESSION_ID = "toolSessionID"; public static final String ATTR_DOKUMARAN = "dokumaran"; - + public static final String ATTR_GROUP_USERS = "groupUsers"; - + public static final String ATTR_IS_LEADER_RESPONSE_FINALIZED = "isLeaderResponseFinalized"; public static final String ATTR_NEXT_ACTIVITY_URL = "nextActivityUrl"; public static final String ATTR_SUMMARY_LIST = "summaryList"; - + public static final String ATTR_HAS_FAULTY_SESSION = "hasFaultySession"; public static final String ATTR_USER_LIST = "userList"; public static final String ATTR_FINISH_LOCK = "finishedLock"; public static final String ATTR_LOCK_ON_FINISH = "lockOnFinish"; - + public static final String ATTR_HAS_EDIT_RIGHT = "hasEditRight"; public static final String ATTR_SESSION_MAP_ID = "sessionMapID"; @@ -90,17 +90,17 @@ public static final String ATTR_USER_FINISHED = "userFinished"; public static final String ATTR_IS_GROUPED_ACTIVITY = "isGroupedActivity"; - + public static final String ATTR_PAD_ID = "padId"; - + public static final String ATTR_SECONDS_LEFT = "secondsLeft"; - + public static final String KEY_ETHERPAD_SERVER_URL = "etherpadServerUrl"; - + public static final String DEFAULT_PAD_NAME = "LAMS-pad"; - + public static final String PREFIX_REGULAR_GROUP = "LAMS-group-"; - + public static final String PREFIX_SHARED_GROUP = "LAMS-sharedGroup-"; // error message keys @@ -120,4 +120,8 @@ public static final String ATTR_USER_UID = "userUid"; public static final String MANUAL_GRADING_DEFINITION_NAME = "manual.grading"; + + public static final String ATTR_SUBMISSION_DEADLINE = "submissionDeadline"; + + public static final String ATTR_SUBMISSION_DEADLINE_DATESTRING = "submissionDateString"; } Index: lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/dbupdates/patch20221116.sql =================================================================== diff -u --- lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/dbupdates/patch20221116.sql (revision 0) +++ lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/dbupdates/patch20221116.sql (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -0,0 +1,14 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +-- Put all sql statements below here + +-- LDEV-5331 Add submission deadline +ALTER TABLE tl_ladoku11_dokumaran ADD COLUMN submission_deadline DATETIME AFTER reflect_on_activity; + +-- Put all sql statements above here + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; Index: lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/model/Dokumaran.java =================================================================== diff -u -r5d95aefac93918b2ff1904e78f59eceb024b2583 -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/model/Dokumaran.java (.../Dokumaran.java) (revision 5d95aefac93918b2ff1904e78f59eceb024b2583) +++ lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/model/Dokumaran.java (.../Dokumaran.java) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -83,6 +83,9 @@ @Column(name = "allow_multiple_leaders") private boolean allowMultipleLeaders; + @Column(name = "submission_deadline") + private Date submissionDeadline; + @Column(name = "relative_time_limit") private int relativeTimeLimit; @@ -358,6 +361,14 @@ this.contentId = contentId; } + public Date getSubmissionDeadline() { + return submissionDeadline; + } + + public void setSubmissionDeadline(Date submissionDeadline) { + this.submissionDeadline = submissionDeadline; + } + /** * @return Returns the time limitation, that students have to complete an attempt. */ Index: lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/controller/LearningController.java =================================================================== diff -u -ra3b7d85bf0348714e0486955b9280b6b7de46438 -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/controller/LearningController.java (.../LearningController.java) (revision a3b7d85bf0348714e0486955b9280b6b7de46438) +++ lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/controller/LearningController.java (.../LearningController.java) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -30,6 +30,7 @@ import java.util.Date; import java.util.List; import java.util.Set; +import java.util.TimeZone; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -53,6 +54,7 @@ import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; +import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -229,6 +231,24 @@ return "pages/learning/definelater"; } + //check if there is submission deadline + Date submissionDeadline = dokumaran.getSubmissionDeadline(); + if (submissionDeadline != null) { + //store submission deadline to sessionMap + sessionMap.put(DokumaranConstants.ATTR_SUBMISSION_DEADLINE, submissionDeadline); + if (currentUserDto == null) { + currentUserDto = (UserDTO) ss.getAttribute(AttributeNames.USER); + } + TimeZone learnerTimeZone = currentUserDto.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 "submissionDeadline" + if (currentLearnerDate.after(tzSubmissionDeadline)) { + return "pages/learning/submissionDeadline"; + } + } + // set contentInUse flag to true! dokumaran.setContentInUse(true); dokumaran.setDefineLater(false); Index: lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/controller/MonitoringController.java =================================================================== diff -u -rf3e44aee5373a1233080ea5acd1cb5959bb46544 -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/controller/MonitoringController.java (.../MonitoringController.java) (revision f3e44aee5373a1233080ea5acd1cb5959bb46544) +++ lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/controller/MonitoringController.java (.../MonitoringController.java) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -30,10 +30,12 @@ import java.time.OffsetDateTime; import java.util.Collections; import java.util.Comparator; +import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TimeZone; import java.util.TreeMap; import java.util.TreeSet; import java.util.stream.Collectors; @@ -65,6 +67,7 @@ import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; +import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.util.MessageService; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.session.SessionManager; @@ -73,6 +76,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -139,6 +143,19 @@ Dokumaran dokumaran = dokumaranService.getDokumaranByContentId(contentId); + //set SubmissionDeadline, if any + if (dokumaran.getSubmissionDeadline() != null) { + Date submissionDeadline = dokumaran.getSubmissionDeadline(); + HttpSession ss = SessionManager.getSession(); + UserDTO teacher = (UserDTO) ss.getAttribute(AttributeNames.USER); + TimeZone teacherTimeZone = teacher.getTimeZone(); + Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(teacherTimeZone, submissionDeadline); + request.setAttribute(DokumaranConstants.ATTR_SUBMISSION_DEADLINE, tzSubmissionDeadline.getTime()); + // use the unconverted time, as convertToStringForJSON() does the timezone conversion if needed + request.setAttribute(DokumaranConstants.ATTR_SUBMISSION_DEADLINE_DATESTRING, + DateUtil.convertToStringForJSON(submissionDeadline, request.getLocale())); + } + // Create reflectList if reflection is enabled. if (dokumaran.isReflectOnActivity()) { List relectList = dokumaranService.getReflectList(contentId); @@ -478,6 +495,33 @@ dokumaranService.saveOrUpdate(dokumaran); } + /** + * Set Submission Deadline + */ + @RequestMapping(path = "/setSubmissionDeadline", method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) + @ResponseBody + public String setSubmissionDeadline(HttpServletRequest request) { + Long contentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); + Dokumaran dokumaran = dokumaranService.getDokumaranByContentId(contentID); + + Long dateParameter = WebUtil.readLongParam(request, DokumaranConstants.ATTR_SUBMISSION_DEADLINE, true); + Date tzSubmissionDeadline = null; + String formattedDate = ""; + if (dateParameter != null) { + Date submissionDeadline = new Date(dateParameter); + HttpSession ss = SessionManager.getSession(); + UserDTO teacher = (UserDTO) ss.getAttribute(AttributeNames.USER); + TimeZone teacherTimeZone = teacher.getTimeZone(); + tzSubmissionDeadline = DateUtil.convertFromTimeZoneToDefault(teacherTimeZone, submissionDeadline); + formattedDate = DateUtil.convertToStringForJSON(tzSubmissionDeadline, request.getLocale()); + + } + dokumaran.setSubmissionDeadline(tzSubmissionDeadline); + dokumaranService.saveOrUpdate(dokumaran); + + return formattedDate; + } + private Integer getUserId() { HttpSession ss = SessionManager.getSession(); UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); Index: lams_tool_doku/web/pages/learning/learning.jsp =================================================================== diff -u -r6e5200081bea4aa28f0ce8ac227c6220fd498a51 -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_doku/web/pages/learning/learning.jsp (.../learning.jsp) (revision 6e5200081bea4aa28f0ce8ac227c6220fd498a51) +++ lams_tool_doku/web/pages/learning/learning.jsp (.../learning.jsp) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -220,7 +220,14 @@ - + + + + + + + + Index: lams_tool_doku/web/pages/learning/submissionDeadline.jsp =================================================================== diff -u --- lams_tool_doku/web/pages/learning/submissionDeadline.jsp (revision 0) +++ lams_tool_doku/web/pages/learning/submissionDeadline.jsp (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -0,0 +1,83 @@ + +<%@include file="/common/taglibs.jsp"%> + + + + + <%@ include file="/common/header.jsp"%> + <fmt:message key="label.learning.title" /> + + + + + + + + + + + + +
+

+ ${sessionMap.reflectInstructions} +

+ + + +

+ + +

+
+ +

+ +

+
+
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + +
+ + +
+ +
Index: lams_tool_doku/web/pages/monitoring/dateRestriction.jsp =================================================================== diff -u --- lams_tool_doku/web/pages/monitoring/dateRestriction.jsp (revision 0) +++ lams_tool_doku/web/pages/monitoring/dateRestriction.jsp (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -0,0 +1,36 @@ +<%@include file="/common/taglibs.jsp"%> + + + + +
+ +
+ +
style="display: none;" > +
+ + + + + +
+
+ +
style="display: none;" > + + + + + +
+ +
\ No newline at end of file Index: lams_tool_doku/web/pages/monitoring/summary.jsp =================================================================== diff -u -rc0283ff52f11937eaf098f9273aa448449997e96 -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_doku/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision c0283ff52f11937eaf098f9273aa448449997e96) +++ lams_tool_doku/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -19,6 +19,7 @@ + + + + @@ -615,8 +631,10 @@ <%@ include file="advanceoptions.jsp"%> - +
+ + <%@ include file="dateRestriction.jsp"%>
\ No newline at end of file Index: lams_tool_whiteboard/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r5563dc18a8b8d19478fb804c8beef31e63bd249b -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_whiteboard/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 5563dc18a8b8d19478fb804c8beef31e63bd249b) +++ lams_tool_whiteboard/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -126,3 +126,13 @@ label.gallery.walk.state.started = started label.gallery.walk.state.finished = finished label.gallery.walk.state.learner.edit.enabled = , learners can modify answers +monitor.summary.date.restriction = Date and time restriction +monitor.summary.when.date.restriction.is.set = If a date and time restriction is set, learners will not be able to submit assignments after this date. +monitor.summary.after.date = Date and 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 submission from {0}. +label.sorry.the.deadline.has.passed = Sorry, the deadline to participate in this activity has passed. Please contact your teacher for further details. +monitor.summary.notification = Notification +monitor.summary.date.restriction.set = Date availability has been set +monitor.summary.date.restriction.removed = Date availability has been removed \ No newline at end of file Index: lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/WhiteboardConstants.java =================================================================== diff -u -r9bf6bd63c0898b92badeafa0b421879d295d953e -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/WhiteboardConstants.java (.../WhiteboardConstants.java) (revision 9bf6bd63c0898b92badeafa0b421879d295d953e) +++ lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/WhiteboardConstants.java (.../WhiteboardConstants.java) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -41,19 +41,19 @@ public static final String ATTR_TOOL_CONTENT_ID = "toolContentID"; public static final String ATTR_WHITEBOARD = "whiteboard"; - + public static final String ATTR_GROUP_USERS = "groupUsers"; - + public static final String ATTR_IS_LEADER_RESPONSE_FINALIZED = "isLeaderResponseFinalized"; public static final String ATTR_NEXT_ACTIVITY_URL = "nextActivityUrl"; public static final String ATTR_SUMMARY_LIST = "summaryList"; - + public static final String ATTR_FINISH_LOCK = "finishedLock"; public static final String ATTR_LOCK_ON_FINISH = "lockOnFinish"; - + public static final String ATTR_HAS_EDIT_RIGHT = "hasEditRight"; public static final String ATTR_SESSION_MAP_ID = "sessionMapID"; @@ -79,4 +79,8 @@ public static final String ATTR_REFLECT_LIST = "reflectList"; public static final String MANUAL_GRADING_DEFINITION_NAME = "manual.grading"; -} + + public static final String ATTR_SUBMISSION_DEADLINE = "submissionDeadline"; + + public static final String ATTR_SUBMISSION_DEADLINE_DATESTRING = "submissionDateString"; +} \ No newline at end of file Index: lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/dbupdates/patch20221116.sql =================================================================== diff -u --- lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/dbupdates/patch20221116.sql (revision 0) +++ lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/dbupdates/patch20221116.sql (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -0,0 +1,14 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +-- Put all sql statements below here + +-- LDEV-5331 Add submission deadline +ALTER TABLE tl_lawhiteboard11_whiteboard ADD COLUMN submission_deadline DATETIME AFTER reflect_on_activity; + +-- Put all sql statements above here + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; Index: lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/model/Whiteboard.java =================================================================== diff -u -r5d95aefac93918b2ff1904e78f59eceb024b2583 -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/model/Whiteboard.java (.../Whiteboard.java) (revision 5d95aefac93918b2ff1904e78f59eceb024b2583) +++ lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/model/Whiteboard.java (.../Whiteboard.java) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -71,6 +71,9 @@ @Column(name = "use_select_leader_tool_ouput") private boolean useSelectLeaderToolOuput; + @Column(name = "submission_deadline") + private Date submissionDeadline; + @Column(name = "relative_time_limit") private int relativeTimeLimit; @@ -304,6 +307,14 @@ this.contentId = contentId; } + public Date getSubmissionDeadline() { + return submissionDeadline; + } + + public void setSubmissionDeadline(Date submissionDeadline) { + this.submissionDeadline = submissionDeadline; + } + /** * @return Returns the time limitation, that students have to complete an attempt. */ Index: lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/web/controller/LearningController.java =================================================================== diff -u -rf9be6342ddca0a8816c2017806cb7f7d45436561 -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/web/controller/LearningController.java (.../LearningController.java) (revision f9be6342ddca0a8816c2017806cb7f7d45436561) +++ lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/web/controller/LearningController.java (.../LearningController.java) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -30,6 +30,7 @@ import java.util.Date; import java.util.List; import java.util.Set; +import java.util.TimeZone; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -50,6 +51,7 @@ import org.lamsfoundation.lams.tool.whiteboard.web.form.ReflectionForm; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -204,12 +206,30 @@ boolean isLeaderResponseFinalized = session != null && leader != null && leader.isSessionFinished(); sessionMap.put(WhiteboardConstants.ATTR_IS_LEADER_RESPONSE_FINALIZED, isLeaderResponseFinalized); } - + // add define later support if (whiteboard.isDefineLater()) { return "pages/learning/definelater"; } + //check if there is submission deadline + Date submissionDeadline = whiteboard.getSubmissionDeadline(); + if (submissionDeadline != null) { + //store submission deadline to sessionMap + sessionMap.put(WhiteboardConstants.ATTR_SUBMISSION_DEADLINE, submissionDeadline); + if (currentUserDto == null) { + currentUserDto = (UserDTO) ss.getAttribute(AttributeNames.USER); + } + TimeZone learnerTimeZone = currentUserDto.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 "submissionDeadline" + if (currentLearnerDate.after(tzSubmissionDeadline)) { + return "pages/learning/submissionDeadline"; + } + } + // set contentInUse flag to true! whiteboard.setContentInUse(true); whiteboard.setDefineLater(false); Index: lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/web/controller/MonitoringController.java =================================================================== diff -u -rf3e44aee5373a1233080ea5acd1cb5959bb46544 -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/web/controller/MonitoringController.java (.../MonitoringController.java) (revision f3e44aee5373a1233080ea5acd1cb5959bb46544) +++ lams_tool_whiteboard/src/java/org/lamsfoundation/lams/tool/whiteboard/web/controller/MonitoringController.java (.../MonitoringController.java) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -30,10 +30,12 @@ import java.time.OffsetDateTime; import java.util.Collections; import java.util.Comparator; +import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TimeZone; import java.util.TreeMap; import java.util.TreeSet; import java.util.stream.Collectors; @@ -64,6 +66,7 @@ import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; +import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.util.MessageService; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.session.SessionManager; @@ -72,6 +75,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -137,6 +141,19 @@ Whiteboard whiteboard = whiteboardService.getWhiteboardByContentId(contentId); + //set SubmissionDeadline, if any + if (whiteboard.getSubmissionDeadline() != null) { + Date submissionDeadline = whiteboard.getSubmissionDeadline(); + HttpSession ss = SessionManager.getSession(); + UserDTO teacher = (UserDTO) ss.getAttribute(AttributeNames.USER); + TimeZone teacherTimeZone = teacher.getTimeZone(); + Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(teacherTimeZone, submissionDeadline); + request.setAttribute(WhiteboardConstants.ATTR_SUBMISSION_DEADLINE, tzSubmissionDeadline.getTime()); + // use the unconverted time, as convertToStringForJSON() does the timezone conversion if needed + request.setAttribute(WhiteboardConstants.ATTR_SUBMISSION_DEADLINE_DATESTRING, + DateUtil.convertToStringForJSON(submissionDeadline, request.getLocale())); + } + // Create reflectList if reflection is enabled. if (whiteboard.isReflectOnActivity()) { List relectList = whiteboardService.getReflectList(contentId); @@ -323,7 +340,8 @@ if (grouping != null) { Set groups = grouping.getGroups(); for (Group group : groups) { - if (!group.getUsers().isEmpty() && group.getGroupName().toLowerCase().contains(searchString.toLowerCase())) { + if (!group.getUsers().isEmpty() + && group.getGroupName().toLowerCase().contains(searchString.toLowerCase())) { ObjectNode groupJSON = JsonNodeFactory.instance.objectNode(); groupJSON.put("label", groupLabel + group.getGroupName() + "\""); groupJSON.put("value", "group-" + group.getGroupId()); @@ -436,6 +454,33 @@ whiteboardService.saveOrUpdate(whiteboard); } + /** + * Set Submission Deadline + */ + @RequestMapping(path = "/setSubmissionDeadline", method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) + @ResponseBody + public String setSubmissionDeadline(HttpServletRequest request) { + Long contentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); + Whiteboard whiteboard = whiteboardService.getWhiteboardByContentId(contentID); + + Long dateParameter = WebUtil.readLongParam(request, WhiteboardConstants.ATTR_SUBMISSION_DEADLINE, true); + Date tzSubmissionDeadline = null; + String formattedDate = ""; + if (dateParameter != null) { + Date submissionDeadline = new Date(dateParameter); + HttpSession ss = SessionManager.getSession(); + UserDTO teacher = (UserDTO) ss.getAttribute(AttributeNames.USER); + TimeZone teacherTimeZone = teacher.getTimeZone(); + tzSubmissionDeadline = DateUtil.convertFromTimeZoneToDefault(teacherTimeZone, submissionDeadline); + formattedDate = DateUtil.convertToStringForJSON(tzSubmissionDeadline, request.getLocale()); + + } + whiteboard.setSubmissionDeadline(tzSubmissionDeadline); + whiteboardService.saveOrUpdate(whiteboard); + + return formattedDate; + } + private Integer getUserId() { HttpSession ss = SessionManager.getSession(); UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); Index: lams_tool_whiteboard/web/pages/learning/learning.jsp =================================================================== diff -u -rd5fa41792bdb2657d0d53c35126a64604510d18a -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_whiteboard/web/pages/learning/learning.jsp (.../learning.jsp) (revision d5fa41792bdb2657d0d53c35126a64604510d18a) +++ lams_tool_whiteboard/web/pages/learning/learning.jsp (.../learning.jsp) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -225,6 +225,14 @@ + + + + + + + + Index: lams_tool_whiteboard/web/pages/learning/submissionDeadline.jsp =================================================================== diff -u --- lams_tool_whiteboard/web/pages/learning/submissionDeadline.jsp (revision 0) +++ lams_tool_whiteboard/web/pages/learning/submissionDeadline.jsp (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -0,0 +1,83 @@ + +<%@include file="/common/taglibs.jsp"%> + + + + + <%@ include file="/common/header.jsp"%> + <fmt:message key="label.learning.title" /> + + + + + + + + + + + + +
+

+ ${sessionMap.reflectInstructions} +

+ + + +

+ + +

+
+ +

+ +

+
+
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + +
+ + +
+ +
Index: lams_tool_whiteboard/web/pages/monitoring/dateRestriction.jsp =================================================================== diff -u --- lams_tool_whiteboard/web/pages/monitoring/dateRestriction.jsp (revision 0) +++ lams_tool_whiteboard/web/pages/monitoring/dateRestriction.jsp (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -0,0 +1,36 @@ +<%@include file="/common/taglibs.jsp"%> + + + + +
+ +
+ +
style="display: none;" > +
+ + + + + +
+
+ +
style="display: none;" > + + + + + +
+ +
\ No newline at end of file Index: lams_tool_whiteboard/web/pages/monitoring/summary.jsp =================================================================== diff -u -r58faa819bf7c281e7a12660020f3b063b16ada93 -r1621b6daf8385b83e75f7ffde03c017b05c12487 --- lams_tool_whiteboard/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 58faa819bf7c281e7a12660020f3b063b16ada93) +++ lams_tool_whiteboard/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 1621b6daf8385b83e75f7ffde03c017b05c12487) @@ -19,6 +19,7 @@ + + + + @@ -658,6 +674,8 @@
+ + <%@ include file="dateRestriction.jsp"%>
\ No newline at end of file