Commit 671b70d8 authored by Leigh Stoller's avatar Leigh Stoller

Add notes field to images so we can record, well, notes about an image.

parent b88f2971
......@@ -160,6 +160,7 @@ my %xmlfields =
"mbr_version", => ["mbr_version", $SLOT_OPTIONAL],
"mtype_*" => ["mtype", $SLOT_OPTIONAL],
"hash", => ["hash", $SLOT_ADMINONLY],
"notes", => ["notes", $SLOT_ADMINONLY],
);
#
# Need a list of node types. We join this over the nodes table so that
......
......@@ -805,7 +805,7 @@ sub EditImageid($$$$)
# (Others above already did their own updates.)
#
my %updates;
foreach my $col ("description", "path", "mbr_version", "hash") {
foreach my $col ("description", "path", "mbr_version", "hash", "notes") {
# Copy args we want so that others can't get through.
if (exists($argref->{$col})) {
$updates{$col} = $mods{$col} = $argref->{$col};
......
......@@ -1045,7 +1045,7 @@ REPLACE INTO table_regex VALUES ('images','load_address','text','redirect','defa
REPLACE INTO table_regex VALUES ('images','frisbee_pid','text','redirect','default:int',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','metadata_url','text','redirect','default:tinytext',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','imagefile_url','text','redirect','default:tinytext',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','notes','text','redirect','default:fulltext',0,1024,NULL);
REPLACE INTO table_regex VALUES ('images','nodetype','text','redirect','node_types:node_type',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','OS','text','redirect','os_info:OS',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','version','text','redirect','os_info:version',0,0,NULL);
......
#
# Add notes to images,
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
DBQueryFatal("REPLACE INTO table_regex VALUES ".
"('images','notes','text','redirect',".
"'default:fulltext',0,1024,NULL)");
return 0;
}
# Local Variables:
# mode:perl
# End:
......@@ -316,6 +316,19 @@ function SPITFORM($image, $formfields, $errors)
"formfields[def_parentosid]",
$osid_result, $formfields["def_parentosid"]);
}
#
# Notes
#
echo "<tr>
<td>Admin Notes:</td>
<td class=left>
<textarea name=\"formfields[notes]\"
rows=4 cols=60>" .
str_replace("\r", "",
$formfields["notes"]) .
"</textarea>
</td>
</tr>\n";
}
echo "<tr>
......@@ -408,6 +421,12 @@ if (isset($formfields["mbr_version"]) && $formfields["mbr_version"] != "" &&
$formfields["mbr_version"] != $image->mbr_version()) {
$args["mbr_version"] = $formfields["mbr_version"];
}
if ($formfields["notes"] != "" && !TBvalid_description($formfields["notes"])) {
$errors["Notes"] = TBFieldErrorString();
}
else {
$args["notes"] = $formfields["notes"];
}
# The mtype_* checkboxes are dynamically generated.
foreach ($mtypes_array as $type) {
......
......@@ -441,6 +441,7 @@ class Image
function isdelta() { return $this->field("isdelta"); }
function nodelta() { return $this->field("nodelta"); }
function released() { return $this->field("released"); }
function notes() { return $this->field("notes"); }
# Return the DB data.
function DBData() { return $this->image; }
......@@ -619,6 +620,7 @@ class Image
$image_uuid = $this->image_uuid();
$mbr_version = $this->mbr_version();
$hash = $this->hash();
$notes = $this->notes();
#
# An imported image has a metadata_url, and at the moment I
......@@ -636,6 +638,8 @@ class Image
$path = "&nbsp;";
if (!$created)
$created = "N/A";
if (!strcmp($notes, ""))
$notes = "&nbsp;";
#
# Generate the table.
......@@ -930,6 +934,11 @@ class Image
<td class=left><a href='$metadata_url'>https:// ...</a></td>
</tr>\n";
echo "<tr>
<td>Notes: </td>
<td>$notes</td>
</tr>\n";
if ($imagefile_url) {
echo "<tr>
<td>Image File URL: </td>
......
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