Repository navigation
Expand file tree
/
Copy pathInfo.pm
More file actions
149 lines (94 loc) · 2.67 KB
/
Copy pathInfo.pm
File metadata and controls
149 lines (94 loc) · 2.67 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package WebComponent::Info;
# Info - component for a collapsable info field
use strict;
use warnings;
use WebConfig;
use base qw( WebComponent );
1;
=pod
=head1 NAME
Info - component for a collapsable info field
=head1 DESCRIPTION
WebComponent for a collapsable info field
=head1 METHODS
=over 4
=item * B<new> ()
Called when the object is initialized. Expands SUPER::new.
=cut
sub new {
my $self = shift->SUPER::new(@_);
$self->{content} = "";
$self->{width} = "70%";
$self->{default} = 1;
$self->{title} = undef;
return $self;
}
=item * B<output> ()
Returns the html output of the Info component.
=cut
sub output {
my ($self) = @_;
my $class_1 = "info_button_show";
my $class_2 = "info_show";
unless ($self->default()) {
$class_1 = "info_button_hide";
$class_2 = "info_hide";
}
my $title = '';
if (defined($self->title)) {
$title = "<td style='padding-top: 3px;padding-right: 2px;'>" . $self->title . "</td>";
}
my $info = qq~<div style="width: ~ . $self->width() . qq~; padding: 0px; margin-bottom: 5px;"><table class="info"><tr><td class='info'><div onclick="info_field('~ . $self->id() . qq~');" id="info_button_~ . $self->id() . qq~" class="$class_1"><img src='~.IMAGES.qq~wac_infobulb.png'></div></td><td class='info'><div id="info_~ . $self->id() . qq~" class="$class_2">~ . $self->content() . qq~</div></td>~ . $title . qq~</tr></table></div>~;
return $info;
}
=item * B<width> (I<width>)
Getter / Setter for the width attribute.
This determines the width of the component as used by the css width attribute.
=cut
sub width {
my ($self, $width) = @_;
if (defined($width)) {
$self->{width} = $width;
}
return $self->{width};
}
=item * B<content> (I<content>)
Getter / Setter for the content attribute.
This determines the content of the component.
=cut
sub content {
my ($self, $content) = @_;
if (defined($content)) {
$self->{content} = $content;
}
return $self->{content};
}
=item * B<default> (I<default>)
Getter / Setter for the default attribute.
This determines whether the info component is initially expanded or collapsed.
=cut
sub default {
my ($self, $default) = @_;
if (defined($default)) {
$self->{default} = $default;
}
return $self->{default};
}
=item * B<title> (I<title>)
Getter / Setter for the title attribute.
This determines whether the info component will have a title to the right of it
when collapsed.
=cut
sub title {
my ($self, $title) = @_;
if (defined($title)) {
$self->{title} = $title;
}
return $self->{title};
}
sub require_css {
return "$Conf::cgi_url/Html/Info.css";
}
sub require_javascript {
return ["$Conf::cgi_url/Html/Info.js"];
}