]> mj.ucw.cz Git - pciids.git/commitdiff
New terminology, part 2 -- DBQ function names
authorMichal Vaner <vorner@ucw.cz>
Fri, 29 Aug 2008 18:48:55 +0000 (20:48 +0200)
committerMichal Vaner <vorner@ucw.cz>
Fri, 29 Aug 2008 18:48:55 +0000 (20:48 +0200)
PciIds/DBQ.pm
PciIds/Html/Admin.pm
PciIds/Html/Changes.pm
scripts/importil.pl

index 7d4e6ef01d6a3a97ab4e16df36af4cc8c830107d..63b201ca2b1632bef8e1c20e581b43c23109d235 100644 (file)
@@ -28,7 +28,7 @@ sub new( $ ) {
                'setlastlog' => 'UPDATE users SET logtime = now(), lastlog = ? WHERE id = ?',
                'rights' => 'SELECT rightId FROM rights WHERE userId = ?',
                'newitem' => 'INSERT INTO locations (id, parent) VALUES(?, ?)',
-               'newcomment' => 'INSERT INTO history (location, owner, discussion, nodename, nodenote) VALUES(?, ?, ?, ?, ?)',
+               'newhistory' => 'INSERT INTO history (location, owner, discussion, nodename, nodenote) VALUES(?, ?, ?, ?, ?)',
                'history' => 'SELECT history.id, history.discussion, history.time, history.nodename, history.nodenote, history.seen, users.login FROM history LEFT OUTER JOIN users ON history.owner = users.id WHERE history.location = ? ORDER BY history.time',
                'admindump' => 'SELECT
                        locations.id, locations.name, locations.note, locations.mainhistory, musers.login, main.discussion,
@@ -39,11 +39,11 @@ sub new( $ ) {
                        LEFT OUTER JOIN history AS main ON locations.mainhistory = main.id
                        LEFT OUTER JOIN users AS musers ON main.owner = musers.id WHERE history.seen = "0"
                ORDER BY locations.id, history.id
-               LIMIT 15',#Dumps new comments with their senders and corresponding main comments and names
+               LIMIT 15',#Dumps new discussion submits with their senders and corresponding main history and names
                'delete-hist' => 'DELETE FROM history WHERE id = ?',
                'mark-checked' => 'UPDATE history SET seen = 1 WHERE id = ?',
                'delete-item' => 'DELETE FROM locations WHERE id = ?',
-               'set-maincomment' => 'UPDATE locations SET
+               'set-mainhist' => 'UPDATE locations SET
                                mainhistory = ?,
                                name = ( SELECT nodename FROM history WHERE id = ? ),
                                note = ( SELECT nodenote FROM history WHERE id = ? )
@@ -187,7 +187,7 @@ sub submitItem( $$$ ) {
        return( 'exists', undef ) if( defined( $self->item( $addr->get(), 0 ) ) );
        eval {
                $self->command( 'newitem', [ $addr->get(), $addr->parent()->get() ] );
-               $self->command( 'newcomment', [ $addr->get(), $auth->{'authid'}, $data->{'text'}, $data->{'name'}, $data->{'description'} ] );
+               $self->command( 'newhistory', [ $addr->get(), $auth->{'authid'}, $data->{'text'}, $data->{'name'}, $data->{'description'} ] );
 
        };
        if( $@ ) {
@@ -197,9 +197,9 @@ sub submitItem( $$$ ) {
        return( '', $self->last() );
 }
 
-sub submitComment( $$$$ ) {
+sub submitHistory( $$$$ ) {
        my( $self, $data, $auth, $address ) = @_;
-       $self->command( 'newcomment', [ $address->get(), $auth->{'authid'}, $data->{'text'}, $data->{'name'}, $data->{'description'} ], 1 );
+       $self->command( 'newhistory', [ $address->get(), $auth->{'authid'}, $data->{'text'}, $data->{'name'}, $data->{'description'} ], 1 );
        return $self->last();
 }
 
@@ -222,9 +222,9 @@ sub deleteItem( $$ ) {
        $self->command( 'delete-item', [ $id ] );
 }
 
-sub setMainComment( $$$ ) {
-       my( $self, $location, $comment ) = @_;
-       $self->command( 'set-maincomment', [ $comment, $comment, $comment, $location ] );
+sub setMainHistory( $$$ ) {
+       my( $self, $location, $history ) = @_;
+       $self->command( 'set-mainhist', [ $history, $history, $history, $location ] );
 }
 
 sub resetInfo( $$ ) {
@@ -285,9 +285,9 @@ sub submitNotification( $$$$ ) {
 }
 
 sub pushNotifications( $$$$$ ) {
-       my( $self, $location, $comment, $priority, $reason ) = @_;
-       $self->command( 'notify', [ $comment, 0, $reason, 0, $priority, $location, $location ] );
-       $self->command( 'notify', [ $comment, 1, $reason, 1, $priority, $location, $location ] );
+       my( $self, $location, $history, $priority, $reason ) = @_;
+       $self->command( 'notify', [ $history, 0, $reason, 0, $priority, $location, $location ] );
+       $self->command( 'notify', [ $history, 1, $reason, 1, $priority, $location, $location ] );
        $self->command( 'newtime-mail', [ $priority, $location, $location ] );
        $self->command( 'newtime-xmpp', [ $priority, $location, $location ] );
 }
index e945bd7ffb9bba024047cd27a3cd40f9c3c508b3..d5773eb46dfc556d69b73ba44a748434017d7bb4 100644 (file)
@@ -134,13 +134,13 @@ sub submitAdminForm( $$$$ ) {
                        }
                        if( ( defined( $name ) && ( length $name >= 3 ) ) || ( defined( $text ) && ( $text ne '' ) ) ) { #Submited comment
                                my $addr = PciIds::Address::new( $loc );
-                               my $comId = $tables->submitComment( { 'name' => $name, 'description' => $description, 'explanation' => $text }, $auth, $addr );
+                               my $comId = $tables->submitHistory( { 'name' => $name, 'description' => $description, 'explanation' => $text }, $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 ) );
                                if( defined( $name ) && ( length $name >= 3 ) ) {
-                                       $tables->setMainComment( $loc, $comId );
+                                       $tables->setMainHistory( $loc, $comId );
                                        tulog( $authid, "Item main comment changed $loc $comId" );
                                        $action = 'keep';
                                }
@@ -155,7 +155,7 @@ 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" );
                                markAllChecked( $tables, $i, \%deleted, $authid );
index d31c916039311a0dfb1265fc3bc22f9708700e51..e444f06fb84100260e14a97af2fb91f6b09235a9 100644 (file)
@@ -125,7 +125,7 @@ sub newCommentSubmit( $$$$ ) {
                        return undef;
                }, sub { return $address->canAddComment() ? undef : 'You can not discuss this item'; } ] );
                return genNewCommentForm( $req, $args, $tables, $error, $data ) if( defined $error );
-               my $hid = $tables->submitComment( $data, $auth, $address );
+               my $hid = $tables->submitHistory( $data, $auth, $address );
                tulog( $auth->{'authid'}, "Comment 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' );
index add02d1a8a4f0c3767fd646b6d686159ed3cdbb8..7e0fe4b02e156a1ad0372a6d3d798fe721f87333 100755 (executable)
@@ -82,7 +82,7 @@ sub markAllSeen() {
 }
 
 sub setMain( $ ) {
-       $db->setMainComment( $addr->get(), shift );
+       $db->setMainHistory( $addr->get(), shift );
 }
 
 print "Importing\n";