#!/usr/bin/perl
#  Copyright 2001-2017 Leslie Richardson

#  This file is part of Open Admin for Schools.


# show oaupdates - called by iframe on main page. Shows current values 


use DBI;
use CGI;
use Time::JulianDay;


eval require "../etc/admin.conf";
if ( $@ ) {
    print $lex{Error}. " $@<br>\n";
    die $lex{Error}. " $@\n";
}

my $q = CGI->new;
print $q->header;


my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);


print qq{<!DOCTYPE html>\n};

# Display the updates
my $sth = $dbh->prepare("select * from oaupdate order by date desc, id desc");
$sth->execute;
if ( $DBI::errstr ) { print DBI::errstr; die $DBI::errstr; }

while ( my $ref = $sth->fetchrow_hashref ) {
    my %r = %$ref;
    print qq{<div style="font-weight:bold;font-size:90%;">$r{title} [$r{date}]</div>\n};
    print qq{<div style="font-size:80%;">$r{description}</div><hr>\n};
}
