Printing for current resource is only possible between [_1] and [_1]
', - $res_printstartdate, $res_printenddate); - Apache::lonhelper::message->new(); + my $now = time; + my $shownprintstart = &Apache::lonlocal::locallocaltime($res_printstartdate); + my $shownprintend = &Apache::lonlocal::locallocaltime($res_printenddate); + my $noprintmsg; + if (($res_printenddate) && ($res_printenddate < $now)) { + $noprintmsg = &mt('Printing for current resource no longer available (ended: [_1])', + $shownprintend); + } else { + if (($res_printstartdate) && ($res_printstartdate > $now)) { + if (($res_printenddate) && ($res_printenddate > $now) && ($res_printenddate > $res_printstartdate)) { + $noprintmsg = &mt('Printing for current resource is only possible between [_1] and [_2]', + $shownprintstart,$shownprintend); + } elsif (!$res_printenddate) { + $noprintmsg = &mt('Printing for current resource will only be possible starting [_1]', + $shownprintstart); + } else { + $noprintmsg = &mt('Printing for current resource is unavailable'); + } + } + } + + if ($noprintmsg) { + $paramHash = Apache::lonhelper::getParamHash(); + $paramHash->{MESSAGE_TEXT} = + ''.$noprintmsg.'
'; + Apache::lonhelper::message->new(); + } } $paramHash = Apache::lonhelper::getParamHash(); $paramHash = Apache::lonhelper::getParamHash(); @@ -4853,7 +4908,7 @@ FONT_SELECTION return "$helper->{VARS}->{'probstatus'}";