diff --git a/checkin_notes b/checkin_notes index 3d14ac2c68..4d281cac2c 100755 --- a/checkin_notes +++ b/checkin_notes @@ -19370,11 +19370,13 @@ Rom 13 Nov 2004 (boinc) Bruce Allen 13 Nov 2004 - Fixed, modified, tested script to remove workunits. Linked to main ops page. + - Fixed links at bottom of workunits page, showing outcomes of results. + - Added tabular description of tables to the database form page, longer clause box html/ops/ - Removed: - cancel_wu.php - Added: + cancel_wu.php (removed) cancel_wu_form.php cancel_wu_action.php - Modified: (link added at bottom) index.php + db_form.php + html/inc/ + db_ops.inc diff --git a/html/inc/db_ops.inc b/html/inc/db_ops.inc index 1885382d98..ce00fbf2c7 100644 --- a/html/inc/db_ops.inc +++ b/html/inc/db_ops.inc @@ -1,4 +1,57 @@ \n"; + +// Function prints a description of $table +function print_describe_table_onecol($table, $which, $columns) { + $result=mysql_query("SELECT * from $table LIMIT 1"); + $fields=mysql_num_fields($result); + + $avgnum=(int)($fields/$columns); + if ($avgnum*$columns<$fields) + $avgnum++; + + $actualcolumns=0; + while ($avgnum*$actualcolumns<$fields) + $actualcolumns++; + + if ($which>$actualcolumns) + return 0; + + $bot=($which-1)*$avgnum; + $top=$which*$avgnum; + + $width=100.0/$actualcolumns; + + // echo "\n"; + echo ""; + return 0; +} + +function print_describe_table($table, $how_many_columns) { + // Number of columns for showing table description + echo "

Description of $table table fields:

\n"; + echo "
\n"; + echo "\n"; + for ($count=$bot; $count<$top; $count++) { + if ($count<$fields) { + $name= mysql_field_name($result, $count); + $type= mysql_field_type($result, $count); + $length=mysql_field_len($result, $count); + } + else { + $name="
"; + $type="
"; + $length="
"; + } + echo "\t\n"; + } + echo "
NAMETypeBytes
$name$type$length
\n\t"; + for ($i=1; $i<=$how_many_columns; $i++) + print_describe_table_onecol($table, $i, $how_many_columns); + echo "\t\n
\n"; + return 0; +} + function join_query_string($s1, $s2) { if ($s1) { @@ -193,7 +246,9 @@ function show_result_summary() { $_GET['sort_by'] = ''; // ignore sort $query_appid = $_GET['appid']; - $query_received_time = time() - $_GET['nsecs']; + if ($_GET['nsecs']) + $query_received_time = time() - $_GET['nsecs']; + $query_wuid = $_GET['workunitid']; $q = new SqlQueryString(); $q->process_form_items(); @@ -224,16 +279,26 @@ SELECT COUNT(id) AS nTotal, SUM(case when server_state = '5' and outcome = '3' and client_state = '3' then 1 else 0 end) AS clientstate_computedone, SUM(case when server_state = '5' and outcome = '3' and client_state = '4' then 1 else 0 end) AS clientstate_uploading, SUM(case when server_state = '5' and outcome = '3' and client_state = '5' then 1 else 0 end) AS clientstate_uploaded -FROM result -WHERE - appid=$query_appid and - received_time > $query_received_time +FROM result WHERE "; +if ($query_appid) + $main_query .= "appid=$query_appid and "; +if ($query_received_time) + $main_query .= "received_time > $query_received_time and "; +if ($query_wuid) + $main_query .= "workunitid=$query_wuid and "; + + $main_query .= "1=1"; + $urlquery = $q->urlquery; $result = mysql_query($main_query); - if ($res = mysql_fetch_object($result)) { + // echo "Main query was $main_query
"; + + if ($result) { + + $res = mysql_fetch_object($result); $ntotal = $res->nTotal; $server_state[1] = $res->serverstate_inactive; @@ -258,8 +323,8 @@ WHERE $ninvalid = $res->validate_invalid; $nfile_deleted = $res->filedeletestate_ready + $res->filedeletestate_done; + mysql_free_result($result); } - mysql_free_result($result); echo ""; @@ -274,7 +339,7 @@ WHERE echo "\n"; for ($ss=1; $ss<6; $ss++) { row2(server_state_string($ss), - link_results($server_state[$ss], $urlquery,"server_state=$ss", '')); + link_results("$server_state[$ss]", $urlquery,"server_state=$ss", '')); } echo "
Server state# results
"; @@ -282,26 +347,27 @@ WHERE echo "Outcome# results\n"; for ($ro=0; $ro<6; $ro++) { c_row2($outcome[$ro]?outcome_color($ro):'', outcome_string($ro), - link_results($outcome[$ro], $urlquery, "outcome=$ro", '') + link_results("$outcome[$ro]", $urlquery, "outcome=$ro", '') ); } echo ""; echo "\n"; - row2("Valid", link_results($nvalid, $urlquery, "validate_state=1", "outcome=1")); - row2("Invalid", link_results($ninvalid, $urlquery, "validate_state=2", "outcome=1")); + // row2("Valid", link_results("$nvalid", $urlquery, "validate_state=1", "outcome=1")); + row2("Valid", link_results("$nvalid", $urlquery, "validate_state=1", "outcome=1")); + row2("Invalid", link_results("$ninvalid", $urlquery, "validate_state=2", "outcome=1")); echo "
Validate state# results
"; echo "\n"; - row2("Files deleted", link_results($nfile_deleted, $urlquery, "outcome=1", "(file_delete_state=1 or file_delete_state=2)")); + row2("Files deleted", link_results("$nfile_deleted", $urlquery, "outcome=1", "(file_delete_state=1 or file_delete_state=2)")); echo "
File Delete state# results
"; echo "\n"; for ($cs=1; $cs<6; $cs++) { row2(client_state_string($cs), - link_results($client_state[$cs], $urlquery, "client_state=$cs", "outcome=3") + link_results("$client_state[$cs]", $urlquery, "client_state=$cs", "outcome=3") ); } echo "
Client state# results
"; diff --git a/html/ops/db_form.php b/html/ops/db_form.php index 22f144ead8..3c2a0af546 100644 --- a/html/ops/db_form.php +++ b/html/ops/db_form.php @@ -1,6 +1,7 @@ \n"; db_init(); @@ -19,7 +20,7 @@ require_once("../inc/db_ops.inc"); echo " Additional clauses - + "; } @@ -38,9 +39,11 @@ require_once("../inc/db_ops.inc"); } else if ($table=="app") { } else if ($table=="app_version") { print_detail_field(); + print_query_field(); } else if ($table=="host") { print_checkbox("Show Aggregate Information", "show_aggregate", $show_aggregate); print_detail_field(); + print_query_field(); } else if ($table=="workunit") { print_detail_field(); print_query_field(); @@ -64,7 +67,9 @@ require_once("../inc/db_ops.inc"); print_query_field(); } else if ($table=="team") { + print_query_field(); } else if ($table=="user") { + print_query_field(); } else { echo "Unknown table name\n"; exit(); @@ -76,5 +81,7 @@ require_once("../inc/db_ops.inc"); end_table(); echo "\n"; + print_describe_table($table, 4); + page_tail(); ?>