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

raeburn raeburn@source.lon-capa.org
Sat, 29 Aug 2009 03:06:09 -0000


raeburn		Sat Aug 29 03:06:09 2009 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  - Bug 5988.
   - Log entries resulting from global date shifts do not include parmname.type,
     so values were being displayed as Unix times instead of human times.
   - Use type from packages.tab in cases where no type is logged to determine if
   value is a time which should be converted for display.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.468 loncom/interface/lonparmset.pm:1.469
--- loncom/interface/lonparmset.pm:1.468	Fri Jul 31 16:09:03 2009
+++ loncom/interface/lonparmset.pm	Sat Aug 29 03:06:09 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.468 2009/07/31 16:09:03 amueller Exp $
+# $Id: lonparmset.pm,v 1.469 2009/08/29 03:06:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4218,7 +4218,7 @@
 }
 
 my %standard_parms;
-
+my %standard_parms_types;
 
 sub load_parameter_names {
     open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab");
@@ -4229,7 +4229,9 @@
 	my (undef,$name,$type)=split(/\&/,$short,3);
 	if ($type eq 'display') {
 	    $standard_parms{$name} = $plain;
-	}
+        } elsif ($type eq 'type') {
+            $standard_parms_types{$name} = $plain;
+        }
     }
     close($config);
     $standard_parms{'int_pos'}      = 'Positive Integer';
@@ -4249,7 +4251,16 @@
     }
 }
 
-
+sub standard_parameter_types {
+    my ($name)=@_;
+    if (!%standard_parms_types) {
+        &load_parameter_names();
+    }
+    if ($standard_parms_types{$name}) {
+        return $standard_parms_types{$name};
+    }
+    return;
+}
 
 sub parm_change_log {
     my ($r)=@_;
@@ -4359,11 +4370,22 @@
 		} else {
 		    my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what),
 						      $uname,$udom,$issection,$issection,$courseopt);
-		    if (&isdateparm($istype{$parmname})) {
-			$output .= &Apache::lonlocal::locallocaltime($value);
-		    } else {
-			$output .= $value;
-		    }
+                    my $showvalue = $value;
+                    if ($istype{$parmname} eq '') {
+                        my $type = &standard_parameter_types($parmname);
+                        if ($type ne '') {
+                            if (&isdateparm($type)) {
+                                $showvalue =
+                                    &Apache::lonlocal::locallocaltime($value);
+                            }
+                        }
+                    } else {
+		        if (&isdateparm($istype{$parmname})) {
+			    $showvalue = 
+                                &Apache::lonlocal::locallocaltime($value);
+		        }
+                    }
+                    $output .= $showvalue;
 		    if ($value ne $all[$level]) {
 			$output .= '<br /><span class="LC_warning">'.&mt('Not active anymore').'</span>';
 		    } else {