version 1.23, 2003/06/11 14:20:29
|
version 1.26, 2003/06/20 16:13:06
|
Line 58 package Apache::lonhtmlcommon;
|
Line 58 package Apache::lonhtmlcommon;
|
use Time::Local; |
use Time::Local; |
use strict; |
use strict; |
|
|
|
|
|
############################################## |
|
############################################## |
|
|
|
=pod |
|
|
|
=item textbox |
|
|
|
=cut |
|
|
|
############################################## |
|
############################################## |
|
sub textbox { |
|
my ($name,$value,$size,$special) = @_; |
|
$size = 40 if (! defined($size)); |
|
my $Str = '<input type="text" name="'.$name.'" size="'.$size.'" '. |
|
'value="'.$value.'" '.$special.' />'; |
|
return $Str; |
|
} |
|
|
|
############################################## |
|
############################################## |
|
|
|
=pod |
|
|
|
=item checkbox |
|
|
|
=cut |
|
|
|
############################################## |
|
############################################## |
|
sub checkbox { |
|
my ($name) = @_; |
|
my $Str = '<input type="checkbox" name="'.$name.'" />'; |
|
return $Str; |
|
} |
|
|
|
|
|
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
Line 85 The current setting for this time parame
|
Line 124 The current setting for this time parame
|
An undefined value is taken to indicate the value is the current time. |
An undefined value is taken to indicate the value is the current time. |
Also, to be explicit, a value of 'now' also indicates the current time. |
Also, to be explicit, a value of 'now' also indicates the current time. |
|
|
|
=item $special |
|
|
|
Additional html/javascript to be associated with each element in |
|
the date_setter. See lonparmset for example usage. |
|
|
=back |
=back |
|
|
Bugs |
Bugs |
Line 96 The method used to restrict user input w
|
Line 140 The method used to restrict user input w
|
############################################## |
############################################## |
############################################## |
############################################## |
sub date_setter { |
sub date_setter { |
my ($formname,$dname,$currentvalue) = @_; |
my ($formname,$dname,$currentvalue,$special) = @_; |
if (! defined($currentvalue) || $currentvalue eq 'now') { |
if (! defined($currentvalue) || $currentvalue eq 'now') { |
$currentvalue = time; |
$currentvalue = time; |
} |
} |
Line 139 sub date_setter {
|
Line 183 sub date_setter {
|
} |
} |
</script> |
</script> |
ENDJS |
ENDJS |
$result .= " <select name=\"$dname\_month\" ". |
$result .= " <nobr><select name=\"$dname\_month\" ".$special.' '. |
"onChange=\"javascript:$dname\_checkday()\" >\n"; |
"onChange=\"javascript:$dname\_checkday()\" >\n"; |
my @Months = qw/January February March April May June |
my @Months = qw/January February March April May June |
July August September October November December/; |
July August September October November December/; |
Line 152 ENDJS
|
Line 196 ENDJS
|
} |
} |
$result .= " </select>\n"; |
$result .= " </select>\n"; |
$result .= " <input type=\"text\" name=\"$dname\_day\" ". |
$result .= " <input type=\"text\" name=\"$dname\_day\" ". |
"value=\"$mday\" size=\"3\" ". |
"value=\"$mday\" size=\"3\" ".$special.' '. |
"onChange=\"javascript:$dname\_checkday()\" />\n"; |
"onChange=\"javascript:$dname\_checkday()\" />\n"; |
$result .= " <input type=\"year\" name=\"$dname\_year\" ". |
$result .= " <input type=\"year\" name=\"$dname\_year\" ". |
"value=\"$year\" size=\"5\" ". |
"value=\"$year\" size=\"5\" ".$special.' '. |
"onChange=\"javascript:$dname\_checkday()\" />\n"; |
"onChange=\"javascript:$dname\_checkday()\" />\n"; |
$result .= " "; |
$result .= " "; |
$result .= " <select name=\"$dname\_hour\" >\n"; |
$result .= " <select name=\"$dname\_hour\" ".$special." >\n"; |
for (my $h = 0;$h<24;$h++) { |
for (my $h = 0;$h<24;$h++) { |
$result .= " <option value=\"$h\" "; |
$result .= " <option value=\"$h\" "; |
$result .= "selected " if ($hour == $h); |
$result .= "selected " if ($hour == $h); |
Line 175 ENDJS
|
Line 219 ENDJS
|
$result .= " </option>\n"; |
$result .= " </option>\n"; |
} |
} |
$result .= " </select>\n"; |
$result .= " </select>\n"; |
$result .= " <input type=\"text\" name=\"$dname\_minute\" ". |
$result .= " <input type=\"text\" name=\"$dname\_minute\" ".$special.' '. |
"value=\"$min\" size=\"3\" /> m\n"; |
"value=\"$min\" size=\"3\" /> m\n"; |
$result .= " <input type=\"text\" name=\"$dname\_second\" ". |
$result .= " <input type=\"text\" name=\"$dname\_second\" ".$special.' '. |
"value=\"$sec\" size=\"3\" /> s\n"; |
"value=\"$sec\" size=\"3\" /> s\n"; |
$result .= "<!-- end $dname date setting form -->\n"; |
$result .= "</nobr>\n<!-- end $dname date setting form -->\n"; |
return $result; |
return $result; |
} |
} |
|
|
Line 252 sub get_date_from_form {
|
Line 296 sub get_date_from_form {
|
$year = $tmpyear - 1900; |
$year = $tmpyear - 1900; |
} |
} |
} |
} |
|
if (($year<70) || ($year>137)) { return undef; } |
if (eval(&timelocal($sec,$min,$hour,$day,$month,$year))) { |
if (eval(&timelocal($sec,$min,$hour,$day,$month,$year))) { |
return &timelocal($sec,$min,$hour,$day,$month,$year); |
return &timelocal($sec,$min,$hour,$day,$month,$year); |
} else { |
} else { |
Line 719 sub Increment_PrgWin {
|
Line 764 sub Increment_PrgWin {
|
my $min = int($time_est/60); |
my $min = int($time_est/60); |
my $sec = $time_est % 60; |
my $sec = $time_est % 60; |
$time_est = $min.' minutes'; |
$time_est = $min.' minutes'; |
if ($sec > 1) { |
if ($min < 10) { |
$time_est.= ', '.$sec.' seconds'; |
if ($sec > 1) { |
} elsif ($sec > 0) { |
$time_est.= ', '.$sec.' seconds'; |
$time_est.= ', '.$sec.' second'; |
} elsif ($sec > 0) { |
} |
$time_est.= ', '.$sec.' second'; |
|
} |
|
} |
} else { |
} else { |
$time_est .= ' seconds'; |
$time_est .= ' seconds'; |
} |
} |