X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=PciIds%2FHtml%2FList.pm;h=b2f3df058e57f9050306c5c4643baf68133236c5;hb=d2935a5e76ef0e5a2f3a15e80b2649a2913581e5;hp=4115bbb7caf9cecf4c85bcd5373405db39d1c85d;hpb=1c1f422006b7a43bf9a3c112134353e4bc130a85;p=pciids.git diff --git a/PciIds/Html/List.pm b/PciIds/Html/List.pm index 4115bbb..b2f3df0 100644 --- a/PciIds/Html/List.pm +++ b/PciIds/Html/List.pm @@ -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; @@ -14,46 +32,53 @@ sub loadItem( $$ ) { return ( 0 ) unless( defined $address ); my $item = $tables->item( $address->get() ); return ( 0 ) unless( defined $item ); - my( $parent, $name, $description, $maincomment ) = @{$item}; - return ( 1, $parent, $name, $description, $address, $maincomment ); + my( $parent, $name, $note, $mainhistory ) = @{$item}; + return ( 1, $parent, $name, $note, $address, $mainhistory ); } sub list( $$$$ ) { my( $req, $args, $tables, $auth ) = @_; - my( $ok, $parent, $name, $description, $address, $mid ) = loadItem( $tables, $req->uri() ); + 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 '

'.encode( $id ).'

'; - genMenu( $address, $args, $auth ); - print htmlDiv( 'name', '

'.encode( $name ) ) if( defined( $name ) ); - print htmlDiv( 'description', '

'.encode( $description ) ) if( defined( $description ) ); - genPath( $address, 0 ); + my $id = $address->top()->pretty(); + genHtmlHead( $req, $id, "\n" ); + print "

\n"; + genMenu( $req, $address, $args, $auth, [ [ 'Help', 'help', 'list' ], $address->helpName() ? [ 'ID syntax', 'help', $address->helpName() ] : () ] ); + print '

The PCI ID Repository

The home of the pci.ids file

'; + print "
\n"; + genPath( $req, $address, 0 ); + print htmlDiv( 'name', '

Name: '.encode( $name ) ) if defined $name && $name ne ''; + print htmlDiv( 'note', '

Note: '.encode( $note ) ) if defined $note && $note ne ''; my $diss = 0; - my $comment; - foreach $comment ( @{$tables->history( $address->get() )} ) { + my $history; + foreach $history ( @{$tables->history( $address->get() )} ) { unless( $diss ) { print "

\n

Discussion

"; $diss = 1; } - my( $id, $text, $time, $name, $description, $seen, $user ) = @{$comment}; - my $type = $seen ? 'comment' : 'unseen-comment'; - $type = 'main-comment' if( defined( $mid ) && ( $id == $mid ) ); + 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 "
\n"; print "

Name: ".encode( $name )."\n" if( defined( $name ) && ( $name ne '' ) ); - print "

Description: ".encode( $description )."\n" if( defined( $description ) && ( $description ne '' ) ); + print "

Deletion request\n" if( defined $name && $name eq '' ); + print "

Note: ".encode( $note )."\n" if( defined( $note ) && ( $note ne '' ) ); if( defined( $text ) && ( $text ne '' ) ) { $text = encode( $text ); $text =~ s/\n/
/g; - print "

$text\n"; + print "

$text\n"; } + ( $user ) = ( $email =~ /^(.*)@/ ) if defined $email && !defined $user; print "

".encode( $user )."\n" if( defined( $user ) ); print "

".encode( $time )."\n"; print "

\n"; } - print "
\n" if( $diss ); + if( $diss ) { + print "

Discuss\n"; + print "\n" if( $diss ); + } unless( $address->leaf() ) { - print "

Subitems

\n"; + print "

".encode( $address->subName() )."

\n"; my $restricts = $address->defaultRestrictList(); if( scalar @{$restricts} ) { print "

"; @@ -65,12 +90,13 @@ sub list( $$$$ ) { my $url = '/read/'.$address->get().buildExcept( 'sort', $args ); my $sort = ( $args->{'sort'} or 'id' ); my( $sort_id, $sort_name ) = ( ( $sort eq 'id' ? 'rid' : 'id' ), ( $sort eq 'name' ? 'rname' : 'name' ) ); - genTableHead( 'subnodes', [ 'Id', 'Name', 'Description' ], [ 'id-col', 'name-col', 'desc-col' ] ); + genTableHead( 'subnodes', [ 'Id', 'Name', 'Note' ], [ 'id-col', 'name-col', 'note-col' ] ); $args->{'restrict'} = $address->defaultRestrict() unless( defined( $args->{'restrict'} ) ); $tables->nodes( $address->get(), $args ); genTableTail(); + print "

Add item\n"; } - genHtmlTail(); + genHtmlFooter( 1, $req, $args ); return OK; }