]> mj.ucw.cz Git - pciids.git/blob - PciIds/Html/Tables.pm
Parent is notified about new item
[pciids.git] / PciIds / Html / Tables.pm
1 package PciIds::Html::Tables;
2 use strict;
3 use warnings;
4 use base 'PciIds::DBQ';
5 use PciIds::Html::Format;
6 use PciIds::Address;
7
8 sub new( $ ) {
9         my( $dbh ) = @_;
10         return bless PciIds::DBQ::new( $dbh );
11 }
12
13 sub formatLink( $ ) {
14         my $address = PciIds::Address::new( shift );
15         return '<a href="/read/'.$address->get().'">'.$address->tail().'</a>';
16 }
17
18 sub nodes( $$$ ) {
19         my( $self, $parent, $args ) = @_;
20         my $restrict = $args->{'restrict'};
21         $restrict = '' unless( defined $restrict );
22         $restrict = PciIds::Address::new( $parent )->restrictRex( $restrict );#How do I know if the restrict is OK?
23         htmlFormatTable( PciIds::DBQ::nodes( $self, $parent, $args, $restrict ), 3, [], [ \&formatLink ], sub { 1; }, sub {
24                 my $name = shift->[ 1 ];
25                 return ' class="'.( defined $name && $name ne '' ? 'item' : 'unnamedItem' ).'"';
26         } );
27 }
28
29 1;