added a check/uncheck all feature

This commit is contained in:
Loïc Chapeaux
2002-04-28 13:08:12 +00:00
parent ced0a3e40b
commit 41b1940d74
3 changed files with 112 additions and 92 deletions

View File

@@ -10,7 +10,7 @@ $Source$
start the split
* tbl_properties.php3, new tbl_properties_export.php3,
tbl_properties_links.php3, lang/*.php3: export is splitted
* new tbl_properties_table_info.php3, to be able to display links
* new tbl_properties_table_info, to be able to display links
on the export page
* new tbl_properties_operations.php3
@@ -28,6 +28,7 @@ $Source$
* tbl_qbe.php3, line 732: fixed again a warning.
* tbl_addfield.php3; tbl_alter.php3: fixed bug #548495 - Alter table not
replicate.
* db_stats.php3; libraries/functions.js: added a check/uncheck all feature.
2002-04-27 Marc Delisle <lem9@users.sourceforge.net>
* tbl_properties.php3, new tbl_properties_links.php3:

View File

@@ -4,6 +4,7 @@
/**
* Gets the variables sent to this script and send headers
*/
$js_to_run = 'functions.js';
require('./libraries/grab_globals.lib.php3');
require('./header.inc.php3');
@@ -168,7 +169,7 @@ if ($num_dbs > 0) {
$col = 3;
}
?>
<form action="db_stats.php3">
<form action="db_stats.php3" name="dbStatsForm">
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="server" value="<?php echo $server; ?>" />
@@ -249,6 +250,16 @@ if ($num_dbs > 0) {
uksort($dbs_array, 'PMA_dbCmp');
reset($dbs_array);
// Check/unchek all databases url
$checkall_url = 'db_stats.php3'
. '?lang=' . $lang
. '&amp;server=' . $server
. (empty($sort_by) ? '' : '&amp;sort_by=' . $sort_by)
. (empty($sort_order) ? '' : '&amp;sort_order=' . $sort_order);
$do_check = (empty($checkall))
? ''
: ' checked="checked"';
// Displays the tables stats per database
$i = 0;
while (list($db_name, $db_prop) = each($dbs_array)) {
@@ -260,7 +271,7 @@ if ($num_dbs > 0) {
echo ' <tr>' . "\n";
echo ' <td align="center" bgcolor="'. $bgcolor . '">' . "\n";
echo ' &nbsp;<input type="checkbox" name="selected_db[]" value="' . urlencode($db_name) . '" />&nbsp;' . "\n";
echo ' &nbsp;<input type="checkbox" name="selected_db[]" value="' . urlencode($db_name) . '"' . $do_check . ' />&nbsp;' . "\n";
echo ' </td>' . "\n";
echo ' <td bgcolor="'. $bgcolor . '">&nbsp;<a href="index.php3?lang=' . $lang . '&amp;server=' . $server . '&amp;db=' . urlencode($db_name) . '" target="_parent">' . htmlentities($db_name) . '</a>&nbsp;</td>' . "\n";
echo ' <td align="right" bgcolor="'. $bgcolor . '">&nbsp;' . $dbs_array[$db_name][0] . '&nbsp;</td>' . "\n";
@@ -290,6 +301,12 @@ if ($num_dbs > 0) {
echo ' <tr>' . "\n";
echo ' <td colspan="6">' . "\n";
echo ' <img src="./images/arrow_' . $text_dir . '.gif" border="0" width="38" height="22" alt="' . $strWithChecked . '" />' . "\n";
echo ' <a href="' . $checkall_url . '&amp;checkall=1" onclick="setCheckboxes(\'dbStatsForm\', true); return false;">' . "\n";
echo ' ' . $strCheckAll . '</a>' . "\n";
echo ' &nbsp;/&nbsp;' . "\n";
echo ' <a href="' . $checkall_url . '" onclick="setCheckboxes(\'dbStatsForm\', false); return false;">' . "\n";
echo ' ' . $strUncheckAll . '</a>' . "\n";
echo ' &nbsp;&nbsp;&nbsp;' . "\n";
echo ' <i>' . $strWithChecked . '</i>&nbsp;&nbsp;<input type="submit" name="submit_mult" value="' . $strDrop . '" />' . "\n";
echo ' </td>' . "\n";
echo ' </tr>' . "\n";

View File

@@ -420,7 +420,9 @@ function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerCol
*/
function setCheckboxes(the_form, do_check)
{
var elts = document.forms[the_form].elements['selected_tbl[]'];
var elts = (typeof(document.forms[the_form].elements['selected_db[]']) != 'undefined')
? document.forms[the_form].elements['selected_db[]']
: document.forms[the_form].elements['selected_tbl[]'];
var elts_cnt = (typeof(elts.length) != 'undefined')
? elts.length
: 0;