Fixed up styles for simple boxes see MDL-8101

This commit is contained in:
moodler 2007-01-23 05:37:26 +00:00
parent 4a384c5bbe
commit 8f36e33ec3
2 changed files with 14 additions and 3 deletions

View File

@ -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.';';

View File

@ -2864,7 +2864,7 @@ function print_box_start($classes='generalbox', $ids='', $return=false) {
$ids = ' id="'.$ids.'"';
}
$output .= '<div'.$ids.' class="'.$classes.'">';
$output .= '<div'.$ids.' class="box '.$classes.'">';
if ($return) {
return $output;