Revision: 2188
http://mrbs.svn.sourceforge.net/mrbs/?rev=2188&view=rev
Author: cimorrison
Date: 2011-11-23 04:36:12 +0000 (Wed, 23 Nov 2011)
Log Message:
-----------
Took account of days in calculating the duration when maximum duration is
enabled
Modified Paths:
--------------
mrbs/trunk/web/Themes/default/header.inc
mrbs/trunk/web/edit_entry.php
mrbs/trunk/web/mrbs.css.php
Modified: mrbs/trunk/web/Themes/default/header.inc
===================================================================
--- mrbs/trunk/web/Themes/default/header.inc 2011-11-22 23:14:43 UTC (rev
2187)
+++ mrbs/trunk/web/Themes/default/header.inc 2011-11-23 04:36:12 UTC (rev
2188)
@@ -73,7 +73,7 @@
$search_str, $locale_warning;
global $tbl_entry, $tbl_room, $tbl_area;
global $PHP_SELF, $HTTP_HOST, $QUERY_STRING;
- global $view_week_number, $weekstarts, $times_along_top, $enable_periods;
+ global $view_week_number, $weekstarts, $times_along_top, $periods,
$enable_periods;
global $auth, $max_level;
global $default_language_tokens, $disable_automatic_language_changing,
$override_locale;
global $lang_map_windows, $langs, $server_os;
@@ -984,8 +984,10 @@
var maxDurationEnabled = areas[area]['max_duration_enabled'];
var maxDurationSecs = areas[area]['max_duration_secs'];
var maxDurationPeriods = areas[area]['max_duration_periods'];
+ var maxDurationQty = areas[area]['max_duration_qty'];
+ var maxDurationUnits = areas[area]['max_duration_units'];
- var isSelected, i, j, option, defaultDuration, maxDuration;
+ var isSelected, i, j, option, duration, defaultDuration, maxDuration;
var nbsp = '\u00A0';
var errorText = '<?php echo get_vocab("start_after_end")?>';
var text = errorText;
@@ -1157,6 +1159,7 @@
endSelect.remove(0);
}
+ $('#end_time_error').text(''); <?php // Clear the error message ?>
j = 0;
for (i = 0; i < nEndOptions[area]; i++)
{
@@ -1168,11 +1171,42 @@
?>
if (maxDurationEnabled)
{
- maxDuration = (enablePeriods) ? (maxDurationPeriods - 1) * 60 :
maxDurationSecs
- if ((endOptions[area][i]['value'] - startValue) > maxDuration)
+ <?php
+ // Calculate the duration in periods or seconds
+ ?>
+ duration = endOptions[area][i]['value'] - startValue;
+ if (enablePeriods)
{
- break;
+ duration = duration/60 + 1; <?php // because of the way periods
work ?>
+ duration += dateDifference * <?php echo count($periods) ?>;
}
+ else
+ {
+ duration += dateDifference * 60 * 60 *24;
+ }
+ maxDuration = (enablePeriods) ? maxDurationPeriods : maxDurationSecs;
+ if (duration > maxDuration)
+ {
+ if (i == 0)
+ {
+ endSelect.options[j] = new Option(nbsp,
endOptions[area][i]['value'], false, isSelected);
+ var errorMessage = '<?php echo get_vocab("max_booking_duration")
?>' + nbsp;
+ if (enablePeriods)
+ {
+ errorMessage += maxDurationPeriods + nbsp;
+ errorMessage += (maxDurationPeriods > 1) ? '<?php echo
get_vocab("periods") ?>' : '<?php get_vocab("period_lc") ?>';
+ }
+ else
+ {
+ errorMessage += maxDurationQty + nbsp + maxDurationUnits;
+ }
+ $('#end_time_error').text(errorMessage);
+ }
+ else
+ {
+ break;
+ }
+ }
}
<?php
}
Modified: mrbs/trunk/web/edit_entry.php
===================================================================
--- mrbs/trunk/web/edit_entry.php 2011-11-22 23:14:43 UTC (rev 2187)
+++ mrbs/trunk/web/edit_entry.php 2011-11-23 04:36:12 UTC (rev 2188)
@@ -230,6 +230,7 @@
$display_none = ($a['id'] != $area_id);
genSlotSelector($a, "end_", $first, $last, $end_value, $display_none);
}
+ echo "<span id=\"end_time_error\" class=\"error\"></span>\n";
echo "</div>\n";
}
@@ -964,6 +965,10 @@
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";
+ $max_duration_qty = $max_duration_secs;
+ toTimeString($max_duration_qty, $max_duration_units);
+ echo "areas[${area['id']}]['max_duration_qty'] = $max_duration_qty;\n";
+ echo "areas[${area['id']}]['max_duration_units'] = '$max_duration_units';\n";
}
?>
Modified: mrbs/trunk/web/mrbs.css.php
===================================================================
--- mrbs/trunk/web/mrbs.css.php 2011-11-22 23:14:43 UTC (rev 2187)
+++ mrbs/trunk/web/mrbs.css.php 2011-11-23 04:36:12 UTC (rev 2188)
@@ -594,6 +594,7 @@
div#edit_entry_submit_save {float: left; clear: none; width: auto}
#edit_entry_submit_back input {float: right}
+
.form_general .div_dur_mins input{width: 4.0em}
.form_general .div_time input {width: 2.0em}
.form_general .div_time input.time_hour {text-align: right}
@@ -609,6 +610,7 @@
fieldset#rep_info {border-top: 1px solid <?php echo
$site_faq_entry_border_color ?>; padding-top: 0.7em}
.form_general input#rep_num_weeks {width: 2.0em}
+.edit_entry span#end_time_error {display: block; float: left; margin-left:
2em; font-weight: normal}
.edit_area_room span.error {display: block; width: 100%; margin-bottom: 0.5em}
.form_general label.secondary {font-weight: normal; width: auto}
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