#!/usr/bin/perl ##!/usr/local/bin/perl5.8.0 # # $Id: creports.pl,v 1.24 2006/09/13 18:12:31 psims Exp $ # # Source File: creports.pl # Get config require 'sitecfg.pl'; require 'testlib.pl'; require 'tstatlib.pl'; require 'cybertestlib.pl'; use Time::Local; $FORM{'frm'}=""; &app_initialize; my $HBI_Debug = 0 ; my $HBI_Key ; if ($HBI_Debug) { foreach $HBI_Key (sort keys %FORM) { warn __FILE__ . " key $HBI_Key FORM $FORM{$HBI_Key} X" ; } } if ($FORM{'pdf'}) { print "Content-Type: application/pdf\n\n"; open(STDOUT, "| ".$cfgroot.$pathsep."html2pdf"); select(STDOUT); # needed for older versions of perl } else { print "Content-Type: text/html\n\n"; #print STDERR "Content-Type: text/html\n\n"; #open(STDOUT, "| filtertest.pl"); #select(STDOUT); } # ACT-C-001&Login Activity Report # ACT-C-005&Login Activity by User # ACT-C-002&Test Activity Report # ACT-C-003&Test Reports by Candidate # ACT-C-004&Test Statistics by Test # ACT-C-004F&Test Statistics by Test User Filter # ACT-C-006&Test Report by User # ACT-C-007&Timing Statistics by Test if (&get_session($FORM{'tid'})) { &LanguageSupportInit(); $REPORT{'rptid'}=""; @rptdefs = &get_data("reports.$SESSION{'clid'}"); @lbls = split(/&/, $rptdefs[0]); foreach $rptdef (@rptdefs) { chomp ($rptdef); @flds = split(/&/, $rptdef); if ($flds[0] eq $FORM{'rptno'}) { for $i (0 .. $#lbls) { $REPORT{$lbls[$i]} = $flds[$i]; $i++; } } } if (substr($FORM{'rptno'},0,5) ne 'ACT-C') { # This is a custom report my ($ret); (my $rptapp, @rptparams) = split(/ /, $REPORT{'rptapp'}); unless ($ret=do $rptapp) { warn "couldn't parse $REPORT{'rptapp'}: $@" if $@; warn "couldn't do $REPORT{'rptapp'}: $!" unless defined $ret; warn "couldn't run $REPORT{'rptapp'}" unless $ret; } # At this point the custom report takes over writing out all the html. } elsif (($FORM{'frm'} eq '1') || ($FORM{'frm'} eq '5')) { &show_index; } else { if ($FORM{'frm'} eq '2') { &show_detail; } else { if ($FORM{'frm'} eq '') { if ($FORM{'rptno'} eq 'ACT-C-004') { $REPORT{'rptid'}=$FORM{'rptno'}; &show_index; } elsif ($FORM{'rptno'} eq 'ACT-C-003') { $REPORT{'rptid'}=$FORM{'rptno'}; # &show_index; &show_frames_003; } elsif ($FORM{'rptno'} eq 'ACT-C-006') { $REPORT{'rptid'}=$FORM{'rptno'}; &show_detail; } elsif ($FORM{'rptno'} eq 'ACT-C-007') { $REPORT{'rptid'}=$FORM{'rptno'}; &show_frames_007; } elsif ($FORM{'rptno'} eq 'ACT-C-002') { $REPORT{'rptid'}=$FORM{'rptno'}; &show_frames_002; } elsif ($FORM{'rptno'} eq 'ACT-C-001') { $REPORT{'rptid'}=$FORM{'rptno'}; &show_frames_001; } else { &show_frames; } } else { print "\n"; print "\n"; print " \n"; print "\n"; } } } } close(STDOUT); sub show_frames { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } sub show_frames_001 { print "\n"; print "\n"; print "\n"; print "\n"; print "\t\n"; print "\t\n"; print "\t\n"; print "\t\n"; print "\n"; print "\n"; } sub show_frames_002 { print "\n"; print "\n"; print "\n"; print "\t\n"; print "\t\n"; print "\n"; print "\n"; } sub show_frames_003 { print "\n"; print "\n"; print "\n"; print "\t\n"; print "\t\n"; print "\t\t\n"; print "\t\t\n"; print "\t\n"; print "\n"; print "\n"; } sub show_frames_007 { print "\n"; print "\n"; print "\n"; print "\t\n"; print "\t\n"; print "\t\t\n"; print "\t\t\n"; print "\t\n"; print "\n"; print "\n"; } sub print_report_header() { my $i; $dform=1; if ($REPORT{'rptid'} eq 'ACT-C-001') { # C_001 my ($frm); $faction="$cgiroot/creports.pl"; if ($FORM{"frm"} == 5) { $ftarget="rptindex"; $frm=1; } else { $ftarget="rptdetail"; $frm=2 } $fparms="\n"; $fparms=join('',$fparms,"\n"); $fparms=join('',$fparms,"\n"); $fparms=join('',$fparms,"\n"); $fparms=join('',$fparms,"\n"); $fjscript=" function parmsC001(oform,dbf,fltr) { oform.dbfile.value=dbf; oform.filter.value=fltr; oform.submit(); } "; } elsif ($REPORT{'rptid'} eq 'ACT-C-002') { # C_002 $dform=1; my $testoptions=""; my $useroptions=""; my $groupoptions=""; my $yroptions=""; my $mooptions=""; my $dayoptions=""; my @flds; #print STDERR "ACT-C-002: cbcomplete = $FORM{'cbcomplete'}\n"; #print STDERR " cbsort = $FORM{'cbsort'}\n"; my $st = time; my @tmparray=&get_test_list($CLIENT{'clid'}); #my $end = time; #my $dl = $end - $st; #$st = $end; #print STDERR "get_test_list($CLIENT{'clid'}) - $dl seconds\n"; print "\n"; foreach (sort @tmparray[1..$#tmparray]) { @flds=split(/&/,$_); $testoptions=join('',$testoptions,"