my @result;
my $address = $self;
while( defined( $address = $address->parent() ) ) {
- push @result, $address;
+ push @result, [ $address, 0 ];
}
+ unshift @result, [ $self, 0, 1 ];
return \@result;
}
my( $self ) = @_;
my $result = PciIds::Address::Base::path( $self );
my( $vid ) = ( $self->get() =~ /^PC\/[0-9a-f]{4}\/[0-9a-f]{4}\/([0-9a-f]{4})/ );
- splice @{$result}, 2, 0, PciIds::Address::new( "PC/$vid" ) if( defined $vid ) && ( $result->[1]->get() ne "PC/$vid" );
+ unshift @{$result}, [ PciIds::Address::new( "PC/$vid" ), 1 ] if( defined $vid );# && ( $result->[1]->[0]->get() ne "PC/$vid" );
return $result;
}
}
print "<tr class='new'><td>New:<td><input type='text' name='name-$cnt' class='text'><td><input type='text' name='note-$cnt' class='text'><td><textarea name='disc-$cnt'></textarea>\n";
print "<td colspan='3'>";
- genPathBare( $req, $addr, 0, 0 );
+ genPathBare( $req, $addr, 0, 0, 0 );
print "<td><input type='checkbox' name='loc-$cnt-softdel' value='del'>\n";
}
print "<tr class='unseen-history'><td class='empty'><td>".safeEncode( ( defined $name && $name eq '' ) ? 'Deletion request' : $name )."<td>".safeEncode( $note )."<td>".safeEncode( $disc )."<td>".mailEncode( $user );
print "<div class='clear'></div>\n";
print "</div\n>";
genPath( $req, $address, 0 );
- if( defined $name ) {
- print '<h2>'.encode( $id ).'</h2>';
- print htmlDiv( 'name', '<p>Name: '.encode( $name ) );
- }
+ print htmlDiv( 'name', '<p>Name: '.encode( $name ) ) if defined $name && $name ne '';
print htmlDiv( 'note', '<p>Note: '.encode( $note ) ) if defined $note && $note ne '';
my $diss = 0;
my $history;
return HTTP_SEE_OTHER;
}
-sub genPathBare( $$$$ ) {
+sub genPathBare( $$$$$ ) {
my( $req, $address, $printAddr, $started ) = @_;
my $path;
if( defined $address ) {
$path = $address->path();
- unshift @{$path}, $address if( $printAddr );
} else {
$path = [];
}
- foreach my $addr ( reverse @{$path} ) {
+ foreach my $item ( reverse @{$path} ) {
+ my( $addr, $exception, $myAddr ) = @{$item};
if( $started ) {
- print " -> ";
+ if( $exception ) {
+ print ", ";
+ } else {
+ print " -> ";
+ }
} else {
$started = 1;
}
- print "<a href='http://".$req->hostname()."/read/".$addr->get()."'>".encode( $addr->pretty() )."</a>";
+ print "(" if( $exception );
+ if( !$printAddr && $myAddr ) {
+ print "<strong>".encode( $addr->pretty() )."</strong>";
+ } else {
+ print "<a href='http://".$req->hostname()."/read/".$addr->get()."'>".encode( $addr->pretty() )."</a>";
+ }
+ print ")" if( $exception );
}
}
sub genPath( $$$ ) {
my( $req, $address, $printAddr ) = @_;
print "<div class='path'>\n";
- print "<p><a href='http://".$req->hostname()."/index.html'>Main page</a>";
- genPathBare( $req, $address, $printAddr, 1 );
+ print "<p><a href='http://".$req->hostname()."/index.html'>Main</a>";
+ genPathBare( $req, $address, $printAddr, 1, 1 );
print "</div>\n";
}