Revision: 1057
http://mrbs.svn.sourceforge.net/mrbs/?rev=1057&view=rev
Author: cimorrison
Date: 2009-03-20 00:24:45 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Improved checking of number of slots in the config file and also when editing
areas.
Modified Paths:
--------------
mrbs/trunk/web/config.inc.php
mrbs/trunk/web/edit_area_room.php
mrbs/trunk/web/lang.en
Modified: mrbs/trunk/web/config.inc.php
===================================================================
--- mrbs/trunk/web/config.inc.php 2009-03-19 23:22:14 UTC (rev 1056)
+++ mrbs/trunk/web/config.inc.php 2009-03-20 00:24:45 UTC (rev 1057)
@@ -103,10 +103,6 @@
// $eveningends_minutes and $twentyfourhour_format are ignored.
$enable_periods = FALSE;
-// This is the maximum number of rows (timeslots or periods) that one can
expect to see in the day
-// and week views. It is used by mrbs.css.php for creating classes. It
does not matter if it
-// is too large, except for the fact that more CSS than necessary will be
generated.
-$max_slots = 60;
// TIMES SETTINGS
// --------------
@@ -150,7 +146,12 @@
// To get a full 24 hour display with 15-minute steps, set morningstarts=0;
eveningends=23;
// eveningends_minutes=45; and resolution=900.
+// This is the maximum number of rows (timeslots or periods) that one can
expect to see in the day
+// and week views. It is used by mrbs.css.php for creating classes. It
does not matter if it
+// is too large, except for the fact that more CSS than necessary will be
generated.
+$max_slots = 60;
+
// PERIODS SETTINGS
// ----------------
@@ -183,10 +184,11 @@
// CHECKING
// --------
-// Do some checking
+// Do some checking (and redefine $max_slots if we're using periods)
if ($enable_periods)
{
- if (count($periods) > 60)
+ $max_slots = count($periods); // We know exactly how many we need
+ if ($max_slots > 60)
{
die('Configuration error: too many periods defined');
}
Modified: mrbs/trunk/web/edit_area_room.php
===================================================================
--- mrbs/trunk/web/edit_area_room.php 2009-03-19 23:22:14 UTC (rev 1056)
+++ mrbs/trunk/web/edit_area_room.php 2009-03-20 00:24:45 UTC (rev 1057)
@@ -194,6 +194,7 @@
{
$valid_email = TRUE;
$valid_resolution = TRUE;
+ $enough_slots = TRUE;
if (isset($change_area)) // we're on the second pass through
{
@@ -224,10 +225,18 @@
{
$valid_resolution = FALSE;
}
+
+ // Check that the number of slots we now have is no greater than
$max_slots
+ // defined in the config file - otherwise we won't generate enough CSS
classes
+ $n_slots = ($start_difference/$area_res_mins) + 1;
+ if ($n_slots > $max_slots)
+ {
+ $enough_slots = FALSE;
+ }
}
// If everything is OK, update the database
- if ((FALSE != $valid_email) && (FALSE != $valid_resolution))
+ if ((FALSE != $valid_email) && (FALSE != $valid_resolution) && (FALSE !=
$enough_slots))
{
$sql = "UPDATE $tbl_area SET area_name='" . addslashes($area_name)
. "', area_admin_email='" . addslashes($area_admin_email) . "'";
@@ -276,6 +285,10 @@
{
echo "<p class=\"error\">" .get_vocab('invalid_resolution') . "</p>\n";
}
+ if (FALSE == $enough_slots)
+ {
+ echo "<p class=\"error\">" .get_vocab('too_many_slots') . "</p>\n";
+ }
?>
</fieldset>
Modified: mrbs/trunk/web/lang.en
===================================================================
--- mrbs/trunk/web/lang.en 2009-03-19 23:22:14 UTC (rev 1056)
+++ mrbs/trunk/web/lang.en 2009-03-20 00:24:45 UTC (rev 1057)
@@ -254,6 +254,7 @@
$vocab["area_def_duration_mins"] = "Default duration (minutes)";
$vocab["invalid_email"] = "Invalid email!";
$vocab["invalid_resolution"] = "Invalid combination of first slot, last
slot and resolution!";
+$vocab["too_many_slots"] = 'You need to increase the value of
$max_slots in the config file!';
// Used in edit_users.php
$vocab["name_empty"] = "You must enter a name.";
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits