You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.9 KiB

#!/usr/bin/perl
#
# $Id: tstframes.pl,v 1.4 2006/01/23 21:39:30 ddoughty Exp $
#
# Source File: tframes.pl
# Get config
require 'sitecfg.pl';
require 'testlib.pl';
&app_initialize;
print "Content-Type: text/html\n\n";
if (&get_session($FORM{'tid'})) {
$TEST{'id'} = $FORM{'tstid'};
&get_client_profile($SESSION{'clid'});
if ($SESSION{'taclid'} eq '') {
&get_candidate_profile( $SESSION{'clid'}, $SESSION{'uid'});
} else {
&get_tacl_profile();
}
&get_test_profile( $SESSION{'clid'}, $TEST{'id'});
# Find out if the user is really allowed to run this test.
my $mul_allowed = 0 ;
my $mul_cnt_taken = 0 ;
unless ($TEST{'retkcnt'} eq "unlimited") {
$mul_allowed = 1 ;
$mul_cnt_taken = get_cnd_test_cnt_from_history($testcomplete,$SESSION{'clid'},$SESSION{'uid'},$TEST{'id'}) ;
}
### Check completed status and retake options
unless (($TEST{'retkcnt'} eq "unlimited") || ($mul_allowed && ($mul_cnt_taken < $TEST{'retkcnt'}))) {
# Code to execute if not allowed to run this test.
&show_template("toomanytst");
} else {
if (&verifypasswordprotection()) {
if ($SESSION{'uac'} eq 'sas') {
&get_test_sequence( $SESSION{'clid'}, $SESSION{'uid'}, $TEST{'id'});
($tstate,$tsubtest,$tqno) = split(/\./, $TEST_SESSION{'state'});
if ($tstate ne $TEST_STATES{'_PAUSED_BY_USER'} && $tstate ne $TEST_STATES{'_IN_PROGRESS'}) {
&prepare_test($SESSION{'clid'}, $SESSION{'uid'}, "$FORM{'tstid'};");
}
}
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "1", "Test Ready $TEST{'id'}");
&show_template("tstframe");
} else {
&show_template("tstpwdfailed");
}
}
}
# v sac - end addition for test password protection support
sub verifypasswordprotection() {
unless ($TEST{'pwdprotenab'} == 1) { return 1;}
if (lc($TEST{'pwd'}) eq lc($FORM{'tstpwd'})) {
return 1;
} else {
return 0;
}
}
# ^ sac - end addition for test password protection support