* 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
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;
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();
/**
* 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;
/**
* 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);
/**
* 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 .= '&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
'icon' => field('icon', 'folder'),
'action' => url(field('url'),
$reqvars,
- array(
- 'action' => 'cluster_properties'
- )
+ array('action' => 'cluster_properties')
),
'branch' => url(field('url'),
$reqvars,
'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}&action=cluster_properties&",
- 'vars' => array()
+ 'vars' => array('slony_cluster' => 'cluster')
),
'drop' => array(
'title' => $lang['strdrop'],
'url' => "plugin_slony.php?{$misc->href}&action=confirm_drop_cluster&",
- '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}&action=node_properties&",
- 'vars' => array('no_id' => 'no_id')
+ 'url' => "plugin_slony.php?{$misc->href}&action=node_properties&subject=slony_node&",
+ 'vars' => array('no_id' => 'no_id', 'no_name' => 'no_comment')
),
'drop' => array(
'title' => $lang['strdrop'],
- 'url' => "plugin_slony.php?{$misc->href}&action=confirm_drop_node&",
- 'vars' => array('no_id' => 'no_id')
+ 'url' => "plugin_slony.php?{$misc->href}&action=confirm_drop_node&subject=slony_node&",
+ '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();