#!/usr/bin/perl require 'td_global.pl'; ################################################################### # # # Program Name : am2_issues.cgi # # Author : James Xing # # Description : List all closing market highlights available. # # # ################################################################### use CGI; use DBI; use lib '..'; use paths; require 'server_root.pl'; use lib &paths::get('packages'); use do_template; use CGI::Carp qw(fatalsToBrowser); $doc_root = "/webAS/web/docs"; require 'includes.pl'; require './packages/am_db.pl'; #hide the bad free messages from displaying $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /^Bad free/ }; my $cgi = new CGI; my $lang = $cgi->param('lang'); my (@fund_date, @title, @highlight, @cash_income); my (@equities, @globals, @prod_id); $lang = 'EN' if (! $lang); my $web_cgi = &paths::get('web_cgi'); &get_index_values; $template = &get_html_template($lang); &generate_page($template, $lang); exit; ################## # Subroutines # ################## sub get_index_values { &login; $sh = $dbh->prepare("select substr(monthname(fund_date),1,3) || ' ' || ltrim(rtrim(char(day(fund_date)))) || ', ' || ltrim(char(year(fund_date))), title, prod_id from market_highlight where CURRENT DATE between actvtn_dt and xprtn_dt and approval_ind = 1 and lang_cd = '$lang' order by fund_date desc") || die "$DBI::errstr\n"; $sh->execute; my ($t1, $t2, $t3); while (($t1, $t2, $t3) = $sh->fetchrow) { push @fund_date, $t1; push @title, $t2; push @prod_id , $t3; } $sh->finish; &logout; } sub get_html_template { my ($lang) = @_; my $template = ($lang eq "FR") ? "./templates/french/am2_index.html" : "./templates/english/am2_index.html"; return $template } sub generate_page { my ($template, $lang) = @_; my $html = ''; my (%ins, $page); for $i (0 .. $#prod_id) { my $link = "$web_cgi/am/am2_details.cgi?lang=$lang&prod_id=$prod_id[$i]"; $html .= "