File:  [LON-CAPA] / loncom / homework / outputtags.pm
Revision 1.1: download - view: text, annotated - select for diffs
Thu Jan 11 15:20:58 2001 UTC (23 years, 4 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- added <duedatebox> for displaying the duedate.

    1: package Apache::outputtags; 
    2: 
    3: use strict;
    4: use Apache::lonnet;
    5: use POSIX qw(strftime);
    6: 
    7: sub BEGIN {
    8:   &Apache::lonxml::register('Apache::outputtags',('duedatebox'));
    9: }
   10: 
   11: 
   12: sub start_duedatebox {
   13:   my ($target,$token,$parstack,$parser,$safeeval)=@_;
   14:   my $result;
   15:   my $status=$Apache::inputtags::status['-1'];
   16:   &Apache::lonxml::debug("got a $status in duedatebox");
   17:   if ($status =~ /CAN.*_ANSWER/) {
   18:     my $args ='';
   19:     if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
   20:     my $format = &Apache::run::run("{$args;".'return $format}',$safeeval);
   21:     if ($format eq '') {
   22:       &Apache::lonxml::debug("using default format");
   23:       $format="%c";
   24:     }
   25:     my $id = $Apache::inputtags::part;
   26:     my $date = &Apache::lonnet::EXT("resource.$id.duedate");
   27:     &Apache::lonxml::debug("duedatebox found $date for $id");
   28:     $result ='<table border="on"><tr><td>Due at '.
   29:       POSIX::strftime($format,localtime($date)).
   30: 	'</td></tr></table>';
   31:   }
   32:   return $result;
   33: }
   34: 
   35: sub end_duedatebox {
   36: }
   37: 
   38: 1;
   39: __END__

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