aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2015-03-18 09:11:24 +0000
committerSean Whitton <spwhitton@spwhitton.name>2015-03-18 09:11:24 +0000
commit7b4a0e10cf16e4669e87e13a499a84f49e5bc8cb (patch)
tree47547a0cf94ed45285f64c7b23b52a0f09b6902d /assets
parente48a6625884f89cde3ef81c63a77603572692c71 (diff)
downloadsariulclocks-7b4a0e10cf16e4669e87e13a499a84f49e5bc8cb.tar.gz
new form for end of class inc. password
Diffstat (limited to 'assets')
-rw-r--r--assets/.htaccess4
-rw-r--r--assets/js/main.js23
2 files changed, 18 insertions, 9 deletions
diff --git a/assets/.htaccess b/assets/.htaccess
new file mode 100644
index 0000000..d97a05c
--- /dev/null
+++ b/assets/.htaccess
@@ -0,0 +1,4 @@
+<Files "password">
+ Order Allow,Deny
+ Deny from all
+</Files>
diff --git a/assets/js/main.js b/assets/js/main.js
index 364c240..9417e3c 100644
--- a/assets/js/main.js
+++ b/assets/js/main.js
@@ -96,30 +96,35 @@ function startLesson()
function endLesson()
{
+ // elements
+ var $points = $('#class_points');
+ var $form = $('#end_of_class_form');
+ var $password = $('#teachers_password');
+ var $time = $('#class_time_wasted');
+
var oldCookie = readCookie("class_cookie");
// bail out if we've already started a class (the cookie will
// always be set cos our CGI monad always sets it)
if (oldCookie == "Nothing")
return false;
- // get input
- var points = prompt("How many points did they earn?", "0");
-
// validate
var valRegExp = new RegExp("^[0-9]*$");
- if (valRegExp.test(points) == false)
+ if (valRegExp.test($points.val()) == false)
{
alert ("invalid points!");
return false;
}
+ if ($password.val() == "")
+ {
+ alert ("invalid password!");
+ return false;
+ }
+ // submit
timeWastingClock.stop();
- // set the form field values: the other gets set by the tick function
- $("#class_points").val(points);
-
- // submit the form data
timeWastingClock.reset();
- $("#end_of_class_form").submit();
+ $form.submit();
}
// toggle date style