Revision: 2040
http://mrbs.svn.sourceforge.net/mrbs/?rev=2040&view=rev
Author: cimorrison
Date: 2011-09-30 15:26:54 +0000 (Fri, 30 Sep 2011)
Log Message:
-----------
Stopped the right hand column of the rooms table from being fixed when not an
admin
Modified Paths:
--------------
mrbs/branches/datatables/web/Themes/default/header.inc
Modified: mrbs/branches/datatables/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/datatables/web/Themes/default/header.inc 2011-09-30
14:53:18 UTC (rev 2039)
+++ mrbs/branches/datatables/web/Themes/default/header.inc 2011-09-30
15:26:54 UTC (rev 2040)
@@ -209,7 +209,7 @@
// which are merged with the default options. If the browser is IE6
or less
// we don't bother making a dataTable: it can be done, but it's not
worth it.
//
- // leftCol and rightCol are two objects which if defined will fix the
left and/or
+ // leftCol and rightCol are two objects which if defined or not null
will fix the left and/or
// right most columns. They have properties 'iWidth' and 'sWidth'
defining the
// maximum width of the fixed column. If sWidth = "fixed" then the
iWidth is
// a pixel value. If it is "relative" then a percentage.
@@ -253,7 +253,8 @@
sRestore: '<?php echo
get_vocab("restore_original") ?>'};
defaultOptions.fnInitComplete = function(){
- if ((leftCol !== undefined) || (rightCol !== undefined))
+ if (((leftCol !== undefined) && (leftCol !== null)) ||
+ ((rightCol !== undefined) && (rightCol !== null)) )
{
<?php
// Fix the left and/or right columns. This has to be done
when
@@ -261,13 +262,13 @@
// asynchronously
?>
var options = {};
- if (leftCol !== undefined)
+ if ((leftCol !== undefined) && (leftCol !== null))
{
options.iLeftColumns = 1;
options.sLeftWidth = "fixed";
options.iLeftWidth = getFixedColWidth(table, leftCol);
}
- if (rightCol !== undefined)
+ if ((rightCol !== undefined) && (rightCol !== null))
{
options.iRightColumns = 1;
options.sRightWidth = "fixed";
@@ -284,17 +285,29 @@
$('.js div.datatable_container').css('visibility', 'visible');
};
- if (leftCol !== undefined)
- {
+ <?php
+ // If we've fixed the left or right hand columns, then (a) remove
it
+ // from the column visibility list because it is fixed and (b)
stop it
+ // being reordered
+ ?>
+ var colVisExcludeCols = []
+ if ((leftCol !== undefined) && (leftCol !== null))
+ {
+ colVisExcludeCols.push(0);
+ defaultOptions.oColReorder = {iFixedColumns: 1};
+ }
+ if ((rightCol !== undefined) && (rightCol !== null))
+ {
+ nCols = table.find('tr:first-child th').length;
+ colVisExcludeCols.push(nCols - 1);
<?php
- // If we've fixed the left hand column, then (a) remove the
first column
- // from the column visibility list because it is fixed and (b)
stop it
- // being reordered
+ // Actually we stop them all from being reordered because at the
moment
+ // dataTables only has a way of stopping the leftmost n columns
from
+ // being reordered. May be fixed in a future release
?>
- defaultOptions.oColVis = {aiExclude: [0]};
- defaultOptions.oColReorder = {iFixedColumns: 1};
+ defaultOptions.oColReorder = {iFixedColumns: nCols};
}
-
+ defaultOptions.oColVis = {aiExclude: colVisExcludeCols};
<?php
// Merge the specific options with the default options. We do a
deep
// merge.
@@ -1115,11 +1128,24 @@
if ($page == 'admin')
{
// Turn the list of rooms into a dataTable
+ // If we're an admin, then fix the right hand column
+ if ($is_admin)
+ {
+ ?>
+ var rightCol = {sWidth: "fixed", iWidth: 40};
+ <?php
+ }
+ else
+ {
+ ?>
+ var rightCol = null;
+ <?php
+ }
?>
var roomsTable = makeDataTable('#rooms_table',
{},
{sWidth: "relative", iWidth: 33},
- {sWidth: "fixed", iWidth: 40} );
+ rightCol);
<?php
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits