combine ticket notification scrips, #15353
[freeside.git] / httemplate / elements / popup_link_onclick.html
1 <%doc>
2
3 Example:
4
5   include('/elements/init_overlib.html')
6
7   include( '/elements/popup_link_onclick.html', { #hashref or a list, either way
8
9     #required
10     'action'         => 'content.html', # uri for content of popup
11    
12     #strongly recommended
13     'actionlabel     => 'You clicked',  # popup title
14    
15     #opt
16     'width'          => 540,
17     'height'         => 336,
18     'color'          => '#ff0000',
19     'closetext'      => 'Go Away',      # the value '' removes the link
20
21     #uncommon opt
22     'frame'          => 0, #bool
23     'scrolling'      => 'yes', #scrollbars:
24                                # 'auto' (default if omitted), 'yes' or 'no'.
25     'nofalse'        => 0, #bool, eliminates "return false;"
26
27   } )
28
29 </%doc>
30 % if ($action) { 
31 <% $onclick |n %>\
32 % }
33 <%init>
34
35 my( $action, $actionlabel, $frame ) = ( '', '', '' );
36 my( $width, $height ) = ( 540, 336 );
37 my $closetext = emt('Close');
38 my $color = '#333399';
39 my $scrolling = 'auto';
40
41 my $params;
42 if (ref($_[0]) eq 'HASH') {
43   #$params = { %$params, %{ $_[0] } };
44   $params = shift;
45 } else {
46   #$params = { %$params, @_ };
47   $params = { @_ };
48 }
49
50 $action      = $params->{'action'}      if exists $params->{'action'};
51 $actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'};
52 $width       = $params->{'width'}       if exists $params->{'width'};
53 $height      = $params->{'height'}      if exists $params->{'height'};
54 $color       = $params->{'color'}       if exists $params->{'color'};
55 $closetext   = $params->{'closetext'}   if exists $params->{'closetext'};
56 $frame       = $params->{'frame'}       if exists $params->{'frame'};
57 $scrolling   = $params->{'scrolling'}   if exists $params->{'scrolling'};
58
59 #stupid safari is caching the "location" of popup iframs, and submitting them
60 #instead of displaying them.  this should prevent that.
61 my $popup_name = 'popup-'.time. "-$$-". rand() * 2**32;
62
63 my $onclick =
64   "overlib( OLiframeContent('$action', $width, $height, '$popup_name', 0, '$scrolling' ), ".
65     "CAPTION, '$actionlabel', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, ".
66     "DRAGGABLE, CLOSECLICK, ".
67     "BGCOLOR, '$color', CGCOLOR, '$color', CLOSETEXT, '$closetext'".
68     ( $frame ? ", FRAME, $frame" : '' ).
69   ");";
70   
71 $onclick .= " return false;"
72   unless $params->{'nofalse'};
73
74 </%init>