'hasChildren' => 'SELECT DISTINCT 1 FROM locations WHERE parent = ?',
'hasMain' => 'SELECT DISTINCT 1 FROM locations WHERE id = ? AND mainhistory IS NOT NULL',
'notif-exists' => 'SELECT DISTINCT 1 FROM notifications WHERE user = ? AND ( location = ? OR ( recursive = 1 AND type <= 1 AND SUBSTR( ?, 1, LENGTH( location ) ) = location ) )',
- 'itemname' => 'SELECT name FROM locations WHERE id = ?'
+ 'itemname' => 'SELECT name FROM locations WHERE id = ?',
+ 'admincount' => 'SELECT COUNT( DISTINCT location ) FROM history WHERE seen = 0 AND location LIKE ?'
} );
}
return defined $result ? $result : '';
}
+sub adminCount( $$ ) {
+ my( $tables, $prefix ) = @_;
+ return $tables->query( 'admincount', [ "$prefix%" ] )->[0]->[0];
+}
+
1;
my $moreButt = 'admin?limit='.( $limit ? int( $limit * 2 ) : 160 ).buildExcept( 'action', $args );
$moreButt .= '?global='.$glob if defined $glob;
genCustomHead( $req, $args, $address, $caption, [ $address->canAddItem() ? [ 'Add item', 'newitem' ] : (), $address->canDiscuss() ? [ 'Discuss', 'newhistory' ] : (), $glob ? [ 'Local', 'admin'.buildExcept( 'action', $args ) ] : [ 'Global', 'admin?global=1'.buildExcept( 'action', $args ) ], [ 'More items', $moreButt ], [ 'Help', 'help', 'admin' ] ], [ [ 'Log out', 'logout' ] ] );
+ print "<p>Pending events: ".$tables->adminCount( $glob ? '' : $address->get() );
print "<div class='error'>$error</div>\n" if( defined $error );
print "<form name='admin' id='admin' class='admin' method='POST' action=''>\n";
my $lastId;