#!/usr/bin/perl -w

###############################################################################
# 404.pl - this code displays the error page
#
# Copyright (C) 1997 Rob "CmdrTaco" Malda
# malda@slashdot.org
#
# This program 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA	 02111-1307, USA.
#
#
#	 $Id: breaking_stories.pl,v 1.1.1.1 2001/08/07 09:42:20 maldoror Exp $
###############################################################################
use strict;
use lib '../';
use vars '%I';
use imcSlash;

*I = getimcSlashConf();
getimcSlash();
header();

print qq!

<\!-- breaking news block-->

<table width="100%" bgcolor="#222222" cellspacing="0" cellpadding="0" border="0" valign="top">
  <tr>
    <td bgcolor="#003366" cellpadding="0" cellspacing="0" valign="top">
      <font size="-2" color="white" face="Arial">
ÚLTIMAS NOTICIAS
      </font>
    </td>
  </tr>
</table>

<table bgcolor="#dddddd" cellspacing="0" cellpadding="3" border="0" valign="top">
  <font face="verdana,helvetica,arial" size="1" color="FFFFFF">
!;

my $date_add = " DATE_ADD(time, INTERVAL 0 SECOND) ";#getDateOffset ('time');
my ($breaking_story) = sqlSelectMany (qq!date_format($date_add,"%W, %d %M, %Y"),date_format($date_add, "%h:%i%p"),bodytext!, 'breaking_stories', '', 'ORDER BY time DESC');
my $day_printed = 0;
my $old_day;
while (my ($day, $date, $bodytext) = $breaking_story->fetchrow) {
	if ($day ne $old_day) {
		$day_printed = 0;
		$old_day = $day;
	}
	if (! $day_printed) {
		$day_printed = 1;
		print qq!
  <tr>
    <td colspan="2">
      <b>$day</b>
    </td>
  </tr>
!;
	}

	print qq!
  <tr>
    <td valign="top">
      <b>$date</b>
    </td>
    <td>
      $bodytext
    </td>
  </tr>
!;
}

print qq!
  </font>
</table>
!;

footer();
