#!/usr/bin/perl
# Copyright 2001-2008 Leslie Richardson
# This file is part of Open Admin for Schools.
# Open Admin for Schools is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# weightgrp.pl - script to adjust test weighting by group percent
# vars showWeights - from gbook.conf
my %lex = ( 'Adjust Group Weights' => 'Adjust Group Weights',
'Main' => 'Main',
'GB Main' => 'GB Main',
'Weight by Item' => 'Weight by Item',
'Group' => 'Group',
'Weight' => 'Weight',
'Items' => 'Items',
'Group Weight' => 'Group Weight',
'Update Weights' => 'Update Weights',
'Total Weight' => 'Total Weight',
'Please Log In' => 'Please Log In',
'Add New Groups' => 'Add New Groups',
'Put X in weight to delete' => 'Put X in weight to delete',
'Please Log in' => 'Please Log in',
);
# Number of blank group entries to allow
my $maxEntries = 6;
my $self = 'weightgrp.pl';
use DBI;
use CGI;
use CGI::Session;
my $q = new CGI;
my %arr = $q->Vars;
delete $arr{subjsec}; # no longer needed; session based.
eval require "../../etc/admin.conf";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@
\n";
}
eval require "../../etc/gbook.conf";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@
\n";
}
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
# Get Session Information...
my $session = new CGI::Session("driver:mysql;serializer:FreezeThaw",
undef,{Handle => $dbh}) or die CGI::Session->errstr;
print $q->header;
my $logged_in = $session->param(logged_in);
if (not $logged_in){
print $lex{'Please Log in'}. "!
\n";
die;
}
my $subjsec = $session->param('subjsec');
# Get Subject Description
$sth = $dbh->prepare("select description from subject
where subjsec = ?");
$sth->execute($subjsec);
if ($DBI::errstr){ print $DBI::errstr; die "$DBI::errstr:$!\n";}
my $subject = $sth->fetchrow;
# Print Document Head
print "$doctype\n