Use Niko's new icons.
authorjollytoad <jollytoad>
Fri, 25 Nov 2005 08:42:31 +0000 (08:42 +0000)
committerjollytoad <jollytoad>
Fri, 25 Nov 2005 08:42:31 +0000 (08:42 +0000)
classes/Misc.php

index 4253f37073034b921112c0951b1918e4facf07cd..ea1a5904c6fab600164d60092a7435755c818eaa 100644 (file)
@@ -2,7 +2,7 @@
        /**
         * Class to hold various commonly used functions
         *
-        * $Id: Misc.php,v 1.116 2005/11/16 13:35:45 jollytoad Exp $
+        * $Id: Misc.php,v 1.117 2005/11/25 08:42:31 jollytoad Exp $
         */
         
        class Misc {
                        }
                        
                        echo "<table class=\"tabs\"><tr>\n";
+                       #echo "<div class=\"tabs\">\n";
                        
                        # FIXME: don't count hidden tags
                        $width = round(100 / count($tabs)).'%';
                                $active = ($tab_id == $activetab) ? ' active' : '';
                                
                                if (!isset($tab['hide']) || $tab['hide'] !== true) {
-                                       $tablink = "<a" . $this->printActionUrl($tab, $_REQUEST, 'href') . ">{$tab['title']}</a>";
+                                       
+                                       $tablink = "<a" . $this->printActionUrl($tab, $_REQUEST, 'href') . ">";
+                                       
+                                       if (isset($tab['icon']) && $icon = $this->icon($tab['icon']))
+                                               $tablink .= "<img src=\"{$icon}\" /><br />";
+                                       
+                                       $tablink .= "{$tab['title']}</a>";
                                        
                                        echo "<td width=\"{$width}\" class=\"tab{$active}\">";
+                                       #echo "<span class=\"tab{$active}\" style=\"white-space:nowrap;\">";
                                        
                                        if (isset($tab['help']))
                                                $this->printHelp($tablink, $tab['help']);
                                                echo $tablink;
                                        
                                        echo "</td>\n";
+                                       #echo "</span>\n";
                                }
                        }
                        
                        echo "</tr></table>\n";
+                       #echo "</div>\n";
                }
 
                /**
                                                'servers' => array (
                                                        'title' => $lang['strservers'],
                                                        'url'   => "servers.php",
+                                                       'icon'  => 'Servers',
                                                ),
                                        );
 
                                                        'url'   => 'all_db.php',
                                                        'urlvars' => array('subject' => 'server'),
                                                        'help'  => 'pg.database',
+                                                       'icon'  => 'Databases',
                                                ),
                                                'users' => array (
                                                        'title' => $lang['strusers'],
                                                        'urlvars' => array('subject' => 'server'),
                                                        'hide'  => $hide_users,
                                                        'help'  => 'pg.user',
+                                                       'icon'  => 'Users',
                                                ),
                                                'groups' => array (
                                                        'title' => $lang['strgroups'],
                                                        'urlvars' => array('subject' => 'server'),
                                                        'hide'  => $hide_users,
                                                        'help'  => 'pg.group',
+                                                       'icon'  => 'UserGroups',
                                                ),
                                                'account' => array (
                                                        'title' => $lang['straccount'],
                                                        'urlvars' => array('subject' => 'server', 'action' => 'account'),
                                                        'hide'  => !$hide_users,
                                                        'help'  => 'pg.user',
+                                                       'icon'  => 'User',
                                                ),
                                                'tablespaces' => array (
                                                        'title' => $lang['strtablespaces'],
                                                        'urlvars' => array('subject' => 'server'),
                                                        'hide'  => (!$data->hasTablespaces()),
                                                        'help'  => 'pg.tablespace',
+                                                       'icon'  => 'Tablespaces',
                                                ),
                                                'export' => array (
                                                        'title' => $lang['strexport'],
                                                        'url'   => 'all_db.php',
                                                        'urlvars' => array('subject' => 'server', 'action' => 'export'),
                                                        'hide'  => (!$this->isDumpEnabled()),
+                                                       'icon'  => 'Save',
                                                ),
                                                'reports' => array (
                                                        'title' => $lang['strreports'],
                                                        'url'   => 'reports.php',
                                                        'urlvars' => array('subject' => 'server'),
-                                                       'hide' => !$conf['show_reports']
+                                                       'hide' => !$conf['show_reports'],
+                                                       'icon' => 'Statistics',
                                                ),
                                        );
 
-                               case 'database':                                
+                               case 'database':
                                        $tabs = array (
                                                'schemas' => array (
                                                        'title' => $lang['strschemas'],
                                                        'urlvars' => array('subject' => 'database'),
                                                        'hide'  => (!$data->hasSchemas()),
                                                        'help'  => 'pg.schema',
+                                                       'icon'  => 'Schemas',
                                                ),
                                                'sql' => array (
                                                        'title' => $lang['strsql'],
                                                        'urlvars' => array('subject' => 'database', 'action' => 'sql'),
                                                        'help'  => 'pg.sql',
                                                        'tree'  => false,
+                                                       'icon'  => 'SqlEditor'
                                                ),
                                                'find' => array (
                                                        'title' => $lang['strfind'],
                                                        'url'   => 'database.php',
                                                        'urlvars' => array('subject' => 'database', 'action' => 'find'),
                                                        'tree'  => false,
+                                                       'icon'  => 'Search'
                                                ),
                                                'variables' => array (
                                                        'title' => $lang['strvariables'],
                                                        'hide'  => (!$data->hasVariables()),
                                                        'help'  => 'pg.variable',
                                                        'tree'  => false,
+                                                       'icon'  => 'Property',
                                                ),
                                                'processes' => array (
                                                        'title' => $lang['strprocesses'],
                                                        'hide'  => (!$data->hasProcesses()),
                                                        'help'  => 'pg.process',
                                                        'tree'  => false,
+                                                       'icon'  => 'Statistics',
                                                ),
                                                'admin' => array (
                                                        'title' => $lang['stradmin'],
                                                        'hide'  => (!isset($data->privlist['database'])),
                                                        'help'  => 'pg.privilege',
                                                        'tree'  => false,
+                                                       'icon'  => 'Key',
                                                ),
                                                'languages' => array (
                                                        'title' => $lang['strlanguages'],
                                                        'urlvars' => array('subject' => 'database'),
                                                        'hide'  => $hide_advanced,
                                                        'help'  => 'pg.language',
+                                                       'icon'  => 'Languages',
                                                ),
                                                'casts' => array (
                                                        'title' => $lang['strcasts'],
                                                        'urlvars' => array('subject' => 'database'),
                                                        'hide'  => ($hide_advanced || !$data->hasCasts()),
                                                        'help'  => 'pg.cast',
+                                                       'icon'  => 'Casts',
                                                ),
                                                'slony' => array (
                                                        'title' => 'Slony',
                                                        'urlvars' => array('subject' => 'database', 'action' => 'clusters_properties'),
                                                        'hide'  => !isset($slony),
                                                        'help'  => '',
+                                                       'icon'  => 'Replication',
                                                ),
                                                'export' => array (
                                                        'title' => $lang['strexport'],
                                                        'urlvars' => array('subject' => 'database', 'action' => 'export'),
                                                        'hide'  => (!$this->isDumpEnabled()),
                                                        'tree'  => false,
+                                                       'icon'  => 'Save',
                                                ),
                                        );
                                        return $tabs;
                                                        'url'   => 'tables.php',
                                                        'urlvars' => array('subject' => 'schema'),
                                                        'help'  => 'pg.table',
-                                                       'icon'  => 'tables',
+                                                       'icon'  => 'Tables',
                                                ),
                                                'views' => array (
                                                        'title' => $lang['strviews'],
                                                        'url'   => 'views.php',
                                                        'urlvars' => array('subject' => 'schema'),
                                                        'help'  => 'pg.view',
-                                                       'icon'  => 'views',
+                                                       'icon'  => 'Views',
                                                ),
                                                'sequences' => array (
                                                        'title' => $lang['strsequences'],
                                                        'url'   => 'sequences.php',
                                                        'urlvars' => array('subject' => 'schema'),
                                                        'help'  => 'pg.sequence',
-                                                       'icon'  => 'sequences',
+                                                       'icon'  => 'Sequences',
                                                ),
                                                'functions' => array (
                                                        'title' => $lang['strfunctions'],
                                                        'url'   => 'functions.php',
                                                        'urlvars' => array('subject' => 'schema'),
                                                        'help'  => 'pg.function',
-                                                       'icon'  => 'functions',
+                                                       'icon'  => 'Functions',
                                                ),
                                                'domains' => array (
                                                        'title' => $lang['strdomains'],
                                                        'urlvars' => array('subject' => 'schema'),
                                                        'hide'  => (!$data->hasDomains()),
                                                        'help'  => 'pg.domain',
-                                                       'icon'  => 'domains',
+                                                       'icon'  => 'Domains',
                                                ),
                                                'aggregates' => array (
                                                        'title' => $lang['straggregates'],
                                                        'urlvars' => array('subject' => 'schema'),
                                                        'hide'  => $hide_advanced,
                                                        'help'  => 'pg.aggregate',
-                                                       'icon'  => 'functions',
+                                                       'icon'  => 'Aggregates',
                                                ),
                                                'types' => array (
                                                        'title' => $lang['strtypes'],
                                                        'urlvars' => array('subject' => 'schema'),
                                                        'hide'  => $hide_advanced,
                                                        'help'  => 'pg.type',
-                                                       'icon'  => 'types',
+                                                       'icon'  => 'Types',
                                                ),
                                                'operators' => array (
                                                        'title' => $lang['stroperators'],
                                                        'urlvars' => array('subject' => 'schema'),
                                                        'hide'  => $hide_advanced,
                                                        'help'  => 'pg.operator',
-                                                       'icon'  => 'operators',
+                                                       'icon'  => 'Operators',
                                                ),
                                                'opclasses' => array (
                                                        'title' => $lang['stropclasses'],
                                                        'urlvars' => array('subject' => 'schema'),
                                                        'hide'  => $hide_advanced,
                                                        'help'  => 'pg.opclass',
-                                                       'icon'  => 'operators',
+                                                       'icon'  => 'OperatorClasses',
                                                ),
                                                'conversions' => array (
                                                        'title' => $lang['strconversions'],
                                                        'urlvars' => array('subject' => 'schema'),
                                                        'hide'  => ($hide_advanced || !$data->hasConversions()),
                                                        'help'  => 'pg.conversion',
-                                                       'icon'  => 'types',
+                                                       'icon'  => 'Conversions',
                                                ),
                                                'privileges' => array (
                                                        'title' => $lang['strprivileges'],
                                                        'hide'  => (!$data->hasSchemas()),
                                                        'help'  => 'pg.privilege',
                                                        'tree'  => false,
+                                                       'icon'  => 'Key',
                                                ),
                                        );
 
                                                        'title' => $lang['strcolumns'],
                                                        'url'   => 'tblproperties.php',
                                                        'urlvars' => array('subject' => 'table', 'table' => field('table')),
+                                                       'icon'  => 'Columns',
                                                ),
                                                'indexes' => array (
                                                        'title' => $lang['strindexes'],
                                                        'url'   => 'indexes.php',
                                                        'urlvars' => array('subject' => 'table', 'table' => field('table')),
                                                        'help'  => 'pg.index',
+                                                       'icon'  => 'Indexes',
                                                ),
                                                'constraints' => array (
                                                        'title' => $lang['strconstraints'],
                                                        'url'   => 'constraints.php',
                                                        'urlvars' => array('subject' => 'table', 'table' => field('table')),
                                                        'help'  => 'pg.constraint',
+                                                       'icon'  => 'Constraints',
                                                ),
                                                'triggers' => array (
                                                        'title' => $lang['strtriggers'],
                                                        'url'   => 'triggers.php',
                                                        'urlvars' => array('subject' => 'table', 'table' => field('table')),
                                                        'help'  => 'pg.trigger',
+                                                       'icon'  => 'Triggers',
                                                ),
                                                'rules' => array (
                                                        'title' => $lang['strrules'],
                                                        'url'   => 'rules.php',
                                                        'urlvars' => array('subject' => 'table', 'table' => field('table')),
                                                        'help'  => 'pg.rule',
+                                                       'icon'  => 'Rules',
                                                ),
                                                'info' => array (
                                                        'title' => $lang['strinfo'],
                                                        'url'   => 'info.php',
                                                        'urlvars' => array('subject' => 'table', 'table' => field('table')),
+                                                       'icon'  => 'Statistics',
                                                ),
                                                'privileges' => array (
                                                        'title' => $lang['strprivileges'],
                                                        'url'   => 'privileges.php',
                                                        'urlvars' => array('subject' => 'table', 'table' => field('table')),
                                                        'help'  => 'pg.privilege',
+                                                       'icon'  => 'Key',
                                                ),
                                                'import' => array (
                                                        'title' => $lang['strimport'],
                                                        'url'   => 'tblproperties.php',
                                                        'urlvars' => array('subject' => 'table', 'table' => field('table'), 'action' => 'import'),
+                                                       'icon'  => 'Open',
                                                ),
                                                'export' => array (
                                                        'title' => $lang['strexport'],
                                                        'url'   => 'tblproperties.php',
                                                        'urlvars' => array('subject' => 'table', 'table' => field('table'), 'action' => 'export'),
+                                                       'icon'  => 'Save',
                                                ),
                                        );
                                
                                                        'title' => $lang['strcolumns'],
                                                        'url'   => 'viewproperties.php',
                                                        'urlvars' => array('subject' => 'view', 'view' => field('view')),
+                                                       'icon'  => 'Columns',
                                                ),
                                                'definition' => array (
                                                        'title' => $lang['strdefinition'],
                                                        'url'   => 'viewproperties.php',
                                                        'urlvars' => array('subject' => 'view', 'view' => field('view'), 'action' => 'definition'),
+                                                       'icon'  => 'Editor'
                                                ),
                                                'rules' => array (
                                                        'title' => $lang['strrules'],
                                                        'url'   => 'rules.php',
                                                        'urlvars' => array('subject' => 'view', 'view' => field('view')),
                                                        'help'  => 'pg.rule',
+                                                       'icon'  => 'Rules',
                                                ),
                                                'privileges' => array (
                                                        'title' => $lang['strprivileges'],
                                                        'url'   => 'privileges.php',
                                                        'urlvars' => array('subject' => 'view', 'view' => field('view')),
                                                        'help'  => 'pg.privilege',
+                                                       'icon'  => 'Key',
                                                ),
                                                'export' => array (
                                                        'title' => $lang['strexport'],
                                                        'url'   => 'viewproperties.php',
                                                        'urlvars' => array('subject' => 'view', 'view' => field('view'), 'action' => 'export'),
+                                                       'icon'  => 'Save',
                                                ),
                                        );
                                
                                                                        'function_oid' => field('function_oid'),
                                                                        'action' => 'properties',
                                                                ),
+                                                       'icon'  => 'Property',
                                                ),
                                                'privileges' => array (
                                                        'title' => $lang['strprivileges'],
                                                                        'function' => field('function'),
                                                                        'function_oid' => field('function_oid'),
                                                                ),
+                                                       'icon'  => 'Key',
                                                ),
                                        );
                                
                                                        'url'   => 'sqledit.php',
                                                        'urlvars' => array('subject' => 'schema', 'action' => 'sql'),
                                                        'help'  => 'pg.sql',
+                                                       'icon'  => 'SqlEditor',
                                                ),
                                                'find' => array (
                                                        'title' => $lang['strfind'],
                                                        'url'   => 'sqledit.php',
                                                        'urlvars' => array('subject' => 'schema', 'action' => 'find'),
+                                                       'icon'  => 'Search',
                                                ),
                                        );
                                
                                                                        'slony_cluster' => field('slony_cluster')
                                                                ),
                                                        'help'  => '',
+                                                       'icon'  => 'Cluster',
                                                ),
                                                'nodes' => array (
                                                        'title' => $lang['strnodes'],
                                                                        'slony_cluster' => field('slony_cluster')
                                                                ),
                                                        'help'  => '',
+                                                       'icon'  => 'Nodes',
                                                ),
                                                'sets' => array (
                                                        'title' => $lang['strrepsets'],
                                                                        'slony_cluster' => field('slony_cluster')
                                                                ),
                                                        'help'  => '',
+                                                       'icon'  => 'ReplicationSets',
                                                ),
                                        );
                                        
                                if (isset($crumb['title']))
                                        $crumblink .= " title=\"{$crumb['title']}\"";
                                
-                               $crumblink .= ">" . htmlspecialchars($crumb['text']) . "</a>";
+                               $crumblink .= ">";
+                               
+                               if (isset($crumb['icon']) && $icon = $this->icon($crumb['icon']))
+                                       $crumblink .= "<img src=\"{$icon}\" />";
+                                
+                               $crumblink .= htmlspecialchars($crumb['text']) . "</a>";
                                
                                if (isset($crumb['help']))
                                        $this->printHelp($crumblink, $crumb['help']);
                                        'title' => $lang['strserver'],
                                        'text'  => $server_info['desc'],
                                        'url'   => "redirect.php?subject=server&{$vars}",
-                                       'help'  => 'pg.server'
+                                       'help'  => 'pg.server',
+                                       'icon'  => 'Server'
                                );
                        }
                        if ($subject == 'server') $done = true;
                                        'title' => $lang['strdatabase'],
                                        'text'  => $_REQUEST['database'],
                                        'url'   => "redirect.php?subject=database&{$vars}",
-                                       'help'  => 'pg.database'
+                                       'help'  => 'pg.database',
+                                       'icon'  => 'Database'
                                );
                        }
                        if ($subject == 'database') $done = true;
                                        'title' => $lang['strschema'],
                                        'text'  => $_REQUEST['schema'],
                                        'url'   => "redirect.php?subject=schema&{$vars}",
-                                       'help'  => 'pg.schema'
+                                       'help'  => 'pg.schema',
+                                       'icon'  => 'Schema'
                                );
                        }
                        if ($subject == 'schema') $done = true;
                                        'title' => 'Slony Cluster',
                                        'text'  => $_REQUEST['slony_cluster'],
                                        'url'   => "redirect.php?subject=slony_cluster&{$vars}",
-                                       'help'  => 'sl.cluster'
+                                       'help'  => 'sl.cluster',
+                                       'icon'  => 'Cluster'
                                );
                        }
                        if ($subject == 'slony_cluster') $done = true;
                                        'title' => $lang['strtable'],
                                        'text'  => $_REQUEST['table'],
                                        'url'   => "redirect.php?{$vars}",
-                                       'help'  => 'pg.table'
+                                       'help'  => 'pg.table',
+                                       'icon'  => 'Table'
                                );
                        } elseif (isset($_REQUEST['view']) && !$done) {
                                $vars .= "subject=view&view=".urlencode($_REQUEST['view']);
                                        'title' => $lang['strview'],
                                        'text'  => $_REQUEST['view'],
                                        'url'   => "redirect.php?{$vars}",
-                                       'help'  => 'pg.view'
+                                       'help'  => 'pg.view',
+                                       'icon'  => 'View'
                                );
                        }
                        if ($subject == 'table' || $subject == 'view') $done = true;
                                                        'title' => $lang['str'.$subject],
                                                        'text'  => $_REQUEST[$subject],
                                                        'url'   => "redirect.php?{$vars}",
-                                                       'help'  => 'pg.function'
+                                                       'help'  => 'pg.function',
+                                                       'icon'  => 'Function'
                                                );
                                                break;
                                        case 'slony_node':
                                                        'title' => 'Slony Node',
                                                        'text'  => $_REQUEST['no_name'],
                                                        'url'   => "redirect.php?{$vars}",
-                                                       'help'  => 'sl.'.$subject
+                                                       'help'  => 'sl.'.$subject,
+                                                       'icon'  => 'Node'
                                                );
                                                break;
                                        case 'slony_set':
                                                        'title' => $lang['str'.$subject],
                                                        'text'  => $_REQUEST[$subject],
                                                        'url'   => "redirect.php?{$vars}",
-                                                       'help'  => 'sl.'.$subject
+                                                       'help'  => 'sl.'.$subject,
+                                                       'icon'  => 'AvailableReplicationSet'
                                                );
                                                break;
                                        default:
                                                        $trail[$_REQUEST[$subject]] = array(
                                                                'title' => $lang['str'.$subject],
                                                                'text'  => $_REQUEST[$subject],
-                                                               'help'  => 'pg.'.$subject       
+                                                               'help'  => 'pg.'.$subject
                                                        );
                                                }
                                }