Changeset:
9480657fedac
https://sourceforge.net/p/mrbs/hg-code/ci/9480657fedac8c04338e0536d6aa6789113f863b
Author:
Campbell Morrison <[email protected]>
Date:
Sun Apr 02 18:02:36 2017 +0100
Log message:
Limited the maximum colspan size to 1000 as browsers other than Chrome cannot
handle larger colspans.
diffstat:
web/index.php | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diffs (44 lines):
diff -r 8d8697fc032c -r 9480657fedac web/index.php
--- a/web/index.php Sun Apr 02 16:56:22 2017 +0100
+++ b/web/index.php Sun Apr 02 18:02:36 2017 +0100
@@ -163,6 +163,13 @@
function get_row_data_table($map)
{
+ // Some browsers cannot handle very large colspans, anmd so we split large
colspans
+ // up into chunks that they can handle. For example Firefox will not
handle colspans
+ // longer than 1000. See
https://bugzilla.mozilla.org/show_bug.cgi?id=321474. Chrome
+ // seems to cope OK, but to keep things simple we'll just chunkify colspans
for all
+ // browsers.
+ $max_colspan_size = 1000;
+
$html = '';
$html .= "<table class=\"main_view_data\">\n";
@@ -223,6 +230,26 @@
{
// Still in the same booking
$n_slots++;
+ // Check to see whether we've reached the maximum colspan size and
whether the next
+ // slot is also part of this booking. If so, write it out and start
a new colspan.
+ if ($n_slots >= $max_colspan_size)
+ {
+ $data = next($row);
+ if (($data !== false) && (count($data) == 1) && ($data[0]['id'] ==
$this_id))
+ {
+ // The next slot is part of the same booking, so write it out
and start
+ // a new colspan.
+ $html .= get_cell_html($content, $type, $n_slots);
+ $n_slots = 1;
+ }
+ else
+ {
+ // It's not part of the same booking, so just go back one slot
and the booking will
+ // get written out naturally on the next iteration.
+ prev($row);
+ }
+
+ }
}
else
{
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits