From: moodler Date: Tue, 23 Jan 2007 05:37:26 +0000 (+0000) Subject: Fixed up styles for simple boxes see MDL-8101 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8f36e33ec3737ba535177501c5ef9773a86abf74;p=moodle.git Fixed up styles for simple boxes see MDL-8101 --- diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index d413588201..fa932916e1 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -836,14 +836,25 @@ function print_simple_box_start($align='', $width='', $color='', $padding=5, $cl $output = ''; - $divclasses = $class.' '.$class.'content'; + $divclasses = 'box '.$class.' '.$class.'content'; $divstyles = ''; if ($align) { $divclasses .= ' boxalign'.$align; // Implement alignment using a class } if ($width) { // Hopefully we can eliminate these in calls to this function (inline styles are bad) - $divstyles .= ' width:'.$width.';'; + if (substr($width, -1, 1) == '%') { // Width is a % value + $width = (int) substr($width, 0, -1); // Extract just the number + if ($width < 40) { + $divclasses .= ' boxwidthnarrow'; // Approx 30% depending on theme + } else if ($width > 60) { + $divclasses .= ' boxwidthwide'; // Approx 80% depending on theme + } else { + $divclasses .= ' boxwidthnormal'; // Approx 50% depending on theme + } + } else { + $divstyles .= ' width:'.$width.';'; // Last resort + } } if ($color) { // Hopefully we can eliminate these in calls to this function (inline styles are bad) $divstyles .= ' background:'.$color.';'; diff --git a/lib/weblib.php b/lib/weblib.php index 3452b3cc9b..6368975dd7 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2864,7 +2864,7 @@ function print_box_start($classes='generalbox', $ids='', $return=false) { $ids = ' id="'.$ids.'"'; } - $output .= ''; + $output .= ''; if ($return) { return $output;