SylvainTI / phpliteadmin

Automatically exported from code.google.com/p/phpliteadmin
0 stars 0 forks source link

Phpliteadmin should remeber selected tab when switching between tables #229

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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

Original issue reported on code.google.com by Loiroor...@gmail.com on 30 Aug 2013 at 6:20

GoogleCodeExporter commented 9 years ago
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']);

Original comment by Loiroor...@gmail.com on 1 Sep 2013 at 12:23

GoogleCodeExporter commented 9 years ago
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?

Original comment by crazy4ch...@gmail.com on 24 Dec 2013 at 1:10