Diff for /loncom/homework/lonhomework.pm between versions 1.323 and 1.330

version 1.323, 2011/02/06 18:43:10 version 1.330, 2011/11/14 00:20:39
Line 147  sub get_target { Line 147  sub get_target {
  } else {   } else {
     if ($env{'form.problemstate'} eq 'WEB_GRADE') {      if ($env{'form.problemstate'} eq 'WEB_GRADE') {
  return ('grade','webgrade','answer');   return ('grade','webgrade','answer');
               } elsif ($env{'form.problemmode'} eq 'view') {
                   return ('grade','web','answer');
     } elsif ($env{'form.problemmode'} eq 'saveview') {      } elsif ($env{'form.problemmode'} eq 'saveview') {
                 return ('modified','web','answer');                  return ('modified','web','answer');
             } elsif ($env{'form.problemmode'} eq 'discard') {              } elsif ($env{'form.problemmode'} eq 'discard') {
Line 374  sub check_access { Line 376  sub check_access {
     $date=&mt("can not be accessed from your location.");      $date=&mt("can not be accessed from your location.");
     return($status,$date);      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") {   foreach my $temp ("opendate","duedate","answerdate") {
     $lastdate = $date;      $lastdate = $date;
     if ($temp eq 'duedate') {      if ($temp eq 'duedate') {
Line 432  sub check_access { Line 439  sub check_access {
  if ( $tries eq '' ) { $tries = '0'; }   if ( $tries eq '' ) { $tries = '0'; }
  if ( $maxtries eq '' &&    if ( $maxtries eq '' && 
      $env{'request.state'} ne 'construct') { $maxtries = '2'; }        $env{'request.state'} ne 'construct') { $maxtries = '2'; } 
    $Apache::lonhomework::results{'resource.'.$id.'.maxtries'}=$maxtries;
  if ($maxtries && $tries >= $maxtries) { $status = 'CANNOT_ANSWER'; }   if ($maxtries && $tries >= $maxtries) { $status = 'CANNOT_ANSWER'; }
  # if (correct and show prob status) or excused then CANNOT_ANSWER   # if (correct and show prob status) or excused then CANNOT_ANSWER
  if(($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/   if(($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/
     &&      &&
     &show_problem_status())      &show_problem_status()
               &&
               $Apache::lonhomework::history{"resource.$id.awarded"}==1)
    ||     ||
    $Apache::lonhomework::history{"resource.$id.solved"}=~/^excused/) {     $Apache::lonhomework::history{"resource.$id.solved"}=~/^excused/) {
     $status = 'CANNOT_ANSWER';      $status = 'CANNOT_ANSWER';
Line 688  sub analyze_header { Line 698  sub analyze_header {
     my $js = &Apache::structuretags::setmode_javascript();      my $js = &Apache::structuretags::setmode_javascript();
   
     # Breadcrumbs      # Breadcrumbs
     my $brcrum = [{'href' => &Apache::loncommon::authorspace(),      my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri),
                    'text' => 'Construction Space'},                     'text' => 'Construction Space'},
                   {'href' => '',                    {'href' => '',
                    'text' => 'Problem Testing'},                     'text' => 'Problem Testing'},
Line 894  sub editxmlmode { Line 904  sub editxmlmode {
     my $problem=&Apache::lonnet::getfile($file);      my $problem=&Apache::lonnet::getfile($file);
     if ($problem eq -1) {      if ($problem eq -1) {
  &Apache::lonxml::error(   &Apache::lonxml::error(
             '<b> '              '<p class="LC_error">'
            .&mt('Unable to find [_1]',             .&mt('Unable to find [_1]',
                 '<span class="LC_filename">'.$file.'</span>')                  '<span class="LC_filename">'.$file.'</span>')
            .'</b>');             .'</p>');
   
  $problem='';   $problem='';
     }      }
Line 926  sub editxmlmode { Line 936  sub editxmlmode {
             &Apache::lonhtmlcommon::dragmath_js("EditMathPopup");              &Apache::lonhtmlcommon::dragmath_js("EditMathPopup");
   
     # Breadcrumbs      # Breadcrumbs
     my $brcrum = [{'href' => &Apache::loncommon::authorspace(),      my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri),
                    'text' => 'Construction Space'},                     'text' => 'Construction Space'},
                   {'href' => '',                    {'href' => '',
                    'text' => 'Problem Editing'}];                     'text' => 'Problem Editing'}];
Line 1004  sub renderpage { Line 1014  sub renderpage {
     $problem='';      $problem='';
     my $filename=(split('/',$file))[-1];      my $filename=(split('/',$file))[-1];
     my $error =      my $error =
  "<b> ".&mt('Unable to find [_1]',   '<p class="LC_error">'
                  .&mt('Unable to find [_1]',
    '<span class="LC_filename">'.$filename.'</span>')     '<span class="LC_filename">'.$filename.'</span>')
  ."</b>";   ."</p>";
     $result.=      $result.=
  &Apache::loncommon::simple_error_page($request,'Not available',   &Apache::loncommon::simple_error_page($request,'Not available',
       $error);        $error);
Line 1088  sub get_template_list { Line 1099  sub get_template_list {
     my $count = 0;      my $count = 0;
     my $currentcategory='';      my $currentcategory='';
     my $first = 1;      my $first = 1;
       my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
     foreach my $file (@files) {      foreach my $file (@files) {
  next if ($file->[1] !~ /\S/);   next if ($file->[1] !~ /\S/);
         if ($file->[2] ne $currentcategory) {          if ($file->[2] ne $currentcategory) {
Line 1111  sub get_template_list { Line 1123  sub get_template_list {
            $result.=&Apache::loncommon::help_open_topic($file->[3]);             $result.=&Apache::loncommon::help_open_topic($file->[3]);
         }          }
         my $filename=$file->[0];          my $filename=$file->[0];
         $filename=~s/^\/home\/httpd\/html//;          $filename=~s{^\Q$londocroot\E}{};
         $result.=' <span class="LC_fontsize_small">'          $result.=' <span class="LC_fontsize_small">'
                 .'<a href="'.$filename.'?inhibitmenu=yes" target="sample">'.&mt('Example').'</a>'                  .'<a href="'.$filename.'?inhibitmenu=yes" target="sample">'.&mt('Example').'</a>'
                 .'</span><br />'."\n";                  .'</span><br />'."\n";
Line 1147  sub newproblem { Line 1159  sub newproblem {
  &renderpage($request,$dest);   &renderpage($request,$dest);
     } else {      } else {
  my $url=&HTML::Entities::encode($request->uri,'<>&"');   my $url=&HTML::Entities::encode($request->uri,'<>&"');
  my $shownurl=$url;  
  $shownurl=~s-^/~-/priv/-;  
  my $dest = &Apache::lonnet::filelocation("",$request->uri);   my $dest = &Apache::lonnet::filelocation("",$request->uri);
  my $errormsg;   my $errormsg;
  my $instructions;   my $instructions;
         my $brcrum = [{'href' => &Apache::loncommon::authorspace(),          my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri),
                        'text' => 'Construction Space'},                         'text' => 'Construction Space'},
                       {'href' => '',                        {'href' => '',
                        'text' => "Create New $extension"}];                         'text' => "Create New $extension"}];
Line 1167  sub newproblem { Line 1177  sub newproblem {
        .'<h1>'.&mt("Creating a new $extension resource.")."</h1>         .'<h1>'.&mt("Creating a new $extension resource.")."</h1>
 $errormsg  $errormsg
 ".&mt("The requested file [_1] currently does not exist.",  ".&mt("The requested file [_1] currently does not exist.",
       '<span class="LC_filename">'.$shownurl.'</span>').'        '<span class="LC_filename">'.$url.'</span>').'
 <p class="LC_info">  <p class="LC_info">
 '.&mt("To create a new $extension, select a template from the".  '.&mt("To create a new $extension, select a template from the".
       " list below. Then click on the \"Create $extension\" button.").'        " list below. Then click on the \"Create $extension\" button.").'

Removed from v.1.323  
changed lines
  Added in v.1.330


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>