Annotation of loncom/homework/outputtags.pm, revision 1.8
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.8 ! albertel 12: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.1 albertel 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.7 albertel 17: my $format = &Apache::lonxml::get_param('format',$parstack,$safeeval);
1.1 albertel 18: if ($format eq '') {
19: &Apache::lonxml::debug("using default format");
20: $format="%c";
21: }
22: my $id = $Apache::inputtags::part;
23: my $date = &Apache::lonnet::EXT("resource.$id.duedate");
24: &Apache::lonxml::debug("duedatebox found $date for $id");
1.5 www 25: if ($date) {
26: $result ='<table border="on"><tr><td>Due at '.
27: POSIX::strftime($format,localtime($date)).
28: '</td></tr></table>';
29: } else {
30: $result ='<table border="on"><tr><td>No due date set.</td></tr></table>';
31: }
1.1 albertel 32: }
33: return $result;
34: }
35:
1.2 albertel 36: sub end_displayduedate {
1.6 albertel 37: return '';
1.2 albertel 38: }
39:
40: sub start_displaytitle {
1.8 ! albertel 41: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.4 albertel 42: my $result='';
1.3 www 43: if ($target eq 'web') {
1.4 albertel 44: $result="<h1>$Apache::lonhomework::name</h1>";
45: }
46: return $result;
1.2 albertel 47: }
48:
49: sub end_displaytitle {
1.6 albertel 50: return '';
1.1 albertel 51: }
52:
53: 1;
54: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>