--- loncom/interface/lonhtmlcommon.pm 2004/04/16 15:06:56 1.65
+++ loncom/interface/lonhtmlcommon.pm 2004/04/23 17:49:25 1.67
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.65 2004/04/16 15:06:56 albertel Exp $
+# $Id: lonhtmlcommon.pm,v 1.67 2004/04/23 17:49:25 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -219,10 +219,14 @@ The method used to restrict user input w
##############################################
##############################################
sub date_setter {
- my ($formname,$dname,$currentvalue,$special,$includeempty,$state) = @_;
+ my ($formname,$dname,$currentvalue,$special,$includeempty,$state,
+ $no_hh_mm_ss) = @_;
if (! defined($state) || $state ne 'disabled') {
$state = '';
}
+ if (! defined($no_hh_mm_ss)) {
+ $no_hh_mm_ss = 0;
+ }
if (! defined($currentvalue) || $currentvalue eq 'now') {
unless ($includeempty) {
$currentvalue = time;
@@ -305,6 +309,7 @@ ENDJS
$result .= " \n";
+ # Day
$result .= " \n";
+ # Year
$result .= " \n";
$result .= " ";
- $result .= " \n";
- $result .= " m\n";
- $result .= " s\n";
+ if (! $no_hh_mm_ss) {
+ # Hours
+ $result .= " \n";
+ $result .= " m\n";
+ $result .= " s\n";
+ }
$result .= "".
&mt('Select Date')."\n\n";
return $result;
@@ -393,6 +406,8 @@ sub get_date_from_form {
$sec = $tmpsec;
}
if (!defined($tmpsec) || $tmpsec eq '') { $sec = 0; }
+ } else {
+ $sec = 0;
}
if (defined($ENV{'form.'.$dname.'_minute'})) {
my $tmpmin = $ENV{'form.'.$dname.'_minute'};
@@ -400,12 +415,16 @@ sub get_date_from_form {
$min = $tmpmin;
}
if (!defined($tmpmin) || $tmpmin eq '') { $min = 0; }
+ } else {
+ $min = 0;
}
if (defined($ENV{'form.'.$dname.'_hour'})) {
my $tmphour = $ENV{'form.'.$dname.'_hour'};
if (($tmphour =~ /^\d+$/) && ($tmphour >= 0) && ($tmphour < 24)) {
$hour = $tmphour;
}
+ } else {
+ $hour = 0;
}
if (defined($ENV{'form.'.$dname.'_day'})) {
my $tmpday = $ENV{'form.'.$dname.'_day'};
@@ -952,7 +971,7 @@ returns: nothing
#
# The first one should be the course, I guess.
if (!defined($menulink)) { $menulink=1; }
- if ($menulink && exists($ENV{'request.course.id'})) {
+ if ($menulink && exists($ENV{'request.course.id'}) && $ENV{'request.course.id'} ne '') {
my $cid = $ENV{'request.course.id'};
unshift(@Crumbs,{
href=>'/adm/menu',