Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Hussamuddin Nasir
emulab-devel
Commits
2e7be2ea
Commit
2e7be2ea
authored
Aug 07, 2009
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix up editnodetype to handle the case when there is no
default_imageid sensibly.
parent
a140e1b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
www/editnodetype.php3
www/editnodetype.php3
+21
-8
No files found.
www/editnodetype.php3
View file @
2e7be2ea
...
...
@@ -121,14 +121,20 @@ function SPITFORM($node_type, $formfields, $attributes, $deletes, $errors)
# Split default_imageid
#
$default_imageids
=
preg_split
(
'/,/'
,
$attributes
[
"default_imageid"
]);
for
(
$i
=
0
;
$i
!=
count
(
$default_imageids
);
$i
++
)
{
$attributes
[
"default_imageid_
$i
"
]
=
$default_imageids
[
$i
];
if
(
isset
(
$attributes
[
"default_imageid"
]))
{
$default_imageids
=
preg_split
(
'/,/'
,
$attributes
[
"default_imageid"
]);
for
(
$i
=
0
;
$i
!=
count
(
$default_imageids
);
$i
++
)
{
$attributes
[
"default_imageid_
$i
"
]
=
$default_imageids
[
$i
];
}
$last_default_imageid_label
=
"default_imageid_
$i
"
;
$attributes
[
"default_imageid_
$i
"
]
=
0
;
unset
(
$attributes
[
"default_imageid"
]);
ksort
(
$attributes
);
}
else
{
$attributes
[
"default_imageid_0"
]
=
0
;
$last_default_imageid_label
=
"default_imageid_0"
;
ksort
(
$attributes
);
}
$last_default_imageid_label
=
"default_imageid_
$i
"
;
$attributes
[
"default_imageid_
$i
"
]
=
0
;
unset
(
$attributes
[
"default_imageid"
]);
ksort
(
$attributes
);
#
# Standard Testbed Header
...
...
@@ -501,13 +507,20 @@ $errors = array();
# Combine imageids into a comma seperated list
#
$default_imagesids
=
array
();
$default_imagesid_once_defined
=
0
;
for
(
$i
=
0
;
isset
(
$attributes
[
"default_imageid_
$i
"
]);
$i
++
)
{
if
(
!
(
isset
(
$deletes
[
"default_imageid_
$i
"
])
&&
$deletes
[
"default_imageid_
$i
"
]
==
"checked"
)
&&
$attributes
[
"default_imageid_
$i
"
]
!=
0
)
array_push
(
$default_imagesids
,
$attributes
[
"default_imageid_
$i
"
]);
unset
(
$attributes
[
"default_imageid_
$i
"
]);
$default_imagesid_once_defined
=
1
;
}
if
(
count
(
$default_imagesids
)
>
0
)
{
$attributes
[
"default_imageid"
]
=
join
(
','
,
$default_imagesids
);
}
elseif
(
$default_imagesid_once_defined
)
{
$attributes
[
"default_imageid"
]
=
"0"
;
$deletes
[
"default_imageid"
]
=
"checked"
;
}
$attributes
[
"default_imageid"
]
=
join
(
','
,
$default_imagesids
);
# Check the attributes.
while
(
list
(
$key
,
$val
)
=
each
(
$attributes
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment