From 597e9f443c7dea4a617763110f8bcdb31fef0c10 Mon Sep 17 00:00:00 2001 From: chriskl Date: Sun, 6 Jun 2004 08:50:27 +0000 Subject: [PATCH] first phase of context-sensitive online help system --- BUGS | 1 - HISTORY | 6 ++++++ classes/Misc.php | 33 ++++++++++++++++++++++++++++++++- classes/database/Postgres.php | 13 +++++++++++-- classes/database/Postgres71.php | 16 ++++++++++++++-- classes/database/Postgres72.php | 5 ++++- classes/database/Postgres73.php | 5 ++++- classes/database/Postgres74.php | 5 ++++- classes/database/Postgres75.php | 5 ++++- lang/english.php | 3 ++- lang/recoded/english.php | 3 ++- tables.php | 16 ++++++++-------- themes/default/global.css | 5 +++-- 13 files changed, 94 insertions(+), 22 deletions(-) diff --git a/BUGS b/BUGS index 85327343..6162dbc5 100644 --- a/BUGS +++ b/BUGS @@ -25,7 +25,6 @@ NEEDS TESTING * Script execution needs to support error handling - make it pass thru adodb layer * COPY should work in normal sql screen and sql popup window -* Create view wizard is buggy * notice on viewing reports page - does this still occur? * highlight things on the info stats page * advanced stats functions diff --git a/HISTORY b/HISTORY index ad922196..bc64f59e 100644 --- a/HISTORY +++ b/HISTORY @@ -4,6 +4,12 @@ phpPgAdmin History Version 3.5-dev ----------- +Features +* Context-sensitive online help system + +Version 3.4.1 +------------- + Bugs * Fix export of mixed case tables pre 7.4 diff --git a/classes/Misc.php b/classes/Misc.php index 9ecf4483..c6ed9841 100644 --- a/classes/Misc.php +++ b/classes/Misc.php @@ -2,7 +2,7 @@ /** * Class to hold various commonly used functions * - * $Id: Misc.php,v 1.63 2004/05/16 07:31:21 chriskl Exp $ + * $Id: Misc.php,v 1.64 2004/06/06 08:50:27 chriskl Exp $ */ class Misc { @@ -142,6 +142,37 @@ $var = stripslashes($var); } + /** + * Print out the page heading and help link + * @param $arr Array of heading items, already escaped + * @param $help (optional) The identifier for the help link + */ + function printTitle($arr, $help = null) { + global $data, $lang; + + // Don't continue unles we are actually displaying something + if (!is_array($arr) || sizeof($arr) == 0) return; + + if ($help !== null && isset($data->help_page[$help])) { + echo "\n"; + echo "\n"; + echo "

"; + // Join array with separator character + echo implode($lang['strseparator'], $arr); + echo "

help_base . $data->help_page[$help]); + echo "\" target=\"ppa_help\">{$lang['strhelp']}
\n"; + echo "
\n"; + } + else { + echo "

"; + // Join array with separator character + echo implode($lang['strseparator'], $arr); + echo "

\n"; + } + } + /** * Print out a message * @param $msg The message to print diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index f01531f6..9342b39b 100755 --- a/classes/database/Postgres.php +++ b/classes/database/Postgres.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres.php,v 1.220 2004/06/03 06:42:20 chriskl Exp $ + * $Id: Postgres.php,v 1.221 2004/06/06 08:50:27 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -127,8 +127,17 @@ class Postgres extends BaseDB { '~' => 'i', '!~' => 'i', '~*' => 'i', '!~*' => 'i', 'IS NULL' => 'p', 'IS NOT NULL' => 'p', 'IN' => 'x', 'NOT IN' => 'x'); - //Supported join operations for use with view wizard + // Supported join operations for use with view wizard var $joinOps = array('INNER JOIN' => 'INNER JOIN'); + + // Default help URL + var $help_base = 'http://www.postgresql.org/docs/7/static/'; + + // Help sub pages + var $help_page = array( + 'create_table' => 'sql-createtable.htm' + ); + /** * Constructor * @param $conn The database connection diff --git a/classes/database/Postgres71.php b/classes/database/Postgres71.php index 18f05764..59e85907 100644 --- a/classes/database/Postgres71.php +++ b/classes/database/Postgres71.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres71.php,v 1.58 2004/05/26 13:54:42 chriskl Exp $ + * $Id: Postgres71.php,v 1.59 2004/06/06 08:50:28 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -48,9 +48,21 @@ class Postgres71 extends Postgres { var $selectOps = array('=' => 'i', '!=' => 'i', '<' => 'i', '>' => 'i', '<=' => 'i', '>=' => 'i', 'LIKE' => 'i', 'NOT LIKE' => 'i', 'ILIKE' => 'i', 'NOT ILIKE' => 'i', '~' => 'i', '!~' => 'i', '~*' => 'i', '!~*' => 'i', 'IS NULL' => 'p', 'IS NOT NULL' => 'p', 'IN' => 'x', 'NOT IN' => 'x'); - //Supported join operations for use with view wizard + // Supported join operations for use with view wizard var $joinOps = array('INNER JOIN' => 'INNER JOIN', 'LEFT JOIN' => 'LEFT JOIN', 'RIGHT JOIN' => 'RIGHT JOIN', 'FULL JOIN' => 'FULL JOIN'); + // Default help URL + var $help_base = 'http://www.postgresql.org/docs/7.1/static/'; + + // Help sub pages (alphabetical order) + var $help_page = array( + 'create_table' => 'sql-createtable.html', + 'drop_table' => 'sql-droptable.html', + 'insert' => 'sql-insert.html', + 'select' => 'sql-select.html', + 'tables' => 'ddl.html#DDL-BASICS' + ); + /** * Constructor * @param $conn The database connection diff --git a/classes/database/Postgres72.php b/classes/database/Postgres72.php index 7a50b53c..14bd123e 100644 --- a/classes/database/Postgres72.php +++ b/classes/database/Postgres72.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres72.php,v 1.68 2004/05/26 14:29:50 chriskl Exp $ + * $Id: Postgres72.php,v 1.69 2004/06/06 08:50:28 chriskl Exp $ */ @@ -26,6 +26,9 @@ class Postgres72 extends Postgres71 { // Extra "magic" types. BIGSERIAL was added in PostgreSQL 7.2. var $extraTypes = array('SERIAL', 'BIGSERIAL'); + // Default help URL + var $help_base = 'http://www.postgresql.org/docs/7.2/static/'; + /** * Constructor * @param $conn The database connection diff --git a/classes/database/Postgres73.php b/classes/database/Postgres73.php index cc5c6520..33467629 100644 --- a/classes/database/Postgres73.php +++ b/classes/database/Postgres73.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres73.php,v 1.118 2004/06/04 05:26:35 chriskl Exp $ + * $Id: Postgres73.php,v 1.119 2004/06/06 08:50:28 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -49,6 +49,9 @@ class Postgres73 extends Postgres72 { 'SIMILAR TO' => 'i', 'NOT SIMILAR TO' => 'i', '~' => 'i', '!~' => 'i', '~*' => 'i', '!~*' => 'i', 'IS NULL' => 'p', 'IS NOT NULL' => 'p', 'IN' => 'x', 'NOT IN' => 'x'); + // Default help URL + var $help_base = 'http://www.postgresql.org/docs/7.3/static/'; + /** * Constructor * @param $conn The database connection diff --git a/classes/database/Postgres74.php b/classes/database/Postgres74.php index edb12bf2..4f7830e9 100644 --- a/classes/database/Postgres74.php +++ b/classes/database/Postgres74.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres74.php,v 1.32 2004/06/03 07:34:56 chriskl Exp $ + * $Id: Postgres74.php,v 1.33 2004/06/06 08:50:28 chriskl Exp $ */ include_once('./classes/database/Postgres73.php'); @@ -17,6 +17,9 @@ class Postgres74 extends Postgres73 { // Max object name length var $_maxNameLen = 63; + // Default help URL + var $help_base = 'http://www.postgresql.org/docs/7.4/static/'; + /** * Constructor * @param $conn The database connection diff --git a/classes/database/Postgres75.php b/classes/database/Postgres75.php index 55eb3e70..f5a620c3 100755 --- a/classes/database/Postgres75.php +++ b/classes/database/Postgres75.php @@ -3,7 +3,7 @@ /** * PostgreSQL 7.5 support * - * $Id: Postgres75.php,v 1.5 2004/05/23 04:10:20 chriskl Exp $ + * $Id: Postgres75.php,v 1.6 2004/06/06 08:50:28 chriskl Exp $ */ include_once('./classes/database/Postgres74.php'); @@ -13,6 +13,9 @@ class Postgres75 extends Postgres74 { // Last oid assigned to a system object var $_lastSystemOID = 17137; + // Default help URL + var $help_base = 'http://developer.postgresql.org/docs/postgres/'; + /** * Constructor * @param $conn The database connection diff --git a/lang/english.php b/lang/english.php index 9bfec843..b4fe251b 100755 --- a/lang/english.php +++ b/lang/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.145 2004/05/26 11:27:00 soranzo Exp $ + * $Id: english.php,v 1.146 2004/06/06 08:50:28 chriskl Exp $ */ // Language and character set @@ -100,6 +100,7 @@ $lang['strconfirm'] = 'Confirm'; $lang['strexpression'] = 'Expression'; $lang['strellipsis'] = '...'; + $lang['strseparator'] = ': '; $lang['strexpand'] = 'Expand'; $lang['strcollapse'] = 'Collapse'; $lang['strexplain'] = 'Explain'; diff --git a/lang/recoded/english.php b/lang/recoded/english.php index 3799b066..f2bffdae 100644 --- a/lang/recoded/english.php +++ b/lang/recoded/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.98 2004/05/26 11:27:00 soranzo Exp $ + * $Id: english.php,v 1.99 2004/06/06 08:50:28 chriskl Exp $ */ // Language and character set @@ -100,6 +100,7 @@ $lang['strconfirm'] = 'Confirm'; $lang['strexpression'] = 'Expression'; $lang['strellipsis'] = '...'; + $lang['strseparator'] = ': '; $lang['strexpand'] = 'Expand'; $lang['strcollapse'] = 'Collapse'; $lang['strexplain'] = 'Explain'; diff --git a/tables.php b/tables.php index 888dcc63..34818191 100644 --- a/tables.php +++ b/tables.php @@ -3,7 +3,7 @@ /** * List tables in a database * - * $Id: tables.php,v 1.53 2004/06/03 06:42:20 chriskl Exp $ + * $Id: tables.php,v 1.54 2004/06/06 08:50:27 chriskl Exp $ */ // Include application functions @@ -26,7 +26,7 @@ switch ($_REQUEST['stage']) { case 1: - echo "

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

\n"; + $misc->printTitle(array($misc->printVal($_REQUEST['database']), $lang['strtables'], $lang['strcreatetable']), 'create_table'); $misc->printMsg($msg); echo "
\n"; @@ -73,7 +73,7 @@ $types = &$data->getTypes(true); - echo "

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

\n"; + $misc->printTitle(array($misc->printVal($_REQUEST['database']), $lang['strtables'], $lang['strcreatetable']), 'create_table'); $misc->printMsg($msg); echo "\n"; @@ -190,7 +190,7 @@ global $PHP_SELF; if ($confirm) { - echo "

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

\n"; + $misc->printTitle(array($misc->printVal($_REQUEST['database']), $lang['strtables'], $misc->printVal($_REQUEST['table']), $lang['strselect']), 'select'); $misc->printMsg($msg); $attrs = &$data->getTableAttributes($_REQUEST['table']); @@ -297,7 +297,7 @@ global $PHP_SELF; if ($confirm) { - echo "

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

\n"; + $misc->printTitle(array($misc->printVal($_REQUEST['database']), $lang['strtables'], $misc->printVal($_REQUEST['table']), $lang['strinsertrow']), 'insert'); $misc->printMsg($msg); $attrs = &$data->getTableAttributes($_REQUEST['table']); @@ -389,7 +389,7 @@ global $PHP_SELF; if ($confirm) { - echo "

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

\n"; + $misc->printTitle(array($misc->printVal($_REQUEST['database']), $lang['strtables'], $misc->printVal($_REQUEST['table']), $lang['strempty'])); echo "

", sprintf($lang['strconfemptytable'], $misc->printVal($_REQUEST['table'])), "

\n"; @@ -419,7 +419,7 @@ global $PHP_SELF; if ($confirm) { - echo "

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

\n"; + $misc->printTitle(array($misc->printVal($_REQUEST['database']), $lang['strtables'], $misc->printVal($_REQUEST['table']), $lang['strdrop']), 'drop_table'); echo "

", sprintf($lang['strconfdroptable'], $misc->printVal($_REQUEST['table'])), "

\n"; @@ -454,7 +454,7 @@ global $data, $conf, $misc, $data; global $PHP_SELF, $lang; - echo "

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

\n"; + $misc->printTitle(array($misc->printVal($_REQUEST['database']), $lang['strtables']), 'tables'); $tables = &$data->getTables(); diff --git a/themes/default/global.css b/themes/default/global.css index 01d51283..53442e4a 100644 --- a/themes/default/global.css +++ b/themes/default/global.css @@ -1,7 +1,7 @@ /** * Default style sheet * - * $Id: global.css,v 1.16 2003/09/30 09:33:43 soranzo Exp $ + * $Id: global.css,v 1.17 2004/06/06 08:50:28 chriskl Exp $ */ /** ELEMENTS */ @@ -210,6 +210,8 @@ a:hover text-decoration: none; } +a.help { margin-right: 10px } + a.navlink:link, a.toplink:link { color: #336699; @@ -241,4 +243,3 @@ a.navlink:active, a.toplink:active font-weight: bold; text-decoration: none; } - -- 2.39.5