";
- genFormEx( [ [ 'input', 'Id:', 'text', 'id', 'maxlength="50"' ],
+ print "';
- print 'Items marked with * are optional.';
- genHtmlTail();
+ print '
+
+ Please enter only accurate information. Descriptions like "Unknown modem device" are only of a little use to anybody.
+ Real chip names and numbers are preferred over marketing names. In case you know both, enclose the marketing name in square brackets like in
+ "3c595 100BaseTX [Vortex]". Do not include names of superitems in the name (like vendor name in device name).
+ Check information specific to this ID type.
+
+ 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.';
+ genHtmlFooter( 1, $req, $args );
return OK;
}
@@ -55,7 +79,8 @@ sub newItemSubmit( $$$$ ) {
return undef;
},
'note' => sub { return ( length shift > 1024 ) ? 'Note can not be longer than 1024 characters' : undef; },
- 'discussion' => sub { return ( length shift > 1024 ) ? 'Discussion can not be longer than 1024 characters' : undef; }
+ 'discussion' => sub { return ( length shift > 1024 ) ? 'Discussion can not be longer than 1024 characters' : undef; },
+ 'subscribe' => undef
}, [ sub { my( $data ) = @_;
my $errstr;
return undef unless( length $data->{'id'} );#No address, so let it for the first check
@@ -66,19 +91,16 @@ sub newItemSubmit( $$$$ ) {
my( $result, $comName ) = $tables->submitItem( $data, $auth );
if( $result eq 'exists' ) {
genHtmlHead( $req, 'ID collision', undef );
- print "
\n";
- print '
ID collision
';
my $addr = PciIds::Address::new( $req->uri() );
- genCustomMenu( $req, $addr, $args, [ logItem( $auth ), [ 'Add other item', 'newitem' ], $addr->canDiscuss() ? [ 'Discuss', 'newhistory' ] : () ] );
- genPath( $req, $data->{'address'}, 1 );
- print "
\n";
+ genCustomHead( $req, $args, $addr, 'ID collision', [ [ 'Add other item', 'newitem' ], $addr->canDiscuss() ? [ 'Discuss', 'newhistory' ] : (), ], [ logItem( $auth ) ] );
print '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'}->get(), $comName, 2, 0 );
+ 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' => 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 {
@@ -90,21 +112,32 @@ sub genNewHistoryForm( $$$$$$ ) {
my( $req, $args, $tables, $auth, $error, $values ) = @_;
my( $ok, $parent, $name, $note, $address ) = loadItem( $tables, $req->uri() );
return NOT_FOUND unless( $ok );
- my $prettyAddr = encode( $address->pretty() );
- genHtmlHead( $req, "$prettyAddr - discuss", undef );
- print "
\n";
- print "
$prettyAddr - discuss
\n";
- genLocMenu( $req, $args, [ logItem( $auth ), $address->canAddItem() ? [ 'Add item', 'newitem' ] : (), [ 'Notifications', 'notifications' ], [ 'Help', 'help', 'newhistory' ] ] );
- print "
\n";
+ genHtmlHead( $req, "Discuss", undef );
+ genCustomHead( $req, $args, $address, "Discuss", [ $address->canAddItem() ? [ 'Add item', 'newitem' ] : (), [ 'Help', 'help', 'newhistory' ] ], [ logItem( $auth ), [ 'Notifications', 'notifications' ] ] );
print "$error
\n" if( defined $error );
- print "