componentize conflicting %once subroutines (rt#3250)
[freeside.git] / httemplate / elements / popup_link.html
1 <%doc>
2
3 Example:
4
5   <SCRIPT TYPE="text/javascript" SRC="overlibmws.js"></SCRIPT>
6   <SCRIPT TYPE="text/javascript" SRC="iframecontentmws.js"></SCRIPT>
7
8   include( '/elements/popup_link.html', {
9
10     #required
11     'action'         => 'content.html', # uri for content of popup
12     'label'          => 'click me',     # text of <A> tag
13    
14     #strongly recommended
15     'actionlabel     => 'You clicked',  # popup title
16    
17     #opt
18     'width'          => '540',
19     'color'          => '#ff0000',
20     'closetext'      => 'Go Away',      # the value '' removes the link
21   )
22
23 </%doc>
24 <%init>
25 my($params, $action, $label, $actionlabel, $width, $color);
26 my $closetext = 'Close';
27 if (ref(@_[0]) eq 'HASH') {
28   $params = shift;
29   foreach (qw(action label actionlabel width color)) {
30     $action      = $params->{'action'}      if exists $params->{'action'};
31     $label       = $params->{'label'}       if exists $params->{'label'};
32     $actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'};
33     $width       = $params->{'width'}       if exists $params->{'width'};
34     $color       = $params->{'color'}       if exists $params->{'color'};
35     $closetext   = $params->{'closetext'}   if exists $params->{'closetext'};
36   }
37 }else{  # deprecated
38   ($action, $label, $actionlabel, $width) = @_;
39 }
40
41 $width ||= 540;
42 $color ||= '#333399';
43
44 </%init>
45 %if ($action && $label) {
46 <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<% "$action" %>', <% $width %>, 336, 'pkg_or_svc_action_popup' ), CAPTION, '<% $actionlabel %>', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '<% $color %>', CGCOLOR, '<% $color %>', CLOSETEXT, '<% $closetext %>' ); return false;"><% $label %></A>
47 %}