'searchlocalname' => 'SELECT l.id, l.name, p.name FROM locations AS l JOIN locations AS p ON l.parent = p.id WHERE l.name LIKE ? AND l.id LIKE ? ORDER BY LENGTH(l.id), l.id',
'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 ) )'
+ '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 = ?'
} );
}
return $self->query( 'searchname', [ "%$search%" ] );
}
+sub itemName( $$ ) {
+ my( $self, $id ) = @_;
+ my $result = $self->query( 'itemname', [ $id ] )->[0]->[0];
+ return defined $result ? $result : '';
+}
+
1;
print "<col class='author'><col class='main'><col class='controls' span='2'>\n";
print "<tr class='label'><p>\n";
print "<td class='path' colspan='2'>";
- genPathBare( $req, $addr, 1, 0 );
+ genPathBare( $req, $addr, 1, 0, $tables );
print "<input type='hidden' name='loc-$cnt-subcnt' value='$subcnt'>" if( $subcnt );
$subcnt = 0;
$cnt ++;
return HTTP_SEE_OTHER;
}
-sub genPathBare( $$$$ ) {
- my( $req, $address, $printAddr, $started ) = @_;
+sub genPathBare( $$$$$ ) {
+ my( $req, $address, $printAddr, $started, $tables ) = @_;
my $path;
if( defined $address ) {
$path = $address->path();
if( !$printAddr && $myAddr ) {
print "<strong>".encode( $addr->pretty() )."</strong>";
} else {
- print "<a href='/read/".$addr->get()."'>".encode( $addr->pretty() )."</a>";
+ my $title = '';
+ $title = ' title="'.encode( $tables->itemName( $addr->get() ) ).'"' if defined $tables;
+ print "<a href='/read/".$addr->get()."'$title>".encode( $addr->pretty() )."</a>";
}
print ")" if( $exception );
}
my( $req, $address, $printAddr ) = @_;
print "<div class='path'>\n";
print "<p><a href='/'>Main</a>";
- genPathBare( $req, $address, $printAddr, 1 );
+ genPathBare( $req, $address, $printAddr, 1, undef );
print "</div>\n";
}