Index: tool/src/bundle/messages.properties =================================================================== --- tool/src/bundle/messages.properties (revision 59241) +++ tool/src/bundle/messages.properties (working copy) @@ -308,6 +308,7 @@ event_publish_attendee_name=Display Participant Names: publish_button=Publish assign_attendee_publish_button=Assign Participants & Publish +event_endtime_auto_adjusted_warning=The meeting end time has been adjusted because the number of sessions cannot be divided evenly within the time period provided. #User action exception messages db.error_or_event.notExisted=Either a database error has occurred or the meeting no longer exists. Index: tool/src/java/org/sakaiproject/signup/tool/jsf/NewSignupMeetingBean.java =================================================================== --- tool/src/java/org/sakaiproject/signup/tool/jsf/NewSignupMeetingBean.java (revision 59241) +++ tool/src/java/org/sakaiproject/signup/tool/jsf/NewSignupMeetingBean.java (working copy) @@ -131,6 +131,8 @@ private boolean eidInputMode = false; private Boolean publishedSite; + + private boolean endTimeAutoAdjusted=false; private Log logger = LogFactory.getLog(getClass()); @@ -292,6 +294,17 @@ // signupMeeting.setMeetingType(null); } + + /*give warning to user in the next page if the event ending time get auto adjusted due to not even-division*/ + setEndTimeAutoAdjusted(false); + if (isIndividualType() && getNumberOfSlots()!=0) { + double duration = (double)(getSignupMeeting().getEndTime().getTime() - getSignupMeeting().getStartTime().getTime()) + / (double)(MINUTE_IN_MILLISEC * getNumberOfSlots()); + if (duration != Math.floor(duration)){ + setEndTimeAutoAdjusted(true); + Utilities.addErrorMessage(Utilities.rb.getString("event_endtime_auto_adjusted_warning")); + } + } } } @@ -327,9 +340,10 @@ return ADD_MEETING_STEP1_PAGE_URL; } if (step.equals("assignAttendee")) { - timeSlotWrappers = null; // reset to remove timeslots info with + timeSlotWrappers = null; // reset to remove timeslots info with attendees assignParicitpantsToAllRecurEvents = false; - // attendees + //reset warning for ending time auto-adjustment + setEndTimeAutoAdjusted(false); return ADD_MEETING_STEP2_PAGE_URL; } @@ -765,6 +779,7 @@ if (this.timeSlotDuration == 0) {// first time long duration = (getSignupMeeting().getEndTime().getTime() - getSignupMeeting().getStartTime().getTime()) / (MINUTE_IN_MILLISEC * getNumberOfSlots()); + setTimeSlotDuration((int) duration); } return this.timeSlotDuration; @@ -1305,4 +1320,21 @@ return publishedSite.booleanValue(); } + /** + * This is a getter method for UI + * @return true if the ending time is adjusted. + */ + public boolean isEndTimeAutoAdjusted() { + return endTimeAutoAdjusted; + } + + /** + * This is a setter method. + * @param endTimeAutoAdjusted + */ + public void setEndTimeAutoAdjusted(boolean endTimeAutoAdjusted) { + this.endTimeAutoAdjusted = endTimeAutoAdjusted; + } + + } Index: tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/EditMeetingSignupMBean.java =================================================================== --- tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/EditMeetingSignupMBean.java (revision 59241) +++ tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/EditMeetingSignupMBean.java (working copy) @@ -177,6 +177,14 @@ editMeeting.setConvertToNoRecurrent(convertToNoRecurrent); /* update to DB */ editMeeting.saveModifiedMeeting(meeting); + + /*give warning to user in the next page if the event ending time get auto adjusted due to not even-division*/ + if (isIndividualType() && getNumberOfSlots()!=0) { + double duration = (double)(getSignupMeeting().getEndTime().getTime() - getSignupMeeting().getStartTime().getTime()) + / (double)(MINUTE_IN_MILLISEC * getNumberOfSlots()); + if (duration != Math.floor(duration)) + Utilities.addErrorMessage(Utilities.rb.getString("event_endtime_auto_adjusted_warning")); + } /* For case: a set of recurring meetings are updated */ List successUpdatedMeetings = editMeeting.getSavedMeetings(); Index: tool/src/webapp/js/signupScript.js =================================================================== --- tool/src/webapp/js/signupScript.js (revision 59241) +++ tool/src/webapp/js/signupScript.js (working copy) @@ -210,7 +210,7 @@ } var prev_slotNum=4;//default - function getSignupDuration(){ + function getSignup_Duration(showDecimal){ if (signupMeetingType !=INDIVIDUAL_TYPE) return; @@ -222,19 +222,40 @@ prev_slotNum = signup_ValidateNumber(prev_slotNum,slotNumTag,100); - var slotNum = parseInt(slotNumTag.value); + var slotNum = parseInt(slotNumTag.value); var duration = getSignupDateTime(endTimeTag).getTime() - getSignupDateTime(startTimeTag).getTime(); - //alert("duration in Minutes:=" + duration/(slotNum*60*1000) ); var currentTimeslotDuration = document.getElementById("meeting:currentTimeslotDuration"); - currentTimeslotDuration.value= isNaN(duration/(slotNum*60*1000))? 0 : duration/(slotNum*60*1000); + var slot_duration= isNaN(duration/(slotNum*60*1000))? 0 : duration/(slotNum*60*1000); + if(showDecimal=='yes') + currentTimeslotDuration.value= slot_duration; + else + currentTimeslotDuration.value= Math.floor(slot_duration); + + setTimeout( "signup_displaySlotDurationFloorNum();", 1200);//1.2 sec } + function getSignupDuration(){ + getSignup_Duration('yes'); + } + + function getSignupDurationNoDecimal(){ + getSignup_Duration('no'); + } + + function signup_displaySlotDurationFloorNum(){ + var slotDurationTag = document.getElementById("meeting:currentTimeslotDuration"); + if(slotDurationTag){ + var cur_durationVal=parseFloat(slotDurationTag.value); + slotDurationTag.value= Math.floor(cur_durationVal); + } + } + var waiting=false; function delayedRecalculateDateTime(){ if (!waiting){ waiting = true; setEndtimeMonthDateYear(); - getSignupDuration(); + getSignupDurationNoDecimal(); setTimeout("waiting=false;", 1500);//1.5 sec } } Index: tool/src/webapp/signup/newMeeting/step2.jsp =================================================================== --- tool/src/webapp/signup/newMeeting/step2.jsp (revision 59241) +++ tool/src/webapp/signup/newMeeting/step2.jsp (working copy) @@ -43,9 +43,14 @@ - - - + + + + + + + +