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

1.9     ! harris41    1: # The LON-CAPA output tags handler
        !             2: #
        !             3: # Handles output tags.
        !             4: #
        !             5: # YEAR=2001
        !             6: # 1/11,1/15,4/26,6/1,6/2 Guy Albertelli
        !             7: # 8/6 Scott Harrison
        !             8: 
1.1       albertel    9: package Apache::outputtags; 
                     10: 
                     11: use strict;
                     12: use Apache::lonnet;
                     13: use POSIX qw(strftime);
                     14: 
1.9     ! harris41   15: # ======================================================================= BEGIN
1.1       albertel   16: sub BEGIN {
1.9     ! harris41   17:     &Apache::lonxml::register('Apache::outputtags',('displayduedate',
        !            18: 						    'displaytitle'));
1.1       albertel   19: }
                     20: 
1.9     ! harris41   21: # =============================== Start display due date (return scalar string)
1.2       albertel   22: sub start_displayduedate {
1.9     ! harris41   23:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
        !            24:     my $result;
        !            25:     my $status=$Apache::inputtags::status['-1'];
        !            26:     &Apache::lonxml::debug("got a $status in duedatebox");
        !            27:     if (($status =~ /CAN.*_ANSWER/) && ($target eq 'web')) {
        !            28: 	my $format = &Apache::lonxml::get_param('format',$parstack,$safeeval);
        !            29: 	if ($format eq '') {
        !            30: 	    &Apache::lonxml::debug("using default format");
        !            31: 	    $format="%c";
        !            32: 	}
        !            33: 	my $id = $Apache::inputtags::part;
        !            34: 	my $date = &Apache::lonnet::EXT("resource.$id.duedate");
        !            35: 	&Apache::lonxml::debug("duedatebox found $date for $id");
        !            36: 	if ($date) {
        !            37: 	    $result = '<table border="on"><tr><td>Due at '.
        !            38: 	              POSIX::strftime($format,localtime($date)).
        !            39: 		      '</td></tr></table>';
        !            40: 	} else {
        !            41: 	    $result = '<table border="on"><tr><td>No due date set.</td></tr>'.
        !            42: 		      '</table>';
        !            43: 	}
1.5       www        44:     }
1.9     ! harris41   45:     return $result;
1.1       albertel   46: }
                     47: 
1.9     ! harris41   48: # ======================================================== End display due date
1.2       albertel   49: sub end_displayduedate {
1.9     ! harris41   50:     return '';
1.2       albertel   51: }
                     52: 
1.9     ! harris41   53: # ================================== Start display title (return scalar string)
1.2       albertel   54: sub start_displaytitle {
1.9     ! harris41   55:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
        !            56:     my $result = '';
        !            57:     if ($target eq 'web') {
        !            58: 	$result = "<h1>$Apache::lonhomework::name</h1>";
        !            59:     }
        !            60:     return $result;
1.2       albertel   61: }
                     62: 
1.9     ! harris41   63: # =========================================================== End display title
1.2       albertel   64: sub end_displaytitle {
1.6       albertel   65:   return '';
1.1       albertel   66: }
                     67: 
                     68: 1;
1.9     ! harris41   69: 
1.1       albertel   70: __END__

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