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.
96 lines
2.5 KiB
96 lines
2.5 KiB
4 months ago
|
#!/usr/bin/perl
|
||
|
#
|
||
|
# Source File: tcstmpgdtl.pl
|
||
|
|
||
|
# Get config
|
||
|
require 'sitecfg.pl';
|
||
|
|
||
|
&app_initialize;
|
||
|
|
||
|
print "Content-Type: text/html\n\n";
|
||
|
|
||
|
if (&get_session($FORM{'tid'})) {
|
||
|
&LanguageSupportInit();
|
||
|
&get_client_profile($SESSION{'clid'});
|
||
|
&get_test_profile($SESSION{'clid'}, $FORM{'tstid'});
|
||
|
if ($FORM{'dbop'} eq 'h') {
|
||
|
&show_template("taccnav");
|
||
|
} else {
|
||
|
if ($FORM{'dbop'} eq 'g') {
|
||
|
&get_custom_page();
|
||
|
} elsif ($FORM{'dbop'} eq 'd') {
|
||
|
if(&delete_custom_page()) {
|
||
|
$FORM{'page'}="ins";
|
||
|
&get_custom_page();
|
||
|
}
|
||
|
} elsif ($FORM{'dbop'} eq 's') {
|
||
|
&save_custom_page();
|
||
|
&get_custom_page();
|
||
|
} else {
|
||
|
if ($FORM{'page'} eq '') {
|
||
|
$FORM{'page'}="ins";
|
||
|
}
|
||
|
&get_custom_page();
|
||
|
}
|
||
|
$FORM{'cxpselected'}=($FORM{'page'} eq 'cxp') ? " selected" : "";
|
||
|
$FORM{'cepselected'}=($FORM{'page'} eq 'cep') ? " selected" : "";
|
||
|
$FORM{'cxfselected'}=($FORM{'page'} eq 'cxf') ? " selected" : "";
|
||
|
$FORM{'cefselected'}=($FORM{'page'} eq 'cef') ? " selected" : "";
|
||
|
$FORM{'cxuselected'}=($FORM{'page'} eq 'cxu') ? " selected" : "";
|
||
|
$FORM{'ceuselected'}=($FORM{'page'} eq 'ceu') ? " selected" : "";
|
||
|
$FORM{'insselected'}=($FORM{'page'} =~ 'cxpcxfcxu') ? "" : " selected";
|
||
|
&show_template("tcstmpgdtl");
|
||
|
}
|
||
|
} else {
|
||
|
&show_illegal_access_warning;
|
||
|
}
|
||
|
|
||
|
sub get_custom_page {
|
||
|
my $rec;
|
||
|
my $customexitfile=join($pathsep,$questionroot,"$TEST{'id'}.$SESSION{'clid'}.$FORM{'page'}");
|
||
|
$FORM{'html'}="";
|
||
|
if (file_exists($customexitfile)) {
|
||
|
if (open(TMPFILE,"<$customexitfile")) {
|
||
|
my @cstextrecs=<TMPFILE>;
|
||
|
close TMPFILE;
|
||
|
my $customfilecontents="";
|
||
|
foreach $rec (@cstextrecs) {
|
||
|
$customfilecontents=join('',$customfilecontents,$rec);
|
||
|
}
|
||
|
$FORM{'html'}="$customfilecontents";
|
||
|
@cstextrecs=();
|
||
|
return 1;
|
||
|
}
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
sub save_custom_page {
|
||
|
my $customexitfile=join($pathsep,$questionroot,"$TEST{'id'}.$SESSION{'clid'}.$FORM{'page'}");
|
||
|
my $fileexisted=file_exists($customexitfile);
|
||
|
if (open(TMPFILE,">$customexitfile")) {
|
||
|
print TMPFILE "$FORM{'cstmpgrawhtml'}";
|
||
|
close TMPFILE;
|
||
|
unless ($fileexisted) { my $chmod = chmod 0777,$customexitfile;}
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
sub delete_custom_page() {
|
||
|
my $rec;
|
||
|
my $customexitfile=join($pathsep,$questionroot,"$TEST{'id'}.$SESSION{'clid'}.$FORM{'page'}");
|
||
|
if (file_exists($customexitfile)) {
|
||
|
my $filepath=join($pathsep,$questionroot);
|
||
|
my $customexitfile="$TEST{'id'}.$SESSION{'clid'}.$FORM{'page'}";
|
||
|
if (chdir($filepath)) {
|
||
|
my $cnt = unlink "$customexitfile";
|
||
|
if ($cnt != 0 ) {
|
||
|
$FORM{'html'}="";
|
||
|
return 1;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return 0;
|
||
|
}
|