#! /usr/bin/perl
# Copyright 2001-2020 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.
my %lex = ('Main' => 'Main',
'Template' => 'Template',
'Creator' => 'Creator',
'Description' => 'Description',
'Type' => 'Type',
'Select' => 'Select',
'Fields' => 'Fields',
'Error' => 'Error',
'Continue' => 'Continue',
'Column' => 'Column',
'Number' => 'Number',
'Width' => 'Width',
'Order' => 'Order',
'Tabular' => 'Tabular',
'Multicolumn' => 'Multicolumn',
'Reorder' => 'Reorder',
'Student Roster' => 'Student Roster',
'Report' => 'Report',
'Created' => 'Created',
'Delete' => 'Delete',
'Select' => 'Select',
'Deleted' => 'Deleted',
'Save' => 'Save',
'Drag' => 'Drag',
'Change' => 'Change',
'Order' => 'Order',
'View' => 'View',
'New' => 'New',
'Missing' => 'Missing',
);
my $self = 'templatecreator.pl';
my $templatepath = '../template/';
my $startTemplateDelete = 5; # Starting Number for User Created Templates (to delete)
use DBI;
use CGI;
use Cwd;
# Read config variables
eval require "../etc/admin.conf";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@\n";
}
# Setup Database access
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
$dbh->{mysql_enable_utf8} = 1;
=head
# redundant until doing direct db load
# my @fieldnames = qw( g_jquery_url g_jquery_ui_url );
my $sth = $dbh->prepare("select datavalue from conf_system where dataname = ?");
foreach my $var ( qw( g_jquery_url g_jquery_ui_url )) {
$sth->execute( $var );
my $datavalue = $sth->fetchrow;
eval $datavalue;
if ( $@ ) {
print qq{$lex{Error}: $@
\n};
die "$lex{Error}: $@\n";
}
}
=cut
my $q = new CGI;
my %arr = $q->Vars;
print $q->header( -charset, $charset );
# setup for teacher site, if called from there.
if ( getcwd() =~ /tcgi/ ){ # we are in tcgi
$css = $tchcss;
$homepage = $tchpage;
$downloaddir = $tchdownloaddir;
$webdownloaddir = $tchwebdownloaddir;
}
# Page Header
my $title = "$lex{Template} $lex{Creator}";
print qq{$doctype\n
$key $lex{Deleted}
\n}; } } print qq{[ $lex{'Student Roster'} $lex{Report} | \n}; print qq{$lex{Template} $lex{Creator} | \n}; print qq{$lex{Main} ]
\n}; print qq{\n}; exit; } #------------------------- sub selectTemplateToDelete { #------------------------- # Open the Report Templates my @files = glob($templatepath."rptstudrost*.tpl"); for my $tplfile ( @files ) { # read each label file and get description unless ( open (FH,"<$tplfile")) { print qq{$lex{Error} $lex{Template}: $!\n}; die "$lex{Error} $lex{Template}: $!\n"; } # read first 2 lines of the template only. my $desc =