]> mj.ucw.cz Git - pciids.git/commitdiff
Tooltips with name in admin interface
authorMichal Vaner <vorner@ucw.cz>
Mon, 13 Oct 2008 20:47:45 +0000 (22:47 +0200)
committerMichal Vaner <vorner@ucw.cz>
Mon, 13 Oct 2008 20:47:45 +0000 (22:47 +0200)
PciIds/DBQ.pm
PciIds/Html/Admin.pm
PciIds/Html/Util.pm

index cb82576474e7eaf34fccef321cc1a8900d1124f5..bf7134de1a566c67e5066bb94374070df40af25e 100644 (file)
@@ -118,7 +118,8 @@ sub new( $ ) {
                '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 = ?'
        } );
 }
 
@@ -387,4 +388,10 @@ sub searchName( $$$ ) {
        return $self->query( 'searchname', [ "%$search%" ] );
 }
 
+sub itemName( $$ ) {
+       my( $self, $id ) = @_;
+       my $result = $self->query( 'itemname', [ $id ] )->[0]->[0];
+       return defined $result ? $result : '';
+}
+
 1;
index 6b90c7c2015345dd00572629249cda3f6588190e..056d353004022ab6e5fec1c85cb7a0b5ba4d1698 100644 (file)
@@ -166,7 +166,7 @@ function answer( id ) {
                        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 ++;
index 8a5c80478bcd5d5104941bb5ac1e3fd6f63c4b6d..615bac53875460bb232816720ea914d83dec1380 100644 (file)
@@ -193,8 +193,8 @@ sub HTTPRedirect( $$ ) {
        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();
@@ -216,7 +216,9 @@ sub genPathBare( $$$$ ) {
                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 );
        }
@@ -226,7 +228,7 @@ sub genPath( $$$ ) {
        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";
 }