]> git.joonet.de Git - adminer.git/commitdiff
Display number of selected rows
authorJakub Vrana <jakub@vrana.cz>
Mon, 8 Jul 2013 22:27:53 +0000 (15:27 -0700)
committerJakub Vrana <jakub@vrana.cz>
Mon, 8 Jul 2013 22:27:53 +0000 (15:27 -0700)
adminer/select.inc.php
adminer/static/functions.js
changes.txt

index f359cdbc5e326223ccfd369d48b4e238c1ecdf46..c8dc5ec718b314b15150aa5e3df3332beec780e2 100644 (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) {
index 13d5485a9d4b35c22e6334f8e49a760fb6730d97..82fb7af3f9e8cdaca8fa7dba0d89571c4c15737b 100644 (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
index ca1c3d56f4d906ec968ac37433d25696bd4fceaf..1f2433bd74a3dd0bcb20cdec7cbd7f34bf98ac31 100644 (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):