--- loncom/interface/lonhtmlcommon.pm 2015/05/05 21:45:55 1.362 +++ loncom/interface/lonhtmlcommon.pm 2015/05/10 01:05:50 1.363 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.362 2015/05/05 21:45:55 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.363 2015/05/10 01:05:50 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -484,7 +484,36 @@ the date/time fields are left empty. =item $state Specifies the initial state of the form elements. Either 'disabled' or empty. -Defaults to empty, which indiciates the form elements are not disabled. +Defaults to empty, which indicates the form elements are not disabled. + +=item $no_hh_mm_ss + +If true, text boxes for hours, minutes and seconds are omitted. + +=item $defhour + +Default value for hours (a default of 0 is used otherwise). + +=item $defmin + +Default value for minutes (a default of 0 is used otherwise). + +=item defsec + +Default value for seconds (a default of 0 is used otherwise). + +=item $nolink + +If true, a "Select calendar" link (to pop-up a calendar) is not displayed +to the right of the items. + +=item $no_mm_ss + +If true, text boxes for minutes and seconds are omitted. + +=item $no_ss + +If true, text boxes for seconds are omitted. =back @@ -500,7 +529,7 @@ The method used to restrict user input w ############################################## sub date_setter { my ($formname,$dname,$currentvalue,$special,$includeempty,$state, - $no_hh_mm_ss,$defhour,$defmin,$defsec,$nolink) = @_; + $no_hh_mm_ss,$defhour,$defmin,$defsec,$nolink,$no_mm_ss,$no_ss) = @_; my $now = time; my $tzname; @@ -653,17 +682,26 @@ ENDJS $result .= &mt('[_1] [_2] [_3] ', $monthselector,$dayselector,$yearselector). $tzone; - if (!$nolink) { - $result .= &mt('[_1]Select Date[_2]',$cal_link,''); - } + } elsif ($no_mm_ss) { + $result .= &mt('[_1] [_2] [_3] [_4]', + $monthselector,$dayselector,$yearselector, + $hourselector). + $tzone; + + } elsif ($no_ss) { + $result .= &mt('[_1] [_2] [_3] [_4] [_5]m', + $monthselector,$dayselector,$yearselector, + $hourselector,$minuteselector). + $tzone; + } else { $result .= &mt('[_1] [_2] [_3] [_4] [_5]m [_6]s ', $monthselector,$dayselector,$yearselector, $hourselector,$minuteselector,$secondselector). $tzone; - if (!$nolink) { - $result .= &mt('[_1]Select Date[_2]',$cal_link,''); - } + } + if (!$nolink) { + $result .= &mt('[_1]Select Date[_2]',$cal_link,''); } $result .= "\n\n"; return $result;