Diff for /loncom/interface/lonnavmaps.pm between versions 1.267.2.8 and 1.268

version 1.267.2.8, 2004/10/07 19:55:52 version 1.268, 2004/07/21 19:54:43
Line 83  my %colormap = Line 83  my %colormap =
 # is not yet done and due in less then 24 hours  # is not yet done and due in less then 24 hours
 my $hurryUpColor = "#FF0000";  my $hurryUpColor = "#FF0000";
   
   sub launch_win {
       my ($mode,$script)=@_;
       my $result;
       if ($script ne 'no') {
    $result.='<script type="text/javascript">';
       }
       $result.='function launch_navmapwin() {
                    newWindow=open(\'/adm/navmaps?launchExternal\',\'loncapanav\',\'width=400,height=600,scrollbars=1\');
                  }';
       if ($mode eq 'now') {
    $result.="\nlaunch_navmapwin();\n";
       }
       if ($script ne 'no') {
    $result.='</script>';
       }
       if ($mode eq 'link') {
    $result.='<a href="javascript:launch_navmapwin();void(0);">'
       .&mt("Launch Navmaps in seperate window")."</a>";
       }
       return $result;
   }
   
   
   
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
     real_handler($r);      real_handler($r);
Line 111  sub real_handler { Line 135  sub real_handler {
     &Apache::loncommon::no_cache($r);      &Apache::loncommon::no_cache($r);
     $r->send_http_header;      $r->send_http_header;
   
       if ($ENV{QUERY_STRING} eq 'collapseExternal') {
    &Apache::lonnet::put('environment',{'remotenavmap' => 'off'});
    &Apache::lonnet::appenv('environment.remotenavmap' => 'off');
    $r->print(<<"ENDSUBM");
    <html>
           <head>
     <script type="text/javascript">
        function submitthis() {
       self.close();
       }
      </script>
           </head>
    <body bgcolor="#FFFFFF" onLoad="submitthis()"></body>
           </html>
   ENDSUBM
           return;
       }
       if ($ENV{QUERY_STRING} eq 'launchExternal') {
    &Apache::lonnet::put('environment',{'remotenavmap' => 'on'});
    &Apache::lonnet::appenv('environment.remotenavmap' => 'on');
       }
   
     # Create the nav map      # Create the nav map
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
   
Line 127  sub real_handler { Line 173  sub real_handler {
           
 # ----------------------------------------------------- Force menu registration  # ----------------------------------------------------- Force menu registration
     my $addentries='';      my $addentries='';
       my $more_unload;
       if ($ENV{'environment.remotenavmap'} eq 'on') {
    $r->print('<script type="text/javascript">
                         function collapse() {
                            this.document.location="/adm/navmaps?collapseExternal";
                         }
                      </script>');
   # FIXME need to be smarter to only catch window close events
   # $more_unload="collapse()"
       }
     if ($ENV{'form.register'}) {      if ($ENV{'form.register'}) {
        $addentries=' onLoad="'.&Apache::lonmenu::loadevents().   $addentries=' onLoad="'.&Apache::lonmenu::loadevents().
    '" onUnload="'.&Apache::lonmenu::unloadevents().'"';      '" onUnload="'.&Apache::lonmenu::unloadevents().';'.
        $r->print(&Apache::lonmenu::registerurl(1));      $more_unload.'"';
    $r->print(&Apache::lonmenu::registerurl(1));
       } else {
    $addentries=' onUnload="'.$more_unload.'"';
     }      }
   
     # Header      # Header
Line 173  sub real_handler { Line 232  sub real_handler {
         }          }
     }      }
   
       if ($ENV{QUERY_STRING} eq 'launchExternal') {
    $r->print('
             <form name="returnwin" action="/adm/flip?postdata=return%3a" 
                   method="post" target="loncapaclient">
             </form>');
    $r->print('
             <script type="text/javascript">
                 this.document.returnwin.submit();
             </script>');
       }
   
       if ($ENV{'environment.remotenavmap'} ne 'on') {
    $r->print(&launch_win('link','yes'));
       } 
       if ($ENV{'environment.remotenavmap'} eq 'on') {
   #        $r->print("<a href='navmaps?collapseExternal'>" .
           $r->print("<a href='javascript:collapse();void(0);'>" .
     &mt("Close external navmaps").
     "</a>&nbsp;&nbsp;&nbsp;&nbsp;");
       } 
   
     my $jumpToFirstHomework = 0;      my $jumpToFirstHomework = 0;
     # Check to see if the student is jumping to next open, do-able problem      # Check to see if the student is jumping to next open, do-able problem
     if ($ENV{QUERY_STRING} eq 'jumpToFirstHomework') {      if ($ENV{QUERY_STRING} eq 'jumpToFirstHomework') {
Line 513  sub timeToHumanString { Line 593  sub timeToHumanString {
         }          }
   
         # Not this year, so show the year          # Not this year, so show the year
         my $timeStr = strftime("on %A, %b %e %Y at %I:%M %P", localtime($time));          my $timeStr = strftime("on %A, %b %e %G at %I:%M %P", localtime($time));
         $timeStr =~ s/12:00 am/00:00/;          $timeStr =~ s/12:00 am/00:00/;
         $timeStr =~ s/12:00 pm/noon/;          $timeStr =~ s/12:00 pm/noon/;
         return $timeStr;          return $timeStr;
Line 971  sub render_resource { Line 1051  sub render_resource {
         $nonLinkedText .= ' (' . $resource->countParts() . ' parts)';          $nonLinkedText .= ' (' . $resource->countParts() . ' parts)';
     }      }
   
       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 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$title$partLabel$curMarkerEnd $nonLinkedText</td>";
     }      }
Line 1260  sub render { Line 1344  sub render {
         # We only need to do this if we need to open the maps to show the          # We only need to do this if we need to open the maps to show the
         # current position. This will change the counter so we can't count          # current position. This will change the counter so we can't count
         # for the jump marker with this loop.          # for the jump marker with this loop.
         while ($here && ($curRes = $mapIterator->next()) && !$found) {          while (($curRes = $mapIterator->next()) && !$found) {
             if (ref($curRes) && $curRes->symb() eq $here) {              if (ref($curRes) && $curRes->symb() eq $here) {
                 my $mapStack = $mapIterator->getStack();                  my $mapStack = $mapIterator->getStack();
                                   
Line 1374  sub render { Line 1458  sub render {
   
     # Check for any unread discussions in all resources.      # Check for any unread discussions in all resources.
     if (!$args->{'resource_no_folder_link'}) {      if (!$args->{'resource_no_folder_link'}) {
  my $time=time;   my $totdisc = 0;
  my $mapr = &mt('Mark all posts read');   my $haveDisc = '';
  $result .= (<<END);   my @allres=$navmap->retrieveResources();
         &nbsp;&nbsp;&nbsp;<a href="javascript:document.clearbubbles.submit()">$mapr</a>&nbsp;<a href="javascript:void(open('/adm/help/NavMaps_MarkPosts_Read.hlp', 'Help_for_NavMaps_MarkPosts', 'menubar=0,toolbar=1,scrollbars=1,width=350,height=400,resizable=yes'))" title="Online Help"><image src="/adm/help/gif/smallHelp.gif" border="0" alt="(Help: NavMaps_MarkPostsLink)" /></a>   foreach my $resource (@allres) {
       if ($resource->hasDiscussion()) {
    my $ressymb;
    if ($resource->symb() =~ m-(___adm/\w+/\w+)/(\d+)/bulletinboard$-) {
       $ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard';
    } else {
       $ressymb = $resource->symb();
    }
    $haveDisc .= $ressymb.':';
    $totdisc ++;
       }
    }
    if ($totdisc > 0) {
       $haveDisc =~ s/:$//;
       my %lt = &Apache::lonlocal::texthash(
    'mapr' => 'Mark all posts read',
    );
       $result .= (<<END);
           &nbsp;&nbsp;&nbsp;<a href="javascript:document.clearbubbles.submit()">$lt{'mapr'}</a>&nbsp;<a href="javascript:void(open('/adm/help/NavMaps_MarkPosts_Read.hlp', 'Help_for_NavMaps_MarkPosts', 'menubar=0,toolbar=1,scrollbars=1,width=350,height=400,resizable=yes'))" title="Online Help"><image src="/adm/help/gif/smallHelp.gif" border="0" alt="(Help: NavMaps_MarkPostsLink)" /></a>
  <form name="clearbubbles" method="post" action="/adm/feedback">   <form name="clearbubbles" method="post" action="/adm/feedback">
  <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="navmaps" value="$haveDisc" />
  </form>   </form>
 END  END
           } else {
       $result .= '<br />';
    }
     }      }
     $result .= "<br />\n";      $result .= "<br />\n";
     if ($r) {      if ($r) {
Line 1858  sub generate_email_discuss_status { Line 1963  sub generate_email_discuss_status {
           
     foreach my $msgid (split(/\&/, $keys)) {      foreach my $msgid (split(/\&/, $keys)) {
  $msgid=&Apache::lonnet::unescape($msgid);   $msgid=&Apache::lonnet::unescape($msgid);
  if ((!$emailstatus{$msgid}) || ($emailstatus{$msgid} eq 'new')) {   my $plain=&Apache::lonnet::unescape(&Apache::lonnet::unescape($msgid));
     my $plain=   if ($plain=~/(Error|Feedback) \[([^\]]+)\]/) {
  &Apache::lonnet::unescape(&Apache::lonnet::unescape($msgid));      my ($what,$url)=($1,$2);
     if ($plain=~/(Error|Feedback) \[([^\]]+)\]/) {      my %status=
  my ($what,$url)=($1,$2);   &Apache::lonnet::get('email_status',[$msgid]);
       if ($status{$msgid}=~/^error\:/) { 
    $status{$msgid}=''; 
       }
       
       if (($status{$msgid} eq 'new') || 
    (!$status{$msgid})) { 
  if ($what eq 'Error') {   if ($what eq 'Error') {
     $error{$url}.=','.$msgid;       $error{$url}.=','.$msgid; 
  } else {   } else {
Line 1872  sub generate_email_discuss_status { Line 1983  sub generate_email_discuss_status {
  }   }
     }      }
           
     #url's of resources that have feedbacks  
     $self->{FEEDBACK} = \%feedback;      $self->{FEEDBACK} = \%feedback;
     #or errors      $self->{ERROR_MSG} = \%error; # what is this? JB
     $self->{ERROR_MSG} = \%error;  
     $self->{DISCUSSION_TIME} = \%discussiontime;      $self->{DISCUSSION_TIME} = \%discussiontime;
     $self->{EMAIL_STATUS} = \%emailstatus;      $self->{EMAIL_STATUS} = \%emailstatus;
     $self->{LAST_READ} = \%lastreadtime;      $self->{LAST_READ} = \%lastreadtime;
Line 3957  sub getCompletionStatus { Line 4066  sub getCompletionStatus {
   
     # Left as separate if statements in case we ever do more with this      # Left as separate if statements in case we ever do more with this
     if ($status eq 'correct_by_student') {return $self->CORRECT;}      if ($status eq 'correct_by_student') {return $self->CORRECT;}
     if ($status eq 'correct_by_scantron') {return $self->CORRECT;}  
     if ($status eq 'correct_by_override') {return $self->CORRECT_BY_OVERRIDE; }      if ($status eq 'correct_by_override') {return $self->CORRECT_BY_OVERRIDE; }
     if ($status eq 'incorrect_attempted') {return $self->INCORRECT; }      if ($status eq 'incorrect_attempted') {return $self->INCORRECT; }
     if ($status eq 'incorrect_by_override') {return $self->INCORRECT_BY_OVERRIDE; }      if ($status eq 'incorrect_by_override') {return $self->INCORRECT_BY_OVERRIDE; }
Line 4108  sub status { Line 4216  sub status {
   
     if ($dateStatus == PAST_DUE_ANSWER_LATER ||      if ($dateStatus == PAST_DUE_ANSWER_LATER ||
         $dateStatus == PAST_DUE_NO_ANSWER ) {          $dateStatus == PAST_DUE_NO_ANSWER ) {
         return $suppressFeedback ? ANSWER_SUBMITTED : $dateStatus;           return $dateStatus; 
     }      }
   
     if ($dateStatus == ANSWER_OPEN) {      if ($dateStatus == ANSWER_OPEN) {

Removed from v.1.267.2.8  
changed lines
  Added in v.1.268


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