Author: cfinck
Date: Fri Apr 17 20:48:09 2009
New Revision: 376
URL:
http://svn.reactos.org/svn/reactos?rev=376&view=rev
Log:
Sort the results to compare by ID instead of clicking order
Modified:
branches/danny-web/www/www.reactos.org/testman/js/index.js.php
Modified:
branches/danny-web/www/www.reactos.org/testman/js/index.js.php
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/t…
==============================================================================
---
branches/danny-web/www/www.reactos.org/testman/js/index.js.php [iso-8859-1]
(original)
+++
branches/danny-web/www/www.reactos.org/testman/js/index.js.php [iso-8859-1] Fri Apr 17
20:48:09 2009
@@ -14,7 +14,7 @@
var inputbox_endrev;
var PageCount;
var ResultCount;
-var SelectedResults = new Array();
+var SelectedResults = new Object();
var SelectedResultCount = 0;
var REQUESTTYPE_FULLLOAD = 1;
@@ -422,28 +422,38 @@
PageSwitch(info[0], info[1]);
}
+function NumericComparison(a, b)
+{
+ return a - b;
+}
+
function CompareButton_OnClick()
{
- var first = true;
var parameters = "ids=";
-
+ var IDArray = new Array();
+
+ // Sort the selected IDs
for(id in SelectedResults)
- {
- if(first)
- {
- parameters += id;
+ IDArray.push(parseInt(id));
+
+ if(!IDArray.length)
+ {
+ alert("<?php echo addslashes($testman_langres["noselection"]);
?>");
+ return;
+ }
+
+ IDArray.sort(NumericComparison);
+
+ for(i = 0; i < IDArray.length; i++)
+ {
+ if(!i)
+ {
+ parameters += IDArray[i];
first = false;
continue;
}
- parameters += "," + id;
- }
-
- // If first is still true, no results were selected at all
- if(first)
- {
- alert("<?php echo addslashes($testman_langres["noselection"]);
?>");
- return;
+ parameters += "," + IDArray[i];
}
window.open("compare.php?" + parameters);