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 2016/02/26 22:21:06 UTC
svn commit: r1732560 - in /vcl/trunk/web: .ht-inc/groups.php
.ht-inc/requests.php .ht-inc/utils.php js/requests.js
Author: jfthomps
Date: Fri Feb 26 21:21:05 2016
New Revision: 1732560
URL: http://svn.apache.org/viewvc?rev=1732560&view=rev
Log:
VCL-937 - Increase max length of duration limited images from 45 days to 20 weeks
groups.php:
-modified jsonUserGroupStore, editOrAddGroup, and confirmEditOrAddGroup: changed argument passed to getReservationLengths from 65535 to 201600
-modified submitDeleteGroup: changed update query to set groupid to NULL instead of 0 (unrelated to VCL-937)
requests.php: modified AJeditRequest: modified for loops that generate values for extending reservation to include 7 weeks through 20 weeks
utils.php:
-modified getReservationLengths: added extra for loop to generate values for reservation duration to include 7 weeks through 20 weeks
-modified getReservationLength: added conditional to return value in days if less than 64800 minutes; changed default return to be in weeks
-modified getReservationExtenstion: added conditional to return value in days if less than 64800 minutes; changed default return to be in weeks
-modified getReservationLengthCeiling: added extra for loop to generate values for reservation duration to include 7 weeks through 20 weeks; changed default return to be 201600
requests.js: modified setMaxRequestLength: added extra "else if" block to handle options greater than 45 days as weeks
Modified:
vcl/trunk/web/.ht-inc/groups.php
vcl/trunk/web/.ht-inc/requests.php
vcl/trunk/web/.ht-inc/utils.php
vcl/trunk/web/js/requests.js
Modified: vcl/trunk/web/.ht-inc/groups.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/groups.php?rev=1732560&r1=1732559&r2=1732560&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/groups.php (original)
+++ vcl/trunk/web/.ht-inc/groups.php Fri Feb 26 21:21:05 2016
@@ -307,7 +307,7 @@ function jsonUserGroupStore() {
elseif(checkUserHasPerm('Manage Federated User Groups (affiliation only)'))
$showfederatedaffil = 1;
$items = array();
- $lengths = getReservationLengths(65535);
+ $lengths = getReservationLengths(201600);
foreach($affilusergroups as $id => $group) {
if($group['name'] == 'None' || preg_match('/^\s*None/', $group['name']))
continue;
@@ -768,7 +768,7 @@ function editOrAddGroup($state) {
print " <TR>\n";
print " <TH align=right>Initial Max Time:</TH>\n";
print " <TD>";
- $lengths = getReservationLengths(65535);
+ $lengths = getReservationLengths(201600);
if(! array_key_exists($data['initialmax'], $lengths))
$data['initialmax'] = getReservationLengthCeiling($data['initialmax']);
printSelectInput("initialmax", $lengths, $data['initialmax']);
@@ -1470,7 +1470,7 @@ function confirmEditOrAddGroup($state) {
print " <TD>" . $usergroups[$data["editgroupid"]]["name"] . "</TD>\n";
print " </TR>\n";
}
- $lengths = getReservationLengths(65535);
+ $lengths = getReservationLengths(201600);
print " <TR>\n";
print " <TH align=right>Initial Max Time:</TH>\n";
print " <TD>{$lengths[$data["initialmax"]]}</TD>\n";
@@ -1722,7 +1722,7 @@ function submitDeleteGroup() {
$type = getContinuationVar("type");
if($type == "user") {
$query = "UPDATE blockRequest "
- . "SET groupid = 0 "
+ . "SET groupid = NULL "
. "WHERE groupid = $groupid";
doQuery($query);
$table = "usergroup";
Modified: vcl/trunk/web/.ht-inc/requests.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/requests.php?rev=1732560&r1=1732559&r2=1732560&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/requests.php (original)
+++ vcl/trunk/web/.ht-inc/requests.php Fri Feb 26 21:21:05 2016
@@ -3342,8 +3342,10 @@ function AJeditRequest() {
$lengths["60"] = i("1 hour");
for($i = 120; (($reslen + $i) <= $maxtimes["total"]) && ($i <= $maxtimes["extend"]) && $i < 2880; $i += 120)
$lengths[$i] = $i / 60 . " " . i("hours");
- for($i = 2880; (($reslen + $i) <= $maxtimes["total"]) && ($i <= $maxtimes["extend"]); $i += 1440)
+ for($i = 2880; (($reslen + $i) <= $maxtimes["total"]) && ($i <= $maxtimes["extend"]) && $i < 64800; $i += 1440)
$lengths[$i] = $i / 1440 . " " . i("days");
+ for($i = 70560; (($reslen + $i) <= $maxtimes["total"]) && ($i <= $maxtimes["extend"]); $i += 10080)
+ $lengths[$i] = $i / 10080 . " " . i("weeks");
}
else {
if($timeToNext >= 15 && (($reslen + 15) <= $maxtimes["total"]) && (15 <= $maxtimes["extend"]))
@@ -3356,8 +3358,10 @@ function AJeditRequest() {
$lengths["60"] = i("1 hour");
for($i = 120; ($i <= $timeToNext) && (($reslen + $i) <= $maxtimes["total"]) && ($i <= $maxtimes["extend"]) && $i < 2880; $i += 120)
$lengths[$i] = $i / 60 . " " . i("hours");
- for($i = 2880; ($i <= $timeToNext) && (($reslen + $i) <= $maxtimes["total"]) && ($i <= $maxtimes["extend"]); $i += 1440)
+ for($i = 2880; ($i <= $timeToNext) && (($reslen + $i) <= $maxtimes["total"]) && ($i <= $maxtimes["extend"]) && $i < 64800; $i += 1440)
$lengths[$i] = $i / 1440 . " " . i("days");
+ for($i = 70560; ($i <= $timeToNext) && (($reslen + $i) <= $maxtimes["total"]) && ($i <= $maxtimes["extend"]); $i += 10080)
+ $lengths[$i] = $i / 10080 . " " . i("weeks");
}
$cdata['lengths'] = array_keys($lengths);
if($timeToNext == -1 || $timeToNext >= $maxtimes['total']) {
Modified: vcl/trunk/web/.ht-inc/utils.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/utils.php?rev=1732560&r1=1732559&r2=1732560&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/utils.php (original)
+++ vcl/trunk/web/.ht-inc/utils.php Fri Feb 26 21:21:05 2016
@@ -10187,7 +10187,7 @@ function getUserMaxTimes($uid=0) {
///
/// \fn getReservationLengths($max)
///
-/// \param $max - max allowed length in seconds
+/// \param $max - max allowed length in minutes
///
/// \return array of lengths up to $max starting with 30 minutes, 1 hour,
/// 2 hours, then increasing by 2 hours up to 47 hours, then 2 days, then
@@ -10206,8 +10206,10 @@ function getReservationLengths($max) {
$lengths["60"] = i("1 hour");
for($i = 120; $i <= $max && $i < 2880; $i += 120)
$lengths[$i] = $i / 60 . " " . i("hours");
- for($i = 2880; $i <= $max; $i += 1440)
+ for($i = 2880; $i <= $max && $i <= 64800; $i += 1440)
$lengths[$i] = $i / 1440 . " " . i("days");
+ for($i = 70560; $i <= $max; $i += 10080)
+ $lengths[$i] = $i / 10080 . " " . i("weeks");
return $lengths;
}
@@ -10229,7 +10231,9 @@ function getReservationLength($length) {
return i("1 hour");
if($length < 2880)
return intval($length / 60) . " " . i("hours");
- return intval($length / 1440) . " " . i("days");
+ if($length < 64800)
+ return intval($length / 1440) . " " . i("days");
+ return intval($length / 10080) . " " . i("weeks");
}
////////////////////////////////////////////////////////////////////////////////
@@ -10254,7 +10258,9 @@ function getReservationExtenstion($lengt
}
if($length < 2880)
return intval($length / 60) . " " . i("hours");
- return intval($length / 1440) . " " . i("days");
+ if($length < 64800)
+ return intval($length / 1440) . " " . i("days");
+ return intval($length / 10080) . " " . i("weeks");
}
////////////////////////////////////////////////////////////////////////////////
@@ -10286,7 +10292,11 @@ function getReservationLengthCeiling($le
if($length < $i)
return $i;
}
- return 64800;
+ for($i = 70560; $i <= 201600; $i += 10080) {
+ if($length < $i)
+ return $i;
+ }
+ return 201600;
}
////////////////////////////////////////////////////////////////////////////////
Modified: vcl/trunk/web/js/requests.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/requests.js?rev=1732560&r1=1732559&r2=1732560&view=diff
==============================================================================
--- vcl/trunk/web/js/requests.js (original)
+++ vcl/trunk/web/js/requests.js Fri Feb 26 21:21:05 2016
@@ -799,6 +799,18 @@ function setMaxRequestLength(minutes) {
text = '1 ' + _('hour');
newminutes = 60;
}
+ // if option > 45 days, add as weeks
+ else if(parseInt(obj.options[i].value) > 64700) {
+ var len = parseInt(obj.options[i].value);
+ if(len == 64800)
+ len = 60480;
+ if(len % 10080)
+ len = len - (len % 10080);
+ else
+ len = len + 10080;
+ text = len / 10080 + ' ' + _('weeks');
+ newminutes = len;
+ }
// if option > 46 hours, add as days
else if(parseInt(obj.options[i].value) > 2640) {
var len = parseInt(obj.options[i].value);