#!/usr/bin/perl # # $Id: tocrinp.pl # # Source File: tocrinp.pl # Get config require 'sitecfg.pl'; require 'testlib.pl'; print "Content-Type: text/html\n\n"; &app_initialize; if (&get_session($FORM{'tid'})) { my $show_template = "selectpg"; &LanguageSupportInit(); $FORM{'respmsg'} = ""; if ($FORM{'dbop'} eq 'hc') { # client selection header frame $show_template="tocrclient"; } elsif ($FORM{'dbop'} eq 'ht') { # test selection header frame &get_client_profile($FORM{'clid'}); $show_template=($FORM{'clid'} eq '') ? "selectpg" : "tocrtest"; } elsif ($FORM{'dbop'} eq 'hu') { # candidate selection header frame &get_client_profile($FORM{'clid'}); $FORM{'testcandidates'}=&get_test_candidates($FORM{'clid'},$FORM{'tstid'},$FORM{'unscored'},$FORM{'completed'}); $FORM{'tccount'}=($FORM{'testcandidates'} eq '') ? 0 : 1; $show_template=($FORM{'tstid'} eq '') ? "selectpg" : "tocrcnd"; } elsif ($FORM{'dbop'} eq 'dtl') { if ($FORM{'cndid'} eq '') { $show_template="selectpg"; } else { my $dir = ($FORM{'unscored'} eq 'P') ? $testpending : $testcomplete; &get_client_profile($FORM{'clid'}); &get_test_profile($FORM{'clid'},$FORM{'tstid'}); &get_candidate_profile($FORM{'clid'},$FORM{'cndid'}); &get_test_sequence( $CLIENT{'clid'}, $CANDIDATE{'uid'}, $TEST{'id'}, $dir); &CreateOCRInputForm(); $show_template=""; } } elsif ($FORM{'dbop'} eq 'post') { # test replication detail save if ($FORM{'cndid'} eq '') { $show_template="selectpg"; } else { $endtime = &format_date_time("dd-mmm-yyyy hh:nn:ss GMT", "1", "0"); my $dir = ($FORM{'unscored'} eq 'P') ? $testpending : $testcomplete; &get_client_profile($FORM{'clid'}); &get_test_profile($FORM{'clid'},$FORM{'tstid'}); &get_candidate_profile($FORM{'clid'},$FORM{'cndid'}); &get_test_sequence( $CLIENT{'clid'}, $CANDIDATE{'uid'}, $TEST{'id'}, $dir); &promote_test_sequence( $testpending, $testinprog, $TEST_STATES{'_PENDING'}); $tetmplt = 'tsubend'; $tsubtest = 2; $TEST_SESSION{'subtest'} = $FORM{'tstid'}; &single_form_test_done($dir); &make_anonymous(); $show_template=""; } } unless ($show_template eq '') { &show_template($show_template);} } else { &show_illegal_access_warning; } sub get_test_candidates { my ($clid,$tstid,$unscoredflag,$completedflag) = @_; my $html=""; my @cnds=(); my @recs=(); my $rec; my $reclid; my $recndid; my $rectst; if ($unscoredflag ne '') { opendir (TMPDIR, "$testpending"); @cnds = readdir(TMPDIR); closedir TMPDIR; my @recs=grep( /^$clid\.(.*)\.$tstid/ , @cnds); @cnds=(); foreach $rec (@recs) { ($reclid,$recndid,$rectst)=&split_test_filename($rec,$clid,$tstid); if (($reclid eq $clid) && ($rectst eq $tstid)) { if (&get_candidate_profile($clid,$recndid)) { $uniquenml = "$CANDIDATE{'nml'}:$CANDIDATE{'uid'}"; push(@cndsnml,$uniquenml); } } } @scndsnml = sort(@cndsnml); @cndsnml=(); foreach $cnml (@scndsnml) { ($trash, $tmpcndid) = split(/:/,$cnml); if (&get_candidate_profile($clid,$tmpcndid)) { $html=join('',$html,"