add vonage click2call feature
[freeside.git] / httemplate / elements / phonenumber.html
1 <%
2   my( $number, %opt ) = @_;
3   my $conf = new FS::Conf;
4   ( my $snumber = $number ) =~ s/\D//g;
5 %>
6 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
7 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
8 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_draggable.js"></SCRIPT>
9 <SCRIPT TYPE="text/javascript">
10 function OLiframeContent(src, width, height, name) {
11   return ('<iframe src="'+src+'" width="'+width+'" height="'+height+'"'
12    +(name?' name="'+name+'" id="'+name+'"':'')+' scrolling="auto">'
13    +'<div>[iframe not supported]</div></iframe>');
14 }
15 </SCRIPT>
16 <% if ( length($number) ) { %>
17   <%= $number %>
18   <% if ( $opt{'callable'} && $conf->config('vonage-username') ) { %>
19       <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('https://secure.click2callu.com/tpcc/makecall?username=<%= $conf->config('vonage-username') %>&password=<%= $conf->config('vonage-password') %>&fromnumber=<%= $conf->config('vonage-fromnumber')%>&tonumber=1<%= $snumber %>', 240, 64, 'call_popup'), CAPTION, 'Initiating call', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE, WIDTH, 240, HEIGHT, 64 ); return false;" TITLE="Call this number"><IMG SRC="<%=$fsurl%>images/red_telephone_mimooh_01.png" BORDER=0 ALT="Call this number"></A>
20   <% } %>
21 <% } else { %>
22   &nbsp;
23 <% } %>