Revision: 1585
http://mrbs.svn.sourceforge.net/mrbs/?rev=1585&view=rev
Author: cimorrison
Date: 2010-11-05 11:22:33 +0000 (Fri, 05 Nov 2010)
Log Message:
-----------
Made the start and end time selectors change when the selected area is changed.
Modified Paths:
--------------
mrbs/branches/from_to_bookings/web/Themes/default/header.inc
mrbs/branches/from_to_bookings/web/edit_entry.php
Modified: mrbs/branches/from_to_bookings/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/from_to_bookings/web/Themes/default/header.inc
2010-11-03 17:52:41 UTC (rev 1584)
+++ mrbs/branches/from_to_bookings/web/Themes/default/header.inc
2010-11-05 11:22:33 UTC (rev 1585)
@@ -9,7 +9,7 @@
$search_str, $locale_warning;
global $tbl_entry, $tbl_room, $tbl_area;
global $PHP_SELF, $view_week_number, $weekstarts;
- global $enable_periods, $auth;
+ global $auth;
global $default_language_tokens, $disable_automatic_language_changing,
$override_locale;
global $lang_map_windows, $langs;
@@ -253,14 +253,18 @@
if ($page == 'edit_entry')
{
- // Declare some variables to hold details of the slot selectors.
+ // Declare some variables to hold details of the slot selectors for each
area.
// We are going to store the contents of the selectors on page load
// (when they will be fully populated with options) so that we can
// rebuild the arrays later
// Also declare a variable to hold text strings with the current
// locale translations for periods,minutes, hours, etc.
+ // The nStartOptions and nEndOptions array are indexed by area id
+ // The startOptions and endOptions are multi-dimensional arrays indexed as
follows:
+ // [area_id][option number][text|value]
?>
- var nStartOptions, nEndOptions;
+ var nStartOptions = new Array;
+ var nEndOptions = new Array;
var startOptions = new Array();
var endOptions = new Array();
var vocab = new Array();
@@ -301,48 +305,37 @@
{
var duration, durUnits;
var text = '';
-
- durUnits = '<?php echo ($enable_periods) ? "periods" : "minutes" ?>';
+ var enablePeriods = areas[currentArea]['enable_periods'];
+
+ durUnits = (enablePeriods) ? '<?php echo "periods" ?>' : '<?php echo
"minutes" ?>';
duration = to - from;
duration = Math.floor((to - from) / 60);
if (duration < 0)
{
days--;
- <?php
- if ($enable_periods)
+ if (enablePeriods)
{
- // add a day's worth of periods ?>
- duration += nEndOptions;
- <?php
+ duration += nEndOptions[currentArea]; <?php // add a day's worth of
periods ?>
}
else
{
- // add 24 hours (duration is now in minutes) ?>
- duration += 24*60;
- <?php
+ duration += 24*60; <?php // add 24 hours (duration is now in minutes)
?>
}
- ?>
}
- <?php
- if ($enable_periods)
+ if (enablePeriods)
{
- // a period is a period rather than a point ?>
- duration++;
- <?php
+ duration++; <?php // a period is a period rather than a point ?>
}
else
{
- ?>
if (duration >= 60)
{
durUnits = "hours";
duration = durFormat(duration/60);
}
- <?php
}
- ?>
if (days != 0)
{
@@ -398,7 +391,7 @@
return diff;
}
- function adjustSlotSelectors(form)
+ function adjustSlotSelectors(form, oldArea, oldAreaStartValue,
oldAreaEndValue)
{
<?php
// Adjust the start and end time slot select boxes.
@@ -408,39 +401,153 @@
// (b) If the end time has changed then adjust the duration.
// (c) Make sure that you can't have an end time before the start time.
// (d) Tidy up the two select boxes so that they are the same width
+ // (e) if oldArea etc. are set, then we've switched areas and we want
+ // to have a go at finding a time/period in the new area as close
+ // as possible to the one that was selected in the old area.
?>
if (!form)
{
return;
}
-
- var isSelected, i, j;
+
+ var area = currentArea;
+ var enablePeriods = areas[area]['enable_periods'];
+
+ var isSelected, i, j, option, defaultDuration;
var nbsp = '\u00A0';
var errorText = '<?php echo get_vocab("start_after_end")?>';
var text = errorText;
- var startSelect = form.start_seconds;
- var startIndex = startSelect.selectedIndex;
- var startValue = parseInt(startSelect.options[startIndex].value);
+ var startSelect = form["start_seconds" + area];
+ var endSelect = form["end_seconds" + area];
+ var startIndex, startValue, endIndex, endValue;
- var endSelect = form.end_seconds;
- var endIndex = endSelect.selectedIndex;
- var endValue = parseInt(endSelect.options[endIndex].value);
-
+ <?php
+ // If All Day is checked then just set the start and end values to the
first
+ // and last possible options.
+ ?>
if (form.all_day.checked)
{
- endValue = endOptions[nEndOptions - 1]['value'];
+ startValue = startOptions[area][0]['value']
+ endValue = endOptions[area][nEndOptions[area] - 1]['value'];
+ <?php
+ // If we've come here from another area then we need to make sure that
the
+ // start and end selectors are disabled. (We won't change the old_end
and old_start
+ // values, because there's a chance the existing ones may still work -
for example if
+ // the user flicks from Area A to Area B and then back to Area A, or
else if the time/
+ // period slots in Area B match those in Area.)
+ ?>
+ if (oldArea != null)
+ {
+ startSelect.disabled = true;
+ endSelect.disabled = true;
+ }
}
- else if (prevStartValue)
+ <?php
+ // Otherwise what we do depends on whether we've come here as a result
+ // of the area being changed
+ ?>
+ else if ((oldArea != null) && (oldAreaStartValue != null) &&
(oldAreaStartValue != null))
{
- endValue = endValue + (startValue - prevStartValue);
- endValue = Math.min(endValue, endOptions[nEndOptions - 1]['value']);
+ <?php
+ // If we've changed areas and the modes are the same, we can try and
match times/periods.
+ // We will try and be conservative and find a start time that includes
the previous start time
+ // and an end time that includes the previous end time. This means
that by default the
+ // booking period will include the old boioking period (unless we've hit
the start or
+ // end of day). But it does mean that as you switch between areas the
booking period
+ // tends to get bigger: if you switch fromn Area 1 to Area 2 and then
bavk again it's
+ // possible that the booking period for Area 1 is longer than it was
originally.
+ ?>
+ if (areas[oldArea]['enable_periods'] == areas[area]['enable_periods'])
+ {
+ <?php
+ // Step back through the start options until we find one that is less
than or equal to the previous value,
+ // or else we've got to the first option
+ ?>
+ option = startOptions[area];
+ for (i = nStartOptions[area] - 1; i >= 0; i--)
+ {
+ if ((i == 0) || (option[i]['value'] <= oldAreaStartValue))
+ {
+ startValue = option[i]['value'];
+ break;
+ }
+ }
+ <?php
+ // And step forward through the end options until we find one that is
greater than
+ // or equal to the previous value, or else we've got to the last option
+ ?>
+ option = endOptions[area];
+ for (i = 0; i < nEndOptions[area]; i++)
+ {
+ if ((i == nEndOptions[area] - 1) || (option[i]['value'] >=
oldAreaEndValue))
+ {
+ endValue = option[i]['value'];
+ break;
+ }
+ }
+ }
+ <?php
+ // The modes are different, so it doesn't make any sense to match up old
and new
+ // times/periods. The best we can do is choose some sensible defaults,
which
+ // is to set the start to the first possible start, and the end to the
start + the
+ // default duration (or the last possible end value if that is less)
+ ?>
+ else
+ {
+ startValue = startOptions[area][0]['value'];
+ if (enablePeriods)
+ {
+ endValue = startValue;
+ }
+ else
+ {
+ if ((areas[area]['default_duration'] == null) ||
(areas[area]['default_duration'] == 0))
+ {
+ defaultDuration = 60 * 60;
+ }
+ else
+ {
+ defaultDuration = areas[area]['default_duration'];
+ }
+ endValue = startValue + defaultDuration;
+ endValue = Math.min(endValue, endOptions[area][nEndOptions[area] -
1]['value']);
+ }
+ }
}
- prevStartValue = startValue;
+ <?php
+ // We haven't changed areas. In this case get the currently selected
start and
+ // end values
+ ?>
+ else
+ {
+ startIndex = startSelect.selectedIndex;
+ startValue = parseInt(startSelect.options[startIndex].value);
+ endIndex = endSelect.selectedIndex;
+ endValue = parseInt(endSelect.options[endIndex].value);
+ <?php
+ // If the start value has changed then we adjust the endvalue
+ // to keep the duration the same. (If the end value has changed
+ // then the duration will be changed when we recalculate durations below)
+ ?>
+ if (prevStartValue)
+ {
+ endValue = endValue + (startValue - prevStartValue);
+ endValue = Math.min(endValue, endOptions[area][nEndOptions[area] -
1]['value']);
+ }
+ }
+
+ prevStartValue = startValue; <? // Update the previous start value ?>
var dateDifference = getDateDifference(form);
+ <?php
+ // If All Day isn't checked then we need to work out whether the start
+ // and end dates are valid. If the end date is before the start date
+ // then we disable all the time selectors (start, end and All Day) until
+ // the dates are fixed.
+ ?>
if (!form.all_day.checked)
{
var newState = (dateDifference < 0);
@@ -455,14 +562,14 @@
startSelect.remove(0);
}
- for (i = 0; i < nStartOptions; i++)
+ for (i = 0; i < nStartOptions[area]; i++)
{
- isSelected = (startOptions[i]['value'] == startValue);
+ isSelected = (startOptions[area][i]['value'] == startValue);
if (dateDifference >= 0)
{
- text = startOptions[i]['text'];
+ text = startOptions[area][i]['text'];
}
- startSelect.options[i] = new Option(text, startOptions[i]['value'],
false, isSelected);
+ startSelect.options[i] = new Option(text,
startOptions[area][i]['value'], false, isSelected);
}
<?php // Destroy and rebuild the end select ?>
@@ -472,18 +579,19 @@
}
j = 0;
- for (i = 0; i < nEndOptions; i++)
+ for (i = 0; i < nEndOptions[area]; i++)
{
- if ((endOptions[i]['value'] <?php echo ($enable_periods) ? ">=" : ">"?>
startValue) ||
+ if ((endOptions[area][i]['value'] > startValue) ||
+ ((endOptions[area][i]['value'] == startValue) && enablePeriods) ||
(dateDifference != 0))
{
- isSelected = (endOptions[i]['value'] == endValue);
+ isSelected = (endOptions[area][i]['value'] == endValue);
if (dateDifference >= 0)
{
- text = endOptions[i]['text'] + nbsp + nbsp + '(' +
- getDuration(startValue, endOptions[i]['value'],
dateDifference) + ')';
+ text = endOptions[area][i]['text'] + nbsp + nbsp + '(' +
+ getDuration(startValue, endOptions[area][i]['value'],
dateDifference) + ')';
}
- endSelect.options[j] = new Option(text, endOptions[i]['value'], false,
isSelected);
+ endSelect.options[j] = new Option(text, endOptions[area][i]['value'],
false, isSelected);
j++;
}
}
@@ -500,14 +608,17 @@
// The width: auto is necessary to get the boxes to resize themselves
// according to their new contents.
?>
- $("#start_seconds").css({width: "auto"});
- $("#end_seconds").css({width: "auto"});
- var startWidth = $("#start_seconds").width();
- var endWidth = $("#end_seconds").width();
+ var startId = "#start_seconds" + area;
+ var endId = "#end_seconds" + area;
+ $(startId).css({width: "auto"});
+ $(endId).css({width: "auto"});
+ var startWidth = $(startId).width();
+ var endWidth = $(endId).width();
var maxWidth = Math.max(startWidth, endWidth) + 2;
- $("#end_seconds").width(maxWidth);
- $("#start_seconds").width(maxWidth);
- }
+ $(startId).width(maxWidth);
+ $(endId).width(maxWidth);
+ } <?php // function adjustSlotSelectors() ?>
+
<?php
}
@@ -634,10 +745,7 @@
?>
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();
@@ -663,31 +771,43 @@
// they are fully populated with options. We can then use the details
// to rebuild the selectors later on
?>
- nStartOptions = startSelect.options.length;
- for (var i=0; i < nStartOptions; i++)
+ var i, j, area, startSelect, endSelect;
+ for (i in areas)
{
- startOptions[i] = new Array();
- startOptions[i]['text'] = startSelect.options[i].text;
- startOptions[i]['value'] = parseInt(startSelect.options[i].value);
+ area = i;
+ startSelect = form["start_seconds" + area];
+ endSelect = form["end_seconds" + area];
+
+ startOptions[area] = new Array();
+ nStartOptions[area] = startSelect.options.length;
+ for (j=0; j < nStartOptions[area]; j++)
+ {
+ startOptions[area][j] = new Array();
+ startOptions[area][j]['text'] = startSelect.options[j].text;
+ startOptions[area][j]['value'] =
parseInt(startSelect.options[j].value);
+ }
+
+ endOptions[area] = new Array();
+ nEndOptions[area] = endSelect.options.length;
+ for (j=0; j < nEndOptions[area]; j++)
+ {
+ endOptions[area][j] = new Array();
+ endOptions[area][j]['text'] = endSelect.options[j].text;
+ endOptions[area][j]['value'] = parseInt(endSelect.options[j].value);
+ }
}
- nEndOptions = endSelect.options.length;
- for (var i=0; i < nEndOptions; i++)
- {
- endOptions[i] = new Array();
- endOptions[i]['text'] = endSelect.options[i].text;
- endOptions[i]['value'] = parseInt(endSelect.options[i].value);
- }
-
adjustSlotSelectors(form);
<?php
// If this is an All Day booking then check the All Day box and disable
the
// start and end time boxes
?>
+ startSelect = form["start_seconds" + currentArea];
+ endSelect = form["end_seconds" + currentArea];
if (!form.all_day.disabled &&
- (parseInt(startSelect.options[startSelect.selectedIndex].value) ==
startOptions[0]['value']) &&
- (parseInt(endSelect.options[endSelect.selectedIndex].value) ==
endOptions[nEndOptions - 1]['value']))
+ (parseInt(startSelect.options[startSelect.selectedIndex].value) ==
startOptions[currentArea][0]['value']) &&
+ (parseInt(endSelect.options[endSelect.selectedIndex].value) ==
endOptions[currentArea][nEndOptions[currentArea] - 1]['value']))
{
form.all_day.checked = true;
startSelect.disabled = true;
Modified: mrbs/branches/from_to_bookings/web/edit_entry.php
===================================================================
--- mrbs/branches/from_to_bookings/web/edit_entry.php 2010-11-03 17:52:41 UTC
(rev 1584)
+++ mrbs/branches/from_to_bookings/web/edit_entry.php 2010-11-05 11:22:33 UTC
(rev 1585)
@@ -54,10 +54,20 @@
// Generate a time or period selector starting with $first and ending with
$last.
// $time is a full Unix timestamp and is the current value. The selector
returns
// the start time in seconds since the beginning of the day for the start of
that slot
-function genslotselector($prefix, $first, $last, $time)
+// The $display parameter sets the display style of the <select>
+function genslotselector($area, $prefix, $first, $last, $time,
$display="block")
{
- global $resolution, $twentyfourhour_format, $periods, $enable_periods;
+ global $twentyfourhour_format, $periods;
+ $html = '';
+ // Get the settings for this area. Note that the variables below are
+ // local variables, not globals.
+ $enable_periods = $area['enable_periods'];
+ $resolution = ($enable_periods) ? 60 : $area['resolution'];
+ // If they've asked for "display: none" then we'll also disable the select so
+ // hat there is only one select passing through the variable to the handler
+ $disabled = (strtolower($display) == "none") ? " disabled=\"disabled\"" : "";
+
$date = getdate($time);
$time_zero = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']);
if ($enable_periods)
@@ -68,7 +78,7 @@
{
$format = ($twentyfourhour_format) ? "%R" : "%l:%M %P";
}
- $html .= "<select id = \"${prefix}seconds\" name=\"${prefix}seconds\"
onChange=\"adjustSlotSelectors(this.form)\">\n";
+ $html .= "<select style=\"display: $display\" id =
\"${prefix}seconds${area['id']}\" name=\"${prefix}seconds\"
onChange=\"adjustSlotSelectors(this.form)\"$disabled>\n";
for ($t = $first; $t <= $last; $t = $t + $resolution)
{
$timestamp = $t + $time_zero;
@@ -304,6 +314,25 @@
$name = "";
$create_by = $user;
$description = "";
+ $type = "I";
+ $room_id = $room;
+ $rep_id = 0;
+ $rep_type = REP_NONE;
+ $rep_end_day = $day;
+ $rep_end_month = $month;
+ $rep_end_year = $year;
+ $rep_day = array(0, 0, 0, 0, 0, 0, 0);
+ $private = $private_default;
+ $confirmed = $confirmed_default;
+
+ // now initialise the custom fields
+ foreach ($fields as $field)
+ {
+ if (!in_array($field['name'], $standard_fields['entry']))
+ {
+ $custom_fields[$field['name']] = '';
+ }
+ }
// Get the hour and minute, converting a period to its MRBS time
// Set some sensible defaults
@@ -337,26 +366,6 @@
}
$duration = ($enable_periods ? 60 : $default_duration);
$end_time = $start_time + $duration;
- $type = "I";
- $room_id = $room;
- unset($id);
-
- $rep_id = 0;
- $rep_type = REP_NONE;
- $rep_end_day = $day;
- $rep_end_month = $month;
- $rep_end_year = $year;
- $rep_day = array(0, 0, 0, 0, 0, 0, 0);
- $private = $private_default;
- $confirmed = $confirmed_default;
- // now initialise the custom fields
- foreach ($fields as $field)
- {
- if (!in_array($field['name'], $standard_fields['entry']))
- {
- $custom_fields[$field['name']] = '';
- }
- }
}
$start_hour = strftime('%H', $start_time);
@@ -374,6 +383,8 @@
$room_id = $row['id'];
}
+// Determine the area id of the room in question first
+$area_id = mrbsGetRoomArea($room_id);
// Remove "Undefined variable" notice
@@ -394,11 +405,64 @@
print_header($day, $month, $year, $area, isset($room) ? $room : "");
+// Get the details of all the rooms
+$rooms = array();
+$sql = "SELECT id, room_name, area_id
+ FROM $tbl_room
+ ORDER BY area_id, sort_key";
+$res = sql_query($sql);
+if ($res)
+{
+ for ($i = 0; ($row = sql_row_keyed($res, $i)); $i++)
+ {
+ $rooms[$row['id']] = $row;
+ }
+}
+
+// Get the details of all the areas
+$areas = array();
+$sql = "SELECT id, area_name, resolution, default_duration, enable_periods,
+ morningstarts, morningstarts_minutes, eveningends ,
eveningends_minutes
+ FROM $tbl_area
+ ORDER BY area_name";
+$res = sql_query($sql);
+if ($res)
+{
+ for ($i = 0; ($row = sql_row_keyed($res, $i)); $i++)
+ {
+ $areas[$row['id']] = $row;
+ }
+}
+
?>
<script type="text/javascript">
//<![CDATA[
+var currentArea = <?php echo $area_id ?>;
+var areas = new Array();
+<?php
+// give JavaScript a copy of the PHP array $areas
+foreach ($areas as $area)
+{
+ echo "areas[${area['id']}] = new Array();\n";
+ foreach ($area as $key => $value)
+ {
+ if ($key == "area_name")
+ {
+ // Enclose strings in quotes
+ $value = "'$value'";
+ }
+ elseif (in_array($key, $boolean_fields['area']))
+ {
+ // Convert booleans
+ $value = ($value) ? 'true' : 'false';
+ }
+ echo "areas[${area['id']}]['$key'] = $value;\n";
+ }
+}
+?>
+
// do a little form verifying
function validate(form)
{
@@ -525,8 +589,8 @@
var form = document.forms["main"];
if (form)
{
- var startSelect = form.start_seconds;
- var endSelect = form.end_seconds;
+ var startSelect = form["start_seconds" + currentArea];
+ var endSelect = form["end_seconds" + currentArea];
var i;
if (form.all_day.checked) // If checking the box...
{
@@ -635,28 +699,34 @@
}
echo "</div>\n";
- if ($enable_periods)
- {
- $resolution = 60;
- $first = 12*60*60;
- // If we're using periods we just go to the beginning of the last slot
- $last = $first + ((count($periods) - 1) * $resolution);
- }
- else
- {
- $first = (($morningstarts * 60) + $morningstarts_minutes) * 60;
- $last = (($eveningends * 60) + $eveningends_minutes) * 60;
- $last = $last + $resolution;
- }
+
echo "<div id=\"div_start_date\">\n";
echo "<label for=\"start_datepicker\">" . get_vocab("start") .
":</label>\n";
$date = getdate($start_time);
gendateselector("start_", $date['mday'], $date['mon'], $date['year']);
// If we're using periods the booking model is slightly different:
// you're allowed to specify the last period as your first period.
- // This is why we don't substract the $resolution
- $start_last = ($enable_periods) ? $last : $last - $resolution;
- genslotselector("start_", $first, $start_last, $start_time);
+ // This is why we don't substract the resolution
+
+ foreach ($areas as $a)
+ {
+ if ($a['enable_periods'])
+ {
+ $a['resolution'] = 60;
+ $first = 12*60*60;
+ // If we're using periods we just go to the beginning of the last slot
+ $last = $first + ((count($periods) - 1) * $a['resolution']);
+ }
+ else
+ {
+ $first = (($a['morningstarts'] * 60) + $a['morningstarts_minutes']) *
60;
+ $last = (($a['eveningends'] * 60) + $a['eveningends_minutes']) * 60;
+ $last = $last + $a['resolution'];
+ }
+ $start_last = ($a['enable_periods']) ? $last : $last - $a['resolution'];
+ $display = ($a['id'] == $area_id) ? "block" : "none";
+ genslotselector($a, "start_", $first, $start_last, $start_time,
$display);
+ }
?>
<div class="group">
@@ -678,46 +748,32 @@
// If we're using periods the booking model is slightly different,
// so subtract one period because the "end" period is actually the
beginning
// of the last period booked
- $end_value = ($enable_periods) ? $end_time - $resolution : $end_time;
- genslotselector("end_", $first, $last, $end_value);
- echo "</div>\n";
-
- ?>
- <div id="div_areas">
- </div>
-
- <?php
- // Determine the area id of the room in question first
- $area_id = mrbsGetRoomArea($room_id);
-
- // Get the details of all the rooms
- $rooms = array();
- $sql = "SELECT id, room_name, area_id
- FROM $tbl_room
- ORDER BY area_id, sort_key";
- $res = sql_query($sql);
- if ($res)
+ foreach ($areas as $a)
{
- for ($i = 0; ($row = sql_row_keyed($res, $i)); $i++)
+ if ($a['enable_periods'])
{
- $rooms[$row['id']] = $row;
+ $a['resolution'] = 60;
+ $first = 12*60*60;
+ // If we're using periods we just go to the beginning of the last slot
+ $last = $first + ((count($periods) - 1) * $a['resolution']);
}
- }
-
- // Get the details of all the areas
- $areas = array();
- $sql = "SELECT id, area_name, resolution, enable_periods
- FROM $tbl_area
- ORDER BY area_name";
- $res = sql_query($sql);
- if ($res)
- {
- for ($i = 0; ($row = sql_row_keyed($res, $i)); $i++)
+ else
{
- $areas[$row['id']] = $row;
+ $first = (($a['morningstarts'] * 60) + $a['morningstarts_minutes']) *
60;
+ $last = (($a['eveningends'] * 60) + $a['eveningends_minutes']) * 60;
+ $last = $last + $a['resolution'];
}
+ $end_value = ($a['enable_periods']) ? $end_time - $a['resolution'] :
$end_time;
+ $display = ($a['id'] == $area_id) ? "block" : "none";
+ genslotselector($a, "end_", $first, $last, $end_value, $display);
}
+ echo "</div>\n";
+ ?>
+ <div id="div_areas">
+ </div>
+
+ <?php
// if there is more than one area then give the option
// to choose areas.
if (count($areas) > 1)
@@ -770,6 +826,37 @@
}
?>
} //switch
+
+ <?php
+ // Replace the start and end selectors with those for the new area
+ // (1) We set the display for the old elements to "none" and the new
+ // elements to "block". (2) We also need to disable the old
selectors and
+ // enable the new ones: they all have the same name, so we only want
+ // one passed through with the form. (3) We take a note of the
currently
+ // selected start and end values so that we can have a go at finding a
+ // similar time/period in the new area. (4) We also take a note of the
old
+ // area id because we'll need that when trying to match up slots: it
only
+ // makes sense to match up slots if both old and new area used the same
+ // mode (periods/times).
+ ?>
+ var oldStartId = "start_seconds" + currentArea;
+ var oldEndId = "end_seconds" + currentArea;
+ var newStartId = "start_seconds" + area;
+ var newEndId = "end_seconds" + area;
+ var oldAreaStartValue =
formObj[oldStartId].options[formObj[oldStartId].selectedIndex].value;
+ var oldAreaEndValue =
formObj[oldEndId].options[formObj[oldEndId].selectedIndex].value;
+ $("#" + oldStartId).css({display: "none"});
+ $("#" + oldStartId).attr('disabled', 'disabled');
+ $("#" + oldEndId).css({display: "none"});
+ $("#" + oldEndId).attr('disabled', 'disabled');
+ $("#" + newStartId).css({display: "block"});
+ $("#" + newStartId).removeAttr('disabled');
+ $("#" + newEndId).css({display: "block"});
+ $("#" + newEndId).removeAttr('disabled');
+ var oldArea = currentArea;
+ currentArea = area;
+ prevStartValue = undefined;
+ adjustSlotSelectors(formObj, oldArea, oldAreaStartValue,
oldAreaEndValue);
}
// Create area selector, only if we have Javascript
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits