Diff for /rat/lonpageflip.pm between versions 1.94 and 1.95

version 1.94, 2017/02/25 19:40:29 version 1.95, 2017/03/08 02:51:18
Line 279  sub first_answerable_ressymb { Line 279  sub first_answerable_ressymb {
     }      }
 }  }
   
 sub check_for_syllabus {  sub check_http_req {
     my ($srcref) = @_;      my ($srcref) = @_;
     return unless (ref($srcref) eq 'SCALAR');      return unless (ref($srcref) eq 'SCALAR');
     my $usehttp;      my $usehttp;
Line 291  sub check_for_syllabus { Line 291  sub check_for_syllabus {
             ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {              ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
             $$srcref .= (($$srcref =~/\?/)? '&':'?') . 'usehttp=1';              $$srcref .= (($$srcref =~/\?/)? '&':'?') . 'usehttp=1';
             $usehttp = 1;              $usehttp = 1;
           } elsif (($$srcref =~ m{^\Q/adm/wrapper/ext/\E(?!https:)}) &&
                    ($ENV{'SERVER_PORT'} == 443)) {
               $usehttp = 1;
         }          }
     }      }
     return $usehttp;      return $usehttp;
Line 334  sub handler { Line 337  sub handler {
           }            }
       } elsif ($direction eq 'firstanswerable') {        } elsif ($direction eq 'firstanswerable') {
           my $furl = &first_answerable_ressymb();            my $furl = &first_answerable_ressymb();
           my $usehttp = &check_for_syllabus(\$furl);            my $usehttp = &check_http_req(\$furl);
           if (($usehttp) && ($hostname ne '')) {            if (($usehttp) && ($hostname ne '')) {
               $furl='http://'.$hostname.$furl;                $furl='http://'.$hostname.$furl;
           } else {            } else {
Line 387  sub handler { Line 390  sub handler {
       }        }
       if ($direction eq 'firstres') {        if ($direction eq 'firstres') {
   my $furl=&first_accessible_resource();    my $furl=&first_accessible_resource();
           my $usehttp = &check_for_syllabus(\$furl);            my $usehttp = &check_http_req(\$furl);
           if (($usehttp) && ($hostname ne '')) {            if (($usehttp) && ($hostname ne '')) {
               $furl='http://'.$hostname.$furl;                $furl='http://'.$hostname.$furl;
           } else {            } else {
Line 406  sub handler { Line 409  sub handler {
     $id=$hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id;      $id=$hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id;
     $newloc=$hash{'src_'.$id};      $newloc=$hash{'src_'.$id};
     if ($newloc) {      if ($newloc) {
                 $usehttp = &check_for_syllabus(\$newloc);                  $usehttp = &check_http_req(\$newloc);
  if ($hash{'encrypted_'.$id}) {    if ($hash{'encrypted_'.$id}) { 
                     $newloc=&Apache::lonenc::encrypted($newloc);                      $newloc=&Apache::lonenc::encrypted($newloc);
                 } elsif ($newloc =~ m{^(/adm/wrapper/ext/[^\#]+)\#([^\#]+)$}) {                  } elsif ($newloc =~ m{^(/adm/wrapper/ext/[^\#]+)\#([^\#]+)$}) {
Line 529  sub handler { Line 532  sub handler {
 # ------------------------------------- Check for and display critical messages  # ------------------------------------- Check for and display critical messages
                   my ($redirect, $url) = &Apache::loncommon::critical_redirect(300);                    my ($redirect, $url) = &Apache::loncommon::critical_redirect(300);
                   unless ($redirect) {                    unless ($redirect) {
                       my $usehttp = &check_for_syllabus(\$redirecturl);                        my $usehttp = &check_http_req(\$redirecturl);
                       if (($usehttp) && ($hostname ne '')) {                        if (($usehttp) && ($hostname ne '')) {
                           $url='http://'.$hostname.$redirecturl;                            $url='http://'.$hostname.$redirecturl;
                       } else {                        } else {
Line 584  $lt{'pick'}: Line 587  $lt{'pick'}:
 ENDSTART  ENDSTART
                      foreach my $id (@possibilities) {                       foreach my $id (@possibilities) {
                         my $src = $multichoicehash{'src_'.$id};                          my $src = $multichoicehash{'src_'.$id};
                         my $usehttp = &check_for_syllabus(\$src);                          my $usehttp = &check_http_req(\$src);
                         if (($usehttp) && ($hostname ne '')) {                          if (($usehttp) && ($hostname ne '')) {
                             $src = 'http://'.$hostname.$src;                              $src = 'http://'.$hostname.$src;
                         }                          }

Removed from v.1.94  
changed lines
  Added in v.1.95


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>