basic table browsing
authorchriskl <chriskl>
Wed, 10 Apr 2002 04:09:47 +0000 (04:09 +0000)
committerchriskl <chriskl>
Wed, 10 Apr 2002 04:09:47 +0000 (04:09 +0000)
classes/database/Postgres71.php
conf/config.inc.php
lang/template.php
public_html/browser.php
public_html/index.php
public_html/tables.php
public_html/topbar.php
themes/default/global.css

index c5d29de26fe1665c7a0db422a2764d8d3f6b91f6..78c68bfc4d105f56043eaf1abab6757258d73126 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres\r
  * Note: This class uses ADODB and returns RecordSets.\r
  *\r
- * $Id: Postgres71.php,v 1.4 2002/02/18 13:06:13 chriskl Exp $\r
+ * $Id: Postgres71.php,v 1.5 2002/04/10 04:09:47 chriskl Exp $\r
  */\r
 \r
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???\r
@@ -115,6 +115,20 @@ class Postgres71 extends BaseDB {
                // @@ How do you do this?\r
                return $this->execute($sql);\r
        }\r
+       \r
+       /**\r
+        *\r
+        */\r
+       function &browseTable($table, $offset, $limit) {\r
+               return $this->selectTable("SELECT * FROM \"{$table}\"", $offset, $limit);\r
+       }\r
+       \r
+       /**\r
+        *\r
+        */\r
+       function &selectTable($sql, $offset, $limit) {\r
+               return $this->selectSet($sql, $offset, $limit);\r
+       }\r
 \r
        /**\r
         * Adds a check constraint to a table\r
index ccecf1d1905ffbf61691e5f5f57aceb36305c871..493d3ea69e0855df7c8211ddc8b282a1d0f7b044 100644 (file)
@@ -3,7 +3,7 @@
        /**\r
         * Central WebDB configuration\r
         *\r
-        * $Id: config.inc.php,v 1.4 2002/02/18 13:06:13 chriskl Exp $\r
+        * $Id: config.inc.php,v 1.5 2002/04/10 04:09:47 chriskl Exp $\r
         */\r
 \r
        // Set error reporting level\r
@@ -17,6 +17,7 @@
        \r
        // GUI settings\r
        $guiLeftFrameWidth = 200;\r
+       $guiTheme = 'default';\r
 \r
        // Servers and types\r
        $confServers = array();\r
@@ -76,7 +77,7 @@
 \r
        // Theme\r
        echo "<style type=\"text/css\">\n<!--\n";\r
-       include("../themes/default/global.css");\r
+       include("../themes/{$guiTheme}/global.css");\r
        echo "\n-->\n</style>\n";\r
        \r
 ?>
\ No newline at end of file
index 85b1f831a1caab7ad546d9d071bc0236840defda..d0e1a23b4bd18587ce78fc61402197620b8598e4 100644 (file)
@@ -4,7 +4,7 @@
         * Language template file for WebDB.  Use this to base language\r
         * files.\r
         *\r
-        * $Id: template.php,v 1.3 2002/02/18 13:06:13 chriskl Exp $\r
+        * $Id: template.php,v 1.4 2002/04/10 04:09:47 chriskl Exp $\r
         */\r
 \r
        $appLang = 'english';\r
@@ -12,6 +12,9 @@
        $strNoFrames = 'You need a frames-enabled browser to use this application.';\r
        $strLogin = 'Login';\r
        $strNoTables = 'No tables found.';\r
+       $strOwner = 'Owner';\r
+       $strActions = 'Actions';        \r
+       $strTable = 'Table';\r
        $strTables = 'Tables';\r
        $strViews = 'Views';\r
        $strTriggers = 'Triggers';\r
index 545027ead9a8934e00105f0d372d7cdcd8df5fb1..9a1fb5958613b531cdaa65338be9e537b6869f7c 100644 (file)
@@ -3,7 +3,7 @@
        /**\r
         * Main object browser\r
         *\r
-        * $Id: browser.php,v 1.4 2002/02/18 13:06:13 chriskl Exp $\r
+        * $Id: browser.php,v 1.5 2002/04/10 04:09:47 chriskl Exp $\r
         */\r
 \r
        // Include application functions\r
@@ -16,7 +16,7 @@
 <html>\r
 <head>\r
 <title><?= $appName ?></title>\r
-<body>\r
+<body class=browser>\r
 <?php\r
 \r
        // Construct expanding tree\r
                $node = $tree->add_folder($root, htmlspecialchars($databases->f[$data->dbFields['dbname']]), \r
                        'database.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]));\r
                if ($data->hasTables())\r
-                       $tree->add_document($node, $strTables, 'tables.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]));\r
+                       $tree->add_document($node, $strTables, 'tables.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]), "../images/themes/{$guiTheme}/tables.gif");\r
                if ($data->hasViews())\r
-                       $tree->add_document($node, $strViews, 'views.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]));\r
+                       $tree->add_document($node, $strViews, 'views.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]), "../images/themes/{$guiTheme}/views.gif");\r
 /*             if ($data->hasTriggers())\r
                        $tree->add_document($node, $strTriggers, 'triggers.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]));\r
                if ($data->hasRules())\r
-                       $tree->add_document($node, $strRules, 'rules.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]));\r
-               if ($data->hasSequences())*/\r
-                       $tree->add_document($node, $strSequences, 'sequences.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]));\r
+                       $tree->add_document($node, $strRules, 'rules.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]));*/\r
+               if ($data->hasSequences())\r
+                       $tree->add_document($node, $strSequences, 'sequences.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]), "../images/themes/{$guiTheme}/sequences.gif");\r
                if ($data->hasFunctions())\r
-                       $tree->add_document($node, $strFunctions, 'functions.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]));\r
+                       $tree->add_document($node, $strFunctions, 'functions.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]), "../images/themes/{$guiTheme}/functions.gif");\r
                if ($data->hasOperators())\r
                        $tree->add_document($node, $strOperators, 'operators.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]));\r
                if ($data->hasTypes())\r
index f6d16eac61912901440fda379a2b83133c96365d..66448000b4da6697a4e9b64c41096543b3038457 100755 (executable)
@@ -3,7 +3,7 @@
        /**\r
         * Main access point to WebDB.\r
         *\r
-        * $Id: index.php,v 1.2 2002/02/12 01:11:58 kkemp102294 Exp $\r
+        * $Id: index.php,v 1.3 2002/04/10 04:09:47 chriskl Exp $\r
         */\r
 \r
        // Include application functions\r
@@ -16,7 +16,7 @@
 <title><?= $appName ?></title>\r
 </head>\r
 \r
-<frameset rows="50, *" border="0" frameborder="0">\r
+<frameset rows="50, *" border="0" frameborder="0" framespacing="0">\r
        <frame src="topbar.php" name="topbar">\r
        <frameset cols="<?= $guiLeftFrameWidth ?>,*" border="0" frameborder="0">\r
          <frame src="browser.php" name="browser">\r
index cddf22b9caea2cfbe522075a8e87551f31e2d879..7f783914821cf4448a63d37295449f9891f12304 100644 (file)
@@ -3,32 +3,82 @@
        /**\r
         * List tables in a database\r
         *\r
-        * $Id: tables.php,v 1.1 2002/02/12 08:51:08 chriskl Exp $\r
+        * $Id: tables.php,v 1.2 2002/04/10 04:09:47 chriskl Exp $\r
         */\r
 \r
        // Include application functions\r
        include_once('../conf/config.inc.php');\r
-\r
-       $tables = &$localData->getTables();\r
+       \r
+       if (!isset($action)) $action = '';\r
+       \r
 ?>\r
 \r
 <html>\r
 <body>\r
 \r
-<h1><?= $appName ?></h1>\r
 <?php\r
 \r
-       if ($tables->recordCount() > 0) {\r
-               echo "<table>\n";\r
-               while (!$tables->EOF) {\r
-                       echo "<tr><td>", htmlspecialchars($tables->f[$data->tbFields['tbname']]), "</td></tr>\n";\r
-                       $tables->moveNext();\r
+switch ($action) {\r
+       case 'browse':          \r
+               echo "<h2>", htmlspecialchars($database), ": ", htmlspecialchars($table), "</h2>\n";\r
+               $rs = &$localData->browseTable($table, $offset, $limit);\r
+               \r
+               if ($rs->recordCount() > 0) {\r
+                       echo "<table>\n<tr>";\r
+                       reset($rs->f);\r
+                       while(list($k, ) = each($rs->f)) {\r
+                               echo "<th class=data>", htmlspecialchars($k), "</td>";\r
+                       }                       \r
+                       echo "<th colspan=2 class=data>{$strActions}</th>\n";\r
+                       \r
+                       $i = 0;\r
+                       reset($rs->f);\r
+                       while (!$rs->EOF) {\r
+                               $id = (($i % 2) == 0 ? '1' : '2');\r
+                               echo "<tr>\n";\r
+                               while(list(, $v) = each($rs->f)) {\r
+                                       echo "<td class=data{$id} nowrap>", nl2br(htmlspecialchars($v)), "</td>";\r
+                               }                                                       \r
+                               echo "<td class=opbutton{$id}>Edit</td>\n";\r
+                               echo "<td class=opbutton{$id}>Delete</td>\n";\r
+                               echo "</tr>\n";\r
+                               $rs->moveNext();\r
+                               $i++;\r
+                       }\r
                }\r
-       }\r
-       else {\r
-               echo "<p>{$strNoTables}</p>\n";\r
-       }\r
-       \r
+               else echo "<p>No data.</p>\n";\r
+                       \r
+               break;\r
+       default:\r
+               echo "<h2>", htmlspecialchars($database), "</h2>\n";\r
+               \r
+               $tables = &$localData->getTables();\r
+               \r
+               if ($tables->recordCount() > 0) {\r
+                       echo "<table>\n";\r
+                       echo "<tr><th class=data>{$strTable}</th><th class=data>{$strOwner}</th><th colspan=6 class=data>{$strActions}</th>\n";\r
+                       $i = 0;\r
+                       while (!$tables->EOF) {\r
+                               $id = (($i % 2) == 0 ? '1' : '2');\r
+                               echo "<tr><td class=data{$id}>", htmlspecialchars($tables->f[$data->tbFields['tbname']]), "</td>\n";\r
+                               echo "<td class=data{$id}>", htmlspecialchars($tables->f[$data->tbFields['tbowner']]), "</td>\n";\r
+                               echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=browse&offset=0&limit=30&database=", \r
+                                       htmlspecialchars($database), "&table=", htmlspecialchars($tables->f[$data->tbFields['tbname']]), "\">Browse</a></td>\n";\r
+                               echo "<td class=opbutton{$id}>Select</td>\n";\r
+                               echo "<td class=opbutton{$id}>Insert</td>\n";\r
+                               echo "<td class=opbutton{$id}>Properties</td>\n";\r
+                               echo "<td class=opbutton{$id}>Empty</td>\n";\r
+                               echo "<td class=opbutton{$id}>Drop</td>\n";\r
+                               echo "</tr>\n";\r
+                               $tables->moveNext();\r
+                               $i++;\r
+                       }\r
+               }\r
+               else {\r
+                       echo "<p>{$strNoTables}</p>\n";\r
+               }\r
+               break;\r
+}      \r
        \r
 ?>\r
 </body>\r
index f9280c7e174b02e24efa1e523a000e0f67a1639a..f65b80c6545cf351833f4071cc6ba4b29b295d4d 100755 (executable)
@@ -3,7 +3,7 @@
        /**\r
         * Top menu for WebDB\r
         *\r
-        * $Id: topbar.php,v 1.2 2002/02/12 01:11:58 kkemp102294 Exp $\r
+        * $Id: topbar.php,v 1.3 2002/04/10 04:09:47 chriskl Exp $\r
         */\r
 \r
        // Include application functions\r
 ?>\r
 \r
 <html>\r
+<body class=topbar>\r
+<table width="100%" border="0" cellspacing="0" cellpadding="0">\r
+       <tr> \r
+               <td width="211" rowspan="2"><img src="images/themes/<?= $guiTheme ?>/title.gif" width=211 height=50 alt="<? htmlspecialchars($appName) ?>"></td>\r
+               <td width="69%"><?= $confServers[$webdbServerID]['type'] ?> running on \r
+               <?= htmlspecialchars($confServers[$webdbServerID]['host']) ?>:<?= $confServers[$webdbServerID]['port'] ?>\r
+               -- You are logged in as user <b><?= htmlspecialchars($webdbUsername) ?></b>, \r
+                       <?= date('jS M, Y g:iA') ?></font></td>\r
+       </tr>\r
+       <tr>\r
+               <td>\r
+                       <a class=toplink href="usrlist.php">User Admin</a> | \r
+                       <a class=toplink href="grplist.php">Group Admin</a> | \r
+                       <a class=toplink href="login.php?mode=logout" target="_parent">Logout</a>\r
+               </td>\r
+       </tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+<!--\r
 \r
 <p>\r
 <a href="">Refresh</a> | \r
@@ -20,5 +41,4 @@
 <a href="">Preferences</a> | \r
 <a href="">Logout</a>\r
 </p>\r
-\r
-</html>
\ No newline at end of file
+-->
\ No newline at end of file
index a37f196f83f968d8a4062c70f968f071f28be399..a7493c45e168b318984e258da6278426342ec8ff 100644 (file)
@@ -16,6 +16,95 @@ body, td
        text-align: left;
 }
 
+body.topbar
+{
+       background-color: #ffffff;
+       margin: 0px 0px;
+       font-family: arial;
+       padding: 0px;
+       font-size: 10pt;
+       text-align: left;
+}
+
+body.browser
+{
+       background-color: #ffffff;
+       /*background-color: #efefef;*/
+       margin: 0px 0px;
+       font-family: arial;
+       padding: 0px;
+       font-size: 10pt;
+       text-align: left;
+}
+
+h2
+{
+       color: #666633;
+       font-size: 16;
+       font-family: verdana, arial, helvetica, sans-serif;
+       font-weight: bold;
+}
+
+th.data
+{
+       color: #000000;
+       background-color: #E6E6CC;
+       text-align: center;
+       font-family: verdana, arial, helvetica, sans-serif;
+       font-weight: bold;
+       font-size: 14;
+}
+
+td.data1
+{
+       color: #000000;
+       background-color: #F3F3E9;
+       text-align: left;
+       font-family: verdana, arial, helvetica, sans-serif;
+       font-weight: bold;
+       font-size: 13;
+}
+
+td.data2
+{
+       color: #000000;
+       background-color: #E6E6CC;
+       text-align: left;
+       font-family: verdana, arial, helvetica, sans-serif;
+       font-weight: bold;
+       font-size: 13;
+}
+
+td.opbutton1 {
+       color: #000000;
+       background-color: #F3F3E9;
+       border-top: 1px solid #FFFFFF;
+       border-right: 1px solid #706D41;
+       border-bottom: 1px solid #706D41;
+       border-left: 1px solid #FFFFFF;
+       cursor: hand;
+       font-family: Helvetica,Arial,Verdana;
+       font-size: 9pt;
+}
+
+td.opbutton2 {
+       color: #000000;
+       background-color: #E6E6CC;
+       border-top: 1px solid #FFFFFF;
+       border-right: 1px solid #706D41;
+       border-bottom: 1px solid #706D41;
+       border-left: 1px solid #FFFFFF;
+       cursor: hand;
+       font-family: Helvetica,Arial,Verdana;
+       font-size: 9pt;
+}
+
+a.toplink {
+       font-weight: bold;
+}
+
+/*
+
 tr
 {
        vertical-align: top;
@@ -220,4 +309,5 @@ a.nav:active
        padding: 0px;
        text-align: left;
        width: 100%;
-}
\ No newline at end of file
+}
+*/
\ No newline at end of file