Diff for /loncom/homework/lonhomework.pm between versions 1.18 and 1.22

version 1.18, 2000/12/04 22:08:57 version 1.22, 2000/12/19 23:22:22
Line 10  use Apache::lonnet; Line 10  use Apache::lonnet;
 use Apache::inputtags;  use Apache::inputtags;
 use Apache::structuretags;  use Apache::structuretags;
 use Apache::response;  use Apache::response;
   use Apache::hint;
   
 sub get_target {  sub get_target {
   if ( $ENV{'request.state'} eq "published") {    if ( $ENV{'request.state'} eq "published") {
Line 52  sub send_footer { Line 52  sub send_footer {
   $request->print(&Apache::lontexconvert::footer());    $request->print(&Apache::lontexconvert::footer());
 }  }
   
   #@Apache::lonhomework::date_status=();
   #@Apache::lonhomework::date_msg=();
   sub check_date {
     my ($id) = @_;
     my $date ='';
     my $status = '';
     my $datemsg = '';
     my $lastdate = '';
     my $temp;
     my $type;
     my $passed;
     &Apache::lonxml::debug("checking for part :$id:");
     foreach $temp ("opendate","duedate","answerdate") {
       $lastdate = $date;
       $date = &Apache::lonnet::EXT("resource.$id.$temp");
       &Apache::lonxml::debug("found :$date: for :$temp:");
       if ($date eq '') {
         $date = "an unknown date"; $passed = 0;
       } else {
         if (time < $date) { $passed = 0; } else { $passed = 1; }
         $date = localtime $date;
       }
       if (!$passed) { $type=$temp; last; }
     }
     &Apache::lonxml::debug("have :$type:$passed:");
     if ($passed) {
       $status='SHOW_ANSWER';
       $datemsg=$date;
     } elsif ($type eq 'opendate') {
       $status='CLOSED';
       $datemsg = "will open on $date";
     } elsif ($type eq 'duedate') {
       $status='CAN_ANSWER';
       $datemsg = "is due at $date";
     } elsif ($type eq 'answerdate') {
       $status='CLOSED';
       $datemsg = "was due as $lastdate, and asnswers will be available at $date";
     }
     &Apache::lonxml::debug("sending back :$status:$datemsg:");
     return ($status,$datemsg);
   }
   
 sub handler {  sub handler {
   my $request=$_[0];    my $request=$_[0];
   
   $Apache::lonxml::debug=1;    if ( $ENV{'user.name'} eq 'albertel' ) { $Apache::lonxml::debug=1; }
       
   my (@targets) = &get_target();    my (@targets) = &get_target();
   
Line 69  sub handler { Line 111  sub handler {
       
   &Apache::lonhomework::send_header($request);    &Apache::lonhomework::send_header($request);
       
     #check if allowed to see
     
   foreach my $target (@targets) {    foreach my $target (@targets) {
     my $file=&Apache::lonnet::filelocation("",$request->uri);      my $file=&Apache::lonnet::filelocation("",$request->uri);
     my $problem=&Apache::lonnet::getfile($file);      my $problem=&Apache::lonnet::getfile($file);
Line 85  sub handler { Line 129  sub handler {
     #ignore error conditions      #ignore error conditions
     my ($temp)=keys %Apache::lonhomework::history ;      my ($temp)=keys %Apache::lonhomework::history ;
     if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); }       if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); } 
           if ($target eq 'web' && &Apache::lonnet::symbread() eq '') {
         $request->print("Vieiwing this problem as not a student, submissions will be ignored.");
       }
     if ($target eq 'grade') {      if ($target eq 'grade') {
       my $resultkey;        my $resultkey;
       foreach $resultkey (sort keys %Apache::lonhomework::history) {        foreach $resultkey (sort keys %Apache::lonhomework::history) {

Removed from v.1.18  
changed lines
  Added in v.1.22


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