X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=PciIds%2FHtml%2FNotifications.pm;h=fc20e1cef2bb0aa484e148088f2b9e6ee6ddbb09;hb=904a25d66ec221203148aa1559b5d062860788ce;hp=3807a70c6abe11f1b0ea40370e396028aff4024a;hpb=9fc9e51f37b97a3c4496d98e476d194d57e7b19f;p=pciids.git diff --git a/PciIds/Html/Notifications.pm b/PciIds/Html/Notifications.pm index 3807a70..fc20e1c 100644 --- a/PciIds/Html/Notifications.pm +++ b/PciIds/Html/Notifications.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::Notifications; use strict; use warnings; @@ -5,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 "
$error
\n" if( defined $error ); my $uri = $addr->get(); my $notifs = $tables->notificationsUser( $auth->{'authid'} ); @@ -42,16 +61,17 @@ sub genNotifForm( $$$$$$ ) { print "\n"; } - genHtmlTail(); + genHtmlFooter( 1, $req, $args ); return OK; } 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 { @@ -84,4 +104,6 @@ sub notifFormSubmit( $$$$ ) { return HTTPRedirect( $req, setAddrPrefix( $req->uri(), 'read' ).buildExcept( 'action', $args )."?action=list" ); } +checkConf( [ 'default_uri' ] ); + 1;