From: Michal Vaner Date: Fri, 29 Aug 2008 20:00:08 +0000 (+0200) Subject: New terminology, finist -- admin part X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=53b21dc64db21ed1df17ca486b9a51b7bd9d64b2;p=pciids.git New terminology, finist -- admin part --- diff --git a/PciIds/Address/Base.pm b/PciIds/Address/Base.pm index d390c9d..428245d 100644 --- a/PciIds/Address/Base.pm +++ b/PciIds/Address/Base.pm @@ -25,7 +25,7 @@ sub tail( $ ) { return $new; } -sub canAddComment( $ ) { +sub canDiscuss( $ ) { return 1; #By default, comments can be added anywhere } diff --git a/PciIds/Address/Toplevel.pm b/PciIds/Address/Toplevel.pm index 55e5039..0f16698 100644 --- a/PciIds/Address/Toplevel.pm +++ b/PciIds/Address/Toplevel.pm @@ -41,7 +41,7 @@ sub append( $$ ) { return ( PciIds::Address::Base::new( $self->{'value'} . ( ( $self->{'value'} =~ /\/$/ ) ? '' : '/' ) . $suffix ), undef ); } -sub canAddComment( $ ) { return 0; } +sub canAddDiscuss( $ ) { return 0; } sub defaultRestrict( $ ) { my( $self ) = @_; diff --git a/PciIds/Html/Admin.pm b/PciIds/Html/Admin.pm index d5773eb..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->submitHistory( { '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->setMainHistory( $loc, $comId ); - tulog( $authid, "Item main comment changed $loc $comId" ); + $tables->setMainHistory( $loc, $histId ); + tulog( $authid, "Item main history changed $loc $histId" ); $action = 'keep'; } } @@ -157,7 +157,7 @@ sub submitAdminForm( $$$$ ) { next if( $deleted{$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 ); } } diff --git a/PciIds/Html/Changes.pm b/PciIds/Html/Changes.pm index 0dfbc97..2c8cc3a 100644 --- a/PciIds/Html/Changes.pm +++ b/PciIds/Html/Changes.pm @@ -123,10 +123,10 @@ sub newHistorySubmit( $$$$ ) { }, [ sub { my( $data ) = @_; return 'You must provide name too' if( ( length $data->{'note'} ) && ( ! length $data->{'name'} ) ); return undef; - }, sub { return $address->canAddComment() ? undef : 'You can not discuss this item'; } ] ); + }, sub { return $address->canDiscuss() ? undef : 'You can not discuss this item'; } ] ); return genNewHistoryForm( $req, $args, $tables, $error, $data ) if( defined $error ); my $hid = $tables->submitHistory( $data, $auth, $address ); - tulog( $auth->{'authid'}, "Comment created $hid ".$address->get()." ".logEscape( $data->{'name'} )." ".logEscape( $data->{'description'} )." ".logEscape( $data->{'text'} ) ); + tulog( $auth->{'authid'}, "Discussion created $hid ".$address->get()." ".logEscape( $data->{'name'} )." ".logEscape( $data->{'description'} )." ".logEscape( $data->{'text'} ) ); notify( $tables, $address->get(), $hid, ( defined $name && ( $name ne '' ) ) ? 1 : 0, 1 ); return HTTPRedirect( $req, '/read/'.$address->get().'?action=list' ); } else { diff --git a/PciIds/Html/Util.pm b/PciIds/Html/Util.pm index e54b8a7..f29f872 100644 --- a/PciIds/Html/Util.pm +++ b/PciIds/Html/Util.pm @@ -61,7 +61,7 @@ sub genMenu( $$$ ) { push @list, [ 'Log in', 'login' ]; } push @list, [ 'Add item', 'newitem' ] if( $address->canAddItem() ); - push @list, [ 'Discuss', 'newhistory' ] if( $address->canAddComment() ); + push @list, [ 'Discuss', 'newhistory' ] if( $address->canDiscuss() ); push @list, [ 'Administrate', 'admin' ] if( hasRight( $auth->{'accrights'}, 'validate' ) ); push @list, [ 'Profile', 'profile' ] if defined $auth->{'authid'}; push @list, [ 'Notifications', 'notifications' ] if defined $auth->{'authid'};