4.x style
[freeside.git] / httemplate / elements / popup_link.html
1 <%doc>
2
3 Example:
4
5   <& /elements/init_overlib.html &>
6
7   <& /elements/popup_link.html', { #hashref or a list, either way is fine
8
9     #required
10     'action'         => 'content.html', # uri for content of popup
11     'label'          => 'click me',     # text of <A> tag
12    
13     #strongly recommended
14     'actionlabel'    => 'You clicked',  # popup title
15    
16     #opt
17     'width'          => 540,
18     'height'         => 336,
19     'color'          => '#ff0000',
20     'closetext'      => 'Go Away',      # the value '' removes the link
21     'title'          => 'Hover Text',
22
23     #uncommon opt
24     'aname'          => "target", # link NAME= value, useful for #targets
25     'target'         => '_parent',
26     'style'          => 'css-attribute:value',
27     'html_label'     => '<IMG SRC="something.png">',  # overrides label
28   }
29   &>
30
31 </%doc>
32 % if ($params->{'action'} && $label) {
33 <A HREF="javascript:void(0);"
34    onClick="<% $onclick |n %>"
35    <% $params->{'title'}  ? 'TITLE="' . $params->{'title'}.  '"' : '' |n %>
36    <% $params->{'aname'}  ? 'NAME="'.   $params->{'aname'}.  '"' : '' |n %>
37    <% $params->{'target'} ? 'TARGET="'. $params->{'target'}. '"' : '' |n %>
38    <% $params->{'style'}  ? 'STYLE="'.  $params->{'style'}.  '"' : '' |n %>
39 ><% $label %></A>\
40 % }
41 <%init>
42
43 my $params;
44 if (ref($_[0]) eq 'HASH') {
45   #$params = { %$params, %{ $_[0] } };
46   $params = shift;
47 } else {
48   #$params = { %$params, @_ };
49   $params = { @_ };
50 }
51
52 my $label = $params->{'label'};
53 $label = encode_entities($label);
54 $label =~ s/ /&nbsp;/g;
55 $label = $params->{'html_label'} || $label;
56 my $onclick = include('/elements/popup_link_onclick.html', $params);
57
58 </%init>