X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=PciIds%2FHtml%2FUtil.pm;h=ec6de57650f3ce50dd40c91f50375410dce652da;hb=d14718cb3192765fb35f43c560e9bee5d8bba3d7;hp=5c3b2a4ecd123bafc708e60ac0495274f7a1f112;hpb=70ff29444c4fef1c4422398aafa71d02cd8dd5f9;p=pciids.git diff --git a/PciIds/Html/Util.pm b/PciIds/Html/Util.pm index 5c3b2a4..ec6de57 100644 --- a/PciIds/Html/Util.pm +++ b/PciIds/Html/Util.pm @@ -7,7 +7,7 @@ use PciIds::Users; use Apache2::Const qw(:common :http); use APR::Table; -our @EXPORT = qw(&genHtmlHead &htmlDiv &genHtmlTail &genTableHead &genTableTail &parseArgs &buildExcept &buildArgs &genMenu &genCustomMenu &encode &setAddrPrefix &HTTPRedirect &genPath &logItem &genLocMenu); +our @EXPORT = qw(&genHtmlHead &htmlDiv &genHtmlTail &genTableHead &genTableTail &parseArgs &buildExcept &buildArgs &genMenu &genCustomMenu &encode &setAddrPrefix &HTTPRedirect &genPath &logItem &genLocMenu &genCustomHead); sub encode( $ ) { return encode_entities( shift, "\"'&<>" ); @@ -47,7 +47,7 @@ sub genCustomMenu( $$$$ ) { } else { $url = '/read/?action='; } - print "\n"; + print "\n"; } sub logItem( $ ) { @@ -70,16 +70,24 @@ sub logItem( $ ) { sub genMenu( $$$$$ ) { my( $req, $address, $args, $auth, $append ) = @_; - my @list = ( logItem( $auth ) ); + my @list; if( defined $address ) { push @list, [ 'Add item', 'newitem' ] if( $address->canAddItem() ); push @list, [ 'Discuss', 'newhistory' ] if( $address->canDiscuss() ); } push @list, [ 'Administrate', 'admin' ] if( hasRight( $auth->{'accrights'}, 'validate' ) ); + push @list, @{$append} if defined $append; + if( @list ) { + print "\n"; + } + @list = ( logItem( $auth ) ); push @list, [ 'Profile', 'profile' ] if defined $auth->{'authid'}; push @list, [ 'Notifications', 'notifications' ] if defined $auth->{'authid'}; - push @list, @{$append} if defined $append; + print "
\n"; genCustomMenu( $req, $address, $args, \@list ); + print "
\n"; } sub genTableHead( $$$ ) { @@ -152,10 +160,21 @@ sub genPath( $$$ ) { print "\n"; } -sub genLocMenu( $$$ ) { - my( $req, $args, $actions ) = @_; - my $addr = PciIds::Address::new( $req->uri() ); - genCustomMenu( $req, $addr, $args, $actions ); +sub genLocMenu( $$$$$ ) { + my( $req, $args, $addr, $lactions, $ractions ) = @_; + print "\n
\n"; + genCustomMenu( $req, $addr, $args, $ractions ); + print "
\n"; +} + +sub genCustomHead( $$$$$$ ) { + my( $req, $args, $addr, $caption, $lactions, $ractions ) = @_; + print "
\n"; + print "

$caption

\n"; + genLocMenu( $req, $args, $addr, $lactions, $ractions ); + print "
\n"; genPath( $req, $addr, 1 ); }