]> mj.ucw.cz Git - pciids.git/commitdiff
Integrate ID syntax help
authorMichal Vaner <vorner@ucw.cz>
Sat, 30 Aug 2008 17:14:33 +0000 (19:14 +0200)
committerMichal Vaner <vorner@ucw.cz>
Sat, 30 Aug 2008 17:14:33 +0000 (19:14 +0200)
PciIds/Address/Base.pm
PciIds/Address/Pci.pm
PciIds/Address/PciClass.pm
PciIds/Address/Toplevel.pm
PciIds/Html/Changes.pm
PciIds/Html/List.pm
PciIds/Html/Util.pm

index 428245d7e0446b38fe41ff4d26922a37e3a9c168..1ec3cb80706af6184ac851d3443a99c36fdafb9e 100644 (file)
@@ -45,4 +45,8 @@ sub path( $ ) {
        return \@result;
 }
 
+sub helpName( $ ) {
+       return undef;
+}
+
 1;
index 33e4afc0e210120e5c0112d11be4d32a05864c2e..c9b3a16b6cf6f45cf37126b002abf904aba112d7 100644 (file)
@@ -60,4 +60,8 @@ sub path( $ ) {
        return $result;
 }
 
+sub helpName( $ ) {
+       return 'pci';
+}
+
 1;
index 13656ef7db620bfadbed6ef09d0c3f58a10f6b1d..f0ac79328218e42212e88fd3103e1285ce5e40f6 100644 (file)
@@ -44,4 +44,8 @@ sub append( $$ ) {
        return ( PciIds::Address::new( $self->{'value'} . ( ( $self->{'value'} =~ /\/$/ ) ? '' : '/' ) . $suffix ), undef );
 }
 
+sub helpName( $ ) {
+       return 'pci_class';
+}
+
 1;
index bc660244f64699a8c91a6b001b90f809f4d0e124..614db4735b1609975c78288cf2bb8b4dd0bcb8a4 100644 (file)
@@ -73,4 +73,13 @@ sub parent( $ ) {
        return undef;
 }
 
+sub helpName( $ ) {
+       my( $self ) = @_;
+       if( $self->{'value'} =~ /^PC/ ) {
+               return 'pci';
+       } else {
+               return 'pci_class';
+       }
+}
+
 1;
index 2fa3d2c4a242e04a8e600d8b171b6024c30dfad4..a23d50dfd70ccc6aafebb68d734640110faedd60 100644 (file)
@@ -16,7 +16,7 @@ sub genNewItemForm( $$$$$$ ) {
        my $prettyAddr = encode( $address->pretty() );
        genHtmlHead( $req, "$prettyAddr - add new item", undef );
        print "<h1>$prettyAddr - add new item</h1>\n";
-       genLocMenu( $req, $args, [ logItem( $auth ), $address->canDiscuss() ? [ 'Discuss', 'newhistory' ] : (), [ 'Notifications', 'notifications' ], [ 'Help', 'help', 'newitem' ] ] );
+       genLocMenu( $req, $args, [ logItem( $auth ), $address->canDiscuss() ? [ 'Discuss', 'newhistory' ] : (), [ 'Notifications', 'notifications' ], [ 'Help', 'help', 'newitem' ], [ 'ID syntax', 'help', $address->helpName() ] ] );
        print "<div class='error'>$error</div>\n" if( defined $error );
        print "<form name='newitem' id='newitem' method='POST' action=''>\n<table>";
        genFormEx( [ [ 'input', 'Id:', 'text', 'id', 'maxlength="50"' ],
index 02c62c9d23bb6b8fc1e97c4da3316e1683c0257f..040d35abeb1311c83bd078368726a64e50ae6f4a 100644 (file)
@@ -25,7 +25,7 @@ sub list( $$$$ ) {
        my $id = $address->pretty();
        genHtmlHead( $req, $id, undef );
        print '<h1>'.encode( $id ).'</h1>';
-       genMenu( $req, $address, $args, $auth, 'list' );
+       genMenu( $req, $address, $args, $auth, [ [ 'Help', 'help', 'list' ], $address->helpName() ? [ 'ID syntax', 'help', $address->helpName() ] : () ] );
        genPath( $req, $address, 0 );
        print htmlDiv( 'name', '<p>'.encode( $name ) ) if( defined( $name ) );
        print htmlDiv( 'note', '<p>'.encode( $note ) ) if( defined( $note ) );
index 37538f3151eb590e3ebf62e38bc3166cea0f9941..63f98bf0cbf7419a5fdd46369869fb3b013e9529 100644 (file)
@@ -69,7 +69,7 @@ sub logItem( $ ) {
 }
 
 sub genMenu( $$$$$ ) {
-       my( $req, $address, $args, $auth, $help ) = @_;
+       my( $req, $address, $args, $auth, $append ) = @_;
        my @list = ( logItem( $auth ) );
        if( defined $address ) {
                push @list, [ 'Add item', 'newitem' ] if( $address->canAddItem() );
@@ -78,7 +78,7 @@ sub genMenu( $$$$$ ) {
        push @list, [ 'Administrate', 'admin' ] if( hasRight( $auth->{'accrights'}, 'validate' ) );
        push @list, [ 'Profile', 'profile' ] if defined $auth->{'authid'};
        push @list, [ 'Notifications', 'notifications' ] if defined $auth->{'authid'};
-       push @list, [ 'Help', 'help', $help ] if defined $help;
+       push @list, @{$append} if defined $append;
        genCustomMenu( $req, $address, $args, \@list );
 }