Fixed tabs for non-schema db's.
authorjollytoad <jollytoad>
Thu, 15 Jul 2004 09:32:52 +0000 (09:32 +0000)
committerjollytoad <jollytoad>
Thu, 15 Jul 2004 09:32:52 +0000 (09:32 +0000)
Hide some tabs for features not present in db.

classes/Misc.php

index 9e5571f3a92d857b8280e803ef9f05c655480fd3..fcd555d21d9f86c9ff952e7fc25af2b1755f583b 100644 (file)
@@ -2,7 +2,7 @@
        /**
         * Class to hold various commonly used functions
         *
-        * $Id: Misc.php,v 1.73 2004/07/13 16:13:14 jollytoad Exp $
+        * $Id: Misc.php,v 1.74 2004/07/15 09:32:52 jollytoad Exp $
         */
         
        class Misc {
                                                'casts' => array (
                                                        'title' => $lang['strcasts'],
                                                        'url'   => "casts.php?{$vars}",
+                                                       'hide'  => (!$data->hasCasts()),
                                                ),
                                                'export' => array (
                                                        'title' => $lang['strexport'],
                                                'domains' => array (
                                                        'title' => $lang['strdomains'],
                                                        'url'   => "domains.php?{$vars}",
+                                                       'hide'  => (!$data->hasDomains()),
                                                ),
                                                'aggregates' => array (
                                                        'title' => $lang['straggregates'],
                                                'conversions' => array (
                                                        'title' => $lang['strconversions'],
                                                        'url'   => "conversions.php?{$vars}",
-                                                       'hide'  => $hide_advanced,
+                                                       'hide'  => ($hide_advanced || !$data->hasConversions()),
                                                ),
                                        );
 
                                                $this->printTabs($this->getNavTabs('database'),$activetab);
                                                $this->printTabs($this->getNavTabs('schema'),$activetab);
                                                $_SESSION['webdbLastTab']['database'] = $activetab;
-                                               $_SESSION['webdbLastTab']['schema'] = $activetab;
                                                break;
                                        }
                                default:
                 * Get the URL for the last active tab of a particular tab bar.
                 */
                function getLastTabURL($section) {
-                       $tabs = $this->getNavTabs($section);
+                       switch ($section) {
+                               case 'database':
+                               case 'schema':
+                                       if ($data->hasSchemas() === false) {
+                                               $section = 'database';
+                                               $tabs = array_merge($this->getNavTabs('schema'), $this->getNavTabs('database'));
+                                               break;
+                                       }
+                               default:
+                                       $tabs = $this->getNavTabs($section);
+                       }
                        
                        if (isset($_SESSION['webdbLastTab'][$section]))
                                $tab = $tabs[$_SESSION['webdbLastTab'][$section]];