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

raeburn raeburn at source.lon-capa.org
Fri Dec 29 10:55:21 EST 2017


raeburn		Fri Dec 29 15:55:21 2017 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - When recovering deleted external tools, set gradable parameter for resource 
    in map from value in exttool_$marker.db file. 
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.647 loncom/interface/londocs.pm:1.648
--- loncom/interface/londocs.pm:1.647	Fri Dec 29 15:11:18 2017
+++ loncom/interface/londocs.pm	Fri Dec 29 15:55:21 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.647 2017/12/29 15:11:18 raeburn Exp $
+# $Id: londocs.pm,v 1.648 2017/12/29 15:55:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -677,7 +677,9 @@
                     $toolhash{$item} = &unescape($toolhash{$item});
                 }
                 if ($folder =~ /^supplemental/) {
-                    delete($toolhash{'gradable'}); 
+                    delete($toolhash{'gradable'});
+                } else {
+                    $toolhash{'gradable'} =~ s/\D+//g;
                 }
                 if (ref($ltitoolsref) eq 'HASH') {
                     if (ref($ltitoolsref->{$toolid}) eq 'HASH') {
@@ -768,13 +770,19 @@
                         }
                         my $changegradable;
                         if (($residx) && ($folder =~ /^default/)) {
-                            if (exists($toolsettings{'gradable'})) {
-                                if (!exists($toolhash{'gradable'})) {
+                            if ($toolsettings{'gradable'}) {
+                                unless (($toolhash{'gradable'}) || (defined($LONCAPA::map::zombies[$residx]))) {
                                     push(@deleted,'gradable');
                                     $changegradable = 1;
                                 }
-                            } elsif (exists($toolhash{'gradable'})) {
+                            } elsif ($toolhash{'gradable'}) {
+                                $changegradable = 1;
+                            }
+                            if (($caller eq 'londocs') && (defined($LONCAPA::map::zombies[$residx]))) {
                                 $changegradable = 1;
+                                if ($toolsettings{'gradable'}) {
+                                    $toolhash{'gradable'} = 1;
+                                }
                             }
                         }
                         my $putres = &Apache::lonnet::put('exttool_'.$marker,\%toolhash,$coursedom,$coursenum);
@@ -1892,7 +1900,7 @@
         }
         if ($url=~ m{/(bulletinboard|smppg|ext\.tool)$}) {
             my $prefix = $1;
-            my $fromothercrs; 
+            my $fromothercrs;
             #need to copy the db contents to a new one, unless this is a move.
             my %info = (
                          src  => $url,




More information about the LON-CAPA-cvs mailing list