diff options
author | Leonardo Sapiras | 2012-02-23 22:57:54 +0000 |
---|---|---|
committer | Jehan-Guillaume (ioguix) de Rorthais | 2012-08-22 10:27:20 +0000 |
commit | 4f77054ad815d1d28e40e38e3c5cc08761e2fbad (patch) | |
tree | f366ba05786a9b2a5b0bd4fb5fc0b1979e251774 | |
parent | f5892dd7650ad1057555acd64aca2c345daea1ef (diff) |
Add support for 'actionbuttons' hooks in the plugin architecture.
By Leonardo Sapiras during the GSoC 2011. Reviewed, massively patched,
fixed, integrated and commited by ioguix
-rw-r--r-- | admin.php | 36 | ||||
-rw-r--r-- | aggregates.php | 30 | ||||
-rw-r--r-- | all_db.php | 55 | ||||
-rw-r--r-- | casts.php | 2 | ||||
-rw-r--r-- | classes/Misc.php | 84 | ||||
-rw-r--r-- | classes/PluginManager.php | 2 | ||||
-rw-r--r-- | colproperties.php | 2 | ||||
-rw-r--r-- | constraints.php | 19 | ||||
-rw-r--r-- | conversions.php | 2 | ||||
-rwxr-xr-x | database.php | 36 | ||||
-rw-r--r-- | display.php | 32 | ||||
-rw-r--r-- | domains.php | 86 | ||||
-rw-r--r-- | fulltext.php | 88 | ||||
-rw-r--r-- | functions.php | 44 | ||||
-rw-r--r-- | groups.php | 55 | ||||
-rw-r--r-- | history.php | 34 | ||||
-rw-r--r-- | indexes.php | 48 | ||||
-rw-r--r-- | info.php | 169 | ||||
-rw-r--r-- | languages.php | 2 | ||||
-rw-r--r-- | opclasses.php | 2 | ||||
-rw-r--r-- | operators.php | 23 | ||||
-rw-r--r-- | reports.php | 46 | ||||
-rw-r--r-- | roles.php | 28 | ||||
-rw-r--r-- | rules.php | 18 | ||||
-rwxr-xr-x | schemas.php | 43 | ||||
-rw-r--r-- | sequences.php | 42 | ||||
-rw-r--r-- | servers.php | 17 | ||||
-rw-r--r-- | tables.php | 122 | ||||
-rwxr-xr-x | tablespaces.php | 41 | ||||
-rw-r--r-- | tblproperties.php | 65 | ||||
-rw-r--r-- | triggers.php | 66 | ||||
-rw-r--r-- | types.php | 17 | ||||
-rw-r--r-- | users.php | 28 | ||||
-rwxr-xr-x | viewproperties.php | 16 | ||||
-rw-r--r-- | views.php | 58 |
35 files changed, 1059 insertions, 399 deletions
@@ -628,23 +628,35 @@ $actions = array( 'edit' => array( - 'title' => $lang['stredit'], - 'url' => "{$script}?action=confeditautovac&{$misc->href}&subject={$type}&", - 'vars' => array( - 'schema' => 'nspname', - 'table' => 'relname' + 'content' => $lang['stredit'], + 'attr'=> array ( + 'href' => array ( + 'url' => $script, + 'urlvars' => array ( + 'subject' => $type, + 'action' => 'confeditautovac', + 'schema' => field('nspname'), + 'table' => field('relname') + ) + ) ) ), 'delete' => array( - 'title' => $lang['strdelete'], - 'url' => "{$script}?action=confdelautovac&{$misc->href}&subject={$type}&", - 'vars' => array( - 'schema' => 'nspname', - 'table' => 'relname' + 'content' => $lang['strdelete'], + 'attr'=> array ( + 'href' => array ( + 'url' => $script, + 'urlvars' => array ( + 'subject' => $type, + 'action' => 'confdelautovac', + 'schema' => field('nspname'), + 'table' => field('relname') + ) + ) ) ) ); - + if ($type == 'table') { unset($actions['edit']['vars']['schema'], $actions['delete']['vars']['schema'], @@ -653,7 +665,7 @@ ); } - $misc->printTable($autovac, $columns, $actions, $lang['strnovacuumconf']); + $misc->printTable($autovac, $columns, $actions, 'admin-admin', $lang['strnovacuumconf']); if (($type == 'table') and ($autovac->recordCount() == 0)) { echo "<br />"; diff --git a/aggregates.php b/aggregates.php index fdf10223..6970d338 100644 --- a/aggregates.php +++ b/aggregates.php @@ -344,19 +344,35 @@ $actions = array( 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "aggregates.php?action=alter&{$misc->href}&", - 'vars' => array('aggrname' => 'proname', 'aggrtype' => 'proargtypes'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'aggregates.php', + 'urlvars' => array ( + 'action' => 'alter', + 'aggrname' => field('proname'), + 'aggrtype' => field('proargtypes') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "aggregates.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('aggrname' => 'proname', 'aggrtype' => 'proargtypes'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'aggregates.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'aggrname' => field('proname'), + 'aggrtype' => field('proargtypes') + ) + ) + ) ) ); if (!$data->hasAlterAggregate()) unset($actions['alter']); - $misc->printTable($aggregates, $columns, $actions, $lang['strnoaggregates']); + $misc->printTable($aggregates, $columns, $actions, 'aggregates-aggregates', $lang['strnoaggregates']); $navlinks = array ( array ( @@ -393,28 +393,51 @@ $actions = array( 'multiactions' => array( - 'keycols' => array('database' => 'datname'), - 'url' => 'all_db.php', - 'default' => null, + 'keycols' => array('database' => 'datname'), + 'url' => 'all_db.php', + 'default' => null, ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "all_db.php?action=confirm_drop&subject=database&{$misc->href}&", - 'vars' => array('dropdatabase' => 'datname'), - 'multiaction' => 'confirm_drop', + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'all_db.php', + 'urlvars' => array ( + 'subject' => 'database', + 'action' => 'confirm_drop', + 'dropdatabase' => field('datname') + ) + ) + ), + 'multiaction' => 'confirm_drop', ), 'privileges' => array( - 'title' => $lang['strprivileges'], - 'url' => "privileges.php?subject=database&{$misc->href}&", - 'vars' => array('database' => 'datname'), + 'content' => $lang['strprivileges'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'privileges.php', + 'urlvars' => array ( + 'subject' => 'database', + 'database' => field('datname') + ) + ) + ) ) ); if ($data->hasAlterDatabase() ) { - $actions['alter'] = array( - 'title' => $lang['stralter'], - 'url' => "all_db.php?action=confirm_alter&subject=database&{$misc->href}&", - 'vars' => array('alterdatabase' => 'datname') - ); + $actions['alter'] = array( + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'all_db.php', + 'urlvars' => array ( + 'subject' => 'database', + 'action' => 'confirm_alter', + 'alterdatabase' => field('datname') + ) + ) + ) + ); } if (!$data->hasTablespaces()) unset($columns['tablespace']); @@ -422,7 +445,7 @@ if (!$data->hasDatabaseCollation()) unset($columns['lc_collate'], $columns['lc_ctype']); if (!isset($data->privlist['database'])) unset($actions['privileges']); - $misc->printTable($databases, $columns, $actions, $lang['strnodatabases']); + $misc->printTable($databases, $columns, $actions, 'all_db-databases', $lang['strnodatabases']); $navlinks = array ( array ( @@ -62,7 +62,7 @@ $actions = array(); - $misc->printTable($casts, $columns, $actions, $lang['strnocasts']); + $misc->printTable($casts, $columns, $actions, 'casts-casts', $lang['strnocasts']); } /** diff --git a/classes/Misc.php b/classes/Misc.php index 64cd26f7..84c8be8e 100644 --- a/classes/Misc.php +++ b/classes/Misc.php @@ -594,35 +594,46 @@ } /** - * Display a list of links - * @param $links An associative array of links to print - * links = array( + * Display a link + * @param $link An associative array of link parameters to print + * link = array( * 'attr' => array( // list of A tag attribute * 'attrname' => attribute value * ... * ), * 'content' => The link text - * 'fields' => the data from which content and attr's values are obtained + * 'fields' => (optionnal) the data from which content and attr's values are obtained * ); * the special attribute 'href' might be a string or an array. If href is an array it * will be generated by getActionUrl. See getActionUrl comment for array format. + */ + function printLink($link) { + $tag = "<a "; + foreach ($link['attr'] as $attr => $value) { + if ($attr == 'href' and is_array($value)) { + $tag.= 'href="'. htmlentities($this->getActionUrl($value, $link['fields'])).'" '; + } + else { + $tag.= htmlentities($attr).'="'. value($value, $link['fields'], 'html') .'" '; + } + } + $tag.= ">". value($link['content'], $link['fields'], 'html') ."</a>\n"; + echo $tag; + } + + /** + * Display a list of links + * @param $links An associative array of links to print. See printLink function for + * the links array format. * @param $class An optional class or list of classes seprated by a space * WARNING: This field is NOT escaped! No user should be able to inject something here, use with care. */ function printLinksList($links, $class='') { echo "<ul class=\"{$class}\">\n"; foreach ($links as $link) { - $tag = "\t<li><a "; - foreach ($link['attr'] as $attr => $value) { - if ($attr == 'href' and is_array($value)) { - $tag.= 'href="'. htmlentities($this->getActionUrl($value, $link['fields'])).'" '; - } - else { - $tag.= htmlentities($attr).'="'. value($value, $link['fields'], 'html') .'" '; - } - } - $tag.= ">". value($link['content'], $link['fields'], 'html') ."</a></li>\n"; - echo $tag; + echo "\t<li>"; + $this->printLink($link); + echo "</li>\n"; } echo "</ul>\n"; } @@ -1723,15 +1734,18 @@ $urlvars = array(); } - if (isset($urlvars['subject'])) { + /* set server, database and schema parameter if not presents */ + if (isset($urlvars['subject'])) $subject = value($urlvars['subject'], $fields); - if (isset($_REQUEST['server']) && $subject != 'root') { - $urlvars['server'] = $_REQUEST['server']; - if (isset($_REQUEST['database']) && $subject != 'server') { - $urlvars['database'] = $_REQUEST['database']; - if (isset($_REQUEST['schema']) && $subject != 'database') { - $urlvars['schema'] = $_REQUEST['schema']; - } + else + $subject = ''; + + if (isset($_REQUEST['server']) and !isset($urlvars['server']) and $subject != 'root') { + $urlvars['server'] = $_REQUEST['server']; + if (isset($_REQUEST['database']) and !isset($urlvars['database']) and $subject != 'server') { + $urlvars['database'] = $_REQUEST['database']; + if (isset($_REQUEST['schema']) and !isset($urlvars['schema']) and $subject != 'database') { + $urlvars['schema'] = $_REQUEST['schema']; } } } @@ -1798,6 +1812,8 @@ * Add this action to the multi action form * ), ... * ); + * @param $place Place where the $actions are displayed. Like 'display-browse', where 'display' is the file (display.php) + * and 'browse' is the place inside that code (doBrowse). * @param $nodata (optional) Message to display if data set is empty. * @param $pre_fn (optional) Name of a function to call for each row, * it will be passed two params: $rowdata and $actions, @@ -1808,8 +1824,15 @@ * The function must not must not store urls because * they are relative and won't work out of context. */ - function printTable(&$tabledata, &$columns, &$actions, $nodata = null, $pre_fn = null) { - global $data, $conf, $misc, $lang; + function printTable(&$tabledata, &$columns, &$actions, $place, $nodata = null, $pre_fn = null) { + global $data, $conf, $misc, $lang, $plugin_manager; + + // Action buttons hook's place + $plugin_functions_parameters = array( + 'actionbuttons' => &$actions, + 'place' => $place + ); + $plugin_manager->do_hook('actionbuttons', $plugin_functions_parameters); if ($has_ma = isset($actions['multiactions'])) $ma = $actions['multiactions']; @@ -1887,12 +1910,9 @@ echo "<td></td>\n"; } else { echo "<td class=\"opbutton{$id}\">"; - echo "<a href=\"{$action['url']}"; - if ($action['url'] === '') echo '?'; - $misc->printUrlVars($action['vars'], $tabledata->fields); - if (isset($action['target'])) - echo "\" target=\"{$action['target']}"; - echo "\">{$action['title']}</a></td>\n"; + $action['fields'] = $tabledata->fields; + $this->printLink($action); + echo "</td>\n"; } } break; @@ -1943,7 +1963,7 @@ echo "\t\t<option value=\"\">--</option>\n"; foreach($actions as $k => $a) if (isset($a['multiaction'])) - echo "\t\t<option value=\"{$a['multiaction']}\"", ($ma['default'] == $k? ' selected="selected"': ''), ">{$a['title']}</option>\n"; + echo "\t\t<option value=\"{$a['multiaction']}\"", ($ma['default'] == $k? ' selected="selected"': ''), ">{$a['content']}</option>\n"; echo "\t</select>\n"; echo "<input type=\"submit\" value=\"{$lang['strexecute']}\" />\n"; echo $misc->form; diff --git a/classes/PluginManager.php b/classes/PluginManager.php index 3932f8ce..e2a97c92 100644 --- a/classes/PluginManager.php +++ b/classes/PluginManager.php @@ -10,7 +10,7 @@ class PluginManager { * Attributes */ private $plugins_list = array(); - private $available_hooks = array('toplinks', 'tabs', 'trail', 'navlinks' /* wip, more hooks to come in next commits */); + private $available_hooks = array('toplinks', 'tabs', 'trail', 'navlinks', 'actionbuttons' /* wip, more hooks to come in next commits */); private $actions = array(); private $hooks = array(); diff --git a/colproperties.php b/colproperties.php index 75051423..c4d8ae37 100644 --- a/colproperties.php +++ b/colproperties.php @@ -226,7 +226,7 @@ } $actions=array(); - $misc->printTable($attrs, $column, $actions, null, 'attPre'); + $misc->printTable($attrs, $column, $actions, 'colproperties-colproperties', null, 'attPre'); echo "<br />\n"; diff --git a/constraints.php b/constraints.php index 93c2036b..5aa7462f 100644 --- a/constraints.php +++ b/constraints.php @@ -464,13 +464,22 @@ $actions = array( 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "constraints.php?action=confirm_drop&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", - 'vars' => array('constraint' => 'conname', 'type' => 'contype'), - ), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'constraints.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'table' => $_REQUEST['table'], + 'constraint' => field('conname'), + 'type' => field('contype') + ) + ) + ) + ) ); - $misc->printTable($constraints, $columns, $actions, $lang['strnoconstraints'], 'cnPre'); + $misc->printTable($constraints, $columns, $actions, 'constraints-constraints', $lang['strnoconstraints'], 'cnPre'); $navlinks = array ( array ( diff --git a/conversions.php b/conversions.php index 69525007..8b5ab7c4 100644 --- a/conversions.php +++ b/conversions.php @@ -51,7 +51,7 @@ $actions = array(); - $misc->printTable($conversions, $columns, $actions, $lang['strnoconversions']); + $misc->printTable($conversions, $columns, $actions, 'conversions-conversions', $lang['strnoconversions']); } /** diff --git a/database.php b/database.php index c49f0748..5a655780 100755 --- a/database.php +++ b/database.php @@ -376,7 +376,7 @@ $actions = array(); - $misc->printTable($variables, $columns, $actions, $lang['strnodata']); + $misc->printTable($variables, $columns, $actions, 'database-variables', $lang['strnodata']); } /** @@ -429,7 +429,7 @@ $actions = array(); - $misc->printTable($prep_xacts, $columns, $actions, $lang['strnodata']); + $misc->printTable($prep_xacts, $columns, $actions, 'database-processes-preparedxacts', $lang['strnodata']); } // Fetch the processes from the database @@ -462,14 +462,30 @@ if ($data->isSuperUser()) { $actions = array( 'cancel' => array( - 'title' => $lang['strcancel'], - 'url' => "database.php?action=signal&signal=CANCEL&{$misc->href}&", - 'vars' => array('procpid' => 'procpid') + 'content' => $lang['strcancel'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'database.php', + 'urlvars' => array ( + 'action' => 'signal', + 'signal' => 'CANCEL', + 'procpid' => field('procpid') + ) + ) + ) ), 'kill' => array( - 'title' => $lang['strkill'], - 'url' => "database.php?action=signal&signal=KILL&{$misc->href}&", - 'vars' => array('procpid' => 'procpid') + 'content' => $lang['strkill'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'database.php', + 'urlvars' => array ( + 'action' => 'signal', + 'signal' => 'KILL', + 'procpid' => field('procpid') + ) + ) + ) ) ); @@ -483,7 +499,7 @@ // Remove query start time for <7.4 if (!isset($processes->fields['query_start'])) unset($columns['start_time']); - $misc->printTable($processes, $columns, $actions, $lang['strnodata']); + $misc->printTable($processes, $columns, $actions, 'database-processes', $lang['strnodata']); if ($isAjax) exit; } @@ -529,7 +545,7 @@ if (!$data->hasVirtualTransactionId()) unset($columns['vxid']); $actions = array(); - $misc->printTable($variables, $columns, $actions, $lang['strnodata']); + $misc->printTable($variables, $columns, $actions, 'database-locks', $lang['strnodata']); if ($isAjax) exit; } diff --git a/display.php b/display.php index a05e872e..4fbdb0ed 100644 --- a/display.php +++ b/display.php @@ -551,9 +551,27 @@ break; } } + + $buttons = array(); + $plugin_functions_parameters = array( + 'actionbuttons' => &$buttons, + 'place' => 'display-browse' + ); + $plugin_manager->do_hook('actionbuttons', $plugin_functions_parameters); + + foreach (array_keys($plugin_functions_parameters['actionbuttons']) as $action) { + $plugin_functions_parameters['actionbuttons'][$action]['attr']['href']['urlvars'] = array_merge( + $plugin_functions_parameters['actionbuttons'][$action]['attr']['href']['urlvars'], + $_gets, $_getsort + ); + } + + error_log(print_r($plugin_functions_parameters, 1)); + // Display edit and delete actions if we have a key + $colspan = count($buttons) + 2; if (sizeof($key) > 0) - echo "<th colspan=\"2\" class=\"data\">{$lang['stractions']}</th>\n"; + echo "<th colspan=\"{$colspan}\" class=\"data\">{$lang['stractions']}</th>\n"; /* we show OIDs only if we are in TABLE or SELECT type browsing */ printTableHeaderCells($rs, $gets, isset($object)); @@ -578,7 +596,7 @@ $key_str .= urlencode("key[{$v}]") . '=' . urlencode($rs->fields[$v]); } if ($has_nulls) { - echo "<td colspan=\"2\"> </td>\n"; + echo "<td colspan=\"{$colspan}\"> </td>\n"; } else { echo "<td class=\"opbutton{$id}\"><a href=\"display.php?action=confeditrow&strings=", urlencode($_REQUEST['strings']), "&page=", @@ -586,6 +604,16 @@ echo "<td class=\"opbutton{$id}\"><a href=\"display.php?action=confdelrow&strings=", urlencode($_REQUEST['strings']), "&page=", urlencode($_REQUEST['page']), "&{$key_str}&{$gets}&{$getsort}\">{$lang['strdelete']}</a></td>\n"; + + foreach ($plugin_functions_parameters['actionbuttons'] as $action) { + echo "<td class=\"opbutton{$id}\">"; + $misc->printLink($action); + // "<a href=\"display.php?action=confeditrow&strings=", + // urlencode($_REQUEST['strings']), "&page=", + // urlencode($_REQUEST['page']), "&{$key_str}&{$gets}&{$getsort}\">{$lang['stredit']}</a>" + echo "</td>\n"; + } + } } diff --git a/domains.php b/domains.php index 1df7fa50..633535a0 100644 --- a/domains.php +++ b/domains.php @@ -200,30 +200,44 @@ echo "</table>\n"; // Display domain constraints + echo "<h3>{$lang['strconstraints']}</h3>\n"; if ($data->hasDomainConstraints()) { $domaincons = $data->getDomainConstraints($_REQUEST['domain']); - if ($domaincons->recordCount() > 0) { - echo "<h3>{$lang['strconstraints']}</h3>\n"; - echo "<table>\n"; - echo "<tr><th class=\"data\">{$lang['strname']}</th><th class=\"data\">{$lang['strdefinition']}</th><th class=\"data\">{$lang['stractions']}</th>\n"; - $i = 0; - - while (!$domaincons->EOF) { - $id = (($i % 2 ) == 0 ? '1' : '2'); - echo "<tr class=\"data{$id}\"><td>", $misc->printVal($domaincons->fields['conname']), "</td>"; - echo "<td>"; - echo $misc->printVal($domaincons->fields['consrc']); - echo "</td>"; - echo "<td class=\"opbutton{$id}\">"; - echo "<a href=\"domains.php?action=confirm_drop_con&{$misc->href}&constraint=", urlencode($domaincons->fields['conname']), - "&domain=", urlencode($_REQUEST['domain']), "&type=", urlencode($domaincons->fields['contype']), "\">{$lang['strdrop']}</a></td></tr>\n"; - - $domaincons->moveNext(); - $i++; - } - - echo "</table>\n"; - } + + error_log(print_r($domaincons, 1)); + + $columns = array ( + 'name' => array ( + 'title' => $lang['strname'], + 'field' => field('conname') + ), + 'definition' => array ( + 'title' => $lang['strdefinition'], + 'field' => field('consrc'), + ), + 'actions' => array ( + 'title' => $lang['stractions'], + ) + ); + + $actions = array ( + 'drop' => array ( + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'domains.php', + 'urlvars' => array ( + 'action' => 'confirm_drop_con', + 'domain' => $_REQUEST['domain'], + 'constraint' => field('conname'), + 'type' => field('contype'), + ) + ) + ) + ) + ); + + $misc->printTable($domaincons, $columns, $actions, 'domains-properties', $lang['strnodata']); } } else echo "<p>{$lang['strnodata']}</p>\n"; @@ -446,20 +460,34 @@ $actions = array( 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "domains.php?action=alter&{$misc->href}&", - 'vars' => array('domain' => 'domname'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'domains.php', + 'urlvars' => array ( + 'action' => 'alter', + 'domain' => field('domname') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "domains.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('domain' => 'domname'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'domains.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'domain' => field('domname') + ) + ) + ) ), ); if (!$data->hasAlterDomains()) unset($actions['alter']); - $misc->printTable($domains, $columns, $actions, $lang['strnodomains']); + $misc->printTable($domains, $columns, $actions, 'domains-domains', $lang['strnodomains']); $navlinks = array ( array ( diff --git a/fulltext.php b/fulltext.php index 8d16da92..b6bb9e70 100644 --- a/fulltext.php +++ b/fulltext.php @@ -45,18 +45,32 @@ $actions = array( 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "fulltext.php?action=dropconfig&{$misc->href}&", - 'vars' => array('ftscfg' => 'name'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'fulltext.php', + 'urlvars' => array ( + 'action' => 'dropconfig', + 'ftscfg' => field('name') + ) + ) + ) ), 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "fulltext.php?action=alterconfig&{$misc->href}&", - 'vars' => array('ftscfg' => 'name'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'fulltext.php', + 'urlvars' => array ( + 'action' => 'alterconfig', + 'ftscfg' => field('name') + ) + ) + ) ), ); - $misc->printTable($cfgs, $columns, $actions, $lang['strftsnoconfigs']); + $misc->printTable($cfgs, $columns, $actions, 'fulltext-fulltext', $lang['strftsnoconfigs']); $navlinks = array( array ( @@ -356,7 +370,7 @@ $actions = array(); - $misc->printTable($parsers, $columns, $actions, $lang['strftsnoparsers']); + $misc->printTable($parsers, $columns, $actions, 'fulltext-viewparsers', $lang['strftsnoparsers']); //TODO: navlink to "create parser" } @@ -396,18 +410,32 @@ $actions = array( 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "fulltext.php?action=dropdict&{$misc->href}&", - 'vars' => array('ftsdict' => 'name'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'fulltext.php', + 'urlvars' => array ( + 'action' => 'dropdict', + 'ftsdict' => field('name') + ) + ) + ) ), 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "fulltext.php?action=alterdict&{$misc->href}&", - 'vars' => array('ftsdict' => 'name'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'fulltext.php', + 'urlvars' => array ( + 'action' => 'alterdict', + 'ftsdict' => field('name') + ) + ) + ) ), ); - $misc->printTable($dicts, $columns, $actions, $lang['strftsnodicts']); + $misc->printTable($dicts, $columns, $actions, 'fulltext-viewdicts', $lang['strftsnodicts']); $navlinks = array( array ( @@ -466,15 +494,31 @@ $actions = array( 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "fulltext.php?action=dropmapping&{$misc->href}&", - 'vars' => array('mapping' => 'name', 'ftscfg' => 'cfgname'), 'multiaction' => 'dropmapping', + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'fulltext.php', + 'urlvars' => array ( + 'action' => 'dropmapping', + 'mapping' => field('name'), + 'ftscfg' => field('cfgname') + ) + ) + ) ), 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "fulltext.php?action=altermapping&{$misc->href}&", - 'vars' => array('mapping' => 'name', 'ftscfg' => 'cfgname'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'fulltext.php', + 'urlvars' => array ( + 'action' => 'altermapping', + 'mapping' => field('name'), + 'ftscfg' => field('cfgname') + ) + ) + ) ), 'multiactions' => array( 'keycols' => array('mapping' => 'name'), @@ -485,7 +529,7 @@ ); - $misc->printTable($map, $columns, $actions, $lang['strftsemptymap']); + $misc->printTable($map, $columns, $actions, 'fulltext-viewconfig', $lang['strftsemptymap']); $navlinks = array( array ( diff --git a/functions.php b/functions.php index 84ef140a..cd36244b 100644 --- a/functions.php +++ b/functions.php @@ -847,24 +847,48 @@ 'url' => 'functions.php', ), 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "functions.php?action=edit&{$misc->href}&", - 'vars' => array('function' => 'proproto', 'function_oid' => 'prooid'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'functions.php', + 'urlvars' => array ( + 'action' => 'edit', + 'function' => field('proproto'), + 'function_oid' => field('prooid') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "functions.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('function' => 'proproto', 'function_oid' => 'prooid'), 'multiaction' => 'confirm_drop', + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'functions.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'function' => field('proproto'), + 'function_oid' => field('prooid') + ) + ) + ) ), 'privileges' => array( - 'title' => $lang['strprivileges'], - 'url' => "privileges.php?{$misc->href}&subject=function&", - 'vars' => array('function' => 'proproto', 'function_oid' => 'prooid'), + 'content' => $lang['strprivileges'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'privileges.php', + 'urlvars' => array ( + 'subject' => 'function', + 'function' => field('proproto'), + 'function_oid' => field('prooid') + ) + ) + ) ), ); - $misc->printTable($funcs, $columns, $actions, $lang['strnofunctions']); + $misc->printTable($funcs, $columns, $actions, 'functions-functions', $lang['strnofunctions']); $navlinks = array( array ( @@ -74,20 +74,34 @@ $users = $data->getUsers(); if ($groupdata->recordCount() > 0) { - echo "<table>\n"; - echo "<tr><th class=\"data\">{$lang['strmembers']}</th><th class=\"data\">{$lang['stractions']}</th></tr>\n"; - $i = 0; - while (!$groupdata->EOF) { - $id = (($i % 2) == 0 ? '1' : '2'); - echo "<tr class=\"data{$id}\"><td>", $misc->printVal($groupdata->fields['usename']), "</td>\n"; - echo "<td class=\"opbutton{$id}\"><a href=\"groups.php?action=confirm_drop_member&{$misc->href}&group=", - urlencode($_REQUEST['group']), "&user=", urlencode($groupdata->fields['usename']), "\">{$lang['strdrop']}</a></td>\n"; - echo "</tr>\n"; - $groupdata->moveNext(); - } - echo "</table>\n"; + $columns = array ( + 'members' => array ( + 'title' => $lang['strmembers'], + 'field' => field('usename') + ), + 'actions' => array ( + 'title' => $lang['stractions'], + ) + ); + + $actions = array ( + 'drop' => array ( + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'groups.php', + 'urlvars' => array ( + 'action' => 'confirm_drop_member', + 'group' => $_REQUEST['group'], + 'user' => field('usename') + ) + ) + ) + ) + ); + + $misc->printTable($groupdata, $columns, $actions, 'groups-properties', $lang['strnousers']); } - else echo "<p>{$lang['strnousers']}</p>\n"; // Display form for adding a user to the group echo "<form action=\"groups.php\" method=\"post\">\n"; @@ -239,13 +253,20 @@ $actions = array( 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "groups.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('group' => 'groname'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'groups.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'group' => field('groname') + ) + ) + ) ), ); - $misc->printTable($groups, $columns, $actions, $lang['strnogroups']); + $misc->printTable($groups, $columns, $actions, 'groups-properties', $lang['strnogroups']); $misc->printNavLinks(array (array ( 'attr'=> array ( diff --git a/history.php b/history.php index c0db8188..c16caa1b 100644 --- a/history.php +++ b/history.php @@ -52,19 +52,35 @@ $actions = array( 'run' => array( - 'title' => $lang['strexecute'], - 'url' => "sql.php?{$misc->href}&nohistory=t&subject=history&", - 'vars' => array('queryid' => 'queryid', 'paginate' => 'paginate'), - 'target' => 'detail', + 'content' => $lang['strexecute'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'sql.php', + 'urlvars' => array ( + 'subject' => 'history', + 'nohistory' => 't', + 'queryid' => field('queryid'), + 'paginate' => field('paginate') + ) + ), + 'target' => 'detail' + ) ), 'remove' => array( - 'title' => $lang['strdelete'], - 'url' => "history.php?{$misc->href}&action=confdelhistory&", - 'vars' => array('queryid' => 'queryid'), - ), + 'content' => $lang['strdelete'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'history.php', + 'urlvars' => array ( + 'action' => 'confdelhistory', + 'queryid' => field('queryid'), + ) + ) + ) + ) ); - $misc->printTable($history, $columns, $actions, $lang['strnohistory']); + $misc->printTable($history, $columns, $actions, 'history-history', $lang['strnohistory']); } else echo "<p>{$lang['strnohistory']}</p>\n"; diff --git a/indexes.php b/indexes.php index fa5f296c..113a26d4 100644 --- a/indexes.php +++ b/indexes.php @@ -290,26 +290,50 @@ 'field' => field('idxcomment'), ), ); - + $actions = array( 'cluster' => array( - 'title' => $lang['strclusterindex'], - 'url' => "indexes.php?action=confirm_cluster_index&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", - 'vars' => array('index' => 'indname'), + 'content' => $lang['strclusterindex'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'indexes.php', + 'urlvars' => array ( + 'action' => 'confirm_cluster_index', + 'table' => $_REQUEST['table'], + 'index' => field('indname') + ) + ) + ) ), 'reindex' => array( - 'title' => $lang['strreindex'], - 'url' => "indexes.php?action=reindex&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", - 'vars' => array('index' => 'indname'), + 'content' => $lang['strreindex'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'indexes.php', + 'urlvars' => array ( + 'action' => 'reindex', + 'table' => $_REQUEST['table'], + 'index' => field('indname') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "indexes.php?action=confirm_drop_index&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", - 'vars' => array('index' => 'indname'), - ), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'indexes.php', + 'urlvars' => array ( + 'action' => 'confirm_drop_index', + 'table' => $_REQUEST['table'], + 'index' => field('indname') + ) + ) + ) + ) ); - $misc->printTable($indexes, $columns, $actions, $lang['strnoindexes'], 'indPre'); + $misc->printTable($indexes, $columns, $actions, 'indexes-indexes', $lang['strnoindexes'], 'indPre'); $misc->printNavLinks(array ( array ( @@ -45,85 +45,118 @@ // Referring foreign tables if ($referrers !== -99 && $referrers->recordCount() > 0) { echo "<h3>{$lang['strreferringtables']}</h3>\n"; - echo "<table>\n"; - echo "\t<tr>\n\t\t"; - 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 class=\"data{$id}\">\n\t\t"; - echo "<td>", $misc->printVal($referrers->fields['nspname']), "</td>"; - echo "<td>", $misc->printVal($referrers->fields['relname']), "</td>"; - echo "<td>", $misc->printVal($referrers->fields['conname']), "</td>"; - echo "<td>", $misc->printVal($referrers->fields['consrc']), "</td>"; - echo "<td class=\"opbutton{$id}\"><a href=\"constraints.php?{$misc->href}", - "&schema=", urlencode($referrers->fields['nspname']), - "&table=", urlencode($referrers->fields['relname']), "\">{$lang['strproperties']}</a></td>\n"; - echo "\t</tr>\n"; - $referrers->movenext(); - $i++; - } - - echo "</table>\n"; + + $columns = array ( + 'schema' => array ( + 'title' => $lang['strschema'], + 'field' => field('nspname') + ), + 'table' => array ( + 'title' => $lang['strtable'], + 'field' => field('relname'), + ), + 'name' => array ( + 'title' => $lang['strname'], + 'field' => field('conname'), + ), + 'definition' => array ( + 'title' => $lang['strdefinition'], + 'field' => field('consrc'), + ), + 'actions' => array ( + 'title' => $lang['stractions'], + ) + ); + + $actions = array ( + 'properties' => array ( + 'content' => $lang['strproperties'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'constraints.php', + 'urlvars' => array ( + 'schema' => field('nspname'), + 'table' => field('relname') + ) + ) + ) + ) + ); + + $misc->printTable($referrers, $columns, $actions, 'info-referrers', $lang['strnodata']); } // Parent tables if ($parents->recordCount() > 0) { echo "<h3>{$lang['strparenttables']}</h3>\n"; - echo "<table>\n"; - echo "\t<tr>\n\t\t"; - 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 class=\"data{$id}\">\n"; - echo "\t\t<td>", $misc->printVal($parents->fields['nspname']), "</td>"; - echo "<td>", $misc->printVal($parents->fields['relname']), "</td>"; - echo "<td class=\"opbutton{$id}\"><a href=\"tblproperties.php?{$misc->href}", - "&schema=", urlencode($parents->fields['nspname']), - "&table=", urlencode($parents->fields['relname']), "\">{$lang['strproperties']}</a></td>\n"; - echo "\t</tr>\n"; - $parents->movenext(); - $i++; - } - - echo "</table>\n"; + + $columns = array ( + 'schema' => array ( + 'title' => $lang['strschema'], + 'field' => field('nspname') + ), + 'table' => array ( + 'title' => $lang['strtable'], + 'field' => field('relname'), + ), + 'actions' => array ( + 'title' => $lang['stractions'], + ) + ); + + $actions = array ( + 'properties' => array ( + 'content' => $lang['strproperties'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tblproperties.php', + 'urlvars' => array ( + 'schema' => field('nspname'), + 'table' => field('relname') + ) + ) + ) + ) + ); + + $misc->printTable($parents, $columns, $actions, 'info-parents', $lang['strnodata']); } // Child tables if ($children->recordCount() > 0) { echo "<h3>{$lang['strchildtables']}</h3>\n"; - echo "<table>\n"; - echo "\t<tr>\n"; - 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; + + $columns = array ( + 'schema' => array ( + 'title' => $lang['strschema'], + 'field' => field('nspname') + ), + 'table' => array ( + 'title' => $lang['strtable'], + 'field' => field('relname'), + ), + 'actions' => array ( + 'title' => $lang['stractions'], + ) + ); - while (!$children->EOF) { - $id = ( ($i % 2 ) == 0 ? '1' : '2' ); - echo "\t<tr class=\"data{$id}\">\n"; - echo "\t\t<td>", $misc->printVal($children->fields['nspname']), "</td>"; - echo "<td>", $misc->printVal($children->fields['relname']), "</td>"; - echo "<td class=\"opbutton{$id}\"><a href=\"tblproperties.php?{$misc->href}", - "&schema=", urlencode($children->fields['nspname']), - "&table=", urlencode($children->fields['relname']), "\">{$lang['strproperties']}</a></td>\n"; - echo "\t</tr>\n"; - $children->movenext(); - $i++; - } - - echo "</table>\n"; + $actions = array ( + 'properties' => array ( + 'content' => $lang['strproperties'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tblproperties.php', + 'urlvars' => array ( + 'schema' => field('nspname'), + 'table' => field('relname') + ) + ) + ) + ) + ); + + $misc->printTable($children, $columns, $actions, 'info-children', $lang['strnodata']); + } // Row performance diff --git a/languages.php b/languages.php index 6ce806fd..c201aba7 100644 --- a/languages.php +++ b/languages.php @@ -43,7 +43,7 @@ $actions = array(); - $misc->printTable($languages, $columns, $actions, $lang['strnolanguages']); + $misc->printTable($languages, $columns, $actions, 'languages-languages', $lang['strnolanguages']); } /** diff --git a/opclasses.php b/opclasses.php index 24c0bbdd..9446dbad 100644 --- a/opclasses.php +++ b/opclasses.php @@ -51,7 +51,7 @@ $actions = array(); - $misc->printTable($opclasses, $columns, $actions, $lang['strnoopclasses']); + $misc->printTable($opclasses, $columns, $actions, 'opclasses-opclasses', $lang['strnoopclasses']); } /** diff --git a/operators.php b/operators.php index 02a886f3..4aa0b10b 100644 --- a/operators.php +++ b/operators.php @@ -130,6 +130,8 @@ $operators = $data->getOperators(); + error_log(print_r($operators, 1)); + $columns = array( 'operator' => array( 'title' => $lang['stroperator'], @@ -160,13 +162,24 @@ $actions = array( 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "operators.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('operator' => 'oprname', 'operator_oid' => 'oid'), - ), + // 'title' => $lang['strdrop'], + // 'url' => "operators.php?action=confirm_drop&{$misc->href}&", + // 'vars' => array('operator' => 'oprname', 'operator_oid' => 'oid'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'operators.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'operator' => field('oprname'), + 'operator_oid' => field('oid') + ) + ) + ) + ) ); - $misc->printTable($operators, $columns, $actions, $lang['strnooperators']); + $misc->printTable($operators, $columns, $actions, 'operators-operators', $lang['strnooperators']); // TODO operators.php action=create $lang['strcreateoperator'] } diff --git a/reports.php b/reports.php index 005ce03e..89fac6bd 100644 --- a/reports.php +++ b/reports.php @@ -279,7 +279,6 @@ else doDefault($lang['strreportdroppedbad']); } - } /** @@ -326,23 +325,48 @@ $actions = array( 'run' => array( - 'title' => $lang['strexecute'], - 'url' => "sql.php?subject=report&{$misc->href}&return=report&", - 'vars' => array('report' => 'report_name', 'database' => 'db_name', 'reportid' => 'report_id', 'paginate' => 'paginate'), + 'content' => $lang['strexecute'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'sql.php', + 'urlvars' => array ( + 'subject' => 'report', + 'return' => 'report', + 'report' => field('report_name'), + 'database' => field('db_name'), + 'reportid' => field('report_id'), + 'paginate' => field('paginate') + ) + ) + ) ), 'edit' => array( - 'title' => $lang['stredit'], - 'url' => "reports.php?action=edit&{$misc->href}&", - 'vars' => array('report_id' => 'report_id'), + 'content' => $lang['stredit'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'reports.php', + 'urlvars' => array ( + 'action' => 'edit', + 'report_id' => field('report_id') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "reports.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('report_id' => 'report_id'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'reports.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'report_id' => field('report_id') + ) + ) + ) ), ); - $misc->printTable($reports, $columns, $actions, $lang['strnoreports']); + $misc->printTable($reports, $columns, $actions, 'reports-reports', $lang['strnoreports']); $urlvars = array ('server' => $_REQUEST['server']); if (isset($_REQUEST['database'])) $urlvars['database'] = $_REQUEST['database']; @@ -652,18 +652,32 @@ $actions = array( 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "roles.php?action=alter&{$misc->href}&", - 'vars' => array('rolename' => 'rolname'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'roles.php', + 'urlvars' => array ( + 'action' => 'alter', + 'rolename' => field('rolname') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "roles.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('rolename' => 'rolname'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'roles.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'rolename' => field('rolname') + ) + ) + ) ), ); - $misc->printTable($roles, $columns, $actions, $lang['strnoroles']); + $misc->printTable($roles, $columns, $actions, 'roles-roles', $lang['strnoroles']); $navlinks = array ( array ( @@ -149,13 +149,23 @@ $actions = array( 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "rules.php?action=confirm_drop&{$misc->href}&reltype={$subject}&{$subject}={$object}&subject=rule&", - 'vars' => array('rule' => 'rulename'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'rules.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'reltype' => $subject, + $subject => $object, + 'subject' => 'rule', + 'rule' => field('rulename') + ) + ) + ) ), ); - $misc->printTable($rules, $columns, $actions, $lang['strnorules']); + $misc->printTable($rules, $columns, $actions, 'rules-rules', $lang['strnorules']); $misc->printNavLinks(array (array ( 'attr'=> array ( diff --git a/schemas.php b/schemas.php index 0935f016..73b74b77 100755 --- a/schemas.php +++ b/schemas.php @@ -52,26 +52,47 @@ 'url' => 'schemas.php', ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "schemas.php?action=drop&{$misc->href}&", - 'vars' => array('nsp' => 'nspname'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'schemas.php', + 'urlvars' => array ( + 'action' => 'drop', + 'nsp' => field('nspname') + ) + ) + ), 'multiaction' => 'drop', ), 'privileges' => array( - 'title' => $lang['strprivileges'], - 'url' => "privileges.php?subject=schema&{$misc->href}&", - 'vars' => array('schema' => 'nspname'), + 'content' => $lang['strprivileges'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'privileges.php', + 'urlvars' => array ( + 'subject' => 'schema', + 'schema' => field('nspname') + ) + ) + ) ), 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "schemas.php?action=alter&{$misc->href}&", - 'vars' => array('schema' => 'nspname'), - ), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'schemas.php', + 'urlvars' => array ( + 'action' => 'alter', + 'schema' => field('nspname') + ) + ) + ) + ) ); if (!$data->hasAlterSchema()) unset($actions['alter']); - $misc->printTable($schemas, $columns, $actions, $lang['strnoschemas']); + $misc->printTable($schemas, $columns, $actions, 'schemas-schemas', $lang['strnoschemas']); $misc->printNavLinks(array (array ( 'attr'=> array ( diff --git a/sequences.php b/sequences.php index 433ed61c..5d72e575 100644 --- a/sequences.php +++ b/sequences.php @@ -52,24 +52,46 @@ 'url' => 'sequences.php', ), 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "sequences.php?action=confirm_alter&{$misc->href}&subject=sequence&", - 'vars' => array('sequence' => 'seqname'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'sequences.php', + 'urlvars' => array ( + 'action' => 'confirm_alter', + 'subject' => 'sequence', + 'sequence' => field('seqname') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "sequences.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('sequence' => 'seqname'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'sequences.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'sequence' => field('seqname') + ) + ) + ), 'multiaction' => 'confirm_drop', ), 'privileges' => array( - 'title' => $lang['strprivileges'], - 'url' => "privileges.php?{$misc->href}&subject=sequence&", - 'vars' => array('sequence' => 'seqname'), + 'content' => $lang['strprivileges'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'privileges.php', + 'urlvars' => array ( + 'subject' => 'sequence', + 'sequence' => field('seqname') + ) + ) + ) ), ); - $misc->printTable($sequences, $columns, $actions, $lang['strnosequences']); + $misc->printTable($sequences, $columns, $actions, 'sequences-sequences', $lang['strnosequences']); $misc->printNavLinks(array (array ( 'attr'=> array ( diff --git a/servers.php b/servers.php index 50583544..ae8647a8 100644 --- a/servers.php +++ b/servers.php @@ -85,9 +85,16 @@ $actions = array( 'logout' => array( - 'title' => $lang['strlogout'], - 'url' => "servers.php?action=logout&", - 'vars' => array('logoutServer' => 'id'), + 'content' => $lang['strlogout'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'servers.php', + 'urlvars' => array ( + 'action' => 'logout', + 'logoutServer' => field('id') + ) + ) + ) ), ); @@ -95,8 +102,8 @@ $misc->printTitle(sprintf($lang['strgroupservers'],htmlentities($conf['srv_groups'][$group]['desc'], ENT_QUOTES, 'UTF-8'))); $actions['logout']['url'] .= "group=" . htmlentities($group, ENT_COMPAT, 'UTF-8') . "&"; } - - $misc->printTable($servers, $columns, $actions, $lang['strnoobjects'], 'svPre'); + + $misc->printTable($servers, $columns, $actions, 'servers-servers', $lang['strnoobjects'], 'svPre'); } function doTree() { @@ -770,61 +770,125 @@ 'default' => 'analyze', ), 'browse' => array( - 'title' => $lang['strbrowse'], - 'url' => "display.php?{$misc->href}&subject=table&return=schema&", - 'vars' => array('table' => 'relname'), + 'content' => $lang['strbrowse'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'display.php', + 'urlvars' => array ( + 'subject' => 'table', + 'return' => 'schema', + 'table' => field('relname') + ) + ) + ) ), 'select' => array( - 'title' => $lang['strselect'], - 'url' => "tables.php?action=confselectrows&{$misc->href}&", - 'vars' => array('table' => 'relname'), + 'content' => $lang['strselect'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tables.php', + 'urlvars' => array ( + 'action' => 'confselectrows', + 'table' => field('relname') + ) + ) + ) ), 'insert' => array( - 'title' => $lang['strinsert'], - 'url' => "tables.php?action=confinsertrow&{$misc->href}&", - 'vars' => array('table' => 'relname'), + 'content' => $lang['strinsert'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tables.php', + 'urlvars' => array ( + 'action' => 'confinsertrow', + 'table' => field('relname') + ) + ) + ) ), 'empty' => array( - 'title' => $lang['strempty'], - 'url' => "tables.php?action=confirm_empty&{$misc->href}&", - 'vars' => array('table' => 'relname'), 'multiaction' => 'confirm_empty', + 'content' => $lang['strempty'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tables.php', + 'urlvars' => array ( + 'action' => 'confirm_empty', + 'table' => field('relname') + ) + ) + ) ), 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "tblproperties.php?action=confirm_alter&{$misc->href}&", - 'vars' => array('table' => 'relname'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tblproperties.php', + 'urlvars' => array ( + 'action' => 'confirm_alter', + 'table' => field('relname') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "tables.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('table' => 'relname'), 'multiaction' => 'confirm_drop', + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tables.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'table' => field('relname') + ) + ) + ) ), 'vacuum' => array( - 'title' => $lang['strvacuum'], - 'url' => "tables.php?action=confirm_vacuum&{$misc->href}&", - 'vars' => array('table' => 'relname'), 'multiaction' => 'confirm_vacuum', + 'content' => $lang['strvacuum'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tables.php', + 'urlvars' => array ( + 'action' => 'confirm_vacuum', + 'table' => field('relname') + ) + ) + ) ), 'analyze' => array( - 'title' => $lang['stranalyze'], - 'url' => "tables.php?action=confirm_analyze&{$misc->href}&", - 'vars' => array('table' => 'relname'), 'multiaction' => 'confirm_analyze', + 'content' => $lang['stranalyze'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tables.php', + 'urlvars' => array ( + 'action' => 'confirm_analyze', + 'table' => field('relname') + ) + ) + ) ), 'reindex' => array( - 'title' => $lang['strreindex'], - 'url' => "tables.php?action=confirm_reindex&{$misc->href}&", - 'vars' => array('table' => 'relname'), 'multiaction' => 'confirm_reindex', - ), + 'content' => $lang['strreindex'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tables.php', + 'urlvars' => array ( + 'action' => 'confirm_reindex', + 'table' => field('relname') + ) + ) + ) + ) //'cluster' TODO ? ); if (!$data->hasTablespaces()) unset($columns['tablespace']); - $misc->printTable($tables, $columns, $actions, $lang['strnotables']); + $misc->printTable($tables, $columns, $actions, 'tables-tables', $lang['strnotables']); $navlinks = array ( array ( diff --git a/tablespaces.php b/tablespaces.php index c9cfb7ff..90b33c46 100755 --- a/tablespaces.php +++ b/tablespaces.php @@ -238,23 +238,44 @@ $actions = array( 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "tablespaces.php?action=edit&{$misc->href}&", - 'vars' => array('tablespace' => 'spcname') + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tablespaces.php', + 'urlvars' => array ( + 'action' => 'edit', + 'tablespace' => field('spcname') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "tablespaces.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('tablespace' => 'spcname') + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tablespaces.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'tablespace' => field('spcname') + ) + ) + ) ), 'privileges' => array( - 'title' => $lang['strprivileges'], - 'url' => "privileges.php?subject=tablespace&{$misc->href}&", - 'vars' => array('tablespace' => 'spcname') + 'content' => $lang['strprivileges'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'privileges.php', + 'urlvars' => array ( + 'subject' => 'tablespace', + 'tablespace' => field('spcname') + ) + ) + ) ) ); - $misc->printTable($tablespaces, $columns, $actions, $lang['strnotablespaces']); + $misc->printTable($tablespaces, $columns, $actions, 'tablespaces-tablespaces', $lang['strnotablespaces']); $misc->printNavLinks(array (array ( 'attr'=> array ( diff --git a/tblproperties.php b/tblproperties.php index 5eeccf37..dcb67f0d 100644 --- a/tblproperties.php +++ b/tblproperties.php @@ -447,8 +447,9 @@ $data->fieldClean($attname); $data->fieldClean($table); - $actions['browse']['url'] .= 'query=' . urlencode("SELECT \"{$attname}\", count(*) AS \"count\" - FROM \"{$table}\" GROUP BY \"{$attname}\" ORDER BY \"{$attname}\"") . '&'; + $actions['browse']['attr']['href']['urlvars']['query'] = "SELECT \"{$attname}\", count(*) AS \"count\" + FROM \"{$table}\" GROUP BY \"{$attname}\" ORDER BY \"{$attname}\""; + return $actions; } @@ -563,7 +564,65 @@ ), ); - $misc->printTable($attrs, $columns, $actions, null, 'attPre'); + $actions = array( + 'browse' => array( + 'content' => $lang['strbrowse'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'display.php', + 'urlvars' => array ( + 'table' => $_REQUEST['table'], + 'subject' => 'column', + 'return' => 'table', + 'column' => field('attname') + ) + ) + ) + ), + 'alter' => array( + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'colproperties.php', + 'urlvars' => array ( + 'subject' => 'column', + 'action' => 'properties', + 'table' => $_REQUEST['table'], + 'column' => field('attname') + ) + ) + ) + ), + 'privileges' => array( + 'content' => $lang['strprivileges'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'privileges.php', + 'urlvars' => array ( + 'subject' => 'column', + 'table' => $_REQUEST['table'], + 'column' => field('attname') + ) + ) + ) + ), + 'drop' => array( + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'tblproperties.php', + 'urlvars' => array ( + 'subject' => 'column', + 'action' => 'confirm_drop', + 'table' => $_REQUEST['table'], + 'column' => field('attname') + ) + ) + ) + ), + ); + + $misc->printTable($attrs, $columns, $actions, 'tblproperties-tblproperties', null, 'attPre'); $navlinks = array ( array ( diff --git a/triggers.php b/triggers.php index 90d05348..cd8fb31b 100644 --- a/triggers.php +++ b/triggers.php @@ -306,30 +306,62 @@ $actions = array( 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "triggers.php?action=confirm_alter&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", - 'vars' => array('trigger' => 'tgname'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'triggers.php', + 'urlvars' => array ( + 'action' => 'confirm_alter', + 'table' => $_REQUEST['table'], + 'trigger' => field('tgname') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "triggers.php?action=confirm_drop&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", - 'vars' => array('trigger' => 'tgname'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'triggers.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'table' => $_REQUEST['table'], + 'trigger' => field('tgname') + ) + ) + ) ), ); if($data->hasDisableTriggers()) { - $actions['enable'] = array( - 'title' => $lang['strenable'], - 'url' => "triggers.php?action=confirm_enable&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", - 'vars' => array('trigger' => 'tgname'), - ); - $actions['disable'] = array( - 'title' => $lang['strdisable'], - 'url' => "triggers.php?action=confirm_disable&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", - 'vars' => array('trigger' => 'tgname'), - ); + $actions['enable'] = array( + 'content' => $lang['strenable'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'triggers.php', + 'urlvars' => array ( + 'action' => 'confirm_enable', + 'table' => $_REQUEST['table'], + 'trigger' => field('tgname') + ) + ) + ) + ); + $actions['disable'] = array( + 'content' => $lang['strdisable'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'triggers.php', + 'urlvars' => array ( + 'action' => 'confirm_disable', + 'table' => $_REQUEST['table'], + 'trigger' => field('tgname') + ) + ) + ) + ); } - $misc->printTable($triggers, $columns, $actions, $lang['strnotriggers'], 'tgPre'); + $misc->printTable($triggers, $columns, $actions, 'triggers-triggers', $lang['strnotriggers'], 'tgPre'); $misc->printNavLinks(array (array ( 'attr'=> array ( @@ -54,7 +54,7 @@ $actions = array(); - $misc->printTable($attrs, $columns, $actions, null, 'attPre'); + $misc->printTable($attrs, $columns, $actions, 'types-properties', null, 'attPre'); break; case 'e': @@ -579,13 +579,20 @@ $actions = array( 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "types.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('type' => 'basename'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'types.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'type' => field('basename') + ) + ) + ) ), ); - $misc->printTable($types, $columns, $actions, $lang['strnotypes']); + $misc->printTable($types, $columns, $actions, 'types-types', $lang['strnotypes']); $navlinks = array ( array ( @@ -328,18 +328,32 @@ $actions = array( 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "users.php?action=edit&{$misc->href}&", - 'vars' => array('username' => 'usename'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'users.php', + 'urlvars' => array ( + 'action' => 'edit', + 'username' => field('usename') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "users.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('username' => 'usename'), + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'users.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'username' => field('usename') + ) + ) + ) ), ); - $misc->printTable($users, $columns, $actions, $lang['strnousers']); + $misc->printTable($users, $columns, $actions, 'users-users', $lang['strnousers']); $misc->printNavLinks(array (array ( 'attr'=> array ( diff --git a/viewproperties.php b/viewproperties.php index 8fa8317d..531d7613 100755 --- a/viewproperties.php +++ b/viewproperties.php @@ -434,13 +434,21 @@ $actions = array( 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "viewproperties.php?action=properties&{$misc->href}&view=".urlencode($_REQUEST['view'])."&", - 'vars' => array('column' => 'attname'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'viewproperties.php', + 'urlvars' => array ( + 'action' => 'properties', + 'view' => $_REQUEST['view'], + 'column' => field('attname') + ) + ) + ) ), ); - $misc->printTable($attrs, $columns, $actions, null, 'attPre'); + $misc->printTable($attrs, $columns, $actions, 'viewproperties-viewproperties', null, 'attPre'); echo "<br />\n"; @@ -585,16 +585,32 @@ 'url' => 'views.php', ), 'browse' => array( - 'title' => $lang['strbrowse'], - 'url' => "display.php?{$misc->href}&subject=view&return=schema&", - 'vars' => array('view' => 'relname'), + 'content' => $lang['strbrowse'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'display.php', + 'urlvars' => array ( + 'action' => 'confselectrows', + 'subject' => 'view', + 'return' => 'schema', + 'view' => field('relname') + ) + ) + ) ), 'select' => array( - 'title' => $lang['strselect'], - 'url' => "views.php?action=confselectrows&{$misc->href}&", - 'vars' => array('view' => 'relname'), + 'content' => $lang['strselect'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'views.php', + 'urlvars' => array ( + 'action' => 'confselectrows', + 'view' => field('relname') + ) + ) + ) ), - + // Insert is possible if the relevant rule for the view has been created. // 'insert' => array( // 'title' => $lang['strinsert'], @@ -603,19 +619,33 @@ // ), 'alter' => array( - 'title' => $lang['stralter'], - 'url' => "viewproperties.php?action=confirm_alter&{$misc->href}&", - 'vars' => array('view' => 'relname'), + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'viewproperties.php', + 'urlvars' => array ( + 'action' => 'confirm_alter', + 'view' => field('relname') + ) + ) + ) ), 'drop' => array( - 'title' => $lang['strdrop'], - 'url' => "views.php?action=confirm_drop&{$misc->href}&", - 'vars' => array('view' => 'relname'), 'multiaction' => 'confirm_drop', + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'views.php', + 'urlvars' => array ( + 'action' => 'confirm_drop', + 'view' => field('relname') + ) + ) + ) ), ); - $misc->printTable($views, $columns, $actions, $lang['strnoviews']); + $misc->printTable($views, $columns, $actions, 'views-views', $lang['strnoviews']); $navlinks = array ( array ( |