[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lon-capa-cvs
Subject:    [LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm  /localize/localize de.pm
From:       bisitz <lon-capa-cvs-allow () mail ! lon-capa ! org>
Date:       2008-10-23 14:26:23
Message-ID: cvsbisitz1224771983 () cvsserver
[Download RAW message or body]

bisitz		Thu Oct 23 14:26:23 2008 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
    /loncom/localize/localize	de.pm 
  Log:
  Optimizations for the display of date/time parameters:
  - Added warning style to warning of dates out of enrollment time slot
  - Improved timer unit shortcuts display depending on singular/plural
  - Improved timer values display: added comma separation for a better readability
  - Bugfix/Special case: Allow again a change of the timer values, if all values has \
                been set to 0. Used to show empty field which has prevented a change \
                (missing link).
  - Added nobreak style to date shift link text
  
  - Prepared little info texts to warn of dates which are in the past/in the future:
      Experiences revealed that users accidently define (due) dates for the past \
which are meant to be in the future and the other way round. See additional comments \
in the code.  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.412 loncom/interface/lonparmset.pm:1.413
--- loncom/interface/lonparmset.pm:1.412	Fri Oct 10 15:29:17 2008
+++ loncom/interface/lonparmset.pm	Thu Oct 23 14:26:17 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.412 2008/10/10 15:29:17 bisitz Exp $
+# $Id: lonparmset.pm,v 1.413 2008/10/23 14:26:17 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -325,14 +325,31 @@
    my $crsprefix='course.'.$env{'request.course.id'}.'.';
    if ($env{$crsprefix.'default_enrollment_end_date'}) {
       if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) {
-         $result.='<br />'.&mt('After course enrollment end!');
+         $result.='<div class="LC_warning">'
+                 .&mt('After course enrollment end!')
+                 .'</div>';
       }
    }
    if ($env{$crsprefix.'default_enrollment_start_date'}) {
       if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) {
-         $result.='<br />'.&mt('Before course enrollment start!');
+         $result.='<div class="LC_warning">'
+                 .&mt('Before course enrollment start!')
+                 .'</div>';
       }
    }
+# Preparation for additional warnings about dates in the past/future.
+# An improved, more context sensitive version is recommended,
+# e.g. warn for due and answer dates which are defined before the corresponding open \
date, etc. +#   if ($checkdate<time) {
+#      $result.='<div class="LC_info">'
+#              .'('.&mt('in the past').')'
+#              .'</div>';
+#      }
+#   if ($checkdate>time) {
+#      $result.='<div class="LC_info">'
+#              .'('.&mt('in the future').')'
+#              .'</div>';
+#      }
    return $result;
 }
 ##################################################
@@ -551,27 +568,38 @@
     } else {
         if ($type eq 'date_interval') {
             my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value);
+            my @timer;
             $year=$year-70;
             $mday--;
             if ($year) {
-		$result.=$year.' yrs ';
+#               $result.=&mt('[quant,_1,yr]',$year).' ';
+                push(@timer,&mt('[quant,_1,yr]',$year));
             }
             if ($mon) {
-		$result.=$mon.' mths ';
+#               $result.=&mt('[quant,_1,mth]',$mon).' ';
+                push(@timer,&mt('[quant,_1,mth]',$mon));
             }
             if ($mday) {
-		$result.=$mday.' days ';
+#               $result.=&mt('[quant,_1,day]',$mday).' ';
+                push(@timer,&mt('[quant,_1,day]',$mday));
             }
             if ($hour) {
-		$result.=$hour.' hrs ';
+#               $result.=&mt('[quant,_1,hr]',$hour).' ';
+                push(@timer,&mt('[quant,_1,hr]',$hour));
             }
             if ($min) {
-		$result.=$min.' mins ';
+#               $result.=&mt('[quant,_1,min]',$min).' ';
+                push(@timer,&mt('[quant,_1,min]',$min));
             }
             if ($sec) {
-		$result.=$sec.' secs ';
+#               $result.=&mt('[quant,_1,sec]',$sec).' ';
+                push(@timer,&mt('[quant,_1,sec]',$sec));
             }
-            $result=~s/\s+$//;
+#           $result=~s/\s+$//;
+            if (!@timer) { # Special case: all entries 0 -> display "0 secs" intead \
of empty field to keep this field editable +                \
push(@timer,&mt('[quant,_1,sec]',0)); +            }
+            $result.=join(", ",@timer);
         } elsif (&isdateparm($type)) {
             $result = &Apache::lonlocal::locallocaltime($value).
 		&date_sanity_info($value);
@@ -2950,8 +2978,8 @@
 						      $$resourcedata{$thiskey},
 							      '',1,'','').
 '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'.
-(($$resourcedata{$thiskey}!=0)?'<a \
                href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'.
                
-&mt('Shift all dates based on this date').'</a>':'').
+(($$resourcedata{$thiskey}!=0)?'<span class="LC_nobreak"><a \
href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'. \
+&mt('Shift all dates based on this date').'</a></span>':'').  \
&date_sanity_info($$resourcedata{$thiskey})  );
 	    } elsif ($thistype eq 'date_interval') {
Index: loncom/localize/localize/de.pm
diff -u loncom/localize/localize/de.pm:1.152 loncom/localize/localize/de.pm:1.153
--- loncom/localize/localize/de.pm:1.152	Thu Oct 23 10:15:44 2008
+++ loncom/localize/localize/de.pm	Thu Oct 23 14:26:23 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # German Localization Lexicon
 #
-# $Id: de.pm,v 1.152 2008/10/23 10:15:44 bisitz Exp $
+# $Id: de.pm,v 1.153 2008/10/23 14:26:23 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -8864,6 +8864,12 @@
    'After course enrollment end!'
 => 'Liegt NACH Kursbelegungs-Ende!',
 
+   'in the past'
+=> 'liegt in der Vergangenheit',
+
+   'in the future'
+=> 'liegt in der Zukunft',
+
    'Choose'
 => 'Übernehmen',
 
@@ -16085,6 +16091,39 @@
    'As your session file for the course has expired, you will need to re-select the \
course.'  => 'Da die Sitzungsdatei für diesen Kurs zwischenzeitlich verfallen ist, \
müssen Sie den Kurs erneut auswählen.',  
+   '[quant,_1,yr]'
+=> '[quant,_1,Jahr,Jahre]',
+
+   '[quant,_1,mth]'
+=> '[quant,_1,Mon.,Mon.]',
+
+   '[quant,_1,day]'
+=> '[quant,_1,Tag,Tage]',
+
+   '[quant,_1,hr]'
+=> '[quant,_1,h,h]',
+
+   '[quant,_1,min]'
+=> '[quant,_1,min,min]',
+
+   '[quant,_1,sec]'
+=> '[quant,_1,s,s]',
+
+   ''
+=> '',
+
+   ''
+=> '',
+
+   ''
+=> '',
+
+   ''
+=> '',
+
+   ''
+=> '',
+
    ''
 => '',
 


_______________________________________________
LON-CAPA-cvs mailing list
LON-CAPA-cvs@mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic