Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.358 diff -u -p -r1.358 theme.inc --- includes/theme.inc 8 Jun 2007 12:51:58 -0000 1.358 +++ includes/theme.inc 24 Jun 2007 17:26:21 -0000 @@ -100,33 +100,16 @@ function _init_theme($theme, $base_theme $theme_path = dirname($theme->filename); - // Add the default stylesheet - if (!empty($theme->stylesheet)) { - drupal_add_css($theme->stylesheet, 'theme'); - } - else { - // If we don't have a stylesheet of our own, look for the first - // base to have one and use its. - foreach ($base_theme as $base) { - if (!empty($base->stylesheet)) { - drupal_add_css($base->stylesheet, 'theme'); - break; - } + // Add the default stylesheets. + if (!empty($theme->stylesheets)) { + foreach ($theme->stylesheets as $stylesheet) { + drupal_add_css($stylesheet, 'theme'); } } - - // Add the default script - if (!empty($theme->script)) { - drupal_add_js($theme->script, 'theme'); - } - else { - // If we don't have a script of our own, look for the first - // base to have one and use its. - foreach ($base_theme as $base) { - if (!empty($base->script)) { - drupal_add_js($base->script, 'theme'); - break; - } + // Add the default scripts. + if (!empty($theme->scripts)) { + foreach ($theme->scripts as $script) { + drupal_add_js($script, 'theme'); } } @@ -356,11 +339,15 @@ function list_themes($refresh = FALSE) { while ($theme = db_fetch_object($result)) { if (file_exists($theme->filename)) { $theme->info = unserialize($theme->info); - if (!empty($theme->info['stylesheet']) && file_exists($theme->info['stylesheet'])) { - $theme->stylesheet = $theme->info['stylesheet']; + foreach ($theme->info['stylesheets'] as $stylesheet => $path) { + if (file_exists($path)) { + $theme->stylesheets[$stylesheet] = $path; + } } - if (!empty($theme->info['script']) && file_exists($theme->info['script'])) { - $theme->script = $theme->info['script']; + foreach ($theme->info['scripts'] as $script => $path) { + if (file_exists($path)) { + $theme->scripts[$script] = $path; + } } if (isset($theme->info['engine'])) { $theme->engine = $theme->info['engine']; Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.496 diff -u -p -r1.496 system.module --- modules/system/system.module 24 Jun 2007 10:09:53 -0000 1.496 +++ modules/system/system.module 24 Jun 2007 17:26:22 -0000 @@ -1058,8 +1058,8 @@ function system_theme_default() { 'search', 'slogan' ), - 'stylesheet' => 'style.css', - 'script' => 'script.js', + 'stylesheets' => array('style.css'), + 'scripts' => array('script.js'), 'screenshot' => 'screenshot.png', ); } @@ -1109,14 +1109,18 @@ function system_theme_data() { } } - // Give the stylesheet proper path information. - if (!empty($themes[$key]->info['stylesheet'])) { - $themes[$key]->info['stylesheet'] = dirname($themes[$key]->filename) .'/'. $themes[$key]->info['stylesheet']; + // Give the stylesheets proper path information. + $stylesheets = array(); + foreach ($themes[$key]->info['stylesheets'] as $stylesheet) { + $stylesheets[$stylesheet] = dirname($themes[$key]->filename) .'/'. $stylesheet; } + $themes[$key]->info['stylesheets'] = $stylesheets; // Give the script proper path information. - if (!empty($themes[$key]->info['script'])) { - $themes[$key]->info['script'] = dirname($themes[$key]->filename) .'/'. $themes[$key]->info['script']; + $scripts = array(); + foreach ($themes[$key]->info['scripts'] as $script) { + $scripts[$script] = dirname($themes[$key]->filename) .'/'. $script; } + $themes[$key]->info['scripts'] = $scripts; // Give the screenshot proper path information. if (!empty($themes[$key]->info['screenshot'])) { $themes[$key]->info['screenshot'] = dirname($themes[$key]->filename) .'/'. $themes[$key]->info['screenshot']; @@ -1142,6 +1146,20 @@ function system_theme_data() { $themes[$key]->prefix = $key; } } + // Add any stylesheets from the base theme, unless the names match in which case + // the sub-theme wins. Note that we slip the base theme's stylesheets in at the + // beginning of the array so that they get added to the page in the correct order. + foreach ($themes[$base_key]->info['stylesheets'] as $stylesheet => $path) { + if (!isset($themes[$key]->info['stylesheets'][$stylesheet])) { + $themes[$key]->info['stylesheets'] = array($stylesheet => $path) + $themes[$key]->info['stylesheets']; + } + } + // Now do the same for scripts. + foreach ($themes[$base_key]->info['scripts'] as $script => $path) { + if (!isset($themes[$key]->info['scripts'][$script])) { + $themes[$key]->info['scripts'] = array($script => $path) + $themes[$key]->info['scripts']; + } + } } // Extract current files from database. Index: themes/garland/garland.info =================================================================== RCS file: /cvs/drupal/drupal/themes/garland/garland.info,v retrieving revision 1.4 diff -u -p -r1.4 garland.info --- themes/garland/garland.info 8 Jun 2007 05:50:57 -0000 1.4 +++ themes/garland/garland.info 24 Jun 2007 17:26:22 -0000 @@ -4,3 +4,7 @@ description = Tableless, recolorable, mu version = VERSION core = 6.x engine = phptemplate +stylesheets[] = style.css +stylesheets[] = lists.css +scripts[] = script1.js +scripts[] = script2.js Index: themes/garland/lists.css =================================================================== RCS file: themes/garland/lists.css diff -N themes/garland/lists.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ themes/garland/lists.css 24 Jun 2007 17:26:22 -0000 @@ -0,0 +1,92 @@ +ul { + margin: 0.5em 0 1em; + padding: 0; +} + +ol { + margin: 0.75em 0 1.25em; + padding: 0; +} + +ol li, ul li { + margin: 0.4em 0 0.4em .5em; +} + +ul.menu, .item-list ul { + margin: 0.35em 0 0 -0.5em; + padding: 0; +} + +ul.menu ul, .item-list ul ul { + margin-left: 0em; +} + +ol li, ul li, ul.menu li, .item-list ul li, li.leaf { + margin: 0.15em 0 0.15em .5em; +} + +ul li, ul.menu li, .item-list ul li, li.leaf { + padding: 0 0 .2em 1.5em; + list-style-type: none; + list-style-image: none; + background: transparent url(images/menu-leaf.gif) no-repeat 1px .35em; +} + +ol li { + padding: 0 0 .3em; + margin-left: 2em; +} + +ul li.expanded { + background: transparent url(images/menu-expanded.gif) no-repeat 1px .35em; +} + +ul li.collapsed { + background: transparent url(images/menu-collapsed.gif) no-repeat 0px .35em; +} + +ul li.leaf a, ul li.expanded a, ul li.collapsed a { + display: block; +} + +ul.inline li { + background: none; + margin: 0; + padding: 0 1em 0 0; +} + +ol.task-list { + margin-left: 0; + list-style-type: none; + list-style-image: none; +} +ol.task-list li { + padding: 0.5em 1em 0.5em 2em; +} +ol.task-list li.active { + background: transparent url(images/task-list.png) no-repeat 3px 50%; +} +ol.task-list li.done { + color: #393; + background: transparent url(../../misc/watchdog-ok.png) no-repeat 0px 50%; +} +ol.task-list li.active { + margin-right: 1em; +} + +fieldset ul.clear-block li { + margin: 0; + padding: 0; + background-image: none; +} + +dl { + margin: 0.5em 0 1em 1.5em; +} + +dl dt { +} + +dl dd { + margin: 0 0 .5em 1.5em; +} Index: themes/garland/script1.js =================================================================== RCS file: themes/garland/script1.js diff -N themes/garland/script1.js Index: themes/garland/script2.js =================================================================== RCS file: themes/garland/script2.js diff -N themes/garland/script2.js Index: themes/garland/style.css =================================================================== RCS file: /cvs/drupal/drupal/themes/garland/style.css,v retrieving revision 1.20 diff -u -p -r1.20 style.css --- themes/garland/style.css 21 Jun 2007 04:38:41 -0000 1.20 +++ themes/garland/style.css 24 Jun 2007 17:26:22 -0000 @@ -93,99 +93,6 @@ hr { background: #5294c1; } -ul { - margin: 0.5em 0 1em; - padding: 0; -} - -ol { - margin: 0.75em 0 1.25em; - padding: 0; -} - -ol li, ul li { - margin: 0.4em 0 0.4em .5em; -} - -ul.menu, .item-list ul { - margin: 0.35em 0 0 -0.5em; - padding: 0; -} - -ul.menu ul, .item-list ul ul { - margin-left: 0em; -} - -ol li, ul li, ul.menu li, .item-list ul li, li.leaf { - margin: 0.15em 0 0.15em .5em; -} - -ul li, ul.menu li, .item-list ul li, li.leaf { - padding: 0 0 .2em 1.5em; - list-style-type: none; - list-style-image: none; - background: transparent url(images/menu-leaf.gif) no-repeat 1px .35em; -} - -ol li { - padding: 0 0 .3em; - margin-left: 2em; -} - -ul li.expanded { - background: transparent url(images/menu-expanded.gif) no-repeat 1px .35em; -} - -ul li.collapsed { - background: transparent url(images/menu-collapsed.gif) no-repeat 0px .35em; -} - -ul li.leaf a, ul li.expanded a, ul li.collapsed a { - display: block; -} - -ul.inline li { - background: none; - margin: 0; - padding: 0 1em 0 0; -} - -ol.task-list { - margin-left: 0; - list-style-type: none; - list-style-image: none; -} -ol.task-list li { - padding: 0.5em 1em 0.5em 2em; -} -ol.task-list li.active { - background: transparent url(images/task-list.png) no-repeat 3px 50%; -} -ol.task-list li.done { - color: #393; - background: transparent url(../../misc/watchdog-ok.png) no-repeat 0px 50%; -} -ol.task-list li.active { - margin-right: 1em; -} - -fieldset ul.clear-block li { - margin: 0; - padding: 0; - background-image: none; -} - -dl { - margin: 0.5em 0 1em 1.5em; -} - -dl dt { -} - -dl dd { - margin: 0 0 .5em 1.5em; -} - img, a img { border: none; }