Display number of selected rows

This commit is contained in:
Jakub Vrana 2013-07-08 15:27:53 -07:00
parent 10f500dfea
commit c2a3bec036
3 changed files with 14 additions and 3 deletions

View file

@ -437,7 +437,6 @@ if (!$columns) {
exit;
}
echo "</table>\n";
echo (!$group && $select ? "" : "<script type='text/javascript'>tableCheck();</script>\n");
}
if (($rows || $page) && !is_ajax()) {
@ -480,20 +479,21 @@ if (!$columns) {
echo "<p>\n";
echo ($found_rows !== false ? "(" . ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) . ") " : "");
echo checkbox("all", 1, 0, lang('whole result')) . "\n";
echo checkbox("all", 1, 0, lang('whole result'), "selectCount(this.checked ? '$found_rows' : formChecked(this, /check/));") . "\n";
if ($adminer->selectCommandPrint()) {
?>
<fieldset<?php echo ($_GET["modify"] ? '' : ' class="jsonly"'); ?>><legend><?php echo lang('Modify'); ?></legend><div>
<input type="submit" value="<?php echo lang('Save'); ?>"<?php echo ($_GET["modify"] ? '' : ' title="' . lang('Ctrl+click on a value to modify it.') . '"'); ?>>
</div></fieldset>
<fieldset><legend><?php echo lang('Selected'); ?></legend><div>
<fieldset><legend><?php echo lang('Selected'); ?> <span id="selected"></span></legend><div>
<input type="submit" name="edit" value="<?php echo lang('Edit'); ?>">
<input type="submit" name="clone" value="<?php echo lang('Clone'); ?>">
<input type="submit" name="delete" value="<?php echo lang('Delete'); ?>" onclick="return confirm('<?php echo lang('Are you sure?'); ?> (' + (this.form['all'].checked ? '<?php echo $found_rows; ?>' : formChecked(this, /check/)) + ')');">
</div></fieldset>
<?php
}
echo (!$group && $select ? "" : "<script type='text/javascript'>tableCheck();</script>\n");
$format = $adminer->dumpFormat();
foreach ((array) $_GET["columns"] as $column) {

View file

@ -57,6 +57,16 @@ function parentTag(el, tag) {
function trCheck(el) {
var tr = parentTag(el, 'tr');
tr.className = tr.className.replace(/(^|\s)checked(\s|$)/, '$2') + (el.checked ? ' checked' : '');
if (el.form['all']) {
el.form['all'].onclick();
}
}
/** Fill number of selected items
* @param string
*/
function selectCount(count) {
setHtml('selected', (count === '' ? '' : '(' + count + ')'));
}
/** Check all elements matching given name

View file

@ -4,6 +4,7 @@ Add a new column in alter table on key press
Mark length as required for strings
Add label to database selection
Add button for dropping an index
Display number of selected rows
PostgreSQL: Fix handling of nextval() default values
Adminer 3.7.1 (released 2013-06-29):