ikano.pm initial commit, svc_dsl UI initial commit, and svc_dsl on-going work, RT7111
[freeside.git] / httemplate / view / svc_dsl.cgi
1 <% include('elements/svc_Common.html',
2             'table'     => 'svc_dsl',
3             'labels'    => \%labels,
4             'fields' => \@fields,
5             'svc_callback' => $svc_cb,
6             'html_foot' => $html_foot,
7           )
8 %>
9 <%init>
10 my $conf = new FS::Conf;
11 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
12
13 my $fields = FS::svc_dsl->table_info->{'fields'};
14 my %labels = map { $_ =>  ( ref($fields->{$_})
15                              ? $fields->{$_}{'label'}
16                              : $fields->{$_}
17                          );
18                  } keys %$fields;
19 my @fields = keys %$fields;
20
21 my $footer;
22
23 my $html_foot = sub {
24     return $footer;
25 };
26
27 my $svc_cb = sub {
28     my( $cgi,$svc_x, $part_svc,$cust_pkg, $fields1,$opt) = @_;
29
30     my @exports = $part_svc->part_export_dsl_pull;
31     die "more than one DSL-pulling export attached to svcpart ".$part_svc->svcpart
32         if ( scalar(@exports) > 1 );
33     
34     # if no DSL-pulling exports, then just display everything, which is the
35     # default behaviour implemented above
36     return if ( scalar(@exports) == 0 );
37
38     $opt->{'disable_unprovision'} = 1;
39     my $exporttype = @exports[0]->exporttype;   
40
41     # XXX: AJAX auto-pull
42         
43     @fields = qw( svctn first last company username password );
44
45     if($exporttype eq 'ikano') {
46         push @fields, 'isp_chg';
47         push @fields, 'isp_prev';
48         push @fields, 'staticips';
49     }
50     else {
51         # XXX
52     }
53     
54     # hack against "can't use string ... as a subroutine ref while 'strict refs' in use"
55     my $statusSub = \&{'FS::part_export::'.$exporttype.'::status_line'};
56     my $statusLine = &$statusSub($svc_x,$date_format,"<BR>");
57     
58     $footer = "<B>$statusLine</B>";
59
60     # XXX: notes
61 };
62 </%init>