--- loncom/lonnet/perl/lonnet.pm 2016/05/30 03:16:33 1.1309 +++ loncom/lonnet/perl/lonnet.pm 2016/06/19 04:28:19 1.1312 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1309 2016/05/30 03:16:33 raeburn Exp $ +# $Id: lonnet.pm,v 1.1312 2016/06/19 04:28:19 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2332,6 +2332,22 @@ sub get_domain_defaults { return %domdefaults; } +sub course_portal_url { + my ($cnum,$cdom) = @_; + my $chome = &homeserver($cnum,$cdom); + my $hostname = &hostname($chome); + my $protocol = $protocol{$chome}; + $protocol = 'http' if ($protocol ne 'https'); + my %domdefaults = &get_domain_defaults($cdom); + my $firsturl; + if ($domdefaults{'portal_def'}) { + $firsturl = $domdefaults{'portal_def'}; + } else { + $firsturl = $protocol.'://'.$hostname; + } + return $firsturl; +} + # --------------------------------------------------- Assign a key to a student sub assign_access_key { @@ -7367,6 +7383,15 @@ sub constructaccess { $ownerhome = &homeserver($ownername,$ownerdomain); return ($ownername,$ownerdomain,$ownerhome); } + if ($env{'request.course.id'}) { + if (($ownername eq $env{'course.'.$env{'request.course.id'}.'.num'}) && + ($ownerdomain eq $env{'course.'.$env{'request.course.id'}.'.domain'})) { + if (&allowed('mdc',$env{'request.course.id'})) { + $ownerhome = $env{'course.'.$env{'request.course.id'}.'.home'}; + return ($ownername,$ownerdomain,$ownerhome); + } + } + } } # We don't have any access right now. If we are not possibly going to do anything about this, @@ -7519,7 +7544,7 @@ sub get_commblock_resources { } } } - if ($interval[0] =~ /^(\d+/)) { + if ($interval[0] =~ /^(\d+)/) { my $timelimit = $1; my $first_access; if ($type eq 'resource') { @@ -10354,7 +10379,7 @@ sub get_userresdata { # Parameters: # $name - Course/user name. # $domain - Name of the domain the user/course is registered on. -# $type - Type of thing $name is (must be 'course' or 'user' +# $type - Type of thing $name is (must be 'course' or 'user') # $mapp - decluttered URL of enclosing map # $recursed - Ref to scalar -- set to 1, if nested maps have been recursed. # $recurseup - Ref to array of map URLs, starting with map containing