[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm

raeburn raeburn at source.lon-capa.org
Fri Apr 27 20:57:59 EDT 2018


raeburn		Sat Apr 28 00:57:59 2018 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  - Bug 6754 LON-CAPA as LTI Provider
    - When loading role following LTI launch just display a "Continue" link.
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.336 loncom/auth/lonroles.pm:1.337
--- loncom/auth/lonroles.pm:1.336	Tue Jan  9 15:44:43 2018
+++ loncom/auth/lonroles.pm	Sat Apr 28 00:57:58 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.336 2018/01/09 15:44:43 raeburn Exp $
+# $Id: lonroles.pm,v 1.337 2018/04/28 00:57:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -153,20 +153,26 @@
     &Apache::loncommon::no_cache($r);
     $r->send_http_header;
 
-    # Breadcrumbs
-    my $brcrum = [{'href' => $url,
-                   'text' => 'Switching Role'},];
-    my $start_page = &Apache::loncommon::start_page('Switching Role',undef,
-                                                    {'redirect' => [1,$url],
-                                                     'bread_crumbs' => $brcrum,});
-    my $end_page   = &Apache::loncommon::end_page();
+    my $start_page;
+    if ($env{'request.lti.login'}) {
+        $start_page = &Apache::loncommon::start_page(undef,undef,
+                                                     {'redirect' => [0,$url],}).$msg;
+    } else {
+        # Breadcrumbs
+        my $brcrum = [{'href' => $url,
+                       'text' => 'Switching Role'},];
+        $start_page = &Apache::loncommon::start_page('Switching Role',undef,
+                                                     {'redirect' => [1,$url],
+                                                      'bread_crumbs' => $brcrum,}).
+                      "\n<p>$msg</p>";
+    }
+    my $end_page = &Apache::loncommon::end_page();
 
 # Note to style police: 
 # This must only replace the spaces, nothing else, or it bombs elsewhere.
     $url=~s/ /\%20/g;
     $r->print(<<ENDREDIR);
 $start_page
-<p>$msg</p>
 $end_page
 ENDREDIR
     return;
@@ -738,9 +744,12 @@
                                                 $dest .= (($dest =~/\?/)? '&':'?').'symb='.$esc_symb;
                                             }
                                         }
-                                        &redirect_user($r, &mt('Entering [_1]',
-                                                       $env{'course.'.$cdom.'_'.$cnum.'.description'}),
-                                                       $dest, $msg);
+                                        my $title;
+                                        unless ($env{'request.lti.login'}) {
+                                            $title = &mt('Entering [_1]',
+                                                         $env{'course.'.$cdom.'_'.$cnum.'.description'});
+                                        }
+                                        &redirect_user($r,$title,$dest,$msg);
                                         return OK;
                                     }
 				    if (&Apache::lonnet::allowed('whn',
@@ -778,11 +787,16 @@
                                 } elsif ($access eq 'B') {
                                     $furl = '/adm/navmaps?showOnlyHomework=1';
                                 }
-                                $msg = &mt('Entering [_1] ...',
-					   $env{'course.'.$cdom.'_'.$cnum.'.description'});
-				&redirect_user($r, &mt('Entering [_1]',
-                               $env{'course.'.$cdom.'_'.$cnum.'.description'}),
-                               $furl, $msg);
+                                my $title;
+                                if ($env{'request.lti.login'}) {
+                                    undef($msg);
+                                } else {
+                                    $title = &mt('Entering [_1]',
+                                                 $env{'course.'.$cdom.'_'.$cnum.'.description'});
+                                    $msg = &mt('Entering [_1] ...',
+					       $env{'course.'.$cdom.'_'.$cnum.'.description'});
+                                }
+				&redirect_user($r,$title,$furl,$msg);
 			    }
 			    return OK;
 			}




More information about the LON-CAPA-cvs mailing list