]> mj.ucw.cz Git - pciids.git/blobdiff - PciIds/Html/List.pm
imgs do not allow border attribute
[pciids.git] / PciIds / Html / List.pm
index e8b9a29054a32e1227d0eb7bc5b1cb75fd70e256..b2f3df058e57f9050306c5c4643baf68133236c5 100644 (file)
@@ -1,3 +1,21 @@
+#      PciIds web database
+#      Copyright (C) 2008 Michal Vaner (vorner@ucw.cz)
+#
+#      This program is free software; you can redistribute it and/or modify
+#      it under the terms of the GNU General Public License as published by
+#      he Free Software Foundation; either version 2 of the License, or
+#      (at your option) any later version.
+#
+#      This program is distributed in the hope that it will be useful,
+#      but WITHOUT ANY WARRANTY; without even the implied warranty of
+#      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#
+#      GNU General Public License for more details.
+#
+#      You should have received a copy of the GNU General Public License
+#      along with this program; if not, write to the Free Software
+#      Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
 package PciIds::Html::List;
 use strict;
 use warnings;
@@ -22,13 +40,15 @@ sub list( $$$$ ) {
        my( $req, $args, $tables, $auth ) = @_;
        my( $ok, $parent, $name, $note, $address, $mid ) = loadItem( $tables, $req->uri() );
        return NOT_FOUND unless( $ok );
-       my $id = $address->pretty();
-       genHtmlHead( $req, $id, undef );
-       print '<h1>'.encode( $id ).'</h1>';
+       my $id = $address->top()->pretty();
+       genHtmlHead( $req, $id, "<style type='text/css' media='screen,print'>col.id-col { width: ".$address->subIdSize()*1.25."ex; }</style>\n" );
+       print "<div class='top'>\n";
        genMenu( $req, $address, $args, $auth, [ [ 'Help', 'help', 'list' ], $address->helpName() ? [ 'ID syntax', 'help', $address->helpName() ] : () ] );
+       print '<div class="bluesquare"><h1>The PCI ID Repository</h1><p class="home">The home of the <code>pci.ids</code> file</div>';
+       print "<div class='clear'></div></div>\n";
        genPath( $req, $address, 0 );
-       print htmlDiv( 'name', '<p>'.encode( $name ) ) if defined( $name );
-       print htmlDiv( 'note', '<p>'.encode( $note ) ) if( defined( $note ) );
+       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;
        foreach $history ( @{$tables->history( $address->get() )} ) {
@@ -36,7 +56,7 @@ sub list( $$$$ ) {
                        print "<div class='discussion'>\n<h2>Discussion</h2>";
                        $diss = 1;
                }
-               my( $id, $text, $time, $name, $note, $seen, $user ) = @{$history};
+               my( $id, $text, $time, $name, $note, $seen, $user, $email ) = @{$history};
                my $type = $seen ? 'history' : 'unseen-history';
                $type = 'main-history' if( defined( $mid ) && ( $id == $mid ) );
                print "<div class='$type'>\n";
@@ -48,13 +68,17 @@ sub list( $$$$ ) {
                        $text =~ s/\n/<br>/g;
                        print "<p class='discussion-text'>$text\n";
                }
+               ( $user ) = ( $email =~ /^(.*)@/ ) if defined $email && !defined $user;
                print "<p class='author'>".encode( $user )."\n" if( defined( $user ) );
                print "<p class='time'>".encode( $time )."\n";
                print "</div>\n";
        }
-       print "</div>\n" if( $diss );
+       if( $diss ) {
+               print "<p><a href='".buildExcept( 'action', $args )."?action=newhistory'>Discuss</a>\n";
+               print "</div>\n" if( $diss );
+       }
        unless( $address->leaf() ) {
-               print "<h2>Sub-items</h2>\n";
+               print "<h2>".encode( $address->subName() )."</h2>\n";
                my $restricts = $address->defaultRestrictList();
                if( scalar @{$restricts} ) {
                        print "<p>";
@@ -70,8 +94,9 @@ sub list( $$$$ ) {
                $args->{'restrict'} = $address->defaultRestrict() unless( defined( $args->{'restrict'} ) );
                $tables->nodes( $address->get(), $args );
                genTableTail();
+               print "<p><a href='".buildExcept( 'action', $args )."?action=newitem'>Add item</a>\n";
        }
-       genHtmlTail();
+       genHtmlFooter( 1, $req, $args );
        return OK;
 }