%doc> Circuit Interface %doc> <%args> $id => undef $edit => undef $strand_sort => undef $search => undef $_action => undef $sequence_list => undef $add_interfaces => undef $new_interface => undef $add_strands => undef $user => $ui->get_current_user($r) %args> <%attr> title => 'Circuit' %attr> <%init> my $DEBUG = 0; print "
", Dumper(%ARGS), "
No results"; $m->abort; } my $num = scalar(@list); if ( $num == 1 ){ # Don't offer list. Just display this circuit $o = $list[0]; $id = $o->id; $search = undef; } }else{ # Show all @list = Circuit->retrieve_all(); } }elsif( $_action eq "ADD_STRANDS" && $sequence_list ){ my @sequences; if ( ref($sequence_list) eq "ARRAY" ) { @sequences = @{$sequence_list}; }else { push(@sequences, $sequence_list); } if ( scalar @sequences ){ foreach my $seq ( @sequences ){ my @strands = split(/,/o, $seq); foreach my $strandid ( @strands ){ my $strand = CableStrand->retrieve($strandid); $strand->update({circuit_id=>$o}); } } }else{ $m->comp("/generic/error.mhtml", error=>"Empty sequence list"); } }elsif( $_action eq "UPDATE_SEQUENCES" ){ foreach my $key ( keys(%ARGS) ) { next if ($key !~ /^__unassign_(\d+)/o); my @strands = split(/,/o, $ARGS{"__sequence_" . $1}); foreach my $strandid ( @strands ){ eval { my $strand = CableStrand->retrieve($strandid); $strand->update({circuit_id=>""}); }; if ( my $e = $@ ){ $m->comp("/generic/error.mhtml", error=>"Problem updating strand: $e"); } } } }elsif( $_action eq "ADD_INTERFACE" ){ if ( $new_interface && $new_interface !~ /\D/o){ eval { my $i = Interface->retrieve($new_interface); $i->update({circuit=>$o}); }; if ( my $e = $@ ){ $m->comp("/generic/error.mhtml", error=>"Problem updating interface: $e"); } }else{ $m->comp("/generic/error.mhtml", error=>"No interface selected, or invalid value"); } }elsif( $_action eq "UPDATE_INTERFACES" ){ my @ints; foreach my $key ( keys %ARGS ){ my $id; if ( $key =~ /^_un_interface_(\d+)$/og ){ $id = $1; }else{ next; } eval { my $i = Interface->retrieve($id); $i->update({circuit=>''}); }; if ( my $e = $@ ){ $m->comp("/generic/error.mhtml", error=>"Problem unassigning interface: $e"); } } } } %init> % if ( defined $search && @list ){
<& display_sequence.mhtml, strands=>[$o->strands], id=>$id, add=>$add_strands, table_view=>1 &>
%# Contacts % my $cl; % if ( $o->vendor && int($cl = $o->vendor->contactlist) && $cl->contacts ){