Revision: 2187
http://mrbs.svn.sourceforge.net/mrbs/?rev=2187&view=rev
Author: cimorrison
Date: 2011-11-22 23:14:43 +0000 (Tue, 22 Nov 2011)
Log Message:
-----------
Restricted the options available in the end time selector to those permitted if
a maximum duration has been specified
Modified Paths:
--------------
mrbs/trunk/web/Themes/default/header.inc
mrbs/trunk/web/edit_entry.php
Modified: mrbs/trunk/web/Themes/default/header.inc
===================================================================
--- mrbs/trunk/web/Themes/default/header.inc 2011-11-22 20:49:39 UTC (rev
2186)
+++ mrbs/trunk/web/Themes/default/header.inc 2011-11-22 23:14:43 UTC (rev
2187)
@@ -981,8 +981,11 @@
var area = currentArea;
var enablePeriods = areas[area]['enable_periods'];
+ var maxDurationEnabled = areas[area]['max_duration_enabled'];
+ var maxDurationSecs = areas[area]['max_duration_secs'];
+ var maxDurationPeriods = areas[area]['max_duration_periods'];
- var isSelected, i, j, option, defaultDuration;
+ var isSelected, i, j, option, defaultDuration, maxDuration;
var nbsp = '\u00A0';
var errorText = '<?php echo get_vocab("start_after_end")?>';
var text = errorText;
@@ -1053,7 +1056,8 @@
option = endOptions[area];
for (i = 0; i < nEndOptions[area]; i++)
{
- if ((i == nEndOptions[area] - 1) || (option[i]['value'] >=
oldAreaEndValue))
+ if ((i == nEndOptions[area] - 1) ||
+ (option[i]['value'] >= oldAreaEndValue))
{
endValue = option[i]['value'];
break;
@@ -1156,6 +1160,24 @@
j = 0;
for (i = 0; i < nEndOptions[area]; i++)
{
+ <?php
+ // Limit the end slots to the maximum duration if that is enabled, if the
+ // user is not an admin
+ if (!$is_admin)
+ {
+ ?>
+ if (maxDurationEnabled)
+ {
+ maxDuration = (enablePeriods) ? (maxDurationPeriods - 1) * 60 :
maxDurationSecs
+ if ((endOptions[area][i]['value'] - startValue) > maxDuration)
+ {
+ break;
+ }
+ }
+ <?php
+ }
+ ?>
+
if ((endOptions[area][i]['value'] > startValue) ||
((endOptions[area][i]['value'] == startValue) && enablePeriods) ||
(dateDifference != 0))
Modified: mrbs/trunk/web/edit_entry.php
===================================================================
--- mrbs/trunk/web/edit_entry.php 2011-11-22 20:49:39 UTC (rev 2186)
+++ mrbs/trunk/web/edit_entry.php 2011-11-22 23:14:43 UTC (rev 2187)
@@ -959,6 +959,11 @@
}
echo "areas[${area['id']}]['$key'] = $value;\n";
}
+ // Add in the maximum durations. These are not per area at the moment
+ // but they might be in the future
+ echo "areas[${area['id']}]['max_duration_enabled'] =
$max_duration_enabled;\n";
+ echo "areas[${area['id']}]['max_duration_secs'] = $max_duration_secs;\n";
+ echo "areas[${area['id']}]['max_duration_periods'] =
$max_duration_periods;\n";
}
?>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits