Diff for /loncom/interface/lonnavmaps.pm between versions 1.444.2.8 and 1.445

version 1.444.2.8, 2012/07/09 18:43:03 version 1.445, 2010/03/16 19:55:49
Line 509  my %statusIconMap = Line 509  my %statusIconMap =
 my %iconAltTags =   #texthash does not work here  my %iconAltTags =   #texthash does not work here
     ( 'navmap.correct.gif'  => 'Correct',      ( 'navmap.correct.gif'  => 'Correct',
       'navmap.wrong.gif'    => 'Incorrect',        'navmap.wrong.gif'    => 'Incorrect',
       'navmap.open.gif'     => 'Is Open',        'navmap.open.gif'     => 'Open',
       'navmap.partial.gif'  => 'Partially Correct',        'navmap.partial.gif'  => 'Partially Correct',
       'navmap.ellipsis.gif' => 'Attempted',        'navmap.ellipsis.gif' => 'Attempted',
      );       );
Line 527  my %colormap = Line 527  my %colormap =
       $resObj->INCORRECT              => '',        $resObj->INCORRECT              => '',
       $resObj->OPEN                   => '',        $resObj->OPEN                   => '',
       $resObj->NOTHING_SET            => '',        $resObj->NOTHING_SET            => '',
       $resObj->CREDIT_ATTEMPTED       => '',  
       $resObj->ATTEMPTED              => '',        $resObj->ATTEMPTED              => '',
       $resObj->ANSWER_SUBMITTED       => '',        $resObj->ANSWER_SUBMITTED       => '',
       $resObj->PARTIALLY_CORRECT      => '#006600'        $resObj->PARTIALLY_CORRECT      => '#006600'
Line 539  my $hurryUpColor = "#FF0000"; Line 538  my $hurryUpColor = "#FF0000";
 my $future_slots_checked = 0;  my $future_slots_checked = 0;
 my $future_slots = 0;  my $future_slots = 0;
   
 sub close {  
     if ($env{'environment.remotenavmap'} ne 'on') { return ''; }  
     return(<<ENDCLOSE);  
 <script type="text/javascript">  
 window.status='Accessing Nav Control';  
 menu=window.open("/adm/rat/empty.html","loncapanav",  
                  "height=600,width=400,scrollbars=1");  
 window.status='Closing Nav Control';  
 menu.close();  
 window.status='Done.';  
 </script>  
 ENDCLOSE  
 }  
   
 sub update {  
     if ($env{'environment.remotenavmap'} ne 'on') { return ''; }  
     if (!$env{'request.course.id'}) { return ''; }  
     if ($ENV{'REQUEST_URI'}=~m|^/adm/navmaps|) { return ''; }  
     return(<<ENDUPDATE);  
 <form name="navform"></form>  
 <script type="text/javascript">  
 this.document.navform.action='/adm/navmaps#curloc';  
 this.document.navform.target='loncapanav';  
 this.document.navform.submit();  
 </script>  
 ENDUPDATE  
 }  
   
   
 sub addToFilter {  sub addToFilter {
     my $hashIn = shift;      my $hashIn = shift;
     my $addition = shift;      my $addition = shift;
Line 641  sub getDescription { Line 611  sub getDescription {
         return &mt("Not currently assigned.");          return &mt("Not currently assigned.");
     }      }
     if ($status == $res->OPEN_LATER) {      if ($status == $res->OPEN_LATER) {
         return &mt("Open [_1]",&timeToHumanString($open,'start'));          return &mt("Open ") .timeToHumanString($open,'start');
     }      }
     if ($res->simpleStatus($part) == $res->OPEN) {      if ($res->simpleStatus($part) == $res->OPEN) {
         unless (&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) {          unless (&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) {
Line 675  sub getDescription { Line 645  sub getDescription {
     if ($status == $res->OPEN) {      if ($status == $res->OPEN) {
         if ($due) {          if ($due) {
     if ($res->is_practice()) {      if ($res->is_practice()) {
  return &mt("Closes [_1]",&timeToHumanString($due,'start'));   return &mt("Closes ")."  " .timeToHumanString($due,'start');
     } else {      } else {
  return &mt("Due [_1]",&timeToHumanString($due,'end'));   return &mt("Due")."  " .timeToHumanString($due,'end');
     }      }
         } else {          } else {
             return &mt("Open, no due date");              return &mt("Open, no due date");
         }          }
     }      }
     if ($status == $res->PAST_DUE_ANSWER_LATER) {      if ($status == $res->PAST_DUE_ANSWER_LATER) {
         return &mt("Answer open [_1]",&timeToHumanString($answer,'start'));          return &mt("Answer open")." " .timeToHumanString($answer,'start');
     }      }
     if ($status == $res->PAST_DUE_NO_ANSWER) {      if ($status == $res->PAST_DUE_NO_ANSWER) {
  if ($res->is_practice()) {   if ($res->is_practice()) {
     return &mt("Closed [_1]",&timeToHumanString($due,'start'));      return &mt("Closed")." " . timeToHumanString($due,'start');
  } else {   } else {
     return &mt("Was due [_1]",&timeToHumanString($due,'end'));      return &mt("Was due")." " . timeToHumanString($due,'end');
  }   }
     }      }
     if (($status == $res->ANSWER_OPEN || $status == $res->PARTIALLY_CORRECT)      if (($status == $res->ANSWER_OPEN || $status == $res->PARTIALLY_CORRECT)
Line 707  sub getDescription { Line 677  sub getDescription {
             return &mt("Answer submitted, not yet graded");              return &mt("Answer submitted, not yet graded");
         }          }
     }      }
     if ($status == $res->CREDIT_ATTEMPTED) {  
         if ($res->is_anonsurvey($part) || $res->is_survey($part)) {  
             return &mt("Credit for survey submission");  
         }  
     }  
     if ($status == $res->TRIES_LEFT) {      if ($status == $res->TRIES_LEFT) {
         my $tries = $res->tries($part);          my $tries = $res->tries($part);
         my $maxtries = $res->maxtries($part);          my $maxtries = $res->maxtries($part);
Line 723  sub getDescription { Line 688  sub getDescription {
             }              }
         }          }
         if ($due) {          if ($due) {
             return &mt("Due [_1]",&timeToHumanString($due,'end')) .              return &mt("Due")." " . timeToHumanString($due,'end') .
                 " $triesString";                  " $triesString";
         } else {          } else {
             return &mt("No due date")." $triesString";              return &mt("No due date")." $triesString";
Line 808  sub timeToHumanString { Line 773  sub timeToHumanString {
   
         # Less than an hour          # Less than an hour
         if ( $delta < $hour ) {          if ( $delta < $hour ) {
             # If so, use minutes; or minutes, seconds (if format requires)              # If so, use minutes
             my $minutes = floor($delta / 60);              my $minutes = floor($delta / 60);
             if (($format ne '') && ($format =~ /\%(T|S)/)) {  
                 my $display;  
                 if ($minutes == 1) {  
                     $display = "${prefix}1 minute";  
                 } else {  
                     $display = "$prefix$minutes minutes";  
                 }  
                 my $seconds = $delta % $minute;  
                 if ($seconds == 0) {  
                     $display .= $tense;  
                 } elsif ($seconds == 1) {  
                     $display .= ", 1 second$tense";  
                 } else {  
                     $display .= ", $seconds seconds$tense";  
                 }  
                 return $display;  
             }  
             if ($minutes == 1) { return "${prefix}1 minute$tense"; }              if ($minutes == 1) { return "${prefix}1 minute$tense"; }
             return "$prefix$minutes minutes$tense";              return "$prefix$minutes minutes$tense";
         }          }
                   
         # Is it less than 24 hours away? If so,          # Is it less than 24 hours away? If so,
         # display hours + minutes, (and + seconds, if format specified it)          # display hours + minutes
         if ( $delta < $hour * 24) {          if ( $delta < $hour * 24) {
             my $hours = floor($delta / $hour);              my $hours = floor($delta / $hour);
             my $minutes = floor(($delta % $hour) / $minute);              my $minutes = floor(($delta % $hour) / $minute);
Line 847  sub timeToHumanString { Line 795  sub timeToHumanString {
             if ($minutes == 0) {              if ($minutes == 0) {
                 $minuteString = "";                  $minuteString = "";
             }              }
             if (($format ne '') && ($format =~ /\%(T|S)/)) {  
                 my $display = "$prefix$hourString$minuteString";  
                 my $seconds = $delta-(($hours * $hour)+($minutes * $minute));  
                 if ($seconds == 0) {  
                     $display .= $tense;  
                 } elsif ($seconds == 1) {  
                     $display .= ", 1 second$tense";  
                 } else {  
                     $display .= ", $seconds seconds$tense";  
                 }  
                 return $display;  
             }  
             return "$prefix$hourString$minuteString$tense";              return "$prefix$hourString$minuteString$tense";
         }          }
   
         # Date/time is more than 24 hours away  
   
  my $dt = DateTime->from_epoch(epoch => $time)   my $dt = DateTime->from_epoch(epoch => $time)
                  ->set_time_zone(&Apache::lonlocal::gettimezone());                   ->set_time_zone(&Apache::lonlocal::gettimezone());
   
  # If there's a caller supplied format, use it, unless it only displays   # If there's a caller supplied format, use it.
         # H:M:S or H:M.  
   
         if (($format ne '') && ($format ne '%T') && ($format ne '%R')) {   if ($format ne '') {
     my $timeStr = $dt->strftime($format);      my $timeStr = $dt->strftime($format);
     return $timeStr.' ('.$dt->time_zone_short_name().')';      return $timeStr.' ('.$dt->time_zone_short_name().')';
  }   }
Line 1006  sub render_resource { Line 939  sub render_resource {
     }      }
   
     if ($resource->randomout()) {      if ($resource->randomout()) {
         $nonLinkedText .= ' <span class="LC_warning">('.&mt('hidden').')</span> ';          $nonLinkedText .= ' <i>('.&mt('hidden').')</i> ';
     }      }
     if (!$resource->condval()) {      if (!$resource->condval()) {
         $nonLinkedText .= ' <span class="LC_info">('.&mt('conditionally hidden').')</span> ';          $nonLinkedText .= ' <i>('.&mt('conditionally hidden').')</i> ';
     }      }
     if (($resource->is_practice()) && ($resource->is_raw_problem())) {      if (($resource->is_practice()) && ($resource->is_raw_problem())) {
         $nonLinkedText .=' <font color="green"><b>'.&mt('not graded').'</b></font>';          $nonLinkedText .=' <font color="green"><b>'.&mt('not graded').'</b></font>';
Line 1053  sub render_resource { Line 986  sub render_resource {
         $nonLinkedText .= ' ('.&mt('[_1] parts', $resource->countParts()).')';          $nonLinkedText .= ' ('.&mt('[_1] parts', $resource->countParts()).')';
     }      }
   
     my $target;  
     if ($env{'environment.remotenavmap'} eq 'on') {  
  $target=' target="loncapaclient" ';  
     }  
     if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) {      if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) {
         $result .= "$curMarkerBegin<a $target href=\"$link\">$title$partLabel</a>$curMarkerEnd$nonLinkedText</td>";          $result .= "$curMarkerBegin<a href=\"$link\">$title$partLabel</a>$curMarkerEnd$nonLinkedText</td>";
     } else {      } else {
         $result .= "$curMarkerBegin$linkopen$title$partLabel</a>$curMarkerEnd$nonLinkedText</td>";          $result .= "$curMarkerBegin$linkopen$title$partLabel</a>$curMarkerEnd$nonLinkedText</td>";
     }      }
Line 1071  sub render_communication_status { Line 1000  sub render_communication_status {
     my $discussionHTML = ""; my $feedbackHTML = ""; my $errorHTML = "";      my $discussionHTML = ""; my $feedbackHTML = ""; my $errorHTML = "";
   
     my $link = $params->{"resourceLink"};      my $link = $params->{"resourceLink"};
     my $target;      my $linkopen = "<a href=\"$link\">";
     if ($env{'environment.remotenavmap'} eq 'on') {  
  $target=' target="loncapaclient" ';  
     }  
     my $linkopen = "<a $target href=\"$link\">";  
     my $linkclose = "</a>";      my $linkclose = "</a>";
     my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc");      my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc");
     if ($resource->hasDiscussion()) {      if ($resource->hasDiscussion()) {
Line 1088  sub render_communication_status { Line 1013  sub render_communication_status {
         my $feedback = $resource->getFeedback();          my $feedback = $resource->getFeedback();
         foreach my $msgid (split(/\,/, $feedback)) {          foreach my $msgid (split(/\,/, $feedback)) {
             if ($msgid) {              if ($msgid) {
                 $feedbackHTML .= '&nbsp;<a '.$target.' href="/adm/email?display='                  $feedbackHTML .= '&nbsp;<a href="/adm/email?display='
                     . &escape($msgid) . '">'                      . &escape($msgid) . '">'
                     . '<img alt="'.&mt('New E-mail').'" src="'.$location.'/feedback.gif" title="'.&mt('New E-mail').'"/></a>';                      . '<img alt="'.&mt('New E-mail').'" src="'.$location.'/feedback.gif" title="'.&mt('New E-mail').'"/></a>';
             }              }
Line 1102  sub render_communication_status { Line 1027  sub render_communication_status {
             last if ($errorcount>=10); # Only output 10 bombs maximum              last if ($errorcount>=10); # Only output 10 bombs maximum
             if ($msgid) {              if ($msgid) {
                 $errorcount++;                  $errorcount++;
                 $errorHTML .= '&nbsp;<a '.$target.' href="/adm/email?display='                  $errorHTML .= '&nbsp;<a href="/adm/email?display='
                     . &escape($msgid) . '">'                      . &escape($msgid) . '">'
                     . '<img alt="'.&mt('New Error').'" src="'.$location.'/bomb.gif" title="'.&mt('New Error').'"/></a>';                      . '<img alt="'.&mt('New Error').'" src="'.$location.'/bomb.gif" title="'.&mt('New Error').'"/></a>';
             }              }
Line 1122  sub render_quick_status { Line 1047  sub render_quick_status {
         $params->{'multipart'} && $part eq "0";          $params->{'multipart'} && $part eq "0";
   
     my $link = $params->{"resourceLink"};      my $link = $params->{"resourceLink"};
     my $target;      my $linkopen = "<a href=\"$link\">";
     if ($env{'environment.remotenavmap'} eq 'on') {  
  $target=' target="loncapaclient" ';  
     }  
     my $linkopen = "<a $target href=\"$link\">";  
     my $linkclose = "</a>";      my $linkclose = "</a>";
   
  $result .= '<td class="LC_middle">';   $result .= '<td class="LC_middle">';
Line 1164  sub render_long_status { Line 1085  sub render_long_status {
     }      }
           
     if ($resource->kind() eq "res" &&      if ($resource->kind() eq "res" &&
         $resource->is_raw_problem() &&          ($resource->is_problem() || $resource->is_practice()) &&
         !$firstDisplayed) {          !$firstDisplayed) {
         if ($color) {$result .= "<font color=\"$color\"><b>"; }          if ($color) {$result .= "<font color=\"$color\"><b>"; }
         $result .= getDescription($resource, $part);          $result .= getDescription($resource, $part);
Line 1479  sub render { Line 1400  sub render {
     if ($printCloseAll && !$args->{'resource_no_folder_link'}) {      if ($printCloseAll && !$args->{'resource_no_folder_link'}) {
  my ($link,$text);   my ($link,$text);
         if ($condition) {          if ($condition) {
     $link='navmaps?condition=0&amp;filter=&amp;'.$queryString.      $link='"navmaps?condition=0&amp;filter=&amp;'.$queryString.
  '&amp;here='.&escape($here);   '&here='.&escape($here).'"';
     $text='Close all folders';      $text='Close all folders';
         } else {          } else {
     $link='navmaps?condition=1&amp;filter=&amp;'.$queryString.      $link='"navmaps?condition=1&amp;filter=&amp;'.$queryString.
  '&amp;here='.&escape($here);   '&here='.&escape($here).'"';
     $text='Open all folders';      $text='Open all folders';
         }          }
         if ($env{'form.register'}) {  
             $link .= '&amp;register='.$env{'form.register'};  
         }  
  if ($args->{'caller'} eq 'navmapsdisplay') {   if ($args->{'caller'} eq 'navmapsdisplay') {
     &add_linkitem($args->{'linkitems'},'changefolder',      &add_linkitem($args->{'linkitems'},'changefolder',
                           "location.href='$link'",$text);    'location.href='.$link,$text);
  } else {   } else {
             $result.= '<a href="'.$link.'">'.&mt($text).'</a>';      $result.='<a href='.$link.'>'.&mt($text).'</a>';
  }   }
         $result .= "\n";          $result .= "\n";
     }      }
Line 1510  sub render { Line 1428  sub render {
  <input type="hidden" name="navurl" value="$ENV{'QUERY_STRING'}" />   <input type="hidden" name="navurl" value="$ENV{'QUERY_STRING'}" />
  <input type="hidden" name="navtime" value="$time" />   <input type="hidden" name="navtime" value="$time" />
 END  END
         if ($env{'form.register'}) {  
             $result .= '<input type="hidden" name="register" value="'.$env{'form.register'}.'" />';  
         }  
         if ($args->{'sort'} eq 'discussion') {           if ($args->{'sort'} eq 'discussion') { 
     my $totdisc = 0;      my $totdisc = 0;
     my $haveDisc = '';      my $haveDisc = '';
Line 1534  END Line 1449  END
  $result.='</form>';   $result.='</form>';
     }      }
   
      
     if ($args->{'caller'} eq 'navmapsdisplay') {      if ($args->{'caller'} eq 'navmapsdisplay') {
         $result .= '<table><tr><td>'.          $result .= '<table><tr><td>'.
                    &Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').'</td><td>&nbsp;</td>'.                     &Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').'</td>';
                    '<td class="LC_middle">'.&mt('Tools:').'</td>'.      $result .= '<td>&nbsp;</td>'; 
                    &show_linkitems_toolbar($args->{'linkitems'});   $result.="<td class=\"LC_middle\">".mt('Tools:')."</td>";
    $result.=&show_linkitems_toolbar($args->{'linkitems'});
         if ($args->{'sort_html'}) {          if ($args->{'sort_html'}) {
     if ($env{'environment.remotenavmap'} ne 'on') {              $result.='<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
         $result .= '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.                  '<td align="right">'.$args->{'sort_html'}.'</td></tr>';
                            '<td align="right">'.$args->{'sort_html'}.'</td></tr>';  
             } else {  
         $result .= '</tr><tr><td align="left" colspan="4"><br />'.  
                            $args->{'sort_html'}.'</td></tr>';  
             }  
         } else {  
             $result .= '</tr>';  
         }          }
         $result .= '</table>';          $result .= '</table>';
     } elsif ($args->{'sort_html'}) {       } elsif ($args->{'sort_html'}) { 
Line 1800  END Line 1710  END
     if (defined($anchor)) { $anchor='#'.$anchor; }      if (defined($anchor)) { $anchor='#'.$anchor; }
     my $srcHasQuestion = $src =~ /\?/;      my $srcHasQuestion = $src =~ /\?/;
     $args->{"resourceLink"} = $src.      $args->{"resourceLink"} = $src.
  ($srcHasQuestion?'&amp;':'?') .   ($srcHasQuestion?'&':'?') .
  'symb=' . &escape($symb).$anchor;   'symb=' . &escape($symb).$anchor;
  }   }
         # Now, we've decided what parts to show. Loop through them and          # Now, we've decided what parts to show. Loop through them and
Line 1862  END Line 1772  END
     # it's quite likely this might fix other browsers, too, and       # it's quite likely this might fix other browsers, too, and 
     # certainly won't hurt anything.      # certainly won't hurt anything.
     if ($displayedJumpMarker) {      if ($displayedJumpMarker) {
         $result .= &Apache::lonhtmlcommon::scripttag("          $result .= "
   <script>
 if (location.href.indexOf('#curloc')==-1) {  if (location.href.indexOf('#curloc')==-1) {
     setTimeout(\"location += '#curloc';\", 0)      setTimeout(\"location += '#curloc';\", 0)
 }  }
 ");  </script>";
     }      }
   
     $result.=&Apache::loncommon::end_data_table();      $result.=&Apache::loncommon::end_data_table();
Line 1886  sub add_linkitem { Line 1797  sub add_linkitem {
     $$linkitems{$name}{'text'}=&mt($text);      $$linkitems{$name}{'text'}=&mt($text);
 }  }
   
   sub show_linkitems {
       my ($linkitems)=@_;
       my @linkorder = ("blank","launchnav","closenav","firsthomework",
        "everything","uncompleted","changefolder","clearbubbles");
       
       my $result .= (<<ENDBLOCK);
                 <td align="left">
   <script type="text/javascript">
       function changeNavDisplay () {
    var navchoice = document.linkitems.toplink[document.linkitems.toplink.selectedIndex].value;
   ENDBLOCK
       foreach my $link (@linkorder) {
    $result.= "if (navchoice == '$link') {".
       $linkitems->{$link}{'cmd'}."}\n";
       }
       $result.='}
                 </script>
                      <form name="linkitems" method="post">
                          <span class="LC_nobreak"><select name="toplink">'."\n";
       foreach my $link (@linkorder) {
    if (defined($linkitems->{$link})) {
       if ($linkitems->{$link}{'text'} ne '') {
    $result .= ' <option value="'.$link.'">'.
       $linkitems->{$link}{'text'}."</option>\n";
       }
    }
       }
       $result .= '</select>&nbsp;<input type="button" name="chgnav"
                      value="Go" onClick="javascript:changeNavDisplay()" />
                   </span></form></td>'."\n";
   
       return $result;
   }
   
 sub show_linkitems_toolbar {  sub show_linkitems_toolbar {
     my ($linkitems,$condition)=@_;      my ($linkitems,$condition)=@_;
     my @linkorder = ("launchnav","closenav","firsthomework",      my @linkorder = ("blank","launchnav","closenav","firsthomework",
      "everything","uncompleted","changefolder","clearbubbles");       "everything","uncompleted","changefolder","clearbubbles");
     my $result .='<td align="left">'."\n".      
                  '<span class="LC_nobreak">'."\n".      my $result .=' 
                  '<ul id="LC_toolbar">';                <td align="left">
     foreach my $link (@linkorder) {                         <span class="LC_nobreak">'."\n<ul id=\"LC_toolbar\">";
         my $link_id = 'LC_content_toolbar_'.$link;   foreach my $link (@linkorder) {
         if (defined($linkitems->{$link})) {          my $link_id = "LC_content_toolbar_".$link;
             if ($linkitems->{$link}{'text'} ne '') {   if (defined($linkitems->{$link})) {
                 $linkitems->{$link}{'cmd'}=~s/"/'/g;      if ($linkitems->{$link}{'text'} ne '') {
                 if ($linkitems->{$link}{'cmd'}) {   $linkitems->{$link}{'cmd'}=~s/"/'/g;
                     if ($link eq 'changefolder') {   if($linkitems->{$link}{'cmd'}){
                         if ($condition) {                     if($link eq 'changefolder'){
                             $link_id='LC_content_toolbar_changefolder_toggled';                        if($condition){$link_id='LC_content_toolbar_changefolder_toggled'}
                         } else {                        else{$link_id='LC_content_toolbar_changefolder'}
                             $link_id='LC_content_toolbar_changefolder';                     }
                         }                            $result .=  ' <li><a href="#"'.
                     }       ' onClick="'.$linkitems->{$link}{'cmd'}.'"'.
                     $result .= '<li><a href="#" '.                                  ' id="'.$link_id.'"'.
                                'onclick="'.$linkitems->{$link}{'cmd'}.'" '.                                  ' class="LC_toolbarItem"'.
                                'id="'.$link_id.'" '.     ' title="'.$linkitems->{$link}{'text'}.'"></a></li>'."\n";
                                'class="LC_toolbarItem" '.   }
                                'title="'.$linkitems->{$link}{'text'}.'">'.  
                                '</a></li>'."\n";      }
                 }   }
             }  
         }  
     }      }
     $result .= '</ul>'.      $result .= '</ul>';
                '</span></td>'."\n";      $result .= ' </span></td>'."\n";
   
     return $result;      return $result;
 }  }
   
Line 2388  resource object. Line 2332  resource object.
 Based on the symb of the resource, get a resource object for that  Based on the symb of the resource, get a resource object for that
 resource. This is one of the proper ways to get a resource object.  resource. This is one of the proper ways to get a resource object.
   
 =item * B<getByMapPc>(map_pc):  =item * B<getMapByMapPc>(map_pc):
   
 Based on the map_pc of the resource, get a resource object for  Based on the map_pc of the resource, get a resource object for
 the given map. This is one of the proper ways to get a resource object.  the given map. This is one of the proper ways to get a resource object.
Line 3526  sub new { Line 3470  sub new {
     $self->{NAV_MAP}->{RESOURCE_CACHE}->{$self->{ID}} = $self;      $self->{NAV_MAP}->{RESOURCE_CACHE}->{$self->{ID}} = $self;
     $self->{RESOURCE_ERROR} = 0;      $self->{RESOURCE_ERROR} = 0;
   
     $self->{DUEDATE_CACHE} = undef;  
   
     # A hash that can be used by two-pass algorithms to store data      # A hash that can be used by two-pass algorithms to store data
     # about this resource in. Not used by the resource object      # about this resource in. Not used by the resource object
     # directly.      # directly.
Line 3926  resource of the map. Line 3868  resource of the map.
   
 Returns a string with the type of the map in it.  Returns a string with the type of the map in it.
   
 =item *B<map_hierarchy>:  
   
 Returns a string with a comma-separated ordered list of map_pc IDs  
 for the hierarchy of maps containing a map, with the top level  
 map first, then descending to deeper levels, with the enclosing map last.  
   
 =back  =back
   
 =cut  =cut
Line 3962  sub map_type { Line 3898  sub map_type {
     my $pc = $self->map_pc();      my $pc = $self->map_pc();
     return $self->navHash("map_type_$pc", 0);      return $self->navHash("map_type_$pc", 0);
 }  }
 sub map_hierarchy {  
     my $self = shift;  
     my $pc = $self->map_pc();  
     return $self->navHash("map_hierarchy_$pc", 0);  
 }  
   
   
 #####  #####
 # Property queries  # Property queries
Line 4105  sub checkedin { Line 4035  sub checkedin {
 # this should work exactly like the copy in lonhomework.pm  # this should work exactly like the copy in lonhomework.pm
 sub duedate {  sub duedate {
     (my $self, my $part) = @_;      (my $self, my $part) = @_;
     if (defined ($self->{DUEDATE_CACHE}->{$part})) {  
         return $self->{DUEDATE_CACHE}->{$part};  
     }  
     my $date;      my $date;
     my @interval=$self->parmval("interval", $part);      my @interval=$self->parmval("interval", $part);
     my $due_date=$self->parmval("duedate", $part);      my $due_date=$self->parmval("duedate", $part);
Line 4124  sub duedate { Line 4051  sub duedate {
     } else {      } else {
  $date = $due_date;   $date = $due_date;
     }      }
     $self->{DUEDATE_CACHE}->{$part} = $date;  
     return $date;      return $date;
 }  }
 sub handgrade {  sub handgrade {
Line 4727  Information not available due to network Line 4653  Information not available due to network
   
 Attempted, and not yet graded.  Attempted, and not yet graded.
   
 =item * B<CREDIT_ATTEMPTED>:  
   
 Attempted, and credit received for attempt (survey and anonymous survey only).  
   
 =back  =back
   
 =cut  =cut
Line 4742  sub CORRECT               { return 13; } Line 4664  sub CORRECT               { return 13; }
 sub CORRECT_BY_OVERRIDE   { return 14; }  sub CORRECT_BY_OVERRIDE   { return 14; }
 sub EXCUSED               { return 15; }  sub EXCUSED               { return 15; }
 sub ATTEMPTED             { return 16; }  sub ATTEMPTED             { return 16; }
 sub CREDIT_ATTEMPTED      { return 17; }  
   
 sub getCompletionStatus {  sub getCompletionStatus {
     my $self = shift;      my $self = shift;
Line 4761  sub getCompletionStatus { Line 4682  sub getCompletionStatus {
     if ($status eq 'incorrect_by_override') {return $self->INCORRECT_BY_OVERRIDE; }      if ($status eq 'incorrect_by_override') {return $self->INCORRECT_BY_OVERRIDE; }
     if ($status eq 'excused') {return $self->EXCUSED; }      if ($status eq 'excused') {return $self->EXCUSED; }
     if ($status eq 'ungraded_attempted') {return $self->ATTEMPTED; }      if ($status eq 'ungraded_attempted') {return $self->ATTEMPTED; }
     if ($status eq 'credit_attempted') {  
         if ($self->is_anonsurvey($part) || $self->is_survey($part)) {  
             return $self->CREDIT_ATTEMPTED;  
         } else {  
             return $self->ATTEMPTED;  
         }  
     }  
     return $self->NOT_ATTEMPTED;      return $self->NOT_ATTEMPTED;
 }  }
   
Line 4857  The item is open and not yet tried. Line 4771  The item is open and not yet tried.
   
 The problem has been attempted.  The problem has been attempted.
   
 =item * B<CREDIT_ATTEMPTED>:  
   
 The problem has been attempted, and credit given for the attempt (survey and anonymous survey only).  
   
 =item * B<ANSWER_SUBMITTED>:  =item * B<ANSWER_SUBMITTED>:
   
 An answer has been submitted, but the student should not see it.  An answer has been submitted, but the student should not see it.
Line 4934  sub status { Line 4844  sub status {
         return ATTEMPTED;          return ATTEMPTED;
     }      }
   
     if ($completionStatus == CREDIT_ATTEMPTED) {  
         return CREDIT_ATTEMPTED;  
     }  
   
     # If it's EXCUSED, then return that no matter what      # If it's EXCUSED, then return that no matter what
     if ($completionStatus == EXCUSED) {      if ($completionStatus == EXCUSED) {
         return EXCUSED;           return EXCUSED; 
Line 5040  sub check_for_slot { Line 4946  sub check_for_slot {
                 my $taskstatus = $self->taskstatus();                  my $taskstatus = $self->taskstatus();
                 $is_correct = (($taskstatus eq 'pass') ||                   $is_correct = (($taskstatus eq 'pass') || 
                                ($self->solved() =~ /^correct_/));                                 ($self->solved() =~ /^correct_/));
                 $got_grade = ($taskstatus =~ /^(?:pass|fail)$/);                  $got_grade = ($self->solved() =~ /^(?:pass|fail)$/);
             } else {              } else {
                 $got_grade = 1;                  $got_grade = 1;
                 $is_correct = ($self->solved() =~ /^correct_/);                     $is_correct = ($self->solved() =~ /^correct_/);   
Line 5130  my %compositeToSimple = Line 5036  my %compositeToSimple =
       INCORRECT()             => INCORRECT,        INCORRECT()             => INCORRECT,
       OPEN()                  => OPEN,        OPEN()                  => OPEN,
       ATTEMPTED()             => ATTEMPTED,        ATTEMPTED()             => ATTEMPTED,
       CREDIT_ATTEMPTED()      => CORRECT,  
       ANSWER_SUBMITTED()      => ATTEMPTED        ANSWER_SUBMITTED()      => ATTEMPTED
      );       );
   
Line 5204  sub completable { Line 5109  sub completable {
         # "If any of the parts are open, or have tries left (implies open),          # "If any of the parts are open, or have tries left (implies open),
         # and it is not "attempted" (manually graded problem), it is          # and it is not "attempted" (manually graded problem), it is
         # not "complete"          # not "complete"
         if ($self->getCompletionStatus($part) == ATTEMPTED() ||   if ($self->getCompletionStatus($part) == ATTEMPTED() ||
             $self->getCompletionStatus($part) == CREDIT_ATTEMPTED() ||      $status == ANSWER_SUBMITTED() ) {
             $status == ANSWER_SUBMITTED() ) {  
     # did this part already, as well as we can      # did this part already, as well as we can
     next;      next;
  }   }

Removed from v.1.444.2.8  
changed lines
  Added in v.1.445


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