File:  [LON-CAPA] / loncom / homework / outputtags.pm
Revision 1.2: download - view: text, annotated - select for diffs
Thu Jan 11 16:11:16 2001 UTC (23 years, 3 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- changed <duedatebox> to <displayduedate>
- added <displaytitle>
- <problem> sets $Apache::lonhomework::name to the title of the resource

    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',('displayduedate','displaytitle'));
    9: }
   10: 
   11: sub start_displayduedate {
   12:   my ($target,$token,$parstack,$parser,$safeeval)=@_;
   13:   my $result;
   14:   my $status=$Apache::inputtags::status['-1'];
   15:   &Apache::lonxml::debug("got a $status in duedatebox");
   16:   if ($status =~ /CAN.*_ANSWER/) {
   17:     my $args ='';
   18:     if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
   19:     my $format = &Apache::run::run("{$args;".'return $format}',$safeeval);
   20:     if ($format eq '') {
   21:       &Apache::lonxml::debug("using default format");
   22:       $format="%c";
   23:     }
   24:     my $id = $Apache::inputtags::part;
   25:     my $date = &Apache::lonnet::EXT("resource.$id.duedate");
   26:     &Apache::lonxml::debug("duedatebox found $date for $id");
   27:     $result ='<table border="on"><tr><td>Due at '.
   28:       POSIX::strftime($format,localtime($date)).
   29: 	'</td></tr></table>';
   30:   }
   31:   return $result;
   32: }
   33: 
   34: sub end_displayduedate {
   35: }
   36: 
   37: sub start_displaytitle {
   38:   my ($target,$token,$parstack,$parser,$safeeval)=@_;
   39:   return "<h1>$Apache::lonhomework::name</h1>";
   40: }
   41: 
   42: sub end_displaytitle {
   43: }
   44: 
   45: 1;
   46: __END__

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