Revision: 1613
http://mrbs.svn.sourceforge.net/mrbs/?rev=1613&view=rev
Author: cimorrison
Date: 2010-11-18 11:15:03 +0000 (Thu, 18 Nov 2010)
Log Message:
-----------
Changed the area and room tables to record disabled status and changed the
pages for editing rooms and areas to allow room and areas to be
enabled/disabled. Still to come: changing the calendar views so that
disabled rooms/areas are not displayed.
Modified Paths:
--------------
mrbs/branches/disabled_rooms/tables.my.sql
mrbs/branches/disabled_rooms/tables.pg.pre73.sql
mrbs/branches/disabled_rooms/tables.pg.sql
mrbs/branches/disabled_rooms/web/admin.php
mrbs/branches/disabled_rooms/web/dbsys.inc
mrbs/branches/disabled_rooms/web/edit_area_room.php
mrbs/branches/disabled_rooms/web/internalconfig.inc.php
mrbs/branches/disabled_rooms/web/lang.en
mrbs/branches/disabled_rooms/web/mrbs.css.php
Added Paths:
-----------
mrbs/branches/disabled_rooms/web/upgrade/22/
mrbs/branches/disabled_rooms/web/upgrade/22/mysql.sql
mrbs/branches/disabled_rooms/web/upgrade/22/pgsql.sql
Modified: mrbs/branches/disabled_rooms/tables.my.sql
===================================================================
--- mrbs/branches/disabled_rooms/tables.my.sql 2010-11-18 10:02:40 UTC (rev
1612)
+++ mrbs/branches/disabled_rooms/tables.my.sql 2010-11-18 11:15:03 UTC (rev
1613)
@@ -20,6 +20,7 @@
CREATE TABLE mrbs_area
(
id int NOT NULL auto_increment,
+ disabled tinyint(1) DEFAULT 0 NOT NULL,
area_name varchar(30),
area_admin_email text,
resolution int,
@@ -49,6 +50,7 @@
CREATE TABLE mrbs_room
(
id int NOT NULL auto_increment,
+ disabled tinyint(1) DEFAULT 0 NOT NULL,
area_id int DEFAULT '0' NOT NULL,
room_name varchar(25) DEFAULT '' NOT NULL,
sort_key varchar(25) DEFAULT '' NOT NULL,
@@ -131,6 +133,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ( 'db_version', '21');
+ VALUES ( 'db_version', '22');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ( 'local_db_version', '1');
Modified: mrbs/branches/disabled_rooms/tables.pg.pre73.sql
===================================================================
--- mrbs/branches/disabled_rooms/tables.pg.pre73.sql 2010-11-18 10:02:40 UTC
(rev 1612)
+++ mrbs/branches/disabled_rooms/tables.pg.pre73.sql 2010-11-18 11:15:03 UTC
(rev 1613)
@@ -23,6 +23,7 @@
CREATE TABLE mrbs_area
(
id serial primary key,
+ disabled smallint DEFAULT 0 NOT NULL,
area_name varchar(30),
area_admin_email text,
resolution int,
@@ -50,6 +51,7 @@
CREATE TABLE mrbs_room
(
id serial primary key,
+ disabled smallint DEFAULT 0 NOT NULL,
area_id int DEFAULT 0 NOT NULL,
room_name varchar(25) DEFAULT '' NOT NULL,
sort_key varchar(25) DEFAULT '' NOT NULL,
@@ -122,6 +124,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ('db_version', '21');
+ VALUES ('db_version', '22');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ('local_db_version', '1');
Modified: mrbs/branches/disabled_rooms/tables.pg.sql
===================================================================
--- mrbs/branches/disabled_rooms/tables.pg.sql 2010-11-18 10:02:40 UTC (rev
1612)
+++ mrbs/branches/disabled_rooms/tables.pg.sql 2010-11-18 11:15:03 UTC (rev
1613)
@@ -36,6 +36,7 @@
CREATE TABLE mrbs_area
(
id serial primary key,
+ disabled smallint DEFAULT 0 NOT NULL,
area_name varchar(30),
area_admin_email text,
resolution int,
@@ -63,6 +64,7 @@
CREATE TABLE mrbs_room
(
id serial primary key,
+ disabled smallint DEFAULT 0 NOT NULL,
area_id int DEFAULT 0 NOT NULL,
room_name varchar(25) NOT NULL,
sort_key varchar(25) NOT NULL,
@@ -135,6 +137,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ('db_version', '21');
+ VALUES ('db_version', '22');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ('local_db_version', '1');
Modified: mrbs/branches/disabled_rooms/web/admin.php
===================================================================
--- mrbs/branches/disabled_rooms/web/admin.php 2010-11-18 10:02:40 UTC (rev
1612)
+++ mrbs/branches/disabled_rooms/web/admin.php 2010-11-18 11:15:03 UTC (rev
1613)
@@ -62,52 +62,77 @@
// TOP SECTION: THE FORM FOR SELECTING AN AREA
echo "<div id=\"area_form\">\n";
-$sql = "select id, area_name from $tbl_area order by area_name";
+$sql = "select id, area_name, disabled from $tbl_area order by area_name";
$res = sql_query($sql);
$areas_defined = $res && (sql_count($res) > 0);
-if ($areas_defined)
+if (!$areas_defined)
{
- // If there are some areas defined, then show the area form
- echo "<form id=\"areaChangeForm\" method=\"get\" action=\"$PHP_SELF\">\n";
- echo "<fieldset>\n";
- echo "<legend></legend>\n";
-
- // The area selector
- echo "<label id=\"area_label\" for=\"area_select\">" . get_vocab("area") .
":</label>\n";
- echo "<select class=\"room_area_select\" id=\"area_select\" name=\"area\"
onchange=\"this.form.submit()\">";
+ echo "<p>" . get_vocab("noareas") . "</p>\n";
+}
+else
+{
+ // Build an array with the area info and also see if there are going
+ // to be any areas to display (in other words rooms if you are not an
+ // admin whether any areas are enabled)
+ $areas = array();
+ $n_displayable_areas = 0;
for ($i = 0; ($row = sql_row_keyed($res, $i)); $i++)
{
- $selected = ($row['id'] == $area) ? "selected=\"selected\"" : "";
- echo "<option $selected value=\"". $row['id']. "\">" .
htmlspecialchars($row['area_name']) . "</option>";
+ $areas[] = $row;
+ if ($is_admin || !$row['disabled'])
+ {
+ $n_displayable_areas++;
+ }
}
- echo "</select>\n";
+
+ if ($n_displayable_areas == 0)
+ {
+ echo "<p>" . get_vocab("noareas_enabled") . "</p>\n";
+ }
+ else
+ {
+ // If there are some areas displayable, then show the area form
+ echo "<form id=\"areaChangeForm\" method=\"get\" action=\"$PHP_SELF\">\n";
+ echo "<fieldset>\n";
+ echo "<legend></legend>\n";
- // Some hidden inputs for current day, month, year
- echo "<input type=\"hidden\" name=\"day\" value=\"$day\">\n";
- echo "<input type=\"hidden\" name=\"month\" value=\"$month\">\n";
- echo "<input type=\"hidden\" name=\"year\" value=\"$year\">\n";
+ // The area selector
+ echo "<label id=\"area_label\" for=\"area_select\">" . get_vocab("area") .
":</label>\n";
+ echo "<select class=\"room_area_select\" id=\"area_select\" name=\"area\"
onchange=\"this.form.submit()\">";
+ foreach ($areas as $a)
+ {
+ if ($is_admin || !$a['disabled'])
+ {
+ $selected = ($a['id'] == $area) ? "selected=\"selected\"" : "";
+ echo "<option $selected value=\"". $a['id']. "\">" .
htmlspecialchars($a['area_name']) . "</option>";
+ }
+ }
+ echo "</select>\n";
- // The change area button (won't be needed or displayed if JavaScript is
enabled)
- echo "<input type=\"submit\" name=\"change\" class=\"js_none\" value=\"" .
get_vocab("change") . "\">\n";
+ // Some hidden inputs for current day, month, year
+ echo "<input type=\"hidden\" name=\"day\" value=\"$day\">\n";
+ echo "<input type=\"hidden\" name=\"month\" value=\"$month\">\n";
+ echo "<input type=\"hidden\" name=\"year\" value=\"$year\">\n";
- // If they're an admin then give them edit and delete buttons for the area
- // and also a form for adding a new area
- if ($is_admin)
- {
- // Can't use <button> because IE6 does not support those properly
- echo "<input type=\"image\" class=\"button\" name=\"edit\"
src=\"images/edit.png\"
- title=\"" . get_vocab("edit") . "\" alt=\"" . get_vocab("edit") .
"\">\n";
- echo "<input type=\"image\" class=\"button\" name=\"delete\"
src=\"images/delete.png\"
- title=\"" . get_vocab("delete") . "\" alt=\"" . get_vocab("delete")
. "\">\n";
+ // The change area button (won't be needed or displayed if JavaScript is
enabled)
+ echo "<input type=\"submit\" name=\"change\" class=\"js_none\" value=\"" .
get_vocab("change") . "\">\n";
+
+ // If they're an admin then give them edit and delete buttons for the area
+ // and also a form for adding a new area
+ if ($is_admin)
+ {
+ // Can't use <button> because IE6 does not support those properly
+ echo "<input type=\"image\" class=\"button\" name=\"edit\"
src=\"images/edit.png\"
+ title=\"" . get_vocab("edit") . "\" alt=\"" . get_vocab("edit") .
"\">\n";
+ echo "<input type=\"image\" class=\"button\" name=\"delete\"
src=\"images/delete.png\"
+ title=\"" . get_vocab("delete") . "\" alt=\"" .
get_vocab("delete") . "\">\n";
+ }
+
+ echo "</fieldset>\n";
+ echo "</form>\n";
}
-
- echo "</fieldset>\n";
- echo "</form>\n";
}
-else
-{
- echo "<p>" . get_vocab("noareas") . "</p>\n";
-}
+
if ($is_admin)
{
// New area form
@@ -141,218 +166,255 @@
// BOTTOM SECTION: ROOMS IN THE SELECTED AREA
-echo "<h2>\n";
-echo get_vocab("rooms");
-if(isset($area_name))
-{
- echo " " . get_vocab("in") . " " . htmlspecialchars($area_name);
-}
-echo "</h2>\n";
-
-echo "<div id=\"room_form\">\n";
-if (isset($area))
+// Only display the bottom section if the user is an admin or
+// else if there are some areas that can be displayed
+if ($is_admin || ($n_displayable_areas > 0))
{
- $res = sql_query("SELECT * FROM $tbl_room WHERE area_id=$area ORDER BY
sort_key");
- if (! $res)
- {
- fatal_error(0, sql_error());
+ echo "<h2>\n";
+ echo get_vocab("rooms");
+ if(isset($area_name))
+ {
+ echo " " . get_vocab("in") . " " . htmlspecialchars($area_name);
}
- if (sql_count($res) == 0)
+ echo "</h2>\n";
+
+ echo "<div id=\"room_form\">\n";
+ if (isset($area))
{
- echo "<p>" . get_vocab("norooms") . "</p>\n";
- }
- else
- {
- // Get the information about the fields in the room table
- $fields = sql_field_info($tbl_room);
-
- // Build an array with the room info
- $rooms = array();
- for ($i = 0; ($row = sql_row_keyed($res, $i)); $i++)
+ $res = sql_query("SELECT * FROM $tbl_room WHERE area_id=$area ORDER BY
sort_key");
+ if (! $res)
{
- $rooms[] = $row;
+ fatal_error(0, sql_error());
}
-
- // Display it in a table [Actually two tables side by side so that we can
- // achieve a "Freeze Panes" effect: there doesn't seem to be a good way of
- // getting a colgroup to scroll, so we have to distort the mark-up a
little]
-
- echo "<div id=\"room_info\" class=\"freeze_panes\">\n";
- // (a) the "header" columns containing the room names
- echo "<div class=\"header_columns\">\n";
- echo "<table class=\"admin_table\">\n";
- echo "<thead>\n";
- echo "<tr>\n";
- if ($is_admin)
+ if (sql_count($res) == 0)
{
- echo "<th><div> </div></th>\n";
- echo "<th><div> </div></th>\n";
+ echo "<p>" . get_vocab("norooms") . "</p>\n";
}
- echo "<th><div>" . get_vocab("name") . "</div></th>\n";
- echo "</tr>\n";
- echo "</thead>\n";
- echo "<tbody>\n";
- $row_class = "odd_row";
- foreach ($rooms as $r)
+ else
{
- $row_class = ($row_class == "even_row") ? "odd_row" : "even_row";
- echo "<tr class=\"$row_class\">\n";
- // Give admins delete and edit links
- if ($is_admin)
- {
- // Delete link
- echo "<td><div>\n";
- echo "<a href=\"del.php?type=room&room=" . $r['id'] . "\">\n";
- echo "<img src=\"images/delete.png\" width=\"16\" height=\"16\"
- alt=\"" . get_vocab("delete") . "\"
- title=\"" . get_vocab("delete") . "\">\n";
- echo "</a>\n";
- echo "</div></td>\n";
- // Delete link
- echo "<td><div>\n";
- echo "<a
href=\"edit_area_room.php?change_room=1&phase=1&room=" . $r['id'] .
"\">\n";
- echo "<img src=\"images/edit.png\" width=\"16\" height=\"16\"
- alt=\"" . get_vocab("edit") . "\"
- title=\"" . get_vocab("edit") . "\">\n";
- echo "</a>\n";
- echo "</div></td>\n";
- }
- echo "<td><div><a
href=\"edit_area_room.php?change_room=1&phase=1&room=" . $r['id'] .
"\">" . htmlspecialchars($r['room_name']) . "</a></div></td>\n";
- echo "</tr>\n";
- }
- echo "</tbody>\n";
- echo "</table>\n";
- echo "</div>\n";
+ // Get the information about the fields in the room table
+ $fields = sql_field_info($tbl_room);
- // (b) the "body" columns containing the room info
- echo "<div class=\"body_columns\">\n";
- echo "<table class=\"admin_table\">\n";
- echo "<thead>\n";
- echo "<tr>\n";
- // ignore these columns, either because we don't want to display them,
- // or because we have already displayed them in the header column
- $ignore = array('id', 'area_id', 'room_name', 'sort_key', 'custom_html');
- foreach($fields as $field)
- {
- if (!in_array($field['name'], $ignore))
+ // Build an array with the room info and also see if there are going
+ // to be any rooms to display (in other words rooms if you are not an
+ // admin whether any rooms are enabled)
+ $rooms = array();
+ $n_displayable_rooms = 0;
+ for ($i = 0; ($row = sql_row_keyed($res, $i)); $i++)
{
- switch ($field['name'])
+ $rooms[] = $row;
+ if ($is_admin || !$row['disabled'])
{
- // the standard MRBS fields
- case 'description':
- case 'capacity':
- case 'room_admin_email':
- $text = get_vocab($field['name']);
- break;
- // any user defined fields
- default:
- $text = get_loc_field_name($tbl_room, $field['name']);
- break;
+ $n_displayable_rooms++;
}
- echo "<th><div>" . htmlspecialchars($text) . "</div></th>\n";
}
- }
- echo "</tr>\n";
- echo "</thead>\n";
- echo "<tbody>\n";
- $row_class = "odd_row";
- foreach ($rooms as $r)
- {
- $row_class = ($row_class == "even_row") ? "odd_row" : "even_row";
- echo "<tr class=\"$row_class\">\n";
- foreach($fields as $field)
+
+ if ($n_displayable_rooms == 0)
{
- if (!in_array($field['name'], $ignore))
+ echo "<p>" . get_vocab("norooms_enabled") . "</p>\n";
+ }
+ else
+ {
+ // Display them in a table [Actually two tables side by side so that
we can
+ // achieve a "Freeze Panes" effect: there doesn't seem to be a good
way of
+ // getting a colgroup to scroll, so we have to distort the mark-up a
little]
+
+ echo "<div id=\"room_info\" class=\"freeze_panes\">\n";
+ // (a) the "header" columns containing the room names
+ echo "<div class=\"header_columns\">\n";
+ echo "<table class=\"admin_table\">\n";
+ echo "<thead>\n";
+ echo "<tr>\n";
+ if ($is_admin)
{
- switch ($field['name'])
+ echo "<th><div> </div></th>\n";
+ echo "<th><div> </div></th>\n";
+ }
+ echo "<th><div>" . get_vocab("name") . "</div></th>\n";
+ if ($is_admin)
+ {
+ // Don't show ordinary users the disabled status: they are only
going to see enabled rooms
+ echo "<th><div>" . get_vocab("enabled") . "</div></th>\n";
+ }
+ echo "</tr>\n";
+ echo "</thead>\n";
+ echo "<tbody>\n";
+ $row_class = "odd_row";
+ foreach ($rooms as $r)
+ {
+ // Don't show ordinary users disabled rooms
+ if ($is_admin || !$r['disabled'])
{
- // the standard MRBS fields
- case 'description':
- case 'room_admin_email':
- echo "<td><div>" . htmlspecialchars($r[$field['name']]) .
"</div></td>\n";
- break;
- case 'capacity':
- echo "<td class=\"int\"><div>" . $r[$field['name']] .
"</div></td>\n";
- break;
- // any user defined fields
- default:
- if (($field['nature'] == 'boolean') ||
- (($field['nature'] == 'integer') && isset($field['length'])
&& ($field['length'] <= 2)) )
+ $row_class = ($row_class == "even_row") ? "odd_row" : "even_row";
+ echo "<tr class=\"$row_class\">\n";
+ // Give admins delete and edit links
+ if ($is_admin)
+ {
+ // Delete link
+ echo "<td><div>\n";
+ echo "<a href=\"del.php?type=room&room=" . $r['id'] .
"\">\n";
+ echo "<img src=\"images/delete.png\" width=\"16\" height=\"16\"
+ alt=\"" . get_vocab("delete") . "\"
+ title=\"" . get_vocab("delete") . "\">\n";
+ echo "</a>\n";
+ echo "</div></td>\n";
+ // Delete link
+ echo "<td><div>\n";
+ echo "<a
href=\"edit_area_room.php?change_room=1&phase=1&room=" . $r['id'] .
"\">\n";
+ echo "<img src=\"images/edit.png\" width=\"16\" height=\"16\"
+ alt=\"" . get_vocab("edit") . "\"
+ title=\"" . get_vocab("edit") . "\">\n";
+ echo "</a>\n";
+ echo "</div></td>\n";
+ }
+ echo "<td><div><a
href=\"edit_area_room.php?change_room=1&phase=1&room=" . $r['id'] .
"\">" . htmlspecialchars($r['room_name']) . "</a></div></td>\n";
+ if ($is_admin)
+ {
+ // Don't show ordinary users the disabled status: they are only
going to see enabled rooms
+ echo "<td class=\"boolean\"><div>" . ((!$r['disabled']) ? "<img
src=\"images/check.png\" alt=\"check mark\" width=\"16\" height=\"16\">" :
" ") . "</div></td>\n";
+ }
+ echo "</tr>\n";
+ }
+ }
+ echo "</tbody>\n";
+ echo "</table>\n";
+ echo "</div>\n";
+
+ // (b) the "body" columns containing the room info
+ echo "<div class=\"body_columns\">\n";
+ echo "<table class=\"admin_table\">\n";
+ echo "<thead>\n";
+ echo "<tr>\n";
+ // ignore these columns, either because we don't want to display them,
+ // or because we have already displayed them in the header column
+ $ignore = array('id', 'area_id', 'room_name', 'disabled', 'sort_key',
'custom_html');
+ foreach($fields as $field)
+ {
+ if (!in_array($field['name'], $ignore))
+ {
+ switch ($field['name'])
+ {
+ // the standard MRBS fields
+ case 'description':
+ case 'capacity':
+ case 'room_admin_email':
+ $text = get_vocab($field['name']);
+ break;
+ // any user defined fields
+ default:
+ $text = get_loc_field_name($tbl_room, $field['name']);
+ break;
+ }
+ echo "<th><div>" . htmlspecialchars($text) . "</div></th>\n";
+ }
+ }
+ echo "</tr>\n";
+ echo "</thead>\n";
+ echo "<tbody>\n";
+ $row_class = "odd_row";
+ foreach ($rooms as $r)
+ {
+ // Don't show ordinary users disabled rooms
+ if ($is_admin || !$r['disabled'])
+ {
+ $row_class = ($row_class == "even_row") ? "odd_row" : "even_row";
+ echo "<tr class=\"$row_class\">\n";
+ foreach($fields as $field)
+ {
+ if (!in_array($field['name'], $ignore))
{
- // booleans: represent by a checkmark
- echo "<td class=\"int\"><div>";
- echo (!empty($r[$field['name']])) ? "<img
src=\"images/check.png\" alt=\"check mark\" width=\"16\" height=\"16\">" :
" ";
- echo "</div></td>\n";
+ switch ($field['name'])
+ {
+ // the standard MRBS fields
+ case 'description':
+ case 'room_admin_email':
+ echo "<td><div>" . htmlspecialchars($r[$field['name']]) .
"</div></td>\n";
+ break;
+ case 'capacity':
+ echo "<td class=\"int\"><div>" . $r[$field['name']] .
"</div></td>\n";
+ break;
+ // any user defined fields
+ default:
+ if (($field['nature'] == 'boolean') ||
+ (($field['nature'] == 'integer') &&
isset($field['length']) && ($field['length'] <= 2)) )
+ {
+ // booleans: represent by a checkmark
+ echo "<td class=\"boolean\"><div>";
+ echo (!empty($r[$field['name']])) ? "<img
src=\"images/check.png\" alt=\"check mark\" width=\"16\" height=\"16\">" :
" ";
+ echo "</div></td>\n";
+ }
+ elseif (($field['nature'] == 'integer') &&
isset($field['length']) && ($field['length'] > 2))
+ {
+ // integer values
+ echo "<td class=\"int\"><div>" . $r[$field['name']] .
"</div></td>\n";
+ }
+ else
+ {
+ // strings
+ $value = $r[$field['name']];
+ $html = "<td title=\"" . htmlspecialchars($value) .
"\"><div>";
+ // Truncate before conversion, otherwise you could chop
off in the middle of an entity
+ $html .= htmlspecialchars(substr($value, 0,
$max_content_length));
+ $html .= (strlen($value) > $max_content_length) ? " ..."
: "";
+ $html .= "</div></td>\n";
+ echo $html;
+ }
+ break;
+ }
}
- elseif (($field['nature'] == 'integer') &&
isset($field['length']) && ($field['length'] > 2))
- {
- // integer values
- echo "<td class=\"int\"><div>" . $r[$field['name']] .
"</div></td>\n";
- }
- else
- {
- // strings
- $value = $r[$field['name']];
- $html = "<td title=\"" . htmlspecialchars($value) . "\"><div>";
- // Truncate before conversion, otherwise you could chop off in
the middle of an entity
- $html .= htmlspecialchars(substr($value, 0,
$max_content_length));
- $html .= (strlen($value) > $max_content_length) ? " ..." : "";
- $html .= "</div></td>\n";
- echo $html;
- }
- break;
+ }
+ echo "</tr>\n";
}
}
+ echo "</tbody>\n";
+ echo "</table>\n";
+ echo "</div>\n";
+ echo "</div>\n";
}
- echo "</tr>\n";
}
- echo "</tbody>\n";
- echo "</table>\n";
- echo "</div>\n";
- echo "</div>\n";
}
-}
-else
-{
- echo get_vocab("noarea");
-}
+ else
+ {
+ echo get_vocab("noarea");
+ }
-// Give admins a form for adding rooms to the area - provided
-// there's an area selected
-if ($is_admin && $areas_defined && !empty($area))
-{
-?>
- <form id="add_room" class="form_admin" action="add.php" method="post">
- <fieldset>
- <legend><?php echo get_vocab("addroom") ?></legend>
+ // Give admins a form for adding rooms to the area - provided
+ // there's an area selected
+ if ($is_admin && $areas_defined && !empty($area))
+ {
+ ?>
+ <form id="add_room" class="form_admin" action="add.php" method="post">
+ <fieldset>
+ <legend><?php echo get_vocab("addroom") ?></legend>
- <input type="hidden" name="type" value="room">
- <input type="hidden" name="area" value="<?php echo $area; ?>">
+ <input type="hidden" name="type" value="room">
+ <input type="hidden" name="area" value="<?php echo $area; ?>">
- <div>
- <label for="room_name"><?php echo get_vocab("name") ?>:</label>
- <input type="text" id="room_name" name="name" maxlength="<?php echo
$maxlength['room.room_name'] ?>">
- </div>
+ <div>
+ <label for="room_name"><?php echo get_vocab("name") ?>:</label>
+ <input type="text" id="room_name" name="name" maxlength="<?php echo
$maxlength['room.room_name'] ?>">
+ </div>
- <div>
- <label for="room_description"><?php echo get_vocab("description")
?>:</label>
- <input type="text" id="room_description" name="description"
maxlength="<?php echo $maxlength['room.description'] ?>">
- </div>
+ <div>
+ <label for="room_description"><?php echo get_vocab("description")
?>:</label>
+ <input type="text" id="room_description" name="description"
maxlength="<?php echo $maxlength['room.description'] ?>">
+ </div>
- <div>
- <label for="room_capacity"><?php echo get_vocab("capacity") ?>:</label>
- <input type="text" id="room_capacity" name="capacity">
- </div>
+ <div>
+ <label for="room_capacity"><?php echo get_vocab("capacity")
?>:</label>
+ <input type="text" id="room_capacity" name="capacity">
+ </div>
- <div>
- <input type="submit" class="submit" value="<?php echo
get_vocab("addroom") ?>">
- </div>
+ <div>
+ <input type="submit" class="submit" value="<?php echo
get_vocab("addroom") ?>">
+ </div>
- </fieldset>
- </form>
-<?php
+ </fieldset>
+ </form>
+ <?php
+ }
+ echo "</div>\n";
}
-echo "</div>\n";
require_once "trailer.inc"
Modified: mrbs/branches/disabled_rooms/web/dbsys.inc
===================================================================
--- mrbs/branches/disabled_rooms/web/dbsys.inc 2010-11-18 10:02:40 UTC (rev
1612)
+++ mrbs/branches/disabled_rooms/web/dbsys.inc 2010-11-18 11:15:03 UTC (rev
1613)
@@ -15,7 +15,7 @@
$tbl_variables = $db_tbl_prefix . "variables";
-$db_schema_version = 21;
+$db_schema_version = 22;
$local_db_schema_version = 1;
Modified: mrbs/branches/disabled_rooms/web/edit_area_room.php
===================================================================
--- mrbs/branches/disabled_rooms/web/edit_area_room.php 2010-11-18 10:02:40 UTC
(rev 1612)
+++ mrbs/branches/disabled_rooms/web/edit_area_room.php 2010-11-18 11:15:03 UTC
(rev 1613)
@@ -50,12 +50,14 @@
$new_area = get_form_var('new_area', 'int');
$old_area = get_form_var('old_area', 'int');
$room_name = get_form_var('room_name', 'string');
+$room_disabled = get_form_var('room_disabled', 'string');
$sort_key = get_form_var('sort_key', 'string');
$old_room_name = get_form_var('old_room_name', 'string');
$area_name = get_form_var('area_name', 'string');
$description = get_form_var('description', 'string');
$capacity = get_form_var('capacity', 'int');
$room_admin_email = get_form_var('room_admin_email', 'string');
+$area_disabled = get_form_var('area_disabled', 'string');
$area_admin_email = get_form_var('area_admin_email', 'string');
$area_morningstarts = get_form_var('area_morningstarts', 'int');
$area_morningstarts_minutes = get_form_var('area_morningstarts_minutes',
'int');
@@ -198,6 +200,8 @@
// If everything is still OK, update the databasae
else
{
+ // Convert booleans into 0/1 (necessary for PostgreSQL)
+ $room_disabled = (!empty($room_disabled)) ? 1 : 0;
$sql = "UPDATE $tbl_room SET ";
$n_fields = count($fields);
$assign_array = array();
@@ -211,6 +215,9 @@
case 'area_id':
$assign_array[] = "area_id=$new_area";
break;
+ case 'disabled':
+ $assign_array[] = "disabled=$room_disabled";
+ break;
case 'room_name':
$assign_array[] = "room_name='" . addslashes($room_name) . "'";
break;
@@ -321,6 +328,7 @@
fromTimeString($area_max_ba_value, $area_max_ba_units);
// Convert booleans into 0/1 (necessary for PostgreSQL)
+ $area_disabled = (!empty($area_disabled)) ? 1 : 0;
$area_min_ba_enabled = (!empty($area_min_ba_enabled)) ? 1 : 0;
$area_max_ba_enabled = (!empty($area_max_ba_enabled)) ? 1 : 0;
$area_private_enabled = (!empty($area_private_enabled)) ? 1 : 0;
@@ -366,6 +374,7 @@
$sql = "UPDATE $tbl_area SET ";
$assign_array = array();
$assign_array[] = "area_name='" . addslashes($area_name) . "'";
+ $assign_array[] = "disabled=" . $area_disabled;
$assign_array[] = "area_admin_email='" . addslashes($area_admin_email) .
"'";
$assign_array[] = "custom_html='" . addslashes($custom_html) . "'";
if (!$area_enable_periods)
@@ -489,88 +498,110 @@
echo "</select>\n";
echo "<input type=\"hidden\" name=\"old_area\" value=\"" .
$row['area_id'] . "\">\n";
echo "</div>\n";
+
+ // First of all deal with the standard MRBS fields
+ // Room name
+ echo "<div>\n";
+ echo "<label for=\"room_name\">" . get_vocab("name") . ":</label>\n";
+ echo "<input type=\"text\" id=\"room_name\" name=\"room_name\" value=\""
. htmlspecialchars($row["room_name"]) . "\"$disabled>\n";
+ echo "<input type=\"hidden\" name=\"old_room_name\" value=\"" .
htmlspecialchars($row["room_name"]) . "\">\n";
+ echo "</div>\n";
+
+ // Status (Enabled or Disabled)
+ echo "<div>\n";
+ echo "<label title=\"" . get_vocab("disabled_room_note") . "\">" .
get_vocab("status") . ":</label>\n";
+ echo "<div class=\"group\">\n";
+ echo "<label>\n";
+ $checked = ($row['disabled']) ? "" : " checked=\"checked\"";
+ echo "<input class=\"radio\" type=\"radio\" name=\"room_disabled\"
value=\"0\"$checked>\n";
+ echo get_vocab("enabled") . "</label>\n";
+ echo "<label>\n";
+ $checked = ($row['disabled']) ? " checked=\"checked\"" : "";
+ echo "<input class=\"radio\" type=\"radio\" name=\"room_disabled\"
value=\"1\"$checked>\n";
+ echo get_vocab("disabled") . "</label>\n";
+ echo "</div>\n";
+ echo "</div>\n";
+
+ // Sort key
+ if ($is_admin)
+ {
+ echo "<div>\n";
+ echo "<label for=\"sort_key\" title=\"" . get_vocab("sort_key_note") .
"\">" . get_vocab("sort_key") . ":</label>\n";
+ echo "<input type=\"text\" id=\"sort_key\" name=\"sort_key\" value=\""
. htmlspecialchars($row["sort_key"]) . "\"$disabled>\n";
+ echo "</div>\n";
+ }
+
+ // Description
+ echo "<div>\n";
+ echo "<label for=\"description\">" . get_vocab("description") .
":</label>\n";
+ echo "<input type=\"text\" id=\"description\" name=\"description\"
value=\"" . htmlspecialchars($row["description"]) . "\"$disabled>\n";
+ echo "</div>\n";
+
+ // Capacity
+ echo "<div>\n";
+ echo "<label for=\"capacity\">" . get_vocab("capacity") . ":</label>\n";
+ echo "<input type=\"text\" id=\"capacity\" name=\"capacity\" value=\"" .
$row["capacity"] . "\"$disabled>\n";
+ echo "</div>\n";
+
+ // Room admin email
+ echo "<div>\n";
+ echo "<label for=\"room_admin_email\" title=\"" .
get_vocab("email_list_note") . "\">" . get_vocab("room_admin_email") .
":</label>\n";
+ echo "<textarea id=\"room_admin_email\" name=\"room_admin_email\"
rows=\"4\" cols=\"40\"$disabled>" . htmlspecialchars($row["room_admin_email"])
. "</textarea>\n";
+ echo "</div>\n";
+
+ // Custom HTML
+ if ($is_admin)
+ {
+ // Only show the raw HTML to admins. Non-admins will see the rendered
HTML
+ echo "<div>\n";
+ echo "<label for=\"room_custom_html\" title=\"" .
get_vocab("custom_html_note") . "\">" . get_vocab("custom_html") .
":</label>\n";
+ echo "<textarea id=\"room_custom_html\" name=\"custom_html\"
rows=\"4\" cols=\"40\"$disabled>\n";
+ echo htmlspecialchars($row['custom_html']);
+ echo "</textarea>\n";
+ echo "</div>\n";
+ }
+ // then look at any user defined fields
foreach ($fields as $field)
{
- if (!in_array($field['name'], array('id', 'area_id'))) // Ignore
certain fields
+ if (!in_array($field['name'], $standard_fields['room']))
{
echo "<div>\n";
- switch($field['name'])
+ $label_text = get_loc_field_name($tbl_room, $field['name']);
+ $var_name = VAR_PREFIX . $field['name'];
+ echo "<label for=\"$var_name\">$label_text:</label>\n";
+ // Output a checkbox if it's a boolean or integer <= 2 bytes (which
we will
+ // assume are intended to be booleans)
+ if (($field['nature'] == 'boolean') ||
+ (($field['nature'] == 'integer') && isset($field['length']) &&
($field['length'] <= 2)) )
{
- // first of all deal with the standard MRBS fields
- case 'room_name':
- echo "<label for=\"room_name\">" . get_vocab("name") .
":</label>\n";
- echo "<input type=\"text\" id=\"room_name\" name=\"room_name\"
value=\"" . htmlspecialchars($row["room_name"]) . "\"$disabled>\n";
- echo "<input type=\"hidden\" name=\"old_room_name\" value=\"" .
htmlspecialchars($row["room_name"]) . "\">\n";
- break;
- case 'sort_key':
- if ($is_admin)
- {
- echo "<label for=\"sort_key\" title=\"" .
get_vocab("sort_key_note") . "\">" . get_vocab("sort_key") . ":</label>\n";
- echo "<input type=\"text\" id=\"sort_key\" name=\"sort_key\"
value=\"" . htmlspecialchars($row["sort_key"]) . "\"$disabled>\n";
- }
- break;
- case 'description':
- echo "<label for=\"description\">" . get_vocab("description") .
":</label>\n";
- echo "<input type=\"text\" id=\"description\"
name=\"description\" value=\"" . htmlspecialchars($row["description"]) .
"\"$disabled>\n";
- break;
- case 'capacity':
- echo "<label for=\"capacity\">" . get_vocab("capacity") .
":</label>\n";
- echo "<input type=\"text\" id=\"capacity\" name=\"capacity\"
value=\"" . $row["capacity"] . "\"$disabled>\n";
- break;
- case 'room_admin_email':
- echo "<label for=\"room_admin_email\" title=\"" .
get_vocab("email_list_note") . "\">" . get_vocab("room_admin_email") .
":</label>\n";
- echo "<textarea id=\"room_admin_email\"
name=\"room_admin_email\" rows=\"4\" cols=\"40\"$disabled>" .
htmlspecialchars($row["room_admin_email"]) . "</textarea>\n";
- break;
- case 'custom_html':
- if ($is_admin)
- {
- // Only show the raw HTML to admins. Non-admins will see the
rendered HTML
- echo "<label for=\"room_custom_html\" title=\"" .
get_vocab("custom_html_note") . "\">" . get_vocab("custom_html") .
":</label>\n";
- echo "<textarea id=\"room_custom_html\" name=\"custom_html\"
rows=\"4\" cols=\"40\"$disabled>\n";
- echo htmlspecialchars($row['custom_html']);
- echo "</textarea>\n";
- }
- break;
- // then look at any user defined fields
- default:
- $label_text = get_loc_field_name($tbl_room, $field['name']);
- $var_name = VAR_PREFIX . $field['name'];
- echo "<label for=\"$var_name\">$label_text:</label>\n";
- // Output a checkbox if it's a boolean or integer <= 2 bytes
(which we will
- // assume are intended to be booleans)
- if (($field['nature'] == 'boolean') ||
- (($field['nature'] == 'integer') && isset($field['length'])
&& ($field['length'] <= 2)) )
- {
- echo "<input type=\"checkbox\" class=\"checkbox\" " .
- "id=\"$var_name\" " .
- "name=\"$var_name\" " .
- "value=\"1\" " .
- ((!empty($row[$field['name']])) ? " checked=\"checked\""
: "") .
- "$disabled>\n";
- }
- // Output a textarea if it's a character string longer than the
limit for a
- // text input
- elseif (($field['nature'] == 'character') &&
isset($field['length']) && ($field['length'] > $text_input_max))
- {
- echo "<textarea rows=\"8\" cols=\"40\" " .
- "id=\"$var_name\" " .
- "name=\"$var_name\" " .
- "$disabled>\n";
- echo htmlspecialchars($row[$field['name']]);
- echo "</textarea>\n";
- }
- // Otherwise output a text input
- else
- {
- echo "<input type=\"text\" " .
- "id=\"$var_name\" " .
- "name=\"$var_name\" " .
- "value=\"" . htmlspecialchars($row[$field['name']]) .
"\"" .
- "$disabled>\n";
- }
- break;
+ echo "<input type=\"checkbox\" class=\"checkbox\" " .
+ "id=\"$var_name\" " .
+ "name=\"$var_name\" " .
+ "value=\"1\" " .
+ ((!empty($row[$field['name']])) ? " checked=\"checked\"" :
"") .
+ "$disabled>\n";
}
+ // Output a textarea if it's a character string longer than the
limit for a
+ // text input
+ elseif (($field['nature'] == 'character') && isset($field['length'])
&& ($field['length'] > $text_input_max))
+ {
+ echo "<textarea rows=\"8\" cols=\"40\" " .
+ "id=\"$var_name\" " .
+ "name=\"$var_name\" " .
+ "$disabled>\n";
+ echo htmlspecialchars($row[$field['name']]);
+ echo "</textarea>\n";
+ }
+ // Otherwise output a text input
+ else
+ {
+ echo "<input type=\"text\" " .
+ "id=\"$var_name\" " .
+ "name=\"$var_name\" " .
+ "value=\"" . htmlspecialchars($row[$field['name']]) . "\"" .
+ "$disabled>\n";
+ }
echo "</div>\n";
}
}
@@ -656,6 +687,23 @@
<label for="area_name"><?php echo get_vocab("name") ?>:</label>
<input type="text" id="area_name" name="area_name" value="<?php echo
htmlspecialchars($row["area_name"]); ?>">
</div>
+
+ <?php
+ // Status - Enabled or Disabled
+ echo "<div id=\"status\">\n";
+ echo "<label title=\"" . get_vocab("disabled_area_note") . "\">" .
get_vocab("status") . ":</label>\n";
+ echo "<div class=\"group\">\n";
+ echo "<label>\n";
+ $checked = ($row['disabled']) ? "" : " checked=\"checked\"";
+ echo "<input class=\"radio\" type=\"radio\" name=\"area_disabled\"
value=\"0\"$checked>\n";
+ echo get_vocab("enabled") . "</label>\n";
+ echo "<label>\n";
+ $checked = ($row['disabled']) ? " checked=\"checked\"" : "";
+ echo "<input class=\"radio\" type=\"radio\" name=\"area_disabled\"
value=\"1\"$checked>\n";
+ echo get_vocab("disabled") . "</label>\n";
+ echo "</div>\n";
+ echo "</div>\n";
+ ?>
<div>
<?php
Modified: mrbs/branches/disabled_rooms/web/internalconfig.inc.php
===================================================================
--- mrbs/branches/disabled_rooms/web/internalconfig.inc.php 2010-11-18
10:02:40 UTC (rev 1612)
+++ mrbs/branches/disabled_rooms/web/internalconfig.inc.php 2010-11-18
11:15:03 UTC (rev 1613)
@@ -97,6 +97,16 @@
'info_user',
'info_text');
+$standard_fields['room'] = array('id',
+ 'disabled',
+ 'area_id',
+ 'room_name',
+ 'sort_key',
+ 'description',
+ 'capacity',
+ 'room_admin_email',
+ 'custom_html');
+
// Boolean fields. These are fields which are treated as booleans
$boolean_fields['area'] = array('private_enabled',
'private_default',
Modified: mrbs/branches/disabled_rooms/web/lang.en
===================================================================
--- mrbs/branches/disabled_rooms/web/lang.en 2010-11-18 10:02:40 UTC (rev
1612)
+++ mrbs/branches/disabled_rooms/web/lang.en 2010-11-18 11:15:03 UTC (rev
1613)
@@ -301,6 +301,7 @@
$vocab["rooms"] = "Rooms";
$vocab["in"] = "in";
$vocab["noareas"] = "No areas have been defined.";
+$vocab["noareas_enabled"] = "No areas have been enabled.";
$vocab["addarea"] = "Add Area";
$vocab["name"] = "Name";
$vocab["noarea"] = "No area selected";
@@ -308,6 +309,7 @@
$vocab["addroom"] = "Add Room";
$vocab["capacity"] = "Capacity";
$vocab["norooms"] = "No rooms have been defined.";
+$vocab["norooms_enabled"] = "No rooms have been enabled.";
$vocab["administration"] = "Room Details";
$vocab["invalid_area_name"] = "This area name has already been used!";
$vocab["empty_name"] = "You have not entered a name!";
@@ -368,7 +370,15 @@
$vocab["mode"] = "Mode";
$vocab["mode_periods"] = "Periods";
$vocab["mode_times"] = "Times";
-$vocab["times_only"] = "Times mode only";
+$vocab["times_only"] = "Times mode only";
+$vocab["enabled"] = "Enabled";
+$vocab["disabled"] = "Disabled";
+$vocab["disabled_area_note"] = "If this area is disabled, it will not
appear in the calendar views " .
+ "and it will not be possible to book rooms
in it. However existing bookings " .
+ "will be preserved and will be visible in
Search and Report results.";
+$vocab["disabled_room_note"] = "If this room is disabled, it will not
appear in the calendar views " .
+ "and it will not be possible to book it.
However existing bookings " .
+ "will be preserved and will be visible in
Search and Report results.";
// Used in edit_users.php
$vocab["name_empty"] = "You must enter a name.";
Modified: mrbs/branches/disabled_rooms/web/mrbs.css.php
===================================================================
--- mrbs/branches/disabled_rooms/web/mrbs.css.php 2010-11-18 10:02:40 UTC
(rev 1612)
+++ mrbs/branches/disabled_rooms/web/mrbs.css.php 2010-11-18 11:15:03 UTC
(rev 1613)
@@ -81,6 +81,9 @@
.freeze_panes th div {height: 1.5em; max-height: 1.5em; min-height: 1.5em}
.freeze_panes td div {height: 2em; max-height: 2em; min-height: 2em}
.freeze_panes td.int div {width: 6em; text-align: right; padding-right: 0.5em}
+.freeze_panes td.boolean {text-align: center}
+.freeze_panes td.boolean div {display: block}
+.freeze_panes td.boolean img {margin-top: 3px}
select.room_area_select {margin-right: 0.5em}
Added: mrbs/branches/disabled_rooms/web/upgrade/22/mysql.sql
===================================================================
--- mrbs/branches/disabled_rooms/web/upgrade/22/mysql.sql
(rev 0)
+++ mrbs/branches/disabled_rooms/web/upgrade/22/mysql.sql 2010-11-18
11:15:03 UTC (rev 1613)
@@ -0,0 +1,9 @@
+# $Id$
+
+# Add a column to record whether the area/room is enabled or disabled for use
+
+ALTER TABLE %DB_TBL_PREFIX%area
+ADD COLUMN disabled tinyint(1) DEFAULT 0 NOT NULL AFTER id;
+
+ALTER TABLE %DB_TBL_PREFIX%room
+ADD COLUMN disabled tinyint(1) DEFAULT 0 NOT NULL AFTER id;
Property changes on: mrbs/branches/disabled_rooms/web/upgrade/22/mysql.sql
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: mrbs/branches/disabled_rooms/web/upgrade/22/pgsql.sql
===================================================================
--- mrbs/branches/disabled_rooms/web/upgrade/22/pgsql.sql
(rev 0)
+++ mrbs/branches/disabled_rooms/web/upgrade/22/pgsql.sql 2010-11-18
11:15:03 UTC (rev 1613)
@@ -0,0 +1,9 @@
+-- $Id$
+
+-- Add a column to record whether the area/room is enabled or disabled for use
+
+ALTER TABLE %DB_TBL_PREFIX%area
+ADD COLUMN disabled smallint DEFAULT 0 NOT NULL;
+
+ALTER TABLE %DB_TBL_PREFIX%room
+ADD COLUMN disabled smallint DEFAULT 0 NOT NULL;
Property changes on: mrbs/branches/disabled_rooms/web/upgrade/22/pgsql.sql
___________________________________________________________________
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.
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits