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 2014/09/11 18:01:49 UTC
svn commit: r1624325 [11/13] - in /vcl/trunk/web: ./ .ht-inc/
.ht-inc/authmethods/ css/ js/ js/resources/
Modified: vcl/trunk/web/.ht-inc/vm.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/vm.php?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/vm.php (original)
+++ vcl/trunk/web/.ht-inc/vm.php Thu Sep 11 16:01:48 2014
@@ -31,6 +31,7 @@ function editVMInfo() {
print "<h2>Manage Virtual Hosts</h2>\n";
$profiles = getVMProfiles();
+ uasort($profiles, 'sortKeepIndex');
if(checkUserHasPerm('Manage VM Profiles')) {
print "<div id=\"mainTabContainer\" dojoType=\"dijit.layout.TabContainer\"\n";
print " style=\"width:650px;height:600px\">\n";
@@ -554,7 +555,6 @@ function updateVMlimit() {
}
$resources = getUserResources(array("computerAdmin"), array("administer"));
if(! array_key_exists($data[$vmhostid]['computerid'], $resources['computer'])) {
- print "alert('You do not have access to manage this host.');";
$rc = array('status' => 'ERROR',
'msg' => "You do not have access to manage this host.");
sendJSON($rc);
@@ -718,6 +718,7 @@ function AJvmFromHost() {
}
# try to remove reservations off of computer
moveReservationsOffComputer($compid);
+ cleanSemaphore();
# check for unmovable or active reservations
$query = "SELECT DATE_FORMAT(rq.end, '%l:%i%p %c/%e/%y') AS end, "
@@ -960,19 +961,19 @@ function AJupdateVMprofileItem() {
$item = mysql_real_escape_string($item);
$profile = getVMProfiles($profileid);
- if($item == 'password' && $profile[$profileid]['rsapub']){
- $encrypted = encryptDataAsymmetric($newvalue, $profile[$profileid]['rsapub']);
- $escaped = mysql_real_escape_string($encrypted);
- $query = "UPDATE vmprofile "
- . "SET `encryptedpasswd` = '$escaped' "
- . "WHERE id=$profileid";
- doQuery($query, 101);
- # don't store the unencrypted password
- $newvalue2 = 'NULL';
- $newvalue = '';
- } else if($profile[$profileid][$item] == $newvalue){
+ if($item == 'password' && $profile[$profileid]['rsapub']) {
+ $encrypted = encryptDataAsymmetric($newvalue, $profile[$profileid]['rsapub']);
+ $escaped = mysql_real_escape_string($encrypted);
+ $query = "UPDATE vmprofile "
+ . "SET `encryptedpasswd` = '$escaped' "
+ . "WHERE id = $profileid";
+ doQuery($query, 101);
+ # don't store the unencrypted password
+ $newvalue2 = 'NULL';
+ $newvalue = '';
+ }
+ else if($profile[$profileid][$item] == $newvalue)
return;
- }
$query = "UPDATE vmprofile "
. "SET `$item` = $newvalue2 "
. "WHERE id = $profileid";
Modified: vcl/trunk/web/.ht-inc/xmlrpcWrappers.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/xmlrpcWrappers.php?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/xmlrpcWrappers.php (original)
+++ vcl/trunk/web/.ht-inc/xmlrpcWrappers.php Thu Sep 11 16:01:48 2014
@@ -108,9 +108,11 @@ function XMLRPCtest($string) {
///
/// \fn XMLRPCgetImages()
///
-/// \return an array of image arrays, each with 2 indices:\n
+/// \return an array of image arrays, each with these indices:\n
/// \b id - id of the image\n
-/// \b name - name of the image
+/// \b name - name of the image\n
+/// \b description - description of image\n
+/// \b usage - usage instructions for image
///
/// \brief gets the images to which the user has access
///
@@ -215,7 +217,7 @@ function XMLRPCaddRequest($imageid, $sta
$images = getImages();
$revisionid = getProductionRevisionid($imageid);
- $rc = isAvailable($images, $imageid, $revisionid, $start, $end);
+ $rc = isAvailable($images, $imageid, $revisionid, $start, $end, 1);
if($rc < 1) {
addLogEntry($nowfuture, unixToDatetime($start),
unixToDatetime($end), 0, $imageid);
@@ -323,7 +325,7 @@ function XMLRPCaddRequestWithEnding($ima
$images = getImages();
$revisionid = getProductionRevisionid($imageid);
- $rc = isAvailable($images, $imageid, $revisionid, $start, $end);
+ $rc = isAvailable($images, $imageid, $revisionid, $start, $end, 1);
if($rc < 1) {
addLogEntry($nowfuture, unixToDatetime($start),
unixToDatetime($end), 0, $imageid);
@@ -376,7 +378,7 @@ function XMLRPCdeployServer($imageid, $s
$logingroup='', $ipaddr='', $macaddr='',
$monitored=0, $foruser='', $name='') {
global $user, $remoteIP;
- if(! in_array("serverProfileAdmin", $user["privileges"])) {
+ if(! in_array("serverCheckOut", $user["privileges"])) {
return array('status' => 'error',
'errorcode' => 60,
'errormsg' => "access denied to deploy server");
@@ -527,7 +529,7 @@ function XMLRPCdeployServer($imageid, $s
$images = getImages();
$revisionid = getProductionRevisionid($imageid);
$rc = isAvailable($images, $imageid, $revisionid, $start, $end,
- 0, 0, 0, 0, $ipaddr, $macaddr);
+ 1, 0, 0, 0, 0, $ipaddr, $macaddr);
if($rc < 1) {
addLogEntry($nowfuture, unixToDatetime($start),
unixToDatetime($end), 0, $imageid);
@@ -582,7 +584,7 @@ function XMLRPCdeployServer($imageid, $s
/// \li \b errorcode - error number\n
/// \li \b errormsg - error string\n
///
-/// \b success - request was successfully ended; there will be an additional
+/// \b success - request was successfully found; there will be an additional
/// element whose index is 'requests' which is an array of arrays, each having
/// these elements (or empty if no existing requests):\n
/// \li \b requestid - id of the request\n
@@ -614,7 +616,8 @@ function XMLRPCgetRequestIds() {
'start' => $start,
'end' => $end,
'OS' => $req['OS'],
- 'isserver' => $req['server']);
+ 'isserver' => $req['server'],
+ 'admin' => $req['serveradmin']);
if($req['currstateid'] == 14)
$tmp['state'] = $states[$req['laststateid']];
else
@@ -884,12 +887,33 @@ function XMLRPCextendRequest($requestid,
$timeToNext = timeToNextReservation($request);
$movedall = 1;
if($timeToNext > -1) {
- foreach($request["reservations"] as $res) {
- if(! moveReservationsOffComputer($res["computerid"])) {
- $movedall = 0;
- break;
+ $lockedall = 1;
+ if(count($request['reservations']) > 1) {
+ # get semaphore on each existing node in cluster so that nothing
+ # can get moved to the nodes during this process
+ $checkend = unixToDatetime($unixend + 900);
+ foreach($request["reservations"] as $res) {
+ if(! retryGetSemaphore(1, 1, $res['managementnodeid'], $res['computerid'], $request['start'], $checkend, $requestid)) {
+ $lockedall = 0;
+ break;
+ }
}
}
+ if($lockedall) {
+ foreach($request["reservations"] as $res) {
+ if(! moveReservationsOffComputer($res["computerid"])) {
+ $movedall = 0;
+ break;
+ }
+ }
+ }
+ else {
+ cleanSemaphore();
+ return array('status' => 'error',
+ 'errorcode' => 42,
+ 'errormsg' => 'cannot extend due to another reservation immediately after this one');
+ }
+ cleanSemaphore();
}
if(! $movedall) {
$timeToNext = timeToNextReservation($request);
@@ -912,7 +936,7 @@ function XMLRPCextendRequest($requestid,
}
$rc = isAvailable(getImages(), $request['reservations'][0]["imageid"],
$request['reservations'][0]['imagerevisionid'],
- $startts, $newendts, $requestid);
+ $startts, $newendts, 1, $requestid);
// conflicts with scheduled maintenance
if($rc == -2) {
addChangeLogEntry($request["logid"], NULL, unixToDatetime($newendts),
@@ -939,6 +963,7 @@ function XMLRPCextendRequest($requestid,
}
// success
updateRequest($requestid);
+ cleanSemaphore();
return array('status' => 'success');
}
@@ -1022,12 +1047,33 @@ function XMLRPCsetRequestEnding($request
$timeToNext = timeToNextReservation($request);
$movedall = 1;
if($timeToNext > -1) {
- foreach($request["reservations"] as $res) {
- if(! moveReservationsOffComputer($res["computerid"])) {
- $movedall = 0;
- break;
+ $lockedall = 1;
+ if(count($request['reservations']) > 1) {
+ # get semaphore on each existing node in cluster so that nothing
+ # can get moved to the nodes during this process
+ $checkend = unixToDatetime($unixend + 900);
+ foreach($request["reservations"] as $res) {
+ if(! retryGetSemaphore(1, 1, $res['managementnodeid'], $res['computerid'], $request['start'], $checkend, $requestid)) {
+ $lockedall = 0;
+ break;
+ }
+ }
+ }
+ if($lockedall) {
+ foreach($request["reservations"] as $res) {
+ if(! moveReservationsOffComputer($res["computerid"])) {
+ $movedall = 0;
+ break;
+ }
}
}
+ else {
+ cleanSemaphore();
+ return array('status' => 'error',
+ 'errorcode' => 42,
+ 'errormsg' => 'cannot extend due to another reservation immediately after this one');
+ }
+ cleanSemaphore();
}
if(! $movedall) {
$timeToNext = timeToNextReservation($request);
@@ -1051,7 +1097,7 @@ function XMLRPCsetRequestEnding($request
}
$rc = isAvailable(getImages(), $request['reservations'][0]["imageid"],
$request['reservations'][0]['imagerevisionid'],
- $startts, $end, $requestid);
+ $startts, $end, 1, $requestid);
// conflicts with scheduled maintenance
if($rc == -2) {
addChangeLogEntry($request["logid"], NULL, unixToDatetime($end),
@@ -1078,6 +1124,7 @@ function XMLRPCsetRequestEnding($request
}
// success
updateRequest($requestid);
+ cleanSemaphore();
return array('status' => 'success');
}
@@ -1164,7 +1211,7 @@ function XMLRPCautoCapture($requestid) {
'errorcode' => 48,
'errormsg' => 'cannot image a cluster reservation');
}
- require_once(".ht-inc/images.php");
+ require_once(".ht-inc/image.php");
$imageid = $reqData['reservations'][0]['imageid'];
$imageData = getImages(0, $imageid);
$captime = unixToDatetime(time());
@@ -1175,7 +1222,7 @@ function XMLRPCautoCapture($requestid) {
# create new revision if requestor is owner and not a kickstart image
if($imageData[$imageid]['installtype'] != 'kickstart' &&
$reqData['userid'] == $imageData[$imageid]['ownerid']) {
- $rc = updateExistingImage($requestid, $reqData['userid'], $comments, 1);
+ $rc = Image::AJupdateImage($requestid, $reqData['userid'], $comments, 1);
if($rc == 0) {
return array('status' => 'error',
'errorcode' => 49,
@@ -1191,7 +1238,7 @@ function XMLRPCautoCapture($requestid) {
. "owner: {$ownerdata['unityid']}@{$ownerdata['affiliation']}<br>";
$connectmethods = getImageConnectMethods($imageid, $reqData['reservations'][0]['imagerevisionid']);
$data = array('requestid' => $requestid,
- 'description' => $desc,
+ 'desc' => $desc,
'usage' => '',
'owner' => "{$ownerdata['unityid']}@{$ownerdata['affiliation']}",
'prettyname' => "Autocaptured ({$ownerdata['unityid']} - $requestid)",
@@ -1203,9 +1250,15 @@ function XMLRPCautoCapture($requestid) {
'checkuser' => 1,
'rootaccess' => 1,
'sysprep' => 1,
+ 'basedoffrevisionid' => $reqData['reservations'][0]['imagerevisionid'],
+ 'platformid' => $imageData[$imageid]['platformid'],
+ 'osid' => $imageData[$imageid]["osid"],
+ 'reload' => 20,
'comments' => $comments,
- 'connectmethodids' => implode(',', array_keys($connectmethods)));
- $rc = submitAddImage($data, 1);
+ 'connectmethodids' => implode(',', array_keys($connectmethods)),
+ 'autocaptured' => 1);
+ $obj = new Image();
+ $rc = $obj->addResource($data);
if($rc == 0) {
return array('status' => 'error',
'errorcode' => 50,
@@ -1608,7 +1661,7 @@ function XMLRPCaddNode($nodeName, $paren
}
if(in_array("nodeAdmin", $user['privileges'])) {
$nodeInfo = getNodeInfo($parentNode);
- if(is_null($tmp)) {
+ if(is_null($nodeInfo)) {
return array('status' => 'error',
'errorcode' => 78,
'errormsg' => 'Invalid nodeid specified');
@@ -1821,7 +1874,8 @@ function XMLRPCaddUserGroupPriv($name, $
array_push($usertypes["users"], "cascade");
$diff = array_diff($perms, $usertypes['users']);
- if(count($diff) || (count($perms) == 1 && $perms[0] == 'cascade')) {
+ if(! count($perms) || count($diff) ||
+ (count($perms) == 1 && $perms[0] == 'cascade')) {
return array('status' => 'error',
'errorcode' => 66,
'errormsg' => 'Invalid or missing permissions list supplied');
@@ -1830,9 +1884,13 @@ function XMLRPCaddUserGroupPriv($name, $
$cnp = getNodeCascadePrivileges($nodeid, "usergroups");
$np = getNodePrivileges($nodeid, "usergroups", $cnp);
- $diff = array_diff($perms, $np['usergroups'][$name]['privs']);
- if(empty($diff))
- return array('status' => 'success');
+ if(array_key_exists($name, $np['usergroups'])) {
+ $diff = array_diff($perms, $np['usergroups'][$name]['privs']);
+ if(empty($diff))
+ return array('status' => 'success');
+ }
+ else
+ $diff = $perms;
updateUserOrGroupPrivs($groupid, $nodeid, $diff, array(), "group");
return array('status' => 'success');
@@ -2430,7 +2488,7 @@ function XMLRPCeditUserGroup($name, $aff
return $rc;
# get info about group
- $query = "SELECT ownerid "
+ $query = "SELECT ownerid, "
. "affiliationid, "
. "custom, "
. "courseroll "
@@ -3014,23 +3072,23 @@ function XMLRPCremoveResourceGroup($name
/// created block time and at least one other index named 'status' which will
/// have one of these values:\n
/// \b error - error occurred; there will be 2 additional elements in the
-/// array:
-/// \li \b errorcode - error number
-/// \li \b errormsg - error string
+/// array:\n
+/// \li \b errorcode - error number\n
+/// \li \b errormsg - error string\n
///
/// \b success - blockTimesid was processed; there will be two additional
-/// elements in this case:
+/// elements in this case:\n
/// \li \b allocated - total number of desired allocations that have been
-/// processed
+/// processed\n
/// \li \b unallocated - total number of desired allocations that have not been
-/// processed
+/// processed\n
///
/// \b warning - there was a non-fatal issue that occurred while processing
-/// the call; there will be four additional elements in this case:
-/// \li \b warningcode - warning number
-/// \li \b warningmsg - warning string
+/// the call; there will be four additional elements in this case:\n
+/// \li \b warningcode - warning number\n
+/// \li \b warningmsg - warning string\n
/// \li \b allocated - total number of desired allocations that have been
-/// processed
+/// processed\n
/// \li \b unallocated - total number of desired allocations that have not been
/// processed\n\n
///
@@ -3206,18 +3264,18 @@ function XMLRPCblockAllocation($imageid,
///
/// \b completed - blockTimesid was previously successfully processed\n
/// \b success - blockTimesid was processed; there will be two additional
-/// elements in this case:
+/// elements in this case:\n
/// \li \b allocated - total number of desired allocations that have been
-/// processed
+/// processed\n
/// \li \b unallocated - total number of desired allocations that have not been
-/// processed
+/// processed\n
///
/// \b warning - there was a non-fatal issue that occurred while processing
-/// the call; there will be four additional elements in this case:
-/// \li \b warningcode - warning number
-/// \li \b warningmsg - warning string
+/// the call; there will be four additional elements in this case:\n
+/// \li \b warningcode - warning number\n
+/// \li \b warningmsg - warning string\n
/// \li \b allocated - total number of desired allocations that have been
-/// processed
+/// processed\n
/// \li \b unallocated - total number of desired allocations that have not been
/// processed\n\n
///
@@ -3332,7 +3390,7 @@ function XMLRPCprocessBlockTime($blockTi
}
# check to see if computer is available for whole block
$rc = isAvailable($images, $rqdata['imageid'], $revisionid, $checkstart,
- $unixend, $row['reqid'], $row['userid'],
+ $unixend, 1, $row['reqid'], $row['userid'],
$ignoreprivileges, 0, '', '', 1);
// if not available for whole block, just skip this one
if($rc < 1)
@@ -3375,6 +3433,7 @@ function XMLRPCprocessBlockTime($blockTi
. "VALUES $blockComps";
doQuery($query);
}
+ cleanSemaphore();
}
# check to see if all computers have been allocated
@@ -3451,7 +3510,7 @@ function XMLRPCprocessBlockTime($blockTi
$userid = array_pop($userids);
# use end of block time to find available computers, but...
$rc = isAvailable($images, $rqdata['imageid'], $revisionid, $stagunixstart,
- $unixend, 0, $userid, $ignoreprivileges);
+ $unixend, 1, 0, $userid, $ignoreprivileges);
if($rc < 1)
continue;
@@ -3488,12 +3547,12 @@ function XMLRPCprocessBlockTime($blockTi
. "$mgmtnodeid)";
doQuery($query, 101);
}
- semUnlock();
$blockComps = implode(',', $blockCompVals);
$query = "INSERT INTO blockComputers "
. "(blockTimeid, computerid, imageid, reloadrequestid) "
. "VALUES $blockComps";
doQuery($query, 101);
+ cleanSemaphore();
$blockCompVals = array();
}
if($allocated == 0) {
Modified: vcl/trunk/web/css/vcl.css
URL: http://svn.apache.org/viewvc/vcl/trunk/web/css/vcl.css?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/css/vcl.css (original)
+++ vcl/trunk/web/css/vcl.css Thu Sep 11 16:01:48 2014
@@ -14,6 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+html {
+ height: 100%;
+ width: 100%;
+}
+body {
+ height: 100%;
+ width: 100%;
+}
.scriptonly {
display: none;
}
@@ -219,6 +227,14 @@
color: red;
}
+.ready {
+ color: #008000;
+}
+
+.wait {
+ color: #e58304;
+}
+
#revisiontable th {
border: solid 1px #000000;
padding: 2px;
@@ -311,9 +327,232 @@
margin: 10px;
}
+#gridcontainer table th,
+#gridcontainer table td,
#usergroupcontainer table th,
#usergroupcontainer table td,
#resourcegroupcontainer table th,
-#resourcegroupcontainer table td {
+#resourcegroupcontainer table td,
+#extrafiltersdiv table th,
+#extrafiltersdiv table td {
font-size: 1em;
}
+
+.editmntable, #deployprofilediv table, #serverprofiledata table {
+ border-collapse: collapse;
+}
+
+.boxedtablerows {
+ border: 1px solid #000000;
+}
+
+#systemconfigdiv .dojoxMultiSelectSelectedOption,
+#groupbyresourcediv .dojoxMultiSelectSelectedOption,
+#groupbygroupdiv .dojoxMultiSelectSelectedOption,
+#mapbyresgroupdiv .dojoxMultiSelectSelectedOption,
+#mapbymaptogroupdiv .dojoxMultiSelectSelectedOption {
+ background-color: black;
+ color: white;
+}
+
+/*#configvariablegriddiv .dojoxGridCellFocus {
+ background-color: black;
+ color: white;
+}*/
+
+#systemconfigdiv .dojoxGridHeader,
+#groupbyresourcediv .dojoxGridHeader,
+#groupbygroupdiv .dojoxGridHeader,
+#mapbyresgroupdiv .dojoxGridHeader,
+#mapbymaptogroupdiv .dojoxGridHeader,
+#configvariablegriddiv .dojoxGridHeader {
+ display: none;
+}
+
+#systemconfigdiv .dojoxGrid,
+#groupbyresourcediv .dojoxGrid,
+#groupbygroupdiv .dojoxGrid,
+#mapbyresgroupdiv .dojoxGrid,
+#mapbymaptogroupdiv .dojoxGrid,
+#subimagegriddiv .dojoxGrid,
+#configvariablegriddiv .dojoxGrid {
+ background-color: white;
+ border: 1px solid black;
+}
+
+#systemconfigdiv .dojoxGridRow,
+#systemconfigdiv .dojoxGridRowOdd,
+#groupbyresourcediv .dojoxGridRow,
+#groupbyresourcediv .dojoxGridRowOdd,
+#groupbygroupdiv .dojoxGridRow,
+#groupbygroupdiv .dojoxGridRowOdd,
+#mapbyresgroupdiv .dojoxGridRow,
+#mapbyresgroupdiv .dojoxGridRowOdd,
+#mapbymaptogroupdiv .dojoxGridRow,
+#mapbymaptogroupdiv .dojoxGridRowOdd,
+#subimagegriddiv .dojoxGridRow,
+#subimagegriddiv .dojoxGridRowOdd,
+#configvariablegriddiv .dojoxGridRow,
+#configvariablegriddiv .dojoxGridRowOdd {
+ width: 300px;
+ background-color: white;
+ border: none;
+ padding: 0;
+ margin: 0;
+}
+
+#content #systemconfigdiv table,
+#content #groupbyresourcediv table,
+#content #groupbygroupdiv table,
+#content #mapbyresgroupdiv table,
+#content #mapbymaptogroupdiv table,
+#content #subimagegriddiv table,
+#content #configvariablegriddiv table {
+ border-spacing: 0;
+}
+
+#systemconfigdiv .dojoxGridRowSelected,
+#groupbyresourcediv .dojoxGridRowSelected,
+#groupbygroupdiv .dojoxGridRowSelected,
+#mapbyresgroupdiv .dojoxGridRowSelected,
+#mapbymaptogroupdiv .dojoxGridRowSelected,
+#subimagegriddiv .dojoxGridRowSelected,
+#configvariablegriddiv .dojoxGridRowSelected {
+ width: 300px;
+ background-color: black;
+ border: none;
+ padding: 0;
+ margin: 0;
+ color: white;
+}
+
+#systemconfigdiv .dojoxGridRowSelected td,
+#groupbyresourcediv .dojoxGridRowSelected td,
+#groupbygroupdiv .dojoxGridRowSelected td,
+#mapbyresgroupdiv .dojoxGridRowSelected td,
+#mapbymaptogroupdiv .dojoxGridRowSelected td,
+#subimagegriddiv .dojoxGridRowSelected td,
+#configvariablegriddiv .dojoxGridRowSelected td {
+ background-color: black;
+ color: white;
+}
+
+#systemconfigdiv .dojoxGridCell,
+#systemconfigdiv .dojoxGridCellFocus,
+#systemconfigdiv .dojoxGridCellOver,
+#groupbyresourcediv .dojoxGridCell,
+#groupbyresourcediv .dojoxGridCellFocus,
+#groupbyresourcediv .dojoxGridCellOver,
+#groupbygroupdiv .dojoxGridCell,
+#groupbygroupdiv .dojoxGridCellFocus,
+#groupbygroupdiv .dojoxGridCellOver,
+#mapbyresgroupdiv .dojoxGridCell,
+#mapbyresgroupdiv .dojoxGridCellFocus,
+#mapbyresgroupdiv .dojoxGridCellOver,
+#mapbymaptogroupdiv .dojoxGridCell,
+#mapbymaptogroupdiv .dojoxGridCellFocus,
+#mapbymaptogroupdiv .dojoxGridCellOver,
+#subimagegriddiv .dojoxGridCell,
+#subimagegriddiv .dojoxGridCellFocus,
+#subimagegriddiv .dojoxGridCellOver,
+#configvariablegriddiv .dojoxGridCell,
+#configvariablegriddiv .dojoxGridCellFocus,
+#configvariablegriddiv .dojoxGridCellOver {
+ border: none;
+ border-style: none;
+}
+
+#systemconfigdiv .dojoxMultiSelectItemBox,
+#groupbyresourcediv .dojoxMultiSelectItemBox,
+#groupbygroupdiv .dojoxMultiSelectItemBox,
+#mapbyresgroupdiv .dojoxMultiSelectItemBox,
+#mapbymaptogroupdiv .dojoxMultiSelectItemBox,
+#subimagegriddiv .dojoxMultiSelectItemBox,
+#configvariablegriddiv .dojoxMultiSelectItemBox {
+ display: none;
+}
+
+#addeditdlgcontent label,
+#newreslabelfields label {
+ position: absolute;
+ text-align: right;
+ width: 9em;
+ font-weight: bold;
+}
+
+#newreslabelfields label {
+ width: 10em;
+}
+
+#addeditdlgcontent .labeledform {
+ margin-left: 9.5em;
+}
+
+#advancedoptions .labeledform {
+ margin-left: 17em;
+}
+
+#mgmtnodedlgcontent label {
+ width: 18.5em;
+}
+
+#mgmtnodedlgcontent .labeledform {
+ margin-left: 19em;
+}
+
+#computerdlgcontent label {
+ width: 12em;
+}
+
+#computerdlgcontent .labeledform {
+ margin-left: 12.5em;
+}
+
+#advancedoptions label {
+ width: 16.5em;
+}
+
+#cfgvartypelbl {
+ margin-top: 6px;
+}
+
+#addeditdlgcontent .labeledforminnerlabel {
+ text-align: left;
+ font-weight: normal;
+ position: static;
+}
+
+#newreslabelfields .labeledform {
+ margin-left: 10.5em;
+}
+
+#configvariables {
+ border: 1px solid black;
+ margin: 3px;
+}
+
+.strikethrough {
+ text-decoration: line-through;
+}
+
+#nrfixedipdiv {
+ border: 1px solid black;
+ padding: 3px;
+ margin: 3px;
+ display: inline-block;
+}
+
+.boxedoptions {
+ border: 1px solid black;
+ padding: 3px;
+ margin: 3px 1px;
+}
+
+#imageRevisionDlg .dijitDialogPaneContent {
+ height: 100%;
+ width: 100%;
+}
+
+.disabledlabel {
+ color: #888888;
+}
Modified: vcl/trunk/web/index.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/index.php?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/index.php (original)
+++ vcl/trunk/web/index.php Thu Sep 11 16:01:48 2014
@@ -16,10 +16,9 @@
limitations under the License.
*/
-# ASF VCL v2.3
-$VCLversion = '2.3';
+# ASF VCL v2.4
+$VCLversion = '2.4';
-@include_once("fckeditor/fckeditor.php");
require_once(".ht-inc/conf.php");
if(! isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") {
header("Location: " . BASEURL . "/");
@@ -84,14 +83,30 @@ if(checkUserHasPerm('View Debug Informat
}
if($hasArg) {
- $actionFunction($arg);
+ if(function_exists($actionFunction))
+ $actionFunction($arg);
+ else {
+ $obj = getContinuationVar('obj');
+ if(! is_null($obj) && method_exists($obj, $actionFunction))
+ $obj->$actionFunction($arg);
+ else
+ main();
+ }
}
else {
- $actionFunction();
+ if(function_exists($actionFunction))
+ $actionFunction();
+ else {
+ $obj = getContinuationVar('obj');
+ if(! is_null($obj) && method_exists($obj, $actionFunction))
+ $obj->$actionFunction();
+ else
+ main();
+ }
}
printHTMLFooter();
-dbDisconnect();
+cleanSemaphore();
-semUnlock();
+dbDisconnect();
?>
Modified: vcl/trunk/web/js/blockallocations.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/blockallocations.js?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/js/blockallocations.js (original)
+++ vcl/trunk/web/js/blockallocations.js Thu Sep 11 16:01:48 2014
@@ -32,27 +32,7 @@ var blockFormAddListData = {
items: []
}
-function RPCwrapper(data, CB, dojson) {
- if(dojson) {
- dojo.xhrPost({
- url: 'index.php',
- load: CB,
- handleAs: "json",
- error: errorHandler,
- content: data,
- timeout: 15000
- });
- }
- else {
- dojo.xhrPost({
- url: 'index.php',
- load: CB,
- error: errorHandler,
- content: data,
- timeout: 15000
- });
- }
-}
+var usagechart = null;
function generalReqCB(data, ioArgs) {
eval(data);
@@ -1367,3 +1347,49 @@ function timestampToTimeVirtual(val) {
function machinecntfilter(val) {
return parseInt(val);
}
+
+function viewBlockUsage(blockid) {
+ var cont = dojo.byId('viewblockusagecont').value;
+ RPCwrapper({continuation: cont, blockid: blockid}, viewBlockUsageCB, 1);
+}
+
+function viewBlockUsageCB(data, ioArgs) {
+ if(data.items.status == 'success') {
+ if(usagechart)
+ usagechart.destroy();
+ usagechart = new dojox.charting.Chart2D('blockusagechartdiv');
+ usagechart.setTheme(dojox.charting.themes.ThreeD);
+ var xtickstep = parseInt(data.items.usage.xlabels.length / 10) || 1;
+ usagechart.addAxis("x", {
+ includeZero: false,
+ labels: data.items.usage.xlabels,
+ rotation: -90,
+ minorTicks: false,
+ font: 'normal normal normal 11px verdana',
+ majorTickStep: xtickstep
+ });
+ usagechart.addAxis('y', {
+ vertical: true,
+ max: 100,
+ includeZero: true,
+ minorTicks: true,
+ minorLabels: false,
+ majorTickStep: 20,
+ minorTickStep: 10
+ });
+ usagechart.addPlot('default', {type: "Columns", gap: 1});
+ usagechart.addPlot('Grid', {type: 'Grid', hMajorLines: true, vMajorLines: false});
+ usagechart.addSeries("Main", data.items.usage.points, {stroke: {width: 1}});
+ var a = new dojox.charting.action2d.Tooltip(usagechart);
+ usagechart.render();
+ dojo.addClass('blockusageemptydiv', 'hidden');
+ dojo.removeClass('blockusagechartdiv', 'hidden');
+ dijit.byId('viewUsageDialog').show();
+ }
+ else if(data.items.status == 'empty') {
+ dojo.addClass('blockusagechartdiv', 'hidden');
+ dojo.removeClass('blockusageemptydiv', 'hidden');
+ dijit.byId('viewUsageDialog').show();
+ }
+}
+
Modified: vcl/trunk/web/js/code.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/code.js?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/js/code.js (original)
+++ vcl/trunk/web/js/code.js Thu Sep 11 16:01:48 2014
@@ -48,52 +48,47 @@ function testJS() {
document.getElementById('testjavascript').value = '1';
}
-function checkAllCompUtils() {
- var count = 0;
- var obj;
- while(obj = document.getElementById('comp' + count)) {
- obj.checked = true;
- document.getElementById('compid' + count).className = 'hlrow';
- toggledRows['compid' + count] = 1;
- count++;
- }
- return true;
-}
-
-function uncheckAllCompUtils() {
- var count = 0;
- var obj;
- while(obj = document.getElementById('comp' + count)) {
- obj.checked = false;
- document.getElementById('compid' + count).className = '';
- toggledRows['compid' + count] = 0;
- count++;
- }
- return true;
-}
-
-function reloadComputerSubmit() {
- var formobj = document.getElementById('utilform');
- var obj = document.getElementById('utilformcont');
- var contobj = document.getElementById('reloadcont');
- obj.value = contobj.value;
- formobj.submit();
-}
-
-function compStateChangeSubmit() {
- var formobj = document.getElementById('utilform');
- var obj = document.getElementById('utilformcont');
- var contobj = document.getElementById('statecont');
- obj.value = contobj.value;
- formobj.submit();
-}
-
-function compScheduleChangeSubmit() {
- var formobj = document.getElementById('utilform');
- var obj = document.getElementById('utilformcont');
- var contobj = document.getElementById('schcont');
- obj.value = contobj.value;
- formobj.submit();
+function RPCwrapper(data, CB, dojson, timeout) {
+ if(typeof timeout === 'undefined')
+ timeout = 15000;
+ if(dojson) {
+ return dojo.xhrPost({
+ url: 'index.php',
+ load: function(data, ioArgs) {returnCheck(CB, data, ioArgs);},
+ //load: CB,
+ //handleAs: "json",
+ error: errorHandler,
+ content: data,
+ timeout: timeout
+ });
+ }
+ else {
+ return dojo.xhrPost({
+ url: 'index.php',
+ load: CB,
+ error: errorHandler,
+ content: data,
+ timeout: timeout
+ });
+ }
+}
+
+function returnCheck(CB, data, ioArgs) {
+ try {
+ var json = dojo.fromJson(data);
+ }
+ catch(error) {
+ if(data.match(/<html/) || ! error.message.match(/syntax error/)) {
+ alert(_('Error encountered:') + " " + _('Please try again later'));
+ return;
+ }
+ var div = document.createElement('div');
+ div.innerHTML = data;
+ var msg = div.textContent || div.innerText || "";
+ alert(_('Error encountered:') + '\n\n' + msg);
+ return;
+ }
+ CB(json, ioArgs);
}
Array.prototype.inArray = function(data) {
@@ -114,7 +109,7 @@ Array.prototype.search = function(data)
return false;
}
-var genericCB = function(type, data, evt) {
+function generalCB(data, ioArgs) {
unsetLoading();
var regex = new RegExp('^<!DOCTYPE html');
if(data.match(regex)) {
@@ -125,7 +120,7 @@ var genericCB = function(type, data, evt
alert(mesg);
var d = {mode: 'errorrpt',
data: data};
- RPCwrapper(d, function(type, data, evt) {});
+ RPCwrapper(d, function(data, ioArgs) {});
return;
}
eval(data);
@@ -135,6 +130,7 @@ var errorHandler = function(error, ioArg
/*if(error.name == 'cancel')
return;
alert('AJAX Error: ' + error.message + '\nLine ' + error.lineNumber + ' in ' + error.fileName);*/
+ //console.log(error);
}
function errorHandler(data, ioArgs) {
@@ -149,38 +145,14 @@ function AJdojoCreate(objid) {
function setLoading() {
document.body.style.cursor = 'wait';
- if(dojo.widget.byId('workingDialog'))
- dojo.widget.byId('workingDialog').show();
+ if(dijit.byId('workingDialog'))
+ dijit.byId('workingDialog').show();
}
function unsetLoading() {
document.body.style.cursor = 'default';
- if(dojo.widget.byId('workingDialog'))
- dojo.widget.byId('workingDialog').hide();
-}
-
-function toggleRowSelect(id) {
- var row = document.getElementById(id);
- if(toggledRows[id] && toggledRows[id] == 1) {
- row.className = '';
- toggledRows[id] = 0;
- }
- else {
- row.className = 'hlrow';
- toggledRows[id] = 1;
- }
-}
-
-function toggleColSelect(id) {
- var col = document.getElementById(id);
- if(toggledCols[id] && toggledCols[id] == 1) {
- col.className = '';
- toggledCols[id] = 0;
- }
- else {
- col.className = 'hlcol';
- toggledCols[id] = 1;
- }
+ if(dijit.byId('workingDialog'))
+ dijit.byId('workingDialog').hide();
}
function updateMouseXY(e) {
@@ -345,3 +317,59 @@ function recenterDijitDialog(id) {
delete dijit.byId(id)._relativePosition;
dijit.byId(id)._position();
}
+
+function resizeRecenterDijitDialog(id) {
+ // taken from Dialog.js _size function
+ /*var d = dijit.byId(id);
+ var mb = dojo._getMarginSize(d.domNode);
+ var viewport = dojo.window.getBox();
+ if(mb.h >= viewport.h) {
+ // Reduce size of dialog contents so that dialog fits in viewport
+ var h = Math.min(mb.h, Math.floor(viewport.h * 0.75));
+ dojo.style(d.containerNode, {
+ height: h + "px",
+ overflow: "auto",
+ position: "relative" // workaround IE bug moving scrollbar or dragging dialog
+ });
+ }*/
+ dijit.byId(id)._size();
+ recenterDijitDialog(id);
+}
+
+function checkValidatedObj(objid, errobj) {
+ if(dijit.byId(objid) && ! dijit.byId(objid).get('disabled') &&
+ ! dijit.byId(objid).isValid()) {
+ dijit.byId(objid)._hasBeenBlurred = true;
+ dijit.byId(objid).validate();
+ //dijit.byId(objid).focus();
+ if(typeof errobj == 'string') {
+ if(dijit.byId(errobj))
+ dijit.byId(errobj).set('value', '');
+ else if(dojo.byId(errobj))
+ dojo.byId(errobj).innerHTML = '';
+ else
+ errobj = null;
+ }
+ if(errobj !== null && typeof errobj != 'undefined')
+ errobj.innerHTML = '';
+ return 0;
+ }
+ return 1;
+}
+
+function resetSelect(objid) {
+ if(dijit.byId(objid)) {
+ dijit.byId(objid).reset();
+ return;
+ }
+ var obj = dojo.byId(objid);
+ var found = 0;
+ for(var i = 0; i < obj.options.length; i++) {
+ if(obj.options[i].defaultSelected) {
+ obj.selectedIndex = i;
+ found = 1;
+ }
+ }
+ if(! found)
+ obj.selectedIndex = 0;
+}
Modified: vcl/trunk/web/js/dashboard.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/dashboard.js?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/js/dashboard.js (original)
+++ vcl/trunk/web/js/dashboard.js Thu Sep 11 16:01:48 2014
@@ -15,27 +15,7 @@
* limitations under the License.
*/
-function RPCwrapper(data, CB, dojson) {
- if(dojson) {
- dojo.xhrPost({
- url: 'index.php',
- load: CB,
- handleAs: "json",
- error: errorHandler,
- content: data,
- timeout: 15000
- });
- }
- else {
- dojo.xhrPost({
- url: 'index.php',
- load: CB,
- error: errorHandler,
- content: data,
- timeout: 15000
- });
- }
-}
+var refreshtimer;
function generalReqCB(data, ioArgs) {
eval(data);
@@ -61,7 +41,9 @@ function updateDashboardCB(data, ioArgs)
updateBlockAllocation(data.items.blockallocation);
if(dojo.byId('newreservations'))
updateNewReservations(data.items.newreservations);
- setTimeout(updateDashboard, 15000);
+ if(dojo.byId('failedimaging'))
+ updateFailedImaging(data.items.failedimaging);
+ refreshtimer = setTimeout(updateDashboard, 15000);
}
function updateStatus(data) {
@@ -157,11 +139,15 @@ function updateTopFailed(data) {
return;
}
var txt = '<table>';
+ txt += '<tr><th align="right">'
+ txt += 'Image</th><th>User</th><th>Reload</th></tr>'
for(var i = 0; i < data.length; i++) {
txt += '<tr><th align="right">'
+ data[i].prettyname
+ '</th><td>'
+ data[i].count
+ + '</td><td>'
+ + data[i].reloadcount
+ '</td></tr>';
}
txt += '</table>';
@@ -244,6 +230,74 @@ function updateNewReservations(data) {
obj.innerHTML = txt;
}
+function updateFailedImaging(data) {
+ var obj = dojo.byId('failedimaging');
+ var txt = '<table>';
+ txt += '<tr>'
+ + '<td></td>'
+ + '<th>Start</th>'
+ + '<th>ReqID</th>'
+ + '<th>Computer</th>'
+ + '<th>VM Host</th>'
+ + '<th>Image</th>'
+ + '<th>Owner</th>'
+ + '<th>Management Node</th>'
+ + '</tr>';
+ for(var i = 0; i < data.length; i++) {
+ if(i % 2)
+ txt += '<tr style=\"background-color: #D8D8D8;\">';
+ else
+ txt += '<tr style=\"background-color: #EEEEEE;\">';
+ txt += '<td style=\"padding: 1px; border-right: 1px solid;\">'
+ + '<button id=\"imgbtn' + data[i].id + '\" type=\"button\"></button>'
+ + '<input type=\"hidden\" id=\"iptimgbtn' + data[i].id + '\">'
+ + '</td><td style=\"padding: 1px; border-right: 1px solid;\">'
+ + data[i].start
+ + '</td><td style=\"padding: 1px; border-right: 1px solid;\">'
+ + data[i].id
+ + '</td><td style=\"padding: 1px; border-right: 1px solid;\">'
+ + data[i].computer
+ + '</td><td style=\"padding: 1px; border-right: 1px solid;\">'
+ + data[i].vmhost
+ + '</td><td style=\"padding: 1px; border-right: 1px solid;\">'
+ + data[i].image
+ + '</td><td style=\"padding: 1px; border-right: 1px solid;\">'
+ //+ data[i].installtype
+ + data[i].owner
+ + '</td><td style=\"padding: 1px; border-right: 1px solid;\">'
+ + data[i].managementnode
+ + '</td></tr>';
+ }
+ txt += '</table>';
+ obj.innerHTML = txt;
+ for(var i = 0; i < data.length; i++) {
+ var btnid = 'imgbtn' + data[i].id
+ if(dijit.byId(btnid))
+ dijit.byId(btnid).destroy(true);
+ dojo.byId('ipt' + btnid).value = data[i].contid;
+ var btn = new dijit.form.Button({
+ label: "Restart Imaging",
+ onClick: function() {
+ var contid = dojo.byId('ipt' + this.id).value;
+ RPCwrapper({continuation: contid}, restartImagingCB, 1);
+ }
+ }, btnid);
+ }
+}
+
+function restartImagingCB(data, ioArgs) {
+ if(data.items.status == 'noaccess') {
+ alert('You do not have access to restart the imaging process for this reservation');
+ return;
+ }
+ else if(data.items.status == 'wrongstate') {
+ alert('The state of this reservation changed and is no longer valid for restarting the reservation');
+ return;
+ }
+ clearTimeout(refreshtimer);
+ updateDashboard();
+}
+
function timestampToTime(val) {
if(! dijit.byId('reschart').chart.labeldata)
return '';
Modified: vcl/trunk/web/js/privileges.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/privileges.js?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/js/privileges.js (original)
+++ vcl/trunk/web/js/privileges.js Thu Sep 11 16:01:48 2014
@@ -16,28 +16,6 @@
*/
var currentOver = '';
-function RPCwrapper(data, CB, dojson) {
- if(dojson) {
- dojo.xhrPost({
- url: 'index.php',
- load: CB,
- handleAs: "json",
- error: errorHandler,
- content: data,
- timeout: 15000
- });
- }
- else {
- dojo.xhrPost({
- url: 'index.php',
- load: CB,
- error: errorHandler,
- content: data,
- timeout: 15000
- });
- }
-}
-
function generalPrivCB(data, ioArgs) {
eval(data);
unsetLoading2();
@@ -447,7 +425,10 @@ function submitAddUserGroup() {
var obj = dijit.byId('blockgrpchk');
if(obj.checked)
perms.push('block');
- for(var i = 0; obj = dijit.byId('usergrpck0:' + i); i++) {
+ obj = dijit.byId('usergrpck0:0');
+ if(obj.checked)
+ perms.push('cascade');
+ for(var i = 1; obj = dijit.byId('usergrpck0:' + i); i++) {
if(obj.checked)
perms.push(obj.name);
}
Modified: vcl/trunk/web/js/requests.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/requests.js?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/js/requests.js (original)
+++ vcl/trunk/web/js/requests.js Thu Sep 11 16:01:48 2014
@@ -17,27 +17,18 @@
var resSubmitted = 0;
var suggestTimeData = {}
var resbtntxt = '';
-
-function RPCwrapper(data, CB, dojson) {
- if(dojson) {
- dojo.xhrPost({
- url: 'index.php',
- load: CB,
- handleAs: "json",
- error: errorHandler,
- content: data,
- timeout: 30000
- });
- }
- else {
- dojo.xhrPost({
- url: 'index.php',
- load: CB,
- error: errorHandler,
- content: data,
- timeout: 30000
- });
- }
+var waittimetimeout = null;
+var durationchanged = 0;
+var initialimageset = 0;
+var resconfigmapid = 0;
+var revisiongrids;
+var waittimeobj;
+var waittimeh;
+
+var profilesstoredata = {
+ identifier: 'id',
+ label: 'name',
+ items: []
}
function generalReqCB(data, ioArgs) {
@@ -45,46 +36,502 @@ function generalReqCB(data, ioArgs) {
document.body.style.cursor = 'default';
}
+function initViewRequests(imaging) {
+ if(typeof(dijit) == "undefined" ||
+ typeof(dijit.byId) == "undefined" ||
+ typeof(images) == "undefined") {
+ setTimeout(function() {initViewRequests(imaging);}, 100);
+ return;
+ }
+ if(dijit.byId('deployimage'))
+ setLastImage();
+ if(imaging) {
+ if(imagingaccess == 0) {
+ var btn = new dijit.form.Button({
+ label: 'Close'
+ });
+ var dlg = new dijit.Dialog({
+ id: 'noimageaccessdlg',
+ title: 'Create / Update an Image',
+ content: 'You do not have access to create or update any images.<br><br>',
+ style: 'width: 300px; text-align: center;',
+ closable: false
+ });
+ dojo.style(dijit.byId('noimageaccessdlg').closeButtonNode, 'display', 'none');
+ dlg.containerNode.appendChild(btn.domNode);
+ dojo.connect(btn, "onClick", function () {dlg.destroy();});
+ dlg.show();
+ }
+ else {
+ dojo.byId('imagingrdo').checked = true;
+ selectResType();
+ dijit.byId('newResDlg').show();
+ }
+ }
+ setTimeout(function() {initialimageset = 1;}, 1);
+}
+
+function showNewResDlg() {
+ resetNewResDlg();
+ if(dojo.byId('basicrdo')) {
+ selectResType();
+ selectEnvironment();
+ }
+ if(dijit.byId('newResDlgBtn'))
+ dijit.byId('newResDlgBtn').set('disabled', false);
+ dijit.byId('newResDlg').show();
+}
+
+function resetNewResDlg() {
+ if(! dijit.byId('deployimage'))
+ return;
+ setLastImage();
+ dojo.byId('basicrdo').checked = true;
+ selectResType();
+ dijit.byId('deployprofileid').reset();
+ dijit.byId('deployname').reset();
+ resetSelect('deployadmingroup');
+ resetSelect('deploylogingroup');
+ //dijit.byId('deployfixedMAC').reset();
+ //dijit.byId('deploymonitored').reset();
+ dijit.byId('deployfixedIP').reset();
+ dijit.byId('deploynetmask').reset();
+ dijit.byId('deployrouter').reset();
+ dijit.byId('deploydns').reset();
+ resetSelect('deploystartday');
+ resetSelect('deployhour');
+ resetSelect('deploymin');
+ resetSelect('deploymeridian');
+ dojo.byId('startnow').checked = true;
+ if(dijit.byId('deploystartdate')) {
+ dijit.byId('deploystartdate')._hasBeenBlurred = false;
+ dijit.byId('deploystartdate').reset();
+ }
+ if(dijit.byId('deploystarttime')) {
+ dijit.byId('deploystarttime')._hasBeenBlurred = false;
+ dijit.byId('deploystarttime').reset();
+ }
+ if(dijit.byId('deployenddate')) {
+ dijit.byId('deployenddate')._hasBeenBlurred = false;
+ dijit.byId('deployenddate').reset();
+ }
+ if(dijit.byId('deployendtime')) {
+ dijit.byId('deployendtime')._hasBeenBlurred = false;
+ dijit.byId('deployendtime').reset();
+ }
+ resetSelect('reqlength');
+ if(dojo.byId('endduration'))
+ setTimeout(function() {
+ // have to reset again to clear warning icons
+ dijit.byId('deployendtime').reset();
+ dijit.byId('deployenddate').reset();
+ dojo.byId('endduration').checked = true;
+ }, 1);
+ dojo.byId('deployerr').innerHTML = '';
+}
+
+function setLastImage() {
+ var sel = dijit.byId('deployimage');
+ sel.set('value', lastimageid);
+ checkSelectedInList();
+}
+
+function selectResType() {
+ if(dojo.byId('basicrdo').checked || dojo.byId('imagingrdo').checked) {
+ dojo.removeClass('limitstart', 'hidden');
+ dojo.removeClass('durationend', 'hidden');
+ dojo.addClass('whentitleserver', 'hidden');
+ dojo.addClass('deployprofileslist', 'hidden');
+ dojo.addClass('nrnamespan', 'hidden');
+ dojo.addClass('nrservergroupspan', 'hidden');
+ //dojo.addClass('nrmacaddrspan', 'hidden');
+ //dojo.addClass('nrmonitoredspan', 'hidden');
+ dojo.addClass('nrfixedipdiv2', 'hidden');
+ dojo.addClass('anystart', 'hidden');
+ dojo.addClass('indefinteend', 'hidden');
+ //hideDijitButton('newResDlgShowConfigBtn'); // finishconfigs
+ if(dojo.byId('openend').value == 1) {
+ dojo.removeClass('endlbl', 'hidden');
+ dojo.removeClass('specifyend', 'hidden');
+ }
+ else {
+ dojo.addClass('endlbl', 'hidden');
+ dojo.addClass('specifyend', 'hidden');
+ }
+ if(dojo.byId('endat') && ! dojo.byId('endat').checked) {
+ dojo.byId('endduration').checked = true;
+ delayedUpdateWaitTime(0, 50);
+ }
+ }
+ if(dojo.byId('basicrdo').checked) {
+ dijit.byId('deployimage').set('query', {basic: 1, checkout: 1});
+ checkSelectedInList();
+ var imageid = getSelectValue('deployimage');
+ var item = dijit.byId('deployimage').get('item');
+ var max = imagestore.getValue(item, 'maxinitialtime');
+ if(max)
+ setMaxRequestLength(max);
+ else
+ setMaxRequestLength(defaultMaxTime);
+ dojo.removeClass('whentitlebasic', 'hidden');
+ dojo.addClass('whentitleimaging', 'hidden');
+ if(! durationchanged)
+ dojo.byId('reqlength').value = 60;
+ }
+ if(dojo.byId('imagingrdo').checked) {
+ dijit.byId('deployimage').set('query', {imaging: 1});
+ checkSelectedInList();
+ setMaxRequestLength(maximaging);
+ dojo.removeClass('whentitleimaging', 'hidden');
+ dojo.addClass('whentitlebasic', 'hidden');
+ if(! durationchanged)
+ dojo.byId('reqlength').value = 480;
+ }
+ if(dojo.byId('serverrdo').checked) {
+ dijit.byId('deployimage').set('query', {server: 1, checkout: 1});
+ checkSelectedInList();
+ dijit.byId('deploystarttime').set('required', true);
+ dijit.byId('deploystartdate').set('required', true);
+ dojo.addClass('waittime', 'hidden');
+ dojo.addClass('deployerr', 'hidden');
+ if(dojo.hasClass('anystart', 'hidden') &&
+ dojo.byId('startlater') &&
+ dojo.byId('startlater').checked) {
+ delayedUpdateWaitTime(0, 50);
+ }
+ dojo.addClass('whentitlebasic', 'hidden');
+ dojo.addClass('whentitleimaging', 'hidden');
+ dojo.addClass('limitstart', 'hidden');
+ dojo.addClass('durationend', 'hidden');
+ dojo.removeClass('whentitleserver', 'hidden');
+ if(profilesstore._arrayOfAllItems.length != 0)
+ dojo.removeClass('deployprofileslist', 'hidden');
+ dojo.removeClass('nrnamespan', 'hidden');
+ dojo.removeClass('nrservergroupspan', 'hidden');
+ //dojo.removeClass('nrmacaddrspan', 'hidden');
+ //dojo.removeClass('nrmonitoredspan', 'hidden');
+ dojo.removeClass('nrfixedipdiv2', 'hidden');
+ dojo.removeClass('anystart', 'hidden');
+ dojo.removeClass('indefinteend', 'hidden');
+ dojo.removeClass('endlbl', 'hidden');
+ dojo.removeClass('specifyend', 'hidden');
+ //showDijitButton('newResDlgShowConfigBtn'); // finishconfigs
+ if(dojo.byId('endat') && ! dojo.byId('endat').checked) {
+ dojo.byId('endindef').checked = true;
+ delayedUpdateWaitTime(0, 50);
+ }
+ }
+ resetDeployBtnLabel();
+ resizeRecenterDijitDialog('newResDlg');
+}
+
+function checkSelectedInList() {
+ var sel = dijit.byId('deployimage');
+ var q = new Object();
+ for(v in sel.query)
+ q[v] = sel.query[v];
+ q.id = sel.get('value');
+ sel.store.fetch({
+ query: q,
+ onComplete: function(items, request) {
+ if(items.length == 0)
+ setFirstAvailableImage();
+ }
+ });
+}
+
+function setFirstAvailableImage() {
+ var sel = dijit.byId('deployimage');
+ sel.store.fetch({
+ query: sel.query,
+ onItem: function(item, request) {
+ sel.set('value', item['id']);
+ },
+ count: 1
+ });
+}
+
function selectEnvironment() {
- var imageid = getSelectValue('imagesel');
- if(maxTimes[imageid])
- setMaxRequestLength(maxTimes[imageid]);
+ if(! initialimageset)
+ return;
+ var imageid = getSelectValue('deployimage');
+ var item = dijit.byId('deployimage').get('item');
+ var max = imagestore.getValue(item, 'maxinitialtime');
+ if(max)
+ setMaxRequestLength(max);
else
setMaxRequestLength(defaultMaxTime);
- updateWaitTime(1);
+ dijit.byId('deployname').reset();
+ delayedUpdateWaitTime(1, 50);
+}
+
+function delayedUpdateWaitTime(cleardesc, time) {
+ clearTimeout(waittimetimeout);
+ waittimetimeout = setTimeout(function() {updateWaitTime(cleardesc);}, time);
}
function updateWaitTime(cleardesc) {
if(! dojo.byId('waittime'))
return;
- var desconly = 0;
+ dojo.addClass('waittime', 'hidden');
+ if(! validateDeployInputs()) {
+ if(cleardesc) {
+ getImageDescription();
+ if(dojo.byId('serverrdo').checked)
+ configureSystem();
+ }
+ return;
+ }
+ dijit.byId('newResDlgBtn').set('disabled', false);
if(cleardesc)
dojo.byId('imgdesc').innerHTML = '';
- dojo.byId('waittime').innerHTML = '';
- if(! dojo.byId('timenow').checked) {
- dojo.byId('waittime').className = 'hidden';
- desconly = 1;
- }
- if(dojo.byId('openend') &&
- dojo.byId('openend').checked) {
- dojo.byId('waittime').className = 'hidden';
- desconly = 1;
- }
- var imageid = getSelectValue('imagesel');
- if(dojo.byId('reqlength'))
- var length = dojo.byId('reqlength').value;
+ var data = getDeployData(1);
+ data.continuation = dojo.byId('waitcontinuation').value;
+ document.body.style.cursor = 'wait';
+ /*if(typeof waittimeobj !== 'undefined')
+ waittimeobj.cancel();
+ waittimeobj = RPCwrapper(data, generalReqCB, 0, 30000);*/
+ RPCwrapper(data, generalReqCB, 0, 30000);
+ if(dojo.byId('serverrdo').checked)
+ configureSystem();
+}
+
+function validateDeployInputs() {
+ if(dijit.byId('deployimage') &&
+ ! checkValidatedObj('deployimage')) {
+ dijit.byId('newResDlgBtn').set('disabled', true);
+ return false;
+ }
+ if(dojo.byId('endat').checked &&
+ (! dijit.byId('deployenddate').isValid() ||
+ ! dijit.byId('deployendtime').isValid())) {
+ dijit.byId('newResDlgBtn').set('disabled', true);
+ if(! checkValidatedObj('deployenddate', 'deployerr') ||
+ ! checkValidatedObj('deployendtime', 'deployerr'))
+ return false;
+ }
+ if(dojo.byId('serverrdo').checked &&
+ dojo.byId('startlater') && dojo.byId('startlater').checked &&
+ (! dijit.byId('deploystartdate').isValid() ||
+ ! dijit.byId('deploystarttime').isValid())) {
+ dijit.byId('newResDlgBtn').set('disabled', true);
+ if(! checkValidatedObj('deploystartdate', 'deployerr') ||
+ ! checkValidatedObj('deploystarttime', 'deployerr'))
+ return false;
+ }
+ if(dojo.byId('serverrdo').checked &&
+ dijit.byId('deployfixedIP') &&
+ ! checkValidatedObj('deployfixedIP', 'deployerr')) {
+ return false;
+ }
+ var now = new Date();
+ now.setMilliseconds(0);
+ var nowts = parseInt(now.getTime() / 1000);
+ if(dojo.byId('startlater').checked) {
+ if(dojo.byId('serverrdo').checked) {
+ var start = dijit.byId('deploystartdate').get('value');
+ var time = dijit.byId('deploystarttime').get('value');
+ start.setHours(time.getHours());
+ start.setMinutes(time.getMinutes());
+ var teststart = parseInt(start.getTime() / 1000);
+ if(start < now) {
+ dojo.byId('deployerr').innerHTML = _('The start day and time must be in the future.');
+ dojo.removeClass('deployerr', 'hidden');
+ dijit.byId('newResDlgBtn').set('disabled', true);
+ return false;
+ }
+ }
+ else {
+ var tmp = dojo.byId('deploystartday').value;
+ var teststart = new Date(tmp * 1000);
+ var hour = parseInt(dojo.byId('deployhour').value);
+ var m = dojo.byId('deploymeridian').value;
+ if(m == 'pm' && hour < 12)
+ hour += 12;
+ else if(m == 'am' && hour == 12)
+ hour = 0;
+ teststart.setHours(hour);
+ teststart.setMinutes(dojo.byId('deploymin').value);
+ teststart.setSeconds(0);
+ if(teststart < now) {
+ dojo.byId('deployerr').innerHTML = _('The start day and time must be in the future.');
+ dojo.removeClass('deployerr', 'hidden');
+ dijit.byId('newResDlgBtn').set('disabled', true);
+ return false;
+ }
+ teststart = parseInt(teststart.getTime() / 1000);
+ }
+ }
+ if(dojo.byId('endat') && dojo.byId('endat').checked) {
+ var end = dijit.byId('deployenddate').get('value');
+ var time = dijit.byId('deployendtime').get('value');
+ end.setHours(time.getHours());
+ end.setMinutes(time.getMinutes());
+ var endts = parseInt(end.getTime() / 1000);
+ if(nowts + 1800 > endts) {
+ dojo.byId('deployerr').innerHTML = _('The end time must be at least 30 minutes in the future.');
+ dojo.removeClass('deployerr', 'hidden');
+ dijit.byId('newResDlgBtn').set('disabled', true);
+ return false;
+ }
+ if(dojo.byId('startnow').checked) {
+ var teststart = new Date();
+ teststart.setMilliseconds(0);
+ teststart = parseInt(teststart.getTime() / 1000);
+ }
+ if(teststart > endts) {
+ dojo.byId('deployerr').innerHTML = _('The end time must be after the start time.');
+ dojo.removeClass('deployerr', 'hidden');
+ dijit.byId('newResDlgBtn').set('disabled', true);
+ return false;
+ }
+ if(teststart + 1800 > endts) {
+ dojo.byId('deployerr').innerHTML = _('The end time is too close to the start time.');
+ dojo.removeClass('deployerr', 'hidden');
+ dijit.byId('newResDlgBtn').set('disabled', true);
+ return false;
+ }
+ }
+ if(! dojo.byId('serverrdo').checked)
+ return true;
+
+ if(! checkValidatedObj('deployname', 'deployerr') ||
+ ! checkValidatedObj('deployadmingroup', 'deployerr') ||
+ ! checkValidatedObj('deploylogingroup', 'deployerr') ||
+ //! checkValidatedObj('deployfixedMAC', 'deployerr') ||
+ ! checkValidatedObj('deploynetmask', 'deployerr') ||
+ ! checkValidatedObj('deployrouter', 'deployerr') ||
+ ! checkValidatedObj('deploydns', 'deployerr'))
+ return false;
+ return true;
+}
+
+function getDeployData(waitonly) {
+ var data = {imageid: getSelectValue('deployimage')}
+ if(dojo.byId('startlater').checked) {
+ if(dojo.byId('serverrdo').checked) {
+ var start = dijit.byId('deploystartdate').get('value');
+ var time = dijit.byId('deploystarttime').get('value');
+ start.setHours(time.getHours());
+ start.setMinutes(time.getMinutes());
+ data.start = parseInt(start.getTime() / 1000);
+ }
+ else {
+ var tmp = dojo.byId('deploystartday').value;
+ var date = new Date(tmp * 1000);
+ var hour = parseInt(dojo.byId('deployhour').value);
+ var m = dojo.byId('deploymeridian').value;
+ if(m == 'pm' && hour < 12)
+ hour += 12;
+ else if(m == 'am' && hour == 12)
+ hour = 0;
+ date.setHours(hour);
+ date.setMinutes(dojo.byId('deploymin').value);
+ date.setSeconds(0);
+ data.start = parseInt(date.getTime() / 1000);
+ }
+ }
+ else {
+ data.start = 'zero';
+ }
+ if(dojo.byId('endindef') && dojo.byId('endindef').checked) {
+ data.ending = 'indefinite';
+ }
+ else if(dojo.byId('endat') && dojo.byId('endat').checked) {
+ data.ending = 'endat';
+ var end = dijit.byId('deployenddate').get('value');
+ var time = dijit.byId('deployendtime').get('value');
+ end.setHours(time.getHours());
+ end.setMinutes(time.getMinutes());
+ data.end = parseInt(end.getTime() / 1000);
+ }
+ else {
+ data.ending = 'duration';
+ data.duration = dojo.byId('reqlength').value;
+ }
+ if(dojo.byId('basicrdo').checked)
+ data.type = 'basic';
+ else if(dojo.byId('imagingrdo').checked)
+ data.type = 'imaging';
+ else if(dojo.byId('serverrdo').checked)
+ data.type = 'server';
+ if(dojo.byId('serverrdo').checked &&
+ dijit.byId('deployfixedIP') &&
+ dijit.byId('deployfixedIP').get('value') != '') {
+ data.fixedIP = dijit.byId('deployfixedIP').get('value');
+ }
+ if(waitonly)
+ return data;
+
+ // finishconfigs
+ /*if(dojo.byId('serverrdo').checked)
+ data.configdata = getConfigData();*/
+ data.profileid = dojo.byId('appliedprofileid').value;
+ data.name = dijit.byId('deployname').get('value');
+ data.admingroupid = getSelectValue('deployadmingroup');
+ data.logingroupid = getSelectValue('deploylogingroup');
+ data.ipaddr = dijit.byId('deployfixedIP').get('value');
+ if(data.ipaddr != '') {
+ data.netmask = dijit.byId('deploynetmask').get('value');
+ data.router = dijit.byId('deployrouter').get('value');
+ data.dns = dijit.byId('deploydns').get('value');
+ }
+ else {
+ data.netmask = '';
+ data.router = '';
+ data.dns = '';
+ }
+ /*data.macaddr = dijit.byId('deployfixedMAC').get('value');
+ if(dijit.byId('deploymonitored').get('value') == 'on')
+ data.monitored = 1;
else
- var length = 480;
- var contid = dojo.byId('waitcontinuation').value;
- var data = {continuation: contid,
- imageid: imageid,
- length: length,
- desconly: desconly};
- if(! desconly)
- dojo.byId('waittime').className = 'shown';
- //setLoading();
- document.body.style.cursor = 'wait';
- RPCwrapper(data, generalReqCB);
+ data.monitored = 0;*/
+ return data;
+}
+
+function getConfigData() {
+ var configdata = [];
+ var tmp = configlist.store._getItemsArray();
+ for(var i = 0; i < tmp.length; i++) {
+ var cfg = '';
+ var ids = tmp[i]['id'][0].split('/');
+ cfg = '"' + tmp[i]['id'];
+ cfg += '":{"id":"' + tmp[i]['id'];
+ cfg += '","applied":"' + tmp[i]['applied'];
+ if(parseInt(ids[1]) < 0) {
+ cfg += '","configid":"' + tmp[i]['configid'];
+ cfg += '","configstageid":"' + tmp[i]['configstageid'];
+ cfg += '","imageid":"' + tmp[i]['imageid'];
+ }
+ cfg += '"}';
+ configdata.push(cfg);
+ }
+ var allcfgs = configdata.join(',');
+
+ var configvardata = [];
+ var tmp = dijit.byId('configvariables').store._getItemsArray();
+ for(var i = 0; i < tmp.length; i++) {
+ var cfgvar = '';
+ cfgvar = '"' + tmp[i]['id'];
+ cfgvar += '":{"id":"' + tmp[i]['id'];
+ cfgvar += '","value":"' + tmp[i]['defaultvalue'][0].replace(/\n/g, '\\n');
+ cfgvar += '"}';
+ configvardata.push(cfgvar);
+ }
+ var allcfgvars = configvardata.join(',');
+ return '{"configs":{' + allcfgs + '},"configvars":{' + allcfgvars + '}}';
+ //return '{"configs":{' + allcfgs + '}}';
+}
+
+function getImageDescription() {
+ if(dijit.byId('deployimage') &&
+ ! checkValidatedObj('deployimage'))
+ return;
+ dojo.byId('imgdesc').innerHTML = '';
+ var data = {continuation: dojo.byId('waitcontinuation').value,
+ desconly: 1,
+ imageid: getSelectValue('deployimage')}
+ RPCwrapper(data, generalReqCB, 0, 30000);
}
function showSuggestedTimes() {
@@ -95,10 +542,11 @@ function showSuggestedTimes() {
dijit.byId('suggestedTimes').show();
dojo.byId('suggestContent').innerHTML = '';
dojo.removeClass('suggestloading', 'hidden');
+ dijit.byId('suggestDlgBtn').set('disabled', true);
showDijitButton('suggestDlgBtn');
dijit.byId('suggestDlgCancelBtn').set('label', _('Cancel'));
var data = {continuation: dojo.byId('suggestcont').value};
- RPCwrapper(data, showSuggestedTimesCB, 1);
+ RPCwrapper(data, showSuggestedTimesCB, 1, 30000);
document.body.style.cursor = 'wait';
}
@@ -137,39 +585,67 @@ function setSuggestSlot(slot) {
dijit.byId('suggestDlgBtn').set('disabled', false);
}
-function useSuggestedSlot() {
+function useSuggestedEditSlot() {
var slot = suggestTimeData[dojo.byId('selectedslot').value];
- dojo.byId('laterradio').checked = true;
- var s = new Date(parseInt(slot['startts'] + '000'));
- dojo.byId('reqday').value = dojox.string.sprintf('%d/%d/%d', s.getMonth() + 1, s.getDate(), s.getFullYear());
- var hm = get12from24(s.getHours());
- dojo.byId('reqhour').value = hm['hour'];
- dojo.byId('reqmeridian').value = hm['meridian'];
- var min = s.getMinutes();
- if(min == 0)
- dojo.byId('reqmin').value = 'zero';
+ var start = parseInt(slot['startts'] + '000');
+ var s = new Date(start);
+ if(slot['startts'] == dojo.byId('selectedslot').value)
+ var e = new Date(start + parseInt(slot['duration'] + '000'));
else
- dojo.byId('reqmin').value = min;
- dojo.byId('reqlength').value = slot['duration'] / 60;
- dojo.byId('waittime').className = 'hidden';
+ var e = new Date(parseInt(dojo.byId('selectedslot').value + '000'));
+ var testend = new Date(2038, 0, 1, 0, 0, 0, 0);
+ if(dojo.byId('deploystartday')) {
+ var sel = dojo.byId('deploystartday');
+ for(var i = 0; i < sel.options.length; i++) {
+ var testdate = new Date(parseInt(sel.options[i].value + '000'));
+ if(s.getDay() == testdate.getDay()) {
+ sel.value = sel.options[i].value;
+ break;
+ }
+ }
+ var hour = s.getHours();
+ if(hour == 0) {
+ dojo.byId('deployhour').value = 12;
+ dojo.byId('deploymeridian').value = 'am';
+ }
+ else if(hour == 12) {
+ dojo.byId('deployhour').value = 12;
+ dojo.byId('deploymeridian').value = 'pm';
+ }
+ else if(hour > 12) {
+ dojo.byId('deployhour').value = hour - 12;
+ dojo.byId('deploymeridian').value = 'pm';
+ }
+ else {
+ dojo.byId('deployhour').value = hour;
+ dojo.byId('deploymeridian').value = 'am';
+ }
+ dojo.byId('deploymin').value = s.getMinutes();
+ dojo.byId('startlater').checked = true;
+ }
+ if(dojo.byId('endduration') && dojo.byId('endduration').checked)
+ dojo.byId('reqlength').value = parseInt(slot['duration'] / 60);
+ if(dojo.byId('endat') && dojo.byId('endat').checked) {
+ dijit.byId('deployenddate').set('value', e);
+ dijit.byId('deployendtime').set('value', e);
+ }
+ if(dojo.byId('startlater') && dojo.byId('startlater').checked) {
+ dijit.byId('deploystartdate').set('value', s);
+ dijit.byId('deploystarttime').set('value', s);
+ }
dijit.byId('suggestedTimes').hide();
- updateWaitTime(0);
+ delayedUpdateWaitTime(0, 50);
}
function selectLater() {
dojo.byId('laterradio').checked = true;
- if(dojo.byId('newsubmit')) {
+ if(dijit.byId('newResDlgBtn')) {
if(resbtntxt != '')
- dojo.byId('newsubmit').value = resbtntxt;
+ dijit.byId('newResDlgBtn').set('label', resbtntxt);
else
- dojo.byId('newsubmit').value = _('Create Reservation');
+ dijit.byId('newResDlgBtn').set('label', _('Create Reservation'));
}
- dojo.byId('waittime').innerHTML = '';
-}
-
-function selectDuration() {
- if(dojo.byId('durationradio'))
- dojo.byId('durationradio').checked = true;
+ dojo.addClass('waittime', 'hidden');
}
function selectLength() {
@@ -205,14 +681,82 @@ function setOpenEnd() {
t.getMinutes());
}
+function setStartNow() {
+ dijit.byId('deploystarttime').set('required', false);
+ dijit.byId('deploystartdate').set('required', false);
+ dojo.addClass('waittime', 'hidden');
+ dojo.addClass('deployerr', 'hidden');
+ delayedUpdateWaitTime(0, 1000);
+ resetDeployBtnLabel();
+}
+
+function setStartLater() {
+ dojo.byId('startlater').checked = true;
+ if(dojo.byId('basicrdo').checked) {
+ dijit.byId('deploystarttime').set('required', false);
+ dijit.byId('deploystartdate').set('required', false);
+ }
+ else {
+ dijit.byId('deploystarttime').set('required', true);
+ dijit.byId('deploystartdate').set('required', true);
+ }
+ dojo.addClass('deployerr', 'hidden');
+ dojo.addClass('waittime', 'hidden');
+ delayedUpdateWaitTime(0, 1000);
+ resetDeployBtnLabel();
+}
+
+function durationChange() {
+ durationchanged = 1;
+}
+
+function setEndDuration() {
+ if(dojo.byId('endduration'))
+ dojo.byId('endduration').checked = true;
+ dijit.byId('deployendtime').set('required', false);
+ dijit.byId('deployenddate').set('required', false);
+ dojo.addClass('deployerr', 'hidden');
+ dojo.addClass('waittime', 'hidden');
+ delayedUpdateWaitTime(0, 1000);
+ resetDeployBtnLabel();
+}
+
+function setEndIndef() {
+ dijit.byId('deployendtime').set('required', false);
+ dijit.byId('deployenddate').set('required', false);
+ dojo.addClass('deployerr', 'hidden');
+ dojo.addClass('waittime', 'hidden');
+ delayedUpdateWaitTime(0, 1000);
+ resetDeployBtnLabel();
+}
+
+function setEndAt() {
+ dojo.byId('endat').checked = true;
+ dijit.byId('deployendtime').set('required', true);
+ dijit.byId('deployenddate').set('required', true);
+ dojo.addClass('deployerr', 'hidden');
+ dojo.addClass('waittime', 'hidden');
+ delayedUpdateWaitTime(0, 1000);
+ resetDeployBtnLabel();
+}
+
+function resetDeployBtnLabel() {
+ if(dojo.byId('basicrdo').checked)
+ dijit.byId('newResDlgBtn').set('label', _("Create Reservation"));
+ if(dojo.byId('imagingrdo').checked)
+ dijit.byId('newResDlgBtn').set('label', _("Create Imaging Reservation"));
+ if(dojo.byId('serverrdo').checked)
+ dijit.byId('newResDlgBtn').set('label', _("Deploy Server"));
+}
+
function checkValidImage() {
if(resSubmitted)
return false;
- if(dijit.byId('imagesel') && ! dijit.byId('imagesel').isValid()) {
+ if(dijit.byId('deployimage') && ! dijit.byId('deployimage').isValid()) {
alert(_('Please select a valid environment.'));
return false;
}
- if(dojo.byId('newsubmit').value == _('View Available Times')) {
+ if(dijit.byId('newResDlgBtn').get('label') == _('View Available Times')) {
showSuggestedTimes();
return false;
}
@@ -226,6 +770,8 @@ function setMaxRequestLength(minutes) {
var text;
var newminutes;
var tmp;
+ var saveduration = obj.options[obj.selectedIndex].value;
+ var saveindex = obj.selectedIndex;
for(i = obj.length - 1; i >= 0; i--) {
if(parseInt(obj.options[i].value) > minutes)
obj.options[i] = null;
@@ -271,6 +817,422 @@ function setMaxRequestLength(minutes) {
}
obj.options[i + 1] = new Option(text, newminutes);
}
+ if(saveindex > i)
+ obj.value = minutes;
+ else
+ obj.value = saveduration;
+}
+
+function configureSystem() {
+ return; // finishconfigs
+ var data = {continuation: dojo.byId('configcont').value,
+ imageid: getSelectValue('deployimage')};
+ RPCwrapper(data, configureSystemCB, 1, 30000);
+}
+
+function configureSystemCB(data, ioArgs) {
+ var vardata = {identifier: 'id', label: 'name', items: data.items.configs};
+ var newstore = new dojo.data.ItemFileWriteStore({data: vardata});
+ var oldstore = configlist.store;
+ configlist.setStore(newstore);
+ delete oldstore;
+
+ var vardata2 = {identifier: 'id', label: 'name', items: data.items.variables};
+ var newstore2 = new dojo.data.ItemFileWriteStore({data: vardata2});
+ oldstore = dijit.byId('configvariables').store;
+ dijit.byId('configvariables').setStore(newstore2, '', {query: {id: ''}});
+ delete oldstore;
+
+ // finishconfigs
+ /*if(data.items.configs.length == 0)
+ dijit.byId('newResDlgShowConfigBtn').set('disabled', true);
+ else
+ dijit.byId('newResDlgShowConfigBtn').set('disabled', false);*/
+
+ if(dijit.byId('clustertree'))
+ dijit.byId('clustertree').destroy();
+ if(data.items.cluster) {
+ dojo.removeClass('clusterdiv', 'hidden');
+ var treedata = {identifier: 'id', label: 'image', items: data.items.subimages};
+ var store = new dojo.data.ItemFileReadStore({data: treedata});
+ var model = new dijit.tree.ForestStoreModel({
+ store: store,
+ query: {id: '*'},
+ rootId: 'root',
+ rootLabel: dijit.byId('deployimage').attr('displayedValue'),
+ childrenAttrs: ['children']
+ });
+ var div = document.createElement('div');
+ dojo.byId('treeparent').appendChild(div);
+ var tree = dijit.Tree({model: model, id: 'clustertree', onClick: subimageSelected}, div);
+ }
+ else {
+ dojo.addClass('clusterdiv', 'hidden');
+ }
+}
+
+function showConfigureSystem() {
+ if(dojo.hasClass('clusterdiv', 'hidden'))
+ setTimeout(function() {configlist.setQuery({id: '*'});}, 1);
+ else
+ setTimeout(function() {
+ configlist.setQuery({id: '0/*', cluster: 0});
+ var tree = dijit.byId('clustertree');
+ tree.attr('path', ['root']);
+ var node = tree._itemNodesMap['root'];
+ tree.focusNode(node[0]);
+ }, 1);
+ dojo.addClass('configdatadiv', 'hidden');
+ dijit.byId('newResConfigDlg').show();
+}
+
+function closeConfigureSystem() {
+ dijit.byId('newResConfigDlg').hide();
+ saveSelectedConfig();
+ if(configlist.selection.selectedIndex >= 0)
+ configlist.selection.setSelected(configlist.selection.selectedIndex, false);
+ dojo.byId('configtype').innerHTML = '';
+ dojo.byId('configapplychk').checked = false;
+ dojo.byId('configkey').innerHTML = '';
+ dijit.byId('configvalueint').reset();
+ dijit.byId('configvaluefloat').reset();
+ dijit.byId('configvaluestring').reset();
+ dijit.byId('configvaluetext').reset();
+ dojo.addClass('configvalint', 'hidden');
+ dojo.removeClass('configvalstring', 'hidden');
+ dijit.byId('configvariables').setStore(dijit.byId('configvariables').store, '', {query: {configid: ''}});
+}
+
+function subimageSelected(item) {
+ if(item.id == 'root')
+ var searchid = 0;
+ else
+ var searchid = item.id[0];
+ configlist.setQuery({id: searchid + '/*', cluster: 0});
+ configlist.selection.clear();
+ dojo.byId('configtype').innerHTML = '';
+ dojo.byId('configapplychk').checked = false;
+ dojo.addClass('configdatadiv', 'hidden');
+}
+
+function addReservationConfig() {
+ var item = dijit.byId('addconfigsel').get('item');
+ var newitem = {};
+ var node = dijit.byId('clustertree').selectedItem;
+ if(node.id == 'root') {
+ var subimageid = 0;
+ var imageid = dijit.byId('deployimage').value;
+ }
+ else {
+ var subimageid = node.id[0];
+ var imageid = node.childimageid[0];
+ }
+ newitem.configmaptype = 'Reservation';
+ resconfigmapid--;
+ //newitem.configmaptypeid = '5'; // TODO rather not hard code this
+ newitem.configid = item.id;
+ newitem.id = subimageid + '/' + resconfigmapid;
+ newitem.config = item.name;
+ newitem.configdata = item.data;
+ newitem.subid = 1;
+ newitem.affiliationid = 1;
+ newitem.affiliation = '';
+ newitem.configstageid = 1; // TODO set this from another select object
+ newitem.configstage = '';
+ newitem.subimageid = null;
+ newitem.configsubimageid = null;
+ newitem.disabled = 0;
+ newitem.configmapid = resconfigmapid;
+ newitem.cluster = 0;
+ newitem.applied = true;
+ newitem.configdata = item.data;
+ newitem.ownerid = item.ownerid;
+ newitem.owner = item.owner;
+ newitem.configtype = item.configtype;
+ newitem.configtypeid = item.configtypeid;
+ newitem.imageid = imageid;
+ configlist.store.newItem(newitem);
+ setTimeout(function() {configlist.setQuery({id: subimageid + '/*', cluster: 0});}, 1);
+ for(var i = 0; i < item.variables.length; i++) {
+ var fromvar = item.variables[i];
+ var newvar = {};
+ newvar.id = newitem.id + '/' + fromvar.id; // configid/configvariableid - configid is of form configsubimageid/configmapid
+ newvar.name = fromvar.name;
+ newvar.description = '';
+ newvar.configid = fromvar.configid;
+ newvar.type = '';
+ newvar.datatype = fromvar.datatype;
+ newvar.datatypeid = fromvar.datatypeid;
+ newvar.defaultvalue = fromvar.defaultvalue;
+ newvar.required = fromvar.required;
+ newvar.identifier = fromvar.identifier;
+ newvar.ask = parseInt(fromvar.ask);
+ dijit.byId('configvariables').store.newItem(newvar);
+ }
+}
+
+function configSelected(rowIndex) {
+ var item = configlist.getItem(rowIndex);
+ var store = configlist.store;
+ dojo.byId('configtype').innerHTML = store.getValue(item, 'configtype');
+ var optional = store.getValue(item, 'optional');
+ if(! optional) {
+ dojo.byId('configapplychk').checked = true;
+ dojo.byId('configapplychk').disabled = true;
+ }
+ else {
+ dojo.byId('configapplychk').disabled = false;
+ if(store.getValue(item, 'applied'))
+ dojo.byId('configapplychk').checked = true;
+ else
+ dojo.byId('configapplychk').checked = false;
+ }
+
+ var configtype = store.getValue(item, 'configtype');
+ if(configtype == 'VLAN' || configtype == 'Cluster')
+ dojo.addClass('configdatadiv', 'hidden');
+ else {
+ dijit.byId('viewconfigdatabtn').set('disabled', false);
+ dijit.byId('configvariables').set('disabled', false);
+ dijit.byId('configvariables').setStore(dijit.byId('configvariables').store, '', {query: {id: store.getValue(item, 'id') + '/*', ask: 1}});
+ if(dijit.byId('configvariables').options.length)
+ dojo.removeClass('configvariablediv', 'hidden');
+ else
+ dojo.addClass('configvariablediv', 'hidden');
+ dojo.removeClass('configdatadiv', 'hidden');
+ }
+}
+
+function setApplyConfig() {
+ var item = configlist.getItem(configlist.selection.selectedIndex);
+ var store = configlist.store;
+ if(dojo.byId('configapplychk').checked)
+ store.setValue(item, 'applied', true);
+ else
+ store.setValue(item, 'applied', false);
+}
+
+function showConfigData() {
+ var item = configlist.getItem(configlist.selection.selectedIndex);
+ var store = configlist.store;
+ var data = store.getValue(item, 'configdata');
+ dijit.byId('configdatadlg').set('content', data.replace(/\n/g, "<br>"));
+}
+
+function selectConfigVariable() {
+ var store = dijit.byId('configvariables').store;
+ store.fetch({
+ query: {id: dijit.byId('configvariables').get('value')},
+ onItem: function(item, request) {
+ dojo.byId('configkey').innerHTML = store.getValue(item, 'identifier');
+ var type = store.getValue(item, 'datatype');
+ var value = store.getValue(item, 'defaultvalue');
+ dojo.addClass('configvalbool', 'hidden');
+ dojo.addClass('configvalint', 'hidden');
+ dojo.addClass('configvalfloat', 'hidden');
+ dojo.addClass('configvalstring', 'hidden');
+ dojo.addClass('configvaltext', 'hidden');
+ dojo.removeClass('configval' + type, 'hidden');
+ dijit.byId('configvalue' + type).set('value', value);
+ if(store.getValue(item, 'required'))
+ dojo.byId('configrequired').innerHTML = 'yes';
+ else
+ dojo.byId('configrequired').innerHTML = 'no';
+ }
+ });
+}
+
+function saveSelectedConfig() {
+ if(configlist.selection.selectedIndex < 0)
+ return;
+ var item = configlist.getItem(configlist.selection.selectedIndex);
+ var store = configlist.store;
+ if(store.getValue(item, 'optional') && dojo.byId('configapplychk').checked)
+ store.setValue(item, 'applied', true);
+}
+
+function saveSelectedConfigVar() {
+ var store = dijit.byId('configvariables').store;
+ store.fetch({
+ query: {id: dijit.byId('configvariables').get('value')},
+ onItem: function(item, request) {
+ var type = store.getValue(item, 'datatype');
+ store.setValue(item, 'defaultvalue', dijit.byId('configvalue' + type).get('value'));
+ }
+ });
+}
+
+function promptRevisions() {
+ document.body.style.cursor = 'wait';
+ var item = dijit.byId('deployimage').get('item');
+ var imageid = imagestore.getValue(item, 'id');
+ if(dijit.byId('imageRevisionDlg'))
+ dijit.byId('imageRevisionDlg').destroyRecursive();
+ var divall = document.createElement('div');
+ var div1 = document.createElement('div');
+ div1.innerHTML = _("There are multiple versions of this environment available.") + "<br>" +
+ _("Please select the version you would like to check out:");
+ divall.appendChild(div1);
+ var div2 = document.createElement('div');
+ div2.id = 'imageRevisionContent';
+ div2.style.height = "85%";
+ div2.style.width = "88%";
+ div2.style.overflow = "auto";
+ divall.appendChild(div2);
+ var div3 = document.createElement('div');
+ div3.style.textAlign = "center";
+ var btn1 = new dijit.form.Button({
+ id: 'imageRevBtn',
+ label: dijit.byId('newResDlgBtn').label,
+ }, document.createElement('div'));
+ dojo.connect(btn1, 'onClick', submitNewReservation);
+ div3.appendChild(btn1.domNode);
+ var btn2 = new dijit.form.Button({
+ label: _('Cancel'),
+ }, document.createElement('div'));
+ dojo.connect(btn2, 'onClick', function() {dijit.byId('imageRevisionDlg').hide();});
+ div3.appendChild(btn2.domNode);
+ divall.appendChild(div3);
+ var dlg = new dijit.Dialog({
+ id: 'imageRevisionDlg',
+ title: _('Select Image Revisions'),
+ content: divall,
+ width: "50%",
+ style: "width: 50%",
+ autofocus: false
+ });
+ detailimagestore.get(imageid).then(promptRevisionsCB);
+}
+
+function promptRevisionsCB(item) {
+ revisiongrids = new Array();
+ addRevisionSelection(item);
+ if(! dojo.byId('imagingrdo').checked &&
+ item.imagemetaid != null &&
+ item.subimages.length) {
+ for(var i = 0; i < item.subimages.length; i++) {
+ detailimagestore.get(item.subimages[i]).then(function(item) {addRevisionSelection(item);});
+ }
+ }
+ dijit.byId('newResDlgBtn').set('disabled', false);
+ if(! dojo.byId('imagingrdo').checked &&
+ item.imagemetaid != null &&
+ item.subimages.length)
+ setTimeout(function() {showRevisionDlg(item.subimages.length + 1);}, 100);
+ else
+ showRevisionDlg(1);
+}
+
+function addRevisionSelection(item) {
+ var mstore = new dojo.store.Memory({data: item.imagerevision});
+ var wrapper = new dojo.data.ObjectStore({objectStore: mstore});
+ var layout = [
+ {field: 'revision', name: 'Revision', width: '60px'},
+ {field: 'user', name: 'User', width: '130px'},
+ {field: 'prettydate', name: 'Created', width: '110px'},
+ {field: 'production', name: 'Production', width: '60px'}
+ ];
+ var div = document.createElement('div');
+ div.style.width = "100%";
+ var grid = new dojox.grid.DataGrid(
+ {
+ store: wrapper,
+ structure: layout,
+ autoHeight: true
+ },
+ div
+ );
+ grid.startup();
+ var node = document.createElement('b');
+ node.innerHTML = '<br><big>' + item.prettyname + ':</big>';
+ dojo.byId('imageRevisionContent').appendChild(node);
+ dojo.byId('imageRevisionContent').appendChild(grid.domNode);
+ grid.render();
+ var newobj = new Object();
+ newobj.grid = grid;
+ newobj.imageid = item.id;
+ revisiongrids.push(newobj);
+}
+
+function showRevisionDlg(count) {
+ if(revisiongrids.length == count) {
+ var waiting = 0;
+ for(var i = 0; i < count; i++) {
+ revisiongrids[i].grid.render();
+ if(! revisiongrids[i].grid._isLoaded) {
+ waiting = 1;
+ break;
+ }
+ }
+ if(! waiting) {
+ document.body.style.cursor = 'default';
+ dijit.byId('imageRevisionDlg').show();
+ dijit.byId('imageRevisionDlg').domNode.childNodes[3].style.width = "96%";
+ return;
+ }
+ }
+ setTimeout(function() {showRevisionDlg(count);}, 100);
+}
+
+function submitNewReservation() {
+ if(! validateDeployInputs()) {
+ return;
+ }
+ if(dijit.byId('newResDlgBtn').get('label') == _('View Available Times')) {
+ showSuggestedTimes();
+ return;
+ }
+ if(! dijit.byId('imageRevisionDlg') || ! dijit.byId('imageRevisionDlg').open) {
+ var item = dijit.byId('deployimage').get('item');
+ if(imagestore.getValue(item, 'revisions')) {
+ dijit.byId('newResDlgBtn').set('disabled', true);
+ promptRevisions();
+ return;
+ }
+ }
+ var data = getDeployData(0);
+ if(dijit.byId('imageRevisionDlg') && dijit.byId('imageRevisionDlg').open) {
+ revids = new Array();
+ for(var i = 0; i < revisiongrids.length; i++) {
+ var sel = revisiongrids[i].grid.selection.getSelected();
+ if(sel.length)
+ revids.push(sel[0].id);
+ else
+ revids.push(0);
+ }
+ data.revisionid = revids.join(':');
+ dijit.byId('imageRevBtn').set('label', _('Working...'));
+ dijit.byId('imageRevBtn').set('disabled', true);
+ }
+ else {
+ dijit.byId('newResDlgBtn').set('disabled', true);
+ }
+ data.continuation = dojo.byId('deploycont').value;
+ RPCwrapper(data, submitNewReservationCB, 1, 30000);
+}
+
+function submitNewReservationCB(data, ioArgs) {
+ if(dijit.byId('imageRevisionDlg') && dijit.byId('imageRevisionDlg').open) {
+ dijit.byId('imageRevisionDlg').hide();
+ dojo.byId('imageRevisionContent').innerHTML = '';
+ dijit.byId('imageRevBtn').set('label', dijit.byId('newResDlgBtn').label);
+ dijit.byId('imageRevBtn').set('disabled', false);
+ }
+ dijit.byId('newResDlgBtn').set('disabled', false);
+ if(data.items.err == 1) {
+ dojo.removeClass('deployerr', 'hidden');
+ dojo.byId('deployerr').innerHTML = data.items.errmsg;
+ dojo.byId('waittime').innerHTML = '';
+ return;
+ }
+ else if(data.items.err == 2) {
+ delayedUpdateWaitTime(0, 50);
+ return;
+ }
+ else if(data.items.err == 0) {
+ resRefresh();
+ dijit.byId('newResDlg').hide();
+ }
}
function checkTimeouts() {
@@ -302,7 +1264,7 @@ function resRefresh() {
incdetails: incdetails};
if(dojo.byId('detailreqid'))
data.reqid = dojo.byId('detailreqid').value;
- RPCwrapper(data, generalReqCB);
+ RPCwrapper(data, generalReqCB, 0, 30000);
}
function showResStatusPane(reqid) {
@@ -340,8 +1302,18 @@ function showWindow(name) {
obj.show();
}
+function connectRequest(cont) {
+ RPCwrapper({continuation: cont}, connectRequestCB, 1);
+}
+
+function connectRequestCB(data, ioArgs) {
+ dijit.byId('connectDlgContent').set('content', data.items.html);
+ dijit.byId('connectDlg').show();
+ setTimeout(checkConnectTimeout, 15000);
+}
+
function endReservation(cont) {
- RPCwrapper({continuation: cont}, endReservationCB, 1);
+ RPCwrapper({continuation: cont}, endReservationCB, 1, 30000);
}
function endReservationCB(data, ioArgs) {
@@ -360,7 +1332,7 @@ function submitDeleteReservation() {
if(dojo.byId('radioprod')) {
if(dojo.byId('radioprod').checked) {
var cont = dojo.byId('radioprod').value;
- RPCwrapper({continuation: cont}, endReservationCB, 1);
+ RPCwrapper({continuation: cont}, endReservationCB, 1, 30000);
return;
}
else if(dojo.byId('radioend').checked)
@@ -374,11 +1346,11 @@ function submitDeleteReservation() {
dojo.byId('endResDlgContent').innerHTML = '';
dijit.byId('endResDlg').hide();
document.body.style.cursor = 'wait';
- RPCwrapper(data, generalReqCB);
+ RPCwrapper(data, generalReqCB, 0, 30000);
}
function removeReservation(cont) {
- RPCwrapper({continuation: cont}, removeReservationCB, 1);
+ RPCwrapper({continuation: cont}, removeReservationCB, 1, 30000);
}
function removeReservationCB(data, ioArgs) {
@@ -398,12 +1370,12 @@ function submitRemoveReservation() {
dojo.byId('remResDlgContent').innerHTML = '';
dijit.byId('remResDlg').hide();
document.body.style.cursor = 'wait';
- RPCwrapper(data, generalReqCB);
+ RPCwrapper(data, generalReqCB, 0, 30000);
}
function editReservation(cont) {
document.body.style.cursor = 'wait';
- RPCwrapper({continuation: cont}, editReservationCB, 1);
+ RPCwrapper({continuation: cont}, editReservationCB, 1, 30000);
}
function editReservationCB(data, ioArgs) {
@@ -421,6 +1393,14 @@ function editReservationCB(data, ioArgs)
dijit.byId('editResDlgBtn').set('style', 'display: none');
dijit.byId('editResCancelBtn').set('label', _('Okay'));
}
+ else if(data.items.status == 'noindefinite') {
+ dijit.byId('editResDlgBtn').set('style', 'display: inline');
+ dijit.byId('editResCancelBtn').set('label', _('Cancel'));
+ dojo.byId('editrescont').value = data.items.cont;
+ dojo.byId('editresid').value = data.items.requestid;
+ dojo.addClass('indefinitelabel', 'disabledlabel');
+ dojo.byId('indefiniteradio').disabled = true;
+ }
else {
dijit.byId('editResDlgBtn').set('style', 'display: inline');
dijit.byId('editResCancelBtn').set('label', _('Cancel'));
@@ -479,44 +1459,6 @@ function editResOpenEnd() {
t.getMinutes());
}
-function useSuggestedEditSlot() {
- var slot = suggestTimeData[dojo.byId('selectedslot').value];
- var tmp = parseInt(slot['startts'] + '000');
- var s = new Date(tmp);
- if(slot['startts'] == dojo.byId('selectedslot').value)
- var e = new Date(tmp + parseInt(slot['duration'] + '000'));
- else
- var e = new Date(parseInt(dojo.byId('selectedslot').value + '000'));
- var testend = new Date(2038, 0, 1, 0, 0, 0, 0);
- if(dijit.byId('day')) {
- var day = dojox.string.sprintf('%d%02d%02d', s.getFullYear(), s.getMonth() + 1, s.getDate());
- dijit.byId('day').set('value', day);
- }
- if(dijit.byId('editstarttime'))
- dijit.byId('editstarttime').set('value', s);
- if(! dojo.byId('indefiniteradio') || e < testend) {
- if(dijit.byId('openenddate'))
- dijit.byId('openenddate').set('value', e);
- if(dijit.byId('openendtime'))
- dijit.byId('openendtime').set('value', e);
- }
-
- var len = slot['duration'] / 60;
- if(dojo.byId('indefiniteradio') && e >= testend) {
- dojo.byId('indefiniteradio').checked = true;
- }
- else if(dijit.byId('length') && dijit.byId('length').getOptions(len.toString())) {
- dijit.byId('length').set('value', len);
- if(dojo.byId('lengthradio'))
- dojo.byId('lengthradio').checked = true;
- }
- else if(dojo.byId('dateradio')) {
- dojo.byId('dateradio').checked = true;
- }
-
- dijit.byId('suggestedTimes').hide();
-}
-
function submitEditReservation() {
if(dijit.byId('editResDlgBtn').get('label') == _('View Available Times')) {
dijit.byId('suggestDlgBtn').set('disabled', true);
@@ -574,7 +1516,7 @@ function submitEditReservation() {
data.endmode = 'indefinite';
}
document.body.style.cursor = 'wait';
- RPCwrapper(data, submitEditReservationCB, 1);
+ RPCwrapper(data, submitEditReservationCB, 1, 30000);
}
function submitEditReservationCB(data, ioArgs) {
@@ -613,7 +1555,7 @@ function submitEditReservationCB(data, i
function checkResGone(reqids) {
var editresid = dojo.byId('editresid').value;
- if(editresid == '')
+ if(editresid == '' || editresid == 'undefined')
return;
for(var i = 0; i < reqids.length; i++) {
if(editresid == reqids[i])
@@ -658,7 +1600,7 @@ function submitRebootReservation() {
else
data.reboottype = 0;
dijit.byId('rebootdlg').hide();
- RPCwrapper(data, generalReqCB);
+ RPCwrapper(data, generalReqCB, 0, 30000);
}
function hideReinstallResDlg() {
@@ -672,7 +1614,7 @@ function showReinstallRequest(cont) {
dojo.removeClass('reinstallloading', 'hidden');
dijit.byId('reinstalldlg').show();
var data = {continuation: cont};
- RPCwrapper(data, showReinstallRequestCB, 1);
+ RPCwrapper(data, showReinstallRequestCB, 1, 30000);
document.body.style.cursor = 'wait';
}
@@ -702,7 +1644,7 @@ function submitReinstallReservation() {
}
}
document.body.style.cursor = 'wait';
- RPCwrapper(data, submitReinstallReservationCB, 1);
+ RPCwrapper(data, submitReinstallReservationCB, 1, 30000);
}
function submitReinstallReservationCB(data, ioArgs) {
@@ -725,6 +1667,8 @@ function submitReinstallReservationCB(da
}
}
+// TODO get this working
+// talk to Andy about preventing vcld from deleting the connecttimeout entry until the end of the reservation
function checkConnectTimeout() {
var nextcheck = 15;
if(! dojo.byId('timeoutvalue'))
@@ -734,7 +1678,7 @@ function checkConnectTimeout() {
var now = (tmp.getTime() - tmp.getMilliseconds()) / 1000;
if(timeout <= now) {
var cont = dojo.byId('refreshcont').value;
- RPCwrapper({continuation: cont}, checkConnectTimeoutCB, 1);
+ RPCwrapper({continuation: cont}, checkConnectTimeoutCB, 1, 30000);
return;
}
else if(timeout - now < nextcheck) {
@@ -753,34 +1697,3 @@ function checkConnectTimeoutCB(data, ioA
}
}
-function showRDPbutton() {
- // submitted by Gerhard Harti from ODU
- if(! dojo.byId('counterdiv') || ! dojo.byId('connectdiv'))
- return;
- var timeInterval = 2;
- if(typeof timeInterval === 'undefined' || parseInt(timeInterval) <= 0) {
- timeInterval = 1
- }
- dojo.addClass('connectdiv', 'hidden');
- dojo.removeClass('counterdiv', 'hidden');
- if(timeInterval == 1)
- dojo.byId('counterdiv').innerHTML = _(' Ready to connect in ') + timeInterval + _(' second');
- else
- dojo.byId('counterdiv').innerHTML = _(' Ready to connect in ') + timeInterval + _(' seconds');
- var si = setInterval(function() {
- if(timeInterval === 0) {
- clearInterval(si);
- } else {
- timeInterval--;
- if(timeInterval !== 0) {
- if(timeInterval == 1)
- dojo.byId('counterdiv').innerHTML = _(' Ready to connect in ') + timeInterval + _(' second');
- else
- dojo.byId('counterdiv').innerHTML = _(' Ready to connect in ') + timeInterval + _(' seconds');
- } else {
- dojo.addClass('counterdiv', 'hidden');
- dojo.removeClass('connectdiv', 'hidden');
- }
- }
- }, 1000);
-}