Skip to content

Commit

Permalink
SAM-3350 Timed assessment progress bar includes hard-coded label "Tim…
Browse files Browse the repository at this point in the history
…e's Up" (sakaiproject#5276)
  • Loading branch information
joaquinmarques authored and ern committed Feb 27, 2018
1 parent eb2c429 commit ff61c32
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ time_expired3=All of your answers are being submitted
five_minutes_left1=You have 5 minutes left.
five_minutes_left2=Press 'Esc' or click 'OK' to return to your assessment.
five_minutes_left3=The timer will continue to count down whether or not you close this window.
time_up=Time's up
hide_show=Hide/Show Time Remaining
session_will_timeout=Your session will expire in 5 minutes. Click OK to renew.
settings=Settings -
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public void encodeEnd(FacesContext context, UIComponent component)
writer.write("\n var barwidth = " + attrMap.get("width") + "; // WIDTH OF THE BAR IN PIXELS");
writer.write("\n var waitTime = " + attrMap.get("wait") + "; // NUMBER OF SECONDS FOR PROGRESSBAR");
writer.write("\n var loaded = " + attrMap.get("elapsed") + "*10; // TENTHS OF A SECOND ELAPSED");
writer.write("\n var timeUpMessage = \"" + attrMap.get("timeUpMessage") + "\"; // I18N message for time's up");
writer.write("\n// THE FUNCTION BELOW CONTAINS THE ACTION(S) TAKEN ONCE BAR REACHES 100.");
writer.write("\n");
writer.write("\n var action = function()");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class TimerBarTag
private String height;
private String wait;
private String width;
private String timeUpMessage;


public void setHeight(String height)
Expand Down Expand Up @@ -94,6 +95,7 @@ protected void setProperties(UIComponent component)
TagUtil.setInteger(component, "wait", wait);
TagUtil.setInteger(component, "elapsed", elapsed);
TagUtil.setString(component, "expireScript", expireScript);
TagUtil.setString(component, "timeUpMessage", timeUpMessage);
}
public String getWidth()
{
Expand Down Expand Up @@ -127,5 +129,11 @@ public void setExpireScript(String expireScript)
{
this.expireScript = expireScript;
}
public void setTimeUpMessage(String timeUpMessage) {
this.timeUpMessage = timeUpMessage;
}
public String getTimeUpMessage() {
return timeUpMessage;
}

}
5 changes: 5 additions & 0 deletions samigo/samigo-app/src/webapp/WEB-INF/samigo.tld
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>timeUpMessage</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>

<!-- we may obsolete this tag -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,22 @@ Headings for delivery pages, needs to have msg=DeliveryMessages.properties, etc.
<h:panelGroup rendered="#{delivery.hasTimeLimit}">
<f:verbatim><span id="remText"></f:verbatim><h:outputText value="#{deliveryMessages.time_remaining} "/><f:verbatim></span></f:verbatim>
<f:verbatim><span id="timer"></f:verbatim><f:verbatim> </span></f:verbatim>
</h:panelGroup>
</h:panelGroup>

<f:verbatim> <span id="bar"></f:verbatim>
<h:panelGroup rendered="#{delivery.timeElapseAfterFileUpload == null || delivery.timeElapseDouble ge delivery.timeElapseAfterFileUploadDouble}">
<samigo:timerBar height="15" width="300"
wait="#{delivery.timeLimit}"
elapsed="#{delivery.timeElapse}"
timeUpMessage="#{deliveryMessages.time_up}"
expireScript="document.forms[0].elements['takeAssessmentForm:assessmentDeliveryHeading:elapsed'].value=loaded; document.forms[0].elements['takeAssessmentForm:assessmentDeliveryHeading:outoftime'].value='true'; " />
</h:panelGroup>

<h:panelGroup rendered="#{delivery.timeElapseAfterFileUpload != null && delivery.timeElapseDouble lt delivery.timeElapseAfterFileUploadDouble}">
<samigo:timerBar height="15" width="300"
wait="#{delivery.timeLimit}"
elapsed="#{delivery.timeElapseAfterFileUpload}"
timeUpMessage="#{deliveryMessages.time_up}"
expireScript="document.forms[0].elements['takeAssessmentForm:assessmentDeliveryHeading:elapsed'].value=loaded; document.forms[0].elements['takeAssessmentForm:assessmentDeliveryHeading:outoftime'].value='true'; " />
</h:panelGroup>

Expand Down Expand Up @@ -106,9 +108,9 @@ function clickDoNotSubmit(){
</script>
</h:panelGroup>

<h:panelGroup rendered="#{delivery.actionString=='previewAssessment' && delivery.hasTimeLimit}" >
<h:panelGroup rendered="#{delivery.actionString=='previewAssessment' && delivery.hasTimeLimit}" >
<f:verbatim><div style="margin:10px 0px 0px 0px;"><span style="background-color:#bab5b5; padding:5px"></f:verbatim>
<h:outputText value="#{deliveryMessages.timer_preview_not_available}"/>
<h:outputText value="#{deliveryMessages.timer_preview_not_available}"/>
<f:verbatim></div></span></f:verbatim>
</h:panelGroup>
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ function clickSubmitForGrade(){
<samigo:timerBar height="15" width="300"
wait="#{delivery.timeLimit}"
elapsed="#{delivery.timeElapse}"
timeUpMessage="#{deliveryMessages.time_up}"
expireScript="document.forms[0].elements['tableOfContentsForm:elapsed'].value=loaded; document.forms[0].elements['tableOfContentsForm:outoftime'].value='true';" />
<f:verbatim> </span></f:verbatim>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function progressTimerBar(){

function stopTimer(){
if(hasTimeLimit) {
document.getElementById('timer').innerHTML="Time's up";
document.getElementById('timer').innerHTML=timeUpMessage;
}
clearTimeout(timerID);
running=false;
Expand Down

0 comments on commit ff61c32

Please sign in to comment.