RT# 82137 - default payment amount now has processing fee in total if processing...
[freeside.git] / httemplate / elements / phonenumber.html
index b1ae2aa..2df5702 100644 (file)
@@ -1,18 +1,73 @@
-<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_iframe.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_draggable.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/iframecontentmws.js"></SCRIPT>
+<% include('/elements/init_overlib.html') %>
 
 % if ( length($number) ) { 
 
-  <% $number %>
+    <% $number %>
 
-%   if ( $opt{'callable'} && $curuser->option('vonage-username') ) { 
+%   if ( $opt{'callable'} ) {
+%
+%     if ( $curuser->option('vonage-username') ) { 
+%
+%       (my $vonage_number = $curuser->option('vonage-fromnumber')) =~ s/\D//g;
+%       $vonage_number =~ /^1/ or $vonage_number = "1$vonage_number";
+
+        <% include('/elements/popup_link.html',
+             'action'      =>
+               'https://secure.click2callu.com/tpcc/makecall'.
+               '?username='. uri_escape($curuser->option('vonage-username')).
+               '&password='. uri_escape($curuser->option('vonage-password')).
+               "&fromnumber=$vonage_number".
+               "&tonumber=$snumber",
+             'width'       => 240,
+             'height'      => 64,
+             'actionlabel' => 'Initiating call',
+             'html_label'  => "<$img>",
+           )
+        %>
+
+%     } elsif ( $curuser->option('snom-ip') ) {
+%
+%       my $host = $curuser->option('snom-ip');
+%       if ( $curuser->option('snom-username') ) {
+%         my $userpass = uri_escape($curuser->option('snom-username'));
+%         $userpass .= ':'. uri_escape($curuser->option('snom-password'))
+%           if $curuser->option('snom-password');
+%         $host = $userpass.'@'.$host;
+%       }
+%
+%       $snumber = "1$snumber" unless $snumber =~ /~1/; #NANPA-centric
+
+%#        <% include('/elements/popup_link.html',
+%#             'action'      => "http://$host/command.htm?number=$snumber",
+%#             %link_common,
+%#           )
+%#        %>
+
+        <A HREF="javascript:snom_call(<%$snumber%>)"><<% $img %>></A>
 
-      <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('https://secure.click2callu.com/tpcc/makecall?username=<% uri_escape($curuser->option('vonage-username')) %>&password=<% uri_escape($curuser->option('vonage-password')) %>&fromnumber=<% uri_escape($curuser->option('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>
+        <SCRIPT TYPE="text/javascript">
+          function snom_call(number) {
 
+            var url = '<% "http://$host/command.htm?number=" %>';
+            url = url + number;
+
+            var xmlhttp = new XMLHttpRequest();
+            xmlhttp.open('GET', url, true);
+            xmlhttp.send(null);
+
+          }
+
+        </SCRIPT>
+
+
+%     }
+%
 %   } 
 %
+%   if ( $opt{'calling_list_exempt'} ) {
+ - calling list exempt
+%   }
+%
 % } else { 
 
   &nbsp;
@@ -25,7 +80,6 @@ my( $number, %opt ) = @_;
 
 my $curuser = $FS::CurrentUser::CurrentUser;
 
-( my $vonage_number = $curuser->option('vonage-fromnumber') ) =~ s/\D//g;
-$vonage_number =~ /^1/ or $vonage_number = "1$vonage_number";
+my $img = qq(IMG SRC="${fsurl}images/red_telephone_mimooh_01.png" BORDER=0 ALT="Call this number");
 
 </%init>