[system] / branches / rel-2-3-dev / webwork-modperl / conf / templates / math / gateway.template Repository:
ViewVC logotype

View of /branches/rel-2-3-dev/webwork-modperl/conf/templates/math/gateway.template

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4434 - (download) (annotate)
Fri Sep 1 16:19:34 2006 UTC (6 years, 9 months ago) by sh002i
File size: 6860 byte(s)
backport (sh002i): replaced unicode literals with code points.

    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    2   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    3 <!--
    4 ################################################################################
    5 # WeBWorK Online Homework Delivery System
    6 # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/
    7 # $CVSHeader$
    8 #
    9 # This program is free software; you can redistribute it and/or modify it under
   10 # the terms of either: (a) the GNU General Public License as published by the
   11 # Free Software Foundation; either version 2, or (at your option) any later
   12 # version, or (b) the "Artistic License" which comes with this package.
   13 #
   14 # This program is distributed in the hope that it will be useful, but WITHOUT
   15 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   16 # FOR A PARTICULAR PURPOSE.  See either the GNU General Public License or the
   17 # Artistic License for more details.
   18 ################################################################################
   19 -->
   20 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
   21 <head>
   22 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   23 <meta http-equiv="Pragma" content="no-cache"/>
   24 <meta http-equiv="expires" content="Wed, 21 Dec 2005 00:00:01 GMT"/>
   25 <link rel="stylesheet" type="text/css" href="<!--#url type="webwork" name="htdocs"-->/css/math.css"/>
   26 <!-- [gateway] since the left-side menus are gone, don't indent the main content area -->
   27 <link rel="stylesheet" type="text/css" href="<!--#url type="webwork" name="htdocs"-->/css/gateway.css"/>
   28 <title><!--#path style="text" text=" : " textonly="1"--></title>
   29 <!--#head-->
   30 <script language="javascript" type="text/javascript">
   31 function jumpTo(ref) {  // scrolling javascript function
   32     if ( ref ) {
   33         var pn = ref - 1; // we start anchors at 1, not zero
   34         if ( navigator.appName == "Netscape" &&
   35              parseFloat(navigator.appVersion) < 5 ) {
   36             var xpos = document.anchors[pn].x;
   37             var ypos = document.anchors[pn].y;
   38         } else {
   39             var xpos = document.anchors[pn].offsetLeft;
   40             var ypos = document.anchors[pn].offsetTop;
   41         }
   42         if ( window.scrollTo == null ) { // cover for anyone
   43             window.scroll(xpos,ypos);    //   lacking js1.2
   44         } else {
   45             window.scrollTo(xpos,ypos);
   46         }
   47     }
   48     return false; // prevent link from being followed
   49 }
   50 
   51 // timer for gateway
   52 var theTimer;   // variable for the timer
   53 var browserTime;  // on load, the time on the client's computer
   54 var serverTime;   // on load, the time on the server
   55 var timeDelta;    // the difference between those
   56 var serverDueTime;  // the time the test is due
   57 
   58 function runtimer() {
   59 // function to start the timer, initializing the time variables
   60     if ( document.getElementById('gwTimer') == null ) {  // no timer
   61   return;
   62     } else {
   63   theTimer = document.getElementById('gwTimer');
   64   var dateNow = new Date();
   65   browserTime = Math.round(dateNow.getTime()/1000);
   66   serverTime = document.gwTimeData.serverTime.value;
   67   serverDueTime = document.gwTimeData.serverDueTime.value;
   68   timeDelta = browserTime - serverTime;
   69 
   70   var remainingTime = serverDueTime - browserTime + 1.*timeDelta;
   71 
   72   if ( remainingTime >= 0 ) {
   73       theTimer.innerHTML = "Remaining time: " + toMinSec(remainingTime) + " (min:sec)";
   74       setTimeout("updateTimer();", 1000);
   75       setTimeout("checkAlert();", 1000);
   76   } else {
   77       theTimer.innerHTML = "Remaining time: 0 min";
   78   }
   79 
   80     // one last check for i.e., which can't do position: fixed
   81   if ( navigator.appName != "Netscape" &&
   82        parseFloat(navigator.appVersion) < 7 ) {
   83       theTimer.style.position = "absolute";
   84   }
   85     }
   86 }
   87 
   88 function updateTimer() {
   89 // update the timer
   90     var dateNow = new Date();
   91     browserTime = Math.round(dateNow.getTime()/1000);
   92     var remainingTime = serverDueTime - browserTime + 1.*timeDelta;
   93     if ( remainingTime >= 0 ) {
   94   theTimer.innerHTML = "Remaining time: " + toMinSec(remainingTime) + " (min:sec)";
   95   setTimeout("updateTimer();", 1000);
   96     }
   97 }
   98 
   99 function checkAlert() {
  100 // check to see if we should put up a low time alert
  101     var dateNow = new Date();
  102     browserTime = Math.round(dateNow.getTime()/1000);
  103     var timeRemaining = serverDueTime - browserTime + 1.*timeDelta;
  104 
  105     if ( timeRemaining <= 0 ) {
  106         alert("* You are out of time! *\n" +
  107         "* Press grade now!     *");
  108     } else if ( timeRemaining <= 45 && timeRemaining > 40 ) {
  109   alert("* You have less than 45 seconds left! *\n" +
  110         "*      Press Grade very soon!         *");
  111     } else if ( timeRemaining <= 90 && timeRemaining > 85 ) {
  112   alert("* You only have less than 90 sec left to complete  *\n" +
  113         "* this assignment. You should finish it very soon! *");
  114     }
  115     if ( timeRemaining > 0 ) {
  116   setTimeout("checkAlert();", 5000);
  117     }
  118 }
  119 
  120 function toMinSec(t) {
  121 // convert to min:sec
  122     if ( t < 0 ) {     // don't deal with negative times
  123   t = 0;
  124     }
  125     mn = Math.floor(t/60);
  126     sc = t - 60*mn;
  127     if ( mn < 10 && mn > -1 ) {
  128         mn = "0" + mn;
  129     }
  130     if ( sc < 10 ) {
  131         sc = "0" + sc;
  132     }
  133     return mn + ":" + sc;
  134 }
  135 
  136 // for some reason putting this as an onload event in the body tag
  137 // isn't working.  so start the timer here; the 500ms delay is to be
  138 // sure that the timer has loaded
  139 setTimeout("runtimer()",500);
  140 // this does not work either
  141 // window.onload=runtimer();
  142 </script>
  143 </head>
  144 <body bgcolor="white">
  145 <div id="masthead">
  146   <div id="loginstatus">
  147     <!--#loginstatus-->
  148   </div>
  149   <div id="logo">
  150     <img src="<!--#url type="webwork" name="htdocs"-->/images/webwork_rectangle.png" alt="WeBWorK" height="51" width="267" />
  151   </div>
  152 </div>
  153 <hr class="for-broken-browsers"/>
  154 <div id="big-wrapper">
  155   <div id="breadcrumbs">
  156     <!--#path style="text" text=" &#x2192; "-->
  157   </div>
  158   <div id="content">
  159 
  160     <!--#if can="info"-->
  161     <!--<div id="page-info">-->
  162       <!--<div class="info-box" id="fisheye">-->
  163         <!--#info-->
  164       <!--</div>-->
  165     <!--</div>-->
  166     <!--#endif-->
  167 
  168     <!-- [gateway] removed nav button to go up -->
  169 
  170     <!--#if can="title"-->
  171     <h1><!--#title--></h1>
  172     <!--#endif-->
  173 
  174     <!--#if can="message"-->
  175       <div class="Message">
  176         <!--#message-->
  177       </div>
  178     <!--#endif-->
  179 
  180     <!--#if can="body"-->
  181     <div class="Body">
  182       <!--#body-->
  183     </div>
  184     <!--#endif-->
  185 
  186     <!--#if warnings="1"-->
  187     <hr>
  188     <div class="Warnings">
  189       <!--#warnings-->
  190     </div>
  191     <!--#endif-->
  192 
  193     <!--#if can="message"-->
  194       <div class="Message">
  195         <!--#message-->
  196       </div>
  197     <!--#endif-->
  198 
  199   </div> <!-- content -->
  200   <hr class="for-broken-browsers"/>
  201   <div id="footer">
  202     <p id="last-modified">Page generated at <!--#timestamp--></p>
  203     <div id="copyright">
  204       WeBWorK &#169; 2000-2006 <a href="http://openwebwork.sf.net/">The WeBWorK Project</a>
  205     </div>
  206   </div>
  207   <!-- [gateway] removed left sidebar -->
  208 </div> <!-- big-wrapper -->
  209 
  210 </body>
  211 </html>

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9