]> mj.ucw.cz Git - pciids.git/blobdiff - PciIds/Html/Notifications.pm
Merge branch 'master' of /home/vorner/pciids
[pciids.git] / PciIds / Html / Notifications.pm
index c8cc15c0dd4f73d53fe46f2d5feb8a3ae419978e..fc20e1cef2bb0aa484e148088f2b9e6ee6ddbb09 100644 (file)
@@ -23,13 +23,14 @@ use PciIds::Html::Util;
 use PciIds::Html::Forms;
 use PciIds::Html::Users;
 use PciIds::Address;
+use PciIds::Config;
 use Apache2::Const qw(:common :http);
 
 sub genNotifForm( $$$$$$ ) {
        my( $req, $args, $tables, $auth, $error, $data ) = @_;
        my $addr = PciIds::Address::new( $req->uri() );
        genHtmlHead( $req, 'Notifications', undef );
-       genCustomHead( $req, $args, $addr, "Notifications", [ $addr->canAddItem() ? [ 'New item', 'newitem' ] : (), $addr->canDiscuss ? [ 'Discuss', 'newhistory' ] : (), [ 'Help', 'help', 'notifications' ], [ '', 'jump' ] ], [ logItem( $auth ), [ 'Profile', 'profile' ] ] );
+       genCustomHead( $req, $args, $addr, "Notifications", [ $addr->canAddItem() ? [ 'New item', 'newitem' ] : (), $addr->canDiscuss ? [ 'Discuss', 'newhistory' ] : (), [ 'Help', 'help', 'notifications' ] ], [ logItem( $auth ), [ 'Profile', 'profile' ] ] );
        print "<div class='error'>$error</div>\n" if( defined $error );
        my $uri = $addr->get();
        my $notifs = $tables->notificationsUser( $auth->{'authid'} );
@@ -60,7 +61,7 @@ sub genNotifForm( $$$$$$ ) {
                print "<div class='navigation'><h2>All notifications</h2><ul>\n";
                foreach( @{$notifs} ) {
                        my( $location ) = @{$_};
-                       print "<li><a href='/$location".buildArgs( $args )."'>".PciIds::Address::new( $location )->pretty()."</a>\n";
+                       print "<li><a href='/mods/$location".buildArgs( $args )."'>".PciIds::Address::new( $location )->pretty()."</a>\n";
                }
                print "</ul></div>\n";
        }
@@ -70,6 +71,7 @@ sub genNotifForm( $$$$$$ ) {
 
 sub notifForm( $$$$ ) {
        my( $req, $args, $tables, $auth ) = @_;
+       return HTTPRedirect( $req, '/mods/'.$config{'default_uri'}.'?action=notifications' ) if $req->uri() =~ /^(\/(read|mods))?\/?$/;
        if( defined $auth->{'authid'} ) {
                return genNotifForm( $req, $args, $tables, $auth, undef, $tables->getNotifData( $auth->{'authid'}, PciIds::Address::new( $req->uri() )->get() ) );
        } else {
@@ -102,4 +104,6 @@ sub notifFormSubmit( $$$$ ) {
        return HTTPRedirect( $req, setAddrPrefix( $req->uri(), 'read' ).buildExcept( 'action', $args )."?action=list" );
 }
 
+checkConf( [ 'default_uri' ] );
+
 1;