diff options
Diffstat (limited to 'httemplate')
| -rw-r--r-- | httemplate/edit/part_device.html | 30 | ||||
| -rw-r--r-- | httemplate/edit/process/part_device.html | 4 | ||||
| -rw-r--r-- | httemplate/elements/checkboxes-table.html | 2 | ||||
| -rw-r--r-- | httemplate/misc/phone_device_config.html | 57 | ||||
| -rw-r--r-- | httemplate/view/svc_phone.cgi | 3 | 
5 files changed, 95 insertions, 1 deletions
| diff --git a/httemplate/edit/part_device.html b/httemplate/edit/part_device.html index 4f2fe93b4..aa626b379 100644 --- a/httemplate/edit/part_device.html +++ b/httemplate/edit/part_device.html @@ -6,6 +6,7 @@                                 'devicename' => 'Device name',                               },                   'viewall_dir' => 'browse', +                 'html_bottom' => $html_bottom_sub,             )  %>  <%init> @@ -13,4 +14,33 @@  die "access denied"    unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $extra_sql = +  join( ' OR ', map { "exporttype = '$_'" } +                keys %{FS::part_export::export_info('part_device')} +      ); +$extra_sql = $extra_sql ? " WHERE ( $extra_sql ) " : " WHERE 0 = 1 "; + +my $html_bottom_sub = sub { +  my $part_device = shift; + +  '<BR>'. +  '<FONT SIZE="+1">Exports</FONT><BR>'. + +  '<TABLE BGCOLOR="#cccccc" WIDTH=100%>'. +  '<TR><TD>'. +  include( '/elements/checkboxes-table.html', +             'source_obj'    => $part_device, +             'link_table'    => 'export_device', +             'target_table'  => 'part_export', +             'extra_sql'     => $extra_sql, +             'name_callback' => sub { my $o = shift; +                                      $o->exporttype. ' to '. $o->machine; +                                    }, +         ). +  '<BR>'. +  '</TD></TR></TABLE>'; + +}; +  </%init> + diff --git a/httemplate/edit/process/part_device.html b/httemplate/edit/process/part_device.html index 2b7e1da49..399991fc8 100644 --- a/httemplate/edit/process/part_device.html +++ b/httemplate/edit/process/part_device.html @@ -1,6 +1,10 @@  <% include( 'elements/process.html',                 'table'       => 'part_device',                 'viewall_dir' => 'browse', +               'process_m2m' => { +                 'link_table'   => 'export_device', +                 'target_table' => 'part_export', +               },             )  %>  <%init> diff --git a/httemplate/elements/checkboxes-table.html b/httemplate/elements/checkboxes-table.html index b6b04d111..a31bdb919 100644 --- a/httemplate/elements/checkboxes-table.html +++ b/httemplate/elements/checkboxes-table.html @@ -46,7 +46,7 @@  %  %  my $hashref = $opt{'hashref'} || {};  % -%  my $extra_sql = ''; +%  my $extra_sql = $opt{'extra_sql'} || '';  %  %  if ( $opt{'agent_virt'} ) {  %    $extra_sql .= ' AND' . $FS::CurrentUser::CurrentUser->agentnums_sql( diff --git a/httemplate/misc/phone_device_config.html b/httemplate/misc/phone_device_config.html new file mode 100644 index 000000000..9ea0d0d1c --- /dev/null +++ b/httemplate/misc/phone_device_config.html @@ -0,0 +1,57 @@ +%if ($config) { +<% $config %> +%}else{ +<% include("/elements/errorpage.html", "No configuration data produced.") %> +%} +<%init> + +die "access denied" +  unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); + +my $exportnum; +if ( $cgi->param('exportnum') ) { +  $cgi->param('exportnum') =~ /^(\d+)$/ or die "unparsable exportnum"; +  $exportnum = $1; +}  + +die "no export provided" +  unless $exportnum; + +my $svcnum; +if ( $cgi->param('svcnum') ) { +  $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum"; +  $svcnum = $1; +}  + +my $devicenum; +if ( $cgi->param('devicenum') ) { +  $cgi->param('devicenum') =~ /^(\d+)$/ or die "unparsable devicenum"; +  $devicenum = $1; +}  + +die "no device or service provided" +  unless $svcnum || $devicenum; + +my $part_export = qsearchs('part_export', { 'exportnum' => $exportnum }) +  or die "Unknown exportnum $exportnum\n"; + +my $phone_device; +my $svc_phone; +if ($devicenum) { +  $phone_device = qsearchs('phone_device', { 'devicenum' => $devicenum }) +    or die "Unknown device $devicenum\n"; +  $svc_phone = $phone_device->svc_phone; +} else { +  $svc_phone = qsearchs('svc_phone', { 'svcnum' => $svcnum }) +    or die "Unknown svc_phone $svcnum\n"; +} + +my $config = $part_export->export_device_config($svc_phone, $phone_device); + +if ($config) { +  http_header('Content-Type' => 'application/octet-stream'); +  http_header('Content-Disposition' => 'attachment;filename="config"'); +  http_header('Content-Length' => length($config)); +} + +</%init> diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi index 59ee2d516..2733e258e 100644 --- a/httemplate/view/svc_phone.cgi +++ b/httemplate/view/svc_phone.cgi @@ -58,6 +58,7 @@ my $html_foot = sub {              '<TH CLASS="grid" BGCOLOR="#cccccc">Type</TH>'.              '<TH CLASS="grid" BGCOLOR="#cccccc">MAC Addr</TH>'.              '<TH CLASS="grid" BGCOLOR="#cccccc"></TH>'. +            '<TH CLASS="grid" BGCOLOR="#cccccc"></TH>'.            '</TR>';        my $bgcolor1 = '#eeeeee';        my $bgcolor2 = '#ffffff'; @@ -73,10 +74,12 @@ my $html_foot = sub {          my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);          my $devicenum = $phone_device->devicenum; +        my $export_links = join( '<BR>', @{ $phone_device->export_links } );          $devices .= '<TR>'.                        $td. $phone_device->part_device->devicename. '</TD>'.                        $td. $phone_device->mac_addr. '</TD>'. +                      $td. $export_links. '</TD>'.                        "$td( ".                          qq(<A HREF="${p}edit/phone_device.html?$devicenum">edit</A> | ).                          qq(<A HREF="javascript:areyousure('${p}misc/delete-phone_device.html?$devicenum')">delete</A>). | 
