[LON-CAPA-cvs] cvs: loncom /interface courseprefs.pm loncommon.pm lonrelrequtils.pm /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Tue Jan 2 23:21:03 EST 2018


raeburn		Wed Jan  3 04:21:03 2018 EDT

  Modified files:              
    /loncom/interface	courseprefs.pm lonrelrequtils.pm loncommon.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Bug 6754 LON-CAPA as LTI Consumer
   - If a course has an External Tool (LTI) in Supplemental Content, then 
     LON-CAPA 2.12 is needed.
  
  
-------------- next part --------------
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.85 loncom/interface/courseprefs.pm:1.86
--- loncom/interface/courseprefs.pm:1.85	Tue Jan  2 14:43:17 2018
+++ loncom/interface/courseprefs.pm	Wed Jan  3 04:20:54 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set configuration settings for a course
 #
-# $Id: courseprefs.pm,v 1.85 2018/01/02 14:43:17 raeburn Exp $
+# $Id: courseprefs.pm,v 1.86 2018/01/03 04:20:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2957,6 +2957,10 @@
             }
         }
     }
+    my $suppmap = 'supplemental.sequence';
+    my ($suppcount,$supptools,$errors) = (0,0,0);
+    ($suppcount,$supptools,$errors) = &Apache::loncommon::recurse_supplemental($cnum,$cdom,
+                                                      $suppmap,$suppcount,$supptools,$errors);
     my $mapres_header = '<h4>'.
                         &mt('Requirements for specific folders or resources').
                         '</h4>';
@@ -2971,9 +2975,9 @@
     $r->print($start_page.$top_header);
     if ($output) {
         $r->print($output);
-        if (defined($navmap)) {
+        if (defined($navmap) || $supptools) {
             &show_contents_view($r,$navmap,$cid,\%toshow,\%bymap,\%byresource,\%bysubmission,
-                                \%byresponsetype,\%bycrsrestype,\@scopeorder,\%lt);
+                                \%byresponsetype,\%bycrsrestype,\@scopeorder,\%lt,$supptools);
         }
         $r->print('<br /><br />'); 
     } else {
@@ -2991,23 +2995,30 @@
 
 sub show_contents_view {
     my ($r,$navmap,$cid,$toshow,$bymap,$byresource,$bysubmission,$byresponsetype,
-        $bycrsrestype,$scopeorder,$lt) = @_;
-    if ((keys(%{$toshow}) > 0) || (keys(%{$byresource}) > 0) || 
-        (keys(%{$bysubmission}) > 0) || (keys(%{$byresponsetype}) > 0) ||
-        (keys(%{$bycrsrestype}) > 0)) {
-        my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons");
-        my $whitespace = '<img src="'.$location.'/whitespace_21.gif" alt="" />';
-        my $icon =  '<img src="'.$location.'/navmap.folder.open.gif" alt="" />';
+        $bycrsrestype,$scopeorder,$lt,$supptools) = @_;
+    my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons");
+    my $whitespace = '<img src="'.$location.'/whitespace_21.gif" alt="" />';
+    my $showmaincontent;
+    if ((ref($navmap)) &&
+        ((keys(%{$toshow}) > 0) || (keys(%{$byresource}) > 0) ||
+         (keys(%{$bysubmission}) > 0) || (keys(%{$byresponsetype}) > 0) ||
+         (keys(%{$bycrsrestype}) > 0))) {
+        $showmaincontent = 1;
+    }
+    if ($showmaincontent || $supptools) {
+        $r->print(&Apache::loncommon::start_data_table());
+    }
+    if ($showmaincontent) {
+        my $icon = '<img src="'.$location.'/navmap.folder.open.gif" alt="" />';
         my $topmap = $env{'course.'.$cid.'.url'};
-        $r->print(&Apache::loncommon::start_data_table().
-                  &Apache::loncommon::start_data_table_header_row().
+        $r->print(&Apache::loncommon::start_data_table_header_row().
                   '<th>'.&mt('Location').'</th><th>'.&mt('Release').'</th>'.
                   '<th>'.&mt('Attribute/Setting').'</th>'.
                   &Apache::loncommon::end_data_table_header_row().
                   &Apache::loncommon::start_data_table_row().
                   '<td> '.$icon.' '.&mt('Main Content').'</td>');
-                  &releases_by_map($r,$bymap,$topmap,$scopeorder,$lt);
-                  $r->print(&Apache::loncommon::end_data_table_row());
+        &releases_by_map($r,$bymap,$topmap,$scopeorder,$lt);
+        $r->print(&Apache::loncommon::end_data_table_row());
         my $it=$navmap->getIterator(undef,undef,undef,1,1,undef);
         my $curRes;
         my $depth = 0;
@@ -3134,10 +3145,28 @@
                             }
                             $r->print('<td>'.$rev.'</td><td>'.$bycrsrestype->{$symb}{$rev}.'</td>');
                         }
+                        $r->print(&Apache::loncommon::end_data_table_row());
                     }
                 }
             }
         }
+    }
+    if ($supptools) {
+        my $icon = '<img src="'.$location.'/navmap.folder.open.gif" alt="" />';
+        $r->print(&Apache::loncommon::start_data_table_header_row().
+                  '<th>'.&mt('Location').'</th><th>'.&mt('Release').'</th>'.
+                  '<th>'.&mt('Resource Type').'</th>'.
+                  &Apache::loncommon::end_data_table_header_row().
+                  &Apache::loncommon::start_data_table_row().
+                  '<td> '.$icon.' '.&mt('Supplemental Content').'</td>'.
+                  '<td valign="middle">'.
+                  $Apache::lonrelrequtils::exttool{'major'}.'.'.
+                  $Apache::lonrelrequtils::exttool{'minor'}.
+                  '</td><td>'.&mt('[quant,_1,External Tool,External Tools]',
+                                  $supptools).'</td>'.
+                  &Apache::loncommon::end_data_table_row());
+    }
+    if ($showmaincontent || $supptools) {
         $r->print(&Apache::loncommon::end_data_table());
     }
     return;
Index: loncom/interface/lonrelrequtils.pm
diff -u loncom/interface/lonrelrequtils.pm:1.6 loncom/interface/lonrelrequtils.pm:1.7
--- loncom/interface/lonrelrequtils.pm:1.6	Tue Jan  2 14:43:17 2018
+++ loncom/interface/lonrelrequtils.pm	Wed Jan  3 04:20:54 2018
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # The LearningOnline Network
 #
-# $Id: lonrelrequtils.pm,v 1.6 2018/01/02 14:43:17 raeburn Exp $
+# $Id: lonrelrequtils.pm,v 1.7 2018/01/03 04:20:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -520,6 +520,14 @@
                                           $Apache::lonrelrequtils::randomizetry{minor},$reqdmajor,$reqdminor);
         }
     }
+    my $suppmap = 'supplemental.sequence';
+    my ($suppcount,$suppexttools,$errors) = (0,0,0);
+    ($suppcount,$suppexttools,$errors) =
+       &Apache::loncommon::recurse_supplemental($cnum,$cdom,$suppmap,$suppcount,$suppexttools,$errors);
+    if ($suppexttools) {
+        ($reqdmajor,$reqdminor) = &update_reqd_loncaparev($Apache::lonrelrequtils::exttool{major},
+                                                          $Apache::lonrelrequtils::exttool{minor});
+    }
     return ($reqdmajor,$reqdminor);
 }
 
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1307 loncom/interface/loncommon.pm:1.1308
--- loncom/interface/loncommon.pm:1.1307	Tue Jan  2 16:53:27 2018
+++ loncom/interface/loncommon.pm	Wed Jan  3 04:20:54 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1307 2018/01/02 16:53:27 raeburn Exp $
+# $Id: loncommon.pm,v 1.1308 2018/01/03 04:20:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -17358,13 +17358,23 @@
             }
         }
         foreach my $key (keys(%allcrsrestypes)) {
-            my ($major,$minor) = split(/\./,$checkcrsrestypes{'exttool'});
+            my ($major,$minor) = split(/\./,$checkcrsrestypes{$key});
             if (($major > $reqdmajor) || ($major == $reqdmajor && $minor > $reqdminor)) {
                 ($reqdmajor,$reqdminor) = ($major,$minor);
             }
         }
         undef($navmap);
     }
+    my $suppmap = 'supplemental.sequence';
+    my ($suppcount,$supptools,$errors) = (0,0,0);
+    ($suppcount,$supptools,$errors) = &recurse_supplemental($cnum,$cdom,$suppmap,
+                                                            $suppcount,$supptools,$errors);
+    if ($supptools) {
+        my ($major,$minor) = split(/\./,$checkcrsrestypes{'exttool'});
+        if (($major > $reqdmajor) || ($major == $reqdmajor && $minor > $reqdminor)) {
+            ($reqdmajor,$reqdminor) = ($major,$minor);
+        }
+    }
     unless (($reqdmajor eq '') && ($reqdminor eq '')) {
         &Apache::lonnet::update_released_required($reqdmajor.'.'.$reqdminor,$cdom,$cnum,$chome,$cid);
     }
@@ -17421,7 +17431,7 @@
 }
 
 sub recurse_supplemental {
-    my ($cnum,$cdom,$suppmap,$numfiles,$errors) = @_;
+    my ($cnum,$cdom,$suppmap,$numfiles,$numexttools,$errors) = @_;
     if ($suppmap) {
         my ($errtext,$fatal) = &LONCAPA::map::mapread('/uploaded/'.$cdom.'/'.$cnum.'/'.$suppmap);
         if ($fatal) {
@@ -17432,8 +17442,12 @@
                     my ($title,$src,$ext,$type,$status)=split(/\:/,$res);
                     if (($src ne '') && ($status eq 'res')) {
                         if ($src =~ m{^\Q/uploaded/$cdom/$cnum/\E(supplemental_\d+\.sequence)$}) {
-                            ($numfiles,$errors) = &recurse_supplemental($cnum,$cdom,$1,$numfiles,$errors);
+                            ($numfiles,$numexttools,$errors) = &recurse_supplemental($cnum,$cdom,$1,
+                                                                   $numfiles,$numexttools,$errors);
                         } else {
+                            if ($src =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}) {
+                                $numexttools ++;
+                            }
                             $numfiles ++;
                         }
                     }
@@ -17441,7 +17455,7 @@
             }
         }
     }
-    return ($numfiles,$errors);
+    return ($numfiles,$numexttools,$errors);
 }
 
 sub symb_to_docspath {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1365 loncom/lonnet/perl/lonnet.pm:1.1366
--- loncom/lonnet/perl/lonnet.pm:1.1365	Fri Dec 29 23:51:50 2017
+++ loncom/lonnet/perl/lonnet.pm	Wed Jan  3 04:21:02 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1365 2017/12/29 23:51:50 raeburn Exp $
+# $Id: lonnet.pm,v 1.1366 2018/01/03 04:21:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -11204,10 +11204,11 @@
     unless (defined($cached)) {
         my $chome=&homeserver($cnum,$cdom);
         unless ($chome eq 'no_host') {
-            ($suppcount,my $errors) = (0,0);
+            ($suppcount,my $supptools,my $errors) = (0,0,0);
             my $suppmap = 'supplemental.sequence';
-            ($suppcount,$errors) = 
-                &Apache::loncommon::recurse_supplemental($cnum,$cdom,$suppmap,$suppcount,$errors);
+            ($suppcount,$supptools,$errors) =
+                &Apache::loncommon::recurse_supplemental($cnum,$cdom,$suppmap,$suppcount,
+                                                         $supptools,$errors);
         }
         &do_cache_new('suppcount',$hashid,$suppcount,600);
     }


More information about the LON-CAPA-cvs mailing list