- added js:markAllRows(), js:unMarkAllRows()

- check/uncheck all rows now sets mark color for this rows
This commit is contained in:
Sebastian Mendel
2005-11-09 16:59:11 +00:00
parent 9a1a9e7237
commit 9fde856f09
6 changed files with 102 additions and 48 deletions

View File

@@ -23,6 +23,10 @@ $Source$
- db with only table specific rights where not displayed if there was not
at least one db with db specfic rights
- javascript errors
* function.js, db_details_structure.php, tbl_properties_structure.php,
display_tbl.lib.php, server_databases.php:
- added js:markAllRows(), js:unMarkAllRows()
- check/uncheck all rows now sets mark color for this rows
2005-11-08 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* Documentation.html, browse_foreigners.php, error.php,

View File

@@ -134,7 +134,7 @@ if ( true == $cfg['PropertiesIconic'] ) {
* Displays the tables list
*/
?>
<form method="post" action="db_details_structure.php" name="tablesForm">
<form method="post" action="db_details_structure.php" name="tablesForm" id="tablesForm">
<?php
echo PMA_generate_common_hidden_inputs( $db );
@@ -399,11 +399,11 @@ $checkall_url = 'db_details_structure.php?' . PMA_generate_common_url($db);
<img class="selectallarrow" src="<?php echo $pmaThemeImage .'arrow_'.$text_dir.'.png'; ?>"
width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
<a href="<?php echo $checkall_url; ?>&amp;checkall=1"
onclick="setCheckboxes('tablesForm', true); return false;">
onclick="if ( markAllRows('tablesForm') ) return false;">
<?php echo $strCheckAll; ?></a>
/
<a href="<?php echo $checkall_url; ?>"
onclick="setCheckboxes('tablesForm', false); return false;">
onclick="if ( unMarkAllRows('tablesForm') ) return false;">
<?php echo $strUncheckAll; ?></a>
<?php if ($overhead_check != '') { ?>
/

View File

@@ -573,7 +573,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
// Start of form for multi-rows delete
if ($is_display['del_lnk'] == 'dr' || $is_display['del_lnk'] == 'kp' ) {
echo '<form method="post" action="tbl_row_action.php" name="rowsDeleteForm">' . "\n";
echo '<form method="post" action="tbl_row_action.php" name="rowsDeleteForm" id="rowsDeleteForm">' . "\n";
echo PMA_generate_common_hidden_inputs($db, $table, 1);
echo '<input type="hidden" name="disp_direction" value="' . $disp_direction . '" />' . "\n";
echo '<input type="hidden" name="repeat_cells" value="' . $repeat_cells . '" />' . "\n";
@@ -584,7 +584,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
}
echo '<!-- Results table -->' . "\n"
. '<table id="table_results" ';
. '<table id="table_results" class="data" ';
if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
echo 'border="1" cellpadding="2" cellspacing="0"';
} else {
@@ -1856,8 +1856,8 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
. '&amp;goto=' . $goto
. '&amp;dontlimitchars=' . $dontlimitchars;
$checkall_url = $uncheckall_url . '&amp;checkall=1';
$checkall_params['onclick'] = 'setCheckboxesRange(\'rowsDeleteForm\', true, \'id_rows_to_delete\', 0, ' . $num_rows . '); return false;';
$uncheckall_params['onclick'] = 'setCheckboxesRange(\'rowsDeleteForm\', false, \'id_rows_to_delete\', 0, ' . $num_rows . '); return false;';
$checkall_params['onclick'] = 'if ( markAllRows(\'rowsDeleteForm\') ) return false;';
$uncheckall_params['onclick'] = 'if ( unMarkAllRows(\'rowsDeleteForm\') ) return false;';
$checkall_link = PMA_linkOrButton( $checkall_url, $GLOBALS['strCheckAll'], $checkall_params, false );
$uncheckall_link = PMA_linkOrButton( $uncheckall_url, $GLOBALS['strUncheckAll'], $uncheckall_params, false );
?>

View File

@@ -491,7 +491,7 @@ function PMA_markRowsInit() {
var unique_id;
var checkbox;
var checkbox = this.getElementsByTagName( 'input' )[0];
checkbox = this.getElementsByTagName( 'input' )[0];
if ( checkbox && checkbox.type == 'checkbox' ) {
unique_id = checkbox.name + checkbox.value;
} else if ( this.id.length > 0 ) {
@@ -536,6 +536,62 @@ function PMA_markRowsInit() {
}
window.onload=PMA_markRowsInit;
/**
* marks all rows and selects its first checkbox inside the given element
* the given element is usaly a table or a div containing the table or tables
*
* @param container DOM element
*/
function markAllRows( container_id ) {
var rows = document.getElementById(container_id).getElementsByTagName('tr');
var unique_id;
var checkbox;
for ( var i = 0; i < rows.length; i++ ) {
checkbox = rows[i].getElementsByTagName( 'input' )[0];
if ( checkbox && checkbox.type == 'checkbox' ) {
unique_id = checkbox.name + checkbox.value;
if ( checkbox.disabled == false ) {
checkbox.checked = true;
if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
rows[i].className += ' marked';
marked_row[unique_id] = true;
}
}
}
}
return true;
}
/**
* marks all rows and selects its first checkbox inside the given element
* the given element is usaly a table or a div containing the table or tables
*
* @param container DOM element
*/
function unMarkAllRows( container_id ) {
var rows = document.getElementById(container_id).getElementsByTagName('tr');
var unique_id;
var checkbox;
for ( var i = 0; i < rows.length; i++ ) {
checkbox = rows[i].getElementsByTagName( 'input' )[0];
if ( checkbox && checkbox.type == 'checkbox' ) {
unique_id = checkbox.name + checkbox.value;
checkbox.checked = false;
rows[i].className = rows[i].className.replace(' marked', '');
marked_row[unique_id] = false;
}
}
return true;
}
/**
* Sets/unsets the pointer and marker in browse mode
*

View File

@@ -164,7 +164,7 @@ if ( count($databases) > 0 ) {
'footer' => 0,
);
echo '<form action="./server_databases.php" method="post" name="dbStatsForm">' . "\n"
echo '<form action="./server_databases.php" method="post" name="dbStatsForm" id="dbStatsForm">' . "\n"
. PMA_generate_common_hidden_inputs('', '', 1)
. '<input type="hidden" name="dbstats" value="' . $dbstats . '" />' . "\n"
. '<input type="hidden" name="sort_by" value="' . $sort_by . '" />' . "\n"
@@ -292,26 +292,20 @@ if ( count($databases) > 0 ) {
echo ' <th>&nbsp;</th>' . "\n";
}
echo '</tr>' . "\n";
unset( $column_order, $stat_name, $stat, $databases );
echo '</tbody>' . "\n"
.'</table>' . "\n";
unset( $column_order, $stat_name, $stat, $databases, $table_columns );
if ($is_superuser || $cfg['AllowUserDropDatabase']) {
$common_url_query = PMA_generate_common_url() . '&amp;sort_by=' . $sort_by . '&amp;sort_order=' . $sort_order . '&amp;dbstats=' . $dbstats;
echo '<tr><td colspan="' . $table_columns . '">' . "\n"
. ' <img class="icon" src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" width="38" height="22" alt="' . $strWithChecked . '" />' . "\n"
. ' <a href="./server_databases.php?' . $common_url_query . '&amp;checkall=1" onclick="setCheckboxes(\'dbStatsForm\', true); return false;">' . "\n"
. ' ' . $strCheckAll
. ' </a> / ' . "\n"
. ' <a href="./server_databases.php?' . $common_url_query . '" onclick="setCheckboxes(\'dbStatsForm\', false); return false;">' . "\n"
. ' ' . $strUncheckAll
. ' </a>' . "\n"
echo '<img class="selectallarrow" src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" width="38" height="22" alt="' . $strWithChecked . '" />' . "\n"
. '<a href="./server_databases.php?' . $common_url_query . '&amp;checkall=1" onclick="if ( markAllRows(\'tabledatabases\') ) return false;">' . "\n"
. ' ' . $strCheckAll . '</a> / ' . "\n"
. '<a href="./server_databases.php?' . $common_url_query . '" onclick="if ( unMarkAllRows(\'tabledatabases\') ) return false;">' . "\n"
. ' ' . $strUncheckAll . '</a>' . "\n"
. '<i>' . $strWithChecked . '</i>' . "\n";
PMA_buttonOrImage( 'drop_selected_dbs', 'mult_submit', 'drop_selected_dbs', $strDrop, 'b_deltbl.png' );
echo ' </td>' . "\n"
. '</tr>' . "\n";
}
echo '</tbody>' . "\n"
.'</table>' . "\n";
unset( $table_columns );
if ( $GLOBALS['cfg']['PropertiesIconic'] ) {
// iconic view

View File

@@ -155,7 +155,7 @@ if ( $cfg['PropertiesIconic'] == true ) {
// table header
$i = 0;
?>
<form method="post" action="tbl_properties_structure.php" name="fieldsForm">
<form method="post" action="tbl_properties_structure.php" name="fieldsForm" id="fieldsForm">
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<table id="tablestructure" class="data">
<thead>
@@ -443,11 +443,11 @@ $checkall_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db,$t
<img class="selectallarrow" src="<?php echo $pmaThemeImage . 'arrow_' . $text_dir . '.png'; ?>"
width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
<a href="<?php echo $checkall_url; ?>&amp;checkall=1"
onclick="setCheckboxes('fieldsForm', true); return false;">
onclick="if ( markAllRows('fieldsForm') ) return false;">
<?php echo $strCheckAll; ?></a>
/
<a href="<?php echo $checkall_url; ?>"
onclick="setCheckboxes('fieldsForm', false); return false;">
onclick="if ( unMarkAllRows('fieldsForm') ) return false;">
<?php echo $strUncheckAll; ?></a>
<i><?php echo $strWithChecked; ?></i>