Revision: 1879
http://mrbs.svn.sourceforge.net/mrbs/?rev=1879&view=rev
Author: cimorrison
Date: 2011-08-23 10:36:20 +0000 (Tue, 23 Aug 2011)
Log Message:
-----------
Turned the rooms table into a DataTable
Modified Paths:
--------------
mrbs/branches/datatables/web/Themes/default/header.inc
mrbs/branches/datatables/web/admin.php
Modified: mrbs/branches/datatables/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/datatables/web/Themes/default/header.inc 2011-08-22
16:50:23 UTC (rev 1878)
+++ mrbs/branches/datatables/web/Themes/default/header.inc 2011-08-23
10:36:20 UTC (rev 1879)
@@ -142,7 +142,7 @@
<?php
// dataTables initialisation
- if (in_array($page, array('edit_users')))
+ if (in_array($page, array('admin', 'edit_users')))
{
// Include the JavaScript for those pages that use dataTables
@@ -876,6 +876,42 @@
}
<?php
+ // ADMIN.PHP
+ if ($page == 'admin')
+ {
+ // Turn the list of users into a dataTable
+ ?>
+ var tableOptions = new Object();
+ <?php
+ // If we're an ordinary user we only see the Name column. If we're
+ // an admin we also see the Delete, Edit and Disabled columns
+ ?>
+ var nFixedColumns = <?php echo ($is_admin) ? 4 : 1 ?>;
+ <?php
+ // Fix the left hand columns. This has to be done when
+ // initialisation is complete as the language files are loaded
+ // asynchronously
+ ?>
+ tableOptions.fnInitComplete = function(){
+ new FixedColumns(roomsTable, {"iLeftColumns": nFixedColumns});
+ };
+ <?php
+ // Remove the fixed columns from the column visibility
+ ?>
+ tableOptions.oColVis = {aiExclude: []};
+ for (var i=0; i<nFixedColumns; i++)
+ {
+ tableOptions.oColVis.aiExclude.push(i);
+ }
+ <?php
+ // and stop those columns being reordered
+ ?>
+ tableOptions.oColReorder = {iFixedColumns: nFixedColumns};
+
+ var roomsTable = makeDataTable('#rooms_table', tableOptions);
+ <?php
+ }
+
// EDIT_AREA_ROOM.PHP
if ($page == 'edit_area_room')
{
Modified: mrbs/branches/datatables/web/admin.php
===================================================================
--- mrbs/branches/datatables/web/admin.php 2011-08-22 16:50:23 UTC (rev
1878)
+++ mrbs/branches/datatables/web/admin.php 2011-08-23 10:36:20 UTC (rev
1879)
@@ -246,14 +246,14 @@
}
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 "<div id=\"room_info\">\n";
+ // Build the table. We deal with the name and disabled columns
+ // first because they are not necessarily the first two columns in
+ // the table (eg if you are running PostgreSQL and have upgraded your
+ // database)
+ echo "<table id=\"rooms_table\" class=\"admin_table display\">\n";
+
+ // The header
echo "<thead>\n";
echo "<tr>\n";
if ($is_admin)
@@ -264,11 +264,36 @@
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
+ // 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";
}
+ // 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";
+
+ // The body
echo "<tbody>\n";
$row_class = "odd_row";
foreach ($rooms as $r)
@@ -304,52 +329,6 @@
// 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))
@@ -391,16 +370,17 @@
echo $html;
}
break;
- }
- }
- }
+ } // switch
+ } // if
+ } // foreach
echo "</tr>\n";
}
}
+
echo "</tbody>\n";
echo "</table>\n";
echo "</div>\n";
- echo "</div>\n";
+
}
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits