Commit 193b35b6 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add an editnodetype page to make it easier to operate on the

node_types table, especially when setting up new testbeds. Currently,
linked off the node summary page, when in admin mode you get the edit
link instead of the show link.
parent 59c0c942
......@@ -76,13 +76,12 @@ function TBFieldData($table, $column, $flag = 0)
}
$fielddata = $DBFieldData["default:default"];
}
# Overwrite final entry with toplevel data.
# Return both values.
if (isset($toplevel) &&
($toplevel["min"] || $toplevel["max"])) {
$fielddata["min"] = $toplevel["min"];
$fielddata["max"] = $toplevel["max"];
return array($fielddata, $toplevel);
}
return $fielddata;
return array($fielddata, NULL);
}
#
......@@ -93,7 +92,7 @@ function TBcheck_dbslot($token, $table, $column, $flag = 0)
{
global $DBFieldErrstr;
$fielddata = TBFieldData($table, $column, $flag);
list ($fielddata, $toplevel) = TBFieldData($table, $column, $flag);
if (! $fielddata) {
return 0;
......@@ -102,8 +101,10 @@ function TBcheck_dbslot($token, $table, $column, $flag = 0)
$check = $fielddata["check"];
$check_type = $fielddata["check_type"];
$column_type = $fielddata["column_type"];
$min = $fielddata["min"];
$max = $fielddata["max"];
$min = (empty($toplevel) ? $fielddata["min"] : $toplevel["min"]);
$max = (empty($toplevel) ? $fielddata["max"] : $toplevel["max"]);
$min = intval($min);
$max = intval($max);
#
# Functional checks not implemented yet.
......@@ -150,7 +151,7 @@ function TBcheck_dbslot($token, $table, $column, $flag = 0)
case "int":
case "float":
if ($token < $min)
$DBFieldErrstr = "too small - $min minimum value";
$DBFieldErrstr = "$token too small - $min minimum value";
else
$DBFieldErrstr = "too large - $max maximum value";
break;
......@@ -226,6 +227,18 @@ function TBvalid_integer($token) {
return TBcheck_dbslot($token, "default", "int",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR);
}
function TBvalid_tinyint($token) {
return TBcheck_dbslot($token, "default", "tinyint",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR);
}
function TBvalid_boolean($token) {
return TBcheck_dbslot($token, "default", "boolean",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR);
}
function TBvalid_float($token) {
return TBcheck_dbslot($token, "default", "float",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR);
}
function TBvalid_num_members($token) {
return TBcheck_dbslot($token, "projects", "num_members",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR);
......
This diff is collapsed.
......@@ -188,8 +188,12 @@ if (! strcmp($showtype, "summary")) {
if (isset($perms[$key]) && !$perms[$key])
continue;
echo "<tr>
<td><a href=shownodetype.php3?node_type=$key>$key</a></td>
echo "<tr>\n";
if ($isadmin)
echo "<td><a href=editnodetype.php3?node_type=$key>\n";
else
echo "<td><a href=shownodetype.php3?node_type=$key>\n";
echo " $key</a></td>
<td align=center>$freecount</td>
<td align=center>$value</td>
</tr>\n";
......
......@@ -66,3 +66,33 @@ function WRITEOSIDMENU($caption, $value, $osid_result, $previous)
</tr>\n";
}
function WRITEIMAGEIDMENU($caption, $value, $imageid_result, $previous)
{
echo "<tr>
<td>*$caption:</td>";
echo " <td><select name=\"$value\">
<option value=X>Please Select </option>\n";
mysql_data_seek($imageid_result, 0);
while ($row = mysql_fetch_array($imageid_result)) {
$imageid = $row[imageid];
$imagename = $row[imagename];
$pid = $row[pid];
$selected = "";
if (strcmp($previous, "$imageid") == 0)
$selected = "selected";
echo "<option $selected value='$imageid'>$pid - $imagename</option>\n";
}
$selected = "";
if (strcmp($previous, "none") == 0)
$selected = "selected";
echo " <option $selected value=none>No ImageID</option>\n";
echo " </select>";
echo " </td>
</tr>\n";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment