Author: jfthomps
Date: Wed Dec 1 18:27:51 2010
New Revision: 1041116
URL: http://svn.apache.org/viewvc?rev=1041116&view=rev
Log:
VCL-232
add way to delete multiple computers
applied patch submitted by David Hutchins
patch is attached to JIRA issue
-modified computerUtilities - added code to select DELETE as one of the options
along with state change
-modified compStateChange - added section to handle when DELETE is selected
-modified submitCompStateChange - added section to handle when DELETE is
selected
Modified:
incubator/vcl/trunk/web/.ht-inc/computers.php
Modified: incubator/vcl/trunk/web/.ht-inc/computers.php
URL:
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/computers.php?rev=1041116&r1=1041115&r2=1041116&view=diff
==
--- incubator/vcl/trunk/web/.ht-inc/computers.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/computers.php Wed Dec 1 18:27:51 2010
@@ -,14 +,15 @@ function computerUtilities() {
print " \n";
}
print " \n";
- print "Change state of selected computers to:";
+ print "Change state of or delete selected computers:";
$states = array("2" => "available",
"23" => "hpc",
"10" => "maintenance",
- "20" => "convert to vmhostinuse");
+ "20" => "convert to vmhostinuse",
+ "999" => "DELETE");
print "\n";
printSelectInput("stateid", $states);
- print "";
+ print "";
print "\n";
$cont = addContinuationsEntry('compStateChange', array(), SECINDAY, 0);
print "\n";
@@ -2468,6 +2469,11 @@ function compStateChange() {
print "hpc state:\n";
print "\n";
}
+ elseif($data['stateid'] == 999) {
+ print "You are about to DELETE
the following computers";
+ print "\n";
+ }
+
$cont = addContinuationsEntry('submitCompStateChange', $data, SECINDAY,
0, 0);
print " \n";
print "\n";
@@ -2972,6 +2978,22 @@ function submitCompStateChange() {
print "\n";
}
}
+ elseif($data['stateid'] == 999) {
+ $compids = implode(',', $data['computerids']);
+ $query = "UPDATE computer "
+ . "SET deleted = 1, "
+ . "notes = '' "
+ . "WHERE id IN ($compids)";
+ doQuery($query, 999);
+ print "The following computers were deleted:\n";
+ print "\n";
+ foreach($data['computerids'] as $compid) {
+ print " \n";
+ print "
{$computers[$compid]['hostname']}\n";
+ print " \n";
+ }
+ print "\n";
+ }
else
abort(50);
}