change awk path in convert.awk. make reports feature detect that reports db doesn...
authorchriskl <chriskl>
Mon, 15 Dec 2003 08:30:54 +0000 (08:30 +0000)
committerchriskl <chriskl>
Mon, 15 Dec 2003 08:30:54 +0000 (08:30 +0000)
BUGS
HISTORY
classes/Reports.php
classes/database/Postgres.php
lang/convert.awk
lang/english.php
lang/recoded/english.php
reports.php

diff --git a/BUGS b/BUGS
index dcb416a56771162f258cb39d451e43a95cf3a5e7..0b95d270af117e87054ce2a7a9f9773bb2a213f7 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -3,7 +3,6 @@ Internal Bugs List
 
 This file is used to track current working tasks - just ignore it!
 
-better detection for when reports database hasn't been installed.
 fix getIndexes() and getConstraints() for < 7.3 to know about index type
   (eg. constraints can only be btree indexes)
 re-enable help system
@@ -19,3 +18,4 @@ investigate phpPgInfo
 
 Need to fix:
 * Variables and processes views for < 7.3
+* Viewing database properties is broken...
diff --git a/HISTORY b/HISTORY
index 5b38724bb110197faf2381eac1cedca5b50a8eb0..4e99d52fc97c148a12eb2abe5dc68f8db90ca3c7 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -12,6 +12,7 @@ Features
 
 Bugs
 * Object browser fixed for databases with no schemas
+* Properly detect that reports database is missing
 
 Translations
 * Spanish from Martin Marques
index e462a709f98cfa1ddcb26dbdd38cf2666144bfc6..a2424c4f0b0a2887f588a96b1c0081794ebe71c0 100644 (file)
@@ -4,22 +4,27 @@
         * the functions provided by the database driver exclusively, and hence
         * will work with any database without modification.
         *
-        * $Id: Reports.php,v 1.9 2003/12/10 16:03:30 chriskl Exp $
+        * $Id: Reports.php,v 1.10 2003/12/15 08:30:54 chriskl Exp $
         */
 
        class Reports {
 
                // A database driver
                var $driver;
+               var $reports_db = 'phppgadmin';
 
                /* Constructor */
-               function Reports() {
-                       global $misc;
-
-                       // Create a new database access object.
-                       // @@ IF THE phppgadmin DATABASE DOES NOT EXIST THEN
-                       // @@ LOGIN FAILURE OCCURS
-                       $this->driver = &$misc->getDatabaseAccessor('phppgadmin');
+               function Reports(&$status) {
+                       global $misc, $data;
+                       
+                       // Check to see if the reports database exists
+                       $rs = $data->getDatabase($this->reports_db);
+                       if ($rs->recordCount() != 1) $status = -1;
+                       else {
+                               // Create a new database access object.
+                               $this->driver = &$misc->getDatabaseAccessor($this->reports_db);
+                               $status = 0;
+                       }
                }
 
                /**
index 62f479a67e7ff86678a9f10168a979bdf41b8e45..b100692500d09cfc1018332b88b9f553befad22a 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.166 2003/12/13 09:28:46 chriskl Exp $
+ * $Id: Postgres.php,v 1.167 2003/12/15 08:30:54 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -226,7 +226,7 @@ class Postgres extends BaseDB {
        function &getDatabase($database) {
                $this->clean($database);
                $sql = "SELECT * FROM pg_database WHERE datname='{$database}'";
-               return $this->selectRow($sql);
+               return $this->selectSet($sql);
        }
 
        /**
index dc684d4ac29836bc7c150d3be501bc55313216fc..1db11f21b4e251d7121f359374d9f47df218205b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/awk -f
+#!/usr/bin/awk -f
 #
 # Script contains all needed conversions of recoded text
 #
index 40f70899144fc1b8a8b60b9498d09aa032397fe3..8d463e43d327016282499f2bf7a96606499878bc 100755 (executable)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.121 2003/12/13 09:28:46 chriskl Exp $
+        * $Id: english.php,v 1.122 2003/12/15 08:30:54 chriskl Exp $
         */
 
        // Language and character set
        $lang['strnodata'] = 'No rows found.';
        $lang['strnoobjects'] = 'No objects found.';
        $lang['strrownotunique'] = 'No unique identifier for this row.';
+       $lang['strnoreportsdb'] = 'You have not created the reports database.  Read the INSTALL file for directions.';
 
        // Tables
        $lang['strtable'] = 'Table';
index 8afc1b27436617eab9527b043c8a98000c811c4f..689eedbba32c6ee0b1a9347d66c88f5dce4e17f5 100644 (file)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.73 2003/12/13 09:28:46 chriskl Exp $
+        * $Id: english.php,v 1.74 2003/12/15 08:30:54 chriskl Exp $
         */
 
        // Language and character set
        $lang['strnodata'] = 'No rows found.';
        $lang['strnoobjects'] = 'No objects found.';
        $lang['strrownotunique'] = 'No unique identifier for this row.';
+       $lang['strnoreportsdb'] = 'You have not created the reports database.  Read the INSTALL file for directions.';
 
        // Tables
        $lang['strtable'] = 'Table';
index 320b0e6429421033675e53758b3bfade10246b9d..f559ee04c55ca33ff01733f7d5e3a236ad70ae2a 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List reports in a database
         *
-        * $Id: reports.php,v 1.14 2003/09/09 06:23:12 chriskl Exp $
+        * $Id: reports.php,v 1.15 2003/12/15 08:30:54 chriskl Exp $
         */
 
        // Include application functions
        $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
        $PHP_SELF = $_SERVER['PHP_SELF'];
 
-       // Create a database accessor for the reports database
-       include_once('classes/Reports.php');
-       $reportsdb = new Reports();
-
        /**
         * Displays a screen where they can edit a report
         */
        $misc->printHeader($lang['strreports']);
        $misc->printBody();
 
-       switch ($action) {
-               case 'save_edit':
-                       if (isset($_POST['cancel'])) doDefault();
-                       else doSaveEdit();
-                       break;
-               case 'edit':
-                       doEdit();
-                       break;
-               case 'properties':
-                       doProperties();
-                       break;
-               case 'save_create':
-                       if (isset($_POST['cancel'])) doDefault();
-                       else doSaveCreate();
-                       break;
-               case 'create':
-                       doCreate();
-                       break;
-               case 'drop':
-                       if (isset($_POST['drop'])) doDrop(false);
-                       else doDefault();
-                       break;
-               case 'confirm_drop':
-                       doDrop(true);
-                       break;
-               default:
-                       doDefault();
-                       break;
-       }       
+       // Create a database accessor for the reports database
+       include_once('classes/Reports.php');
+       $reportsdb = new Reports($status);
+       if ($status != 0) {
+               echo "<p>{$lang['strnoreportsdb']}</p>\n";
+       }
+       else {
+               switch ($action) {
+                       case 'save_edit':
+                               if (isset($_POST['cancel'])) doDefault();
+                               else doSaveEdit();
+                               break;
+                       case 'edit':
+                               doEdit();
+                               break;
+                       case 'properties':
+                               doProperties();
+                               break;
+                       case 'save_create':
+                               if (isset($_POST['cancel'])) doDefault();
+                               else doSaveCreate();
+                               break;
+                       case 'create':
+                               doCreate();
+                               break;
+                       case 'drop':
+                               if (isset($_POST['drop'])) doDrop(false);
+                               else doDefault();
+                               break;
+                       case 'confirm_drop':
+                               doDrop(true);
+                               break;
+                       default:
+                               doDefault();
+                               break;
+               }
+       }
 
        $misc->printFooter();