Annotation of loncom/homework/outputtags.pm, revision 1.5

1.1       albertel    1: package Apache::outputtags; 
                      2: 
                      3: use strict;
                      4: use Apache::lonnet;
                      5: use POSIX qw(strftime);
                      6: 
                      7: sub BEGIN {
1.2       albertel    8:   &Apache::lonxml::register('Apache::outputtags',('displayduedate','displaytitle'));
1.1       albertel    9: }
                     10: 
1.2       albertel   11: sub start_displayduedate {
1.1       albertel   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");
1.3       www        16:   if (($status =~ /CAN.*_ANSWER/) && ($target eq 'web')) {
1.1       albertel   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");
1.5     ! www        27:     if ($date) {
        !            28:        $result ='<table border="on"><tr><td>Due at '.
        !            29:          POSIX::strftime($format,localtime($date)).
        !            30: 	   '</td></tr></table>';
        !            31:     } else {
        !            32:       $result ='<table border="on"><tr><td>No due date set.</td></tr></table>';
        !            33:     }
1.1       albertel   34:   }
                     35:   return $result;
                     36: }
                     37: 
1.2       albertel   38: sub end_displayduedate {
                     39: }
                     40: 
                     41: sub start_displaytitle {
                     42:   my ($target,$token,$parstack,$parser,$safeeval)=@_;
1.4       albertel   43:   my $result='';
1.3       www        44:   if ($target eq 'web') {
1.4       albertel   45:     $result="<h1>$Apache::lonhomework::name</h1>";
                     46:   }
                     47:   return $result;
1.2       albertel   48: }
                     49: 
                     50: sub end_displaytitle {
1.1       albertel   51: }
                     52: 
                     53: 1;
                     54: __END__

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