#!/usr/bin/perl # # $Id: sreports.pl,v 1.4 2006/01/23 21:39:30 ddoughty Exp $ # # Source File: sreports.pl # Get config require 'sitecfg.pl'; require 'testlib.pl'; require 'tstatlib.pl'; $FORM{'frm'}=""; &app_initialize; warn "INFO: " . __FILE__ . " running.\n" ; print "Content-Type: text/html\n\n"; if (&get_session($FORM{'tid'})) { &LanguageSupportInit(); $REPORT{'rptid'}=""; @rptdefs = &get_data("sitereports.dat"); @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 ($FORM{'frm'} == '1' || ($FORM{'frm'} == '' && $REPORT{'rptid'} eq "ACT-004")) { &show_index; } else { if ($FORM{'frm'} == '2') { &show_detail; } else { if ($FORM{'frm'} == '') { &show_frames; } else { print "\n"; print "\n"; print " \n"; print "\n"; } } } } sub show_frames { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } sub show_index { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Exec Report $FORM{'rptno'}"); print "\n"; print "\n$REPORT{'rptid'} - $REPORT{'rptdesc'}\n\n"; print " \n"; print "$REPORT{'rptid'}
$REPORT{'rptdesc'}

 
\n"; if ($REPORT{'rptid'} eq 'ACT-001') { opendir(DIR, "$logroot"); @dircon = readdir(DIR); closedir DIR; @sdircon = sort @dircon; foreach $diritem (@sdircon) { chomp ($diritem); if ($diritem =~ /sess\.[0-9]/i ) { @lines = &get_log($diritem); foreach $line (@lines) { chomp ($line); ($nm,$vlu)=split(/=/, $line); $SESS{$nm}=$vlu; } $tmstr = &format_date_time("yy-mm-dd hh:nn", "1", "-10000", substr($SESS{'tid'}, 0, -4)); print "$tmstr $SESS{'uid'}.$SESS{'clid'}
\n"; } } } elsif ($REPORT{'rptid'} eq 'ACT-002') { print "
\n"; print "Tests Pending:
\n"; opendir(DIR, "$testpending"); @dircon = readdir(DIR); closedir DIR; @sdircon = sort @dircon; foreach $diritem (@sdircon) { chomp ($diritem); if ($diritem =~ /[a-zA-Z0-9](.*).[a-zA-Z0-9](.*).[a-zA-Z0-9]/i ) { print "$diritem
\n"; } } print "
\n"; print "Tests in Progress:
\n"; opendir(DIR, "$testinprog"); @dircon = readdir(DIR); closedir DIR; @sdircon = sort @dircon; foreach $diritem (@sdircon) { chomp ($diritem); if ($diritem =~ /[a-zA-Z0-9](.*).[a-zA-Z0-9](.*).[a-zA-Z0-9]/i ) { print "$diritem
\n"; } } print "
\n"; print "Tests Completed:
\n"; opendir(DIR, "$testcomplete"); @dircon = readdir(DIR); closedir DIR; @sdircon = sort @dircon; foreach $diritem (@sdircon) { chomp ($diritem); if ($diritem =~ /[a-zA-Z0-9](.*).[a-zA-Z0-9](.*).[a-zA-Z0-9]/i ) { print "$diritem
\n"; } } } elsif ($REPORT{'rptid'} eq 'ACT-004') { # C_004 $faction="$cgiroot/IntegroStats.pl"; $ftarget="rptwindow"; $fparms="\n"; $fparms=join('',$fparms,"\n"); ### DED 10/25/2002 Added rptdesc and rptid to pass to creportsf $fparms=join('',$fparms,"\n"); $fparms=join('',$fparms,"\n"); $finputs="\n"; $finputs=join('',$finputs,"\t\n\t\t\n\n"); $finputs=join('',$finputs,"\n"); $finputs=join('',$finputs,"\t\t\n"); ### DED 12/23/04 Removed Test Stats & Other Options #$finputs=join('',$finputs,"\t\t\n"); #$finputs=join('',$finputs,"\t\t\n"); $finputs=join('',$finputs,"\t\n"); $finputs=join('',$finputs,"\t\n"); $finputs=join('',$finputs,"\t\t\n"); #$finputs=join('',$finputs,"\t\t\n"); #$finputs=join('',$finputs,"\t\t\n"); $finputs=join('',$finputs,"\t\n"); $finputs=join('',$finputs,"
Advanced Options
\nQuestion Statistics:
\n"); $finputs=join('',$finputs," Question Statistics
\n"); $finputs=join('',$finputs,"\ \;\ \;\ \;\ \;\ \; include inactive questions
\n"); $finputs=join('',$finputs,"\ \;\ \;\ \;\ \;\ \; exclude No Response from stats
\n"); $finputs=join('',$finputs,"\ \;\ \;\ \;\ \;\ \;User Comments:
\n"); $finputs=join('',$finputs,"\ \;\ \;\ \;\ \;\ \; do not include
\n"); $finputs=join('',$finputs,"\ \;\ \;\ \;\ \;\ \; include with question
\n"); $finputs=join('',$finputs,"\ \;\ \;\ \;\ \;\ \; include at end
\n"); $finputs=join('',$finputs,"\ \;\ \;\ \;\ \;\ \; include at end without uncommented questions
\n"); $finputs=join('',$finputs,"\t\t
\nTest Statistics
\n"); #$finputs=join('',$finputs," Individual Test results
\n"); #$finputs=join('',$finputs,"\ \;\ \;\ \;\ \;\ \; breakdown by subject area
\n"); #$finputs=join('',$finputs,"\t\t
\nOther Options:
"); #$finputs=join('',$finputs," Extract From Tests
\n"); #$finputs=join('',$finputs,"\ \;\ \;\ \;\ \;\ \; Candidate Name
\n"); #$finputs=join('',$finputs,"\ \;\ \;\ \;\ \;\ \; Candidate Email Address
\n"); #$finputs=join('',$finputs,"\ \;\ \;\ \;\ \;\ \; Candidate Score
\n"); #$finputs=join('',$finputs,"\t\t
\n"); ### DED 12/23/04 ### Removed Filter-by-question options #$finputs=join('',$finputs,"\ \;
\n"); #$finputs=join('',$finputs," Filter by question
\n"); #$finputs=join('',$finputs," Filter by user
\n"); #$finputs=join('',$finputs,"\t\t
\n"); #my $j; #$finputs=join('',$finputs,"From:
\n"); #$finputs=join('',$finputs,"To:
\n"); #$finputs=join('',$finputs,"\t\t
\n"); #$finputs=join('',$finputs," download in text format
\n"); #$finputs=join('',$finputs,"\t\t
\ \;
\n"); $fjscript=" function onWdwLoad() { var oform=document.rptform1; //oform.mofm.selectedIndex=0; //oform.dyfm.selectedIndex=0; //oform.yrfm.selectedIndex=0; //oform.moto.selectedIndex=oform.moto.options.length-1; //oform.dyto.selectedIndex=oform.dyto.options.length-1; //oform.yrto.selectedIndex=oform.yrto.options.length-1; //oform.testsummary[0].checked=true; oform.testsummary.checked=true; oform.showcmts[0].checked=true; } function filterCheck(oform) { if (oform.specfilter.checked==true || oform.filterbyques.checked==true) { oform.action=\"$cgiroot/creportsf.pl\"; } else { oform.action=\"$cgiroot/teststats.pl\"; } } function parmsC004(oform,tst) { oform.tstid.value=tst; oform.submit(); } function reportOptions(oinp) { var oform=oinp.form,idx; if (oinp.name==\"testsummary\") { idx=(oform.testsummary[0].checked) ? 0 : -1; idx=(oform.testsummary[1].checked) ? 1 : idx; idx=(oform.testsummary[2].checked) ? 2 : idx; return testsummaryClick(oform,idx); } else { if (oinp.name==\"showcmts\") { idx=(oform.showcmts[0].checked) ? 0 : -1; idx=(oform.showcmts[1].checked) ? 1 : idx; idx=(oform.showcmts[2].checked) ? 2 : idx; idx=(oform.showcmts[3].checked) ? 3 : idx; return showcmtsClick(oform,idx); } else { if (oinp.name==\"statsbysubj\") { return statsbysubjClick(oform,oinp.checked); } else { if (oinp.name==\"showobs\") { return showobsClick(oform,oinp.checked); } else { if (oinp.name==\"export\") { return exportClick(oform,oinp.checked); } else { return dataextractOpts(oform); } } } } } } function dataextractOpts(oform) { if (!(oform.testsummary[2].checked)) { oform.testsummary[2].checked=true; oform.showcmts[0].checked=false; oform.showcmts[1].checked=false; oform.showcmts[2].checked=false; oform.showcmts[3].checked=false; oform.statsbysubj.checked=false; oform.showobs.checked=false; } return true; } function testsummaryClick(oform,i) { if (i==0) { if (!((oform.showcmts[0].checked) || (oform.showcmts[1].checked) || (oform.showcmts[2].checked) || (oform.showcmts[3].checked) )) { oform.showcmts[0].checked=true; oform.statsbysubj.checked=false; oform.showobs.checked=false; oform.cndnme.checked=false; oform.cndeml.checked=false; if (\"$CLIENT{'clcnd1'}\" != \"\") { oform.cnd1.checked=false; } if (\"$CLIENT{'clcnd2'}\" != \"\") { oform.cnd2.checked=false; } if (\"$CLIENT{'clcnd3'}\" != \"\") { oform.cnd3.checked=false; } if (\"$CLIENT{'clcnd4'}\" != \"\") { oform.cnd4.checked=false; } oform.cndscr.checked=false; } } else { if (i==1) { oform.showcmts[0].checked=false; oform.showcmts[1].checked=false; oform.showcmts[2].checked=false; oform.showcmts[3].checked=false; oform.statsbysubj.checked=false; oform.showobs.checked=false; oform.cndnme.checked=false; oform.cndeml.checked=false; if (\"$CLIENT{'clcnd1'}\" != \"\") { oform.cnd1.checked=false; } if (\"$CLIENT{'clcnd2'}\" != \"\") { oform.cnd2.checked=false; } if (\"$CLIENT{'clcnd3'}\" != \"\") { oform.cnd3.checked=false; } if (\"$CLIENT{'clcnd4'}\" != \"\") { oform.cnd4.checked=false; } oform.cndscr.checked=false; } else { if (i==2) { oform.showcmts[0].checked=false; oform.showcmts[1].checked=false; oform.showcmts[2].checked=false; oform.showcmts[3].checked=false; oform.statsbysubj.checked=false; oform.showobs.checked=false; } } } return true; } function showcmtsClick(oform,i) { if (!(oform.testsummary[0].checked)) { oform.testsummary[0].checked=true; oform.statsbysubj.checked=false; oform.showobs.checked=false; } return true; } function statsbysubjClick(oform,chkd) { if (chkd) { if (!(oform.testsummary[1].checked)) { oform.testsummary[1].checked=true; oform.showcmts[0].checked=false; oform.showcmts[1].checked=false; oform.showcmts[2].checked=false; oform.showcmts[3].checked=false; oform.showobs.checked=false; } } return true; } function showobsClick(oform,chkd) { if (chkd) { if (!(oform.testsummary[0].checked)) { oform.testsummary[0].checked=true; oform.showcmts[0].checked=true; oform.statsbysubj.checked=false; } } return true; } function exportClick(oform,chkd) { return true; } window.onload=onWdwLoad; "; print " $REPORT{'rptid'} - $REPORT{'rptdesc'} "; print "
\n$fparms\n"; print "
$CLIENT{'logo'} $REPORT{'rptdesc'}\ -\ $REPORT{'rptid'}
"; &print_report_C_004(); } else { print "
\n"; print "Report $FORM{rptno} is not yet available.\n"; print "
\n"; } print "\n"; print "\n"; &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "3", "Exec Report $FORM{'rptno'} completed"); } sub show_detail { print "\n"; if ($REPORT{'rptid'} eq 'ACT-001') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Exec Log Report $FORM{'dbfile'}"); print "\n$REPORT{'rptid'} - Log File $FORM{'dbfile'}\n\n"; print " \n"; print "

$REPORT{'rptid'} - $REPORT{'rptdesc'}


\n"; if ($FORM{'filter'}!='') { print "Session $FORM{'filter'}
\n"; @lines = &get_log("sess.$FORM{'filter'}"); foreach $line (@lines) { chomp ($line); print "$line
\n"; } print "
\n"; } @lines = &get_log($FORM{'dbfile'}); foreach $line (@lines) { chomp ($line); if ($FORM{'filter'}!='') { if ($line =~ /,$FORM{'filter'},/ ) { print "$line
\n"; } } else { print "$line
\n"; } } &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Exec Log Report $FORM{'dbfile'} completed"); } elsif ($REPORT{'rptid'} eq 'ACT-002') { print " $REPORT{'rptid'} - Test File $FORM{'dbfile'} $REPORT{'rptid'} - $REPORT{'rptdesc'} \n"; $msg = ""; @locations = ( $testpending, $testinprog, $testcomplete); $trash = join($pathsep, $locations[$FORM{'location'}], $FORM{'dbfile'}); open (TESTFILE, "<$trash") or $msg="failed"; if ($msg eq 'failed') { print "Unable to open file."; } else { @lines = ; close TESTFILE; if ($trash =~ /$testinprog/ ) { print "TERMINATE THIS TEST
\n"; } foreach $line (@lines) { chomp ($line); print "$line
\n"; } if ($trash =~ /$testinprog/ ) { print "\n"; print "\n"; print "\n"; print "Reason for Terminating The Test:
\n"; print "
\n"; print "\n"; print "\n"; } } } else { print "\n$REPORT{'rptid'}\n\n"; print "\n"; print "Report Not Yet Available.
\n"; } print "\n"; print "\n"; } sub print_report_C_004 { @trecs = &get_test_list_all(); @tmptrecs = (); for (1 .. $#trecs) { ($id, $desc) = split(/&/, $trecs[$_]); $trecs[$_] = join('&', "$desc", "$id"); push @tmptrecs, $trecs[$_]; } @tmptrecs = sort @tmptrecs; my $prev = 'nonesuch'; @trecs = grep($_ ne $prev && (($prev) = $_), @tmptrecs); for (0 .. $#trecs) { ($desc,$id) = split(/&/, $trecs[$_]); $testscompleted = CountTestFiles($testcomplete,"all",$id); $testsinprogress = CountTestFiles($testinprog, "all",$id); $testspending = CountTestFiles($testpending, "all",$id); $href="javascript:parmsC004(document.rptform1,\'$id\')\;"; $tstoption =" $id $desc $testscompleted $testsinprogress $testspending \n"; $tstoptions = join('', $tstoptions, $tstoption); } print "
Test/Survey Summary Statistics
$finputs $tstoptions

Test ID Description Cmp InP Pnd


"; }