Revision: 1576
http://mrbs.svn.sourceforge.net/mrbs/?rev=1576&view=rev
Author: cimorrison
Date: 2010-11-03 10:40:57 +0000 (Wed, 03 Nov 2010)
Log Message:
-----------
- changed All Day bookings so that you can make an All Day, multi-day booking
(unless of course multi-day booking is disabled)
- fixed various related bugs and tidied up the code
Modified Paths:
--------------
mrbs/branches/from_to_bookings/web/Themes/default/header.inc
mrbs/branches/from_to_bookings/web/edit_entry.php
mrbs/branches/from_to_bookings/web/edit_entry_handler.php
Modified: mrbs/branches/from_to_bookings/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/from_to_bookings/web/Themes/default/header.inc
2010-11-02 17:19:48 UTC (rev 1575)
+++ mrbs/branches/from_to_bookings/web/Themes/default/header.inc
2010-11-03 10:40:57 UTC (rev 1576)
@@ -635,6 +635,9 @@
var form = document.getElementById('main');
if (form)
{
+ var startSelect = form.start_seconds;
+ var endSelect = form.end_seconds;
+
if (form.name && (form.name.value.length == 0))
{
form.name.focus();
@@ -660,20 +663,20 @@
// they are fully populated with options. We can then use the details
// to rebuild the selectors later on
?>
- nStartOptions = form.start_seconds.options.length;
+ nStartOptions = startSelect.options.length;
for (var i=0; i < nStartOptions; i++)
{
startOptions[i] = new Array();
- startOptions[i]['text'] = form.start_seconds.options[i].text;
- startOptions[i]['value'] = parseInt(form.start_seconds.options[i].value);
+ startOptions[i]['text'] = startSelect.options[i].text;
+ startOptions[i]['value'] = parseInt(startSelect.options[i].value);
}
- nEndOptions = form.end_seconds.options.length;
+ nEndOptions = endSelect.options.length;
for (var i=0; i < nEndOptions; i++)
{
endOptions[i] = new Array();
- endOptions[i]['text'] = form.end_seconds.options[i].text;
- endOptions[i]['value'] = parseInt(form.end_seconds.options[i].value);
+ endOptions[i]['text'] = endSelect.options[i].text;
+ endOptions[i]['value'] = parseInt(endSelect.options[i].value);
}
adjustSlotSelectors(form);
@@ -683,14 +686,14 @@
// start and end time boxes
?>
if (!form.all_day.disabled &&
-
(parseInt(form.start_seconds.options[form.start_seconds.selectedIndex].value)
== startOptions[0]['value']) &&
-
(parseInt(form.end_seconds.options[form.end_seconds.selectedIndex].value) ==
endOptions[nEndOptions - 1]['value']))
+ (parseInt(startSelect.options[startSelect.selectedIndex].value) ==
startOptions[0]['value']) &&
+ (parseInt(endSelect.options[endSelect.selectedIndex].value) ==
endOptions[nEndOptions - 1]['value']))
{
form.all_day.checked = true;
- form.start_seconds.disabled = true;
- form.end_seconds.disabled = true;
- old_start = form.start_seconds.selectedIndex;
- old_end = form.end_seconds.selectedIndex;
+ startSelect.disabled = true;
+ endSelect.disabled = true;
+ old_start = startSelect.options[startSelect.selectedIndex].value;
+ old_end = endSelect.options[endSelect.selectedIndex].value;
}
}
Modified: mrbs/branches/from_to_bookings/web/edit_entry.php
===================================================================
--- mrbs/branches/from_to_bookings/web/edit_entry.php 2010-11-02 17:19:48 UTC
(rev 1575)
+++ mrbs/branches/from_to_bookings/web/edit_entry.php 2010-11-03 10:40:57 UTC
(rev 1576)
@@ -503,12 +503,12 @@
<?php
}
- ?>
// Form submit can take some times, especially if mails are enabled and
// there are more than one recipient. To avoid users doing weird things
// like clicking more than one time on submit button, we hide it as soon
// it is clicked.
+ ?>
form.save_button.disabled="true";
// would be nice to also check date to not allow Feb 31, etc...
@@ -517,50 +517,57 @@
}
// set up some global variables for use by OnAllDayClick().
-var old_start, old_end, old_end_datepicker;
-var old_end_datepicker_alt_day, old_end_datepicker_alt_month,
old_end_datepicker_alt_year;
+var old_start, old_end;
// Executed when the user clicks on the all_day checkbox.
function OnAllDayClick(allday)
{
var form = document.forms["main"];
- if (form.all_day.checked) // If checking the box...
+ if (form)
{
- // save the old values, disable the inputs and, to avoid user confusion,
- // show the start time as the beginning of the day and the duration as one
day
- old_start = form.start_seconds.selectedIndex;
- form.start_seconds.selectedIndex = 0;
- form.start_seconds.disabled = true;
- old_end = form.end_seconds.selectedIndex;
- form.end_seconds.selectedIndex = form.end_seconds.options.length - 1;
- form.end_seconds.disabled = true;
+ var startSelect = form.start_seconds;
+ var endSelect = form.end_seconds;
+ var i;
+ if (form.all_day.checked) // If checking the box...
+ {
+ <?php
+ // Save the old values, disable the inputs and, to avoid user confusion,
+ // show the start and end times as the beginning and end of the booking
+ // (Note that we save the value rather than the index because the number
+ // of options in the select box will change)
+ ?>
+ old_start = startSelect.options[startSelect.selectedIndex].value;
+ startSelect.selectedIndex = 0;
+ startSelect.disabled = true;
- old_end_datepicker_alt_day = form.end_datepicker_alt_day.value;
- form.end_datepicker_alt_day.value = form.start_datepicker_alt_day.value;
-
- old_end_datepicker_alt_month = form.end_datepicker_alt_month.value;
- form.end_datepicker_alt_month.value =
form.start_datepicker_alt_month.value;
-
- old_end_datepicker_alt_year = form.end_datepicker_alt_year.value;
- form.end_datepicker_alt_year.value = form.start_datepicker_alt_year.value;
-
- old_end_datepicker = form.end_datepicker.value;
- form.end_datepicker.value = form.start_datepicker.value;
- form.end_datepicker.disabled = true;
+ old_end = endSelect.options[endSelect.selectedIndex].value;
+ endSelect.selectedIndex = endSelect.options.length - 1;
+ endSelect.disabled = true;
+ }
+ else <?php // restore the old values and re-enable the inputs ?>
+ {
+ startSelect.disabled = false;
+ for (i=0; i<startSelect.options.length; i++)
+ {
+ if (startSelect.options[i].value == old_start)
+ {
+ startSelect.options.selectedIndex = i;
+ break;
+ }
+ }
+ endSelect.disabled = false;
+ for (i=0; i<endSelect.options.length; i++)
+ {
+ if (endSelect.options[i].value == old_end)
+ {
+ endSelect.options.selectedIndex = i;
+ break;
+ }
+ }
+ prevStartValue = undefined; <?php // because we don't want
adjustSlotSelectors() to change the end time ?>
+ }
+ adjustSlotSelectors(form); <?php // need to get the duration right ?>
}
- else // restore the old values and re-enable the inputs
- {
- form.start_seconds.disabled = false;
- form.start_seconds.selectedIndex = old_start;
- form.end_seconds.disabled = false;
- form.end_seconds.selectedIndex = old_end;
- form.end_datepicker_alt_day.value = old_end_datepicker_alt_day;
- form.end_datepicker_alt_month.value = old_end_datepicker_alt_month;
- form.end_datepicker_alt_year.value = old_end_datepicker_alt_year;
- form.end_datepicker.disabled = false;
- form.end_datepicker.value = old_end_datepicker;
- }
- adjustSlotSelectors(form); // need to get the duration right
}
//]]>
</script>
Modified: mrbs/branches/from_to_bookings/web/edit_entry_handler.php
===================================================================
--- mrbs/branches/from_to_bookings/web/edit_entry_handler.php 2010-11-02
17:19:48 UTC (rev 1575)
+++ mrbs/branches/from_to_bookings/web/edit_entry_handler.php 2010-11-03
10:40:57 UTC (rev 1576)
@@ -273,7 +273,7 @@
{
$max_periods = count($periods);
$starttime = mktime(12, 0, 0, $month, $day, $year);
- $endtime = mktime(12, $max_periods, 0, $month, $day, $year);
+ $endtime = mktime(12, $max_periods, 0, $end_month, $end_day, $end_year);
// We need to set the duration and units because they are needed for email
notifications
$duration = $max_periods;
$dur_units = "periods";
@@ -285,7 +285,7 @@
$month, $day, $year,
is_dst($month, $day, $year, $morningstarts));
$endtime = mktime($eveningends, $eveningends_minutes, 0,
- $month, $day, $year,
+ $end_month, $end_day, $end_year,
is_dst($month, $day, $year, $eveningends));
$endtime += $resolution; // add on the duration (in
seconds) of the last slot as
// $eveningends and
$eveningends_minutes specify the
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Achieve Improved Network Security with IP and DNS Reputation.
Defend against bad network traffic, including botnets, malware,
phishing sites, and compromised hosts - saving your company time,
money, and embarrassment. Learn More!
http://p.sf.net/sfu/hpdev2dev-nov
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits