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

www lon-capa-cvs@mail.lon-capa.org
Tue, 18 Apr 2006 20:36:01 -0000


www		Tue Apr 18 16:36:01 2006 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  New and improved datastructure - delete your old logs (again)
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.293 loncom/interface/lonparmset.pm:1.294
--- loncom/interface/lonparmset.pm:1.293	Tue Apr 18 14:10:55 2006
+++ loncom/interface/lonparmset.pm	Tue Apr 18 16:35:47 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.293 2006/04/18 18:10:55 www Exp $
+# $Id: lonparmset.pm,v 1.294 2006/04/18 20:35:47 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3359,55 +3359,49 @@
     my %parmlog=&Apache::lonnet::dump('nohist_parameterlog',
 				      $env{'course.'.$env{'request.course.id'}.'.domain'},
 				      $env{'course.'.$env{'request.course.id'}.'.num'});
-    my %exetime=();
-    foreach my $key (keys(%parmlog)) {
-	if ($key=~/^(.+)\_exe\_time$/) {
-	    $exetime{$1}=$parmlog{$key};
-	}
-    }    
     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))) {
+    foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) {
 	if ($bgcolor eq '#EEEEEE') { $bgcolor='#FFFFCC'; } else { $bgcolor='#EEEEEE'; }
-        my @changes=keys(%{$parmlog{$id.'_logentry'}});
+        my @changes=keys(%{$parmlog{$id}{'logentry'}});
 	my $count=$#changes+1;
 	my $time =
-	    &Apache::lonlocal::locallocaltime($parmlog{$id.'_exe_time'});
+	    &Apache::lonlocal::locallocaltime($parmlog{$id}{'exe_time'});
 	my $plainname = 
-	    &Apache::loncommon::plainname($parmlog{$id.'_exe_uname'},
-					  $parmlog{$id.'_exe_udom'});
+	    &Apache::loncommon::plainname($parmlog{$id}{'exe_uname'},
+					  $parmlog{$id}{'exe_udom'});
 	my $about_me_link = 
 	    &Apache::loncommon::aboutmewrapper($plainname,
-					       $parmlog{$id.'_exe_uname'},
-					       $parmlog{$id.'_exe_udom'});
+					       $parmlog{$id}{'exe_uname'},
+					       $parmlog{$id}{'exe_udom'});
 	my $send_msg_link='';
-	if ((($parmlog{$id.'_exe_uname'} ne $env{'user.name'}) 
-	     || ($parmlog{$id.'_exe_udom'} ne $env{'user.domain'}))) {
+	if ((($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) 
+	     || ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) {
 	    $send_msg_link ='<br />'.
 		&Apache::loncommon::messagewrapper(&mt('Send message'),
-						   $parmlog{$id.'_exe_uname'},
-						   $parmlog{$id.'_exe_udom'});
+						   $parmlog{$id}{'exe_uname'},
+						   $parmlog{$id}{'exe_udom'});
 	}
 	$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>'.
+		  '<br /><tt>'.$parmlog{$id}{'exe_uname'}.
+			          ':'.$parmlog{$id}{'exe_udom'}.'</tt>'.
 		  $send_msg_link.'</td>');
 	my $makenewrow=0;
 	my %istype=();
 	foreach my $changed (reverse(sort(@changes))) {
-            my $value=$parmlog{$id.'_logentry'}->{$changed};
+            my $value=$parmlog{$id}{'logentry'}->{$changed};
             my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection)=
-		&components($changed,$parmlog{$id.'_uname'},$parmlog{$id.'_udom'});
+		&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'});
 	    if ($typeflag) { $istype{$parmname}=$value; }
 	    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>');
 	    my $stillactive=0;
-	    if ($parmlog{$id.'_deleteflag'}) {
+	    if ($parmlog{$id}{'deleteflag'}) {
 		$r->print(&mt('Deleted'));
 	    } else {
 		if ($typeflag) {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.729 loncom/lonnet/perl/lonnet.pm:1.730
--- loncom/lonnet/perl/lonnet.pm:1.729	Tue Apr 18 14:11:16 2006
+++ loncom/lonnet/perl/lonnet.pm	Tue Apr 18 16:36:00 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.729 2006/04/18 18:11:16 www Exp $
+# $Id: lonnet.pm,v 1.730 2006/04/18 20:36:00 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -92,16 +92,17 @@
 	$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,
-				    },
+				    { $id => {
+					'exe_uname' => $env{'user.name'},
+					'exe_udom'  => $env{'user.domain'},
+					'exe_time'  => time(),
+					'exe_ip'    => $ENV{'REMOTE_ADDR'},
+					'delflag'   => $delflag,
+					'logentry'  => $storehash,
+					'uname'     => $uname,
+					'udom'      => $udom,
+				    }
+				  },
 				    $env{'course.'.$env{'request.course.id'}.'.domain'},
 				    $env{'course.'.$env{'request.course.id'}.'.num'}
 				    );