From: nfreear Date: Thu, 6 Apr 2006 17:21:04 +0000 (+0000) Subject: Fix 2, bug 4943: "print_simple_box behaviour changed". Centred is now default alignme... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=408b65dd44f409f2d7cdd7666cea9253e36a4ce2;p=moodle.git Fix 2, bug 4943: "print_simple_box behaviour changed". Centred is now default alignment; for centred no-width specified, width=30em. --- diff --git a/lib/weblib.php b/lib/weblib.php index d56b70d6c6..56fab91788 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2499,13 +2499,13 @@ function print_continue($link) { /** * Print a message in a standard themed box. + * See, {@link print_simple_box_start}. * - * @param string $message ? - * @param string $align ? - * @param string $width ? - * @param string $color ? - * @param int $padding ? - * @param string $class ? + * @param string $align string, alignment of the box, not the text (default center, left, right). + * @param string $width string, width of the box, including units %, for example '100%'. + * @param string $color string, background colour of the box, for example '#eee'. + * @param int $padding integer, padding in pixels, specified without units. + * @param string $class string, space-separated class names. * @todo Finish documenting this function */ function print_simple_box($message, $align='', $width='', $color='', $padding=5, $class='generalbox', $id='') { @@ -2516,9 +2516,16 @@ function print_simple_box($message, $align='', $width='', $color='', $padding=5, /** * Print the top portion of a standard themed box. + * To improve accessibility, the box is now a DIV, not a TABLE. + * If the box is left aligned and width is not specified the box will shrink + * to fit - as per the 1.5 table behaviour. + * If alignment and width are not specified, the box will be centred and given + * a width of 30em, based on usability studies + * {@link http://www.maxdesign.com.au/presentation/em/ Ideal line length for content}. + * Text will be left aligned - the behaviour has changed, but will hopefully look OK. * - * @param string $align string, alignment of the box, not the text (default left, center, right). - * @param string $width string, width of the box, including units, for example '100%'. + * @param string $align string, alignment of the box, not the text (default center, left, right). + * @param string $width string, width of the box, including % units, for example '100%'. * @param string $color string, background colour of the box, for example '#eee'. * @param int $padding integer, padding in pixels, specified without units. * @param string $class string, space-separated class names. @@ -2536,10 +2543,13 @@ function print_simple_box_start($align='', $width='', $color='', $padding=5, $cl if ($color) { $style_out .= 'background-color:'. $color .'; '; } - if ($align && 'center' == $align) { + if (!$align || 'center' == $align) { + if (! $width) { + $style_out .= 'width:30em; '; + } $style_out .= 'margin-left:auto; margin-right:auto; '; } - elseif (!$align || 'left' == $align) { + elseif ($align && 'left' == $align) { $style_out .= 'float:left; '; } else { @@ -2552,7 +2562,11 @@ function print_simple_box_start($align='', $width='', $color='', $padding=5, $cl if ($id) { $id = 'id="'. $id .'"'; } - echo "
\n"; + echo "\n
\n"; + global $CFG; + if ($CFG->debug > 7) { + echo "\n"; + } } /**