Skip to content

Commit

Permalink
SAK-42813 Signup: If an attachment is added or removed after dates an…
Browse files Browse the repository at this point in the history
…d times have been set, the dates and times revert back to current (sakaiproject#7581)
  • Loading branch information
Miguel Pellicer authored Dec 10, 2019
1 parent bfbc1eb commit 8cf37fc
Showing 1 changed file with 27 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ public String goNext() {
* @return null.
*/
public String addRemoveAttachments() {
this.setMeetingDates();
getAttachmentHandler().processAddAttachRedirect(attachments, signupMeeting, true);
return null;
}
Expand Down Expand Up @@ -414,26 +415,7 @@ public void validateNewMeeting(ActionEvent e) {
String step = (String) currentStepHiddenInfo.getValue();

if ("step1".equals(step)) {
Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();

String isoStartTime = params.get(HIDDEN_ISO_STARTTIME);

if (DateFormatterUtil.isValidISODate(isoStartTime)) {
signupMeeting.setStartTime(DateFormatterUtil.parseISODate(isoStartTime));
}

String isoEndTime = params.get(HIDDEN_ISO_ENDTIME);

if (DateFormatterUtil.isValidISODate(isoEndTime)) {
signupMeeting.setEndTime(DateFormatterUtil.parseISODate(isoEndTime));
}

String isoUntilTime = params.get(HIDDEN_ISO_UNTILTIME);

if (DateFormatterUtil.isValidISODate(isoUntilTime)) {
setRepeatUntil(DateFormatterUtil.parseISODate(isoUntilTime));
}

this.setMeetingDates();
boolean locationSet = false;

// Set Title
Expand Down Expand Up @@ -1344,4 +1326,29 @@ public String getIframeId() {
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
return (String) request.getAttribute("sakai.tool.placement.id");
}

/* Get the dates from the input fields and save them into the signupMetting object.*/
private void setMeetingDates() {
Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();

String isoStartTime = params.get(HIDDEN_ISO_STARTTIME);

if(DateFormatterUtil.isValidISODate(isoStartTime)){
this.signupMeeting.setStartTime(DateFormatterUtil.parseISODate(isoStartTime));
}

String isoEndTime = params.get(HIDDEN_ISO_ENDTIME);

if(DateFormatterUtil.isValidISODate(isoEndTime)){
this.signupMeeting.setEndTime(DateFormatterUtil.parseISODate(isoEndTime));
}

String isoUntilTime = params.get(HIDDEN_ISO_UNTILTIME);

if(DateFormatterUtil.isValidISODate(isoUntilTime)){
setRepeatUntil(DateFormatterUtil.parseISODate(isoUntilTime));
this.signupMeeting.setRepeatUntil(DateFormatterUtil.parseISODate(isoUntilTime));
}

}
}

0 comments on commit 8cf37fc

Please sign in to comment.