[LON-CAPA-cvs] cvs: modules /gci londocsgci.pm

gci gci@source.lon-capa.org
Sat, 09 Jan 2010 01:07:56 -0000


gci		Sat Jan  9 01:07:56 2010 EDT

  Modified files:              
    /modules/gci	londocsgci.pm 
  Log:
  - Customization for GCI_3 to keep IE8 happy.
    - Use ids for form tags for question checkboxes and bin counts.
    - Use document.getElementById(id) to retrieve the form element
       for Javascript operations.
  
  
Index: modules/gci/londocsgci.pm
diff -u modules/gci/londocsgci.pm:1.9 modules/gci/londocsgci.pm:1.10
--- modules/gci/londocsgci.pm:1.9	Tue Jan  5 23:54:31 2010
+++ modules/gci/londocsgci.pm	Sat Jan  9 01:07:56 2010
@@ -2,7 +2,7 @@
 # Custom Edit Course Routines for Assembly of Valid Concept Tests from
 # Geoscience Concept Inventory. 
 #
-# $Id: londocsgci.pm,v 1.9 2010/01/05 23:54:31 gci Exp $
+# $Id: londocsgci.pm,v 1.10 2010/01/09 01:07:56 gci Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -243,7 +243,8 @@
                 &Apache::lonhtmlcommon::row_closure(1).
                 &Apache::lonhtmlcommon::row_title(&mt('Close date')).
                 $endform.
-                 &Apache::lonhtmlcommon::end_pick_box().'<br />'. 
+                &Apache::lonhtmlcommon::row_closure(1).
+                &Apache::lonhtmlcommon::end_pick_box().'<br />'. 
                 '<input type="hidden" name="phase" value="storeparms" />'.
                 '<input type="submit" value="'.$datebutton.'" />'.
                 '</form></fieldset></p>');
@@ -309,7 +310,7 @@
                    'value="'.$fixed{$catname}.'" readonly="readonly" />').'</legend>';
     } else {
         $output .= '<legend>'.&mt('[_1]: currently [_2] selected',$catlegend,
-                   '<input type="text" name="'.$countid.'" size="1" value="'.
+                   '<input type="text" name="'.$countid.'" id="'.$countid.'" size="1" value="'.
                    $total.'" readonly="readonly" />').'</legend>';
     }
     $output .= '<span id="'.$titleid.'">'.
@@ -333,7 +334,7 @@
         } elsif ($catname eq 'development') {
             $output .= '<input type="hidden" name="pilot'.$item.'" value="checked" />';
         } else {
-            $output .= '<input type="checkbox" name="item'.$item.'"';
+            $output .= '<input type="checkbox" name="item'.$item.'" id="item'.$item.'"';
             if ($chosenitems->{$item}) { $output .= ' checked="checked"'; }
             $output .= ' onclick="countChecked('."'$catname'".');';
             my $binname;
@@ -606,11 +607,13 @@
     my $prereqjs = "
 function checkPrereqs(caller,item,prereq,binname) {
     var changedPrereq = 0;
-    if (document.selecteditems.elements['item'+item].checked == false) {
+    element = document.getElementById('item'+item);
+    if (element.checked == false) {
         return;
     } else {
-        if (!document.selecteditems.elements['item'+prereq].checked) {
-            document.selecteditems.elements['item'+prereq].checked = true;
+        prereqelement = document.getElementById('item'+prereq);
+        if (!prereqelement.checked) {
+            prereqelement.checked = true;
             changedPrereq = 1;
             countChecked(binname);
         }
@@ -695,13 +698,15 @@
             if (document.selecteditems.elements[i].value == binname) {
                 var itemname = document.selecteditems.elements[i].name;
                 var itemnum = itemname.substr(9);
-                if (document.selecteditems.elements['item'+itemnum].checked) {
+                element = document.getElementById('item'+itemnum);
+                if (element.checked) {
                     count ++;
                 }
             }
         }
     }
-    document.selecteditems.elements['GCI_'+binname+'_count'].value = count;
+    countelement = document.getElementById('GCI_'+binname+'_count');
+    countelement.value = count;
 }
 
 function validTestCheck() {
@@ -709,7 +714,8 @@
     for (var i=0; i<11; i++) {
         var binname = 'GCI_bin'+i+'_count';
         var j = i+1;
-        if (document.selecteditems.elements[binname].value < 1) {
+        countelement = document.getElementById(binname);        
+        if (countelement.value < 1) {
             empty = empty +' '+j;
         }
     }