X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=PciIds%2FHtml%2FAdmin.pm;h=e4daf442fab5e5ee0e7347f1f6a2b5be736b93e7;hb=5342f8673c7aedc4d43f2fad44729e1b1d626b41;hp=e945bd7ffb9bba024047cd27a3cd40f9c3c508b3;hpb=4a2376575b2234e9fa3ed60b7527de03c58e3f0a;p=pciids.git diff --git a/PciIds/Html/Admin.pm b/PciIds/Html/Admin.pm index e945bd7..e4daf44 100644 --- a/PciIds/Html/Admin.pm +++ b/PciIds/Html/Admin.pm @@ -21,18 +21,18 @@ sub genNewAdminForm( $$$$ ) { my $hiscnt = 0; my $subcnt; foreach( @{$tables->adminDump()} ) { - my( $locId, $actName, $actDescription, $actCom, $actUser, $actText, - $com, $text, $name, $description, $user ) = @{$_}; + my( $locId, $actName, $actNote, $actHist, $actUser, $actDisc, + $hist, $disc, $name, $note, $user ) = @{$_}; if( !defined( $lastId ) || ( $lastId ne $locId ) ) { $lastId = $locId; print "\n" if( $started ); $started = 1; - print "
\n"; + print "
\n"; my $addr = PciIds::Address::new( $locId ); print "

".encode( $addr->pretty() )."

\n"; print htmlDiv( 'name', '

'.encode( $actName ) ) if( defined( $actName ) ); - print htmlDiv( 'description', '

'.encode( $actDescription ) ) if( defined( $actDescription ) ); - print '

'.encode( $actText ) if( defined( $actText ) ); + print htmlDiv( 'note', '

'.encode( $actNote ) ) if( defined( $actNote ) ); + print '

'.encode( $actDisc ) if( defined( $actDisc ) ); print '

'.encode( $addr->parent()->pretty() )."" if( defined( $addr->parent() ) ); print htmlDiv( 'author', '

'.encode( $actUser ) ) if( defined( $actUser ) ); print "\n" if( defined( $subcnt ) ); @@ -40,28 +40,28 @@ sub genNewAdminForm( $$$$ ) { $cnt++; print "\n"; print "

I will decide later.\n"; - if( defined( $actCom ) ) { + if( defined( $actHist ) ) { print "
Keep current name.\n"; } print "
Delete item.\n"; - print "
Add comment:\n"; + print "
Add discussion:\n"; print "
\n"; print "
Set name:\n"; - print "
Set description:\n"; - print "
Text:\n"; + print "
Set note:\n"; + print "
Discussion:\n"; print "
\n"; } - print "

\n"; + print "
\n"; print "

".encode( $name ) if( defined( $name ) ); - print "

".encode( $description ) if( defined( $description ) ); - print '

'.encode( $text ) if( defined( $text ) ); + print "

".encode( $note ) if( defined( $note ) ); + print '

'.encode( $disc ) if( defined( $disc ) ); print "

".encode( $user ) if( defined( $user ) ); - print "

Use this one.\n" if( defined( $name ) && ( $name ne "" ) ); + print "

Use this one.\n" if( defined( $name ) && ( $name ne "" ) ); $hiscnt ++; - print "
Delete comment.\n"; + print "
Delete history.\n"; print "

\n"; $subcnt ++; - print "\n"; + print "\n"; } print "\n" if( defined( $subcnt ) ); if( $started ) { @@ -69,7 +69,7 @@ sub genNewAdminForm( $$$$ ) { print "

\n"; print "\n"; } else { - print "

No pending comments.\n"; + print "

No pending items.\n"; } print "\n"; genHtmlTail(); @@ -94,7 +94,7 @@ sub markAllChecked( $$$$ ) { next unless( defined( $id ) ); next if( $deleted->{$id} );#Do not update this one, already deleted $tables->markChecked( $id ); - tulog( $authid, "Comment checked $id" ); + tulog( $authid, "Discussion checked $id" ); } } @@ -112,36 +112,36 @@ sub submitAdminForm( $$$$ ) { if( $del ne '' ) { $deleted{$del} = 1; $tables->deleteHistory( $del ); - tulog( $authid, "Comment deleted $del" ); + tulog( $authid, "Discussion deleted $del" ); } } for( my $i = 1; $i <= $maxcnt; $i ++ ) { my $action = getFormValue( "action-$i", 'ignore' ); my $loc = getFormValue( "loc-$i", undef ); next unless( defined( $loc ) ); - my( $text, $name, $description ) = ( - getFormValue( "text-$i", undef ), + my( $discussion, $name, $note ) = ( + getFormValue( "discussion-$i", undef ), getFormValue( "name-$i", undef ), - getFormValue( "description-$i", undef ) ); - if( defined( $description ) && ( $description ne '' ) && ( !defined( $name ) || ( length $name < 3 ) ) ) { + getFormValue( "note-$i", undef ) ); + if( defined( $note ) && ( $note ne '' ) && ( !defined( $name ) || ( length $name < 3 ) ) ) { if( $errors eq '' ) { $errors = '

'; } else { $errors .= '
'; } - $errors .= "$loc - You need to provide name if you provide description\n"; + $errors .= "$loc - You need to provide name if you provide note\n"; next; } - if( ( defined( $name ) && ( length $name >= 3 ) ) || ( defined( $text ) && ( $text ne '' ) ) ) { #Submited comment + if( ( defined( $name ) && ( length $name >= 3 ) ) || ( defined( $discussion ) && ( $discussion ne '' ) ) ) { #Submited comment my $addr = PciIds::Address::new( $loc ); - my $comId = $tables->submitComment( { 'name' => $name, 'description' => $description, 'explanation' => $text }, $auth, $addr ); + my $histId = $tables->submitHistory( { 'name' => $name, 'note' => $note, 'text' => $discussion }, $auth, $addr ); my $main = defined $name && ( $name ne '' ); - notify( $tables, $addr->get(), $comId, $main ? 2 : 0, $main ? 2 : 1 ); - $tables->markChecked( $comId ); - tulog( $authid, "Comment created (admin) $comId $loc ".logEscape( $name )." ".logEscape( $description )." ".logEscape( $text ) ); + notify( $tables, $addr->get(), $histId, $main ? 2 : 0, $main ? 2 : 1 ); + $tables->markChecked( $histId ); + tulog( $authid, "Discussion submited (admin) $histId $loc ".logEscape( $name )." ".logEscape( $note )." ".logEscape( $discussion ) ); if( defined( $name ) && ( length $name >= 3 ) ) { - $tables->setMainComment( $loc, $comId ); - tulog( $authid, "Item main comment changed $loc $comId" ); + $tables->setMainHistory( $loc, $histId ); + tulog( $authid, "Item main history changed $loc $histId" ); $action = 'keep'; } } @@ -155,9 +155,9 @@ sub submitAdminForm( $$$$ ) { } #Ignore if it was already deleted by superitem } elsif( my( $setId ) = ( $action =~ /set-(.*)/ ) ) { next if( $deleted{$setId} ); - $tables->setMainComment( $loc, $setId ); + $tables->setMainHistory( $loc, $setId ); notify( $tables, $loc, $setId, 2, 2 ); - tulog( $authid, "Item main comment changed $loc $setId" ); + tulog( $authid, "Item main history changed $loc $setId" ); markAllChecked( $tables, $i, \%deleted, $authid ); } }