[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm structuretags.pm

raeburn raeburn@source.lon-capa.org
Fri, 31 Dec 2010 00:58:10 -0000


raeburn		Fri Dec 31 00:58:10 2010 EDT

  Modified files:              
    /loncom/homework	structuretags.pm inputtags.pm 
  Log:
  - xhtml. unique form element IDs.  
  - If user cancels deletion of previously submitted files, uncheck "Delete?"
    checkboxes.
  - Clarification on how to disassociate previously submitted files for 
    dropbox or bridge task assessment items.
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.481 loncom/homework/structuretags.pm:1.482
--- loncom/homework/structuretags.pm:1.481	Mon Dec 20 18:33:20 2010
+++ loncom/homework/structuretags.pm	Fri Dec 31 00:58:10 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.481 2010/12/20 18:33:20 raeburn Exp $
+# $Id: structuretags.pm,v 1.482 2010/12/31 00:58:10 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -168,28 +168,31 @@
     return <<"ENDSCRIPT";
 <script type="text/javascript">
 function file_deletion_check(formname) {
-    var str = new RegExp("^HWFILE.+_delete\$");
-    var delfilecount = 0;
     var elemnum = formname.elements.length;
     if (elemnum == 0) {
         return true;
     }
-    for (i=0; i<formname.elements.length; i++) {
+    var str = new RegExp("^HWFILE.+_delete\$");
+    var delboxes = new Array();
+    for (var 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 {
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.275 loncom/homework/inputtags.pm:1.276
--- loncom/homework/inputtags.pm:1.275	Sun Dec 19 21:12:20 2010
+++ loncom/homework/inputtags.pm	Fri Dec 31 00:58:10 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.275 2010/12/19 21:12:20 raeburn Exp $
+# $Id: inputtags.pm,v 1.276 2010/12/31 00:58:10 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -595,9 +595,9 @@
             }
         }
     }
+    my $num = 0;
     foreach my $name (sort(keys(%okfiles))) {
         if (ref($okfiles{$name}) eq 'ARRAY') {
-            my $num = 0;
             foreach my $url (@{$okfiles{$name}}) {
                 if (ref($rows{$url}) eq 'HASH') {
                     my $link = $rows{$url}{link};
@@ -635,7 +635,7 @@
     if ($header_shown) {
         $result .= &Apache::loncommon::end_data_table().
                    '<br /><span class="LC_warning">'.
-                   &mt('Items checked for deletion will not be included amongst the files evaluated when your submission is graded.').'</span>';
+                   &mt('Exclude existing file(s) from grading by checking the "Delete?" checkbox(es) and clicking "Submit Answer"').'</span>';
     }
     if (@bad_file_list) {
         my $bad_files = '<span class="LC_filename">'.