#!/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.
# Globals: useMultipliers, defaultItemWeight
my %lex = ('Add Assessment Item' => 'Add Assessment Item',
'Main' => 'Main',
'GB Main' => 'GB Main',
'No colons(:) please' => 'No colons(:) please',
'Subject-Section' => 'Subject-Section',
'Save Assessment Item' => 'Save Assessment Item',
'Name' => 'Name',
'Description' => 'Description',
'Max Raw Score' => 'Max Raw Score',
'Date' => 'Date',
'Select
Group
and Weight' => 'Select
Group
and Weight',
'Sel' => 'Sel',
'Weight' => 'Weight',
'Group' => 'Group',
'Items' => 'Items',
'New Group' => 'New Group',
'A colon (:) is used to separate group and subgroup. Do not use a colon' =>
'A colon (:) is used to separate group and subgroup. Do not use a colon',
'in the group name unless you mean to create a group with subgroups' =>
'in the group name unless you mean to create a group with subgroups',
'No group chosen or defined' => 'No group chosen or defined',
'You must make sure that you fill in the group, name, and' =>
'You must make sure that you fill in the group, name, and',
'the maximum score value. Please go back and try again' =>
'the maximum score value. Please go back and try again',
'Back' => 'Back',
'Missing field values' => 'Missing field values',
'Add Scores' => 'Add Scores',
'Add Another Item' => 'Add Another Item',
'Save Assessment Item' => 'Save Assessment Item',
'or' => 'or',
'Simple Form Entry' => 'Simple Form Entry',
'Description' => 'Description',
'Select Grp/New Wt' => 'Select Grp/New Wt',
'New Grp/New Wt' => 'New Grp/New Wt',
'No weight defined' => 'No weight defined',
'Your new group was added' => 'Your new group was added',
'The assessment item is now stored in the database' =>
'The assessment item is now stored in the database',
'New Group Weight' => 'New Group Weight',
'Continue' => 'Continue',
'Total' => 'Total',
'Error' => 'Error',
'Please Log In' => 'Please Log In',
);
my $self = 'testadd.pl';
use DBI;
use CGI;
use CGI::Session;
#use strict;
# Set the current date
my @tim = localtime(time);
my $year = @tim[5] + 1900;
my $month = @tim[4] + 1;
my $day = @tim[3];
my $currdate = "$year-$month-$day";
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 $q = new CGI;
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;
my $logged_in = $session->param(logged_in);
if ( not $logged_in ) {
print $q->header;
print "