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/24 19:52:07 UTC
svn commit: r1627374 - in /vcl/trunk/web: .ht-inc/requests.php
.ht-inc/resource.php js/requests.js js/resources/image.js
Author: jfthomps
Date: Wed Sep 24 17:52:07 2014
New Revision: 1627374
URL: http://svn.apache.org/r1627374
Log:
VCL-780 - combine new reservation and current reservations pages
requests.php:
-modified AJeditRequest, AJrebootRequest, and AJshowReinstallRequest: extended condition checking for expired reservation to check for expired states in addition to null
-modified AJconfirmDeleteRequest and AJconnectRequest: added section to check for expired reservation by checking expired states
resource.php: modified AJstartImage: added check for reservation being expired
requests.js: modified connectRequestCB and endReservationCB: added check for 'refresh' in data.items, and if it exists and == 1, refreshes the page
image.js: modified startImageCB: added section checking for 'resgone' status response
Modified:
vcl/trunk/web/.ht-inc/requests.php
vcl/trunk/web/.ht-inc/resource.php
vcl/trunk/web/js/requests.js
vcl/trunk/web/js/resources/image.js
Modified: vcl/trunk/web/.ht-inc/requests.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/requests.php?rev=1627374&r1=1627373&r2=1627374&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/requests.php (original)
+++ vcl/trunk/web/.ht-inc/requests.php Wed Sep 24 17:52:07 2014
@@ -2916,7 +2916,9 @@ function AJeditRequest() {
$requestid = getContinuationVar('requestid', 0);
$request = getRequestInfo($requestid, 1);
# check to see if reservation exists
- if(is_null($request)) {
+ if(is_null($request) || $request['stateid'] == 11 || $request['stateid'] == 12 ||
+ ($request['stateid'] == 14 &&
+ ($request['laststateid'] == 11 || $request['laststateid'] == 12))) {
sendJSON(array('status' => 'resgone'));
return;
}
@@ -3654,10 +3656,20 @@ function AJconfirmDeleteRequest() {
$request = getRequestInfo($requestid, 1);
if(is_null($request)) {
$data = array('error' => 1,
+ 'refresh' => 1,
'msg' => _("The specified reservation no longer exists."));
sendJSON($data);
return;
}
+ if($request['stateid'] == 11 || $request['stateid'] == 12 ||
+ ($request['stateid'] == 14 &&
+ ($request['laststateid'] == 11 || $request['laststateid'] == 12))) {
+ $data = array('error' => 1,
+ 'refresh' => 1,
+ 'msg' => _("This reservation has timed out due to lack of user activity and is no longer available."));
+ sendJSON($data);
+ return;
+ }
if($request['forimaging'])
$reservation = $request['reservations'][0];
else {
@@ -3867,7 +3879,9 @@ function AJsubmitRemoveRequest() {
function AJrebootRequest() {
$requestid = getContinuationVar('requestid');
$reqdata = getRequestInfo($requestid, 1);
- if(is_null($reqdata)) {
+ if(is_null($reqdata) || $reqdata['stateid'] == 11 || $reqdata['stateid'] == 12 ||
+ ($reqdata['stateid'] == 14 &&
+ ($reqdata['laststateid'] == 11 || $reqdata['laststateid'] == 12))) {
print "resGone('reboot'); ";
print "dijit.byId('editResDlg').show();";
print "setTimeout(resRefresh, 1500);";
@@ -3897,7 +3911,9 @@ function AJshowReinstallRequest() {
global $user;
$requestid = getContinuationVar('requestid');
$reqdata = getRequestInfo($requestid, 1);
- if(is_null($reqdata)) {
+ if(is_null($reqdata) || $reqdata['stateid'] == 11 || $reqdata['stateid'] == 12 ||
+ ($reqdata['stateid'] == 14 &&
+ ($reqdata['laststateid'] == 11 || $reqdata['laststateid'] == 12))) {
sendJSON(array('status' => 'resgone'));
return;
}
@@ -4001,12 +4017,17 @@ function AJreinstallRequest() {
function AJconnectRequest() {
global $remoteIP, $user;
$requestid = getContinuationVar('requestid');
- $requestData = getRequestInfo($requestid);
+ $requestData = getRequestInfo($requestid, 1);
+ if(is_null($requestData)) {
+ $h = _("This reservation is no longer available.");
+ sendJSON(array('html' => $h, 'refresh' => 1));
+ return;
+ }
if($requestData['stateid'] == 11 || $requestData['stateid'] == 12 ||
($requestData['stateid'] == 14 &&
($requestData['laststateid'] == 11 || $requestData['laststateid'] == 12))) {
$h = _("This reservation has timed out due to lack of user activity and is no longer available.");
- sendJSON($h);
+ sendJSON(array('html' => $h, 'refresh' => 1));
return;
}
$h = '';
Modified: vcl/trunk/web/.ht-inc/resource.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/resource.php?rev=1627374&r1=1627373&r2=1627374&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/resource.php (original)
+++ vcl/trunk/web/.ht-inc/resource.php Wed Sep 24 17:52:07 2014
@@ -1595,7 +1595,15 @@ function AJstartImage() {
$requestid = getContinuationVar("requestid");
$checkpoint = getContinuationVar("checkpoint", 0);
- $data = getRequestInfo($requestid);
+ $data = getRequestInfo($requestid, 1);
+ if(is_null($data) || $data['stateid'] == 11 || $data['stateid'] == 12 ||
+ ($data['stateid'] == 14 &&
+ ($data['laststateid'] == 11 || $data['laststateid'] == 12))) {
+ $ret = array('status' => 'resgone',
+ 'errmsg' => _("The reservation you selected to image has expired."));
+ sendJSON($ret);
+ return;
+ }
$disableUpdate = 1;
$imageid = '';
if(count($data['reservations']) == 1) {
Modified: vcl/trunk/web/js/requests.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/requests.js?rev=1627374&r1=1627373&r2=1627374&view=diff
==============================================================================
--- vcl/trunk/web/js/requests.js (original)
+++ vcl/trunk/web/js/requests.js Wed Sep 24 17:52:07 2014
@@ -1312,7 +1312,10 @@ function connectRequest(cont) {
function connectRequestCB(data, ioArgs) {
dijit.byId('connectDlgContent').set('content', data.items.html);
dijit.byId('connectDlg').show();
- setTimeout(checkConnectTimeout, 15000);
+ if('refresh' in data.items && data.items.refresh == 1)
+ resRefresh();
+ else
+ setTimeout(checkConnectTimeout, 15000);
}
function endReservation(cont) {
@@ -1322,6 +1325,8 @@ function endReservation(cont) {
function endReservationCB(data, ioArgs) {
if(data.items.error) {
alert(data.items.msg);
+ if('refresh' in data.items && data.items.refresh)
+ setTimeout(resRefresh, 800);
return;
}
dojo.byId('endrescont').value = data.items.cont;
Modified: vcl/trunk/web/js/resources/image.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/resources/image.js?rev=1627374&r1=1627373&r2=1627374&view=diff
==============================================================================
--- vcl/trunk/web/js/resources/image.js (original)
+++ vcl/trunk/web/js/resources/image.js Wed Sep 24 17:52:07 2014
@@ -564,6 +564,11 @@ function startImageCB(data, ioArgs) {
alert(data.items.errmsg);
return;
}
+ if(data.items.status == 'resgone') {
+ alert(data.items.errmsg);
+ resRefresh();
+ return;
+ }
// configure add image dialog, extra work, but saves an AJAX call after selection
resetEditResource();
var methodids = new Array();