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

www lon-capa-cvs@mail.lon-capa.org
Mon, 17 Apr 2006 21:28:51 -0000


www		Mon Apr 17 17:28:51 2006 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Working on log and notification/rss
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.290 loncom/interface/lonparmset.pm:1.291
--- loncom/interface/lonparmset.pm:1.290	Sat Apr 15 17:12:56 2006
+++ loncom/interface/lonparmset.pm	Mon Apr 17 17:28:50 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.290 2006/04/15 21:12:56 www Exp $
+# $Id: lonparmset.pm,v 1.291 2006/04/17 21:28:50 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3324,25 +3324,26 @@
 }
 
 sub components {
-    my ($key,$uname,$udom)=@_;
+    my ($key,$uname,$udom,$exeuser,$exedomain)=@_;
     my $typeflag=0;
     if ($key=~/\.type$/) {
 	$key=~s/\.type$//;
         $typeflag=1;
     }
+    my $issection;
     my ($middle,$part,$name)=($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
     my $section=&mt('All Students');
     if ($middle=~/^\[(.*)\]/) {
-	my $issection=$1;
-	if ($uname) {
-	    $section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom);
-	} else {
-	    $section=&mt('Group/Section').': '.$issection;
-	}
+	$issection=$1;
+	$section=&mt('Group/Section').': '.$issection;
 	$middle=~s/^\[(.*)\]//;
     }
     $middle=~s/\.+$//;
     $middle=~s/^\.+//;
+    if ($uname) {
+	$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom);
+	$issection='';
+    }
     my $realm='<font color="red">'.&mt('All Resources').'</font>';
     if ($middle=~/^(.+)\_\_\_\(all\)$/) {
 	$realm='<font color="green">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><font color="#aaaaaa" size="-2">('.$1.')</font></font>';
@@ -3350,7 +3351,9 @@
 	my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle);
 	$realm='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>';
     }
-    return ($realm,$section,$name,$part,$typeflag);
+    my $what=$part.'.'.$name;
+    return ($realm,$section,$name,$part,$typeflag,
+	    $what,$middle,$uname,$udom,$issection);
 }
 
 sub parm_change_log {
@@ -3364,9 +3367,11 @@
 	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">');
-    foreach my $id (sort { $exetime{$a}<=>$exetime{$b} } (keys(%exetime))) {
+    foreach my $id (sort { $exetime{$b}<=>$exetime{$a} } (keys(%exetime))) {
         my @changes=split(/\,/,$parmlog{$id.'_logentry'});
 	my $count=$#changes+1;
 	my $time =
@@ -3396,24 +3401,40 @@
 	my %istype=();
 	foreach my $changed (sort @changes) {
             my ($key,$value)=split(/\=\>/,&Apache::lonnet::unescape($changed));
-            my ($realm,$section,$parmname,$part,$typeflag)=
+            my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection)=
 		&components($key,$parmlog{$id.'_uname'},$parmlog{$id.'_udom'});
 	    if ($typeflag) { $istype{$parmname}=$value; }
 	    if ($makenewrow) { $r->print('<tr>'); } else { $makenewrow=1; }
 	    $r->print('<td>'.$realm.'</td><td>'.$section.'</td><td>'.
 		      &mt('Part: [_1]',$part).'</td><td>');
+	    my $stillactive=0;
 	    if ($parmlog{$id.'_deleteflag'}) {
 		$r->print(&mt('Deleted'));
 	    } else {
 		if ($typeflag) {
 		    $r->print(&mt('Type: [_1]',$value));
-		} elsif (&isdateparm($istype{$parmname})) {
-		    $r->print(&Apache::lonlocal::locallocaltime($value));
 		} else {
-		    $r->print($value);
+		    my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what),
+						      $uname,$udom,$issection,$issection,$courseopt);
+		    if (&isdateparm($istype{$parmname})) {
+			$r->print(&Apache::lonlocal::locallocaltime($value));
+		    } else {
+			$r->print($value);
+		    }
+		    if ($value ne $all[$level]) {
+			$r->print('<br /><font color="red">'.&mt('Not active anymore').'</font>');
+		    } else {
+			$stillactive=1;
+		    }
 		}
 	    }
-	    $r->print('</td></tr>');
+	    $r->print('</td>');
+	    if ($stillactive) {
+		$r->print('<td>Notify Link</td>');
+	    } else {
+		$r->print('<td>&nbsp;</td>');
+	    }
+	    $r->print('</tr>');
 	}
     }
     $r->print('</table>');