[LON-CAPA-cvs] cvs: loncom(version_2_10_X) /homework structuretags.pm

raeburn raeburn@source.lon-capa.org
Fri, 31 Dec 2010 19:24:48 -0000


raeburn		Fri Dec 31 19:24:48 2010 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/homework	structuretags.pm 
  Log:
  - Backport 1.482, 1.483.
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.465.2.8 loncom/homework/structuretags.pm:1.465.2.9
--- loncom/homework/structuretags.pm:1.465.2.8	Mon Dec 20 21:40:55 2010
+++ loncom/homework/structuretags.pm	Fri Dec 31 19:24:48 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.465.2.8 2010/12/20 21:40:55 raeburn Exp $
+# $Id: structuretags.pm,v 1.465.2.9 2010/12/31 19:24:48 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -128,6 +128,7 @@
            &setmode_javascript().
 	<<'JS';
 <script type="text/javascript">
+// <![CDATA[
 function setSubmittedPart (part) {
    this.document.lonhomework.submitted.value="part_"+part;
 }
@@ -143,9 +144,9 @@
     var y= e.clientY-getY(img_element)+Geometry.getVerticalScroll();
     var click = x+':'+y;
     input_element.value = click;
-    img_element.src = '/adm/randomlabel.png?token='+token+'&clickdata='+click;
+    img_element.src = '/adm/randomlabel.png?token='+token+'&amp;clickdata='+click;
 }
-
+// ]]>
 </script>
 JS
 }
@@ -167,35 +168,40 @@
                           &mt('Submit Answer?');
     return <<"ENDSCRIPT";
 <script type="text/javascript">
+// <![CDATA[
 function file_deletion_check(formname) {
-    var str = new RegExp("^HWFILE.+_delete\$");
-    var delfilecount = 0;
     var elemnum = formname.elements.length;
     if (elemnum == 0) {
         return true;
     }
+    var str = new RegExp("^HWFILE.+_delete\$");
+    var delboxes = new Array();
     for (i=0; i<formname.elements.length; i++) {
         var id = formname.elements[i].id;
         if (id != '') {
             if (str.test(id)) {
                 if (formname.elements[i].type == 'checkbox') {
                     if (formname.elements[i].checked) {
-                        delfilecount ++;
+                        delboxes.push(id);
                     }
                 }
             }
         }
     }
-    if (delfilecount > 0) {
+    if (delboxes.length > 0) {
         if (confirm("$delfilewarn")) {
             return true;
         } else {
+            for (var j=0; j<delboxes.length; j++) {
+                formname.elements[delboxes[j]].checked = false;
+            }
             return false;
         }
     } else {
         return true;
     }
 }
+// ]]>
 </script>
 ENDSCRIPT
 }