Phpliteadmin should remeber selected tab when switching between tables

Issue #229 wontfix
Former user created an issue

Originally reported on Google Code with ID 229

1. Choose a table (e.g. "TableA")
2. Choose a tab different than "row_view" (e.g. "column_view")
3. Choose another table (e.g. "TableB")

Instead of showing "column_view" tab of "TableB", phpliteadmin shows "row_view".

I think that it could be useful if phpliteadmin remembered the current tab.

Then, I propose using something like

    $action = isset($_GET['action']) ? $_GET['action'] : 'row_view';
    for($i=0; $i<sizeof($result); $i++)
    {
        if(substr($result[$i]['name'], 0, 7)!="sqlite_" && $result[$i]['name']!="")
        {
            echo "<span class='sidebar_table'>[".$lang[$result[$i]['type']=='table'?'tbl':'view']."]</span>
";
            echo "<a href='".PAGE."?action=".$action."&amp;table=".urlencode($result[$i]['name']).($result[$i]['type']=='view'?'&amp;view=1':'')."'";
            if(isset($_GET['table']) && $_GET['table']==$result[$i]['name'])
                echo " class='active_table'";
            echo ">".htmlencode($result[$i]['name'])."</a><br/>";
            $j++;
        }
    }

instead of

    for($i=0; $i<sizeof($result); $i++)
    {
        if(substr($result[$i]['name'], 0, 7)!="sqlite_" && $result[$i]['name']!="")
        {
            echo "<span class='sidebar_table'>[".$lang[$result[$i]['type']=='table'?'tbl':'view']."]</span>
";
            echo "<a href='".PAGE."?action=row_view&amp;table=".urlencode($result[$i]['name']).($result[$i]['type']=='view'?'&amp;view=1':'')."'";
            if(isset($_GET['table']) && $_GET['table']==$result[$i]['name'])
                echo " class='active_table'";
            echo ">".htmlencode($result[$i]['name'])."</a><br/>";
            $j++;
        }
    }


I am using
* phpLiteAdmin v1.9.4.1 
* PHP 5.4.17
* PDO
* SQLite version 3.7.7.1
* Apache 2.4.6
* Windows XP SP3

Reported by Loirooriol on 2013-08-30 18:20:24

Comments (3)

  1. Former user Account Deleted
    Maybe like this is better:
    
        $condAction = isset($_GET['action']) && !isset($_GET['confirm']);
        for($i=0; $i<sizeof($result); $i++)
        {
            if(substr($result[$i]['name'], 0, 7)!="sqlite_" && $result[$i]['name']!="")
            {
                $action = $condAction && $result[$i]['name'] !== $_GET['table'] ? $_GET['action']
    : 'row_view';
                echo "<span class='sidebar_table'>[".$lang[$result[$i]['type']=='table'?'tbl':'view']."]</span>
    ";
                echo "<a href='".PAGE."?action=".$action."&table=".urlencode($result[$i]['name']).($result[$i]['type']=='view'?'&view=1':'')."'";
                if(isset($_GET['table']) && $_GET['table']==$result[$i]['name'])
                    echo " class='active_table'";
                echo ">".htmlencode($result[$i]['name'])."</a><br/>";
                $j++;
            }
        }
    
    I think that if `isset($_GET['action'])` is `true`, then `isset($_GET['table'])` must
    be true too.
    If I am wrong, to avoid errors, `$condAction` should be
    
        $condAction = isset($_GET['table']) && isset($_GET['action']) && !isset($_GET['confirm']);
    

    Reported by Loirooriol on 2013-09-01 00:23:06

  2. Christopher Kramer
    Hmm. I am not sure if phpLiteAdmin really should remember the tab.
    phpMyAdmin also does not do it. I am not sure I would find this intuitive or useful.
    Any other opinions?
    Maybe we should add an extra link to allow users to switch to the row_view action directly
    like phpMyAdmin does?
    

    Reported by crazy4chrissi on 2013-12-24 13:10:15 - Labels added: Type-Enhancement - Labels removed: Type-Defect

  3. phpLiteAdmin repo owner
    • edited description
    • changed status to wontfix

    Closing this as nobody else commented on it and I don't think it is intuitive. Since commit ff57c690a7dad9cf11ea062ba1965a81feb28f07, we now have two link in the list of tables, though: one to the browse (row_view) tab, one to the structure (column_view) tab, similar to phpMyAdmin.

  4. Log in to comment