From ba969ffacba58e414a6f2519822970274e515eac Mon Sep 17 00:00:00 2001 From: chriskl Date: Sat, 8 May 2004 14:44:56 +0000 Subject: [PATCH] add config variable to show or hide comments. bumped config version number --- HISTORY | 1 + aggregates.php | 8 ++++---- all_db.php | 12 +++++++----- conf/config.inc.php-dist | 8 ++++++-- conversions.php | 8 ++++---- database.php | 10 ++++++---- domains.php | 10 ++++++---- functions.php | 8 ++++---- libraries/lib.inc.php | 4 ++-- operators.php | 9 +++++---- tables.php | 10 ++++++---- tblproperties.php | 10 +++++----- views.php | 8 ++++---- 13 files changed, 60 insertions(+), 46 deletions(-) diff --git a/HISTORY b/HISTORY index 0770b99d..5a42c1f3 100644 --- a/HISTORY +++ b/HISTORY @@ -9,6 +9,7 @@ Features * View, add, edit and delete comments on tables, views, schemas, aggregates, conversions, operators, functions and columns (Dan Boren & ChrisKL) +* Add config file option for turning off the display of comments * Allow creating array columns in tables * Allow adding array columns to tables * Allow creating domains with type length and arrays diff --git a/aggregates.php b/aggregates.php index 1d6194af..7cc246bc 100644 --- a/aggregates.php +++ b/aggregates.php @@ -3,7 +3,7 @@ /** * Manage aggregates in a database * - * $Id: aggregates.php,v 1.2 2004/04/17 12:59:03 chriskl Exp $ + * $Id: aggregates.php,v 1.3 2004/05/08 14:44:56 chriskl Exp $ */ // Include application functions @@ -16,7 +16,7 @@ * Show default list of aggregates in the database */ function doDefault($msg = '') { - global $data, $misc; + global $data, $conf, $misc; global $lang; echo "

", $misc->printVal($_REQUEST['database']), ": {$lang['straggregates']}

\n"; @@ -27,7 +27,7 @@ if ($aggregates->recordCount() > 0) { echo "\n"; echo ""; - echo ""; + if ($conf['show_comments']) echo ""; echo "\n"; $i = 0; while (!$aggregates->EOF) { @@ -40,7 +40,7 @@ else echo $misc->printVal($aggregates->f['proargtypes']); echo "\n"; - echo "\n"; + if ($conf['show_comments']) echo "\n"; echo "\n"; $aggregates->moveNext(); $i++; diff --git a/all_db.php b/all_db.php index d248ef8f..a0e49360 100644 --- a/all_db.php +++ b/all_db.php @@ -3,7 +3,7 @@ /** * Manage databases within a server * - * $Id: all_db.php,v 1.22 2004/01/04 07:30:12 chriskl Exp $ + * $Id: all_db.php,v 1.23 2004/05/08 14:44:56 chriskl Exp $ */ // Include application functions @@ -108,7 +108,7 @@ * Show default list of databases in the server */ function doDefault($msg = '') { - global $data, $misc; + global $data, $conf, $misc; global $PHP_SELF, $lang; echo "

{$lang['strdatabases']}

\n"; @@ -118,17 +118,19 @@ if ($databases->recordCount() > 0) { echo "
{$lang['strname']}{$lang['strtype']}{$lang['strcomment']}{$lang['strcomment']}
", $misc->printVal($aggregates->f['aggcomment']), "", $misc->printVal($aggregates->f['aggcomment']), "
\n"; echo ""; - echo ""; - echo "\n"; + echo ""; + echo "\n"; + if ($conf['show_comments']) echo ""; + echo "\n"; $i = 0; while (!$databases->EOF) { $id = (($i % 2) == 0 ? '1' : '2'); echo "\n"; echo "\n"; echo "\n"; - echo "\n"; echo "\n"; + if ($conf['show_comments']) echo "\n"; echo "\n"; $databases->moveNext(); $i++; diff --git a/conf/config.inc.php-dist b/conf/config.inc.php-dist index ef6f38db..f63031af 100644 --- a/conf/config.inc.php-dist +++ b/conf/config.inc.php-dist @@ -4,7 +4,7 @@ * Central phpPgAdmin configuration. As a user you may modify the * settings here for your particular configuration. * - * $Id: config.inc.php-dist,v 1.33 2004/03/04 20:12:24 xzilla Exp $ + * $Id: config.inc.php-dist,v 1.34 2004/05/08 14:45:10 chriskl Exp $ */ // An example server. Create as many of these as you wish, @@ -51,6 +51,10 @@ // other means. (eg. Run 'SELECT * FROM pg_database' in the SQL area.) $conf['owned_only'] = false; + // Display comments on objects? Comments are a good way of documenting + // a database, but they do take up space in the interface. + $conf['show_comments'] = true; + // Display "advanced" objects? Setting this to true will show types, // operators conversions, languages and casts in phpPgAdmin. These // objects are rarely administered and can clutter the interface. @@ -93,6 +97,6 @@ * Don't modify anything below this line * *****************************************/ - $conf['version'] = 12; + $conf['version'] = 13; ?> diff --git a/conversions.php b/conversions.php index 4317b5e1..0f5952c4 100644 --- a/conversions.php +++ b/conversions.php @@ -3,7 +3,7 @@ /** * Manage conversions in a database * - * $Id: conversions.php,v 1.4 2004/04/17 12:59:03 chriskl Exp $ + * $Id: conversions.php,v 1.5 2004/05/08 14:44:56 chriskl Exp $ */ // Include application functions @@ -17,7 +17,7 @@ * Show default list of conversions in the database */ function doDefault($msg = '') { - global $data, $misc, $database; + global $data, $conf, $misc, $database; global $PHP_SELF, $lang; echo "

", $misc->printVal($_REQUEST['database']), ": {$lang['strconversions']}

\n"; @@ -29,7 +29,7 @@ echo "
{$lang['strdatabase']}{$lang['strowner']}{$lang['strencoding']}{$lang['strcomment']}{$lang['stractions']}
{$lang['strencoding']}{$lang['stractions']}{$lang['strcomment']}
", $misc->printVal($databases->f[$data->dbFields['dbname']]), "", $misc->printVal($databases->f[$data->dbFields['owner']]), "", $misc->printVal($databases->f[$data->dbFields['encoding']]), "", htmlspecialchars($databases->f[$data->dbFields['dbcomment']]), "f[$data->dbFields['dbname']]), "\">{$lang['strdrop']}", htmlspecialchars($databases->f[$data->dbFields['dbcomment']]), "
\n"; echo ""; echo ""; - echo "\n"; + if ($conf['show_comments']) echo "\n"; echo "\n"; $i = 0; while (!$conversions->EOF) { @@ -39,7 +39,7 @@ echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + if ($conf['show_comments']) echo "\n"; echo "\n"; $conversions->moveNext(); $i++; diff --git a/database.php b/database.php index 368b690f..1a3a13da 100755 --- a/database.php +++ b/database.php @@ -3,7 +3,7 @@ /** * Manage schemas within a database * - * $Id: database.php,v 1.39 2004/04/20 01:34:43 chriskl Exp $ + * $Id: database.php,v 1.40 2004/05/08 14:44:56 chriskl Exp $ */ // Include application functions @@ -547,7 +547,7 @@ * Show default list of schemas in the server */ function doDefault($msg = '') { - global $data, $misc; + global $data, $misc, $conf; global $PHP_SELF, $lang; $misc->printDatabaseNav(); @@ -561,7 +561,9 @@ if ($schemas->recordCount() > 0) { echo "
{$lang['strname']}{$lang['strsourceencoding']}{$lang['strtargetencoding']}{$lang['strdefault']}{$lang['strcomment']}{$lang['strcomment']}
", $misc->printVal($conversions->f['conforencoding']), "", $misc->printVal($conversions->f['contoencoding']), "", ($conversions->f['condefault']) ? $lang['stryes'] : $lang['strno'], "", $misc->printVal($conversions->f['concomment']), "", $misc->printVal($conversions->f['concomment']), "
\n"; echo ""; - echo "\n"; + echo ""; + if ($conf['show_comments']) echo "\n"; + echo "\n"; $i = 0; while (!$schemas->EOF) { $id = (($i % 2) == 0 ? '1' : '2'); @@ -576,7 +578,7 @@ echo "\n"; - echo "\n"; + if ($conf['show_comments']) echo "\n"; echo "\n"; $schemas->moveNext(); $i++; diff --git a/domains.php b/domains.php index 4cd1c64a..70f73e46 100644 --- a/domains.php +++ b/domains.php @@ -3,7 +3,7 @@ /** * Manage domains in a database * - * $Id: domains.php,v 1.10 2004/03/31 08:09:55 chriskl Exp $ + * $Id: domains.php,v 1.11 2004/05/08 14:44:56 chriskl Exp $ */ // Include application functions @@ -357,7 +357,7 @@ * Show default list of domains in the database */ function doDefault($msg = '') { - global $data, $misc; + global $data, $conf, $misc; global $PHP_SELF, $lang; echo "

", $misc->printVal($_REQUEST['database']), ": {$lang['strdomains']}

\n"; @@ -369,7 +369,9 @@ echo "
{$lang['strname']}{$lang['strowner']}{$lang['stractions']}{$lang['strcomment']}{$lang['stractions']}{$lang['strcomment']}
{$lang['stralter']}", $misc->printVal($schemas->f[$data->nspFields['nspcomment']]), "", $misc->printVal($schemas->f[$data->nspFields['nspcomment']]), "
\n"; echo ""; echo ""; - echo "\n"; + echo ""; + if ($conf['show_comments']) echo ""; + echo "\n"; $i = 0; while (!$domains->EOF) { $domains->f['domnotnull'] = $data->phpBool($domains->f['domnotnull']); @@ -381,7 +383,7 @@ echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + if ($conf['show_comments']) echo "\n"; echo "\n"; $domains->moveNext(); $i++; diff --git a/functions.php b/functions.php index 2ad434a3..28883c5b 100644 --- a/functions.php +++ b/functions.php @@ -3,7 +3,7 @@ /** * Manage functions in a database * - * $Id: functions.php,v 1.28 2004/05/08 14:08:00 chriskl Exp $ + * $Id: functions.php,v 1.29 2004/05/08 14:45:09 chriskl Exp $ */ // Include application functions @@ -323,7 +323,7 @@ * Show default list of functions in the database */ function doDefault($msg = '') { - global $data, $misc, $func; + global $data, $conf, $misc, $func; global $PHP_SELF, $lang; echo "

", $misc->printVal($_REQUEST['database']), ": {$lang['strfunctions']}

\n"; @@ -335,7 +335,7 @@ echo "
{$lang['strdomain']}{$lang['strtype']}{$lang['strnotnull']}{$lang['strdefault']}{$lang['strowner']}{$lang['stractions']}{$lang['strcomment']}
{$lang['stractions']}{$lang['strcomment']}
", $misc->printVal($domains->f['domowner']), "href}&domain=", urlencode($domains->f['domname']), "\">{$lang['strproperties']}href}&domain=", urlencode($domains->f['domname']), "\">{$lang['strdrop']}", $misc->printVal($domains->f['domcomment']), "", $misc->printVal($domains->f['domcomment']), "
\n"; echo "\n"; echo "\n"; - echo "\n"; + if ($conf['show_comments']) echo "\n"; echo "\n"; $i = 0; while (!$funcs->EOF) { @@ -359,7 +359,7 @@ $funcs->f[$data->fnFields['fnoid']], "&type=function\">{$lang['strprivileges']}\n"; } else echo ""; - echo "\n"; + if ($conf['show_comments']) echo "\n"; echo "\n"; $funcs->moveNext(); $i++; diff --git a/libraries/lib.inc.php b/libraries/lib.inc.php index fbb4ead6..c2bc419c 100644 --- a/libraries/lib.inc.php +++ b/libraries/lib.inc.php @@ -3,7 +3,7 @@ /** * Function library read in upon startup * - * $Id: lib.inc.php,v 1.74 2004/03/04 01:27:29 chriskl Exp $ + * $Id: lib.inc.php,v 1.75 2004/05/08 14:45:10 chriskl Exp $ */ // Set error reporting level to max @@ -29,7 +29,7 @@ // Configuration file version. If this is greater than that in config.inc.php, then // the app will refuse to run. This and $conf['version'] should be incremented whenever // backwards incompatible changes are made to config.inc.php-dist. - $conf['base_version'] = 12; + $conf['base_version'] = 13; // List of available language files $appLangFiles = array( diff --git a/operators.php b/operators.php index be350243..e2b68cc6 100644 --- a/operators.php +++ b/operators.php @@ -3,7 +3,7 @@ /** * Manage operators in a database * - * $Id: operators.php,v 1.11 2004/04/17 12:59:03 chriskl Exp $ + * $Id: operators.php,v 1.12 2004/05/08 14:45:10 chriskl Exp $ */ // Include application functions @@ -101,7 +101,7 @@ * Show default list of operators in the database */ function doDefault($msg = '') { - global $data, $misc, $database; + global $data, $conf, $misc; global $PHP_SELF, $lang; echo "

", $misc->printVal($_REQUEST['database']), ": {$lang['stroperators']}

\n"; @@ -113,7 +113,8 @@ echo "
{$lang['strfunctions']}{$lang['strreturns']}{$lang['strarguments']}{$lang['stractions']}{$lang['strcomment']}{$lang['strcomment']}
", $misc->printVal($funcs->f['funccomment']), "", $misc->printVal($funcs->f['funccomment']), "
\n"; echo ""; echo ""; - echo ""; + if ($conf['show_comments']) echo "\n"; - echo "\n"; + if ($conf['show_comments']) echo "\n"; echo "\n"; $operators->moveNext(); $i++; diff --git a/tables.php b/tables.php index f6e3e1e4..25e15194 100644 --- a/tables.php +++ b/tables.php @@ -3,7 +3,7 @@ /** * List tables in a database * - * $Id: tables.php,v 1.49 2004/04/17 12:59:04 chriskl Exp $ + * $Id: tables.php,v 1.50 2004/05/08 14:45:10 chriskl Exp $ */ // Include application functions @@ -449,7 +449,7 @@ * Show default list of tables in the database */ function doDefault($msg = '') { - global $data, $misc, $data; + global $data, $conf, $misc, $data; global $PHP_SELF, $lang; echo "

", $misc->printVal($_REQUEST['database']), ": {$lang['strtables']}

\n"; @@ -459,7 +459,9 @@ if ($tables->recordCount() > 0) { echo "
{$lang['stroperator']}{$lang['strleftarg']}{$lang['strrightarg']}{$lang['strreturns']}{$lang['stractions']}{$lang['strcomment']}{$lang['stractions']}{$lang['strcomment']}\n"; $i = 0; while (!$operators->EOF) { @@ -126,7 +127,7 @@ urlencode($operators->f['oprname']), "&operator_oid=", urlencode($operators->f['oid']), "\">{$lang['strproperties']}\n"; echo "href}&operator=", urlencode($operators->f['oprname']), "&operator_oid=", urlencode($operators->f['oid']), "\">{$lang['strdrop']}", $misc->printVal($operators->f['oprcomment']), "", $misc->printVal($operators->f['oprcomment']), "
\n"; echo "\n\t\n\t\n"; - echo "\t\n\t\n\n"; + echo "\t\n"; + if ($conf['show_comments']) echo "\t\n"; + echo "\n"; $i = 0; while (!$tables->EOF) { $return_url = urlencode("tables.php?{$misc->href}"); @@ -479,7 +481,7 @@ urlencode($tables->f[$data->tbFields['tbname']]), "\">{$lang['strempty']}\n"; echo "\t\n"; - echo "\t\n"; + if ($conf['show_comments']) echo "\t\n"; echo "\n"; $tables->moveNext(); $i++; diff --git a/tblproperties.php b/tblproperties.php index dc7c7be9..2cd16429 100644 --- a/tblproperties.php +++ b/tblproperties.php @@ -3,7 +3,7 @@ /** * List tables in a database * - * $Id: tblproperties.php,v 1.42 2004/04/12 07:50:33 chriskl Exp $ + * $Id: tblproperties.php,v 1.43 2004/05/08 14:45:10 chriskl Exp $ */ // Include application functions @@ -395,7 +395,7 @@ * Show default list of columns in the table */ function doDefault($msg = '') { - global $data, $misc; + global $data, $conf, $misc; global $PHP_SELF, $lang; $misc->printTableNav(); @@ -418,8 +418,8 @@ echo "\t\n"; else echo "\t\n"; - echo "\t\n"; - echo "\n"; + if ($conf['show_comments']) echo "\t\n"; + echo "\n"; $i = 0; while (!$attrs->EOF) { @@ -435,7 +435,7 @@ echo "\t\n"; } - echo "\t\n"; + if ($conf['show_comments']) echo "\t\n"; echo "\n"; $attrs->moveNext(); $i++; diff --git a/views.php b/views.php index 66fff5bd..36a5c644 100644 --- a/views.php +++ b/views.php @@ -3,7 +3,7 @@ /** * Manage views in a database * - * $Id: views.php,v 1.28 2004/03/12 08:56:52 chriskl Exp $ + * $Id: views.php,v 1.29 2004/05/08 14:45:10 chriskl Exp $ */ // Include application functions @@ -294,7 +294,6 @@ global $PHP_SELF, $lang; echo "

", $misc->printVal($_REQUEST['database']), ": {$lang['strviews']}

\n"; - //$misc->printHelp("/tutorial-views.html"); $misc->printMsg($msg); $views = &$data->getViews(); @@ -303,7 +302,8 @@ echo "
{$lang['strtable']}{$lang['strowner']}{$lang['stractions']}{$lang['strcomment']}
{$lang['stractions']}{$lang['strcomment']}
href}&table=", urlencode($tables->f[$data->tbFields['tbname']]), "\">{$lang['strdrop']}", $misc->printVal($tables->f['tablecomment']), "", $misc->printVal($tables->f['tablecomment']), "
{$lang['stractions']}{$lang['stractions']}{$lang['strcomment']}
{$lang['strcomment']}
href}&table=", urlencode($_REQUEST['table']), "&column=", urlencode($attrs->f['attname']), "&action=confirm_drop\">{$lang['strdrop']}", $misc->printVal($attrs->f['comment']), "", $misc->printVal($attrs->f['comment']), "
\n"; echo ""; echo "\n"; - echo "\n"; + if ($conf['show_comments']) echo ""; + echo "\n"; $i = 0; while (!$views->EOF) { // @@@@@@@@@ FIX THIS!!!!! @@ -325,7 +325,7 @@ echo "\n"; echo "\n"; - echo "\n"; + if ($conf['show_comments']) echo "\n"; echo "\n"; $views->moveNext(); $i++; -- 2.39.5
{$lang['strview']}{$lang['strowner']}{$lang['stractions']}{$lang['strcomment']}
{$lang['strcomment']}
href}&view=", urlencode($views->f[$data->vwFields['vwname']]), "\">{$lang['strdrop']}href}&object=", urlencode($views->f[$data->vwFields['vwname']]), "&type=view\">{$lang['strprivileges']}", $misc->printVal($views->f[$data->vwFields['vwcomment']]), "", $misc->printVal($views->f[$data->vwFields['vwcomment']]), "