--- loncom/homework/lonhomework.pm 2011/06/06 16:48:39 1.326 +++ loncom/homework/lonhomework.pm 2011/10/31 19:35:03 1.329 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.326 2011/06/06 16:48:39 www Exp $ +# $Id: lonhomework.pm,v 1.329 2011/10/31 19:35:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -376,7 +376,12 @@ sub check_access { $date=&mt("can not be accessed from your location."); return($status,$date); } - + if ($env{'form.grade_imsexport'}) { + if (($env{'request.course.id'}) && + (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) { + return ('SHOW_ANSWER'); + } + } foreach my $temp ("opendate","duedate","answerdate") { $lastdate = $date; if ($temp eq 'duedate') { @@ -899,10 +904,10 @@ sub editxmlmode { my $problem=&Apache::lonnet::getfile($file); if ($problem eq -1) { &Apache::lonxml::error( - ' ' + '

' .&mt('Unable to find [_1]', ''.$file.'') - .''); + .'

'); $problem=''; } @@ -1009,9 +1014,10 @@ sub renderpage { $problem=''; my $filename=(split('/',$file))[-1]; my $error = - " ".&mt('Unable to find [_1]', + '

' + .&mt('Unable to find [_1]', ''.$filename.'') - .""; + ."

"; $result.= &Apache::loncommon::simple_error_page($request,'Not available', $error); @@ -1093,6 +1099,7 @@ sub get_template_list { my $count = 0; my $currentcategory=''; my $first = 1; + my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; foreach my $file (@files) { next if ($file->[1] !~ /\S/); if ($file->[2] ne $currentcategory) { @@ -1116,7 +1123,7 @@ sub get_template_list { $result.=&Apache::loncommon::help_open_topic($file->[3]); } my $filename=$file->[0]; - $filename=~s/^\/home\/httpd\/html//; + $filename=~s{^\Q$londocroot\E}{}; $result.=' ' .''.&mt('Example').'' .'
'."\n"; @@ -1152,8 +1159,6 @@ sub newproblem { &renderpage($request,$dest); } else { my $url=&HTML::Entities::encode($request->uri,'<>&"'); - my $shownurl=$url; - $shownurl=~s-^/~-/priv/-; my $dest = &Apache::lonnet::filelocation("",$request->uri); my $errormsg; my $instructions; @@ -1172,7 +1177,7 @@ sub newproblem { .'

'.&mt("Creating a new $extension resource.")."

$errormsg ".&mt("The requested file [_1] currently does not exist.", - ''.$shownurl.'').' + ''.$url.'').'

'.&mt("To create a new $extension, select a template from the". " list below. Then click on the \"Create $extension\" button.").'