[LON-CAPA-cvs] cvs: rat /client parameter.html

musolffc musolffc at source.lon-capa.org
Fri Nov 20 19:16:09 EST 2015


musolffc		Sat Nov 21 00:16:09 2015 EDT

  Modified files:              
    /rat/client	parameter.html 
  Log:
  Stopped wrapping in Time-Limit settings frame
  
  <select> elements and their labels were grouped into <span>'s with
  style="white-space:nowrap".  It was previously possible for the label to
  wrap to the next line, making it unclear what was being set.
  
  The following functions were changed to return strings instead of writing
  directly to the page.  The results can now be embedded within html strings.
  intervaldis()
  intday()
  inthour()
  intminute()
  intsecond()
  
  
Index: rat/client/parameter.html
diff -u rat/client/parameter.html:1.68 rat/client/parameter.html:1.69
--- rat/client/parameter.html:1.68	Sun Sep 13 21:48:37 2015
+++ rat/client/parameter.html	Sat Nov 21 00:16:09 2015
@@ -5,7 +5,7 @@
 The LearningOnline Network with CAPA
 Parameter Input Window
 //
-// $Id: parameter.html,v 1.68 2015/09/13 21:48:37 raeburn Exp $
+// $Id: parameter.html,v 1.69 2015/11/21 00:16:09 musolffc Exp $
 //
 // Copyright Michigan State University Board of Trustees
 //
@@ -242,58 +242,66 @@
 function intminute() {
    var thisminutes=cmins;
     var i;
-    choicewrite('<select name="minutes" onchange="parent.intcalc();">');
+    var result = '';
+    result += '<select name="minutes" onchange="parent.intcalc();">';
     for (i=0;i<=59;i++) {
-        choicewrite('<option value="'+i+'"');
+        result += '<option value="'+i+'"';
         if (i==thisminutes) {
-            choicewrite(' selected="selected"');
+            result += ' selected="selected"';
         }
-        choicewrite('>'+i+'</option>');
+        result += '>'+i+'</option>';
     }
-    choicewrite('</select>');
+    result += '</select>';
+    return result;
 } 
 
 function inthour() {
    var thishours=chours;
     var i;
-    choicewrite('<select name="hours" onchange="parent.intcalc();">');
+    var result = '';
+    result += '<select name="hours" onchange="parent.intcalc();">';
     for (i=0;i<=23;i++) {
-        choicewrite('<option value="'+i+'"');
+        result += '<option value="'+i+'"';
         if (i==thishours) {
-            choicewrite(' selected="selected"');
+            result += ' selected="selected"';
         }
-        choicewrite('>'+i+'</option>');
+        result += '>'+i+'</option>';
     }
-    choicewrite('</select>');
+    result += '</select>';
+    return result;
 } 
 
 function intsecond() {
-   var thisseconds=csecs;
+    var thisseconds=csecs;
     var i;
-    choicewrite('<select name="seconds" onchange="parent.intcalc();">');
+    var result = '';
+    result += '<select name="seconds" onchange="parent.intcalc();">';
     for (i=0;i<=59;i++) {
-        choicewrite('<option value="'+i+'"');
+        result += '<option value="'+i+'"';
         if (i==thisseconds) {
-            choicewrite(' selected="selected"');
+            result += ' selected="selected"';
         }
-        choicewrite('>'+i+'</option>');
+        result += '>'+i+'</option>';
     }
-    choicewrite('</select>');
+    result += '</select>';
+    return result;
 } 
 
 
 function intday() {
    var thisdate=cdays;
     var i;
-    choicewrite('<select name="date" onchange="parent.intcalc();">');
+    var result ='';
+    result += '<select name="date" onchange="parent.intcalc();">';
     for (i=0;i<=31;i++) {
-        choicewrite('<option value="'+i+'"');
+        result += '<option value="'+i+'"';
         if (i==thisdate) {
-            choicewrite(' selected="selected"');
+            result += ' selected="selected"';
         }
-        choicewrite('>'+i+'</option>');
+        result += '>'+i+'</option>';
     }
-    choicewrite('</select>');
+    result += '</select>';
+    return result;
 }
 
 function intcalc() {
@@ -376,8 +384,7 @@
     csecs-=chours*3600;
     cmins=Math.floor(csecs/60);
     csecs-=cmins*60;
-    choicewrite(cdays+' days '+chours+' hours '
-               +cmins+' mins '+csecs+' secs');
+    return cdays+' days '+chours+' hours '+cmins+' mins '+csecs+' secs';
 }
 
 function pickcolor(picked) {
@@ -494,15 +501,17 @@
       }
       if (pscat=='interval') {
          tablestart('Time interval');
-         choicewrite('<tr><td colspan="3">');
-         intervaldis();
-         choicewrite('</td></tr><tr><td>Time:'
-         +'</td><td colspan="2">');
-         intday();choicewrite('days ');
-         inthour();choicewrite('hours ');
-         intminute(); choicewrite('mins '); intsecond();
-         choicewrite('secs</td></tr></table>');
-         choicewrite('<br />');
+         choicewrite( [
+            '<tr><td colspan="3">'+intervaldis()+'</td></tr>',
+            '<tr><td>Time:</td><td colspan="2">',
+                '<span style="white-space:nowrap">'+intday()+' days </span>',
+                '<span style="white-space:nowrap">'+inthour()+' hours</span>',
+                '<span style="white-space:nowrap">'+intminute()+' mins</span>',
+                '<span style="white-space:nowrap">'+intsecond()+' secs</span>',
+            '</td></tr>',
+            '</table>',
+            '<br />',
+            ].join("\n"));
          tablestart('Provide a "Done" button to students?');
          choicewrite('<tr><td>Value:</td><td colspan="2">');
          choicewrite('<label><input name="donebutton" value="_done"'+




More information about the LON-CAPA-cvs mailing list