You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2011/10/26 18:21:20 UTC
svn commit: r1189292 - /incubator/vcl/trunk/web/.ht-inc/computers.php
Author: jfthomps
Date: Wed Oct 26 16:21:20 2011
New Revision: 1189292
URL: http://svn.apache.org/viewvc?rev=1189292&view=rev
Log:
VCL-491
adding multiple computers - confusing error messages when incorrect count entered
VCL-509
error when adding computer with no groups selected
-modified submitAddBulkComputers - had same problem as VCL-509, fixed in the same way
-modified processBulkComputerInput - improved error messages and when they get displayed
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=1189292&r1=1189291&r2=1189292&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/computers.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/computers.php Wed Oct 26 16:21:20 2011
@@ -1591,15 +1591,17 @@ function submitAddBulkComputers() {
$resid = dbLastInsertID();
// add computer into selected groups
- $vals = array();
- foreach(array_keys($data["computergroup"]) as $groupid)
- $vals[] = "($resid, $groupid)";
- $allvals = implode(',', $vals);
- $query = "INSERT INTO resourcegroupmembers "
- . "(resourceid, "
- . "resourcegroupid) "
- . "VALUES $allvals";
- doQuery($query, 101);
+ if(! empty($data['computergroup'])) {
+ $vals = array();
+ foreach(array_keys($data["computergroup"]) as $groupid)
+ $vals[] = "($resid, $groupid)";
+ $allvals = implode(',', $vals);
+ $query = "INSERT INTO resourcegroupmembers "
+ . "(resourceid, "
+ . "resourcegroupid) "
+ . "VALUES $allvals";
+ doQuery($query, 101);
+ }
if($data['stateid'] == 20) {
# create vmhost entry
@@ -3374,20 +3376,22 @@ function processBulkComputerInput($check
$submitErrMsg[IPADDRERR2] = "The number of IP addresses ($numipaddrs) "
. "does not match the number of hostnames ($numhostnames).";
$submitErr |= ENDHOSTVALERR;
- $submitErrMsg[ENDHOSTVALERR] = "The number of IP addresses ($numipaddrs) "
- . "does not match the number of hostnames ($numhostnames).";
+ $submitErrMsg[ENDHOSTVALERR] = $submitErrMsg[IPADDRERR2];
}
if(! empty($return['startpripaddress']) && ! empty($return['endpripaddress']) &&
- (! ($submitErr & IPADDRERR2 || $submitErr & IPADDRERR4) &&
+ (! ($submitErr & IPADDRERR4) &&
! empty($endpraddrArr) &&
- ($endaddrArr[3] - $startaddrArr[3] != $endpraddrArr[3] - $startpraddrArr[3]))) {
- $numpubaddrs = $endaddrArr[3] - $startaddrArr[3] + 1;
+ ($return["endhostval"] - $return["starthostval"] != $endpraddrArr[3] - $startpraddrArr[3]))) {
$numpraddrs = $endpraddrArr[3] - $startpraddrArr[3] + 1;
- $submitErr |= IPADDRERR2;
- $submitErrMsg[IPADDRERR2] = "The number of public IP addresses ($numpubaddrs) "
- . "does not match the number of private IP addresses ($numpraddrs).";
+ $numhostnames = $return["endhostval"] - $return["starthostval"] + 1;
+
$submitErr |= IPADDRERR4;
- $submitErrMsg[IPADDRERR4] = $submitErrMsg[IPADDRERR2];
+ $submitErrMsg[IPADDRERR4] = "The number of private IP addresses ($numpraddrs) "
+ . "does not match the number of hostnames ($numhostnames).";
+ if(! ($submitErr & ENDHOSTVALERR)) {
+ $submitErr |= ENDHOSTVALERR;
+ $submitErrMsg[ENDHOSTVALERR] = $submitErrMsg[IPADDRERR4];
+ }
}
if(! validateUserid($return["owner"])) {
$submitErr |= OWNERERR;