clean up overlib usage for customer notes
[freeside.git] / httemplate / elements / popup_link_onclick.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_onclick.html', { #hashref or a list, either way
9
10     #required
11     'action'         => 'content.html', # uri for content of popup
12    
13     #strongly recommended
14     'actionlabel     => 'You clicked',  # popup title
15    
16     #opt
17     'width'          => '540',
18     'color'          => '#ff0000',
19     'closetext'      => 'Go Away',      # the value '' removes the link
20   } )
21
22 </%doc>
23 % if ($action) { 
24 <% $onclick %>\
25 % }
26 <%init>
27
28 my( $action, $actionlabel, $frame ) = ( '', '', '' );
29 my( $width, $height ) = ( 540, 336 );
30 my $closetext = 'Close';
31 my $color = '#333399';
32
33 my $params;
34 if (ref($_[0]) eq 'HASH') {
35   #$params = { %$params, %{ $_[0] } };
36   $params = shift;
37 } else {
38   #$params = { %$params, @_ };
39   $params = { @_ };
40 }
41
42 $action      = $params->{'action'}      if exists $params->{'action'};
43 $actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'};
44 $width       = $params->{'width'}       if exists $params->{'width'};
45 $height      = $params->{'height'}      if exists $params->{'height'};
46 $color       = $params->{'color'}       if exists $params->{'color'};
47 $closetext   = $params->{'closetext'}   if exists $params->{'closetext'};
48 $frame       = $params->{'frame'}       if exists $params->{'frame'};
49
50 #stupid safari is caching the "location" of popup iframs, and submitting them
51 #instead of displaying them.  this should prevent that.
52 my $popup_name = 'popup-'.time. "-$$-". rand() * 2**32;
53
54 my $onclick =
55   "overlib( OLiframeContent('$action', $width, $height, '$popup_name' ), ".
56     "CAPTION, '$actionlabel', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, ".
57     "DRAGGABLE, CLOSECLICK, ".
58     "BGCOLOR, '$color', CGCOLOR, '$color', CLOSETEXT, '$closetext'".
59     ( $frame ? ", FRAME, $frame" : '' ).
60   "); return false;";
61
62 </%init>