Revision: 1542
http://mrbs.svn.sourceforge.net/mrbs/?rev=1542&view=rev
Author: cimorrison
Date: 2010-10-25 11:30:48 +0000 (Mon, 25 Oct 2010)
Log Message:
-----------
Implemented $enable_periods on a per-area basis. This means that sites can
now have some areas using periods and others using time slots.
Modified Paths:
--------------
mrbs/trunk/tables.my.sql
mrbs/trunk/tables.pg.pre73.sql
mrbs/trunk/tables.pg.sql
mrbs/trunk/web/Themes/default/header.inc
mrbs/trunk/web/dbsys.inc
mrbs/trunk/web/edit_area_room.php
mrbs/trunk/web/functions.inc
mrbs/trunk/web/internalconfig.inc.php
mrbs/trunk/web/lang.en
mrbs/trunk/web/mrbs-ielte7.css.php
mrbs/trunk/web/mrbs.css.php
Added Paths:
-----------
mrbs/trunk/web/upgrade/16/
mrbs/trunk/web/upgrade/16/mysql.sql
mrbs/trunk/web/upgrade/16/pgsql.sql
mrbs/trunk/web/upgrade/16/post.inc
Modified: mrbs/trunk/tables.my.sql
===================================================================
--- mrbs/trunk/tables.my.sql 2010-10-23 13:10:24 UTC (rev 1541)
+++ mrbs/trunk/tables.my.sql 2010-10-25 11:30:48 UTC (rev 1542)
@@ -39,6 +39,7 @@
custom_html text,
provisional_enabled tinyint(1),
reminders_enabled tinyint(1),
+ enable_periods tinyint(1),
PRIMARY KEY (id)
);
@@ -129,6 +130,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ( 'db_version', '15');
+ VALUES ( 'db_version', '16');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ( 'local_db_version', '1');
Modified: mrbs/trunk/tables.pg.pre73.sql
===================================================================
--- mrbs/trunk/tables.pg.pre73.sql 2010-10-23 13:10:24 UTC (rev 1541)
+++ mrbs/trunk/tables.pg.pre73.sql 2010-10-25 11:30:48 UTC (rev 1542)
@@ -41,7 +41,8 @@
max_book_ahead_secs int,
custom_html text,
provisional_enabled smallint,
- reminders_enabled smallint
+ reminders_enabled smallint,
+ enable_periods smallint
);
CREATE TABLE mrbs_room
@@ -120,6 +121,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ('db_version', '15');
+ VALUES ('db_version', '16');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ('local_db_version', '1');
Modified: mrbs/trunk/tables.pg.sql
===================================================================
--- mrbs/trunk/tables.pg.sql 2010-10-23 13:10:24 UTC (rev 1541)
+++ mrbs/trunk/tables.pg.sql 2010-10-25 11:30:48 UTC (rev 1542)
@@ -54,7 +54,8 @@
max_book_ahead_secs int,
custom_html text,
provisional_enabled smallint,
- reminders_enabled smallint
+ reminders_enabled smallint,
+ enable_periods smallint
);
CREATE TABLE mrbs_room
@@ -133,6 +134,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ('db_version', '15');
+ VALUES ('db_version', '16');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ('local_db_version', '1');
Modified: mrbs/trunk/web/Themes/default/header.inc
===================================================================
--- mrbs/trunk/web/Themes/default/header.inc 2010-10-23 13:10:24 UTC (rev
1541)
+++ mrbs/trunk/web/Themes/default/header.inc 2010-10-25 11:30:48 UTC (rev
1542)
@@ -195,6 +195,24 @@
if ($page == 'edit_area_room')
{
?>
+ var enablePeriods;
+
+ function toggleMode(form, speed)
+ {
+ if (speed === undefined)
+ {
+ speed = 'slow';
+ }
+ if (form.area_enable_periods[0].checked != enablePeriods)
+ {
+ enablePeriods = !enablePeriods;
+ $('#time_settings').animate({
+ opacity : 'toggle',
+ height: 'toggle'
+ }, speed);
+ }
+ }
+
// disable the min and max book ahead values and units if the corresponding
// checkbox isn't checkd; and enable it it is.
function check_book_ahead()
@@ -310,7 +328,19 @@
// EDIT_AREA_ROOM.PHP
if ($page == 'edit_area_room')
{
+ // We need to hide the sections of the form relating to times
+ // slots if the form is loaded with periods enabled. We hide
+ // the times sections instantly by setting speed = 0;
+ // [This method works if there are no periods-specific settings.
+ // When we get those we will have to do something different]
?>
+ var form = document.getElementById('edit_area');
+ enablePeriods = false;
+ if (form.area_enable_periods[0].checked)
+ {
+ toggleMode(form, 0);
+ }
+
check_book_ahead();
<?php
}
Modified: mrbs/trunk/web/dbsys.inc
===================================================================
--- mrbs/trunk/web/dbsys.inc 2010-10-23 13:10:24 UTC (rev 1541)
+++ mrbs/trunk/web/dbsys.inc 2010-10-25 11:30:48 UTC (rev 1542)
@@ -15,7 +15,7 @@
$tbl_variables = $db_tbl_prefix . "variables";
-$db_schema_version = 15;
+$db_schema_version = 16;
$local_db_schema_version = 1;
Modified: mrbs/trunk/web/edit_area_room.php
===================================================================
--- mrbs/trunk/web/edit_area_room.php 2010-10-23 13:10:24 UTC (rev 1541)
+++ mrbs/trunk/web/edit_area_room.php 2010-10-25 11:30:48 UTC (rev 1542)
@@ -78,6 +78,7 @@
$area_private_override = get_form_var('area_private_override', 'string');
$area_provisional_enabled = get_form_var('area_provisional_enabled', 'string');
$area_reminders_enabled = get_form_var('area_reminders_enabled', 'string');
+$area_enable_periods = get_form_var('area_enable_periods', 'string');
$custom_html = get_form_var('custom_html', 'string'); // Used for both area
and room, but you only ever have one or the other
$change_done = get_form_var('change_done', 'string');
$change_room = get_form_var('change_room', 'string');
@@ -325,6 +326,7 @@
$area_private_mandatory = (!empty($area_private_mandatory)) ? 1 : 0;
$area_provisional_enabled = (!empty($area_provisional_enabled)) ? 1 : 0;
$area_reminders_enabled = (!empty($area_reminders_enabled)) ? 1 : 0;
+ $area_enable_periods = (!empty($area_enable_periods)) ? 1 : 0;
if (!$enable_periods)
{
@@ -389,6 +391,7 @@
$assign_array[] = "private_override='" . $area_private_override . "'";
$assign_array[] = "provisional_enabled=" . $area_provisional_enabled;
$assign_array[] = "reminders_enabled=" . $area_reminders_enabled;
+ $assign_array[] = "enable_periods=" . $area_enable_periods;
$sql .= implode(",", $assign_array) . " WHERE id=$area";
if (sql_command($sql) < 0)
@@ -663,263 +666,281 @@
echo htmlspecialchars($row['custom_html']);
echo "</textarea>\n";
echo "</div>\n";
+
+ // Mode - Times or Periods
+ echo "<div id=\"mode\">\n";
+ echo "<label>" . get_vocab("mode") . ":</label>\n";
+ echo "<div class=\"group\">\n";
+ echo "<label>\n";
+ $checked = ($enable_periods) ? " checked=\"checked\"" : "";
+ echo "<input class=\"radio\" type=\"radio\"
name=\"area_enable_periods\" value=\"1\"
onClick=\"toggleMode(this.form)\"$checked>\n";
+ echo get_vocab("mode_periods") . "</label>\n";
+ echo "<label>\n";
+ $checked = ($enable_periods) ? "" : " checked=\"checked\"";
+ echo "<input class=\"radio\" type=\"radio\"
name=\"area_enable_periods\" value=\"0\"
onClick=\"toggleMode(this.form)\"$checked>\n";
+ echo get_vocab("mode_times") . "</label>\n";
+ echo "</div>\n";
+ echo "</div>\n";
echo "</fieldset>\n";
-
- if (!$enable_periods)
- {
+
+
?>
- <script type="text/javascript">
- //<![CDATA[
+ <script type="text/javascript">
+ //<![CDATA[
- function getTimeString(time, twentyfourhour_format)
- {
- // Converts a time (in minutes since midnight) into a string
- // of the form hh:mm if twentyfourhour_format is true,
- // otherwise of the form hh:mm am/pm.
+ function getTimeString(time, twentyfourhour_format)
+ {
+ // Converts a time (in minutes since midnight) into a string
+ // of the form hh:mm if twentyfourhour_format is true,
+ // otherwise of the form hh:mm am/pm.
- // This function doesn't do a great job of replicating the PHP
- // internationalised format, but is probably sufficient for a
- // rarely used admin page.
+ // This function doesn't do a great job of replicating the PHP
+ // internationalised format, but is probably sufficient for a
+ // rarely used admin page.
- var minutes = time % 60;
- time -= minutes;
- var hour = time/60;
- if (!twentyfourhour_format)
- {
- var ap = "AM";
- if (hour > 11) {ap = "PM";}
- if (hour > 12) {hour = hour - 12;}
- if (hour == 0) {hour = 12;}
- }
- if (hour < 10) {hour = "0" + hour;}
- if (minutes < 10) {minutes = "0" + minutes;}
- var timeString = hour + ':' + minutes;
- if (!twentyfourhour_format)
- {
- timeString += ap;
- }
- return timeString;
- } // function getTimeString()
+ var minutes = time % 60;
+ time -= minutes;
+ var hour = time/60;
+ if (!twentyfourhour_format)
+ {
+ var ap = "AM";
+ if (hour > 11) {ap = "PM";}
+ if (hour > 12) {hour = hour - 12;}
+ if (hour == 0) {hour = 12;}
+ }
+ if (hour < 10) {hour = "0" + hour;}
+ if (minutes < 10) {minutes = "0" + minutes;}
+ var timeString = hour + ':' + minutes;
+ if (!twentyfourhour_format)
+ {
+ timeString += ap;
+ }
+ return timeString;
+ } // function getTimeString()
- function writeSelect(morningstarts, morningstarts_minutes,
eveningends, eveningends_minutes, res_mins)
+ function writeSelect(morningstarts, morningstarts_minutes,
eveningends, eveningends_minutes, res_mins)
+ {
+ // generates the HTML for the drop-down for the last slot time and
+ // puts it in the element with id 'last_slot'
+ if (res_mins == 0) return; // avoid endless loops
+
+ var first_slot = (morningstarts * 60) + morningstarts_minutes;
+ var last_slot = (eveningends * 60) + eveningends_minutes;
+ var last_possible = (24 * 60) - res_mins;
+ var html = '<label for="area_eveningends_t"><?php echo
get_vocab("area_last_slot_start")?>:<\/label>\n';
+ html += '<select id="area_eveningends_t"
name="area_eveningends_t">\n';
+ for (var t=first_slot; t <= last_possible; t += res_mins)
{
- // generates the HTML for the drop-down for the last slot time and
- // puts it in the element with id 'last_slot'
- if (res_mins == 0) return; // avoid endless loops
-
- var first_slot = (morningstarts * 60) + morningstarts_minutes;
- var last_slot = (eveningends * 60) + eveningends_minutes;
- var last_possible = (24 * 60) - res_mins;
- var html = '<label for="area_eveningends_t"><?php echo
get_vocab("area_last_slot_start")?>:<\/label>\n';
- html += '<select id="area_eveningends_t"
name="area_eveningends_t">\n';
- for (var t=first_slot; t <= last_possible; t += res_mins)
+ html += '<option value="' + t + '"';
+ if (t == last_slot)
{
- html += '<option value="' + t + '"';
- if (t == last_slot)
- {
- html += ' selected="selected"';
- }
- html += ">" + getTimeString(t, <?php echo
($twentyfourhour_format ? "true" : "false") ?>) + "<\/option>\n";
+ html += ' selected="selected"';
}
- html += "<\/select>\n";
- document.getElementById('last_slot').innerHTML = html;
- } // function writeSelect
+ html += ">" + getTimeString(t, <?php echo ($twentyfourhour_format
? "true" : "false") ?>) + "<\/option>\n";
+ }
+ html += "<\/select>\n";
+ document.getElementById('last_slot').innerHTML = html;
+ } // function writeSelect
- function changeSelect(formObj)
+ function changeSelect(formObj)
+ {
+ // re-generates the dropdown given changed form values
+ var res_mins = parseInt(formObj.area_res_mins.value);
+ if (res_mins == 0) return; // avoid endless loops and divide by
zero errors
+ var morningstarts = parseInt(formObj.area_morningstarts.value);
+ var morningstarts_minutes =
parseInt(formObj.area_morningstarts_minutes.value);
+ var eveningends_t = parseInt(formObj.area_eveningends_t.value);
+ var morningstarts_t = (morningstarts * 60) + morningstarts_minutes;
+ var ampm = "am";
+ if (formObj.area_morning_ampm &&
formObj.area_morning_ampm[1].checked)
{
- // re-generates the dropdown given changed form values
- var res_mins = parseInt(formObj.area_res_mins.value);
- if (res_mins == 0) return; // avoid endless loops and divide by
zero errors
- var morningstarts = parseInt(formObj.area_morningstarts.value);
- var morningstarts_minutes =
parseInt(formObj.area_morningstarts_minutes.value);
- var eveningends_t = parseInt(formObj.area_eveningends_t.value);
- var morningstarts_t = (morningstarts * 60) + morningstarts_minutes;
- var ampm = "am";
- if (formObj.area_morning_ampm &&
formObj.area_morning_ampm[1].checked)
+ ampm = "pm";
+ }
+ if (<?php echo (!$twentyfourhour_format ? "true" : "false") ?>)
+ {
+ if ((ampm == "pm") && (morningstarts < 12))
{
- ampm = "pm";
- }
- if (<?php echo (!$twentyfourhour_format ? "true" : "false") ?>)
- {
- if ((ampm == "pm") && (morningstarts < 12))
- {
- morningstarts += 12;
- }
- if ((ampm == "am") && (morningstarts>11))
- {
- morningstarts -= 12;
- }
+ morningstarts += 12;
}
- // Find valid values for eveningends
- var remainder = (eveningends_t - morningstarts_t) % res_mins;
- // round up to the nearest slot boundary
- if (remainder != 0)
+ if ((ampm == "am") && (morningstarts>11))
{
- eveningends_t += res_mins - remainder;
+ morningstarts -= 12;
}
- // and then step back to make sure that the end of the slot isn't
past midnight (and the beginning isn't before the morning start)
- while ((eveningends_t + res_mins > 1440) && (eveningends_t >
morningstarts_t + res_mins)) // 1440 minutes in a day
- {
- eveningends_t -= res_mins;
- }
- // convert into hours and minutes
- var eveningends_minutes = eveningends_t % 60;
- var eveningends = (eveningends_t - eveningends_minutes) / 60;
- writeSelect (morningstarts, morningstarts_minutes, eveningends,
eveningends_minutes, res_mins);
- } // function changeSelect
-
- //]]>
- </script>
-
- <fieldset>
- <legend><?php echo get_vocab("time_settings")?></legend>
- <div class="div_time">
- <label><?php echo get_vocab("area_first_slot_start")?>:</label>
- <?php
- echo "<input class=\"time_hour\" type=\"text\"
id=\"area_morningstarts\" name=\"area_morningstarts\" value=\"";
- if ($twentyfourhour_format)
- {
- printf("%02d", $morningstarts);
}
- elseif ($morningstarts > 12)
+ // Find valid values for eveningends
+ var remainder = (eveningends_t - morningstarts_t) % res_mins;
+ // round up to the nearest slot boundary
+ if (remainder != 0)
{
- echo ($morningstarts - 12);
- }
- elseif ($morningstarts == 0)
- {
- echo "12";
+ eveningends_t += res_mins - remainder;
}
- else
+ // and then step back to make sure that the end of the slot isn't
past midnight (and the beginning isn't before the morning start)
+ while ((eveningends_t + res_mins > 1440) && (eveningends_t >
morningstarts_t + res_mins)) // 1440 minutes in a day
{
- echo $morningstarts;
- }
- echo "\" maxlength=\"2\" onChange=\"changeSelect(this.form)\">\n";
- ?>
- <span>:</span>
- <input class="time_minute" type="text"
id="area_morningstarts_minutes" name="area_morningstarts_minutes" value="<?php
printf("%02d", $morningstarts_minutes) ?>" maxlength="2"
onChange="changeSelect(this.form)">
- <?php
- if (!$twentyfourhour_format)
- {
- echo "<div class=\"group ampm\">\n";
- $checked = ($morningstarts < 12) ? "checked=\"checked\"" : "";
- echo " <label><input name=\"area_morning_ampm\"
type=\"radio\" value=\"am\" onClick=\"changeSelect(this.form)\" $checked>" .
utf8_strftime("%p",mktime(1,0,0,1,1,2000)) . "</label>\n";
- $checked = ($morningstarts >= 12) ? "checked=\"checked\"" : "";
- echo " <label><input name=\"area_morning_ampm\"
type=\"radio\" value=\"pm\" onClick=\"changeSelect(this.form)\" $checked>".
utf8_strftime("%p",mktime(13,0,0,1,1,2000)) . "</label>\n";
- echo "</div>\n";
+ eveningends_t -= res_mins;
}
- ?>
- </div>
+ // convert into hours and minutes
+ var eveningends_minutes = eveningends_t % 60;
+ var eveningends = (eveningends_t - eveningends_minutes) / 60;
+ writeSelect (morningstarts, morningstarts_minutes, eveningends,
eveningends_minutes, res_mins);
+ } // function changeSelect
+
+ //]]>
+ </script>
- <div class="div_dur_mins">
- <label for="area_res_mins"><?php echo get_vocab("area_res_mins")
?>:</label>
- <input type="text" id="area_res_mins" name="area_res_mins"
value="<?php echo $resolution/60 ?>" onChange="changeSelect(this.form)">
- </div>
-
- <div class="div_dur_mins">
- <label for="area_def_duration_mins"><?php echo
get_vocab("area_def_duration_mins") ?>:</label>
- <input type="text" id="area_def_duration_mins"
name="area_def_duration_mins" value="<?php echo $default_duration/60 ?>">
- </div>
+ <fieldset id="time_settings">
+ <legend></legend>
+ <fieldset >
+ <legend><?php echo get_vocab("time_settings")?>
+ <span class="js_none"> (<?php echo get_vocab("times_only")
?>)</span>
+ </legend>
+ <div class="div_time">
+ <label><?php echo get_vocab("area_first_slot_start")?>:</label>
<?php
- echo "<div id=\"last_slot\">\n";
- // The contents of this div will be overwritten by JavaScript if
enabled. The JavaScript version is a drop-down
- // select input with options limited to those times for the last slot
start that are valid. The options are
- // dynamically regenerated if the start of the first slot or the
resolution change. The code below is
- // therefore an alternative for non-JavaScript browsers.
- echo "<div class=\"div_time\">\n";
- echo "<label>" . get_vocab("area_last_slot_start") . ":</label>\n";
- echo "<input class=\"time_hour\" type=\"text\"
id=\"area_eveningends\" name=\"area_eveningends\" value=\"";
- if ($twentyfourhour_format)
- {
- printf("%02d", $eveningends);
- }
- elseif ($eveningends > 12)
- {
- echo ($eveningends - 12);
- }
- elseif ($eveningends == 0)
- {
- echo "12";
- }
- else
- {
- echo $eveningends;
- }
- echo "\" maxlength=\"2\" onChange=\"changeSelect(this.form)\">\n";
-
- echo "<span>:</span>\n";
- echo "<input class=\"time_minute\" type=\"text\"
id=\"area_eveningends_minutes\" name=\"area_eveningends_minutes\" value=\"";
- printf("%02d", $eveningends_minutes);
- echo "\" maxlength=\"2\" onChange=\"changeSelect(this.form)\">\n";
- if (!$twentyfourhour_format)
- {
- echo "<div class=\"group ampm\">\n";
- $checked = ($eveningends < 12) ? "checked=\"checked\"" : "";
- echo " <label><input name=\"area_evening_ampm\"
type=\"radio\" value=\"am\" onClick=\"changeSelect(this.form)\" $checked>" .
utf8_strftime("%p",mktime(1,0,0,1,1,2000)) . "</label>\n";
- $checked = ($eveningends >= 12) ? "checked=\"checked\"" : "";
- echo " <label><input name=\"area_evening_ampm\"
type=\"radio\" value=\"pm\" onClick=\"changeSelect(this.form)\" $checked>".
utf8_strftime("%p",mktime(13,0,0,1,1,2000)) . "</label>\n";
- echo "</div>\n";
- }
- echo "</div>\n";
- echo "</div>\n"; // last_slot
+ echo "<input class=\"time_hour\" type=\"text\"
id=\"area_morningstarts\" name=\"area_morningstarts\" value=\"";
+ if ($twentyfourhour_format)
+ {
+ printf("%02d", $morningstarts);
+ }
+ elseif ($morningstarts > 12)
+ {
+ echo ($morningstarts - 12);
+ }
+ elseif ($morningstarts == 0)
+ {
+ echo "12";
+ }
+ else
+ {
+ echo $morningstarts;
+ }
+ echo "\" maxlength=\"2\" onChange=\"changeSelect(this.form)\">\n";
?>
-
- <script type="text/javascript">
- //<![CDATA[
- writeSelect(<?php echo "$morningstarts, $morningstarts_minutes,
$eveningends, $eveningends_minutes, $resolution/60" ?>);
- //]]>
- </script>
- </fieldset>
-
+ <span>:</span>
+ <input class="time_minute" type="text" id="area_morningstarts_minutes"
name="area_morningstarts_minutes" value="<?php printf("%02d",
$morningstarts_minutes) ?>" maxlength="2" onChange="changeSelect(this.form)">
<?php
- // Booking policies
- $min_ba_value = $min_book_ahead_secs;
- toTimeString($min_ba_value, $min_ba_units);
- $max_ba_value = $max_book_ahead_secs;
- toTimeString($max_ba_value, $max_ba_units);
- echo "<fieldset id=\"booking_policies\">\n";
- echo "<legend>" . get_vocab("booking_policies") . "</legend>\n";
- // Minimum book ahead
- echo "<div>\n";
- echo "<label for=\"area_min_book_ahead\">" .
get_vocab("min_book_ahead") . ":</label>\n";
- echo "<input class=\"checkbox\" type=\"checkbox\"
id=\"area_min_ba_enabled\" name=\"area_min_ba_enabled\"" .
- (($min_book_ahead_enabled) ? " checked=\"checked\"" : "") .
- " onChange=\"check_book_ahead()\">\n";
- echo "<input class=\"text\" type=\"text\" name=\"area_min_ba_value\"
value=\"$min_ba_value\">";
- echo "<select id=\"area_min_ba_units\" name=\"area_min_ba_units\">\n";
- $units = array("seconds", "minutes", "hours", "days", "weeks");
- foreach ($units as $unit)
+ if (!$twentyfourhour_format)
{
- echo "<option value=\"$unit\"" .
- (($min_ba_units == get_vocab($unit)) ? " selected=\"selected\""
: "") .
- ">" . get_vocab($unit) . "</option>\n";
+ echo "<div class=\"group ampm\">\n";
+ $checked = ($morningstarts < 12) ? "checked=\"checked\"" : "";
+ echo " <label><input name=\"area_morning_ampm\" type=\"radio\"
value=\"am\" onClick=\"changeSelect(this.form)\" $checked>" .
utf8_strftime("%p",mktime(1,0,0,1,1,2000)) . "</label>\n";
+ $checked = ($morningstarts >= 12) ? "checked=\"checked\"" : "";
+ echo " <label><input name=\"area_morning_ampm\" type=\"radio\"
value=\"pm\" onClick=\"changeSelect(this.form)\" $checked>".
utf8_strftime("%p",mktime(13,0,0,1,1,2000)) . "</label>\n";
+ echo "</div>\n";
}
- echo "</select>\n";
- echo "</div>\n";
- // Maximum book ahead
- echo "<div>\n";
- echo "<label for=\"area_max_book_ahead\">" .
get_vocab("max_book_ahead") . ":</label>\n";
- echo "<input class=\"checkbox\" type=\"checkbox\"
id=\"area_max_ba_enabled\" name=\"area_max_ba_enabled\"" .
- (($max_book_ahead_enabled) ? " checked=\"checked\"" : "") .
- " onChange=\"check_book_ahead()\">\n";
- echo "<input class=\"text\" type=\"text\" name=\"area_max_ba_value\"
value=\"$max_ba_value\">";
- echo "<select id=\"area_max_ba_units\" name=\"area_max_ba_units\">\n";
- $units = array("seconds", "minutes", "hours", "days", "weeks");
- foreach ($units as $unit)
+ ?>
+ </div>
+
+ <div class="div_dur_mins">
+ <label for="area_res_mins"><?php echo get_vocab("area_res_mins")
?>:</label>
+ <input type="text" id="area_res_mins" name="area_res_mins" value="<?php
echo $resolution/60 ?>" onChange="changeSelect(this.form)">
+ </div>
+
+ <div class="div_dur_mins">
+ <label for="area_def_duration_mins"><?php echo
get_vocab("area_def_duration_mins") ?>:</label>
+ <input type="text" id="area_def_duration_mins"
name="area_def_duration_mins" value="<?php echo $default_duration/60 ?>">
+ </div>
+ <?php
+ echo "<div id=\"last_slot\">\n";
+ // The contents of this div will be overwritten by JavaScript if
enabled. The JavaScript version is a drop-down
+ // select input with options limited to those times for the last slot
start that are valid. The options are
+ // dynamically regenerated if the start of the first slot or the
resolution change. The code below is
+ // therefore an alternative for non-JavaScript browsers.
+ echo "<div class=\"div_time\">\n";
+ echo "<label>" . get_vocab("area_last_slot_start") . ":</label>\n";
+ echo "<input class=\"time_hour\" type=\"text\" id=\"area_eveningends\"
name=\"area_eveningends\" value=\"";
+ if ($twentyfourhour_format)
{
- echo "<option value=\"$unit\"" .
- (($max_ba_units == get_vocab($unit)) ? " selected=\"selected\""
: "") .
- ">" . get_vocab($unit) . "</option>\n";
+ printf("%02d", $eveningends);
}
- echo "</select>\n";
- echo "</div>\n";
- echo "</fieldset>\n";
- } // end if (!$enable_periods)
-
+ elseif ($eveningends > 12)
+ {
+ echo ($eveningends - 12);
+ }
+ elseif ($eveningends == 0)
+ {
+ echo "12";
+ }
+ else
+ {
+ echo $eveningends;
+ }
+ echo "\" maxlength=\"2\" onChange=\"changeSelect(this.form)\">\n";
+
+ echo "<span>:</span>\n";
+ echo "<input class=\"time_minute\" type=\"text\"
id=\"area_eveningends_minutes\" name=\"area_eveningends_minutes\" value=\"";
+ printf("%02d", $eveningends_minutes);
+ echo "\" maxlength=\"2\" onChange=\"changeSelect(this.form)\">\n";
+ if (!$twentyfourhour_format)
+ {
+ echo "<div class=\"group ampm\">\n";
+ $checked = ($eveningends < 12) ? "checked=\"checked\"" : "";
+ echo " <label><input name=\"area_evening_ampm\" type=\"radio\"
value=\"am\" onClick=\"changeSelect(this.form)\" $checked>" .
utf8_strftime("%p",mktime(1,0,0,1,1,2000)) . "</label>\n";
+ $checked = ($eveningends >= 12) ? "checked=\"checked\"" : "";
+ echo " <label><input name=\"area_evening_ampm\" type=\"radio\"
value=\"pm\" onClick=\"changeSelect(this.form)\" $checked>".
utf8_strftime("%p",mktime(13,0,0,1,1,2000)) . "</label>\n";
+ echo "</div>\n";
+ }
+ echo "</div>\n";
+ echo "</div>\n"; // last_slot
?>
+ <script type="text/javascript">
+ //<![CDATA[
+ writeSelect(<?php echo "$morningstarts, $morningstarts_minutes,
$eveningends, $eveningends_minutes, $resolution/60" ?>);
+ //]]>
+ </script>
+ </fieldset>
+
+ <?php
+ // Booking policies
+ $min_ba_value = $min_book_ahead_secs;
+ toTimeString($min_ba_value, $min_ba_units);
+ $max_ba_value = $max_book_ahead_secs;
+ toTimeString($max_ba_value, $max_ba_units);
+ echo "<fieldset id=\"booking_policies\">\n";
+ echo "<legend>" . get_vocab("booking_policies") .
+ "<span class=\"js_none\"> (" . get_vocab("times_only") .
")</span></legend>\n";
+ // Minimum book ahead
+ echo "<div>\n";
+ echo "<label for=\"area_min_book_ahead\">" . get_vocab("min_book_ahead")
. ":</label>\n";
+ echo "<input class=\"checkbox\" type=\"checkbox\"
id=\"area_min_ba_enabled\" name=\"area_min_ba_enabled\"" .
+ (($min_book_ahead_enabled) ? " checked=\"checked\"" : "") .
+ " onChange=\"check_book_ahead()\">\n";
+ echo "<input class=\"text\" type=\"text\" name=\"area_min_ba_value\"
value=\"$min_ba_value\">";
+ echo "<select id=\"area_min_ba_units\" name=\"area_min_ba_units\">\n";
+ $units = array("seconds", "minutes", "hours", "days", "weeks");
+ foreach ($units as $unit)
+ {
+ echo "<option value=\"$unit\"" .
+ (($min_ba_units == get_vocab($unit)) ? " selected=\"selected\"" :
"") .
+ ">" . get_vocab($unit) . "</option>\n";
+ }
+ echo "</select>\n";
+ echo "</div>\n";
+ // Maximum book ahead
+ echo "<div>\n";
+ echo "<label for=\"area_max_book_ahead\">" . get_vocab("max_book_ahead")
. ":</label>\n";
+ echo "<input class=\"checkbox\" type=\"checkbox\"
id=\"area_max_ba_enabled\" name=\"area_max_ba_enabled\"" .
+ (($max_book_ahead_enabled) ? " checked=\"checked\"" : "") .
+ " onChange=\"check_book_ahead()\">\n";
+ echo "<input class=\"text\" type=\"text\" name=\"area_max_ba_value\"
value=\"$max_ba_value\">";
+ echo "<select id=\"area_max_ba_units\" name=\"area_max_ba_units\">\n";
+ $units = array("seconds", "minutes", "hours", "days", "weeks");
+ foreach ($units as $unit)
+ {
+ echo "<option value=\"$unit\"" .
+ (($max_ba_units == get_vocab($unit)) ? " selected=\"selected\"" :
"") .
+ ">" . get_vocab($unit) . "</option>\n";
+ }
+ echo "</select>\n";
+ echo "</div>\n";
+ echo "</fieldset>\n";
+ ?>
+ </fieldset>
+
<fieldset>
<legend><?php echo get_vocab("provisional_settings")?></legend>
<div>
@@ -950,20 +971,16 @@
<?php echo get_vocab("default_settings")?>:
</label>
<div class="group">
- <div>
- <label>
- <?php $checked = ($private_default) ? " checked=\"checked\"" :
"" ?>
- <input class="radio" type="radio" name="area_private_default"
value="1"<?php echo $checked ?>>
- <?php echo get_vocab("default_private")?>
- </label>
- </div>
- <div>
- <label>
- <?php $checked = ($private_default) ? "" : "
checked=\"checked\"" ?>
- <input class="radio" type="radio" name="area_private_default"
value="0"<?php echo $checked ?>>
- <?php echo get_vocab("default_public")?>
- </label>
- </div>
+ <label>
+ <?php $checked = ($private_default) ? " checked=\"checked\"" : ""
?>
+ <input class="radio" type="radio" name="area_private_default"
value="1"<?php echo $checked ?>>
+ <?php echo get_vocab("default_private")?>
+ </label>
+ <label>
+ <?php $checked = ($private_default) ? "" : " checked=\"checked\""
?>
+ <input class="radio" type="radio" name="area_private_default"
value="0"<?php echo $checked ?>>
+ <?php echo get_vocab("default_public")?>
+ </label>
</div>
</fieldset>
Modified: mrbs/trunk/web/functions.inc
===================================================================
--- mrbs/trunk/web/functions.inc 2010-10-23 13:10:24 UTC (rev 1541)
+++ mrbs/trunk/web/functions.inc 2010-10-25 11:30:48 UTC (rev 1542)
@@ -547,7 +547,7 @@
global $resolution, $default_duration, $morningstarts,
$morningstarts_minutes, $eveningends, $eveningends_minutes;
global $private_enabled, $private_default, $private_mandatory,
$private_override;
global $min_book_ahead_enabled, $max_book_ahead_enabled,
$min_book_ahead_secs, $max_book_ahead_secs;
- global $provisional_enabled, $reminders_enabled, $boolean_fields;
+ global $provisional_enabled, $reminders_enabled, $enable_periods,
$boolean_fields;
// Get all the "per area" config settings
$sql = "SELECT resolution, default_duration, morningstarts,
morningstarts_minutes,
@@ -555,10 +555,10 @@
private_enabled, private_default, private_mandatory,
private_override,
min_book_ahead_enabled, max_book_ahead_enabled,
min_book_ahead_secs, max_book_ahead_secs,
- provisional_enabled, reminders_enabled
- FROM $tbl_area
- WHERE id=$area
- LIMIT 1";
+ provisional_enabled, reminders_enabled, enable_periods
+ FROM $tbl_area
+ WHERE id=$area
+ LIMIT 1";
$res = sql_query($sql);
if (!$res || (sql_count($res) == 0))
{
Modified: mrbs/trunk/web/internalconfig.inc.php
===================================================================
--- mrbs/trunk/web/internalconfig.inc.php 2010-10-23 13:10:24 UTC (rev
1541)
+++ mrbs/trunk/web/internalconfig.inc.php 2010-10-25 11:30:48 UTC (rev
1542)
@@ -97,7 +97,8 @@
'min_book_ahead_enabled',
'max_book_ahead_enabled',
'provisional_enabled',
- 'reminders_enabled');
+ 'reminders_enabled',
+ 'enable_periods');
/********************************************************
* Miscellaneous
@@ -125,6 +126,7 @@
$area_defaults['max_book_ahead_secs'] = $max_book_ahead_secs;
$area_defaults['provisional_enabled'] = $provisional_enabled;
$area_defaults['reminders_enabled'] = $reminders_enabled;
+$area_defaults['enable_periods'] = $enable_periods;
/********************************************************
Modified: mrbs/trunk/web/lang.en
===================================================================
--- mrbs/trunk/web/lang.en 2010-10-23 13:10:24 UTC (rev 1541)
+++ mrbs/trunk/web/lang.en 2010-10-25 11:30:48 UTC (rev 1542)
@@ -341,7 +341,10 @@
$vocab["custom_html"] = "Custom HTML";
$vocab["custom_html_note"] = "This field can be used for displaying
your own HTML, for example an embedded Google map";
$vocab["email_list_note"] = "Enter a list of email addresses separated
by commas or newlines";
-
+$vocab["mode"] = "Mode";
+$vocab["mode_periods"] = "Periods";
+$vocab["mode_times"] = "Times";
+$vocab["times_only"] = "Times mode only";
// Used in edit_users.php
$vocab["name_empty"] = "You must enter a name.";
Modified: mrbs/trunk/web/mrbs-ielte7.css.php
===================================================================
--- mrbs/trunk/web/mrbs-ielte7.css.php 2010-10-23 13:10:24 UTC (rev 1541)
+++ mrbs/trunk/web/mrbs-ielte7.css.php 2010-10-25 11:30:48 UTC (rev 1542)
@@ -27,6 +27,7 @@
.form_general#edit_room select {margin-bottom: 0.2em}
.form_general textarea {margin-top: 0.25em} /* IE7 and below don't understand
margin-bottom */
/* so use the top margin instead */
+div#mode {margin-top: 0.5em} /* this div comes just below a textarea */
/* ------------ DAY/WEEK/MONTH.PHP ------------------*/
Modified: mrbs/trunk/web/mrbs.css.php
===================================================================
--- mrbs/trunk/web/mrbs.css.php 2010-10-23 13:10:24 UTC (rev 1541)
+++ mrbs/trunk/web/mrbs.css.php 2010-10-25 11:30:48 UTC (rev 1542)
@@ -454,6 +454,7 @@
/* ------------ EDIT_AREA_ROOM.PHP ------------------*/
.edit_area_room .form_general fieldset fieldset {padding-top: 0.5em;
padding-bottom: 0.5em}
.edit_area_room .form_general fieldset fieldset legend {font-size: small;
font-style: italic; font-weight: normal}
+.edit_area_room fieldset#time_settings {padding:0; margin 0}
span#private_display_caution {display: block; margin-top: 1em; font-style:
italic; font-weight: normal}
.edit_area_room .form_general textarea {height: 6em; width: 25em}
.edit_area_room div#custom_html {margin-top: 8px}
Added: mrbs/trunk/web/upgrade/16/mysql.sql
===================================================================
--- mrbs/trunk/web/upgrade/16/mysql.sql (rev 0)
+++ mrbs/trunk/web/upgrade/16/mysql.sql 2010-10-25 11:30:48 UTC (rev 1542)
@@ -0,0 +1,6 @@
+# $Id$
+#
+# Add a column for enable_periods
+
+ALTER TABLE %DB_TBL_PREFIX%area
+ADD COLUMN enable_periods tinyint(1);
Property changes on: mrbs/trunk/web/upgrade/16/mysql.sql
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: mrbs/trunk/web/upgrade/16/pgsql.sql
===================================================================
--- mrbs/trunk/web/upgrade/16/pgsql.sql (rev 0)
+++ mrbs/trunk/web/upgrade/16/pgsql.sql 2010-10-25 11:30:48 UTC (rev 1542)
@@ -0,0 +1,6 @@
+-- $Id$
+--
+-- Add a column for enable_periods
+
+ALTER TABLE %DB_TBL_PREFIX%area
+ADD COLUMN enable_periods smallint;
Property changes on: mrbs/trunk/web/upgrade/16/pgsql.sql
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: mrbs/trunk/web/upgrade/16/post.inc
===================================================================
--- mrbs/trunk/web/upgrade/16/post.inc (rev 0)
+++ mrbs/trunk/web/upgrade/16/post.inc 2010-10-25 11:30:48 UTC (rev 1542)
@@ -0,0 +1,19 @@
+<?php
+
+// $Id$
+
+// Update the area table getting rid of NULLs for enable_periods and replacing
them
+// with the default setting.
+
+global $tbl_area;
+global $enable_periods;
+
+// Convert booleans to 1 or 0, as the fields are tinyints/smallints
+$value = ($enable_periods) ? 1 : 0;
+
+if (sql_command("UPDATE $tbl_area SET enable_periods=$value WHERE
enable_periods IS NULL") < 0)
+{
+ fatal_error(0, "Error updating table. " . sql_error());
+}
+
+?>
Property changes on: mrbs/trunk/web/upgrade/16/post.inc
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits