Columns properties can now be accessed from the tree.
Browsing via a column icon gives you the aggregate count of the values in that table.
Patch from JGuillaume 'ioguix' De Rorthais
* Re-enable table browsing from tree icons (ioguix)
* Add Support For IN/OUT Parameters (John Jawed)
* Add column level information into the tree browser (ioguix)
+* Promote column level interaction into its own page (ioguix)
Version 4.0
-----------
/**
* Class to hold various commonly used functions
*
- * $Id: Misc.php,v 1.131 2006/06/23 00:57:37 xzilla Exp $
+ * $Id: Misc.php,v 1.132 2006/08/03 19:03:33 xzilla Exp $
*/
class Misc {
'icon' => 'ReplicationSets',
),
);
+
+ case 'column':
+ return array(
+ 'properties' => array (
+ 'title' => $lang['strcolprop'],
+ 'url' => 'colproperties.php',
+ 'urlvars' => array('subject' => 'column', 'table' => field('table'), 'column' => field('column')),
+ 'icon' => 'Column'
+ )
+ );
default:
return array();
'icon' => 'AvailableReplicationSet'
);
break;
+ case 'column':
+ $vars .= "&column={$_REQUEST['column']}&subject=column";
+ $trail['column'] = array (
+ 'title' => $lang['strcolumn'],
+ 'text' => $_REQUEST['column'],
+ 'icon' => 'Column',
+ 'url' => "redirect.php?{$vars}"
+ );
+ break;
default:
if (isset($_REQUEST[$subject])) {
switch ($subject) {
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.191 2006/06/28 00:56:10 soranzo Exp $
+ * $Id: english.php,v 1.192 2006/08/03 19:03:33 xzilla Exp $
*/
// Language and character set
$lang['strconfvacuumtable'] = 'Are you sure you want to vacuum "%s"?';
$lang['strestimatedrowcount'] = 'Estimated row count';
+ // Columns
+ $lang['strcolprop'] = 'Column Properties';
+
// Users
$lang['struser'] = 'User';
$lang['strusers'] = 'Users';
$lang['strargname'] = 'Name';
$lang['strargmode'] = 'Mode';
$lang['strargtype'] = 'Type';
- $lang['strargadd'] = 'Add another Argument';
+ $lang['strargadd'] = 'Add another argument';
$lang['strargremove'] = 'Remove this argument';
$lang['strargnoargs'] = 'This function will not take any arguments.';
$lang['strargenableargs'] = 'Enable arguments being passed to this function.';
* French Language file for phpPgAdmin.
* @maintainer Pascal PEYRE [pascal.peyre@cir.fr]
*
- * $Id: french.php,v 1.18 2006/06/29 15:43:03 xzilla Exp $
+ * $Id: french.php,v 1.19 2006/08/03 19:03:33 xzilla Exp $
*/
// Language and character set
$lang['strconfvacuumtable'] = 'Êtes-vous sur de vouloir faire un vacuum de « %s » ?';
$lang['strestimatedrowcount'] = 'Nombre d\'enregistrements estimés';
+ // Columns
+ $lang['strcolprop'] = 'Propriétés de la Colonne';
+
// Users
$lang['struser'] = 'Utilisateur';
$lang['strusers'] = 'Utilisateurs';
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.144 2006/06/28 00:56:11 soranzo Exp $
+ * $Id: english.php,v 1.145 2006/08/03 19:03:33 xzilla Exp $
*/
// Language and character set
$lang['strconfvacuumtable'] = 'Are you sure you want to vacuum "%s"?';
$lang['strestimatedrowcount'] = 'Estimated row count';
+ // Columns
+ $lang['strcolprop'] = 'Column Properties';
+
// Users
$lang['struser'] = 'User';
$lang['strusers'] = 'Users';
* French Language file for phpPgAdmin.
* @maintainer Pascal PEYRE [pascal.peyre@cir.fr]
*
- * $Id: french.php,v 1.17 2006/06/29 15:43:04 xzilla Exp $
+ * $Id: french.php,v 1.18 2006/08/03 19:03:33 xzilla Exp $
*/
// Language and character set
$lang['strconfvacuumtable'] = 'Êtes-vous sur de vouloir faire un vacuum de « %s » ?';
$lang['strestimatedrowcount'] = 'Nombre d\'enregistrements estimés';
+ // Columns
+ $lang['strcolprop'] = 'Propriétés de la Colonne';
+
// Users
$lang['struser'] = 'Utilisateur';
$lang['strusers'] = 'Utilisateurs';
* Spanish language file for phpPgAdmin.
* @maintainer Martín Marqués (martin@bugs.unl.edu.ar)
*
- * $Id: spanish.php,v 1.35 2006/06/27 21:34:22 xzilla Exp $
+ * $Id: spanish.php,v 1.36 2006/08/03 19:03:33 xzilla Exp $
*/
// Language and character set
$lang['strconfvacuumtable'] = 'Esta seguro que quiere limpiar "%s"?';
$lang['strestimatedrowcount'] = 'Estimación de filas';
+ // Columns
+ $lang['strcolprop'] = 'Propiedades de Columna';
+
// Users
$lang['struser'] = 'Usuario';
$lang['strusers'] = 'Usuarios';
* Spanish language file for phpPgAdmin.
* @maintainer Martín Marqués (martin@bugs.unl.edu.ar)
*
- * $Id: spanish.php,v 1.34 2006/06/27 21:34:22 xzilla Exp $
+ * $Id: spanish.php,v 1.35 2006/08/03 19:03:33 xzilla Exp $
*/
// Language and character set
$lang['strconfvacuumtable'] = 'Esta seguro que quiere limpiar "%s"?';
$lang['strestimatedrowcount'] = 'Estimación de filas';
+ // Columns
+ $lang['strcolprop'] = 'Propiedades de Columna';
+
// Users
$lang['struser'] = 'Usuario';
$lang['strusers'] = 'Usuarios';
<?php
-// $Id: decorator.inc.php,v 1.5 2005/10/18 04:11:58 mr-russ Exp $
+// $Id: decorator.inc.php,v 1.6 2006/08/03 19:03:33 xzilla Exp $
// This group of functions and classes provides support for
// resolving values in a lazy manner (ie, as and when required)
return new Decorator($value, false);
}
+function prepareSQL($sql, $params) {
+ return new PrepareSQL($sql, $params);
+}
+
// Resolving functions:
function value(&$var, &$fields, $esc = null) {
return $url;
}
}
+
+class PrepareSQL extends Decorator
+{
+ function PrepareSQL($sql, $params) {
+ $this->q = $sql;
+ $this->p = $params;
+ }
+
+ function value($fields) {
+ $req = $this->q;
+ foreach ($this->p as $k => $v) {
+ $req = str_replace($k, value($v, $fields), $req);
+ }
+ return $req;
+ }
+}
?>
/**
* List tables in a database
*
- * $Id: tblproperties.php,v 1.70 2006/06/29 18:22:34 xzilla Exp $
+ * $Id: tblproperties.php,v 1.71 2006/08/03 19:03:32 xzilla Exp $
*/
// Include application functions
* Displays a screen where they can add a column
*/
function doAddColumn($msg = '') {
- global $data, $misc;
+ global $data, $misc, $_reload_browser;
global $PHP_SELF, $lang;
if (!isset($_REQUEST['stage'])) $_REQUEST['stage'] = 1;
$status = $data->addColumn($_POST['table'], $_POST['field'],
$_POST['type'], $_POST['array'] != '', $_POST['length'], isset($_POST['notnull']),
$_POST['default'], $_POST['comment']);
- if ($status == 0)
+ if ($status == 0) {
+ $_reload_browser = true;
doDefault($lang['strcolumnadded']);
+ }
else {
$_REQUEST['stage'] = 1;
doAddColumn($lang['strcolumnaddedbad']);
* Displays a screen where they can alter a column
*/
function doProperties($msg = '') {
- global $data, $misc;
+ global $data, $misc, $_reload_browser;
global $PHP_SELF, $lang;
if (!isset($_REQUEST['stage'])) $_REQUEST['stage'] = 1;
$_REQUEST['default'], $_REQUEST['olddefault'],
$_REQUEST['type'], $_REQUEST['length'], $_REQUEST['array'], $_REQUEST['oldtype'],
$_REQUEST['comment']);
- if ($status == 0)
+ if ($status == 0) {
+ if ($_REQUEST['column'] != $_REQUEST['field']) {
+ $_reload_browser = true;
+ $_REQUEST['column'] = $_REQUEST['field'];
+ }
doDefault($lang['strcolumnaltered']);
+ }
else {
$_REQUEST['stage'] = 1;
doProperties($lang['strcolumnalteredbad']);
* Show confirmation of drop column and perform actual drop
*/
function doDrop($confirm) {
- global $data, $database, $misc;
+ global $data, $database, $misc, $_reload_browser;
global $PHP_SELF, $lang;
if ($confirm) {
}
else {
$status = $data->dropColumn($_POST['table'], $_POST['column'], isset($_POST['cascade']));
- if ($status == 0)
+ if ($status == 0) {
+ $_reload_browser = true;
doDefault($lang['strcolumndropped']);
+ }
else
doDefault($lang['strcolumndroppedbad']);
}
global $misc, $data;
$columns = $data->getTableAttributes($_REQUEST['table']);
- $reqvars = $misc->getRequestVars('table');
+ $reqvars = $misc->getRequestVars('column');
$attrs = array (
'text' => field('attname'),
+ 'action' => url('colproperties.php',
+ $reqvars,
+ array(
+ 'table' => $_REQUEST['table'],
+ 'column' => field('attname')
+ )
+ ),
'icon' => 'Column',
+ 'iconAction' => url('display.php',
+ $reqvars,
+ array(
+ 'table' => $_REQUEST['table'],
+ 'column' => field('attname'),
+ 'query' => prepareSQL(
+ "SELECT %column%, count(*) AS \"count\" FROM %table% GROUP BY %column% ORDER BY %column%",
+ array (
+ '%column%' => field('attname'),
+ '%table%' => $_REQUEST['table']
+ )
+ )
+ )
+ ),
'toolTip'=> field('comment')
);
// Get table
$tdata = $data->getTable($_REQUEST['table']);
// Get columns
- $attrs = $data->getTableAttributes($_REQUEST['table']);
+ $attrs = $data->getTableAttributes($_REQUEST['table']);
// Show comment if any
if ($tdata->f['relcomment'] !== null)
);
$actions = array(
+ 'properties' => array(
+ 'title' => $lang['strproperties'],
+ 'url' => "colproperties.php?subject=column&{$misc->href}&table=".urlencode($_REQUEST['table'])."&",
+ 'vars' => array('column' => 'attname'),
+ ),
'alter' => array(
'title' => $lang['stralter'],
'url' => "{$PHP_SELF}?action=properties&{$misc->href}&table=".urlencode($_REQUEST['table'])."&",
/**
* List views in a database
*
- * $Id: viewproperties.php,v 1.20 2006/06/29 18:22:34 xzilla Exp $
+ * $Id: viewproperties.php,v 1.21 2006/08/03 19:03:32 xzilla Exp $
*/
// Include application functions
function doTree () {
global $misc, $data;
+ $reqvars = $misc->getRequestVars('column');
$columns = $data->getTableAttributes($_REQUEST['view']);
- $reqvars = $misc->getRequestVars('view');
-
+
$attrs = array (
'text' => field('attname'),
+ 'action' => url('colproperties.php',
+ $reqvars,
+ array(
+ 'view' => $_REQUEST['view'],
+ 'column' => field('attname')
+ )
+ ),
'icon' => 'Column',
+ 'iconAction' => url('display.php',
+ $reqvars,
+ array(
+ 'view' => $_REQUEST['view'],
+ 'column' => field('attname'),
+ 'query' => prepareSQL(
+ "SELECT %column%, count(*) AS \"count\" FROM %view% GROUP BY %column% ORDER BY %column%",
+ array (
+ '%column%' => field('attname'),
+ '%view%' => $_REQUEST['view']
+ )
+ )
+ )
+ ),
'toolTip'=> field('comment')
);