#!/usr/bin/perl ################################################################### # CyberCalendar v1.8 # # Displays event formatted for printing # Copyright 1999, 2000, 2001 Shawn Ewald # ################################################################### # License: # # ----------------------------------------------------------------# # 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. # ################################################################### # For the full text of the GNU General Public License, go to: # # http://www.gnu.org/copyleft/gpl.html # ################################################################### # Script Modules use vars qw($config $db $http_in $printable); use CyberCalendar::Application; use strict; ################################################################### # Begin Script $printable = CyberCalendar::Application->new(); $printable->init(); $config = $CyberCalendar::Application::config; $db = $CyberCalendar::Application::db; $http_in = $CyberCalendar::Application::http_in; show_printable(); sub show_printable { print "\n"; CyberCalendar::Application::show_page_title("Calendar: $config->{calendar_name} Event Date: $http_in->{DateID} ID: $http_in->{Repeatid}"); print qq(\n

); show_event(); print "\n

\n\n\n"; } # endsub show_printable sub show_event { my ($rows, $event) = get_event_data(); my $cal = CyberCalendar::Calendar->new(); my $option_link = qq(<<Return to Event Options); my $date_link = qq(<< Go Back); if ($rows == 0) { my_error("no", "Cannot display event."); print qq(
$date_link
); } # if else { $cal = CyberCalendar::Calendar->new(); my ($y, $m, $d) = split("-", $event->{dateid}); $event->{dateid} = $cal->datestring($y, $m, $d); $event->{starttime} = $cal->hr24_2_hr12($event->{starttime}); if ($event->{enddate} != 0) { my ($y, $m, $d) = split("-", $event->{enddate}); $event->{enddate} = $cal->datestring($y, $m, $d); $event->{dateid} = "$event->{dateid} - $event->{enddate}"; } # if if ($event->{endtime} != 0) { $event->{endtime} = $cal->hr24_2_hr12($event->{endtime}); $event->{starttime} = "$event->{starttime} - $event->{endtime}"; } # if print <<"PRINTABLE_EVENT";
Event: $event->{subject}
Date: $event->{dateid}
Time: $event->{starttime}
Location: $event->{location}
Category: $event->{category}
Contact: $event->{email}
Website: $event->{url}

$event->{desctext}

Calendar: $config->{calendar_name}
Url: $config->{calendar_homepage}$config->{cal_url}?Calendar=$http_in->{Calendar}


$option_link
PRINTABLE_EVENT } # else } # endsub show_event sub get_event_data { my $query = qq(SELECT * from $http_in->{Calendar} WHERE dateid = ? AND repeatid = ?); $db->query($query, CyberCalendar::Application::http2dateid($http_in->{DateID}), $http_in->{Repeatid}); return ($db->rowcount, $db->result("hashref"), $db->finish); } # endsub show_event_data sub my_error { CyberCalendar::Application::my_error($_[0], $_[1]); } # endsub my_error $printable->my_exit();