--- loncom/lonnet/perl/lonnet.pm 2012/11/30 16:50:30 1.1203 +++ loncom/lonnet/perl/lonnet.pm 2012/12/31 14:29:21 1.1208 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1203 2012/11/30 16:50:30 raeburn Exp $ +# $Id: lonnet.pm,v 1.1208 2012/12/31 14:29:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2716,10 +2716,14 @@ sub can_edit_resource { return; } } else { + if ($resurl =~ m{^/?adm/viewclasslist$}) { + unless (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { + return; + } + } elsif (!$crsedit) { # # No edit allowed where CC has switched to student role. # - unless ($crsedit) { return; } } @@ -2766,6 +2770,14 @@ sub can_edit_resource { $forceedit = 1; } $cfile = $resurl; + } elsif ($resurl =~ m{^/?adm/viewclasslist$}) { + $incourse = 1; + if ($env{'form.forceedit'}) { + $forceview = 1; + } else { + $forceedit = 1; + } + $cfile = ($resurl =~ m{^/} ? $resurl : "/$resurl"); } } elsif ($resurl eq '/res/lib/templates/simpleproblem.problem/smpedit') { my $template = '/res/lib/templates/simpleproblem.problem'; @@ -2798,7 +2810,7 @@ sub can_edit_resource { } if ($uploaded || $incourse) { $home=&homeserver($cnum,$cdom); - } else { + } elsif ($file !~ m{/$}) { $file=~s{^(priv/$match_domain/$match_username)}{/$1}; $file=~s{^($match_domain/$match_username)}{/priv/$1}; # Check that the user has permission to edit this resource @@ -10324,7 +10336,8 @@ sub getdocspath { ':'.$res->randompick(). ':'.$res->randomout(). ':'.$res->encrypted(). - ':'.$res->randomorder(); + ':'.$res->randomorder(). + ':'.$res->is_page(); } } } @@ -10339,19 +10352,24 @@ sub getdocspath { ':'.$mapresobj->randompick(). ':'.$mapresobj->randomout(). ':'.$mapresobj->encrypted(). - ':'.$mapresobj->randomorder(); + ':'.$mapresobj->randomorder(). + ':'.$mapresobj->is_page(); } else { my $maptitle = &gettitle($mapurl); + my $ispage; + if ($mapurl =~ /\.page$/) { + $ispage = 1; + } if ($mapurl eq 'default') { $maptitle = 'Main Course Documents'; } $path = &Apache::lonhtmlcommon::entity_encode($mapurl).'&'. - &Apache::lonhtmlcommon::entity_encode($maptitle).'::::'; + &Apache::lonhtmlcommon::entity_encode($maptitle).':::::'.$ispage; } unless ($mapurl eq 'default') { $path = 'default&'. &Apache::lonhtmlcommon::entity_encode('Main Course Documents'). - '::::&'.$path; + ':::::&'.$path; } } return $path; @@ -10504,10 +10522,21 @@ sub symbverify { if (tie(%bighash,'GDBM_File',$env{'request.course.fn'}.'.db', &GDBM_READER(),0640)) { + my $noclutter; if (($thisurl =~ m{^/adm/wrapper/ext/}) || ($thisurl =~ m{^ext/})) { $thisurl =~ s/\?.+$//; + if ($map =~ m{^uploaded/.+\.page$}) { + $thisurl =~ s{^(/adm/wrapper|)/ext/}{http://}; + $thisurl =~ s{^\Qhttp://https://\E}{https://}; + $noclutter = 1; + } + } + my $ids; + if ($noclutter) { + $ids=$bighash{'ids_'.$thisurl}; + } else { + $ids=$bighash{'ids_'.&clutter($thisurl)}; } - my $ids=$bighash{'ids_'.&clutter($thisurl)}; unless ($ids) { my $idkey = 'ids_'.($thisurl =~ m{^/}? '' : '/').$thisurl; $ids=$bighash{$idkey}; @@ -10605,14 +10634,14 @@ sub deversion { sub symbread { my ($thisfn,$donotrecurse)=@_; - my $cache_str='request.symbread.cached.'.$thisfn; - if (defined($env{$cache_str})) { - if (($thisfn) || ($env{$cache_str} ne '')) { + my $cache_str; + if ($thisfn ne '') { + $cache_str='request.symbread.cached.'.$thisfn; + if ($env{$cache_str} ne '') { return $env{$cache_str}; } - } + } else { # no filename provided? try from environment - unless ($thisfn) { if ($env{'request.symb'}) { return $env{$cache_str}=&symbclean($env{'request.symb'}); }