add vonage click2call feature
authorivan <ivan>
Wed, 22 Feb 2006 13:07:48 +0000 (13:07 +0000)
committerivan <ivan>
Wed, 22 Feb 2006 13:07:48 +0000 (13:07 +0000)
FS/FS/Conf.pm
httemplate/elements/phonenumber.html [new file with mode: 0644]
httemplate/images/red_telephone_mimooh_01.png [new file with mode: 0644]
httemplate/view/cust_main/contacts.html

index 88dbdf0..a5add28 100644 (file)
@@ -1661,6 +1661,26 @@ httemplate/docs/config.html
     'type'        => 'checkbox',
   },
 
+  #these should become per-user...
+  {
+    'key'         => 'vonage-username',
+    'section'     => '',
+    'description' => 'Vonage Click2Call username (see <a href="https://secure.click2callu.com/">https://secure.click2callu.com/</a>)',
+    'type'        => 'text',
+  },
+  {
+    'key'         => 'vonage-password',
+    'section'     => '',
+    'description' => 'Vonage Click2Call username (see <a href="https://secure.click2callu.com/">https://secure.click2callu.com/</a>)',
+    'type'        => 'text',
+  },
+  {
+    'key'         => 'vonage-fromnumber',
+    'section'     => '',
+    'description' => 'Vonage Click2Call number (see <a href="https://secure.click2callu.com/">https://secure.click2callu.com/</a>)',
+    'type'        => 'text',
+  },
+
 );
 
 1;
diff --git a/httemplate/elements/phonenumber.html b/httemplate/elements/phonenumber.html
new file mode 100644 (file)
index 0000000..1330ca1
--- /dev/null
@@ -0,0 +1,23 @@
+<%
+  my( $number, %opt ) = @_;
+  my $conf = new FS::Conf;
+  ( my $snumber = $number ) =~ s/\D//g;
+%>
+<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
+<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
+<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_draggable.js"></SCRIPT>
+<SCRIPT TYPE="text/javascript">
+function OLiframeContent(src, width, height, name) {
+  return ('<iframe src="'+src+'" width="'+width+'" height="'+height+'"'
+   +(name?' name="'+name+'" id="'+name+'"':'')+' scrolling="auto">'
+   +'<div>[iframe not supported]</div></iframe>');
+}
+</SCRIPT>
+<% if ( length($number) ) { %>
+  <%= $number %>
+  <% if ( $opt{'callable'} && $conf->config('vonage-username') ) { %>
+      <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>
+  <% } %>
+<% } else { %>
+  &nbsp;
+<% } %>
diff --git a/httemplate/images/red_telephone_mimooh_01.png b/httemplate/images/red_telephone_mimooh_01.png
new file mode 100644 (file)
index 0000000..2212ff0
Binary files /dev/null and b/httemplate/images/red_telephone_mimooh_01.png differ
index 456d117..89926ea 100644 (file)
@@ -51,14 +51,22 @@ Billing address
 %>
 <TR>
   <TD ALIGN="right"><%= $daytime_label %></TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff">
-    <%= $cust_main->daytime || '&nbsp' %>
+  <TD COLSPAN=6 BGCOLOR="#ffffff">
+    <%= include('/elements/phonenumber.html',
+                  $cust_main->daytime,
+                  'callable'=>1
+               )
+    %>
   </TD>
 </TR>
 <TR>
   <TD ALIGN="right"><%= $night_label %></TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff">
-    <%= $cust_main->night || '&nbsp' %>
+  <TD COLSPAN=6 BGCOLOR="#ffffff">
+    <%= include('/elements/phonenumber.html',
+                  $cust_main->night,
+                  'callable'=>1
+               )
+    %>
   </TD>
 </TR>
 <TR>
@@ -111,13 +119,21 @@ Service address
 <TR>
   <TD ALIGN="right"><%= $daytime_label %></TD>
   <TD COLSPAN=5 BGCOLOR="#ffffff">
-    <%= $cust_main->get("${pre}daytime") || '&nbsp' %>
+    <%= include('/elements/phonenumber.html',
+                  $cust_main->get("${pre}daytime"),
+                  'callable'=>1
+               )
+    %>
   </TD>
 </TR>
 <TR>
   <TD ALIGN="right"><%= $night_label %></TD>
   <TD COLSPAN=5 BGCOLOR="#ffffff">
-    <%= $cust_main->get("${pre}night") || '&nbsp' %>
+    <%= include('/elements/phonenumber.html',
+                  $cust_main->get("${pre}night"),
+                  'callable'=>1
+               )
+    %>
   </TD>
 </TR>
 <TR>