[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm

raeburn raeburn at source.lon-capa.org
Sat Feb 25 14:48:34 EST 2017


raeburn		Sat Feb 25 19:48:34 2017 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  - Accommodate case where Syllabus is included in Main Content, so $resurl is
    extracted from symb.
  - URL arg in go() item for "Edit" link is an absolute link, where a value has 
    set for $env{'request.use_absolute'}.
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.381 loncom/interface/lonhtmlcommon.pm:1.382
--- loncom/interface/lonhtmlcommon.pm:1.381	Mon Feb 20 18:29:22 2017
+++ loncom/interface/lonhtmlcommon.pm	Sat Feb 25 19:48:33 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.381 2017/02/20 18:29:22 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.382 2017/02/25 19:48:33 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1902,7 +1902,7 @@
                     $env{'course.'.$env{'request.course.id'}.'.description'};
                 $no_mt_descr = 1;
                 if ($env{'request.noversionuri'} =~ 
-                    m{^/public/($match_domain)/($match_courseid)/syllabus$}) {
+                    m{^/?public/($match_domain)/($match_courseid)/syllabus$}) {
                     unless (($env{'course.'.$env{'request.course.id'}.'.domain'} eq $1) &&
                             ($env{'course.'.$env{'request.course.id'}.'.num'} eq $2)) {
                         $description = 'Menu';
@@ -3520,7 +3520,7 @@
             if ($cfile =~ m{^(/adm/wrapper/ext/[^#]+)#([^#]+)$}) {
                 $cfile = $1;
                 $anchor = $2;
-            } elsif ($cfile =~ m{^/public/($match_domain)/($match_courseid)/syllabus}) {
+            } elsif ($cfile =~ m{^/?public/($match_domain)/($match_courseid)/syllabus}) {
                 if ($ENV{'SERVER_PORT'} == 443) {
                     my ($cdom,$cnum) = ($1,$2);
                     if (($env{'request.course.id'}) &&
@@ -3560,14 +3560,16 @@
             }
             if ($forceedit) {
                 $cfile .= (($cfile=~/\?/)?'&':'?').'forceedit=1';
-                if (($usehttps) && ($hostname ne '')) {
-                    $cfile = 'https://'.$hostname.$cfile;
+                if ($usehttps) {
+                    $cfile = $env{'request.use_absolute'}.(($cfile =~ /^\//)? '':'/').$cfile;
                 }
             } elsif ($usehttp) {
                 if ($hostname ne '') {
-                    $cfile = 'http://'.$hostname.$cfile;
+                    $cfile = 'http://'.$hostname.(($cfile =~ /^\//)? '':'/').$cfile;
                 }
                 $cfile .= (($cfile=~/\?/)?'&':'?').'usehttp=1';
+            } elsif ($usehttps) {
+                $cfile = $env{'request.use_absolute'}.(($cfile =~ /^\//)? '':'/').$cfile;
             }
             if ($forcereg) {
                 $cfile .= (($cfile=~/\?/)?'&':'?').'register=1';




More information about the LON-CAPA-cvs mailing list