Commit f57e76eb authored by Leigh Stoller's avatar Leigh Stoller

After getting bit again by mbr version not being set, I've added it to

the new/edit/show pages. Only admins get to change it though.
parent 833a0236
......@@ -138,6 +138,7 @@ my %xmlfields =
# The rest are optional, so we can skip passing ones that are not changing.
"description" => ["description", $SLOT_OPTIONAL],
"path" => ["path", $SLOT_OPTIONAL],
"mbr_version", => ["mbr_version", $SLOT_OPTIONAL],
"mtype_*" => ["mtype", $SLOT_OPTIONAL],
);
#
......
......@@ -370,7 +370,7 @@ sub EditImageid($$$$)
# (Others above already did their own updates.)
#
my %updates;
foreach my $col ("description", "path") {
foreach my $col ("description", "path", "mbr_version") {
# Copy args we want so that others can't get through.
if (exists($argref->{$col})) {
$updates{$col} = $mods{$col} = $argref->{$col};
......
......@@ -262,6 +262,18 @@ function SPITFORM($image, $formfields, $errors)
<td class=left>". ($defaults["global"] ? "Yes" : "No") . "</td>
</tr>\n";
if ($isadmin) {
echo "<tr>
<td>MBR Version:<br>
<td class=left>
<input type=text
name=\"formfields[mbr_version]\"
value=\"" . $formfields["mbr_version"] . "\"
size= maxlength=2>
</td>
</tr>\n";
}
echo "<tr>
<td align=center colspan=2>
<b><input type=submit name=submit value=Submit></b>
......@@ -341,6 +353,11 @@ if (isset($formfields["path"]) && $formfields["path"] != "" &&
$args["path"] = $formfields["path"];
}
if (isset($formfields["mbr_version"]) && $formfields["mbr_version"] != "" &&
$formfields["mbr_version"] != $image->mbr_version()) {
$args["mbr_version"] = $formfields["mbr_version"];
}
# The mtype_* checkboxes are dynamically generated.
foreach ($mtypes_array as $type) {
# Filter booleans from checkbox values, send if different.
......
......@@ -267,7 +267,7 @@ class Image
# Unlink this here, so that the file is left behind in case of error.
# We can then create the image by hand from the xmlfile, if desired.
unlink($xmlname);
#unlink($xmlname);
return true;
}
......@@ -306,6 +306,7 @@ class Image
function shared() { return $this->field("shared"); }
function isglobal() { return $this->field("global"); }
function updated() { return $this->field("updated"); }
function mbr_version() { return $this->field("mbr_version"); }
# Return the DB data.
function DBData() { return $this->image; }
......@@ -470,6 +471,7 @@ class Image
$creator = $this->creator();
$created = $this->created();
$uuid = $this->uuid();
$mbr_version = $this->mbr_version();
if (!$description)
$description = "&nbsp;";
......@@ -617,6 +619,11 @@ class Image
<td class=left>$imageid</td>
</tr>\n";
echo "<tr>
<td>MBR Version: </td>
<td class=left>$mbr_version</td>
</tr>\n";
echo "<tr>
<td>UUID: </td>
<td class=left>$uuid</td>
......
......@@ -418,6 +418,16 @@ function SPITFORM($formfields, $errors)
echo " > Yes
</td>
</tr>\n";
echo "<tr>
<td>MBR Version:<br>
<td class=left>
<input type=text
name=\"formfields[mbr_version]\"
value=\"" . $formfields["mbr_version"] . "\"
size=2 maxlength=2>
</td>
</tr>\n";
}
echo "<tr>
......@@ -478,6 +488,7 @@ if (!isset($submit)) {
$defaults["shared"] = "No";
$defaults["global"] = "No";
$defaults["makedefault"] = "No";
$defaults["mbr_version"] = "";
#
# For users that are in one project and one subgroup, it is usually
......@@ -617,6 +628,11 @@ if (isset($formfields["makedefault"])) {
strcmp($formfields["makedefault"], "Yep") ? 0 : 1;
}
if (isset($formfields["mbr_version"]) &&
$formfields["mbr_version"] != "") {
$args["mbr_version"] = $formfields["mbr_version"];
}
#
# See what node types this image will work on. Must be at least one!
# Store the valid types in a new array for simplicity.
......
......@@ -545,7 +545,19 @@ function SPITFORM($formfields, $errors)
</tr>\n";
}
if ($isadmin) {
echo "<tr>
<td>MBR Version:<br>
<td class=left>
<input type=text
name=\"formfields[mbr_version]\"
value=\"" . $formfields["mbr_version"] . "\"
size= maxlength=2>
</td>
</tr>\n";
}
#
# Shared?
#
......@@ -755,6 +767,7 @@ if (!isset($submit)) {
$defaults["shared"] = "No";
$defaults["global"] = "No";
$defaults["reboot_waittime"] = "";
$defaults["mbr_version"] = "";
if (isset($nodetype) && $nodetype == "mote") {
# Defaults for mote-type nodes
......@@ -954,6 +967,11 @@ if (isset($formfields["max_concurrent"]) &&
$args["max_concurrent"] = $formfields["max_concurrent"];
}
if (isset($formfields["mbr_version"]) &&
$formfields["mbr_version"] != "") {
$args["mbr_version"] = $formfields["mbr_version"];
}
if (isset($formfields["reboot_waittime"]) &&
$formfields["reboot_waittime"] != "") {
$args["reboot_waittime"] = $formfields["reboot_waittime"];
......
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