Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Descending order after second click on column caption

  • Loading branch information...
commit 1501d60f148127b2cf72988008d9254cf577265b 1 parent e5b1c99
Jakub Vrána authored

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. 7  adminer/select.inc.php
7  adminer/select.inc.php
@@ -273,11 +273,14 @@
273 273
 					if ($name != "") {
274 274
 						$rank++;
275 275
 						$names[$key] = $name;
  276
+						$column = idf_escape($key);
276 277
 						$href = remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key);
  278
+						$desc = "&desc%5B0%5D=1";
277 279
 						echo '<th onmouseover="columnMouse(this);" onmouseout="columnMouse(this, \' hidden\');">';
278  
-						echo '<a href="' . h($href) . '">' . (!$select || $val ? apply_sql_function($val["fun"], $name) : h(current($select))) . "</a>"; //! columns looking like functions
  280
+						echo '<a href="' . h($href . ($order[0] == $column || $order[0] == $key || (!$order && count($group) < count($select) && $group[0] == $column) ? $desc : '')) . '">'; // $order[0] == $key - COUNT(*)
  281
+						echo (!$select || $val ? apply_sql_function($val["fun"], $name) : h(current($select))) . "</a>"; //! columns looking like functions
279 282
 						echo "<span class='column hidden'>";
280  
-						echo "<a href='" . h("$href&desc%5B0%5D=1") . "' title='" . lang('descending') . "' class='text'> ↓</a>";
  283
+						echo "<a href='" . h($href . $desc) . "' title='" . lang('descending') . "' class='text'> ↓</a>";
281 284
 						if (!$val["fun"]) {
282 285
 							echo '<a href="#fieldset-search" onclick="selectSearch(\'' . h(js_escape($key)) . '\'); return false;" title="' . lang('Search') . '" class="text jsonly"> =</a>';
283 286
 						}

0 notes on commit 1501d60

Please sign in to comment.
Something went wrong with that request. Please try again.