#!/usr/bin/perl -wT
#
#     ESJ 問い合わせページの生成
#
#     2010 Takenaka, A.

use strict;
use warnings;

use CGI;
use Encode;
use HTML::Template;
use CGI::Carp('fatalsToBrowser');

# =comment
use lib qw(/var/www/vhosts/esj.ne.jp/httpdocs/meeting/forms/pm);
use Info;
use Inquiry;
# =cut

my $lang = $ENV{'QUERY_STRING'};

my $charset = "UTF-8";

my $Data = new CGI; #   CGI オブジェクトを取得。global 変数。
$Data->charset($charset);
print $Data->header(-type=>"text/html");


my $tmpl_file = ($lang =~ /E-page/i) ? 'inquiry_0-e.html': 'inquiry_0.html';

my $announcement;

if  ($lang =~ /E-page/) {
    $announcement = &Inquiry::load_announcement_e();
}
else {
    $announcement = &Inquiry::load_announcement_j();
}

$announcement = &Inquiry::announcement_to_html_LI($announcement);


open (my $handle, "<:utf8", $tmpl_file ) || die;
my $tmpl = HTML::Template->new( filehandle => $handle );

close $handle;

my $n_meeting = &Info::get_n_meeting();
$tmpl->param(n_meeting => $n_meeting);
$tmpl->param(announcement => $announcement);
print $tmpl->output;
