#!/usr/bin/perl # # $Id: treplica.pl # # Source File: treplica.pl # Get config require 'sitecfg.pl'; require 'testlib.pl'; &app_initialize; print "Content-Type: text/html\n\n"; if (&get_session($FORM{'tid'})) { my $show_template = "selectpg"; &LanguageSupportInit(); $FORM{'respmsg'} = ""; if ($FORM{'dbop'} eq 'hc') { # client selection header frame $show_template="trepclient"; } elsif ($FORM{'dbop'} eq 'ht') { # test selection header frame &get_client_profile($FORM{'clid'}); $show_template=($FORM{'clid'} eq '') ? "selectpg" : "treptest"; } elsif ($FORM{'dbop'} eq 'hu') { # test selection header frame &get_client_profile($FORM{'clid'}); $FORM{'testcandidates'}=&get_test_candidates($FORM{'clid'},$FORM{'tstid'},$testpending); $FORM{'tccount'}=($FORM{'testcandidates'} eq '') ? 0 : 1; $show_template=($FORM{'tstid'} eq '') ? "selectpg" : "trepcnd"; } elsif ($FORM{'dbop'} eq 'dtl') { # test replication detail save if ($FORM{'cndid'} eq '') { $show_template="selectpg"; } else { &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'},$testpending); $show_template="treplica"; } } elsif ($FORM{'dbop'} eq 's') { &replicate_test($FORM{'clid'},$FORM{'cndid'},$FORM{'tstid'}); $show_template=""; } &show_template($show_template); } else { &show_illegal_access_warning; } sub get_test_candidates { my ($clid,$tstid,$dir) = @_; my $html=""; my @cnds=(); my @recs=(); my $rec; my $reclid; my $recndid; my $rectst; opendir (TMPDIR, "$dir") or return $html; @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)) { $html=join('',$html,"