[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm

raeburn raeburn at source.lon-capa.org
Sat May 9 21:05:50 EDT 2015


raeburn		Sun May 10 01:05:50 2015 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  - Documentation for &date_setter()
  - Two new args passed to &date_setter() -- $no_mm_ss and $no_ss to support
    date selectors that omit either minutes and seconds or just seconds from
    fields which can be set.  
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.362 loncom/interface/lonhtmlcommon.pm:1.363
--- loncom/interface/lonhtmlcommon.pm:1.362	Tue May  5 21:45:55 2015
+++ loncom/interface/lonhtmlcommon.pm	Sun May 10 01:05:50 2015
@@ -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 @@
 =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 @@
 ##############################################
 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 @@
         $result .= &mt('[_1] [_2] [_3] ',
                        $monthselector,$dayselector,$yearselector).
                    $tzone;
-        if (!$nolink) {
-            $result .= &mt('[_1]Select Date[_2]',$cal_link,'</a>');
-        }
+    } 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,'</a>');
-        }
+    }
+    if (!$nolink) {
+        $result .= &mt('[_1]Select Date[_2]',$cal_link,'</a>');
     }
     $result .= "</span>\n<!-- end $dname date setting form -->\n";
     return $result;




More information about the LON-CAPA-cvs mailing list