Author: jfthomps
Date: Mon Jul 31 20:21:47 2017
New Revision: 1803565
URL: http://svn.apache.org/viewvc?rev=1803565&view=rev
Log:
VCL-1064 - Show reservations being captured or in maintenance on Reservations
page
userpreferences.php: modified processUserPrefsInput: added maintenance state to
list of states of reservations checked to prevent users from changing rdpport
value
utils.php:
-modified checkOverlap: added maintenance and image capture states to list of
ignored reservation states when checking for overlapping reservations
-modified printHTMLHeader: added image and checkpoint to list of reservation
states for which the page will automatically refresh
xmlrpcWrappers.php:
-modified XMLRPCgetRequestStatus: added checks for reservation being in
maintenance and for it beingin image or checkpoint
-modified XMLRPCextendRequest: added checks for reservation being in
maintenance and for it beingin image or checkpoint
-modified XMLRPCsetRequestEnding: added checks for reservation being in
maintenance and for it beingin image or checkpoint
Modified:
vcl/trunk/web/.ht-inc/userpreferences.php
vcl/trunk/web/.ht-inc/utils.php
vcl/trunk/web/.ht-inc/xmlrpcWrappers.php
Modified: vcl/trunk/web/.ht-inc/userpreferences.php
URL:
http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/userpreferences.php?rev=1803565&r1=1803564&r2=1803565&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/userpreferences.php (original)
+++ vcl/trunk/web/.ht-inc/userpreferences.php Mon Jul 31 20:21:47 2017
@@ -646,9 +646,9 @@ function processUserPrefsInput($checks=1
$requests = getUserRequests('all');
$nochange = 0;
foreach($requests as $req) {
- if(preg_match('/^(3|8|24|25|26|27|28|29)$/',
$req['currstateid']) ||
+ if(preg_match('/^(3|8|10|24|25|26|27|28|29)$/',
$req['currstateid']) ||
($req['currstateid'] == 14 &&
- preg_match('/^(3|8|24|25|26|27|28|29)$/',
$req['laststateid']))) {
+ preg_match('/^(3|8|10|24|25|26|27|28|29)$/',
$req['laststateid']))) {
$nochange = 1;
break;
}
Modified: vcl/trunk/web/.ht-inc/utils.php
URL:
http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/utils.php?rev=1803565&r1=1803564&r2=1803565&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/utils.php (original)
+++ vcl/trunk/web/.ht-inc/utils.php Mon Jul 31 20:21:47 2017
@@ -5680,6 +5680,10 @@ function checkOverlap($start, $end, $max
$requests[$id]["currstateid"] == 14) &&
$requests[$id]["laststateid"] == 11) &&
$requests[$id]["currstateid"] != 5 &&
+ $requests[$id]["currstateid"] != 10 &&
+ $requests[$id]["currstateid"] != 16 &&
+ ! ($requests[$id]["currstateid"] == 14 &&
+ $requests[$id]["laststateid"] == 16) &&
$requests[$id]["id"] != $requestid &&
($start < datetimeToUnix($requests[$id]["end"]) &&
$end > datetimeToUnix($requests[$id]["start"])) &&
@@ -6832,8 +6836,6 @@ function getUserRequests($type, $id=0) {
. "rq.end > NOW() AND "
. "i.OSid = o.id AND "
. "c.id = rs.computerid AND "
- #. "rq.stateid NOT IN (1, 10, 16, 17) AND " #
deleted, maintenance, complete, image, makeproduction
- #. "rq.laststateid NOT IN (1, 10, 16, 17) "; # deleted,
maintenance, complete, image, makeproduction
. "rq.stateid = s.id AND "
. "s.name NOT IN ('deleted', 'makeproduction') AND "
. "rq.laststateid = ls.id AND "
@@ -13245,6 +13247,12 @@ function printHTMLHeader() {
($requests[$i]["currstateid"] == 13 ||
($requests[$i]["currstateid"] == 14 &&
$requests[$i]["laststateid"] == 13) ||
+ $requests[$i]["currstateid"] == 16 ||
+ ($requests[$i]["currstateid"] == 14 &&
+ $requests[$i]["laststateid"] == 16) ||
+ $requests[$i]["currstateid"] == 24 ||
+ ($requests[$i]["currstateid"] == 14 &&
+ $requests[$i]["laststateid"] == 24) ||
$requests[$i]["currstateid"] == 3 ||
($requests[$i]["currstateid"] == 8 &&
! $requests[$i]["useraccountready"]))) {
Modified: vcl/trunk/web/.ht-inc/xmlrpcWrappers.php
URL:
http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/xmlrpcWrappers.php?rev=1803565&r1=1803564&r2=1803565&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/xmlrpcWrappers.php (original)
+++ vcl/trunk/web/.ht-inc/xmlrpcWrappers.php Mon Jul 31 20:21:47 2017
@@ -730,6 +730,16 @@ function XMLRPCgetRequestStatus($request
# request failed
elseif($request["currstateid"] == 5)
return array('status' => 'failed');
+ # request maintenance
+ elseif($request["currstateid"] == 10)
+ return array('status' => 'maintenance');
+ # request image
+ elseif($request["currstateid"] == 16 ||
+ $request["currstateid"] == 24 ||
+ ($request["currstateid"] == 14 &&
+ ($request["laststateid"] == 16 ||
+ $request["laststateid"] == 24)))
+ return array('status' => 'image');
# other cases where the reservation start time has been reached
elseif(datetimeToUnix($request["start"]) < $now) {
# request has timed out
@@ -933,6 +943,26 @@ function XMLRPCextendRequest($requestid,
if($newendts % (15 * 60))
$newendts= unixFloor15($newendts) + (15 * 60);
+ // check for maintenance state
+ if($request['stateid'] == 10 ||
+ ($request['stateid'] == 14 &&
+ $request['laststateid'] == 10)) {
+ return array('status' => 'error',
+ 'errorcode' => 103,
+ 'errormsg' => 'reservation in maintenance state');
+ }
+
+ // check for image state
+ if($request['stateid'] == 16 ||
+ $request['stateid'] == 24 ||
+ ($request['stateid'] == 14 &&
+ ($request['laststateid'] == 16 ||
+ $request['laststateid'] == 24))) {
+ return array('status' => 'error',
+ 'errorcode' => 104,
+ 'errormsg' => 'reservation being captured');
+ }
+
// check that reservation has started
if($startts > time()) {
return array('status' => 'error',
@@ -1109,6 +1139,26 @@ function XMLRPCsetRequestEnding($request
'errormsg' => "received invalid input for end");
}
+ // check for maintenance state
+ if($request['stateid'] == 10 ||
+ ($request['stateid'] == 14 &&
+ $request['laststateid'] == 10)) {
+ return array('status' => 'error',
+ 'errorcode' => 103,
+ 'errormsg' => 'reservation in maintenance state');
+ }
+
+ // check for image state
+ if($request['stateid'] == 16 ||
+ $request['stateid'] == 24 ||
+ ($request['stateid'] == 14 &&
+ ($request['laststateid'] == 16 ||
+ $request['laststateid'] == 24))) {
+ return array('status' => 'error',
+ 'errorcode' => 104,
+ 'errormsg' => 'reservation being captured');
+ }
+
$startts = datetimeToUnix($request['start']);
if($end % (15 * 60))
$end= unixFloor15($end) + (15 * 60);