de-randomization fixes for testing, #37340
[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     #alternately, use instead of action
13     'js_action'      => 'url',          # javascript variable or expression
14    
15     #strongly recommended
16     'actionlabel     => 'You clicked',  # popup title
17    
18     #opt
19     'width'          => 540,
20     'height'         => 336,
21     'color'          => '#ff0000',
22     'closetext'      => 'Go Away',      # the value '' removes the link
23
24     #uncommon opt
25     'frame'          => 0, #bool
26     'scrolling'      => 'yes', #scrollbars:
27                                # 'auto' (default if omitted), 'yes' or 'no'.
28     'nofalse'        => 0, #bool, eliminates "return false;"
29
30   } )
31
32 </%doc>
33 % if ($action) { 
34 <% $onclick |n %>\
35 % }
36 <%init>
37
38 my( $action, $actionlabel, $frame ) = ( '', '', '' );
39 my( $width, $height ) = ( 540, 336 );
40 my $closetext = emt('Close');
41 my $color = '#333399';
42 my $scrolling = 'auto';
43
44 my $params;
45 if (ref($_[0]) eq 'HASH') {
46   #$params = { %$params, %{ $_[0] } };
47   $params = shift;
48 } else {
49   #$params = { %$params, @_ };
50   $params = { @_ };
51 }
52
53 $action      = q(') . $params->{'action'} . q(') if exists $params->{'action'};
54 $action      = $params->{'js_action'}   if exists $params->{'js_action'};
55 $actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'};
56 $width       = $params->{'width'}       if exists $params->{'width'};
57 $height      = $params->{'height'}      if exists $params->{'height'};
58 $color       = $params->{'color'}       if exists $params->{'color'};
59 $closetext   = $params->{'closetext'}   if exists $params->{'closetext'};
60 $frame       = $params->{'frame'}       if exists $params->{'frame'};
61 $scrolling   = $params->{'scrolling'}   if exists $params->{'scrolling'};
62
63 #stupid safari is caching the "location" of popup iframs, and submitting them
64 #instead of displaying them.  this should prevent that.
65 my $popup_name = 'popup-'.random_id();
66
67 my $onclick =
68   "overlib( OLiframeContent($action, $width, $height, '$popup_name', 0, '$scrolling' ), ".
69     "CAPTION, '$actionlabel', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, ".
70     "DRAGGABLE, CLOSECLICK, ".
71     "BGCOLOR, '$color', CGCOLOR, '$color', FGCOLOR, '#f8f8f8', ".
72     "CLOSETEXT, '$closetext'".
73     ( $frame ? ", FRAME, $frame" : '' ).
74   ");";
75   
76 $onclick .= " return false;"
77   unless $params->{'nofalse'};
78
79 </%init>