File: _Stats.pl

package info (click to toggle)
piwi 0.8%2B20041206-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, jessie, jessie-kfreebsd, lenny, sarge, squeeze, wheezy
  • size: 1,076 kB
  • ctags: 162
  • sloc: perl: 5,425; makefile: 49; xml: 49
file content (66 lines) | stat: -rw-r--r-- 1,821 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
sub TimePeriodType_List()
{
	my %Types = ();
	%Types = (%Types, 'YYYY-MM-DD', 'Date' );
	%Types = (%Types, 'YYYY-MM', 'Year+Month' );
	%Types = (%Types, 'YYYY', 'Year' );
	%Types = (%Types, 'MM', 'Month' );
	%Types = (%Types, 'DD', 'Month Day' );
	%Types = (%Types, 'HH', 'Hour' );

	foreach my $Type ( 'YYYY-MM-DD', 'YYYY-MM', 'YYYY', 'MM', 'DD', 'HH' )
	{
		my $checked = '';
		if ( $Type eq $cgi->param( 'TimePeriodType' ) ) {$checked = ' checked';};
		print "<input type=radio name=\"TimePeriodType\" value=\"".$Type."\"".$checked.'> ';
		print $Types{$Type}.' ('.$Type.")<br>\n";
	}
}

sub OutputType_List()
{
	my @Types = ();

	if ( $cgi->param( 'backend' ) eq 'HTML' )
	{
		@Types = ( @Types, 'text/html', 'HTML table' );
	}

	if ( $cgi->param( 'backend' ) eq 'GD' )
	{
		if ( ! defined( $miss{'GD::Graph'} ) ) {$miss{'GD::Graph'} = 0;};
		if ( ! defined( $miss{'GD::Graph3d'} ) ) {$miss{'GD::Graph3d'} = 0;};

		if ( ! $miss{'GD::Graph'} )
		{
			@Types = ( @Types, 'png/pie', 'pie chart' );
			@Types = ( @Types, 'png/lines', 'lines' );
			@Types = ( @Types, 'png/area', 'areas' );
			@Types = ( @Types, 'png/bars', 'vertical bars' );
			@Types = ( @Types, 'png/hbars', 'horizontal bars' );

			if (!$miss{'GD::Graph3d'})
			{
				@Types = ( @Types, 'png/lines3d', '3d lines' );
				@Types = ( @Types, 'png/bars3d', '3d vertical bars' );
			}
		}
	}

	if ( $cgi->param( 'backend' ) eq 'PS' )
	{
		@Types = ( @Types, 'png/pie', 'pie chart' );
		@Types = ( @Types, 'png/bars', 'vertical bars' );
	}

	if ( ! $cgi->param( 'OutputType' ) ) {$cgi->param( 'OutputType', $Types[0] );};

	for( my $i = 0 ; $i <= ( $#Types / 2 ) ; $i ++ )
	{
		my $selected = '';
		if ( $Types[$i*2] eq $cgi->param( 'OutputType' )) {$selected = ' selected';};
		print "<option value=\"$Types[$i*2]\"$selected> $Types[$i*2+1]\n";
	}
}

1;