[LON-CAPA-cvs] cvs: loncom /interface lonsyllabus.pm

raeburn raeburn at source.lon-capa.org
Sun May 19 11:48:51 EDT 2013


raeburn		Sun May 19 15:48:51 2013 EDT

  Modified files:              
    /loncom/interface	lonsyllabus.pm 
  Log:
  - Distinguish delete buttons for "Minimal template" and "Uploaded file" on
    Syllabus editing page. 
  
  
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.127 loncom/interface/lonsyllabus.pm:1.128
--- loncom/interface/lonsyllabus.pm:1.127	Thu May 16 20:03:51 2013
+++ loncom/interface/lonsyllabus.pm	Sun May 19 15:48:51 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Syllabus
 #
-# $Id: lonsyllabus.pm,v 1.127 2013/05/16 20:03:51 raeburn Exp $
+# $Id: lonsyllabus.pm,v 1.128 2013/05/19 15:48:51 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1067,10 +1067,10 @@
     unless ((ref($syllabus) eq 'HASH') && (ref($syllabusfields) eq 'HASH')) {
         return ($earlyout,$uploaded,$external,$minimal,$output);
     }
-    if ($env{'form.deleteuploaded'}) {
+    if (($env{'form.deleteuploaded_file'}) || ($env{'form.deleteuploaded_minimal'})) {
         my %storehash;
         if (($env{'form.choice'} eq 'file') && 
-            ($env{'form.deleteuploaded'} eq 'file') && ($uploaded =~ /\w/)) {
+            ($env{'form.deleteuploaded_file'}) && ($uploaded =~ /\w/)) {
             &Apache::lonnet::delenv('course.'.$env{'request.course.id'}.'.uploadedsyllabus');
             &Apache::lonnet::delenv('course.'.$env{'request.course.id'}.'.externalsyllabus');
             $storehash{'uploadedsyllabus'} = '';
@@ -1079,7 +1079,7 @@
             undef($uploaded);
             undef($external);
         } elsif (($env{'form.choice'} eq 'minimal') &&
-                 ($env{'form.deleteuploaded'} eq 'minimal') && ($minimal =~ /\w/)) {
+                 ($env{'form.deleteuploaded_minimal'}) && ($minimal =~ /\w/)) {
             &Apache::lonnet::delenv('course.'.$env{'request.course.id'}.'.externalsyllabus');
             &Apache::lonnet::delenv('course.'.$env{'request.course.id'}.'.minimalsyllabus');
             $storehash{'externalsyllabus'} = '';
@@ -1527,7 +1527,7 @@
     }
     $output .= '
                 <input type="button" value="'.$deltext.'" onclick="javascript:dodelete('."'$context'".');" name="del_'.$context.'" />
-                <input type="hidden" value="" name="deleteuploaded" />
+                <input type="hidden" value="" name="deleteuploaded_'.$context.'" id="deleteuploaded_'.$context.'" />
     ';
     return $output;
 }
@@ -1545,15 +1545,17 @@
                       document.location.href = url+'?editmode=1&forceedit=1';
                   }
                   function dodelete(caller,url) {
-                      document.syllabus.deleteuploaded.value=caller;
-                      if (caller == 'minimal') {
-                          if (confirm("$lt{'min'}"+"\\n"+"$lt{'noundo'}")) {
-                              document.syllabus.submit();
+                      if (document.getElementById('deleteuploaded_'+caller)) {
+                          document.getElementById('deleteuploaded_'+caller).value=1;
+                          if (caller == 'minimal') {
+                              if (confirm("$lt{'min'}"+"\\n"+"$lt{'noundo'}")) {
+                                  document.syllabus.submit();
+                              }
                           }
-                      }
-                      if (caller == 'file') {
-                          if (confirm("$lt{'file'}"+"\\n"+"$lt{'noundo'}")) {
-                              document.syllabus.submit();
+                          if (caller == 'file') {
+                              if (confirm("$lt{'file'}"+"\\n"+"$lt{'noundo'}")) {
+                                  document.syllabus.submit();
+                              }
                           }
                       }
                       return;   




More information about the LON-CAPA-cvs mailing list