From raeburn at source.lon-capa.org Tue Apr 17 15:48:18 2018 From: raeburn at source.lon-capa.org (raeburn) Date: Tue, 17 Apr 2018 19:48:18 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /auth migrateuser.pm Message-ID: raeburn Tue Apr 17 19:48:18 2018 EDT Modified files: /loncom/auth migrateuser.pm Log: - Bug 6754 LON-CAPA as LTI Provider - LTI launch can be for a published .sequence Index: loncom/auth/migrateuser.pm diff -u loncom/auth/migrateuser.pm:1.30 loncom/auth/migrateuser.pm:1.31 --- loncom/auth/migrateuser.pm:1.30 Sun Apr 15 00:14:19 2018 +++ loncom/auth/migrateuser.pm Tue Apr 17 19:48:18 2018 @@ -1,7 +1,7 @@ # The LearningOnline Network # Starts a user off based of an existing token. # -# $Id: migrateuser.pm,v 1.30 2018/04/15 00:14:19 raeburn Exp $ +# $Id: migrateuser.pm,v 1.31 2018/04/17 19:48:18 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -484,7 +484,8 @@ if ($data{'origurl'} ne '') { $next_url .= '&orgurl='.&escape($data{'origurl'}); if ($data{'lti.login'}) { - if ($data{'origurl'} =~ m{/default_\d+\.sequence$}) { + if (($data{'origurl'} =~ m{/default_\d+\.sequence$}) || + ($data{'origurl'} =~ m{^/res/.+\.sequence$})) { $next_url .= '&navmap=1'; } } From raeburn at source.lon-capa.org Sat Apr 21 11:18:15 2018 From: raeburn at source.lon-capa.org (raeburn) Date: Sat, 21 Apr 2018 15:18:15 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /html/adm/MathJax VERSION commands mathjax-MathJax-v2.7.4.zip Message-ID: raeburn Sat Apr 21 15:18:15 2018 EDT Added files: /loncom/html/adm/MathJax mathjax-MathJax-v2.7.4.zip Modified files: /loncom/html/adm/MathJax commands VERSION Log: - MathJax 2.7.4 Index: loncom/html/adm/MathJax/commands diff -u loncom/html/adm/MathJax/commands:1.8 loncom/html/adm/MathJax/commands:1.9 --- loncom/html/adm/MathJax/commands:1.8 Sat Oct 21 00:25:35 2017 +++ loncom/html/adm/MathJax/commands Sat Apr 21 15:18:12 2018 @@ -15,9 +15,9 @@ then rm -rf $mathjaxdir fi - unzip -q -o -d $mathjaxdir mathjax-MathJax-v2.7.2.zip - mv $mathjaxdir/MathJax-2.7.2/* $mathjaxdir/. - rm -r $mathjaxdir/MathJax-2.7.2 + unzip -q -o -d $mathjaxdir mathjax-MathJax-v2.7.4.zip + mv $mathjaxdir/MathJax-2.7.4/* $mathjaxdir/. + rm -r $mathjaxdir/MathJax-2.7.4 cp VERSION $mathjaxdir/VERSION chown -R www:www $mathjaxdir find $mathjaxdir -type d -exec chmod u=rwx,go-rwx {} \; Index: loncom/html/adm/MathJax/VERSION diff -u loncom/html/adm/MathJax/VERSION:1.7 loncom/html/adm/MathJax/VERSION:1.8 --- loncom/html/adm/MathJax/VERSION:1.7 Sat Oct 21 00:25:35 2017 +++ loncom/html/adm/MathJax/VERSION Sat Apr 21 15:18:12 2018 @@ -1 +1 @@ -2.72 +2.74 From raeburn at source.lon-capa.org Sat Apr 21 16:34:50 2018 From: raeburn at source.lon-capa.org (raeburn) Date: Sat, 21 Apr 2018 20:34:50 -0000 Subject: [LON-CAPA-cvs] cvs: loncom / lontrans.pm /lti ltiauth.pm Message-ID: raeburn Sat Apr 21 20:34:50 2018 EDT Modified files: /loncom lontrans.pm /loncom/lti ltiauth.pm Log: - Bug 6754 LON-CAPA as LTI Provider - LTI launch results in call to ltiauth, even if user has existing LON-CAPA session (role, course etc. will be updated). - LTI launch can be for a published .sequence Index: loncom/lontrans.pm diff -u loncom/lontrans.pm:1.21 loncom/lontrans.pm:1.22 --- loncom/lontrans.pm:1.21 Tue Apr 17 14:02:56 2018 +++ loncom/lontrans.pm Sat Apr 21 20:34:44 2018 @@ -1,7 +1,7 @@ # The LearningOnline Network # URL translation for User Files # -# $Id: lontrans.pm,v 1.21 2018/04/17 14:02:56 raeburn Exp $ +# $Id: lontrans.pm,v 1.22 2018/04/21 20:34:44 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -38,63 +38,7 @@ my $r = shift; # FIXME line remove when mod_perl fixes BUG#4948 $r->notes->set('error-notes' => ''); - if ($r->uri =~ m{^/adm/lti/(.+)$}) { - my $realuri = $1; - my %user; - my $handle = &Apache::lonnet::check_for_valid_session($r,undef,\%user); - if (($handle ne '') && ($user{'lti'})) { - if ($realuri =~ m{^uploaded/$match_domain/$match_courseid/(default|supplemental)(|_\d+)\.(?:sequence|page)___\d+___.+$}) { - if ($user{'ltiuri'} ne $realuri) { - &Apache::lonnet::appenv({'request.lti.uri' => $realuri}); - } - my ($map,$resid,$url) = split(/___/,$realuri); - $realuri = &Apache::lonnet::clutter($url).'?symb='.$realuri; - } elsif ($realuri =~ m{^res/$match_domain/$match_username/.+\.(?:sequence|page)___\d+___.+$}) { - if ($user{'ltiuri'} ne $realuri) { - &Apache::lonnet::appenv({'request.lti.uri' => $realuri}); - } - my ($map,$resid,$url) = split(/___/,$realuri); - $realuri = &Apache::lonnet::clutter($url).'?symb='.$realuri; - } elsif ($realuri =~ m{^tiny/$match_domain/\w+$}) { - $realuri = '/'.$realuri; - if ($user{'ltiuri'} ne $realuri) { - &Apache::lonnet::appenv({'request.lti.uri' => $realuri}); - } - } elsif ($realuri =~ m{($match_domain)/($match_courseid)$}) { - $realuri = '/adm/navmaps'; - if ($user{'ltiuri'} ne '') { - &Apache::lonnet::delenv('request.lti.uri'); - } - } else { - $realuri = '/'.$realuri; - if ($realuri =~ m{/default_\d+\.sequence$}) { - if ($user{'ltiuri'} ne $realuri) { - &Apache::lonnet::appenv({'request.lti.uri' => $realuri}); - } - $realuri .= (($realuri =~/\?/)?'&':'?').'navmap=1'; - } elsif ($realuri =~ m{^/res/.+\.sequence$}) { - if ($user{'ltiuri'} ne $realuri) { - &Apache::lonnet::appenv({'request.lti.uri' => $realuri}); - } - $realuri .= (($realuri =~/\?/)?'&':'?').'navmap=1'; - } elsif ($realuri =~ m{\.page$}) { - if ($user{'ltiuri'} ne $realuri) { - &Apache::lonnet::appenv({'request.lti.uri' => $realuri}); - } - } - } - my $host = $r->headers_in->get('Host'); - if ($host) { - my $protocol = 'http'; - if ($r->get_server_port == 443) { - $protocol = 'https'; - } - my $location = $protocol.'://'.$host.$realuri; - $r->headers_out->set(Location => $location); - return REDIRECT; - } - } - } elsif ($r->uri =~ m{^/+tiny/+($match_domain)/+(\w+)$}) { + if ($r->uri =~ m{^/+tiny/+($match_domain)/+(\w+)$}) { my ($cdom,$key) = ($1,$2); if (&Apache::lonnet::domain($cdom) ne '') { my %user; Index: loncom/lti/ltiauth.pm diff -u loncom/lti/ltiauth.pm:1.8 loncom/lti/ltiauth.pm:1.9 --- loncom/lti/ltiauth.pm:1.8 Sat Apr 14 02:30:07 2018 +++ loncom/lti/ltiauth.pm Sat Apr 21 20:34:50 2018 @@ -1,7 +1,7 @@ # The LearningOnline Network # Basic LTI Authentication Module # -# $Id: ltiauth.pm,v 1.8 2018/04/14 02:30:07 raeburn Exp $ +# $Id: ltiauth.pm,v 1.9 2018/04/21 20:34:50 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,6 +43,20 @@ my $r = shift; my $requri = $r->uri; # +# Check for existing session, and temporarily delete any form items +# in %env, if session exists +# + my %savedform; + my $handle = &Apache::lonnet::check_for_valid_session($r); + if ($handle ne '') { + foreach my $key (sort(keys(%env))) { + if ($key =~ /^form\.(.+)$/) { + $savedform{$1} = $env{$key}; + delete($env{$key}); + } + } + } +# # Retrieve data POSTed by LTI Consumer on launch # &Apache::lonacc::get_posted_cgi($r); @@ -52,6 +66,17 @@ $params->{$1} = $env{$key}; } } +# +# Check for existing session, and restored temporarily +# deleted form items to %env, if session exists. +# + if ($handle ne '') { + if (keys(%savedform)) { + foreach my $key (sort(keys(%savedform))) { + $env{'form.'.$key} = $savedform{$key}; + } + } + } unless (keys(%{$params})) { &invalid_request($r,1); @@ -140,7 +165,7 @@ # Order is: # # (a) from custom_coursedomain item in POSTed data -# (b) from tail of requested URL (after /adm/lti) if it has format of a symb +# (b) from tail of requested URL (after /adm/lti/) if it has format of a symb # (c) from tail of requested URL (after /adm/lti) if it has format of a map # (d) from tail of requested URL (after /adm/lti) if it has format /domain/courseID # (e) from tail of requested URL (after /adm/lti) if it has format /tiny/domain/\w+ @@ -182,6 +207,13 @@ $symb = $tail; $symb =~ s{^/+}{}; } + } elsif ($tail =~ m{^/res/(?:$match_domain)/(?:$match_username)/.+\.(?:sequence|page)(|___\d+___.+)$}) { + if ($1 eq '') { + $mapurl = $tail; + } else { + $symb = $tail; + $symb =~ s{^/+}{}; + } } elsif ($tail =~ m{^/($match_domain)/($match_courseid)$}) { ($urlcdom,$urlcnum) = ($1,$2); if (($cdom ne '') && ($cdom ne $urlcdom)) { @@ -329,7 +361,7 @@ # # (a) from course mapping (if the link between Consumer "course" and # Provider "course" has been established previously). -# (b) from tail of requested URL (after /adm/lti) if it has format of a symb +# (b) from tail of requested URL (after /adm/lti/) if it has format of a symb # (c) from tail of requested URL (after /adm/lti) if it has format of a map # (d) from tail of requested URL (after /adm/lti) if it has format /domain/courseID # (e) from tail of requested URL (after /adm/lti) if it has format /tiny/domain/\w+ @@ -823,6 +855,9 @@ } elsif ($tail =~ m{^\Q/tiny/$cdom/\E\w+$}) { $env{'form.origurl'} = $tail; $env{'request.lti.uri'} = $tail; + } elsif ($tail eq "/$cdom/$cnum") { + $env{'form.origurl'} = '/adm/navmaps'; + $env{'request.lti.uri'} = $tail; } else { unless ($tail eq '/adm/roles') { $env{'form.origurl'} = '/adm/navmaps'; From raeburn at source.lon-capa.org Sat Apr 21 17:29:32 2018 From: raeburn at source.lon-capa.org (raeburn) Date: Sat, 21 Apr 2018 21:29:32 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /auth lonauth.pm Message-ID: raeburn Sat Apr 21 21:29:32 2018 EDT Modified files: /loncom/auth lonauth.pm Log: - Bug 6754 LON-CAPA as LTI Provider - Simplified display when initializing LON-CAPA session after LTI launch. Index: loncom/auth/lonauth.pm diff -u loncom/auth/lonauth.pm:1.150 loncom/auth/lonauth.pm:1.151 --- loncom/auth/lonauth.pm:1.150 Sat Apr 14 02:30:11 2018 +++ loncom/auth/lonauth.pm Sat Apr 21 21:29:31 2018 @@ -1,7 +1,7 @@ # The LearningOnline Network # User Authentication Module # -# $Id: lonauth.pm,v 1.150 2018/04/14 02:30:11 raeburn Exp $ +# $Id: lonauth.pm,v 1.151 2018/04/21 21:29:31 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -202,28 +202,35 @@ } $r->send_http_header; - my $start_page=&Apache::loncommon::start_page('Successful Login', - $header,$args); + my $start_page; + if ($env{'request.lti.login'}) { + $args = {'only_body' => 1,}; + $start_page=&Apache::loncommon::start_page('',$header,$args); + } else { + $start_page=&Apache::loncommon::start_page('Successful Login', + $header,$args); + } my $end_page =&Apache::loncommon::end_page(); my $continuelink=''.&mt('Continue').''; - my %lt=&Apache::lonlocal::texthash( - 'wel' => 'Welcome', - 'pro' => 'Login problems?', - ); - my $loginhelp = &loginhelpdisplay($domain); - if ($loginhelp) { - $loginhelp = '

'.$lt{'pro'}.'

'; + my $pagebody; + unless ($env{'request.lti.login'}) { + my %lt=&Apache::lonlocal::texthash( + 'wel' => 'Welcome', + 'pro' => 'Login problems?', + ); + $pagebody = "

$lt{'wel'}

\n". + &mt('Welcome to the Learning[_1]Online[_2] Network with CAPA. Please wait while your session is being set up.','',''); + my $loginhelp = &loginhelpdisplay($domain); + if ($loginhelp) { + $pagebody .= '

'.$lt{'pro'}.'

'; + } } - - my $welcome = &mt('Welcome to the Learning[_1]Online[_2] Network with CAPA. Please wait while your session is being set up.','',''); $r->print(<$lt{'wel'} -$welcome -$loginhelp +$pagebody $continuelink $end_page ENDSUCCESS