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

www lon-capa-cvs@mail.lon-capa.org
Tue, 18 Apr 2006 18:11:17 -0000


www		Tue Apr 18 14:11:17 2006 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  New log style. Need to delete old log files if you already have some.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.292 loncom/interface/lonparmset.pm:1.293
--- loncom/interface/lonparmset.pm:1.292	Mon Apr 17 22:13:49 2006
+++ loncom/interface/lonparmset.pm	Tue Apr 18 14:10:55 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.292 2006/04/18 02:13:49 www Exp $
+# $Id: lonparmset.pm,v 1.293 2006/04/18 18:10:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -394,30 +394,8 @@
     return '';
 }
 
-{
-    my $logid;
-    sub log_parmset {
-	my ($storehash,$delflag,$uname,$udom)=@_;
-        my $logentry=join(',',map {
-	    &Apache::lonnet::escape($_).'=>'.&Apache::lonnet::escape($$storehash{$_});
-	} keys %$storehash);
-	$logid++;
-	my $id=time().'00000'.$$.'00000'.$logid;
-	&Apache::lonnet::put('nohist_parameterlog',
-			     {
-				 $id.'_exe_uname' => $env{'user.name'},
-				 $id.'_exe_udom'  => $env{'user.domain'},
-				 $id.'_exe_time'  => time(),
-				 $id.'_exe_ip'    => $ENV{'REMOTE_ADDR'},
-				 $id.'_delflag'   => $delflag,
-                                 $id.'_logentry'  => $logentry,
-				 $id.'_uname'     => $uname,
-				 $id.'_udom'      => $udom,
-			     },
-			     $env{'course.'.$env{'request.course.id'}.'.domain'},
-			     $env{'course.'.$env{'request.course.id'}.'.num'}
-			     );
-    }
+sub log_parmset {
+    return &Apache::lonnet::instructor_log('parameterlog',@_);
 }
 
 sub storeparm_by_symb_inner {
@@ -2614,8 +2592,8 @@
 #
 # Ready to print
 #
-	    $r->print(&tablestart().'<tr><td><b>'.$name.
-		      ':</b></td><td><input type="checkbox" name="del_'.
+	    $r->print(&tablestart().'<tr><td><b>'.&standard_parameter_names($name).
+		      '</b></td><td><input type="checkbox" name="del_'.
 		      $thiskey.'" /></td><td>');
 	    $foundkeys++;
 	    if (&isdateparm($thistype)) {
@@ -3355,6 +3333,7 @@
     return ($realm,$section,$name,$part,$typeflag,
 	    $what,$middle,$uname,$udom,$issection);
 }
+
 sub standard_parameter_names {
     my ($name)=@_;
     my %standard_parms=&Apache::lonlocal::texthash('duedate' => 'Due Date',
@@ -3363,7 +3342,10 @@
 						   'maxtries' => 'Max. Number of Tries',
 						   'weight' => 'Weight',
 						   'date_start' => 'Starting Date',
-						   'date_end' => 'Ending Date');
+						   'date_end' => 'Ending Date',
+						   'int_pos' => 'Positive Integer',
+						   'int_zero_pos' => 'Positive Integer or Zero',
+						   'hinttries' => 'Number of Tries till Hints appear');
     if ($standard_parms{$name}) {
 	return $standard_parms{$name}; 
     } else { 
@@ -3386,8 +3368,10 @@
     my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'},
 						     $env{'course.'.$env{'request.course.id'}.'.domain'});
     $r->print('<table border="2">');
+    my $bgcolor='#EEEEEE';
     foreach my $id (sort { $exetime{$b}<=>$exetime{$a} } (keys(%exetime))) {
-        my @changes=split(/\,/,$parmlog{$id.'_logentry'});
+	if ($bgcolor eq '#EEEEEE') { $bgcolor='#FFFFCC'; } else { $bgcolor='#EEEEEE'; }
+        my @changes=keys(%{$parmlog{$id.'_logentry'}});
 	my $count=$#changes+1;
 	my $time =
 	    &Apache::lonlocal::locallocaltime($parmlog{$id.'_exe_time'});
@@ -3398,28 +3382,27 @@
 	    &Apache::loncommon::aboutmewrapper($plainname,
 					       $parmlog{$id.'_exe_uname'},
 					       $parmlog{$id.'_exe_udom'});
-
-	my $send_msg_link;
+	my $send_msg_link='';
 	if ((($parmlog{$id.'_exe_uname'} ne $env{'user.name'}) 
 	     || ($parmlog{$id.'_exe_udom'} ne $env{'user.domain'}))) {
-	    my $send_msg_link ='<br />'.
+	    $send_msg_link ='<br />'.
 		&Apache::loncommon::messagewrapper(&mt('Send message'),
 						   $parmlog{$id.'_exe_uname'},
 						   $parmlog{$id.'_exe_udom'});
 	}
-	$r->print('<tr><td rowspan="'.$count.'">'.$time.'</td>
+	$r->print('<tr bgcolor="'.$bgcolor.'"><td rowspan="'.$count.'">'.$time.'</td>
                        <td rowspan="'.$count.'">'.$about_me_link.
 		  '<br /><tt>'.$parmlog{$id.'_exe_uname'}.
 			          ':'.$parmlog{$id.'_exe_udom'}.'</tt>'.
 		  $send_msg_link.'</td>');
 	my $makenewrow=0;
 	my %istype=();
-	foreach my $changed (sort @changes) {
-            my ($key,$value)=split(/\=\>/,&Apache::lonnet::unescape($changed));
+	foreach my $changed (reverse(sort(@changes))) {
+            my $value=$parmlog{$id.'_logentry'}->{$changed};
             my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection)=
-		&components($key,$parmlog{$id.'_uname'},$parmlog{$id.'_udom'});
+		&components($changed,$parmlog{$id.'_uname'},$parmlog{$id.'_udom'});
 	    if ($typeflag) { $istype{$parmname}=$value; }
-	    if ($makenewrow) { $r->print('<tr>'); } else { $makenewrow=1; }
+	    if ($makenewrow) { $r->print('<tr bgcolor="'.$bgcolor.'">'); } else { $makenewrow=1; }
 	    $r->print('<td>'.$realm.'</td><td>'.$section.'</td><td>'.
 		      &standard_parameter_names($parmname).'</td><td>'.
 		      ($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>');
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.728 loncom/lonnet/perl/lonnet.pm:1.729
--- loncom/lonnet/perl/lonnet.pm:1.728	Fri Apr  7 18:42:32 2006
+++ loncom/lonnet/perl/lonnet.pm	Tue Apr 18 14:11:16 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.728 2006/04/07 22:42:32 albertel Exp $
+# $Id: lonnet.pm,v 1.729 2006/04/18 18:11:16 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -85,6 +85,28 @@
 
 
 # --------------------------------------------------------------------- Logging
+{
+    my $logid;
+    sub instructor_log {
+	my ($hash_name,$storehash,$delflag,$uname,$udom)=@_;
+	$logid++;
+	my $id=time().'00000'.$$.'00000'.$logid;
+	return &Apache::lonnet::put('nohist_'.$hash_name,
+				    {
+					$id.'_exe_uname' => $env{'user.name'},
+					$id.'_exe_udom'  => $env{'user.domain'},
+					$id.'_exe_time'  => time(),
+					$id.'_exe_ip'    => $ENV{'REMOTE_ADDR'},
+					$id.'_delflag'   => $delflag,
+					$id.'_logentry'  => $storehash,
+					$id.'_uname'     => $uname,
+					$id.'_udom'      => $udom,
+				    },
+				    $env{'course.'.$env{'request.course.id'}.'.domain'},
+				    $env{'course.'.$env{'request.course.id'}.'.num'}
+				    );
+    }
+}
 
 sub logtouch {
     my $execdir=$perlvar{'lonDaemons'};