diff --git a/backend/editnodetype.in b/backend/editnodetype.in index 01b3d4ce12de9f4294190dd750c9186fc5d7ae5a..c49f9649177e7115a2016a81f1855c895efb8c88 100644 --- a/backend/editnodetype.in +++ b/backend/editnodetype.in @@ -140,26 +140,23 @@ my %xmlfields = "class" => ["class", $SLOT_OPTIONAL], # Fixed attributes. - "isvirtnode" => ["boolean", $SLOT_OPTIONAL], - "isjailed" => ["boolean", $SLOT_OPTIONAL], - "isdynamic" => ["boolean", $SLOT_OPTIONAL], - "isremotenode" => ["boolean", $SLOT_OPTIONAL], - "issubnode" => ["boolean", $SLOT_OPTIONAL], - "isplabdslice" => ["boolean", $SLOT_OPTIONAL], - "issimnode" => ["boolean", $SLOT_OPTIONAL], + "isvirtnode" => ["isvirtnode", $SLOT_OPTIONAL], + "isjailed" => ["isjailed", $SLOT_OPTIONAL], + "isdynamic" => ["isdynamic", $SLOT_OPTIONAL], + "isremotenode" => ["isremotenode", $SLOT_OPTIONAL], + "issubnode" => ["issubnode", $SLOT_OPTIONAL], + "isplabdslice" => ["isplabdslice", $SLOT_OPTIONAL], + "issimnode" => ["issimnode", $SLOT_OPTIONAL], # Dynamic attributes with wildcards. "attr_boolean_*" => ["attr_boolean", $SLOT_OPTIONAL], - "attr_integer_*" => ["attr_int", $SLOT_OPTIONAL], + "attr_integer_*" => ["attr_integer", $SLOT_OPTIONAL], "attr_float_*" => ["attr_float", $SLOT_OPTIONAL], "attr_string_*" => ["attr_string", $SLOT_OPTIONAL], - # Old-style osid and image names. - "attr_string_*_osid" => ["attr_osid", $SLOT_OPTIONAL], - "attr_string_*_imageid" => ["attr_imageid",$SLOT_OPTIONAL], - # New-style indices. - "attr_integer_*_osid" => ["attr_int", $SLOT_OPTIONAL], - "attr_integer_*_imageid"=> ["attr_int", $SLOT_OPTIONAL], + # OS and Image ID's, referenced by their integer index. + "attr_integer_*_osid" => ["attr_osid", $SLOT_OPTIONAL], + "attr_integer_*_imageid"=> ["attr_imageid",$SLOT_OPTIONAL], # The name of a single attribute to add to the list. "new_attr" => ["attr_name", $SLOT_OPTIONAL], @@ -426,9 +423,11 @@ foreach $attr_name (@attr_names) { next if $del; - # An attr to be set must pre-exist, unless it's the new attr. + # An attr to be set must pre-exist, unless it's the one new attr. + # (And of course, the attrs of a new_type are *all* new attrs.) UserError("NodeType Attr: $attr_name is not set in nodetype $node_type!") - if (!exists($prev_attrs->{$attr_name}) && + if (!$new_type && + !exists($prev_attrs->{$attr_name}) && $attr_name ne $new_attr_name); $attr_type = $attr_types{$attr_name}; diff --git a/sql/database-fill.sql b/sql/database-fill.sql index 67e41d8c849fc83855beaa4350656e1a4ce7e7c1..da646eceb2604051006aff8d3588bd16a37fa569 100644 --- a/sql/database-fill.sql +++ b/sql/database-fill.sql @@ -801,7 +801,13 @@ REPLACE INTO table_regex VALUES ('images','frisbee_pid','text','redirect','defau REPLACE INTO table_regex VALUES ('node_types','new_type','text','redirect','default:tinytext',0,0,NULL); REPLACE INTO table_regex VALUES ('node_types','node_type','text','regex','^[-\\w]+$',1,30,NULL); REPLACE INTO table_regex VALUES ('node_types','class','text','regex','^[\\w]+$',1,30,NULL); -REPLACE INTO table_regex VALUES ('node_types','boolean','text','redirect','default:boolean',0,0,NULL); +REPLACE INTO table_regex VALUES ('node_types','isvirtnode','text','redirect','default:boolean',0,0,NULL); +REPLACE INTO table_regex VALUES ('node_types','isjailed','text','redirect','default:boolean',0,0,NULL); +REPLACE INTO table_regex VALUES ('node_types','isdynamic','text','redirect','default:boolean',0,0,NULL); +REPLACE INTO table_regex VALUES ('node_types','isremotenode','text','redirect','default:boolean',0,0,NULL); +REPLACE INTO table_regex VALUES ('node_types','issubnode','text','redirect','default:boolean',0,0,NULL); +REPLACE INTO table_regex VALUES ('node_types','isplabdslice','text','redirect','default:boolean',0,0,NULL); +REPLACE INTO table_regex VALUES ('node_types','issimnode','text','redirect','default:boolean',0,0,NULL); REPLACE INTO table_regex VALUES ('node_types','attr_name','text','regex','^[-\\w]+$',1,32,NULL); REPLACE INTO table_regex VALUES ('node_types','attr_osid','text','redirect','os_info:osid',0,0,NULL); REPLACE INTO table_regex VALUES ('node_types','attr_imageid','text','redirect','images:imageid',0,0,NULL);