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

www lon-capa-cvs@mail.lon-capa.org
Fri, 14 Apr 2006 11:55:59 -0000


www		Fri Apr 14 07:55:59 2006 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Saving my work on parameter log
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.285 loncom/interface/lonparmset.pm:1.286
--- loncom/interface/lonparmset.pm:1.285	Thu Apr 13 17:32:23 2006
+++ loncom/interface/lonparmset.pm	Fri Apr 14 07:55:58 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.285 2006/04/13 21:32:23 albertel Exp $
+# $Id: lonparmset.pm,v 1.286 2006/04/14 11:55:58 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -400,7 +400,7 @@
 	my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_;
 	$logid++;
 	my $id=time().'00000'.$$.'00000'.$logid;
-	&Apache::lonnet::put('parameterlog',
+	&Apache::lonnet::put('nohist_parameterlog',
 			     {
 				 $id.'_exe_uname' => $env{'user.name'},
 				 $id.'_exe_udom'  => $env{'user.domain'},
@@ -3319,6 +3319,115 @@
 sub parm_change_log {
     my ($r)=@_;
     &startpage($r);
+
+    my @ids=();
+    my %symbp=();
+    my %mapp=();
+    my %typep=();
+    my %keyp=();
+    my %uris=();
+    my %maptitles=();
+
+# -------------------------------------------------------- Variable declaration
+
+    my %allmaps=();
+    my %alllevs=();
+
+    my $uname;
+    my $udom;
+    my $uhome;
+    my $csec;
+    my $cgroup;
+    my $grouplist;
+    my @usersgroups = ();
+ 
+    my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'};
+
+    $alllevs{'Resource Level'}='full';
+    $alllevs{'Map/Folder Level'}='map';
+    $alllevs{'Course Level'}='general';
+
+    my %allparms;
+    my %allparts;
+    my %keyorder;
+# --------------------------------------------------------- Get all assessments
+    &extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, 
+				\%mapp, \%symbp,\%maptitles,\%uris,
+				\%keyorder);
+
+    $mapp{'0.0'} = '';
+    $symbp{'0.0'} = '';
+
+    my %level=&Apache::lonlocal::texthash('parmlevel_14' => 'General Course',
+					  'parmlevel_13' => 'Map or Folder level in course',
+					  'parmlevel_12' => 'Resource default',
+					  'parmlevel_11' => 'Map default',
+					  'parmlevel_10' => 'Resource level in course',
+					  'parmlevel_9' => 'General for section',
+					  'parmlevel_8' => 'Map or Folder level for section',
+					  'parmlevel_7' => 'Resource level in section',
+					  'parmlevel_6' => 'General for group',
+					  'parmlevel_5' => 'Map or Folder level for group',
+					  'parmlevel_4' => 'Resource level in group',
+					  'parmlevel_3' => 'General for specific student',
+					  'parmlevel_2' => 'Map or Folder level for specific student',
+					  'parmlevel_1' => 'Resource level for specific student');
+
+#    $id.'_exe_uname' => $env{'user.name'},
+#    $id.'_exe_udom'  => $env{'user.domain'},
+#    $id.'_exe_time'  => time(),
+#    $id.'_exe_ip'    => $ENV{'REMOTE_ADDR'},
+#    $id.'_symb'      => $symb,
+#    $id.'_spnam'     => $spnam,
+#    $id.'_snum'      => $snum,
+#    $id.'_nval'      => $nval,
+#    $id.'_ntype'     => $ntype,
+#    $id.'_uname'     => $uname,
+#    $id.'_udom'      => $udom,
+#    $id.'_csec'      => $csec,
+#    $id.'_cgroup'    => $cgroup
+    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};
+	}
+    }
+    $r->print('<table border="2">');
+    foreach my $id (sort { $exetime{$a}<=>$exetime{$b} } keys %exetime) {
+        my ($part,$name)=($parmlog{$id.'_spnam'}=~/^(.*)[\_\.]([^\_\.]+)$/);
+        my $spnam=$part.'_'.$name;
+	$r->print('<tr><td>'.
+		  &Apache::lonlocal::locallocaltime($parmlog{$id.'_exe_time'}).
+		  '</td><td>'.
+		  &Apache::loncommon::aboutmewrapper(
+						     &Apache::loncommon::plainname($parmlog{$id.'_exe_uname'},
+										   $parmlog{$id.'_exe_udom'}),
+						     $parmlog{$id.'_exe_uname'},
+						     $parmlog{$id.'_exe_udom'}).'<br /><tt>'.
+		  $parmlog{$id.'_exe_uname'}.'@'.$parmlog{$id.'_exe_udom'}.'</tt>'.
+		  ((($parmlog{$id.'_exe_uname'} ne $env{'user.name'}) ||
+		    ($parmlog{$id.'_exe_udom'} ne $env{'user.domain'}))?
+		   '<br />'.&Apache::loncommon::messagewrapper(&mt('Send message'),
+							       $parmlog{$id.'_exe_uname'},
+							       $parmlog{$id.'_exe_udom'}):'').
+		  '</td><td>'.
+                  $level{'parmlevel_'.$parmlog{$id.'_snum'}}.
+                  '</td><td>'.
+                  &mt($allparms{$name}).'<br /><tt>'.$name.'</tt>'.
+                  '</td><td>'.
+                  ($part?&mt('Part: [_1]',$part):&mt('All parts')).
+		  '</td><td>'.
+                  $parmlog{$id.'_symb'}.
+		  '</td><td>'.
+		  ($parmlog{$id.'_nval'}?
+		   (&isdateparm($spnam)?&Apache::lonlocal::locallocaltime($parmlog{$id.'_nval'}):$parmlog{$id.'_nval'})
+		   :&mt('Deleted Parameter')).
+		  '</td></tr>');
+    }
+    $r->print('</table>');
     $r->print(&Apache::loncommon::end_page());
 }