File: OptBlock.pm

package info (click to toggle)
sporum 1.8b1-3.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,108 kB
  • ctags: 676
  • sloc: perl: 14,300; makefile: 52
file content (67 lines) | stat: -rw-r--r-- 1,437 bytes parent folder | download
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
67
package Templates::Admin::OptBlock;

use SmallPigVars qw($config);
use SmallPig;

use CGI qw(:standard :cgi-lib);
use strict;

my %params =
(
 'title' => "",
 'content' => "",
 'width' => "",
 'space' => "",
 'restrshow' => "",
 'bdrcolor' => "",
 'bgcolor' => ""
);

sub new{
  # --- block constructor...
  my ($class, $classvars, $theme) = @_;
  my %self = ();

  $self{width} = $theme->{'intblwidth'};
  $self{bdrcolor} = $theme->{'dhdrcolor'};
  $self{bgcolor} = $theme->{'boxbgcolor'};
  $self{theme} = $theme;
  
  foreach (keys(%params)){
    $self{$_} = $classvars->{$_} if $classvars->{$_};
  }

  return bless \%self, $class;
}

sub get{
  my $self = shift;
  my ($space, $width, $title, $bdrcolor, $bgcolor, $content, $theme) = 
    map { $self->{$_} } 
  qw(space width title bdrcolor bgcolor content theme);

  my $ret = qq|
$space<!--opt_block--><div align=$theme->{'intblalign'}>
<TABLE BORDER="0" CELLSPACING="$theme->{'tblcellspacing'}" 
	      CELLPADDING="$theme->{'tblcellpadding'}" BGCOLOR="$bdrcolor" 
		  WIDTH="$width">
		      <tr><td>
			  <table border="0" cellspacing="$theme->{'intblcsp'}" cellpadding="$theme->{'intblcp'}" width="100%" bgcolor="$bgcolor">
			      <tr>
				  <td bgcolor="$bdrcolor" align="center" class="bheader1">
				      $title
					  </td></tr>
    $content
    </TABLE>
    </TD>
   </TR>
</TABLE></div>
  |;

  return $ret;
}

sub display{
  my $self = shift;
  print get($self);
}