[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm
minaeibi
lon-capa-cvs@mail.lon-capa.org
Fri, 31 May 2002 13:47:01 -0000
This is a MIME encoded message
--minaeibi1022852821
Content-Type: text/plain
minaeibi Fri May 31 09:47:01 2002 EDT
Modified files:
/loncom/interface lonstatistics.pm
Log:
Added removing olor table for printing stuff, So it would be optional for programmer via setcolor fuction.
----------------------------------------------------------------------
--minaeibi1022852821
Content-Type: text/plain
Content-Disposition: attachment; filename="minaeibi-20020531094701.txt"
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.24 loncom/interface/lonstatistics.pm:1.25
--- loncom/interface/lonstatistics.pm:1.24 Thu May 30 09:36:18 2002
+++ loncom/interface/lonstatistics.pm Fri May 31 09:47:01 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: lonstatistics.pm,v 1.24 2002/05/30 13:36:18 stredwic Exp $
+# $Id: lonstatistics.pm,v 1.25 2002/05/31 13:47:01 minaeibi Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -78,6 +78,7 @@
my $DiscFlag;
my $HWN;
my $P_Order;
+my %color;
my %foil_to_concept;
my @Concepts;
my %ConceptData;
@@ -87,12 +88,6 @@
my %Answer = ();
-sub unescape {
- my $str=shift;
- $str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
- return $str;
-}
-
sub Activity {
my $file="/home/minaeibi/minaei";
my $userid='billskat';
@@ -101,32 +96,46 @@
open(FILEID, "<$file");
my $line;
my @allaccess;
+ my $Count=0;
while ($line=<FILEID>) {
my ($time,$machine,$what)=split(':',$line);
- #$r->print("time=$time machine=$machine:-> $what\n");
- #$r->rflush();
- $what=&unescape($what);
+ $what=&Apache::lonnet::unescape($what);
my @accesses=split('&',$what);
foreach my $access (@accesses) {
my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access);
if ($who ne $userid) { next; }
- #if (!$resource) { next; }
- push (@allaccess,unescape($access));
+ if (!$resource) { next; }
+ my $res=&Apache::lonnet::unescape($resource);
+ #if (($key=~/\.(\w+)\.(\w+)\.submission$/)) {
+ #if ($meta=~/\.(problem|exam|quiz|assess|survey|form)$/) {
+ # foreach my $Key(split(/\,/,&Apache::lonnet::metadata($meta,'keys'))) {
+ # if ($Key=~/^stores\_(\w+)\_tries$/) {
+
+ # if (($res =~ /^\/res\/adm/)) {
+ $Count++;
+ $r->print("<br>$Count) $date: $who --> $res");
+ if ($post) {
+ $Count++;
+ $r->print("<br><b>$Count) Sent data ".join(':',
+ &Apache::lonnet::unescape(@posts)).'</b>');
+ }
+ $r->rflush();
+ # }
+ ## push (@allaccess,unescape($access));
#print $machine;
}
}
- @allaccess=sort(@allaccess);
- my $Count=0;
- foreach my $access (@allaccess) {
- my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access);
- $Count++;
-# $r->print("$Count ".localtime($date)." $who $resource\n");
- $r->print("<br>$Count) $date: $who --> $resource");
- $r->rflush();
- if ($post) {
- $r->print("<br><b>Sent data ".join(':',unescape(@posts)).'</b>');
- }
- }
+# @allaccess=sort(@allaccess);
+# $Count=0;
+# foreach my $access (@allaccess) {
+# my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access);
+# $Count++;
+# $r->print("<br>$Count) $date: $who --> $resource");
+# $r->rflush();
+# if ($post) {
+# $r->print("<br><b>Sent data ".join(':',unescape(@posts)).'</b>');
+# }
+# }
}
@@ -265,9 +274,9 @@
for (my $n=0; $n<=$#Concepts; $n++ ) {
$Str .= "\n"."<tr>".
"\n"."<td>".($n+1)."</td>".
- "\n"."<td bgcolor=#FFFFDD> ".$Concepts[$n]." </td>".
- "\n"."<td bgcolor=#DDFFDD> ".$data1[$n]." </td>".
- "\n"."<td bgcolor=#FFDDDD> ".$data2[$n]." </td>".
+ "\n".'<td bgcolor='.$color{"yellow"}.'> '.$Concepts[$n]." </td>".
+ "\n".'<td bgcolor='.$color{"green"}.'> '.$data1[$n]." </td>".
+ "\n".'<td bgcolor='.$color{"red"}.'> '.$data2[$n]." </td>".
"\n"."</tr>";
}
$Str.='<td></td><td><b>From:['.localtime($ConceptData{'Int.'.$k}).
@@ -309,7 +318,6 @@
$Max = int($Max);
} else { $Max = 1; }
-
my $Titr=($ConceptData{'Interval'}>1) ? $Src.'_interval_'.($k+1) : $Src;
# $GData=$Titr.'&Concepts'.'&'.'Answers'.'&'.$Max.'&'.$P_No.'&'.$data1.'&'.$data2;
$GData="$Titr&Concepts&Answers&$Max&$P_No&".
@@ -351,8 +359,8 @@
'" target="_blank">'.$hash{'title_'.$rid}.'</a>';
$Str .= "\n"."<tr>".
"\n"."<td> $P_No </td>".
- "\n"."<td bgcolor=#DDFFDD> ".$Temp." </td>".
- "\n"."<td bgcolor=#EEFFCC> ".$hash{'src_'.$rid}." </td>".
+ "\n"."<td bgcolor=".$color{"green"}."> ".$Temp." </td>".
+ "\n"."<td bgcolor=".$color{"yellow"}."> ".$hash{'src_'.$rid}." </td>".
"\n"."<td> ".'<input type="submit" name="sort" value="'.'Analyze_'.$rid.'" />'.'</td>'.
"\n"."</tr>";
$P_No++;
@@ -1291,18 +1299,18 @@
"\n".'<td>'.($RealIdx+1).'</td>'.
# "\n".'<td>'.$PrOrd.$Temp.'</td>'.
"\n".'<td>'.$Temp.'</td>'.
- "\n".'<td bgcolor="#EEFFCC"> '.$StdNo.'</td>'.
- "\n".'<td bgcolor="#EEFFCC">'.$TotalTries.'</td>'.
- "\n".'<td bgcolor="#EEFFCC">'.$MxTries.'</td>'.
- "\n".'<td bgcolor="#DDFFFF">'.$Avg.'</td>'.
- "\n".'<td bgcolor="#DDFFFF"> '.$YES.'</td>'.
- "\n".'<td bgcolor="#DDFFFF"> '.$Override.'</td>'.
- "\n".'<td bgcolor="#FFDDDD"> '.$Wrng.'</td>'.
- "\n".'<td bgcolor="#FFDDDD">'.$DoD.'</td>'.
- "\n".'<td bgcolor="#DDFFDD"> '.$SD.'</td>'.
- "\n".'<td bgcolor="#DDFFDD"> '.$Sk.'</td>'.
- "\n".'<td bgcolor="#FFDDFF"> '.$_D1.'</td>'.
- "\n".'<td bgcolor="#FFDDFF"> '.$_D2.'</td>';
+ "\n".'<td bgcolor='.$color{"yellow"}.'> '.$StdNo.'</td>'.
+ "\n".'<td bgcolor='.$color{"yellow"}.'>'.$TotalTries.'</td>'.
+ "\n".'<td bgcolor='.$color{"yellow"}.'>'.$MxTries.'</td>'.
+ "\n".'<td bgcolor='.$color{"gb"}.'>'.$Avg.'</td>'.
+ "\n".'<td bgcolor='.$color{"gb"}.'> '.$YES.'</td>'.
+ "\n".'<td bgcolor='.$color{"gb"}.'> '.$Override.'</td>'.
+ "\n".'<td bgcolor='.$color{"red"}.'> '.$Wrng.'</td>'.
+ "\n".'<td bgcolor='.$color{"red"}.'> '.$DoD.'</td>'.
+ "\n".'<td bgcolor='.$color{"green"}.'> '.$SD.'</td>'.
+ "\n".'<td bgcolor='.$color{"green"}.'> '.$Sk.'</td>'.
+ "\n".'<td bgcolor='.$color{"purple"}.'> '.$_D1.'</td>'.
+ "\n".'<td bgcolor='.$color{"purple"}.'> '.$_D2.'</td>';
$r->print("\n".$Ptr.'</tr>' );
}
$GraphDat{$RealIdx}=$DoD.':'.$Wrng;
@@ -1356,28 +1364,50 @@
sub initial {
# --------------------------------- Initialize the global varaibles
- undef @students;
- undef @cols;
- undef %maps;
- undef %section;
- undef %StuBox;
- undef @list;
- undef %CachData;
- undef %GraphDat;
- undef %DiscFac;
- undef %OpResp;
- undef %ConceptData;
- undef $CurMap;
- undef $CurSec;
- undef $CurStu;
- undef $p_count;
- undef $Pos;
- undef $GData;
- $DiscFlag=0;
- $P_Order=100000;
- $HWN=$P_Order;
+ undef @students;
+ undef @cols;
+ undef %maps;
+ undef %section;
+ undef %StuBox;
+ undef @list;
+ undef %CachData;
+ undef %GraphDat;
+ undef %DiscFac;
+ undef %OpResp;
+ undef %ConceptData;
+ undef $CurMap;
+ undef $CurSec;
+ undef $CurStu;
+ undef $p_count;
+ undef $Pos;
+ undef $GData;
+ $DiscFlag=0;
+ $P_Order=100000;
+ $HWN=$P_Order;
+ &setbgcolor(0);
+}
+
+# For loading the colored table for display or un-colored for print
+sub setbgcolor {
+ my $PrintTable=shift;
+ undef %color;
+ if ($PrintTable){
+ $color{"gb"}="#FFFFFF";
+ $color{"red"}="#FFFFFF";
+ $color{"yellow"}="#FFFFFF";
+ $color{"green"}="#FFFFFF";
+ $color{"purple"}="#FFFFFF";
+ } else {
+ $color{"gb"}="#DDFFFF";
+ $color{"red"}="#FFDDDD";
+ $color{"yellow"}="#EEFFCC";
+ $color{"green"}="#DDFFDD";
+ $color{"purple"}="#FFDDFF";
+ }
}
+
+
# my $CacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".
# "_$ENV{'user.domain'}_$cid\_classlist.db";
# if (-e "$CacheDB") {
@@ -1398,7 +1428,6 @@
# }
# untie(%students);
-
sub ClassList {
&GetStatus();
@@ -1508,7 +1537,6 @@
$Ptr .= '<input type=submit name=sort value="Student Assessment"/>';
$Ptr .= '</h3>';
#$Ptr .= '<input type=submit name=sort value="Activity Log"/>';
- #$Ptr .= '</h3>';
$r->print( $Ptr );
}
else {
--minaeibi1022852821--