From ff61c327f3208453ccf81b0edb65f27d84635b5e Mon Sep 17 00:00:00 2001
From: joaquinmarques
Date: Tue, 27 Feb 2018 17:34:08 +0100
Subject: [PATCH] SAM-3350 Timed assessment progress bar includes hard-coded
label "Time's Up" (#5276)
---
.../tool/assessment/bundle/DeliveryMessages.properties | 1 +
.../tool/assessment/jsf/renderer/TimerBarRenderer.java | 1 +
.../sakaiproject/tool/assessment/jsf/tag/TimerBarTag.java | 8 ++++++++
samigo/samigo-app/src/webapp/WEB-INF/samigo.tld | 5 +++++
.../src/webapp/jsf/delivery/assessmentDeliveryTimer.jsp | 8 +++++---
.../src/webapp/jsf/delivery/tableOfContents.jsp | 1 +
.../samigo-app/src/webapp/jsf/widget/timerBar/timerbar.js | 2 +-
7 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/bundle/DeliveryMessages.properties b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/bundle/DeliveryMessages.properties
index 850f64fae343..90e8bd981e8d 100755
--- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/bundle/DeliveryMessages.properties
+++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/bundle/DeliveryMessages.properties
@@ -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 -
diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/renderer/TimerBarRenderer.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/renderer/TimerBarRenderer.java
index b114af18ff81..f0c6f2c1d176 100755
--- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/renderer/TimerBarRenderer.java
+++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/renderer/TimerBarRenderer.java
@@ -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()");
diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/tag/TimerBarTag.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/tag/TimerBarTag.java
index 97ebe5941415..5dfb17b0408e 100755
--- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/tag/TimerBarTag.java
+++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/tag/TimerBarTag.java
@@ -52,6 +52,7 @@ public class TimerBarTag
private String height;
private String wait;
private String width;
+ private String timeUpMessage;
public void setHeight(String height)
@@ -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()
{
@@ -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;
+ }
}
diff --git a/samigo/samigo-app/src/webapp/WEB-INF/samigo.tld b/samigo/samigo-app/src/webapp/WEB-INF/samigo.tld
index e17ea22d6c26..0c4a2d6a8737 100755
--- a/samigo/samigo-app/src/webapp/WEB-INF/samigo.tld
+++ b/samigo/samigo-app/src/webapp/WEB-INF/samigo.tld
@@ -140,6 +140,11 @@
true
false
+
+ timeUpMessage
+ true
+ false
+
diff --git a/samigo/samigo-app/src/webapp/jsf/delivery/assessmentDeliveryTimer.jsp b/samigo/samigo-app/src/webapp/jsf/delivery/assessmentDeliveryTimer.jsp
index 56cb86fcf1e0..98e98386f8fd 100644
--- a/samigo/samigo-app/src/webapp/jsf/delivery/assessmentDeliveryTimer.jsp
+++ b/samigo/samigo-app/src/webapp/jsf/delivery/assessmentDeliveryTimer.jsp
@@ -34,13 +34,14 @@ Headings for delivery pages, needs to have msg=DeliveryMessages.properties, etc.
-
+
@@ -48,6 +49,7 @@ Headings for delivery pages, needs to have msg=DeliveryMessages.properties, etc.
@@ -106,9 +108,9 @@ function clickDoNotSubmit(){
-
+
-
+
diff --git a/samigo/samigo-app/src/webapp/jsf/delivery/tableOfContents.jsp b/samigo/samigo-app/src/webapp/jsf/delivery/tableOfContents.jsp
index 60aec33901d8..3354ecd71bea 100755
--- a/samigo/samigo-app/src/webapp/jsf/delivery/tableOfContents.jsp
+++ b/samigo/samigo-app/src/webapp/jsf/delivery/tableOfContents.jsp
@@ -112,6 +112,7 @@ function clickSubmitForGrade(){
diff --git a/samigo/samigo-app/src/webapp/jsf/widget/timerBar/timerbar.js b/samigo/samigo-app/src/webapp/jsf/widget/timerBar/timerbar.js
index 337bde0cdfb0..895f86161873 100755
--- a/samigo/samigo-app/src/webapp/jsf/widget/timerBar/timerbar.js
+++ b/samigo/samigo-app/src/webapp/jsf/widget/timerBar/timerbar.js
@@ -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;