diff options
-rw-r--r-- | web/html/packages.php | 16 | ||||
-rw-r--r-- | web/template/pkg_search_results.php | 5 |
2 files changed, 20 insertions, 1 deletions
diff --git a/web/html/packages.php b/web/html/packages.php index bf3daf8..4b11f09 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -71,6 +71,22 @@ $(document).ready(function() { collapseDependsList("#pkgdepslist"); collapseDependsList("#pkgreqslist"); collapseDependsList("#pkgsrcslist"); + + function update_checked_count() { + var one_pkg = '<?= __("1 package selected") ?>'; + var pkgs = '<?= __("%d packages selected") ?>'; + + var count = $('.package-checkbox:checked').length; + if (count === 1) { + var res = one_pkg; + } else { + var res = pkgs; + } + $('#pkglist-checked-count').text(res.replace('%s', count.toString())); + } + update_checked_count(); // Set initial string + + $('.package-checkbox').change(update_checked_count); }); </script> diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index cce533c..4d99dd6 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -9,6 +9,7 @@ if (!$result): ?> <p> <?= _n('%d package found.', '%d packages found.', $total) ?> <?= __('Page %d of %d.', $current, $pages) ?> + <span id="pkglist-checked-count"></span> </p> <?php if (count($templ_pages) > 1): ?> <p class="pkglist-nav"> @@ -49,7 +50,7 @@ if (!$result): ?> <?php while (list($indx, $row) = each($searchresults)): ?> <tr class="<?= ($indx % 2 == 0) ? 'odd' : 'even' ?>"> <?php if ($SID): ?> - <td><input type="checkbox" name="IDs[<?= $row["PackageBaseID"] ?>]" value="1" /></td> + <td><input class="package-checkbox" type="checkbox" name="IDs[<?= $row["PackageBaseID"] ?>]" value="1" /></td> <?php endif; ?> <td><a href="<?= htmlspecialchars(get_pkg_uri($row["Name"]), ENT_QUOTES); ?>"><?= htmlspecialchars($row["Name"]) ?></a></td> <td<?php if ($row["OutOfDateTS"]): ?> class="flagged"<?php endif; ?>><?= htmlspecialchars($row["Version"]) ?></td> @@ -89,6 +90,8 @@ if (!$result): ?> <p> <?= _n('%d package found.', '%d packages found.', $total) ?> <?= __('Page %d of %d.', $current, $pages) ?> + + <span id="pkglist-checked-count"></span> </p> <?php if (count($templ_pages) > 1): ?> <p class="pkglist-nav"> |