xhtml fixes. make info screen visible. fix missing brackets on check constraints
authorchriskl <chriskl>
Thu, 9 Oct 2003 06:39:10 +0000 (06:39 +0000)
committerchriskl <chriskl>
Thu, 9 Oct 2003 06:39:10 +0000 (06:39 +0000)
classes/Misc.php
classes/database/Postgres.php
classes/database/Postgres71.php
classes/database/Postgres73.php
info.php [new file with mode: 0644]
lang/english.php
lang/recoded/english.php

index d69d0e854c16d59fa76135b7928bfb16987f8e1e..be0603a2836c7cd90ad2fa714e88345100796bcb 100644 (file)
@@ -2,7 +2,7 @@
        /**
         * Class to hold various commonly used functions
         *
-        * $Id: Misc.php,v 1.44 2003/09/30 07:43:08 chriskl Exp $
+        * $Id: Misc.php,v 1.45 2003/10/09 06:39:10 chriskl Exp $
         */
         
        class Misc {
@@ -27,7 +27,7 @@
                        
                        // If extra security is off, return true
                        if (!$conf['extra_login_security']) return true;
-                       elseif (trim($_SESSION['webdbPassword']) == '') return false;
+                       elseif ($_SESSION['webdbPassword'] == '') return false;
                        else {
                                $username = strtolower($_SESSION['webdbUsername']);
                                return !in_array($username, $bad_usernames);
@@ -42,7 +42,7 @@
                        if (isset($_REQUEST['database'])) {
                                $this->href .= 'database=' . urlencode($_REQUEST['database']);
                                if (isset($_REQUEST['schema']))
-                                       $this->href .= '&schema=' . urlencode($_REQUEST['schema']);
+                                       $this->href .= '&amp;schema=' . urlencode($_REQUEST['schema']);
                        }
                }
 
                                // Send XHTML headers, or regular HTML headers
                                if (isset($conf['use_xhtml']) && $conf['use_xhtml']) {
                                        echo "<?xml version=\"1.0\" encoding=\"", htmlspecialchars($lang['appcharset']), "\"?>\n";
-                                       echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";\r
+                                       echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd\">\n";\r
                                        echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
                                } else {
                                        echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
                function printTableNav() {
                        global $lang;
 
-                       $vars = $this->href . '&table=' . urlencode($_REQUEST['table']);
+                       $vars = $this->href . '&amp;table=' . urlencode($_REQUEST['table']);
 
                        echo "<table class=\"navbar\" border=\"0\" width=\"100%\" cellpadding=\"5\" cellspacing=\"3\"><tr>\n";
-                       echo "<td width=\"14%\"><a href=\"tblproperties.php?{$vars}\">{$lang['strcolumns']}</a></td>\n";
-                       echo "<td width=\"14%\"><a href=\"indexes.php?{$vars}\">{$lang['strindexes']}</a></td>\n";
-                       echo "<td width=\"14%\"><a href=\"constraints.php?{$vars}\">{$lang['strconstraints']}</a></td>\n";
-                       echo "<td width=\"14%\"><a href=\"triggers.php?{$vars}\">{$lang['strtriggers']}</a></td>\n";
-                       echo "<td width=\"14%\"><a href=\"rules.php?{$vars}\">{$lang['strrules']}</a></td>\n";
-                       echo "<td width=\"14%\"><a href=\"privileges.php?{$vars}&type=table&object=", urlencode($_REQUEST['table']), "\">{$lang['strprivileges']}</a></td>\n";
-                       echo "<td width=\"14%\"><a href=\"tblproperties.php?{$vars}&action=export\">{$lang['strexport']}</a></td>\n";
+                       echo "<td width=\"12%\"><a href=\"tblproperties.php?{$vars}\">{$lang['strcolumns']}</a></td>\n";
+                       echo "<td width=\"13%\"><a href=\"indexes.php?{$vars}\">{$lang['strindexes']}</a></td>\n";
+                       echo "<td width=\"12%\"><a href=\"constraints.php?{$vars}\">{$lang['strconstraints']}</a></td>\n";
+                       echo "<td width=\"13%\"><a href=\"triggers.php?{$vars}\">{$lang['strtriggers']}</a></td>\n";
+                       echo "<td width=\"12%\"><a href=\"rules.php?{$vars}\">{$lang['strrules']}</a></td>\n";
+                       echo "<td width=\"13%\"><a href=\"info.php?{$vars}\">{$lang['strinfo']}</a></td>\n";
+                       echo "<td width=\"12%\"><a href=\"privileges.php?{$vars}&amp;type=table&amp;object=", urlencode($_REQUEST['table']), "\">{$lang['strprivileges']}</a></td>\n";
+                       echo "<td width=\"13%\"><a href=\"tblproperties.php?{$vars}&amp;action=export\">{$lang['strexport']}</a></td>\n";
                        echo "</tr></table>\n";
                }
 
                        }
                        // Only show database privs if available
                        if (isset($data->privlist['database'])) {
-                               echo "<td width=\"20%\"><a href=\"privileges.php?{$vars}&type=database&object=", urlencode($_REQUEST['database']), "\">{$lang['strprivileges']}</a></td>\n";
+                               echo "<td width=\"20%\"><a href=\"privileges.php?{$vars}&amp;type=database&amp;object=", urlencode($_REQUEST['database']), "\">{$lang['strprivileges']}</a></td>\n";
                        }
-                       echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=sql\">{$lang['strsql']}</a></td>\n";
-                       echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=find\">{$lang['strfind']}</a></td>\n";
-                       echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=admin\">{$lang['stradmin']}</a></td>\n";
-                       //echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=export\">{$lang['strexport']}</a></td></tr>\n";
+                       echo "<td width=\"20%\"><a href=\"database.php?{$vars}&amp;action=sql\">{$lang['strsql']}</a></td>\n";
+                       echo "<td width=\"20%\"><a href=\"database.php?{$vars}&amp;action=find\">{$lang['strfind']}</a></td>\n";
+                       echo "<td width=\"20%\"><a href=\"database.php?{$vars}&amp;action=admin\">{$lang['stradmin']}</a></td>\n";
                        echo "</tr></table>\n";
                }
 
index c16c94039592643fee542011bf58a2f19d6448e4..4713ceccf850fc5269d7660211d54bf2fac88409 100755 (executable)
@@ -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.151 2003/10/08 02:14:24 chriskl Exp $
+ * $Id: Postgres.php,v 1.152 2003/10/09 06:39:10 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -650,6 +650,9 @@ class Postgres extends BaseDB {
                // End transaction
                $this->endTransaction();
 
+               // Add a newline to separate data that follows (if any)
+               $sql .= "\n";
+               
                return $sql;
        }
 
@@ -2958,7 +2961,7 @@ class Postgres extends BaseDB {
                $sql = "
                        SELECT
                                rcname AS conname,
-                               'CHECK ' || rcsrc AS consrc,
+                               'CHECK (' || rcsrc || ')' AS consrc,
                                'c' AS contype,
                                NULL::int2vector AS indkey
                        FROM
index b97dc4d23c25685e4eac0f6f3fcec458272db220..6e0bf217c5cf197581c75464b4d63cf64a003187 100644 (file)
@@ -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.39 2003/10/06 15:26:23 chriskl Exp $
+ * $Id: Postgres71.php,v 1.40 2003/10/09 06:39:10 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -243,7 +243,7 @@ class Postgres71 extends Postgres {
                        SELECT conname, consrc, contype, indkey FROM (
                                SELECT
                                        rcname AS conname,
-                                       'CHECK ' || rcsrc AS consrc,
+                                       'CHECK (' || rcsrc || ')' AS consrc,
                                        'c' AS contype,
                                        rcrelid AS relid,
                                        NULL AS indkey
index fd1cb4c11cbb2cd24dd8cb3a855bfad697bb8f8e..85063d0df3c347c00c110d377038d2fe48a4c9ec 100644 (file)
@@ -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.66 2003/10/08 02:14:24 chriskl Exp $
+ * $Id: Postgres73.php,v 1.67 2003/10/09 06:39:10 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -914,7 +914,7 @@ class Postgres73 extends Postgres72 {
                                        CASE WHEN contype='f' THEN
                                                pg_catalog.pg_get_constraintdef(oid)
                                        ELSE
-                                               'CHECK ' || consrc
+                                               'CHECK (' || consrc || ')'
                                        END AS consrc,
                                        contype,
                                        conrelid AS relid,
diff --git a/info.php b/info.php
new file mode 100644 (file)
index 0000000..1509ecc
--- /dev/null
+++ b/info.php
@@ -0,0 +1,145 @@
+<?php
+
+       /**
+        * List extra information on a table
+        *
+        * $Id: info.php,v 1.1 2003/10/09 06:39:10 chriskl Exp $
+        */
+
+       // Include application functions
+       include_once('libraries/lib.inc.php');
+
+       $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
+       $PHP_SELF = $_SERVER['PHP_SELF'];
+
+       /**
+        * List all the information on the table
+        */
+       function doDefault($msg = '') {
+               global $localData, $misc;
+               global $lang;
+
+               $misc->printTableNav();
+               echo "<h2>", $misc->printVal($_REQUEST['database']), ": ", $misc->printVal($_REQUEST['table']), ": {$lang['strinfo']}</h2>\n";
+               $misc->printMsg($msg);
+
+               // Fetch info
+               $referrers = &$localData->getReferrers($_REQUEST['table']);
+               $parents = &$localData->getTableParents($_REQUEST['table']);
+               $children = &$localData->getTableChildren($_REQUEST['table']);
+
+               // Check that there is some info
+               if ($referrers->recordCount() == 0 && $parents->recordCount() == 0 && $children->recordCount() == 0) {
+                       $misc->printMsg($lang['strnoinfo']);
+               }
+               else {
+                       // Referring foreign tables
+                       if ($referrers->recordCount() > 0) {
+                               echo "<h3>{$lang['strreferringtables']}</h3>\n";
+                               echo "<table>\n";
+                               echo "\t<tr>\n\t\t";
+                               if ($localData->hasSchemas()) {
+                                       echo "<th class=\"data\">{$lang['strschema']}</th>";
+                               }
+                               echo "<th class=\"data\">{$lang['strtable']}</th>";
+                               echo "<th class=\"data\">{$lang['strname']}</th><th class=\"data\">{$lang['strdefinition']}</th>";
+                               echo "<th class=\"data\">{$lang['stractions']}</th>\n";
+                               echo "\t</tr>\n";
+                               $i = 0;
+                               
+                               while (!$referrers->EOF) {
+                                       $id = ( ($i % 2 ) == 0 ? '1' : '2' );
+                                       echo "\t<tr>\n\t\t";
+                                       if ($localData->hasSchemas()) {
+                                               echo "<td class=\"data{$id}\">", $misc->printVal($referrers->f['nspname']), "</td>";
+                                       }
+                                       echo "<td class=\"data{$id}\">", $misc->printVal($referrers->f['relname']), "</td>";
+                                       echo "<td class=\"data{$id}\">", $misc->printVal($referrers->f['conname']), "</td>";
+                                       echo "<td class=\"data{$id}\">", $misc->printVal($referrers->f['consrc']), "</td>";
+                                       echo "<td class=\"opbutton{$id}\"><a href=\"constraints.php?database=", urlencode($_REQUEST['database']), 
+                                               "&amp;schema=", urlencode($referrers->f['nspname']),
+                                               "&table=", urlencode($referrers->f['relname']), "\">{$lang['strproperties']}</a></td>\n";
+                                       echo "\t</tr>\n";
+                                       $referrers->movenext();
+                                       $i++;
+                               }
+       
+                               echo "</table>\n";
+                       }
+                       
+                       // Parent tables
+                       if ($parents->recordCount() > 0) {
+                               echo "<h3>{$lang['strparenttables']}</h3>\n";
+                               echo "<table>\n";
+                               echo "\t<tr>\n\t\t";
+                               if ($localData->hasSchemas()) {                 
+                                       echo "<th class=\"data\">{$lang['strschema']}</th>";
+                               }
+                               echo "\t\t<th class=\"data\">{$lang['strtable']}</th>";                 
+                               echo "<th class=\"data\">{$lang['stractions']}</th>\n";
+                               echo "\t</tr>\n";
+                               $i = 0;
+                               
+                               while (!$parents->EOF) {
+                                       $id = ( ($i % 2 ) == 0 ? '1' : '2' );
+                                       echo "\t<tr>\n";
+                                       if ($localData->hasSchemas()) {
+                                               echo "\t\t<td class=\"data{$id}\">", $misc->printVal($parents->f['schemaname']), "</td>";
+                                       }
+                                       echo "<td class=\"data{$id}\">", $misc->printVal($parents->f['relname']), "</td>";
+                                       echo "<td class=\"opbutton{$id}\"><a href=\"tblproperties.php?database=", urlencode($_REQUEST['database']), 
+                                               "&amp;schema=", urlencode($parents->f['schemaname']),
+                                               "&table=", urlencode($parents->f['relname']), "\">{$lang['strproperties']}</a></td>\n";
+                                       echo "\t</tr>\n";
+                                       $parents->movenext();
+                                       $i++;
+                               }
+       
+                               echo "</table>\n";
+                       }
+       
+                       // Child tables
+                       if ($children->recordCount() > 0) {
+                               echo "<h3>{$lang['strchildtables']}</h3>\n";
+                               echo "<table>\n";
+                               echo "\t<tr>\n";
+                               if ($localData->hasSchemas()) {                 
+                                       echo "<th class=\"data\">{$lang['strschema']}</th>";
+                               }
+                               echo "\t\t<th class=\"data\">{$lang['strtable']}</th>";                 
+                               echo "<th class=\"data\">{$lang['stractions']}</th>\n";
+                               echo "\t</tr>\n";
+                               $i = 0;
+                               
+                               while (!$children->EOF) {
+                                       $id = ( ($i % 2 ) == 0 ? '1' : '2' );
+                                       echo "\t<tr>\n";
+                                       if ($localData->hasSchemas()) {
+                                               echo "\t\t<td class=\"data{$id}\">", $misc->printVal($children->f['schemaname']), "</td>";
+                                       }
+                                       echo "<td class=\"data{$id}\">", $misc->printVal($children->f['relname']), "</td>";
+                                       echo "<td class=\"opbutton{$id}\"><a href=\"tblproperties.php?database=", urlencode($_REQUEST['database']), 
+                                               "&amp;schema=", urlencode($children->f['schemaname']),
+                                               "&table=", urlencode($children->f['relname']), "\">{$lang['strproperties']}</a></td>\n";
+                                       echo "\t</tr>\n";
+                                       $children->movenext();
+                                       $i++;
+                               }
+       
+                               echo "</table>\n";
+                       }
+               }
+       }
+
+       $misc->printHeader($lang['strtables'] . ' - ' . $_REQUEST['table'] . ' - ' . $lang['strinfo']);
+       $misc->printBody();
+       
+       switch ($action) {
+               default:
+                       doDefault();
+                       break;
+       }
+       
+       $misc->printFooter();
+
+?>
index 0e21d0325d6161793c043c5f718caf24754cc528..67bf19509ba0b5af8afa63201cfb0a1f85481320 100755 (executable)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.110 2003/10/08 02:14:24 chriskl Exp $
+        * $Id: english.php,v 1.111 2003/10/09 06:39:10 chriskl Exp $
         */
 
        // Language and character set
        $lang['stroperatordroppedbad'] = 'Operator drop failed.';
 
        // Info
+       $lang['strnoinfo'] = 'No information available.';
        $lang['strreferringtables'] = 'Referring Tables';
        $lang['strparenttables'] = 'Parent Tables';
        $lang['strchildtables'] = 'Child Tables';
index c5b5fecb1acc7acf768c28adb7546d97c2edac44..a95614cfc4550b69f846175bec0bb4b6f254f3dd 100644 (file)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.62 2003/10/08 02:14:24 chriskl Exp $
+        * $Id: english.php,v 1.63 2003/10/09 06:39:10 chriskl Exp $
         */
 
        // Language and character set
        $lang['stroperatordroppedbad'] = 'Operator drop failed.';
 
        // Info
+       $lang['strnoinfo'] = 'No information available.';
        $lang['strreferringtables'] = 'Referring Tables';
        $lang['strparenttables'] = 'Parent Tables';
        $lang['strchildtables'] = 'Child Tables';