Updated pages that link to display.php.
Fixed hacks in view browsing - now consistent with table browsing.
Fixed reports.php titles and now uses printTable.
* if you click on a database it shows a list of database objects in that
* database.
*
- * $Id: browser.php,v 1.41 2004/07/16 16:01:06 soranzo Exp $
+ * $Id: browser.php,v 1.42 2004/09/02 13:53:56 jollytoad Exp $
*/
// Include application functions
'expandedIcon' => "../../../images/themes/{$conf['theme']}/tables.png",
'expanded' => false,
'linkTarget' => 'detail',
- 'iconLink' => addslashes(htmlspecialchars('display.php?table=' . urlencode($tables->f['relname']) . '&objtype=table&' . $querystr . "&return_url={$return_url}&return_desc=" . urlencode($lang['strback'])))
+ 'iconLink' => addslashes(htmlspecialchars('display.php?table=' . urlencode($tables->f['relname']) . '&subject=table&' . $querystr . "&return_url={$return_url}&return_desc=" . urlencode($lang['strback'])))
));
// Add table folder to schema
$table_node->addItem($item_node);
'expanded' => false,
'linkTarget' => 'detail',
// XXX: FIX BROWSE
- 'iconLink' => addslashes(htmlspecialchars('display.php?table='.urlencode($views->f['relname']).'&objtype=view&'.$querystr.
+ 'iconLink' => addslashes(htmlspecialchars('display.php?view='.urlencode($views->f['relname']).'&subject=view&'.$querystr.
"&return_url={$return_url}&return_desc=" . urlencode($lang['strback'])))
));
// Add view folder to schema
* @param $return_desc The return link name
* @param $page The current page
*
- * $Id: display.php,v 1.44 2004/09/02 09:01:16 jollytoad Exp $
+ * $Id: display.php,v 1.45 2004/09/02 13:53:56 jollytoad Exp $
*/
// Include application functions
$key = $_REQUEST['key'];
if ($confirm) {
- echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strtables']}: ", $misc->printVal($_REQUEST['table']), ": {$lang['streditrow']}</h2>\n";
+ $misc->printTrail($_REQUEST['subject']);
+ $misc->printTitle($lang['streditrow']);
$misc->printMsg($msg);
$attrs = &$data->getTableAttributes($_REQUEST['table']);
echo $misc->form;
if (isset($_REQUEST['table']))
echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\" />\n";
- if (isset($_REQUEST['objtype']))
- echo "<input type=\"hidden\" name=\"objtype\" value=\"", htmlspecialchars($_REQUEST['objtype']), "\" />\n";
+ if (isset($_REQUEST['subject']))
+ echo "<input type=\"hidden\" name=\"subject\" value=\"", htmlspecialchars($_REQUEST['subject']), "\" />\n";
if (isset($_REQUEST['query']))
echo "<input type=\"hidden\" name=\"query\" value=\"", htmlspecialchars($_REQUEST['query']), "\" />\n";
if (isset($_REQUEST['count']))
global $lang;
global $PHP_SELF;
- if ($confirm) {
- echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strtables']}: ", $misc->printVal($_REQUEST['table']), ": {$lang['strdeleterow']}</h2>\n";
+ if ($confirm) {
+ $misc->printTrail($_REQUEST['subject']);
+ $misc->printTitle($lang['strdeleterow']);
echo "<p>{$lang['strconfdeleterow']}</p>\n";
echo $misc->form;
if (isset($_REQUEST['table']))
echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\" />\n";
- if (isset($_REQUEST['objtype']))
- echo "<input type=\"hidden\" name=\"objtype\" value=\"", htmlspecialchars($_REQUEST['objtype']), "\" />\n";
+ if (isset($_REQUEST['subject']))
+ echo "<input type=\"hidden\" name=\"subject\" value=\"", htmlspecialchars($_REQUEST['subject']), "\" />\n";
if (isset($_REQUEST['query']))
echo "<input type=\"hidden\" name=\"query\" value=\"", htmlspecialchars($_REQUEST['query']), "\" />\n";
if (isset($_REQUEST['count']))
// If current page is not set, default to first page
if (!isset($_REQUEST['page'])) $_REQUEST['page'] = 1;
-
- // If 'table' is not set, default to '' and set type
- if (isset($_REQUEST['table']) && isset($_REQUEST['query'])) {
- echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strtables']}: ", $misc->printVal($_REQUEST['table']), ": {$lang['strselect']}</h2>\n";
- $type = 'SELECT';
- }
- elseif (isset($_REQUEST['table'])) {
- echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strtables']}: ", $misc->printVal($_REQUEST['table']), ": {$lang['strbrowse']}</h2>\n";
- $type = 'TABLE';
+
+ if (isset($_REQUEST['subject'])) {
+ $subject = $_REQUEST['subject'];
+ if (isset($_REQUEST[$subject])) $object = $_REQUEST[$subject];
}
- else {
- echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strqueryresults']}</h2>\n";
+
+ $misc->printTrail(isset($subject) ? $subject : 'database');
+
+ if (isset($object)) {
+ if (isset($_REQUEST['query'])) {
+ $misc->printTitle($lang['strselect']);
+ $type = 'SELECT';
+ } else {
+ $misc->printTitle($lang['strbrowse']);
+ $type = 'TABLE';
+ }
+ } else {
+ $misc->printTitle($lang['strqueryresults']);
$type = 'QUERY';
}
if (!isset($_REQUEST['strings'])) $_REQUEST['strings'] = 'collapsed';
// Fetch unique row identifier, if this is a table browse request.
- if (isset($_REQUEST['table']))
- $key = $data->getRowIdentifier($_REQUEST['table']);
+ if (isset($object))
+ $key = $data->getRowIdentifier($object);
else
$key = array();
// Retrieve page from query. $max_pages is returned by reference.
$rs = &$data->browseQuery($type,
- isset($_REQUEST['table']) ? $_REQUEST['table'] : null,
+ isset($object) ? $object : null,
isset($_REQUEST['query']) ? $_REQUEST['query'] : null,
$_REQUEST['sortkey'], $_REQUEST['sortdir'], $_REQUEST['page'],
$conf['max_rows'], $max_pages);
// Build strings for GETs
$str = $misc->href; // . "&page=" . urlencode($_REQUEST['page']);
- if (isset($_REQUEST['table'])) $str .= "&table=" . urlencode($_REQUEST['table']);
- if (isset($_REQUEST['objtype'])) $str .= "&objtype=" . urlencode($_REQUEST['objtype']);
+ if (isset($object)) $str .= "&" . urlencode($subject) . '=' . urlencode($object);
+ if (isset($subject)) $str .= "&subject=" . urlencode($subject);
if (isset($_REQUEST['query'])) $str .= "&query=" . urlencode($_REQUEST['query']);
if (isset($_REQUEST['count'])) $str .= "&count=" . urlencode($_REQUEST['count']);
if (isset($_REQUEST['return_url'])) $str .= "&return_url=" . urlencode($_REQUEST['return_url']);
$j = 0;
foreach ($rs->f as $k => $v) {
- if (isset($_REQUEST['table']) && $k == $data->id && !$conf['show_oids']) {
+ if (isset($object) && $k == $data->id && !$conf['show_oids']) {
$j++;
continue;
}
}
// Insert
- if ( isset($_REQUEST['table']) && ( isset($_REQUEST['objtype']) && $_REQUEST['objtype'] == 'table') ) {
+ if (isset($object) && (isset($subject) && $subject == 'table')) {
echo " | <a class=\"navlink\" href=\"tables.php?action=confinsertrow&table=",
- urlencode($_REQUEST['table']), "&{$misc->href}\">{$lang['strinsert']}</a>\n";
+ urlencode($object), "&{$misc->href}\">{$lang['strinsert']}</a>\n";
}
// Refresh
}
// If a table is specified, then set the title differently
- if (isset($_REQUEST['table']))
+ if (isset($_REQUEST['subject']) && isset($_REQUEST[$_REQUEST['subject']]))
$misc->printHeader($lang['strtables']);
else
$misc->printHeader($lang['strqueryresults']);
+
$misc->printBody();
switch ($action) {
/**
* List reports in a database
*
- * $Id: reports.php,v 1.18 2004/07/07 02:59:58 chriskl Exp $
+ * $Id: reports.php,v 1.19 2004/09/02 13:53:56 jollytoad Exp $
*/
// Include application functions
// Get a list of available databases
$databases = &$data->getDatabases();
- echo "<h2>{$lang['strreports']}: ", htmlspecialchars($report->f['report_name']), ": {$lang['stredit']}</h2>\n";
+ $_REQUEST['report'] = $report->f['report_name'];
+ $misc->printTrail('report');
+ $misc->printTitle($lang['stredit']);
$misc->printMsg($msg);
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
$report = $reportsdb->getReport($_REQUEST['report_id']);
- echo "<h2>{$lang['strreports']}: ", htmlspecialchars($report->f['report_name']), "</h2>\n";
+ $_REQUEST['report'] = $report->f['report_name'];
+ $misc->printTrail('report');
+ $misc->printTitle($lang['strproperties']);
$misc->printMsg($msg);
if ($report->recordCount() == 1) {
$databases = &$data->getDatabases();
- echo "<h2>{$lang['strreports']}: {$lang['strcreatereport']}</h2>\n";
+ $misc->printTrail('server');
+ $misc->printTitle($lang['strcreatereport']);
$misc->printMsg($msg);
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
// Fetch report from the database
$report = &$reportsdb->getReport($_REQUEST['report_id']);
- echo "<h2>{$lang['strreports']}: ", $misc->printVal($report->f['report_name']), ": {$lang['strdrop']}</h2>\n";
+ $_REQUEST['report'] = $report->f['report_name'];
+ $misc->printTrail('report');
+ $misc->printTitle($lang['strdrop']);
echo "<p>", sprintf($lang['strconfdropreport'], $misc->printVal($report->f['report_name'])), "</p>\n";
global $data, $misc, $reportsdb;
global $PHP_SELF, $lang;
- echo "<h2>{$lang['strreports']}</h2>\n";
+ $misc->printTrail('server');
+ $misc->printTitle($lang['strreports']);
$misc->printMsg($msg);
-
+
$reports = &$reportsdb->getReports();
- if ($reports->recordCount() > 0) {
- echo "<table>\n";
- echo "<tr><th class=\"data\">{$lang['strreport']}</th><th class=\"data\">{$lang['strdatabase']}</th><th class=\"data\">{$lang['strcreated']}</th><th colspan=\"4\" class=\"data\">{$lang['stractions']}</th>\n";
- $i = 0;
- while (!$reports->EOF) {
- // @@@@@@@@@ FIX THIS!!!!!
- $query = urlencode($reports->f['report_sql']);
- $return_url = urlencode('reports.php');
- $return_desc = urlencode($lang['strback']);
- $id = (($i % 2) == 0 ? '1' : '2');
- echo "<tr><td class=\"data{$id}\">", $misc->printVal($reports->f['report_name']), "</td>\n";
- echo "<td class=\"data{$id}\">", $misc->printVal($reports->f['db_name']), "</td>\n";
- echo "<td class=\"data{$id}\">", $misc->printVal($reports->f['date_created']), "</td>\n";
- echo "<td class=\"opbutton{$id}\"><a href=\"display.php?database=", urlencode($reports->f['db_name']),
- "&query={$query}&return_url={$return_url}&return_desc={$return_desc}\">{$lang['strrun']}</a></td>\n";
- echo "<td class=\"opbutton{$id}\"><a href=\"$PHP_SELF?action=properties&report_id=",
- $reports->f['report_id'], "\">{$lang['strproperties']}</a></td>\n";
- echo "<td class=\"opbutton{$id}\"><a href=\"$PHP_SELF?action=edit&report_id=",
- $reports->f['report_id'], "\">{$lang['stredit']}</a></td>\n";
- echo "<td class=\"opbutton{$id}\"><a href=\"$PHP_SELF?action=confirm_drop&report_id=",
- $reports->f['report_id'], "\">{$lang['strdrop']}</a></td>\n";
- echo "</tr>\n";
- $reports->moveNext();
- $i++;
- }
- echo "</table>\n";
- }
- else {
- echo "<p>{$lang['strnoreports']}</p>\n";
- }
-
+ $columns = array(
+ 'report' => array(
+ 'title' => $lang['strreport'],
+ 'field' => 'report_name',
+ ),
+ 'database' => array(
+ 'title' => $lang['strdatabase'],
+ 'field' => 'db_name',
+ ),
+ 'created' => array(
+ 'title' => $lang['strcreated'],
+ 'field' => 'date_created',
+ ),
+ 'actions' => array(
+ 'title' => $lang['stractions'],
+ ),
+ 'comment' => array(
+ 'title' => $lang['strcomment'],
+ 'field' => 'descr',
+ ),
+ );
+
+ $actions = array(
+ 'properties' => array(
+ 'title' => $lang['strproperties'],
+ 'url' => "{$PHP_SELF}?action=properties&",
+ 'vars' => array('report_id' => 'report_id'),
+ ),
+ 'run' => array(
+ 'title' => $lang['strrun'],
+ 'url' => "display.php?subject=report&return_url={$PHP_SELF}&return_desc=".urlencode($lang['strback'])."&",
+ 'vars' => array('report' => 'report_name', 'database' => 'db_name', 'query' => 'report_sql'),
+ ),
+ 'edit' => array(
+ 'title' => $lang['stredit'],
+ 'url' => "{$PHP_SELF}?action=edit&",
+ 'vars' => array('report_id' => 'report_id'),
+ ),
+ 'drop' => array(
+ 'title' => $lang['strdrop'],
+ 'url' => "{$PHP_SELF}?action=confirm_drop&",
+ 'vars' => array('report_id' => 'report_id'),
+ ),
+ );
+
+ $misc->printTable($reports, $columns, $actions, $lang['strnoreports']);
+
echo "<p><a class=\"navlink\" href=\"$PHP_SELF?action=create\">{$lang['strcreatereport']}</a></p>\n";
}
/**
* List tables in a database
*
- * $Id: tables.php,v 1.65 2004/09/01 16:35:59 jollytoad Exp $
+ * $Id: tables.php,v 1.66 2004/09/02 13:53:56 jollytoad Exp $
*/
// Include application functions
echo "<p><input type=\"hidden\" name=\"action\" value=\"selectrows\" />\n";
echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\" />\n";
+ echo "<input type=\"hidden\" name=\"subject\" value=\"table\" />\n";
echo $misc->form;
echo "<input type=\"submit\" name=\"select\" value=\"{$lang['strselect']}\" />\n";
echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
),
'browse' => array(
'title' => $lang['strbrowse'],
- 'url' => "display.php?{$misc->href}&objtype=table&return_url=".urlencode("tables.php?{$misc->href}")."&return_desc=".urlencode($lang['strback'])."&",
+ 'url' => "display.php?{$misc->href}&subject=table&return_url=".urlencode("tables.php?{$misc->href}")."&return_desc=".urlencode($lang['strback'])."&",
'vars' => array('table' => 'relname'),
),
'select' => array(
/**
* List tables in a database
*
- * $Id: tblproperties.php,v 1.59 2004/09/01 16:35:59 jollytoad Exp $
+ * $Id: tblproperties.php,v 1.60 2004/09/02 13:53:57 jollytoad Exp $
*/
// Include application functions
echo "<ul>\n";
$return_url = urlencode("tblproperties.php?{$misc->href}&table={$_REQUEST['table']}");
- echo "\t<li><a href=\"display.php?{$misc->href}&table=", urlencode($_REQUEST['table']), "&objtype=table&return_url={$return_url}&return_desc=",
+ echo "\t<li><a href=\"display.php?{$misc->href}&table=", urlencode($_REQUEST['table']), "&subject=table&return_url={$return_url}&return_desc=",
urlencode($lang['strback']), "\">{$lang['strbrowse']}</a></li>\n";
echo "\t<li><a href=\"tables.php?action=confselectrows&{$misc->href}&table=", urlencode($_REQUEST['table']),"\">{$lang['strselect']}</a></li>\n";
echo "\t<li><a href=\"tables.php?action=confinsertrow&{$misc->href}&table=", urlencode($_REQUEST['table']),"\">{$lang['strinsert']}</a></li>\n";
/**
* List views in a database
*
- * $Id: viewproperties.php,v 1.11 2004/09/01 16:35:59 jollytoad Exp $
+ * $Id: viewproperties.php,v 1.12 2004/09/02 13:53:57 jollytoad Exp $
*/
// Include application functions
echo "<br />\n";
echo "<ul>\n";
-
- // @@@@@@@@@ FIX THIS!!!!!
- $data->fieldClean($_REQUEST['view']);
- if ($data->hasSchemas() && isset($_REQUEST['schema'])) {
- $data->fieldClean($_REQUEST['schema']);
- $query = urlencode("SELECT * FROM \"{$_REQUEST['schema']}\".\"{$_REQUEST['view']}\"");
- }
- else
- $query = urlencode("SELECT * FROM \"{$_REQUEST['view']}\"");
-
- $count = urlencode("SELECT COUNT(*) AS total FROM \"{$_REQUEST['view']}\"");
$return_url = urlencode("viewproperties.php?{$misc->href}&view=" . urlencode($_REQUEST['view']));
-
- echo "\t<li><a href=\"display.php?{$misc->href}&query={$query}&count={$count}&return_url={$return_url}&return_desc=",
+ echo "\t<li><a href=\"display.php?{$misc->href}&view=", urlencode($_REQUEST['view']), "&subject=view&return_url={$return_url}&return_desc=",
urlencode($lang['strback']), "\">{$lang['strbrowse']}</a></li>\n";
echo "\t<li><a href=\"views.php?action=confselectrows&{$misc->href}&view=", urlencode($_REQUEST['view']),"\">{$lang['strselect']}</a></li>\n";
echo "\t<li><a href=\"views.php?action=confirm_drop&{$misc->href}&view=", urlencode($_REQUEST['view']),"\">{$lang['strdrop']}</a></li>\n";
/**
* Manage views in a database
*
- * $Id: views.php,v 1.49 2004/09/01 16:35:59 jollytoad Exp $
+ * $Id: views.php,v 1.50 2004/09/02 13:53:57 jollytoad Exp $
*/
// Include application functions
echo "<p><input type=\"hidden\" name=\"action\" value=\"selectrows\" />\n";
echo "<input type=\"hidden\" name=\"view\" value=\"", htmlspecialchars($_REQUEST['view']), "\" />\n";
+ echo "<input type=\"hidden\" name=\"subject\" value=\"view\" />\n";
echo $misc->form;
echo "<input type=\"submit\" name=\"select\" value=\"{$lang['strselect']}\" />\n";
echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
global $data, $misc, $conf;
global $PHP_SELF, $lang;
- function vwPre(&$rowdata) {
- global $data;
- if ($data->hasSchemas() && isset($_REQUEST['schema'])) {
- $data->fieldClean($_REQUEST['schema']);
- $rowdata->f['+vwquery'] = "SELECT * FROM \"{$_REQUEST['schema']}\".\"{$rowdata->f['relname']}\"";
- } else {
- $rowdata->f['+vwquery'] = "SELECT * FROM \"{$rowdata->f['relname']}\"";
- }
- $rowdata->f['+vwcount'] = "SELECT COUNT(*) AS total FROM \"{$rowdata->f['relname']}\"";
- }
-
$misc->printTrail('schema');
$misc->printTabs('schema','views');
$misc->printMsg($msg);
),
'browse' => array(
'title' => $lang['strbrowse'],
- 'url' => "display.php?{$misc->href}&return_url=".urlencode("views.php?{$misc->href}")."&return_desc=".urlencode($lang['strback'])."&",
- 'vars' => array('query' => '+vwquery', 'count' => '+vwcount'),
+ 'url' => "display.php?{$misc->href}&subject=view&return_url=".urlencode("views.php?{$misc->href}")."&return_desc=".urlencode($lang['strback'])."&",
+ 'vars' => array('view' => 'relname'),
),
'select' => array(
'title' => $lang['strselect'],
),
);
- $misc->printTable($views, $columns, $actions, $lang['strnoviews'], 'vwPre');
+ $misc->printTable($views, $columns, $actions, $lang['strnoviews']);
echo "<p><a class=\"navlink\" href=\"$PHP_SELF?action=create&{$misc->href}\">{$lang['strcreateview']}</a> |\n";
echo "<a class=\"navlink\" href=\"$PHP_SELF?action=wiz_create&{$misc->href}\">{$lang['strcreateviewwiz']}</a></p>\n";