<commit_before><?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
include("showstuff.php3");

#
# This page needs more work to make user friendly and flexible.
# Its a hack job at the moment.
# 

#
# Standard Testbed Header
#
PAGEHEADER("Show Experiment Information");

#
# Only known and logged in users can end experiments.
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);
$isadmin = ISADMIN($uid);

#
# Right now we show just the last N records entered, unless the user
# requested a specific record. 
#
if (isset($record) && strcmp($record, "")) {
    $wclause = "";
    if (! $isadmin) {
	$wclause = "and s.creator='$uid'";
    }
    $query_result =
	DBQueryFatal("select s.*,r.* from experiment_stats as s ".
		     "left join experiment_resources as r on ".
		     " r.exptidx=s.exptidx ".
		     "where s.exptidx=$record $wclause ".
		     "order by r.idx desc");

    if (mysql_num_rows($query_result) == 0) {
	USERERROR("No such experiment record $record in the system!", 1);
    }
}
else {
    $wclause = "";
    if (! $isadmin) {
	$wclause = "where s.creator='$uid'";
    }
    $query_result =
	DBQueryFatal("select s.*,r.* from experiment_stats as s ".
		     "left join experiment_resources as r on ".
		     " r.exptidx=s.exptidx ".
		     "$wclause ".
		     "order by s.exptidx desc,r.idx asc limit 200");

    if (mysql_num_rows($query_result) == 0) {
	USERERROR("No experiment records in the system!", 1);
    }
}

#
# Use first row to get the column headers (no pretty printing yet).
# 
$row = mysql_fetch_assoc($query_result);

echo "<table align=center border=1>\n";
echo "<tr>\n";
foreach($row as $key => $value) {
    $key = str_replace("_", " ", $key);
    
    echo "<th><font size=-1>$key</font></th>\n";
}
echo "</tr>\n";

mysql_data_seek($query_result, 0);

while ($row = mysql_fetch_assoc($query_result)) {
    $rsrcidx = $row[idx];
    
    echo "<tr>\n";
    foreach($row as $key => $value) {
	if ($key == "thumbnail") {
	    echo "<td nowrap>
                     <a href='showthumb.php3?idx=$rsrcidx'>Thumbnail</a>
                  </td>\n";
	}
	else {
	    echo "<td nowrap>$value</td>\n";
	}
    }
    echo "</tr>\n";
}
echo "</table>\n";

#
# Standard Testbed Footer
# 
PAGEFOOTER();
?><commit_msg>Cheesy hack to avoid confusing people with output. The stats scripts need output formatting work, but its too low priority to find the time.<commit_after><?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003, 2005 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
include("showstuff.php3");

#
# This page needs more work to make user friendly and flexible.
# Its a hack job at the moment.
# 

#
# Standard Testbed Header
#
PAGEHEADER("Show Experiment Information");

#
# Only known and logged in users can end experiments.
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);
$isadmin = ISADMIN($uid);

#
# Right now we show just the last N records entered, unless the user
# requested a specific record. 
#
if (isset($record) && strcmp($record, "")) {
    $wclause = "";
    if (! $isadmin) {
	$wclause = "and s.creator='$uid'";
    }
    $query_result =
	DBQueryFatal("select s.*,'foo',r.* from experiment_stats as s ".
		     "left join experiment_resources as r on ".
		     " r.exptidx=s.exptidx ".
		     "where s.exptidx=$record $wclause ".
		     "order by r.idx desc");

    if (mysql_num_rows($query_result) == 0) {
	USERERROR("No such experiment record $record in the system!", 1);
    }
}
else {
    $wclause = "";
    if (! $isadmin) {
	$wclause = "where s.creator='$uid'";
    }
    $query_result =
	DBQueryFatal("select s.*,'foo',r.* from experiment_stats as s ".
		     "left join experiment_resources as r on ".
		     " r.exptidx=s.exptidx ".
		     "$wclause ".
		     "order by s.exptidx desc,r.idx asc limit 200");

    if (mysql_num_rows($query_result) == 0) {
	USERERROR("No experiment records in the system!", 1);
    }
}

#
# Use first row to get the column headers (no pretty printing yet).
# 
$row = mysql_fetch_assoc($query_result);

echo "<table align=center border=1>\n";
echo "<tr>\n";
foreach($row as $key => $value) {
    $key = str_replace("_", " ", $key);

    if ($key == "foo")
	continue;
    
    echo "<th><font size=-1>$key</font></th>\n";
}
echo "</tr>\n";

mysql_data_seek($query_result, 0);

$print_header = 0;
$last_exptidx = 0;

while ($row = mysql_fetch_assoc($query_result)) {
    $rsrcidx = $row[idx];
    $exptidx = $row[exptidx];

    $skipping = 1;

    if ($last_exptidx != $exptidx) {
	$print_header  = 1;
	$last_exptidx = $exptidx;
    }

    echo "<tr>\n";
    foreach($row as $key => $value) {
	if ($key == "thumbnail") {
	    echo "<td nowrap>
                     <a href='showthumb.php3?idx=$rsrcidx'>Thumbnail</a>
                  </td>\n";
	}
	else {
	    if (!$print_header && $skipping) {
		if ($key == "foo") {
		    $skipping = 0;
		    continue;
		}
		echo "<td nowrap>&nbsp</td>\n";		
		continue;
	    }
	    if ($key == "foo")
		continue;
	    
	    echo "<td nowrap>$value</td>\n";
	}
    }
    $print_header = 0;
    echo "</tr>\n";
}
echo "</table>\n";

#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>
{'fraction_non_alphanumeric': 0.1679769894534995, 'fraction_numerical': 0.009971236816874401, 'mean_word_length': 3.0215882806476486, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4375847', 'n_tokens_mistral': 1968, 'n_tokens_neox': 1846, 'n_words': 500}