[LON-CAPA-cvs] cvs: rat / lonwrapper.pm loncom/interface londocs.pm lonhtmlcommon.pm lonmenu.pm

raeburn raeburn at source.lon-capa.org
Sun May 7 09:58:04 EDT 2017


raeburn		Sun May  7 13:58:04 2017 EDT

  Modified files:              
    /loncom/interface	londocs.pm lonmenu.pm lonhtmlcommon.pm 
    /rat	lonwrapper.pm 
  Log:
  - Eliminate use of exttools in URL in place of exttool for External Tools 
    where destination URL is https://.
  - Override setting for use of iframe to display External Tool, if
    LON-CAPA server is https://, but destination URL is http:// to
    avoid mixed active content issue. 
  
  
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.624 loncom/interface/londocs.pm:1.625
--- loncom/interface/londocs.pm:1.624	Tue Apr 25 22:18:59 2017
+++ loncom/interface/londocs.pm	Sun May  7 13:57:58 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.624 2017/04/25 22:18:59 raeburn Exp $
+# $Id: londocs.pm,v 1.625 2017/05/07 13:57:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -654,7 +654,7 @@
             }
         }
 	if ($url) {
-            if ($url =~ m{^(/adm/$coursedom/$coursenum/(\d+)/exttool)s?\:?(.*)$}) {
+            if ($url =~ m{^(/adm/$coursedom/$coursenum/(\d+)/exttool)\:?(.*)$}) {
                 $url = $1;
                 my $marker = $2;
                 my $info = $3;
@@ -677,9 +677,6 @@
                 if (ref($ltitoolsref) eq 'HASH') {
                     my @deleted;
                     if (ref($ltitoolsref->{$toolid}) eq 'HASH') {
-                        if ($ltitoolsref->{$toolid}->{'url'} =~ m{^https://}) {
-                            $url =~ s/exttool$/exttools/;
-                        }
                         $toolhash{'id'} = $toolid;
                         if (($toolhash{'target'} eq 'iframe') || ($toolhash{'target'} eq 'window')) {
                             if ($toolhash{'target'} eq 'window') {
@@ -1295,7 +1292,7 @@
             my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1];
             if ($url =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?::|:))//} ) {
                 $is_external = 1;
-            } elsif ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/exttools?$}) {
+            } elsif ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/exttool$}) {
                 $is_exttool = 1;
             }
             if ($folder =~ /^supplemental/) {
@@ -1506,7 +1503,7 @@
         ($url =~ m{^/uploaded/$match_domain/$match_courseid/(docs|supplemental)/(default|\d+)/\d+/}) ||
         ($url =~ m{^/adm/$match_domain/$match_username/aboutme}) ||
         ($url =~ m{^/public/$match_domain/$match_courseid/syllabus}) ||
-        ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/exttools?$})) {
+        ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/exttool$})) {
         return 1;
     }
     return;
@@ -3854,7 +3851,7 @@
 			    |/aboutme$
 			    |/navmaps$
 			    |/bulletinboard$
-                            |/exttools?$
+                            |/exttool$
 			    |\.html$)}x)
              || $isexternal) {
 	    $skip_confirm = 1;
@@ -4013,7 +4010,7 @@
                 if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) {
                     $nomodal = 1;
                 }
-	    } elsif ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
+	    } elsif ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttool$}) {
 		$url='/adm/wrapper'.$url;
             } elsif ($url eq "/public/$coursedom/$coursenum/syllabus") {
                 if (($ENV{'SERVER_PORT'} == 443) &&
@@ -4188,7 +4185,7 @@
         }
     } elsif ($supplementalflag && !$allowed) {
         my $isexttool;
-        if ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
+        if ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttool$}) {
             $url='/adm/wrapper'.$url;
             $isexttool = 1;
         }
@@ -4213,7 +4210,7 @@
                 &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,
                                                      undef,undef,undef,undef,undef,undef,
                                                      undef,$disabled);
-        } elsif ($orig_url =~ m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
+        } elsif ($orig_url =~ m{^/adm/$coursedom/$coursenum/\d+/exttool$}) {
             ($editlink,$extresform) =
                 &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,
                                                      undef,undef,undef,'tool',$coursedom,
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.470 loncom/interface/lonmenu.pm:1.471
--- loncom/interface/lonmenu.pm:1.470	Mon Apr 10 02:45:45 2017
+++ loncom/interface/lonmenu.pm	Sun May  7 13:57:58 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.470 2017/04/10 02:45:45 raeburn Exp $
+# $Id: lonmenu.pm,v 1.471 2017/05/07 13:57:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -918,7 +918,7 @@
     $is_mobile = 1;
 }
 
-            unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio|exttools?)(\?|$)/) {
+            unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio|exttool)(\?|$)/) {
 		if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/})) {
 		    $menuitems.=(<<ENDREALRES);
 s&6&3&catalog.png&Info&info[_1]&catalog_info('$is_mobile')&Show Metadata
@@ -1220,7 +1220,7 @@
         if (($env{'form.folderpath'} =~ /^supplemental/) &&
             (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) &&
             (($resurl =~ m{^/adm/wrapper/ext/}) ||
-             ($resurl =~ m{^/adm/$cdom/$cnum/\d+/exttools?$}) ||
+             ($resurl =~ m{^/adm/$cdom/$cnum/\d+/exttool$}) ||
              ($resurl =~ m{^/uploaded/$cdom/$cnum/supplemental/}) ||
              ($resurl eq '/adm/supplemental') ||
              ($resurl =~ m{^/public/$cdom/$cnum/syllabus$}) ||
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.384 loncom/interface/lonhtmlcommon.pm:1.385
--- loncom/interface/lonhtmlcommon.pm:1.384	Mon Apr 10 02:51:38 2017
+++ loncom/interface/lonhtmlcommon.pm	Sun May  7 13:57:58 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.384 2017/04/10 02:51:38 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.385 2017/05/07 13:57:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1727,7 +1727,7 @@
             (($env{'request.noversionuri'}=~/^\/adm\//) &&
              ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
              ($env{'request.noversionuri'}!~
-              m{^/adm/.*/(smppg|bulletinboard|exttools?)($|\?)})
+              m{^/adm/.*/(smppg|bulletinboard|exttool)($|\?)})
            ));
 }
 
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.60 rat/lonwrapper.pm:1.61
--- rat/lonwrapper.pm:1.60	Tue Apr 25 22:19:03 2017
+++ rat/lonwrapper.pm	Sun May  7 13:58:04 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Wrapper for external and binary files as standalone resources
 #
-# $Id: lonwrapper.pm,v 1.60 2017/04/25 22:19:03 raeburn Exp $
+# $Id: lonwrapper.pm,v 1.61 2017/05/07 13:58:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -183,17 +183,26 @@
 
     if ($url =~ /\.pdf$/i) {
         $is_pdf = 1;
-    } elsif ($url =~ m{^/adm/($match_domain)/($match_courseid)/(\d+)/exttools?$}) {
+    } elsif ($url =~ m{^/adm/($match_domain)/($match_courseid)/(\d+)/exttool$}) {
         $cdom = $1;
         $cnum = $2;
         my $marker = $3;
         $exttool = 'iframe';
-        my %toolhash = &Apache::lonnet::get('exttool_'.$marker,['target','linktext','explanation'],
+        my $exttoolremote;
+        my %toolhash = &Apache::lonnet::get('exttool_'.$marker,['target','linktext','explanation','id'],
                                             $cdom,$cnum);
+        if ($toolhash{'id'}) {
+            my %ltitools = &Apache::lonnet::get_domain_ltitools($cdom);
+            if (ref($ltitools{$toolhash{'id'}}) eq 'HASH') {
+                $exttoolremote = $ltitools{$toolhash{'id'}}{'url'};
+            }
+        }
         if ($toolhash{'target'} eq 'window') {
             $exttool = 'window'; 
             $linktext = $toolhash{'linktext'}; 
             $explanation = $toolhash{'explanation'};
+        } elsif (($exttoolremote =~ /^http:/) && ($ENV{'SERVER_PORT'} == 443)) {
+            $exttool = 'window';
         }
     }
     if (($is_ext) || ($exttool)) {


More information about the LON-CAPA-cvs mailing list