From: Michal Vaner Date: Sun, 26 Oct 2008 19:47:04 +0000 (+0100) Subject: Update to admin interface X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=724470d0d44b3679f406e3f1f05b53cd37db7496;p=pciids.git Update to admin interface * List whole history of an item * Put the select boxes only to items with names --- diff --git a/PciIds/DBQ.pm b/PciIds/DBQ.pm index ac47610..1065797 100644 --- a/PciIds/DBQ.pm +++ b/PciIds/DBQ.pm @@ -21,15 +21,16 @@ use strict; use warnings; use base 'PciIds::DBQAny'; -my $adminDumpSql = 'SELECT +my $adminDumpSql = 'SELECT DISTINCT locations.id, locations.name, locations.note, locations.mainhistory, musers.email, musers.login, main.discussion, main.time, - history.id, history.discussion, history.nodename, history.nodenote, users.email, users.login, history.time + history.id, history.discussion, history.nodename, history.nodenote, users.email, users.login, history.time, history.seen FROM locations INNER JOIN history ON history.location = locations.id LEFT OUTER JOIN users ON history.owner = users.id 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" AND locations.id LIKE ? + LEFT OUTER JOIN history AS test ON test.location = locations.id + WHERE test.seen = "0" AND locations.id LIKE ? ORDER BY locations.id, history.id LIMIT '; diff --git a/PciIds/Html/Admin.pm b/PciIds/Html/Admin.pm index 7b73cb4..31833f2 100644 --- a/PciIds/Html/Admin.pm +++ b/PciIds/Html/Admin.pm @@ -47,7 +47,11 @@ sub mailEncode( $$ ) { sub genHist( $$$$$$$$$$$ ) { my( $class, $email, $login, $time, $name, $note, $disc, $selname, $selvalue, $delname, $delvalue ) = @_; print ""; - print "\n"; + if( defined $selname ) { + print "\n"; + } else { + print "\n"; + } if( defined $delname ) { print "\n"; } else { @@ -155,7 +159,7 @@ function answer( id ) { print "// -->"; foreach( @{$tables->adminDump( $prefix, $limit )} ) { my( $locId, $actName, $actNote, $actHist, $actEmail, $actLogin, $actDisc, $actTime, - $hist, $disc, $name, $note, $email, $login, $time ) = @{$_}; + $hist, $disc, $name, $note, $email, $login, $time, $seen ) = @{$_}; if( !defined( $lastId ) || ( $lastId ne $locId ) ) { last if( $hiscnt > ( defined $limit ? $limit : 80 ) ); $lastId = $locId; @@ -186,15 +190,17 @@ function answer( id ) { print ""; genPathBare( $req, $addr, 1, 0, $tables ); print ""; - if( defined $actHist ) { - genHist( 'main-history', $actEmail, $actLogin, $actTime, $actName, $actNote, $actDisc, "loc-$cnt-sel", 'seen', undef, undef ); - } else { + if( !defined $actHist ) { print ""; } } $hiscnt ++; $subcnt ++; - genHist( 'unseen-history', $email, $login, $time, $name, $note, $disc, "loc-$cnt-sel", $hist, "del-$hiscnt", "del-$hist" ); + if( $hist eq $actHist ) { + genHist( 'main-history', $actEmail, $actLogin, $actTime, $actName, $actNote, $actDisc, "loc-$cnt-sel", 'seen', undef, undef ); + } else { + genHist( $seen ? 'history' : 'unseen-history', $email, $login, $time, $name, $note, $disc, ( defined $name && $name ne '' ) ? "loc-$cnt-sel" : undef, $hist, "del-$hiscnt", "del-$hist" ); + } print ""; print ""; }