[LON-CAPA-cvs] cvs: loncom /interface londocs.pm lonextresedit.pm lonexttool.pm /lonnet/perl lonnet.pm rat lonwrapper.pm

raeburn raeburn at source.lon-capa.org
Thu Nov 30 09:41:38 EST 2017


raeburn		Thu Nov 30 14:41:38 2017 EDT

  Modified files:              
    /loncom/interface	londocs.pm lonextresedit.pm lonexttool.pm 
    /rat	lonwrapper.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Bug 6754 LTI Integration.
    Rename get_domain_ltitools() routine in lonnet.pm as get_domain_lti(),
    and require second argument -- $context -- either: consumer or provider). 
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.643 loncom/interface/londocs.pm:1.644
--- loncom/interface/londocs.pm:1.643	Thu Nov 30 02:17:50 2017
+++ loncom/interface/londocs.pm	Thu Nov 30 14:41:20 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.643 2017/11/30 02:17:50 raeburn Exp $
+# $Id: londocs.pm,v 1.644 2017/11/30 14:41:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5601,7 +5601,7 @@
                 }
             }
             my $tabidstr = join("','", at tabids);
-            %ltitools = &Apache::lonnet::get_domain_ltitools($coursedom);
+            %ltitools = &Apache::lonnet::get_domain_lti($coursedom,'consumer');
             my $posslti = keys(%ltitools);
             my $hostname = $r->hostname();
 	    $script .= &editing_js($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti,
Index: loncom/interface/lonextresedit.pm
diff -u loncom/interface/lonextresedit.pm:1.20 loncom/interface/lonextresedit.pm:1.21
--- loncom/interface/lonextresedit.pm:1.20	Thu Nov 30 01:52:14 2017
+++ loncom/interface/lonextresedit.pm	Thu Nov 30 14:41:20 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: lonextresedit.pm,v 1.20 2017/11/30 01:52:14 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.21 2017/11/30 14:41:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -98,7 +98,7 @@
     }
     my %ltitools;
     if ($type eq 'tool') {
-        %ltitools = &Apache::lonnet::get_domain_ltitools($cdom);
+        %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer');
     }
     my $js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript());
     my $pathitem = '<input type="hidden" name="folderpath" value="'.
@@ -621,7 +621,7 @@
     }
     my %ltitools;
     if ($type eq 'tool') {
-        %ltitools = &Apache::lonnet::get_domain_ltitools($cdom);
+        %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer');
     }
     $js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript());
     my $args = { 'force_register' => $env{'form.register'} };
Index: loncom/interface/lonexttool.pm
diff -u loncom/interface/lonexttool.pm:1.6 loncom/interface/lonexttool.pm:1.7
--- loncom/interface/lonexttool.pm:1.6	Thu Nov 30 02:17:50 2017
+++ loncom/interface/lonexttool.pm	Thu Nov 30 14:41:20 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Launch External Tool Provider (LTI)
 #
-# $Id: lonexttool.pm,v 1.6 2017/11/30 02:17:50 raeburn Exp $
+# $Id: lonexttool.pm,v 1.7 2017/11/30 14:41:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -96,7 +96,7 @@
         my %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum);
         if ($toolsettings{'id'}) {
             my $idx = $toolsettings{'id'};
-            my %ltitools = &Apache::lonnet::get_domain_ltitools($cdom);
+            my %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer');
             if (ref($ltitools{$idx}) eq 'HASH') {
                 my %toolhash = %{$ltitools{$idx}}; 
                 $toolhash{'display'} = {
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.64 rat/lonwrapper.pm:1.65
--- rat/lonwrapper.pm:1.64	Wed May 10 19:25:28 2017
+++ rat/lonwrapper.pm	Thu Nov 30 14:41:30 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Wrapper for external and binary files as standalone resources
 #
-# $Id: lonwrapper.pm,v 1.64 2017/05/10 19:25:28 raeburn Exp $
+# $Id: lonwrapper.pm,v 1.65 2017/11/30 14:41:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -226,7 +226,7 @@
         my %toolhash = &Apache::lonnet::get('exttool_'.$marker,['target','linktext','explanation','id','width','height'],
                                             $cdom,$cnum);
         if ($toolhash{'id'}) {
-            my %ltitools = &Apache::lonnet::get_domain_ltitools($cdom);
+            my %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer');
             if (ref($ltitools{$toolhash{'id'}}) eq 'HASH') {
                 $exttoolremote = $ltitools{$toolhash{'id'}}{'url'};
             }
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1359 loncom/lonnet/perl/lonnet.pm:1.1360
--- loncom/lonnet/perl/lonnet.pm:1.1359	Mon Nov 13 00:49:31 2017
+++ loncom/lonnet/perl/lonnet.pm	Thu Nov 30 14:41:38 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1359 2017/11/13 00:49:31 raeburn Exp $
+# $Id: lonnet.pm,v 1.1360 2017/11/30 14:41:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -11151,33 +11151,40 @@
     return undef;
 }
 
-sub get_domain_ltitools {
-    my ($cdom) = @_;
-    my %ltitools;
-    my ($result,$cached)=&is_cached_new('ltitools',$cdom);
+sub get_domain_lti {
+    my ($cdom,$context) = @_;
+    my ($name,%lti);
+    if ($context eq 'consumer') {
+        $name = 'ltitools';
+    } elsif ($context eq 'provider') {
+        $name = 'lti';
+    } else {
+        return %lti;
+    }
+    my ($result,$cached)=&is_cached_new($name,$cdom);
     if (defined($cached)) {
         if (ref($result) eq 'HASH') {
-            %ltitools = %{$result};
+            %lti = %{$result};
         }
     } else {
-        my %domconfig = &get_dom('configuration',['ltitools'],$cdom);
-        if (ref($domconfig{'ltitools'}) eq 'HASH') {
-            %ltitools = %{$domconfig{'ltitools'}};
-            my %encdomconfig = &get_dom('encconfig',['ltitools'],$cdom);
-            if (ref($encdomconfig{'ltitools'}) eq 'HASH') {
-                foreach my $id (keys(%ltitools)) {
-                    if (ref($encdomconfig{'ltitools'}{$id}) eq 'HASH') {
+        my %domconfig = &get_dom('configuration',[$name],$cdom);
+        if (ref($domconfig{$name}) eq 'HASH') {
+            %lti = %{$domconfig{$name}};
+            my %encdomconfig = &get_dom('encconfig',[$name],$cdom);
+            if (ref($encdomconfig{$name}) eq 'HASH') {
+                foreach my $id (keys(%lti)) {
+                    if (ref($encdomconfig{$name}{$id}) eq 'HASH') {
                         foreach my $item ('key','secret') {
-                            $ltitools{$id}{$item} = $encdomconfig{'ltitools'}{$id}{$item};
+                            $lti{$id}{$item} = $encdomconfig{$name}{$id}{$item};
                         }
                     }
                 }
             }
         }
         my $cachetime = 24*60*60;
-        &do_cache_new('ltitools',$cdom,\%ltitools,$cachetime);
+        &do_cache_new($name,$cdom,\%lti,$cachetime);
     }
-    return %ltitools;
+    return %lti;
 }
 
 sub get_numsuppfiles {




More information about the LON-CAPA-cvs mailing list