[freeside-commits] freeside/httemplate/edit nas.html, 1.2, 1.3 part_export.cgi, 1.33, 1.34 svc_broadband.cgi, 1.26, 1.27
Mark Wells
mark at wavetail.420.am
Wed Dec 28 15:55:34 PST 2011
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv5724/httemplate/edit
Modified Files:
nas.html part_export.cgi svc_broadband.cgi
Log Message:
broadband_nas export, #15284
Index: svc_broadband.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/svc_broadband.cgi,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -w -d -r1.26 -r1.27
--- svc_broadband.cgi 10 Dec 2011 00:36:47 -0000 1.26
+++ svc_broadband.cgi 28 Dec 2011 23:55:32 -0000 1.27
@@ -3,7 +3,9 @@
'name' => 'broadband service',
'table' => 'svc_broadband',
'fields' => \@fields,
- 'field_callback' => $callback,
+ 'field_callback' => $field_callback,
+ 'svc_new_callback' => $svc_edit_callback,
+ 'svc_edit_callback' => $svc_edit_callback,
'dummy' => $cgi->query_string,
'onsubmit' => 'validate_coords',
'html_foot' => $js,
@@ -113,17 +115,57 @@
}
}
-
my $fixedblock = '';
-my $callback = sub {
- my ($cgi, $object, $fieldref) = @_;
+my $part_svc;
- my $svcpart = $object->svcnum ? $object->cust_svc->svcpart
- : $cgi->param('svcpart');
+my $svc_edit_callback = sub {
+ my ($cgi, $svc_x, $part_svc_x, $cust_pkg, $fields, $opt) = @_;
- my $part_svc = qsearchs( 'part_svc', { svcpart => $svcpart } );
- die "No part_svc entry!" unless $part_svc;
+ $part_svc = $part_svc_x; #for field_callback to use
+
+ $opt->{'labels'}{'block_label'} = 'Block';
+
+ my ($nas_export) = $part_svc->part_export('broadband_nas');
+ #can we assume there's only one of these per part_svc?
+ if ( $nas_export ) {
+ my $nas;
+ if ( $svc_x->svcnum ) {
+ $nas = qsearchs('nas', { 'svcnum' => $svc_x->svcnum });
+ }
+ $nas ||= $nas_export->default_nas;
+ $svc_x->set($_, $nas->$_) foreach fields('nas');
+
+ # duplicates the fields in httemplate/edit/nas.html (mostly)
+ push @$fields,
+ { type => 'tablebreak-tr-title',
+ #value => 'Attached NAS',
+ value => $nas_export->exportname,
+ colspan => 2,
+ },
+ { field=>'nasnum', type=>'hidden', },
+ { field=>'shortname', size=>16, maxlength=>32 },
+ { field=>'secret', size=>40, maxlength=>60, required=>1 },
+ { field=>'type', type=>'select',
+ options=>[qw( cisco computone livingston max40xx multitech netserver
+ pathras patton portslave tc usrhiper other )],
+ },
+ { field=>'ports', size=>5 },
+ { field=>'server', size=>40, maxlength=>64 },
+ { field=>'community', size=>40, maxlength=>50 },
+ ;
+
+ $opt->{'labels'}{'shortname'} = 'Short name';
+ $opt->{'labels'}{'secret'} = 'Shared secret';
+ $opt->{'labels'}{'type'} = 'Type';
+ $opt->{'labels'}{'ports'} = 'Ports';
+ $opt->{'labels'}{'server'} = 'Server';
+ $opt->{'labels'}{'community'} = 'Community';
+ }
+};
+
+my $field_callback = sub {
+ my ($cgi, $object, $fieldref) = @_;
my $columndef = $part_svc->part_svc_column($fieldref->{'field'});
if ($columndef->columnflag eq 'F') {
Index: part_export.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_export.cgi,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -w -d -r1.33 -r1.34
--- part_export.cgi 31 Oct 2011 19:20:16 -0000 1.33
+++ part_export.cgi 28 Dec 2011 23:55:32 -0000 1.34
@@ -51,8 +51,12 @@
#my $exports = FS::part_export::export_info($svcdb);
my $exports = FS::part_export::export_info();
-my %layers = map { $_ => "$_ - ". $exports->{$_}{desc} } keys %$exports;
-$layers{''}='';
+tie my %layers, 'Tie::IxHash',
+ '' => '',
+ map { $_ => "$_ - ". $exports->{$_}{desc} }
+ sort { $a cmp $b }
+ keys %$exports;
+;
my $widget = new HTML::Widgets::SelectLayers(
'selected_layer' => $part_export->exporttype,
@@ -83,6 +87,13 @@
? $optinfo->{default}
: ''
);
+ if ( $type eq 'title' ) {
+ $html .= qq!<TR><TH COLSPAN=1 ALIGN="right"><FONT SIZE="+1">! .
+ $label .
+ '</FONT></TH></TR>';
+ next;
+ }
+
# 'freeform': disables table formatting of options. Instead, each
# option can define "before" and "after" strings which are inserted
# around the selector.
Index: nas.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/nas.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- nas.html 31 Oct 2011 19:20:16 -0000 1.2
+++ nas.html 28 Dec 2011 23:55:32 -0000 1.3
@@ -48,7 +48,9 @@
'source_obj' => $nas,
'link_table' => 'export_nas',
'target_table' => 'part_export',
- 'hashref' => { 'exporttype' => 'sqlradius' },
+ 'hashref' => { 'exporttype' =>
+ { op => 'LIKE', value => '%sqlradius' }
+ },
'name_callback' => sub { $_[0]->label },
'default' => 'yes',
'target_link' => $p.'edit/part_export.cgi?',
More information about the freeside-commits
mailing list