#!/usr/bin/perl # # $Id: sbadef.pl # # Source File: sbadef.pl # Get config require 'sitecfg.pl'; require 'sbalib.pl'; &app_initialize; print "Content-Type: text/html\n\n"; if (&get_session($FORM{'tid'})) { my $show_template = undef; &LanguageSupportInit(); $FORM{'respmsg'} = ""; $TEST{'id'} = $FORM{'tstid'}; &get_test_profile($SESSION{'clid'}, $TEST{'id'}); if ($FORM{'frm'} eq '0') { $show_template = "selectpg"; } else { if ($FORM{'frm'} eq '1') { # # Subject Area Navigation frame # $show_template = "subjareanav"; } elsif ($FORM{'frm'} eq '2') { # # Subject Area Test and Master frame # my @frecs; my $safile; $safile=join($pathsep, $questionroot,"$TEST{'id'}.$SESSION{'clid'}.sba"); if (&file_exists($safile)==0) { &create_subjarea_file($SESSION{'clid'}, $TEST{'id'}, ""); } if ($FORM{'sbamids'} ne "") { if ($FORM{'dbop'} eq "m2t") { &add_subjarea_fm_master($SESSION{'clid'}, $TEST{'id'}, $FORM{'sbamids'}); $FORM{'respmsg'} = "Subject Area(s) added from Master."; } elsif ($FORM{'dbop'} eq "t2m") { &add_subjarea_to_master($SESSION{'clid'}, $TEST{'id'}, $FORM{'sbamids'}); $FORM{'respmsg'} = "Master Subject Area(s) updated."; } elsif ($FORM{'dbop'} eq "dt") { &drop_subjarea($SESSION{'clid'}, $TEST{'id'}, $FORM{'sbamids'}); $FORM{'respmsg'} = "Subject Area(s) dropped from test."; } } else { if ($FORM{'dbop'} eq "bq") { &build_subjarea($SESSION{'clid'}, $TEST{'id'}, ""); $FORM{'respmsg'} = "Subject Area(s) built from test questions."; } } $SUBJAREA{'testlist'} = &get_subjarea_masters ($SESSION{'clid'}, $TEST{'id'},"id,id,desc"); $SUBJAREA{'masterlist'} = &get_subjarea_masters ($SESSION{'clid'},"","id,abbr,desc"); $show_template = "subjareahdr"; } elsif ($FORM{'frm'} eq '3') { # # Subject Area Detail frame # $SUBJAREA{'sbanew'}=$FORM{'sbanew'}; if ($FORM{'sbanew'} ne "Y") { if ($FORM{'sbaid'}) { if ($FORM{'dbop'} eq "a") { &put_subjarea($SESSION{'clid'}, $TEST{'id'}, $FORM{'sbaid'}); &get_subjarea($SESSION{'clid'}, $TEST{'id'}, $FORM{'sbaid'}); $FORM{'respmsg'} = "Subject Area added."; } elsif ($FORM{'dbop'} eq "s") { &update_subjarea($SESSION{'clid'}, $TEST{'id'}, $FORM{'sbaid'}); &get_subjarea($SESSION{'clid'}, $TEST{'id'}, $FORM{'sbaid'}); $FORM{'respmsg'} = "Changes saved."; } else { &get_subjarea($SESSION{'clid'}, $TEST{'id'}, $FORM{'sbaid'}); } } $SUBJAREA{'qcnt'}=&count_subj_skill_questions($SESSION{'clid'}, $TEST{'id'}, 1, $SUBJAREA{'id'}); } $show_template = "subjareadtl"; } } if ( $show_template ) { &show_template($show_template); } } else { &show_illegal_access_warning; }