[ros-diffs] [cfinck] 434: - Actually make use of the "desc" parameter. - Remove "perpage" function again, add a "limit" instead and use that for the default search. This way, we don't need to wait till testman has found all >700 results.

cfinck at svn.reactos.org cfinck at svn.reactos.org
Sat Jun 13 04:05:11 CEST 2009


Author: cfinck
Date: Sat Jun 13 06:05:10 2009
New Revision: 434

URL: http://svn.reactos.org/svn/reactos?rev=434&view=rev
Log:
- Actually make use of the "desc" parameter.
- Remove "perpage" function again, add a "limit" instead and use that for the default search.
  This way, we don't need to wait till testman has found all >700 results.

Modified:
    branches/danny-web/www/www.reactos.org/testman/ajax-search.php
    branches/danny-web/www/www.reactos.org/testman/config.inc.php
    branches/danny-web/www/www.reactos.org/testman/js/index.js.php

Modified: branches/danny-web/www/www.reactos.org/testman/ajax-search.php
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/testman/ajax-search.php?rev=434&r1=433&r2=434&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/testman/ajax-search.php [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/testman/ajax-search.php [iso-8859-1] Sat Jun 13 06:05:10 2009
@@ -12,9 +12,7 @@
 	require_once("connect.db.php");
 	require_once("utils.inc.php");
 	
-	// We may supply any "perpage" value as long as it doesn't exceed RESULTS_PER_PAGE
-	// This is currently only used for the default search
-	if(!isset($_GET["user"]) || !isset($_GET["perpage"]) || !is_numeric($_GET["perpage"]) || $_GET["perpage"] < 0 || $_GET["perpage"] > RESULTS_PER_PAGE)
+	if(!isset($_GET["user"]))
 		die("<error>Necessary information not specified!</error>");
 	
 	try
@@ -63,11 +61,16 @@
 	
 	$result_count = $stmt->fetchColumn();
 	
-	if($result_count > $_GET["perpage"])
+	if($_GET["limit"] && $result_count > $_GET["limit"])
+	{
+		$result_count = (int)$_GET["limit"];
+		echo "<moreresults>0</moreresults>";
+	}	
+	else if($result_count > RESULTS_PER_PAGE)
 	{
 		// The number of results exceeds the number of results per page.
 		// Therefore we will only output all results up to the maximum number of results per page with this call.
-		$result_count = $_GET["perpage"];
+		$result_count = RESULTS_PER_PAGE;
 		echo "<moreresults>1</moreresults>";
 	}
 	else
@@ -89,7 +92,7 @@
 			$stmt = $dbh->query(
 				"SELECT r.id, UNIX_TIMESTAMP(r.timestamp) timestamp, a.name, r.revision, r.platform, r.comment " .
 				$tables .	$where . $order .
-				"LIMIT " . $_GET["perpage"]
+				"LIMIT " . $result_count
 			) or die("<error>Query failed #2</error>");
 			
 			$first = true;

Modified: branches/danny-web/www/www.reactos.org/testman/config.inc.php
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/testman/config.inc.php?rev=434&r1=433&r2=434&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/testman/config.inc.php [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/testman/config.inc.php [iso-8859-1] Sat Jun 13 06:05:10 2009
@@ -10,7 +10,7 @@
 	define("SHARED_PATH", "../shared/");
 	define("TESTMAN_PATH", "");
 	
-	define("DEFAULT_SEARCH_RESULTS_PER_PAGE", 10);
+	define("DEFAULT_SEARCH_LIMIT", 10);
 	define("DEFAULT_SEARCH_USER", "Debug-Buildslave");
 	define("MAX_COMPARE_RESULTS", 5);
 	define("RESULTS_PER_PAGE", 100);

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/testman/js/index.js.php?rev=434&r1=433&r2=434&view=diff
==============================================================================
--- 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] Sat Jun 13 06:05:10 2009
@@ -187,7 +187,6 @@
 	data["endrev"] = inputbox_endrev;
 	data["user"] = document.getElementById("search_user").value;
 	data["platform"] = document.getElementById("search_platform").value;
-	data["perpage"] = <?php echo RESULTS_PER_PAGE; ?>;
 	
 	data["resultlist"] = 1;
 	data["requesttype"] = REQUESTTYPE_FULLLOAD;
@@ -237,7 +236,8 @@
 	
 	CurrentPage = 1;
 	
-	data["perpage"] = <?php echo DEFAULT_SEARCH_RESULTS_PER_PAGE; ?>;
+	data["desc"] = 1;
+	data["limit"] = <?php echo DEFAULT_SEARCH_LIMIT; ?>;
 	data["user"] = "<?php echo DEFAULT_SEARCH_USER; ?>";
 	
 	data["resultlist"] = 1;



More information about the Ros-diffs mailing list