Diff for /loncom/interface/lonnavmaps.pm between versions 1.423.2.3 and 1.444

version 1.423.2.3, 2010/02/10 16:45:31 version 1.444, 2010/02/28 22:36:38
Line 2 Line 2
 # Navigate Maps Handler  # Navigate Maps Handler
 #  #
 # $Id$  # $Id$
   
 #  #
 # Copyright Michigan State University Board of Trustees  # Copyright Michigan State University Board of Trustees
 #  #
Line 477  use Apache::loncommon(); Line 478  use Apache::loncommon();
 use Apache::lonenc();  use Apache::lonenc();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonnet;  use Apache::lonnet;
   
 use POSIX qw (floor strftime);  use POSIX qw (floor strftime);
 use Time::HiRes qw( gettimeofday tv_interval );  use Time::HiRes qw( gettimeofday tv_interval );
 use LONCAPA;  use LONCAPA;
Line 491  sub NOTHING { return 3; } Line 493  sub NOTHING { return 3; }
   
 my $resObj = "Apache::lonnavmaps::resource";  my $resObj = "Apache::lonnavmaps::resource";
   
 # Keep these mappings in sync with lonquickgrades, which uses the colors  # Keep these mappings in sync with lonquickgrades, which usesthe colors
 # instead of the icons.  # instead of the icons.
 my %statusIconMap =   my %statusIconMap = 
     (      (
Line 504  my %statusIconMap = Line 506  my %statusIconMap =
      $resObj->ERROR        => ''       $resObj->ERROR        => ''
      );       );
   
 my %iconAltTags =   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'    => 'Open' );        'navmap.open.gif'     => 'Open',
         'navmap.partial.gif'  => 'Partially Correct',
         'navmap.ellipsis.gif' => 'Attempted',
        );
   
 # Defines a status->color mapping, null string means don't color  # Defines a status->color mapping, null string means don't color
 my %colormap =   my %colormap = 
Line 597  sub getLinkForResource { Line 602  sub getLinkForResource {
     my ($map,$id,$src)=&Apache::lonnet::decode_symb($res->symb());      my ($map,$id,$src)=&Apache::lonnet::decode_symb($res->symb());
     if ($map=~/\.page$/) {      if ($map=~/\.page$/) {
  my $url=&Apache::lonnet::clutter($map);   my $url=&Apache::lonnet::clutter($map);
                 $anchor=&escape($res->shown_symb());   $anchor=&escape($res->shown_symb());
  return ($url,$res->shown_symb(),$anchor);   return ($url,$res->shown_symb(),$anchor);
     }      }
         }          }
Line 695  sub getDescription { Line 700  sub getDescription {
         return &mt("Excused by instructor");          return &mt("Excused by instructor");
     }      }
     if ($status == $res->ATTEMPTED) {      if ($status == $res->ATTEMPTED) {
         return &mt("Answer submitted, not yet graded");          if ($res->is_anonsurvey($part) || $res->is_survey($part)) {
               return &mt("Survey submission recorded");
           } else {
               return &mt("Answer submitted, not yet graded");
           }
     }      }
     if ($status == $res->TRIES_LEFT) {      if ($status == $res->TRIES_LEFT) {
         my $tries = $res->tries($part);          my $tries = $res->tries($part);
Line 892  sub render_resource { Line 901  sub render_resource {
     my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons");      my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons");
     # If this is a new branch, label it so      # If this is a new branch, label it so
     if ($params->{'isNewBranch'}) {      if ($params->{'isNewBranch'}) {
         $newBranchText = '<img src="'.$location.'/branch.gif" border="0" alt="'.          $newBranchText = "<img src='$location/branch.gif' alt=".mt('Branch')." />";
                          &mt('Branch').'" />';  
     }      }
   
     # links to open and close the folder      # links to open and close the folder
   
           my $whitespace = $location.'/whitespace_21.gif';
     my $linkopen = "<a href=\"$link\">";      my $linkopen = "<img src='$whitespace' alt='' />"."<a href=\"$link\">";
   
   
     my $linkclose = "</a>";      my $linkclose = "</a>";
   
     # Default icon: unknown page      # Default icon: unknown page
     my $icon = "<img src='$location/unknown.gif' alt='' border='0' alt='&nbsp;&nbsp;' ' />";      my $icon = "<img class=\"LC_contentImage\" src='$location/unknown.gif' alt='' />";
           
     if ($resource->is_problem()) {      if ($resource->is_problem()) {
         if ($part eq '0' || $params->{'condensed'}) {          if ($part eq '0' || $params->{'condensed'}) {
     $icon = '<img src="'.$location.'/';      $icon = '<img class="LC_contentImage" src="'.$location.'/';
     if ($resource->is_task()) {      if ($resource->is_task()) {
  $icon .= 'task.gif" alt="'.&mt('Task');   $icon .= 'task.gif" alt="'.&mt('Task');
     } else {      } else {
  $icon .= 'problem.gif" alt="'.&mt('Problem');   $icon .= 'problem.gif" alt="'.&mt('Problem');
     }      }
     $icon .='" border="0" />';      $icon .='" />';
         } else {          } else {
             $icon = $params->{'indentString'};              $icon = $params->{'indentString'};
         }          }
     } else {      } else {
  $icon = "<img src='".&Apache::loncommon::icon($resource->src)."' alt='&nbsp;&nbsp;' border='0' />";   $icon = "<img class=\"LC_contentImage\" src='".&Apache::loncommon::icon($resource->src)."' alt='' />";
     }      }
   
     # Display the correct map icon to open or shut map      # Display the correct map icon to open or shut map
Line 930  sub render_resource { Line 936  sub render_resource {
         if ($it->{CONDITION}) {          if ($it->{CONDITION}) {
             $nowOpen = !$nowOpen;              $nowOpen = !$nowOpen;
         }          }
   
  my $folderType = $resource->is_sequence() ? 'folder' : 'page';   my $folderType = $resource->is_sequence() ? 'folder' : 'page';
         my $title=$resource->title;          my $title=$resource->title;
         $title=~s/\"/\&quot;/g;   $title=~s/\"/\&qout;/g;
         if (!$params->{'resource_no_folder_link'}) {          if (!$params->{'resource_no_folder_link'}) {
             $icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif';              $icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif';
     $icon = "<img src='$location/$icon' alt=\"".              $icon = "<img src='$location/arrow." . ($nowOpen ? 'closed' : 'open') . ".gif' alt='' />"
  ($nowOpen ? &mt('Open Folder') : &mt('Close Folder')).' '.$title."\" border='0' />";                      ."<img class=\"LC_contentImage\" src='$location/$icon' alt=\""
                       .($nowOpen ? &mt('Open Folder') : &mt('Close Folder')).' '.$title."\" />";
             $linkopen = "<a href=\"" . $params->{'url'} . '?' .               $linkopen = "<a href=\"" . $params->{'url'} . '?' . 
                 $params->{'queryString'} . '&amp;filter=';                  $params->{'queryString'} . '&amp;filter=';
             $linkopen .= ($nowOpen xor $it->{CONDITION}) ?              $linkopen .= ($nowOpen xor $it->{CONDITION}) ?
Line 953  sub render_resource { Line 959  sub render_resource {
   
         } else {          } else {
             # Don't allow users to manipulate folder              # Don't allow users to manipulate folder
             $icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') .              $icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif';
                 '.nomanip.gif';              $icon = "<img class=\"LC_space\" src='$whitespace' alt='' />"."<img class=\"LC_contentImage\" src='$location/$icon' alt=\"".($nowOpen ? &mt('Open Folder') : &mt('Close Folder')).' '.$title."\" />";
             $icon = "<img src='$location/$icon' alt=\"".  
  ($nowOpen ? &mt('Open Folder') : &mt('Close Folder')).' '.$title."\" border='0' />";  
   
             $linkopen = "";              $linkopen = "";
             $linkclose = "";              $linkclose = "";
Line 972  sub render_resource { Line 976  sub render_resource {
     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>';
     }      }
    
     # We're done preparing and finally ready to start the rendering  
     my $result = "<td align='left' valign='middle'>";  
   
       # We're done preparing and finally ready to start the rendering
       my $result = '<td class="LC_middle">';
       my $newfolderType = $resource->is_sequence() ? 'folder' : 'page';
   
     my $indentLevel = $params->{'indentLevel'};      my $indentLevel = $params->{'indentLevel'};
     if ($newBranchText) { $indentLevel--; }      if ($newBranchText) { $indentLevel--; }
   
Line 985  sub render_resource { Line 990  sub render_resource {
     }      }
   
     # Decide what to display      # Decide what to display
   
     $result .= "$newBranchText$linkopen$icon$linkclose";      $result .= "$newBranchText$linkopen$icon$linkclose";
           
     my $curMarkerBegin = '';      my $curMarkerBegin = '';
Line 994  sub render_resource { Line 998  sub render_resource {
     # Is this the current resource?      # Is this the current resource?
     if (!$params->{'displayedHereMarker'} &&       if (!$params->{'displayedHereMarker'} && 
         $resource->symb() eq $params->{'here'} ) {          $resource->symb() eq $params->{'here'} ) {
         $curMarkerBegin = '<span class="LC_fontcolor_red LC_fontsize_large">&gt;</span>';          $curMarkerBegin = '<em>';
         $curMarkerEnd = '<span class="LC_fontcolor_red LC_fontsize_large">&lt;</span>';          $curMarkerEnd = '</em>';
         $params->{'displayedHereMarker'} = 1;   $params->{'displayedHereMarker'} = 1;
     }      }
   
     if ($resource->is_problem() && $part ne '0' &&       if ($resource->is_problem() && $part ne '0' && 
Line 1016  sub render_resource { Line 1020  sub render_resource {
  $target=' target="loncapaclient" ';   $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 $target href=\"$link\">$title$partLabel</a>$curMarkerEnd$nonLinkedText</td>";
     } else {      } else {
         $result .= "  $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText</td>";          $result .= "$curMarkerBegin$linkopen$title$partLabel</a>$curMarkerEnd$nonLinkedText</td>";
     }      }
   
     return $result;      return $result;
Line 1038  sub render_communication_status { Line 1042  sub render_communication_status {
     my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc");      my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc");
     if ($resource->hasDiscussion()) {      if ($resource->hasDiscussion()) {
         $discussionHTML = $linkopen .          $discussionHTML = $linkopen .
             '<img alt="'.&mt('New Discussion').'" border="0" src="'.$location.'/chat.gif" />' .              '<img alt="'.&mt('New Discussion').'" src="'.$location.'/chat.gif" title="'.&mt('New Discussion').'"/>' .
             $linkclose;              $linkclose;
     }      }
           
Line 1048  sub render_communication_status { Line 1052  sub render_communication_status {
             if ($msgid) {              if ($msgid) {
                 $feedbackHTML .= '&nbsp;<a '.$target.' href="/adm/email?display='                  $feedbackHTML .= '&nbsp;<a '.$target.' href="/adm/email?display='
                     . &escape($msgid) . '">'                      . &escape($msgid) . '">'
                     . '<img alt="'.&mt('New E-mail').'" src="'.$location.'/feedback.gif" '                      . '<img alt="'.&mt('New E-mail').'" src="'.$location.'/feedback.gif" title="'.&mt('New E-mail').'"/></a>';
                     . 'border="0" /></a>';  
             }              }
         }          }
     }      }
Line 1063  sub render_communication_status { Line 1066  sub render_communication_status {
                 $errorcount++;                  $errorcount++;
                 $errorHTML .= '&nbsp;<a '.$target.' href="/adm/email?display='                  $errorHTML .= '&nbsp;<a '.$target.' href="/adm/email?display='
                     . &escape($msgid) . '">'                      . &escape($msgid) . '">'
                     . '<img alt="'.&mt('New Error').'" src="'.$location.'/bomb.gif" '                      . '<img alt="'.&mt('New Error').'" src="'.$location.'/bomb.gif" title="'.&mt('New Error').'"/></a>';
                     . 'border="0" /></a>';  
             }              }
         }          }
     }      }
Line 1072  sub render_communication_status { Line 1074  sub render_communication_status {
     if ($params->{'multipart'} && $part != '0') {      if ($params->{'multipart'} && $part != '0') {
  $discussionHTML = $feedbackHTML = $errorHTML = '';   $discussionHTML = $feedbackHTML = $errorHTML = '';
     }      }
       return "<td class=\"LC_middle\">$discussionHTML$feedbackHTML$errorHTML&nbsp;</td>";
     return "<td width=\"75\" align=\"left\" valign=\"middle\">$discussionHTML$feedbackHTML$errorHTML&nbsp;</td>";  
   
 }  }
 sub render_quick_status {  sub render_quick_status {
Line 1089  sub render_quick_status { Line 1090  sub render_quick_status {
     }      }
     my $linkopen = "<a $target href=\"$link\">";      my $linkopen = "<a $target href=\"$link\">";
     my $linkclose = "</a>";      my $linkclose = "</a>";
   
    $result .= '<td class="LC_middle">';
     if ($resource->is_problem() &&      if ($resource->is_problem() &&
         !$firstDisplayed) {          !$firstDisplayed) {
   
         my $icon = $statusIconMap{$resource->simpleStatus($part)};          my $icon = $statusIconMap{$resource->simpleStatus($part)};
         my $alt = $iconAltTags{$icon};          my $alt = $iconAltTags{$icon};
         if ($icon) {          if ($icon) {
     my $location=      my $location=
  &Apache::loncommon::lonhttpdurl("/adm/lonIcons/$icon");   &Apache::loncommon::lonhttpdurl("/adm/lonIcons/$icon");
             $result .= "<td valign='middle' width='50' align='right'>$linkopen<img width='25' height='25' src='$location' border='0' alt='$alt' />$linkclose</td>\n";   $result .= $linkopen.'<img src="'.$location.'" alt="'.&mt($alt).'" title="'.&mt($alt).'" />'.$linkclose;            
         } else {          } else {
             $result .= "<td width='30'>&nbsp;</td>\n";              $result .= "&nbsp;";
         }          }
     } else { # not problem, no icon      } else { # not problem, no icon
         $result .= "<td width='30'>&nbsp;</td>\n";          $result .= "&nbsp;";
     }      }
    $result .= "</td>\n";
     return $result;      return $result;
 }  }
 sub render_long_status {  sub render_long_status {
     my ($resource, $part, $params) = @_;      my ($resource, $part, $params) = @_;
     my $result = "<td align='right' valign='middle'>\n";      my $result = '<td class="LC_middle LC_right">';
     my $firstDisplayed = !$params->{'condensed'} &&       my $firstDisplayed = !$params->{'condensed'} && 
         $params->{'multipart'} && $part eq "0";          $params->{'multipart'} && $part eq "0";
                                   
Line 1414  sub render { Line 1415  sub render {
     my $printKey = $args->{'printKey'};      my $printKey = $args->{'printKey'};
     my $printCloseAll = $args->{'printCloseAll'};      my $printCloseAll = $args->{'printCloseAll'};
     if (!defined($printCloseAll)) { $printCloseAll = 1; }      if (!defined($printCloseAll)) { $printCloseAll = 1; }
      
     # Print key?      # Print key?
     if ($printKey) {      if ($printKey) {
         $result .= '<table border="0" cellpadding="2" cellspacing="0">';          $result .= '<table border="0" cellpadding="2" cellspacing="0">';
Line 1489  END Line 1490  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>';                     &Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').'</td>';
Line 1497  END Line 1499  END
         } else {          } else {
     $result .= '</tr><tr>';       $result .= '</tr><tr>'; 
         }          }
  $result.=&show_linkitems($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') {      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>'.
Line 1512  END Line 1515  END
         $result.=$args->{'sort_html'};           $result.=$args->{'sort_html'}; 
     }      }
   
     $result .= "<br />\n";      #$result .= "<br />\n";
     if ($r) {      if ($r) {
         $r->print($result);          $r->print($result);
         $r->rflush();          $r->rflush();
         $result = "";          $result = "";
     }      }
     # End parameter setting      # End parameter setting
                   
       $result .= "<br />\n";
   
     # Data      # Data
     $result .= '<table cellspacing="0" cellpadding="3" border="0" bgcolor="#FFFFFF">' ."\n";      $result.=&Apache::loncommon::start_data_table("LC_tableOfContent");    
   
     my $res = "Apache::lonnavmaps::resource";      my $res = "Apache::lonnavmaps::resource";
     my %condenseStatuses =      my %condenseStatuses =
         ( $res->NETWORK_FAILURE    => 1,          ( $res->NETWORK_FAILURE    => 1,
           $res->NOTHING_SET        => 1,            $res->NOTHING_SET        => 1,
           $res->CORRECT            => 1 );            $res->CORRECT            => 1 );
     my @backgroundColors = ("#FFFFFF", "#F6F6F6");  
   
     # Shared variables      # Shared variables
     $args->{'counter'} = 0; # counts the rows      $args->{'counter'} = 0; # counts the rows
     $args->{'indentLevel'} = 0;      $args->{'indentLevel'} = 0;
     $args->{'isNewBranch'} = 0;      $args->{'isNewBranch'} = 0;
     $args->{'condensed'} = 0;          $args->{'condensed'} = 0;   
     my $location=  
  &Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace1.gif");      my $location = &Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif");
     $args->{'indentString'} = setDefault($args->{'indentString'}, "<img src='$location' width='25' height='1' alt='&nbsp;&nbsp;' border='0' />");      $args->{'indentString'} = setDefault($args->{'indentString'}, "<img src='$location' alt='' />");
     $args->{'displayedHereMarker'} = 0;      $args->{'displayedHereMarker'} = 0;
   
     # If we're suppressing empty sequences, look for them here. Use DFS for speed,      # If we're suppressing empty sequences, look for them here. Use DFS for speed,
Line 1762  END Line 1767  END
         # show them.          # show them.
         foreach my $part (@parts) {          foreach my $part (@parts) {
             $rownum ++;              $rownum ++;
             my $backgroundColor = $backgroundColors[$rownum % scalar(@backgroundColors)];  
                           
             $result .= "  <tr bgcolor='$backgroundColor'>\n";              $result .= &Apache::loncommon::start_data_table_row();
   
             # Set up some data about the parts that the cols might want              # Set up some data about the parts that the cols might want
             my $filter = $it->{FILTER};              my $filter = $it->{FILTER};
Line 1790  END Line 1794  END
                 }                  }
                 $result .= $colHTML . "\n";                  $result .= $colHTML . "\n";
             }              }
             $result .= "    </tr>\n";              $result .= &Apache::loncommon::end_data_table_row();
             $args->{'isNewBranch'} = 0;              $args->{'isNewBranch'} = 0;
         }          }
   
Line 1826  if (location.href.indexOf('#curloc')==-1 Line 1830  if (location.href.indexOf('#curloc')==-1
 </script>";  </script>";
     }      }
   
     $result .= "</table>";      $result.=&Apache::loncommon::end_data_table();
       
     if ($r) {      if ($r) {
         $r->print($result);          $r->print($result);
         $result = "";          $result = "";
Line 1877  ENDBLOCK Line 1881  ENDBLOCK
     return $result;      return $result;
 }  }
   
   sub show_linkitems_toolbar {
       my ($linkitems,$condition)=@_;
       my @linkorder = ("blank","launchnav","closenav","firsthomework",
        "everything","uncompleted","changefolder","clearbubbles");
       
       my $result .=' 
                 <td align="left">
                          <span class="LC_nobreak">'."\n<ul id=\"LC_toolbar\">";
    foreach my $link (@linkorder) {
           my $link_id = "LC_content_toolbar_".$link;
    if (defined($linkitems->{$link})) {
       if ($linkitems->{$link}{'text'} ne '') {
    $linkitems->{$link}{'cmd'}=~s/"/'/g;
    if($linkitems->{$link}{'cmd'}){
                      if($link eq 'changefolder'){
                         if($condition){$link_id='LC_content_toolbar_changefolder_toggled'}
                         else{$link_id='LC_content_toolbar_changefolder'}
                      }
                             $result .=  ' <li><a href="#"'.
        ' onClick="'.$linkitems->{$link}{'cmd'}.'"'.
                                   ' id="'.$link_id.'"'.
                                   ' class="LC_toolbarItem"'.
      ' title="'.$linkitems->{$link}{'text'}.'"></a></li>'."\n";
    }
   
       }
    }
       }
       $result .= '</ul>';
       $result .= ' </span></td>'."\n";
   
       return $result;
   }
   
   
 1;  1;
   
   
Line 3745  sub is_problem { Line 3784  sub is_problem {
     }      }
     return 0;      return 0;
 }  }
   #
   #  The has below is the set of status that are considered 'incomplete'
   #
   my %incomplete_hash = 
   (
    TRIES_LEFT()     => 1,
    OPEN()           => 1,
    ATTEMPTED()      => 1
   
    );
   #
   #  Return tru if a problem is incomplete... for now incomplete means that
   #  any part of the problem is incomplete. 
   #  Note that if the resources is not a problem, 0 is returned.
   #
   sub is_incomplete {
       my $self = shift;
       if ($self->is_problem()) {
    &Apache::lonnet::logthis('is problem');
    foreach my $part (@{$self->parts()}) {
       &Apache::lonnet::logthis("$part status ".$self->status($part));
       if (exists($incomplete_hash{$self->status($part)})) {
    return 1;
       }
    }
       }
       return 0;
          
   }
 sub is_raw_problem {  sub is_raw_problem {
     my $self=shift;      my $self=shift;
     my $src = $self->src();      my $src = $self->src();
Line 3774  sub map_contains_problem { Line 3842  sub map_contains_problem {
 sub is_sequence {  sub is_sequence {
     my $self=shift;      my $self=shift;
     return $self->navHash("is_map_", 1) &&       return $self->navHash("is_map_", 1) && 
  $self->navHash("map_type_" . $self->map_pc()) eq 'sequence';      $self->navHash("map_type_" . $self->map_pc()) eq 'sequence';
 }  }
 sub is_survey {  sub is_survey {
     my $self = shift();      my $self = shift();
     my $part = shift();      my $part = shift();
     my $type = $self->parmval('type',$part);      my $type = $self->parmval('type',$part);
     if ($type eq 'survey') {      if (($type eq 'survey') || ($type eq 'surveycred')) {
         return 1;          return 1;
     }      }
     if ($self->src() =~ /\.(survey)$/) {      if ($self->src() =~ /\.(survey)$/) {
Line 3788  sub is_survey { Line 3856  sub is_survey {
     }      }
     return 0;      return 0;
 }  }
   sub is_anonsurvey {
       my $self = shift();
       my $part = shift();
       my $type = $self->parmval('type',$part);
       if (($type eq 'anonsurvey') || ($type eq 'anonsurveycred')) {
           return 1;
       }
       return 0;
   }
 sub is_task {  sub is_task {
     my $self=shift;      my $self=shift;
     my $src = $self->src();      my $src = $self->src();
Line 4105  sub slot_control { Line 4182  sub slot_control {
     if (!defined($part)) { $part = '0'; }      if (!defined($part)) { $part = '0'; }
     my $useslots = $self->parmval("useslots", $part);      my $useslots = $self->parmval("useslots", $part);
     my $availablestudent = $self->parmval("availablestudent", $part);      my $availablestudent = $self->parmval("availablestudent", $part);
     my $available = $self->parmval("available", $part);      my $available = $self->parmval("available", $part); 
     return ($useslots,$availablestudent,$available);      return ($useslots,$availablestudent,$available);
 }  }
   
Line 4540  sub OPEN                   { return 1; } Line 4617  sub OPEN                   { return 1; }
 sub PAST_DUE_NO_ANSWER     { return 2; }  sub PAST_DUE_NO_ANSWER     { return 2; }
 sub PAST_DUE_ANSWER_LATER  { return 3; }  sub PAST_DUE_ANSWER_LATER  { return 3; }
 sub ANSWER_OPEN            { return 4; }  sub ANSWER_OPEN            { return 4; }
 sub NOTHING_SET            { return 5; }   sub NOTHING_SET            { return 5; }
 sub NETWORK_FAILURE        { return 100; }  sub NETWORK_FAILURE        { return 100; }
   
 # getDateStatus gets the date status for a given problem part.   # getDateStatus gets the date status for a given problem part. 
Line 4752  An answer has been submitted, but the st Line 4829  An answer has been submitted, but the st
   
 =cut  =cut
   
 sub TRIES_LEFT       { return 20; }  sub TRIES_LEFT        { return 20; }
 sub ANSWER_SUBMITTED { return 21; }  sub ANSWER_SUBMITTED  { return 21; }
 sub PARTIALLY_CORRECT{ return 22; }  sub PARTIALLY_CORRECT { return 22; }
   
 sub RESERVED_LATER    { return 30; }  sub RESERVED_LATER    { return 30; }
 sub RESERVED          { return 31; }  sub RESERVED          { return 31; }
Line 4897  sub check_for_slot { Line 4974  sub check_for_slot {
                                     if (!&Apache::loncommon::check_ip_acc($ip)) {                                      if (!&Apache::loncommon::check_ip_acc($ip)) {
                                         return (RESERVED_LOCATION,$ip,$slot_name);                                          return (RESERVED_LOCATION,$ip,$slot_name);
                                     }                                      }
                                 }                                  } 
                                 if (@proctors > 0) {                                  if (@proctors > 0) {
                                     unless ((grep(/^\Q$checkedin\E/,@proctors)) &&                                      unless ((grep(/^\Q$checkedin\E/,@proctors)) &&
                                         ($checkedinslot eq $slot_name)) {                                          ($checkedinslot eq $slot_name)) {
                                         return (NEEDS_CHECKIN,undef,$slot_name);                                          return (NEEDS_CHECKIN,undef,$slot_name); 
                                     }                                      }
                                 }                                  }
                                 return (RESERVED,$end,$slot_name);                                  return (RESERVED,$end,$slot_name);
Line 4917  sub check_for_slot { Line 4994  sub check_for_slot {
             my ($is_correct,$got_grade);              my ($is_correct,$got_grade);
             if ($self->is_task()) {              if ($self->is_task()) {
                 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 = ($self->solved() =~ /^(?: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_/);   
             }              }
             ($checkedin,$checkedinslot) = $self->checkedin();              ($checkedin,$checkedinslot) = $self->checkedin();
             if ($checkedin) {              if ($checkedin) {
                 if (!$got_grade) {                  if (!$got_grade) {
                     return (WAITING_FOR_GRADE);                      return (WAITING_FOR_GRADE);
                 } elsif ($is_correct) {                  } elsif ($is_correct) {
                     return (CORRECT);                      return (CORRECT); 
                 }                  }
             }              }
             return(NOT_IN_A_SLOT);              return(NOT_IN_A_SLOT);

Removed from v.1.423.2.3  
changed lines
  Added in v.1.444


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