From 47fac27198547ec675c9f69e7eb522e521830b4e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 18 Oct 2002 19:25:30 +0000 Subject: [PATCH] result sort option svn path=/trunk/boinc/; revision=507 --- html/ops/db.php | 26 ++++++++++++++++++++++++++ html/ops/util.inc | 7 +++++++ 2 files changed, 33 insertions(+) diff --git a/html/ops/db.php b/html/ops/db.php index 80a7c60740..a2efd4d6c3 100644 --- a/html/ops/db.php +++ b/html/ops/db.php @@ -103,6 +103,26 @@ $first = 0; } + if (strlen($sort_by)) { + switch ($sort_by) { + case 1: + $query = $query . " order by create_time desc"; + $english_query = append_sql_query( $english_query, "most recent created are listed first", $first ); + $first = 0; + break; + case 2: + $query = $query . " order by sent_time desc"; + $english_query = append_sql_query( $english_query, "most recent sent are listed first", $first ); + $first = 0; + break; + case 3: + $query = $query . " order by received_time desc"; + $english_query = append_sql_query( $english_query, "most recent received are listed first", $first ); + $first = 0; + break; + } + } + if (strlen($nresults)) { $entries_to_show = $nresults; } else { @@ -158,6 +178,12 @@ print_checkbox("Show XML Docs", "show_xml_docs", $show_xml_docs); print_checkbox("Show Result stderr", "show_stderr", $show_stderr); print_checkbox("Show Times", "show_times", $show_times); + printf( "Sort by:
\n" ); + print_radio_button("None", "sort_by", "0", $sort_by == "0"); + print_radio_button("Creation Time", "sort_by", "1", $sort_by == "1"); + print_radio_button("Sent Time", "sort_by", "2", $sort_by == "2"); + print_radio_button("Received Time", "sort_by", "3", $sort_by == 3); + printf("
\n"); } else if ($show=="team") { } else if ($show=="user") { } else { diff --git a/html/ops/util.inc b/html/ops/util.inc index cf2bbe6512..2e05a78239 100644 --- a/html/ops/util.inc +++ b/html/ops/util.inc @@ -107,6 +107,13 @@ function print_checkbox($text,$name,$checked) { . "

\n"; } +function print_radio_button($text,$name,$value,$checked) { + echo "" + . "$text\n" + . "
\n"; +} + function print_text_field($text,$name,$value) { echo "$text \n" . "

\n";