[LON-CAPA-cvs] cvs: loncom /interface courseprefs.pm lonrelrequtils.pm /misc releaseslist.xml

raeburn raeburn at source.lon-capa.org
Tue Jan 2 09:43:24 EST 2018


raeburn		Tue Jan  2 14:43:24 2018 EDT

  Modified files:              
    /loncom/interface	lonrelrequtils.pm courseprefs.pm 
    /loncom/misc	releaseslist.xml 
  Log:
  - Bug 6754 LON-CAPA as LTI Consumer
    - If a course has an External Tool (LTI), then LON-CAPA 2.12 is needed.
  
  
-------------- next part --------------
Index: loncom/interface/lonrelrequtils.pm
diff -u loncom/interface/lonrelrequtils.pm:1.5 loncom/interface/lonrelrequtils.pm:1.6
--- loncom/interface/lonrelrequtils.pm:1.5	Fri Mar  4 21:43:16 2016
+++ loncom/interface/lonrelrequtils.pm	Tue Jan  2 14:43:17 2018
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # The LearningOnline Network
 #
-# $Id: lonrelrequtils.pm,v 1.5 2016/03/04 21:43:16 raeburn Exp $
+# $Id: lonrelrequtils.pm,v 1.6 2018/01/02 14:43:17 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -271,6 +271,7 @@
     %Apache::lonrelrequtils::checkcrstypes = ();
     %Apache::lonrelrequtils::anonsurvey = ();
     %Apache::lonrelrequtils::randomizetry = ();
+    %Apache::lonrelrequtils::exttool = ();
 
     foreach my $key (keys(%Apache::lonnet::needsrelease)) {
         my ($item,$name,$value,$valuematch,$namematch) = split(/:/,$key);
@@ -304,6 +305,11 @@
         } elsif ($item eq 'course') {
             if ($name eq 'crstype') {
                 $Apache::lonrelrequtils::checkcrstypes{$value} = $Apache::lonnet::needsrelease{$key};
+            } elsif ($name eq 'courserestype') {
+                if ($value eq 'exttool') {
+                    ($Apache::lonrelrequtils::exttool{major},$Apache::lonrelrequtils::exttool{minor}) =
+                    split(/\./,$Apache::lonnet::needsrelease{$key});
+                }
             }
         }
     }
@@ -475,8 +481,12 @@
         my %randomizetrysubm = &Apache::lonnet::dump('nohist_randomizetry',
                                                      $cdom,$cnum);
         my %allresponses;
-        my ($anonsurv_subm,$randbytry_subm);
-        foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_problem() },1,0)) {
+        my ($anonsurv_subm,$randbytry_subm,$exttool);
+        foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_problem() || $_[0]->is_tool() },1,0)) {
+            if ($res->is_tool()) {
+                $exttool ++;
+                next;
+            }
             my %responses = $res->responseTypes();
             foreach my $key (keys(%responses)) {
                 next unless(exists($Apache::lonrelrequtils::checkresponsetypes{$key}));
@@ -497,6 +507,10 @@
             my ($major,$minor) = split(/\./,$Apache::lonrelrequtils::checkresponsetypes{$key});
             ($reqdmajor,$reqdminor) = &update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor);
         }
+        if ($exttool) {
+            ($reqdmajor,$reqdminor) = &update_reqd_loncaparev($Apache::lonrelrequtils::exttool{major},
+                                                              $Apache::lonrelrequtils::exttool{minor}); 
+        }
         if ($anonsurv_subm) {
             ($reqdmajor,$reqdminor) = &update_reqd_loncaparev($Apache::lonrelrequtils::anonsurvey{major},
                                           $Apache::lonrelrequtils::anonsurvey{minor},$reqdmajor,$reqdminor);
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.84 loncom/interface/courseprefs.pm:1.85
--- loncom/interface/courseprefs.pm:1.84	Tue Feb  7 15:44:23 2017
+++ loncom/interface/courseprefs.pm	Tue Jan  2 14:43:17 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set configuration settings for a course
 #
-# $Id: courseprefs.pm,v 1.84 2017/02/07 15:44:23 raeburn Exp $
+# $Id: courseprefs.pm,v 1.85 2018/01/02 14:43:17 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2580,7 +2580,7 @@
                               $Apache::lonrelrequtils::checkcrstypes{$crstype}).'</h4>';
     }
     my (%fromparam,%rowspan,%bymap,%byresource, at scopeorder,%toshow,%allmaps,
-        %byresponsetype,%bysubmission,%fromblocks);
+        %byresponsetype,%bysubmission,%fromblocks,%bycrsrestype);
     @scopeorder = ('all','section/group','user');
     my $now = time;
     my $resourcedata = &Apache::lonparmset::readdata($cnum,$cdom);
@@ -2854,15 +2854,22 @@
         my $rev_anonsurv=$Apache::lonnet::needsrelease{'parameter:type:anonsurvey::'};
         my %randtrysubms=&Apache::lonnet::dump('nohist_randomizetry',$cdom,$cnum);
         my $rev_randtry=$Apache::lonnet::needsrelease{'parameter:type:randomizetry::'};
+        my $rev_exttool=$Apache::lonnet::needsrelease{'course:courserestype:exttool'};
         my $stdtype=&Apache::lonparmset::standard_parameter_types('type');
         my $stdname=&Apache::lonparmset::standard_parameter_names('type');
         my $valanon=&get_param_description($stdtype,'anonsurvey');
         my $valrandtry=&get_param_description($stdtype,'randomizetry');
         my %checkedrev;
-        foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_problem() },1,0)) {
+        foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_problem() || $_[0]->is_tool() },1,0)) {
             my @parts = @{$res->parts()};
             my $symb = $res->symb();
             my $enclosing_map = &Apache::lonnet::declutter($res->enclosing_map_src());
+            if ($res->is_tool()) {
+                my $rev = $rev_exttool;
+                $bycrsrestype{$symb}{$rev} = &mt('External Tool');
+                $allmaps{$enclosing_map} = 1;
+                next;
+            }
             foreach my $part (@parts) {
                 if (exists($anonsubms{$symb."\0".$part})) {
                     my $rev = $rev_anonsurv;
@@ -2966,7 +2973,7 @@
         $r->print($output);
         if (defined($navmap)) {
             &show_contents_view($r,$navmap,$cid,\%toshow,\%bymap,\%byresource,\%bysubmission,
-                                \%byresponsetype,\@scopeorder,\%lt);
+                                \%byresponsetype,\%bycrsrestype,\@scopeorder,\%lt);
         }
         $r->print('<br /><br />'); 
     } else {
@@ -2984,9 +2991,10 @@
 
 sub show_contents_view {
     my ($r,$navmap,$cid,$toshow,$bymap,$byresource,$bysubmission,$byresponsetype,
-        $scopeorder,$lt) = @_;
+        $bycrsrestype,$scopeorder,$lt) = @_;
     if ((keys(%{$toshow}) > 0) || (keys(%{$byresource}) > 0) || 
-        (keys(%{$bysubmission}) > 0) || (keys(%{$byresponsetype}) > 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="" />';
@@ -3050,6 +3058,9 @@
                     if (ref($byresponsetype->{$symb}) eq 'HASH') {
                         $rowspan += scalar(keys(%{$byresponsetype->{$symb}}));
                     }
+                    if (ref($bycrsrestype->{$symb}) eq 'HASH') {
+                        $rowspan += scalar(keys(%{$bycrsrestype->{$symb}}));
+                    }
                     next if (!$rowspan);
                     $icon = '<img class="LC_contentImage" src="'.$location.'/problem.gif" alt="'.
                             &mt('Problem').'" />';
@@ -3114,6 +3125,15 @@
                             $r->print('</td>');
                         }
                         $r->print(&Apache::loncommon::end_data_table_row());
+                        $newrow = 1;
+                    }
+                    if (ref($bycrsrestype->{$symb}) eq 'HASH') {
+                        foreach my $rev (sort(keys(%{$bycrsrestype->{$symb}}))) {
+                            if ($newrow) {
+                                $r->print(&Apache::loncommon::continue_data_table_row());
+                            }
+                            $r->print('<td>'.$rev.'</td><td>'.$bycrsrestype->{$symb}{$rev}.'</td>');
+                        }
                     }
                 }
             }
Index: loncom/misc/releaseslist.xml
diff -u loncom/misc/releaseslist.xml:1.16 loncom/misc/releaseslist.xml:1.17
--- loncom/misc/releaseslist.xml:1.16	Mon Jun 26 01:57:07 2017
+++ loncom/misc/releaseslist.xml	Tue Jan  2 14:43:24 2018
@@ -6,6 +6,7 @@
 <course name="commblock" value="passwd">2.12</course>
 <course name="commblock" value="reinit">2.12</course>
 <course name="commblock" value="alert">2.12</course>
+<course name="courserestype" value="exttool">2.12</course>
 <parameter name="type" value="anonsurvey">2.10</parameter>
 <parameter name="type" value="anonsurveycred">2.10</parameter>
 <parameter name="type" value="surveycred">2.10</parameter>


More information about the LON-CAPA-cvs mailing list