clean up popup link elements a bit, have the iframe name autogenerate to work around...
[freeside.git] / httemplate / elements / popup_link-cust_svc.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/svc_popup_link.html', { #hashref or a list, either way
9
10     #required
11     'action'         => 'content.html', # uri for content of popup which should
12                                         # be suitable for appending '?svcnum='
13     'label'          => 'click me',     # text of <A> tag
14     'cust_svc'       => $cust_svc       # a FS::cust_svc object
15    
16     #strongly recommended (you want a title, right?)
17     'actionlabel     => 'You clicked',  # popup title
18    
19     #opt
20     'width'          => '540',
21     'color'          => '#ff0000',
22     'closetext'      => 'Go Away',      # the value '' removes the link
23   )
24
25 </%doc>
26 % if ( $params->{'cust_svc'} ) {
27 <% include( '/elements/popup_link.html', $params ) %>\
28 % }
29 <%init>
30
31 my $params = { 'closetext' => 'Close',
32                'width'     => 392,
33              };
34
35 if (ref($_[0]) eq 'HASH') {
36   $params = { %$params, %{ $_[0] } };
37 } else {
38   $params = { %$params, @_ };
39 }
40
41 $params->{'action'} .=
42   ( $params->{'action'} =~ /\?/ ? ';' : '?' ).
43   'svcnum='. $params->{'cust_svc'}->svcnum;
44
45 $params->{'actionlabel'} .=
46   ' service '. $params->{'cust_svc'}->svcnum; #XXX svcnum? really?
47
48 </%init>