#189 (ok 3.0-dev) Display foreign keys values while browsing

closed-accepted
Marc Delisle
None
1
2008-09-27
2004-02-10
Dave Grijalva
No

I would like the option to see my related table
information in the table instead of as a tooltip. This
is referring to the browse/select results view.

example:
<A HREF="[link]">1</A> - Dave
instead of:
<A HREF="[link]" TITLE="Dave">1</A>

Perhapse also, the ability to limit the amount of text
displayed:

example:
<A HREF="[link]" TITLE="Some really long text.">1</A> -
Some really ...

I would be willing to work on the implimentation of
this feature.

Discussion

  • Dave Grijalva
    Dave Grijalva
    2004-02-10

    Logged In: YES
    user_id=937152

    I went ahead and wrote an implimentation. See details below.
    You can go ahead and change the variable names/comments
    if you so desire. If you impliment this, that is. Thanks for
    taking the time to consider this.

    Details:

    FILE : /config.inc.php
    LINE : 530

    //Added by Dave Grijalva
    $cfg['RelationDataLength'] = FALSE; //The max
    number of characters to show when displaying relation

    //data in the browse/sql result pages.  0 for
    

    unlimited. FALSE for none.
    ------------------------------------------------------------
    ------------------------------------------------------------
    -----------------------------

    FILE : /libraries/display_tbl.lib.php
    LINE : 1319

    //Added by Dave Grijalva
    if( (is_numeric($GLOBALS['cfg']['RelationDataLength'])) && (!
    empty($dispval)) ){
    if( (strlen($dispval) > $GLOBALS['cfg']
    ['RelationDataLength']) && ($GLOBALS['cfg']
    ['RelationDataLength'] > 0) )
    $vertical_display['data'][$row_no][$i] .=
    substr($dispval, 0, $GLOBALS['cfg']
    ['RelationDataLength']) . '... - ';
    else
    $vertical_display['data'][$row_no][$i] .=
    $dispval . ' - ';
    }
    ------------------------------------------------------------
    ------------------------------------------------------------
    -----------------------------

    The extra config option can go anywhere in that file. The
    snipet from display_tbl.lib.php goes in the
    PMA_displayTableBody function between the lines

    $title = (!empty($dispval))? ' title="' . htmlspecialchars
    ($dispval) . '"' : '';

    and

    $vertical_display['data'][$row_no][$i] .= '<a href="sql.php?'

    ... Look for "Dave" or "Dave Grijalva" in the attached file to
    see exactly.

     
  • Dave Grijalva
    Dave Grijalva
    2004-02-10

    My display_tbl.lib.php file with the changes.

     
    Attachments
  • Logged In: YES
    user_id=418833

    The Problem I have with your feature is that we do not
    display the true content of the table anymore. This can be
    really confusing imho.

    If you want a view like that, I'd suggest you to bookmark a
    SELECT query that joins your tables and displays the fields
    you want.

    We could add a new type of browse mode that does this
    automatically, but imho the normal browse mode should always
    display the raw data as it appears inside the database.

     
  • Dave Grijalva
    Dave Grijalva
    2004-02-11

    Logged In: YES
    user_id=937152

    I disagree. You still get the "TRUE" content of the table. Its
    even colored differently (in blue cause it's a link). This
    feature is helpful because you can see, at a glance, what
    that reference number actually means.

    Besides, we're only talking about about 10 lines of code. If
    you distribute with this feature turned off (FALSE), its only an
    optional feature. If people find it helpful, they can just turn it
    on. If not, one extra variable check will not affect
    performance of those who dont care for it.

     
  • Michal Čihař
    Michal Čihař
    2004-05-05

    • summary: Display Fields shown on Browse View --> Display foreign keys values while browsing
     
  • Dave Grijalva
    Dave Grijalva
    2004-05-11

    Logged In: YES
    user_id=937152

    please note that this feature still shows the true content
    of the cell. also note that this is already avalable on the
    printed version of the report. why should it be ok for the
    printed version and not the online version.

    I have been using this feature on my install for the last
    few months and it is extremely helpful. It couldnt hurt to
    make it available to other users.

     
  • Dave Grijalva
    Dave Grijalva
    2004-05-11

    Logged In: YES
    user_id=937152

    I updated this mod so the foreign data can be styled.

    ////////////////////////////////////////////////////////////////
    ////////Feel free to remove the "Added by Dave Grijalva" part

                //Added by Dave Grijalva
                if\( \(is\_numeric\($GLOBALS\['cfg'\]\['RelationDataLength'\]\)\)
    

    && (!empty($dispval)) ){
    if( (strlen($dispval) >
    $GLOBALS['cfg']['RelationDataLength']) &&
    ($GLOBALS['cfg']['RelationDataLength'] > 0) )
    $vertical_display['data'][$row_no][$i] .= '<SPAN
    CLASS="foreign_data">' . substr($dispval, 0,
    $GLOBALS['cfg']['RelationDataLength']) . '...</SPAN> - ';
    else
    $vertical_display['data'][$row_no][$i] .= '<SPAN
    CLASS="foreign_data">' . $dispval . '</SPAN> - ';
    }

     
  • Marc Delisle
    Marc Delisle
    2004-05-19

    • labels: 509327 -->
    • milestone: 284147 -->
     
  • Dave Grijalva
    Dave Grijalva
    2005-01-20

    Logged In: YES
    user_id=937152

    I created a patch from the latest cvs.

     
  • Dave Grijalva
    Dave Grijalva
    2005-01-20

    Patch from latest cvs

     
    Attachments
  • Marc Delisle
    Marc Delisle
    2006-06-30

    Logged In: YES
    user_id=210714

    Maybe we should merged this as a MIME-based transformation.

     
  • Marc Delisle
    Marc Delisle
    2008-05-21

    • assigned_to: nobody --> lem9
     
  • Marc Delisle
    Marc Delisle
    2008-05-23

    Logged In: YES
    user_id=210714
    Originator: NO

    Feature added in the 3.0-dev branch as a display option (selectable on-the-fly).

     
  • Marc Delisle
    Marc Delisle
    2008-05-23

    • priority: 5 --> 1
    • summary: Display foreign keys values while browsing --> (ok 3.0-dev) Display foreign keys values while browsing
    • status: open --> open-accepted
     
  • Marc Delisle
    Marc Delisle
    2008-09-27

    • status: open-accepted --> closed-accepted