show languages
authorchriskl <chriskl>
Mon, 27 Oct 2003 05:43:18 +0000 (05:43 +0000)
committerchriskl <chriskl>
Mon, 27 Oct 2003 05:43:18 +0000 (05:43 +0000)
BUGS
HISTORY
TODO
browser.php
casts.php
classes/database/Postgres.php
classes/database/Postgres73.php
functions.php
lang/english.php
lang/recoded/english.php
schema.php

diff --git a/BUGS b/BUGS
index 652adc9d97b66d154dbbaa2b22a5700ff95f89d8..51b7da8968999dfaa145596439a63b130cb36eb6 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -3,5 +3,5 @@ fix getIndexes() and getConstraints() for < 7.3 to know about index type
   (eg. constraints can only be btree indexes)
 re-enable help system
 all DROP and ALTER commands MUST be fully schema-qualified otherwise you can accidentally drop stuff in pg_catalog :(
-need icons for Casts and Conversions
+need icons for Casts and Conversions and Languages
 
diff --git a/HISTORY b/HISTORY
index 42992cf180c78021d350c8885ab9da7233574d0a..bc9c2d15d7144165d6def2a0d37b5cdcfe052eae 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -17,6 +17,7 @@ Features
 * Removed any trace of MySQL support
 * Show casts
 * Show conversions
+* Show languages
 
 Bugs
 * Added legal DOCTYPE
diff --git a/TODO b/TODO
index 51d529fee19b7b04256e4c863723eb5f81a39ab9..2f61f76ed577a3ed111e795fc84010f5cecea924 100644 (file)
--- a/TODO
+++ b/TODO
@@ -97,7 +97,9 @@ Aggregates
 Languages
 ---------
 
-* Unimplemented
+* -Display (chriskl)
+* Drop
+* Create
 
 Domains (7.3)
 -------------
index 21f6f2c87ab31c115884fbf976cfae61cdbd8925..ab5c00d0cdcead950dfb1a509749e0ec1635845a 100644 (file)
@@ -5,7 +5,7 @@
         * if you click on a database it shows a list of database objects in that
         * database.
         *
-        * $Id: browser.php,v 1.21 2003/10/27 03:49:19 chriskl Exp $
+        * $Id: browser.php,v 1.22 2003/10/27 05:43:18 chriskl Exp $
         */
 
        // Include application functions
                                addNodes($db_node, $querystr);
                        }
                        
+                       // Languages
+                       if ($data->hasLanguages()) {            
+                               $lang_node = &new HTML_TreeNode(array(
+                                                               'text' => addslashes($lang['strlanguages']), 
+                                                               'link' => addslashes(htmlspecialchars("languages.php?{$querystr}")), 
+                                                               'icon' => "../../../images/themes/{$conf['theme']}/types.png", 
+                                                               'expandedIcon' => "../../../images/themes/{$conf['theme']}/types.png",
+                                                               'expanded' => false,
+                                                               'linkTarget' => 'detail'));
+
+                               // Add folder to database
+                               $db_node->addItem($lang_node);
+                       }
+               
                        // Casts
                        if ($data->hasCasts()) {                
                                $cast_node = &new HTML_TreeNode(array(
index 061b2721a3a41bb1590ddf058f6a28a8f9731304..6cb8cbf60f25fc2d89a82d45e78ca8fd6f5309da 100644 (file)
--- a/casts.php
+++ b/casts.php
@@ -3,7 +3,7 @@
        /**
         * Manage casts in a database
         *
-        * $Id: casts.php,v 1.1 2003/10/26 12:12:28 chriskl Exp $
+        * $Id: casts.php,v 1.2 2003/10/27 05:43:18 chriskl Exp $
         */
 
        // Include application functions
                else {
                        echo "<p>{$lang['strnocasts']}</p>\n";
                }
-               
-//             echo "<p><a class=\"navlink\" href=\"$PHP_SELF?action=create&amp;{$misc->href}\">{$lang['strcreatecast']}</a></p>\n";
        }
 
        $misc->printHeader($lang['strcasts']);
        $misc->printBody();
 
        switch ($action) {
-               case 'save_create':
-                       if (isset($_POST['cancel'])) doDefault();
-                       else doSaveCreate();
-                       break;
-               case 'create':
-                       doCreate();
-                       break;
-               case 'drop':
-                       if (isset($_POST['cancel'])) doDefault();
-                       else doDrop(false);
-                       break;
-               case 'confirm_drop':
-                       doDrop(true);
-                       break;                  
-               case 'properties':
-                       doProperties();
-                       break;
                default:
                        doDefault();
                        break;
index f98031b884ddf51ec20fe2100a39b20a07b1e899..542367ca215b8680cdb34ceda03c23d21278dda7 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.159 2003/10/26 10:59:16 chriskl Exp $
+ * $Id: Postgres.php,v 1.160 2003/10/27 05:43:18 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -922,26 +922,6 @@ class Postgres extends BaseDB {
                }
        }
 
-       /**
-        * Return all database available on the server
-        * @return A list of databases, sorted alphabetically
-        */
-       function &getLanguages() {
-               $sql = "SELECT lanname, lanispl, lanpltrusted FROM pg_language ORDER BY lanname";
-               return $this->selectSet($sql);
-       }
-
-       /**
-        * Return all information about a particular database
-        * @param $database The name of the database to retrieve
-        * @return The database info
-        */
-       function &getLanguage($database) {
-               $this->clean($database);
-               $sql = "SELECT * FROM pg_database WHERE datname='{$database}'";
-               return $this->selectRow($sql);
-       }
-
        /**
         * Creates a database
         * @param $database The name of the database to create
@@ -3339,6 +3319,38 @@ class Postgres extends BaseDB {
                return $this->selectSet($sql);
        }
 
+       // Language functions
+       
+       /**
+        * Gets all languages
+        * @param $all True to get all languages, regardless of show_system
+        * @return A recordset
+        */
+       function &getLanguages($all = false) {
+               global $conf;
+               
+               if ($conf['show_system'] || $all)
+                       $where = '';
+               else
+                       $where = 'AND lanispl';
+
+               $sql = "
+                       SELECT
+                               pl.lanname,
+                               pl.lanpltrusted,
+                               pp.proname AS lanplcallf
+                       FROM
+                               pg_language pl, pg_proc pp
+                       WHERE
+                               pl.lanplcallfoid = pp.oid
+                               {$where}
+                       ORDER BY
+                               lanname
+               ";
+               
+               return $this->selectSet($sql);
+       }
+
        // Type conversion routines
 
        /**
index c366ee16526a4ddafece5696da6b71b0b42b056e..a95bf06326fbb5b6161870efd755076966582d69 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.74 2003/10/27 03:49:19 chriskl Exp $
+ * $Id: Postgres73.php,v 1.75 2003/10/27 05:43:18 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -1288,6 +1288,36 @@ class Postgres73 extends Postgres72 {
                        ORDER BY 1;\r
                ";
 
+               return $this->selectSet($sql);
+       }
+       
+       // Language functions
+       
+       /**
+        * Gets all languages
+        * @param $all True to get all languages, regardless of show_system
+        * @return A recordset
+        */
+       function &getLanguages($all = false) {
+               global $conf;
+               
+               if ($conf['show_system'] || $all)
+                       $where = '';
+               else
+                       $where = 'WHERE lanispl';
+
+               $sql = "
+                       SELECT
+                               lanname,
+                               lanpltrusted,
+                               lanplcallfoid::pg_catalog.regproc AS lanplcallf
+                       FROM
+                               pg_catalog.pg_language
+                       {$where}
+                       ORDER BY
+                               lanname
+               ";
+               
                return $this->selectSet($sql);
        }       
                
index fe39893a927f5b1f0e06ba7da30cca9b0f094a00..760bb6b945e986656b43be89f403a05dcc2b4ac4 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage functions in a database
         *
-        * $Id: functions.php,v 1.21 2003/09/17 17:04:11 soranzo Exp $
+        * $Id: functions.php,v 1.22 2003/10/27 05:43:18 chriskl Exp $
         */
 
        // Include application functions
                if (!isset($_POST['formSetOf'])) $_POST['formSetOf'] = '';
                
                $types = &$localData->getTypes(true);
-               $langs = &$localData->getLanguages();
+               $langs = &$localData->getLanguages(true);
 
                echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strfunctions']}: {$lang['strcreatefunction']}</h2>\n";
                $misc->printMsg($msg);
index 6e11b951ed87f45f6520cd26fbfc539d3a8a2a95..d8227872b55c49b63d97a7df65fe4f95e1a5860e 100755 (executable)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.118 2003/10/27 03:49:19 chriskl Exp $
+        * $Id: english.php,v 1.119 2003/10/27 05:43:18 chriskl Exp $
         */
 
        // Language and character set
        $lang['strsourceencoding'] = 'Source encoding';
        $lang['strtargetencoding'] = 'Target encoding';
        
+       // Languages
+       $lang['strlanguages'] = 'Languages';
+       $lang['strnolanguages'] = 'No languages found.';
+       $lang['strtrusted'] = 'Trusted';
+       
        // Info
        $lang['strnoinfo'] = 'No information available.';
        $lang['strreferringtables'] = 'Referring tables';
index 8058b785eea99f0a6430f0af9306f513bbfa247a..f8641b20e5ae86f6e5cd35d3bbb7cf70102ca9b4 100644 (file)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.70 2003/10/27 03:49:20 chriskl Exp $
+        * $Id: english.php,v 1.71 2003/10/27 05:43:18 chriskl Exp $
         */
 
        // Language and character set
        $lang['strsourceencoding'] = 'Source encoding';
        $lang['strtargetencoding'] = 'Target encoding';
        
+       // Languages
+       $lang['strlanguages'] = 'Languages';
+       $lang['strnolanguages'] = 'No languages found.';
+       $lang['strtrusted'] = 'Trusted';
+       
        // Info
        $lang['strnoinfo'] = 'No information available.';
        $lang['strreferringtables'] = 'Referring tables';
index cf69b1d9cb6f3a00dc66f661ea2c355df8a22598..77a4ebba950d8e81f16ee8b5006dbe5afa3552b3 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Display properties of a schema
         *
-        * $Id: schema.php,v 1.8 2003/10/26 10:59:16 chriskl Exp $
+        * $Id: schema.php,v 1.9 2003/10/27 05:43:18 chriskl Exp $
         */
 
        // Include application functions
@@ -32,6 +32,7 @@
                echo "<ul>\n";
                echo "<li><a href=\"types.php?{$misc->href}\">{$lang['strtypes']}</a></li>\n";
                echo "<li><a href=\"operators.php?{$misc->href}\">{$lang['stroperators']}</a></li>\n";
+               echo "<li><a href=\"conversions.php?{$misc->href}\">{$lang['strconversions']}</a></li>\n";
                echo "</ul>\n";
                echo "</ul>\n";
        }