[freeside-commits] branch master updated. 3a8fa4f27ef08792e3d653cee167979a411f89d1
Jonathan Prykop
jonathan at 420.am
Thu Jan 22 13:56:56 PST 2015
The branch, master has been updated
via 3a8fa4f27ef08792e3d653cee167979a411f89d1 (commit)
via 3e6a3208775540e39f590ebbc643826ddb4c82b8 (commit)
from 786cc8367ea7c504a762eb698ae4f93fc76b0dc1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3a8fa4f27ef08792e3d653cee167979a411f89d1
Merge: 3e6a320 786cc83
Author: Jonathan Prykop <jonathan at freeside.biz>
Date: Thu Jan 22 15:52:26 2015 -0600
Merge branch 'master' of git.freeside.biz:/home/git/freeside
commit 3e6a3208775540e39f590ebbc643826ddb4c82b8
Author: Jonathan Prykop <jonathan at freeside.biz>
Date: Thu Jan 22 15:51:11 2015 -0600
30392, refactored manage devices link, added it to broadband service page
diff --git a/httemplate/elements/manage_device_link.html b/httemplate/elements/manage_device_link.html
new file mode 100644
index 0000000..76a3cdf
--- /dev/null
+++ b/httemplate/elements/manage_device_link.html
@@ -0,0 +1,46 @@
+<%doc>
+
+#For including the "Manage Device" link for broadband svc
+# Handles check if svcdb is svc_broadband, ip_addr/mac_addr substitution
+# and manage_link-new_window, but manage_link_loc and no_links must
+# be checked as appropriate before including this
+
+#Example:
+
+ <& /elements/manage_device_link.html,
+ 'svc' => $svc_x,
+ 'part_svc' => $part_svc,
+ 'manage_link' => scalar($conf->config('svc_broadband-manage_link')),
+ 'manage_link_text' => scalar($conf->config('svc_broadband-manage_link_text')),
+ 'manage_link-new_window' => $conf->exists('svc_broadband-manage_link-new_window'),
+ 'prepend' => ' ( ',
+ 'append' => ' ) '
+ &>
+
+</%doc>
+% if ($manage_link) {
+<% $startdec %><A HREF="<% $manage_link %>"<% $manage_target %>><% $manage_link_text |h %></A><% $enddec %>
+% }
+<%init>
+
+my %opt = @_;
+my $manage_link = '';
+my $manage_link_text = '';
+my $manage_target = '';
+my $startdec = '';
+my $enddec = '';
+
+if ( $opt{'part_svc'} and $opt{'svc'} and $opt{'manage_link'} and $opt{'part_svc'}->svcdb eq 'svc_broadband' ) {
+ my $ip_addr = $opt{'svc'}->ip_addr || ''; #substitution for $manage_link
+ my $mac_addr = $opt{'svc'}->mac_addr || ''; # ditto
+ $manage_link = $opt{'manage_link'};
+ $manage_link =~ s/\$ip_addr/$ip_addr/g; #safer than using eval
+ $manage_link =~ s/\$mac_addr/$mac_addr/g; # ditto
+ $manage_link_text = $opt{'manage_link_text'} || mt('Manage Device');
+ $manage_target = ' target="_blank"' if $opt{'manage_link-new_window'};
+ $startdec = $opt{'prepend'};
+ $enddec = $opt{'append'};
+}
+
+</%init>
+
diff --git a/httemplate/elements/tr-cust_svc.html b/httemplate/elements/tr-cust_svc.html
index cc5ec0f..03de3ba 100644
--- a/httemplate/elements/tr-cust_svc.html
+++ b/httemplate/elements/tr-cust_svc.html
@@ -43,8 +43,14 @@ Usage:
% }
</TD>
<TD ALIGN="right"><% FS::UI::Web::svc_export_links($m, $part_svc, $cust_svc) %>
-% if ( $manage_link and $opt{'manage_link_loc'} eq 'right' && ! $opt{no_links} ) {
- <A HREF="<% $manage_link %>" <% $manage_target %>><% $opt{'manage_link_text'} |h %></A>
+% if ( $opt{'manage_link_loc'} eq 'right' && ! $opt{no_links} ) {
+<& /elements/manage_device_link.html,
+ 'svc' => $svc_x,
+ 'part_svc' => $opt{'part_svc'} || $cust_svc->part_svc,
+ 'manage_link' => $opt{'manage_link'},
+ 'manage_link_text' => $opt{'manage_link_text'},
+ 'manage_link-new_window' => $opt{'manage_link-new_window'}
+&>
% }
</TD>
</TR>
@@ -90,8 +96,16 @@ $cust_svc->overlimit )
include('/elements/popup_link-ping.html',
'ip' => $svc_x->ip_addr
) %> )</FONT>
-% if ( $manage_link and $opt{'manage_link_loc'} eq 'bottom' && ! $opt{no_links} ) {
- <FONT SIZE="-2">( <A HREF="<% $manage_link %>" <% $manage_target %>><% $opt{'manage_link_text'} |h %></A> )</FONT>
+% if ( $opt{'manage_link_loc'} eq 'bottom' && ! $opt{no_links} ) {
+<& /elements/manage_device_link.html,
+ 'svc' => $svc_x,
+ 'part_svc' => $opt{'part_svc'} || $cust_svc->part_svc,
+ 'manage_link' => $opt{'manage_link'},
+ 'manage_link_text' => $opt{'manage_link_text'},
+ 'manage_link-new_window' => $opt{'manage_link-new_window'},
+ 'prepend' => '<FONT SIZE="-2">( ',
+ 'append' => ' )</FONT>'
+&>
% }
% } #svc_broadband
% if ( $curuser->access_right('Unprovision customer service') && ! $opt{no_links} ) {
@@ -114,18 +128,6 @@ my $svc_unprovision_link =
$cust_svc->svcnum .
qq!', '!.emt('Permanently unprovision and delete this service?').qq!')">!.emt('Unprovision').'</A>';
-my $manage_link = $opt{'manage_link'};
-my $manage_target = '';
-if ( $part_svc->svcdb eq 'svc_broadband' and $manage_link ) {
- my $ip_addr = $svc_x->ip_addr; #substitution for $manage_link
- my $mac_addr = $svc_x->mac_addr; # ditto
- $manage_link = eval(qq("$manage_link"));
- $opt{'manage_link_text'} ||= mt('Manage Device');
- $opt{'manage_link_loc'} ||= 'bottom';
- $manage_target = ' target="_blank"' if $opt{'manage_link-new_window'};
-}
-else {
- $manage_link = '';
-}
+$opt{'manage_link_loc'} ||= 'bottom';
</%init>
diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html
index b7f7a2c..d7a1dcf 100644
--- a/httemplate/view/elements/svc_Common.html
+++ b/httemplate/view/elements/svc_Common.html
@@ -22,6 +22,11 @@
#at the very bottom (well, as low as you can go from here)
'html_foot' => '',
+ #only needed for svc_broadband Manage Devices link
+ 'manage_link' => scalar($conf->config('svc_broadband-manage_link')),
+ 'manage_link_text' => scalar($conf->config('svc_broadband-manage_link_text')),
+ 'manage_link-new_window' => $conf->exists('svc_broadband-manage_link-new_window')
+
)
</%doc>
@@ -70,7 +75,11 @@ function areyousure(href) {
<% mt('Service #') |h %><B><% $svcnum %></B>
% if ( $custnum ) {
% my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?';
-<& /view/elements/svc_edit_link.html, 'svc' => $svc_x, 'edit_url' => $url &>
+<& /view/elements/svc_edit_link.html, 'svc' => $svc_x, 'part_svc' => $part_svc, 'edit_url' => $url,
+ 'manage_link' => $opt{'manage_link'},
+ 'manage_link_text' => $opt{'manage_link_text'},
+ 'manage_link-new_window' => $opt{'manage_link-new_window'}
+&>
% }
<BR>
@@ -222,7 +231,6 @@ my $format_field = sub {
$field = $f;
$type = 'text';
}
- warn "$field\t$type\t$value\n";
my $columndef = $part_svc->part_svc_column($field);
# skip fields that are fixed and empty
diff --git a/httemplate/view/elements/svc_edit_link.html b/httemplate/view/elements/svc_edit_link.html
index 5438ed2..3ff2f58 100644
--- a/httemplate/view/elements/svc_edit_link.html
+++ b/httemplate/view/elements/svc_edit_link.html
@@ -14,6 +14,14 @@ function areyousure_delete() {
| <A HREF="javascript:areyousure_delete()"><% mt('Unprovision this Service') |h %></A>
% }
% }
+<& /elements/manage_device_link.html,
+ 'svc' => $svc_x,
+ 'part_svc' => $opt{'part_svc'} || $cust_svc->part_svc,
+ 'manage_link' => $opt{'manage_link'},
+ 'manage_link_text' => $opt{'manage_link_text'},
+ 'manage_link-new_window' => $opt{'manage_link-new_window'},
+ 'prepend' => '| '
+&>
<%init>
my %opt = @_;
my $svc_x = $opt{'svc'} or die "'svc' required";
diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi
index ec73c6d..70c0b53 100644
--- a/httemplate/view/svc_broadband.cgi
+++ b/httemplate/view/svc_broadband.cgi
@@ -4,6 +4,9 @@
fields => \@fields,
svc_callback => \&svc_callback,
radius_usage => 1,
+ 'manage_link' => scalar($conf->config('svc_broadband-manage_link')),
+ 'manage_link_text' => scalar($conf->config('svc_broadband-manage_link_text')),
+ 'manage_link-new_window' => $conf->exists('svc_broadband-manage_link-new_window')
&>
<%init>
-----------------------------------------------------------------------
Summary of changes:
httemplate/elements/manage_device_link.html | 46 +++++++++++++++++++++++++++
httemplate/elements/tr-cust_svc.html | 36 +++++++++++----------
httemplate/view/elements/svc_Common.html | 12 +++++--
httemplate/view/elements/svc_edit_link.html | 8 +++++
httemplate/view/svc_broadband.cgi | 3 ++
5 files changed, 86 insertions(+), 19 deletions(-)
create mode 100644 httemplate/elements/manage_device_link.html
More information about the freeside-commits
mailing list