Partial navigation support for slony.
authorjollytoad <jollytoad>
Wed, 9 Nov 2005 09:05:58 +0000 (09:05 +0000)
committerjollytoad <jollytoad>
Wed, 9 Nov 2005 09:05:58 +0000 (09:05 +0000)
browser.php
classes/Misc.php
database.php
plugin_slony.php

index b5ff3de78a9a04bcff09f502b8d85051f00b66fa..4578d4494afcd1a5354c0fe0727e02bb6d4e0e50 100644 (file)
@@ -5,7 +5,7 @@
         * if you click on a database it shows a list of database objects in that
         * database.
         *
-        * $Id: browser.php,v 1.50 2005/09/07 08:11:15 chriskl Exp $
+        * $Id: browser.php,v 1.51 2005/11/09 09:05:58 jollytoad Exp $
         */
 
        // Include application functions
@@ -54,7 +54,7 @@ WebFXTreeAbstractNode.prototype.target = 'detail';
 WebFXTreeAbstractNode.prototype._ondblclick = function(){}
 
 // Show tree XML on double click - for debugging purposes only
-/*
+
 // UNCOMMENT THIS FOR DEBUGGING (SHOWS THE SOURCE XML)
 WebFXTreeAbstractNode.prototype._ondblclick = function(e){
        var el = e.target || e.srcElement;
@@ -63,7 +63,7 @@ WebFXTreeAbstractNode.prototype._ondblclick = function(e){
                window.open(this.src, this.target || "_self");
        return false;
 };
-*/
+
 var tree = new WebFXLoadTree("<?php echo $lang['strservers']; ?>", "servers.php?action=tree", "servers.php");
 
 tree.write();
index 974683d0b7961acad9746ee78de3d2fc7720d880..0b8f6392f8b5515501eeb399b9b34dcfb8baf488 100644 (file)
@@ -2,7 +2,7 @@
        /**
         * Class to hold various commonly used functions
         *
-        * $Id: Misc.php,v 1.111 2005/10/10 21:33:19 xzilla Exp $
+        * $Id: Misc.php,v 1.112 2005/11/09 09:05:58 jollytoad Exp $
         */
         
        class Misc {
                 * @param $section The name of the tab bar.
                 */
                function getNavTabs($section) {
-                       global $data, $lang, $conf;
+                       global $data, $lang, $conf, $slony;
 
                        $hide_advanced = ($conf['show_advanced'] === false);
                        
                                                        'hide'  => ($hide_advanced || !$data->hasCasts()),
                                                        'help'  => 'pg.cast',
                                                ),
+                                               'slony' => array (
+                                                       'title' => 'Slony',
+                                                       'url'   => 'plugin_slony.php',
+                                                       'urlvars' => array('subject' => 'database', 'action' => 'clusters_properties'),
+                                                       'hide'  => !isset($slony),
+                                                       'help'  => '',
+                                               ),
                                                'export' => array (
                                                        'title' => $lang['strexport'],
                                                        'url'   => 'database.php',
                                                ),
                                        );
                                
+                               case 'slony_cluster':
+                                       return array (
+                                               'properties' => array (
+                                                       'title' => $lang['strproperties'],
+                                                       'url'   => 'plugin_slony.php',
+                                                       'urlvars' => array(
+                                                                       'subject' => 'slony_cluster',
+                                                                       'action' => 'cluster_properties',
+                                                                       'slony_cluster' => field('slony_cluster')
+                                                               ),
+                                                       'help'  => '',
+                                               ),
+                                               'nodes' => array (
+                                                       'title' => $lang['strnodes'],
+                                                       'url'   => 'plugin_slony.php',
+                                                       'urlvars' => array(
+                                                                       'subject' => 'slony_cluster',
+                                                                       'action' => 'nodes_properties',
+                                                                       'slony_cluster' => field('slony_cluster')
+                                                               ),
+                                                       'help'  => '',
+                                               ),
+                                               'sets' => array (
+                                                       'title' => $lang['strrepsets'],
+                                                       'url'   => 'plugin_slony.php',
+                                                       'urlvars' => array(
+                                                                       'subject' => 'slony_cluster',
+                                                                       'action' => 'sets_properties',
+                                                                       'slony_cluster' => field('slony_cluster')
+                                                               ),
+                                                       'help'  => '',
+                                               ),
+                                       );
+                                       
                                default:
                                        return array();
                        }
                        }
                        if ($subject == 'schema') $done = true;
                        
+                       if (isset($_REQUEST['slony_cluster']) && !$done) {
+                               $vars .= 'slony_cluster='.urlencode($_REQUEST['slony_cluster']).'&';
+                               $trail['slony_cluster'] = array(
+                                       'title' => 'Slony Cluster',
+                                       'text'  => $_REQUEST['slony_cluster'],
+                                       'url'   => "redirect.php?subject=slony_cluster&{$vars}",
+                                       'help'  => 'sl.cluster'
+                               );
+                       }
+                       if ($subject == 'slony_cluster') $done = true;
+                       
                        if (isset($_REQUEST['table']) && !$done) {
                                $vars .= "subject=table&table=".urlencode($_REQUEST['table']);
                                $trail['table'] = array(
                                                        'help'  => 'pg.function'
                                                );
                                                break;
+                                       case 'slony_node':
+                                               $vars .= 'no_id='.urlencode($_REQUEST['no_id']).'&no_name='.urlencode($_REQUEST['no_name']);
+                                               $trail[$subject] = array(
+                                                       'title' => 'Slony Node',
+                                                       'text'  => $_REQUEST['no_name'],
+                                                       'url'   => "redirect.php?{$vars}",
+                                                       'help'  => 'sl.'.$subject
+                                               );
+                                               break;
+                                       case 'slony_set':
+                                               $vars .= "{$subject}_id=".urlencode($_REQUEST[$subject]).'&';
+                                               $vars .= "subject={$subject}&{$subject}=".urlencode($_REQUEST[$subject]);
+                                               $trail[$subject] = array(
+                                                       'title' => $lang['str'.$subject],
+                                                       'text'  => $_REQUEST[$subject],
+                                                       'url'   => "redirect.php?{$vars}",
+                                                       'help'  => 'sl.'.$subject
+                                               );
+                                               break;
                                        default:
                                                if (isset($_REQUEST[$subject])) {
                                                        $trail[$_REQUEST[$subject]] = array(
                                                $info['username'] = $_SESSION['sharedUsername'];
                                                $info['password'] = $_SESSION['sharedPassword'];
                                                $_reload_browser = true;
+                                               $this->setServerInfo(null, $info, $server_id);
                                        }
                                        
                                        return $info;
index 4be0dbf9dc1741b8f8d097d15e0cf348dc6bc4f3..c1b45d5c30bc9f2511f0222c838203ef8cb87ab0 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Manage schemas within a database
         *
-        * $Id: database.php,v 1.77 2005/10/18 04:00:19 chriskl Exp $
+        * $Id: database.php,v 1.78 2005/11/09 09:05:58 jollytoad Exp $
         */
 
        // Include application functions
 
                $reqvars = $misc->getRequestVars('database');
 
-               if ($data->hasSchemas())
-                       $tabs = $misc->getNavTabs('database');
-               else
-                       $tabs = array_merge($misc->getNavTabs('schema'), $misc->getNavTabs('database'));
-               
-               // Show slony node if enabled on this database
-               if (isset($slony)) {
-                       $tabs['slony'] = array (
-                                                                       'title' => 'Slony',
-                                                                       'url'   => 'plugin_slony.php',
-                                                                       'urlvars' => array('action' => 'clusters_properties'),
-                                                                       'hide'  => false,
-                                                                       'help'  => ''
-                                                               );
-               }
+               $tabs = $misc->getNavTabs('database');
 
                $items = $misc->adjustTabsForTree($tabs);
                
index ae7794fba791e369206e5e21eb24cfe61642c0a4..31e7c112b4095aa9f17c439ff604a46a80480a5e 100755 (executable)
@@ -3,11 +3,11 @@
        /**
         * Slony database tab plugin
         *
-        * $Id: plugin_slony.php,v 1.5 2005/10/18 04:00:19 chriskl Exp $
+        * $Id: plugin_slony.php,v 1.6 2005/11/09 09:05:58 jollytoad Exp $
         */
 
        // Avoid database connections whenever possible
-       switch ($_REQUEST['action']) {
+       switch (isset($_REQUEST['action']) ? $_REQUEST['action'] : '') {
                case 'clusters_top':
                case 'nodes_top':
                case 'sets_top':
 
        $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
        $PHP_SELF = $_SERVER['PHP_SELF'];
+       
+       // Include 'slony_cluster' in $misc->href if present
+       if (isset($_REQUEST['slony_cluster'])) {
+               $misc->href .= '&amp;slony_cluster=' . urlencode($_REQUEST['slony_cluster']);
+       }
 
        /**
         * Generate the somewhat complex Slony tree
                global $misc, $data, $lang, $PHP_SELF, $slony;
 
                $reqvars = $misc->getRequestVars('database');
+               if (isset($slony))
+                       $reqvars['slony_cluster'] = $slony->slony_cluster;
 
                // Determine what actual tree we are building
-               switch ($subject) {                     
+               switch ($subject) {
                        case 'clusters':
                                // Clusters
                                
@@ -53,9 +60,7 @@
                                        'icon'   => field('icon', 'folder'),
                                        'action' => url(field('url'),
                                                                        $reqvars,
-                                                                       array(
-                                                                               'action'  => 'cluster_properties'
-                                                                       )
+                                                                       array('action'  => 'cluster_properties')
                                                                ),
                                        'branch' => url(field('url'),
                                                                        $reqvars,
@@ -83,7 +88,9 @@
                                        'action' => url(field('url'),
                                                                        $reqvars,
                                                                        field('urlvars', array()),
-                                                                       array('action' => 'nodes_properties')
+                                                                       array(
+                                                                               'action' => 'nodes_properties'
+                                                                       )
                                                                ),
                                        'branch' => url(field('url'),
                                                                        $reqvars,
                                        'action' => url('plugin_slony.php',
                                                                        $reqvars,
                                                                        array(
+                                                                               'subject' => 'slony_node',
                                                                                'action'  => 'node_properties',
-                                                                               'no_id' => field('no_id')
+                                                                               'no_id' => field('no_id'),
+                                                                               'no_name' => field('no_comment'),
+                                                                               'slony_cluster' => $slony->slony_cluster
                                                                        )
                                                                ),
                                        'branch' => url('plugin_slony.php',
                global $lang;
 
                $misc->printTrail('database');
+               $misc->printTabs('database','slony');
                $misc->printMsg($msg);
 
                $clusters = $slony->getClusters();
                        'properties' => array(
                                'title' => $lang['strproperties'],
                                'url'   => "plugin_slony.php?{$misc->href}&amp;action=cluster_properties&amp;",
-                               'vars'  => array()
+                               'vars'  => array('slony_cluster' => 'cluster')
                        ),
                        'drop' => array(
                                'title' => $lang['strdrop'],
                                'url'   => "plugin_slony.php?{$misc->href}&amp;action=confirm_drop_cluster&amp;",
-                               'vars'  => array()
+                               'vars'  => array('slony_cluster' => 'cluster')
                        )
                );
                
                global $lang;
                
                $misc->printTrail('slony_cluster');
-               $misc->printTitle($lang['strproperties']);
+               $misc->printTabs('slony_cluster', 'properties');
                $misc->printMsg($msg);
                
                // Fetch the cluster information
                global $PHP_SELF, $slony, $misc;
                global $lang;
 
-               $misc->printTrail('slony_nodes');
+               $misc->printTrail('slony_cluster');
+               $misc->printTabs('slony_cluster', 'nodes');
                $misc->printMsg($msg);
 
                $nodes = $slony->getNodes();
                $actions = array (
                        'properties' => array(
                                'title' => $lang['strproperties'],
-                               'url'   => "plugin_slony.php?{$misc->href}&amp;action=node_properties&amp;",
-                               'vars'  => array('no_id' => 'no_id')
+                               'url'   => "plugin_slony.php?{$misc->href}&amp;action=node_properties&amp;subject=slony_node&amp;",
+                               'vars'  => array('no_id' => 'no_id', 'no_name' => 'no_comment')
                        ),
                        'drop' => array(
                                'title' => $lang['strdrop'],
-                               'url'   => "plugin_slony.php?{$misc->href}&amp;action=confirm_drop_node&amp;",
-                               'vars'  => array('no_id' => 'no_id')
+                               'url'   => "plugin_slony.php?{$misc->href}&amp;action=confirm_drop_node&amp;subject=slony_node&amp;",
+                               'vars'  => array('no_id' => 'no_id', 'no_name' => 'no_comment')
                        )
                );
                
                global $PHP_SELF, $slony, $misc;
                global $lang;
 
-               $misc->printTrail('database');
+               $misc->printTrail('slony_cluster');
+               $misc->printTabs('slony_cluster', 'sets');
                $misc->printMsg($msg);
 
                $sets = $slony->getReplicationSets();
                case 'subscription_properties':
                        doSubscription();
                        break;
-               case 'clusters_properties':
-                       doClusters();
-                       break;
                case 'cluster_properties':
                        doCluster();
                        break;
+               case 'clusters_properties':
                default:
-                       // Shouldn't happen
+                       doClusters();
+                       break;
        }
        
        $misc->printFooter();