X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=mig-bin%2Fmig-reporter;fp=mig-bin%2Fmig-reporter;h=0bed9bf4ca0613973b90939181405cbfcbb9a61c;hp=fbd2644e494dda8072fe0a3e35885f9a42c03e47;hb=0c610fb7e604ad90a3edcb40176b2f8d23bf0f8c;hpb=10a85fa2b47f0a872527697e20a493d10ddb3578 diff --git a/mig-bin/mig-reporter b/mig-bin/mig-reporter index fbd2644..0bed9bf 100755 --- a/mig-bin/mig-reporter +++ b/mig-bin/mig-reporter @@ -1,5 +1,5 @@ #!/usr/bin/perl - +# -*- coding: iso-8859-15 -*- ############################################################################### =pod @@ -110,6 +110,7 @@ $report_file = $MIGGITDIR . $report_file; open($fh, '>', $report_file) or abort("Could not open output file $report_file!"); write_title_page($report_title,$fh,$analyst,$captions); +load_javascript($fh); if (defined $added_page_file and defined $added_page_title) { print $fh "<<<\n"; @@ -200,7 +201,7 @@ foreach my $t (@report_tags) { if ($debug eq 'on') {print "\nchecking for $rname ... ";} %report0 = find_report($dom,$t,$rname,'0',$debug); $check_tables0 = check_table($report0{query},$MIGSCHEMA,$debug,$rname); - if ($check_tables0 == 1) { $r = print_query($fh,%report0); } else { + if ($check_tables0 == 1) { $r = print_query($fh,%report0); } else { %report1 = find_report($dom,$t,$rname,'1',$debug); if (defined $report1{query}) { $check_tables1 = check_table($report1{query},$MIGSCHEMA,$debug,$rname); @@ -261,7 +262,9 @@ sub find_report { tag => $node->findvalue('./tag'), iteration => $node->findvalue('./iteration'), note => $node->findvalue('./note'), - ); + display => $node->findvalue('./display'), + chart_labels => $node->findvalue('./chart_labels'), + ); return %report; } } @@ -314,6 +317,14 @@ sub write_title_page { print $fh "\n"; } +sub load_javascript { + my $fh = shift; + + print $fh "++++\n"; + print $fh "\n"; + print $fh "++++\n"; +} + sub check_table { my $query = shift; my $MIGSCHEMA = shift; @@ -383,13 +394,20 @@ sub clean_query_string { sub print_query { my $fh = shift; my %report = @_; + + my $display = $report{display}; + if (!defined $display) { $display = 'table'; } + my $rname = $report{name}; my $query = $report{query}; + my $title = $report{report_title}; my $sth = $dbh->prepare($query); $sth->execute(); my $header_flag = 0; - while (my @row = $sth->fetchrow_array) { + #print asciidoc + if ($display eq 'table') { + while (my @row = $sth->fetchrow_array) { if ($header_flag == 0) { print $fh "\n.*$report{report_title}*\n"; print $fh "|===\n"; @@ -414,11 +432,45 @@ sub print_query { } print $fh "\n"; } - if ($header_flag == 1) { - print $fh "|===\n\n"; - print $fh $report{note}; - print $fh "\n\n"; - } + if ($header_flag == 1) { + print $fh "|===\n\n"; + print $fh $report{note}; + print $fh "\n\n"; + } + } + + #print pie chart + if ($display eq 'pie_chart') { + my @h = split(/\./,$report{heading}); + my @l = split(/\./,$report{chart_labels}); + + print $fh "++++\n"; + print $fh "
\n"; + print $fh "\n"; + print $fh "++++\n"; + } + print "successfully wrote output for $report{name}.\n\n"; }