#!/usr/bin/perl # # $Id: sadmin.pl,v 1.12 2006/11/28 21:07:48 psims Exp $ # # Source File: sadmin.pl #use strict; use warnings; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); #warningsToBrowser(1); #fatalsToBrowser(1); # Get config require 'sitecfg.pl'; require 'testlib.pl'; &app_initialize; print "Content-Type: text/html\n\n"; #print $logroot; my $tid = $FORM{'tid'}; if (&get_session($tid)) { &LanguageSupportInit(); unless ($SESSION{'clid'}) { warn "ERROR: Empty Client ID in Session data for Session ID $FORM{'tid'} " ; #&show_illegal_access_warning("user"); exit(); } if ($SESSION{'clid'} ne 'std') { &get_client_profile($SESSION{'clid'}); unless (%CLIENT) { warn "ERROR: Invalid Client ID $SESSION{'clid'} in Session ID $FORM{'tid'} " ; #&show_illegal_access_warning("user"); exit(); } if ($SESSION{'uac'} eq 'admin' || $SESSION{'uac'} eq 'madmin') { $FORM{'pageid'} = "Group"; $FORM{'PAGEID'} = "GROUP"; $mainttmplt = "frgrpadmin"; } else { &get_candidate_profile($SESSION{'clid'}, $SESSION{'uid'}); unless (%CANDIDATE) { warn "ERROR: Invalid Candidate ID $SESSION{'uid'} for Client $SESSION{'clid'} in Session ID $FORM{'tid'} " ; #&show_illegal_access_warning("user"); exit(); } $FORM{'pageid'} = "Gradebook"; $FORM{'PAGEID'} = "GRADEBOOK"; $mainttmplt = "frgradebooks"; } } my @tempacl = &popEmlAcl($SESSION{'clid'}); foreach (@tempacl) { $CLIENT{'emlaclstr'} .= "$_,"; } $CLIENT{'emlaclstr'} =~ s/@//g; $CLIENT{'emlaclstr'} =~ s/,$//g; if ($FORM{'idx'} eq '1') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/I"); if ($SESSION{'uac'} eq 'admin' || $SESSION{'uac'} eq 'gadmin' || $SESSION{'uac'} eq 'madmin') { &show_template("sadminidx"); } else { &show_template("cndidx"); } } elsif ($FORM{'dtl'} eq '0') { print "\n$xlatphrase[539]
$xlatphrase[540]\n"; } elsif ($FORM{'dtl'} eq '1') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/CM"); if ($SESSION{'uac'} eq 'gadmin') { &show_admin_request("maintclient"); } else { $FORM{'dbop'} = 'ccupd'; &show_admin_request("cdef"); } } elsif ($FORM{'dtl'} eq '12') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/TR"); &show_admin_request("treplicaframe"); } elsif ($FORM{'dtl'} eq '13') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/TO"); &show_admin_request("tocrinpframe"); } elsif ($FORM{'dtl'} eq '2') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/TM"); $TEST{'id'} = $FORM{'tstid'}; &show_admin_request("tdefframe"); } elsif ($FORM{'dtl'} eq '21') { if ($SESSION{'uac'} eq 'cnd') { $CANDIDATE{'ownedtests'} = &get_group_tests($SESSION{'clid'}, $SESSION{'uid'}, 0); } &show_admin_request("mainttest"); } elsif ($FORM{'dtl'} eq '99') { &show_template("selectpg"); } elsif ($FORM{'dtl'} eq '3') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/R"); &show_admin_request("maintreport"); } elsif ($FORM{'dtl'} eq '4') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/DL"); &show_admin_downloads; } elsif ($FORM{'dtl'} eq '5') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/DB"); &show_admin_request("maintdb"); } elsif ($FORM{'dtl'} eq '6') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/CF"); # set FORM.colors $trash = join( $pathsep, $dataroot, "config.$SESSION{'clid'}"); $omsg = ""; open( CFGFILE, "<$trash" ) or $omsg="not found"; if ($omsg eq 'not found') { $trash = join( $pathsep, $dataroot, "config.std"); open( CFGFILE, "<$trash" ) or return; } @cfgentries = ; close CFGFILE; $langdef = "enu"; $FORM{'colors'} = ""; for (0 .. $#cfgentries) { chop ($cfgentries[$_]); ($entrykey,$entryvalue) = split(/=/, $cfgentries[$_]); if ($entrykey eq 'DEFAULTLANG') { $langdef = $entryvalue; $langselfr = ($langdef eq 'fr') ? " SELECTED" : ""; $langselsp = ($langdef eq 'sp') ? " SELECTED" : ""; $langseldeu = ($langdef eq 'deu') ? " SELECTED" : ""; $langselenu = ($langdef eq 'enu') ? " SELECTED" : ""; $langselena = ($langdef eq 'ena') ? " SELECTED" : ""; $langseleuv = ($langdef eq 'euv') ? " SELECTED" : ""; $langselcyr = ($langdef eq 'cyr') ? " SELECTED" : ""; $langselmy = ($langdef eq 'my') ? " SELECTED" : ""; $langselkor = ($langdef eq 'kor') ? " SELECTED" : ""; $langselafr = ($langdef eq 'afr') ? " SELECTED" : ""; $langselhin = ($langdef eq 'hin') ? " SELECTED" : ""; $colortag = " $xlatphrase[541]\ \; \n"; $FORM{'language'} = join('', $colortag, $FORM{'language'}); } elsif ($entrykey eq 'IP_ACCESS_FILTER') { $FORM{'language'} = " $xlatphrase[385]\ \; \n"; } else { if ($entrykey eq 'BACKGROUND') { $colortag = " $entrykey:\ \; \n"; } else { if (($entrykey =~ /COLOR/) || ($entrykey =~ 'LINK') || ($entrykey =~ 'ALINK') || ($entrykey =~ 'VLINK') || ($entrykey eq 'TEXT') ) { $gotfocus = "onFocus=\"return tGotFocus(this)\""; } else { $gotfocus = ""; } $colortag = " $entrykey:\ \; \n"; } $FORM{'colors'} = join('', $FORM{'colors'}, $colortag); } } &show_admin_request("maintcfg"); } elsif ($FORM{'dtl'} eq '7') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/GP"); &show_admin_request($mainttmplt); } elsif ($FORM{'dtl'} eq '8') { #Begin filtering $filterbydate = $FORM{'filterbydate'}; $day_filter = $FORM{'day_filter'}; $date_filter = $FORM{'date_filter'}; $cnd1_filter = $FORM{'cnd1'}; $cnd2_filter = $FORM{'cnd2'}; $cnd3_filter = $FORM{'cnd3'}; $cnd4_filter = $FORM{'cnd4'}; #End filtering &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/CC"); &show_admin_request("maintcnd"); } elsif ($FORM{'dtl'} eq '9') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/RG"); &show_admin_request("regcnd"); } elsif ($FORM{'dtl'} eq '10') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/IM"); &show_admin_request("upimport"); } elsif ($FORM{'dtl'} eq '11') { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/LC"); &show_admin_request("frlicadmin"); } elsif ($FORM{'dbop'} ne '') { &show_dbop_response; } else { #&show_illegal_access_warning("else1"); } } else { &logger::logerr("Unable to get session with &get_session($FORM{'tid'})"); &show_illegal_access_warning("else2"); } sub show_license_request { } sub show_admin_downloads { @dlrecs = &get_data("downloads.dat"); $bFirst=1; if ($#dlrecs eq 0) { $download = "