allow exports to add links to customer view (#1407)
authorjeff <jeff>
Wed, 12 Mar 2008 16:24:34 +0000 (16:24 +0000)
committerjeff <jeff>
Wed, 12 Mar 2008 16:24:34 +0000 (16:24 +0000)
FS/FS/UI/Web.pm
FS/FS/cust_svc.pm
FS/FS/part_export.pm
FS/FS/part_export/prizm.pm
FS/FS/svc_Common.pm
eg/export_template.pm
httemplate/view/cust_main/packages.html

index 6a97f96..e4a9ac1 100644 (file)
@@ -149,6 +149,14 @@ sub svc_X_link {
   "$ahref$x</A>";
 }
 
+sub svc_export_links {
+  my ($m, $part_svc, $cust_svc) = @_ or return '';
+
+  my $ahref = $cust_svc->export_links;
+
+  join('', @$ahref);
+}
+
 sub parse_lt_gt {
   my($cgi, $field) = @_;
 
index 8eecda3..51fc186 100644 (file)
@@ -392,6 +392,20 @@ sub _svc_label {
 
 }
 
+=item export_links
+
+Returns a list of html elements associated with this services exports.
+
+=cut
+
+sub export_links {
+  my $self = shift;
+  my $svc_x = $self->svc_x
+    or return "can't find ". $self->part_svc->svcdb. '.svcnum '. $self->svcnum;
+
+  $svc_x->export_links;
+}
+
 =item svc_x
 
 Returns the FS::svc_XXX object for this service (i.e. an FS::svc_acct object or
index 6adcab9..983e0b0 100644 (file)
@@ -359,6 +359,14 @@ sub _export_unsuspend {
   $self->_export_replace( $svc_x, $old );
 }
 
+=item export_links SVC_OBJECT ARRAYREF
+
+Adds a list of web elements to ARRAYREF specific to this export and SVC_OBJECT.
+The elements are displayed in the UI to lead the the operator to external
+configuration, monitoring, and similar tools.
+
+=cut
+
 =back
 
 =head1 SUBROUTINES
index 3ba1b27..754d428 100644 (file)
@@ -463,6 +463,14 @@ sub _export_unsuspend {
   '';
 }
 
+sub export_links {
+  my( $self, $svc, $arrayref ) = ( shift, shift, shift );
+
+  push @$arrayref, '<A HREF="http://'. $svc->ip_addr. '">SM</A>';
+
+  '';
+}
+
 sub queue_statuschange {
   my( $self, $method, $jobs, $svc, @args ) = @_;
 
index 787acee..d830f2f 100644 (file)
@@ -708,6 +708,19 @@ sub unsuspend {
   $self->export('unsuspend', @$export_args);
 }
 
+=item export_links
+
+Runs export_links callbacks and returns the links.
+
+=cut
+
+sub export_links {
+  my $self = shift;
+  my $return = [];
+  $self->export('links', $return);
+  $return;
+}
+
 =item export HOOK [ EXPORT_ARGS ]
 
 Runs the provided export hook (i.e. "suspend", "unsuspend") for this service.
index 2830ce3..22eb36a 100644 (file)
@@ -56,7 +56,7 @@ sub _export_delete {
   ref($err_or_queue) ? '' : $err_or_queue;
 }
 
-#these two are optional
+#these three are optional
 # fallback for svc_acct will change and restore password
 sub _export_suspend {
   my( $self, $svc_something ) = (shift, shift);
@@ -72,6 +72,13 @@ sub _export_unsuspend {
   ref($err_or_queue) ? '' : $err_or_queue;
 }
 
+sub export_links {
+  my($self, $svc_something, $arrayref) = (shift, shift, shift);
+  #push @$arrayref, qq!<A HREF="http://example.com/~!. $svc_something->username.
+  #                 qq!">!. $svc_something->username. qq!</A>!;
+  '';
+}
+
 ###
 
 #a good idea to queue anything that could fail or take any time
index 167c625..891fa30 100755 (executable)
@@ -299,10 +299,11 @@ Current packages
       <TR>
         <TD ALIGN="right" VALIGN="top"><% FS::UI::Web::svc_link($m, $part_svc, $cust_svc) %></TD>
         <TD STYLE="padding-bottom:0px"><B><% FS::UI::Web::svc_label_link($m, $part_svc, $cust_svc) %></B></TD>
+        <TD><% FS::UI::Web::svc_export_links($m, $part_svc, $cust_svc) %></TD>
       </TR>
 
       <TR>
-        <TD ALIGN="right" COLSPAN="2" VALIGN="top" STYLE="padding-bottom:1px;padding-top:0px"><FONT SIZE="-2" COLOR="#FFD000">
+        <TD ALIGN="right" COLSPAN="3" VALIGN="top" STYLE="padding-bottom:1px;padding-top:0px"><FONT SIZE="-2" COLOR="#FFD000">
 
             <% $cust_svc->overlimit ? "Overlimit: ". time2str('%b %o %Y' . ($conf->exists('cust_pkg-display_times') ? ' %l:%M %P' : ''), $cust_svc->overlimit) : '' %>
           </FONT></TD>
@@ -338,7 +339,7 @@ Current packages
 %      ) {
 
       <TR>
-        <TD COLSPAN=2 ALIGN="center" STYLE="padding-bottom:4px;padding-top:0px">
+        <TD COLSPAN=3 ALIGN="center" STYLE="padding-bottom:4px;padding-top:0px">
           <B><% svc_provision_link($cust_pkg, $part_svc, $conf, $curuser) %></B>
         </TD>
       </TR>