]> mj.ucw.cz Git - pciids.git/blobdiff - PciIds/Html/Changes.pm
Merge branch 'master' of /home/vorner/pciids
[pciids.git] / PciIds / Html / Changes.pm
index 57418b55ad654bad069ca1412ca9e148d92cb458..0230a8e11ee36ce89016e9263922a89c9d08f99a 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::Changes;
 use strict;
 use PciIds::Html::Users;
@@ -14,7 +32,7 @@ sub genNewItemForm( $$$$$$ ) {
        my( $ok, $parent, $name, $note, $address ) = loadItem( $tables, $req->uri() );
        return NOT_FOUND unless( $ok );
        genHtmlHead( $req, "Add new item", undef );
-       genCustomHead( $req, $args, $address, "Add new item", [ $address->canDiscuss() ? [ 'Discuss', 'newhistory' ] : (), [ 'Help', 'help', 'newitem' ], [ 'ID syntax', 'help', $address->helpName() ], [ '', 'jump' ] ], [ logItem( $auth ), [ 'Notifications', 'notifications' ] ] );
+       genCustomHead( $req, $args, $address, "Add new item", [ $address->canDiscuss() ? [ 'Discuss', 'newhistory' ] : (), [ 'Help', 'help', 'newitem' ], [ 'ID syntax', 'help', $address->helpName() ] ], [ logItem( $auth ), [ 'Notifications', 'notifications' ] ] );
        print "<div class='error'>$error</div>\n" if( defined $error );
        print "<form name='newitem' id='newitem' method='POST' action=''>\n<table>";
        genFormEx( [ [ 'input', 'ID:', 'text', 'id', 'maxlength="'.$address->subIdSize().'"' ],
@@ -34,7 +52,7 @@ sub genNewItemForm( $$$$$$ ) {
        If there is something you want to clarify about the item, you can use note (like the ID does not belong to people using it).
        Discussion is for things more relevant to history of the item than the real device (like information source).
        Both note and discussion is optional.';
-       genHtmlTail();
+       genHtmlFooter( 1, $req, $args );
        return OK;
 }
 
@@ -74,15 +92,15 @@ sub newItemSubmit( $$$$ ) {
                if( $result eq 'exists' ) {
                        genHtmlHead( $req, 'ID collision', undef );
                        my $addr = PciIds::Address::new( $req->uri() );
-                       genCustomHead( $req, $args, $addr, 'ID collision', [ [ 'Add other item', 'newitem' ], $addr->canDiscuss() ? [ 'Discuss', 'newhistory' ] : (), [ '', 'jump' ] ], [ logItem( $auth ) ] );
+                       genCustomHead( $req, $args, $addr, 'ID collision', [ [ 'Add other item', 'newitem' ], $addr->canDiscuss() ? [ 'Discuss', 'newhistory' ] : (), ], [ logItem( $auth ) ] );
                        print '<p>Sorry, this ID already exists.';
-                       genHtmlTail();
+                       genHtmlFooter( 0, undef, undef );
                        return OK;
                } elsif( $result ) {
                        return genNewItemForm( $req, $args, $auth, $tables, $result, $data );
                }
                notify( $tables, $data->{'address'}->parent()->get(), $comName, 2, 0 );#Notify the parent (parent gets new items)
-               $tables->submitNotification( $auth->{'authid'}, $data->{'address'}->get(), { 'recursive' => 0, 'notification' => 1, 'way' => 0 } ) if( defined $data->{'subscribe'} && $data->{'subscribe'} eq 'subscribe' );
+               $tables->submitNotification( $auth->{'authid'}, $data->{'address'}->get(), { 'recursive' => 0, 'notification' => 0, 'way' => 0 } ) if( defined $data->{'subscribe'} && $data->{'subscribe'} eq 'subscribe' );
                tulog( $auth->{'authid'}, "Item created ".$data->{'address'}->get()." ".logEscape( $data->{'name'} )." ".logEscape( $data->{'note'} )." ".logEscape( $data->{'discussion'} )." $comName" );
                return HTTPRedirect( $req, '/read/'.$data->{'address'}->get().'?action=list' );
        } else {
@@ -95,7 +113,7 @@ sub genNewHistoryForm( $$$$$$ ) {
        my( $ok, $parent, $name, $note, $address ) = loadItem( $tables, $req->uri() );
        return NOT_FOUND unless( $ok );
        genHtmlHead( $req, "Discuss", undef );
-       genCustomHead( $req, $args, $address, "Discuss", [ $address->canAddItem() ? [ 'Add item', 'newitem' ] : (), [ 'Help', 'help', 'newhistory' ], [ '', 'jump' ] ], [ logItem( $auth ),  [ 'Notifications', 'notifications' ] ] );
+       genCustomHead( $req, $args, $address, "Discuss", [ $address->canAddItem() ? [ 'Add item', 'newitem' ] : (), [ 'Help', 'help', 'newhistory' ] ], [ logItem( $auth ),  [ 'Notifications', 'notifications' ] ] );
        print "<div class='error'>$error</div>\n" if( defined $error );
        print "<form name='newhistory' id='newhistory' method='POST' action=''>\n<table>";
        genFormEx( [ [ 'textarea', 'Text:', undef, 'text', 'rows="5" cols="50"' ],
@@ -119,7 +137,7 @@ sub genNewHistoryForm( $$$$$$ ) {
        You must provide at last name or discussion or deletion request.
 <p>
        If you provide note, you must provide name too.';
-       genHtmlTail();
+       genHtmlFooter( 1, $req, $args );
        return OK;
 }