? sites/default/files ? sites/default/settings.php ? themes/bartik/js Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.258 diff -u -p -r1.258 locale.inc --- includes/locale.inc 30 Jul 2010 02:47:27 -0000 1.258 +++ includes/locale.inc 24 Aug 2010 00:51:47 -0000 @@ -1187,6 +1187,7 @@ function _locale_parse_js_file($filepath // The file path might contain a query string, so make sure we only use the // actual file. + debug($filepath); $parsed_url = drupal_parse_url($filepath); $filepath = $parsed_url['path']; // Load the JavaScript file. Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.606 diff -u -p -r1.606 theme.inc --- includes/theme.inc 22 Aug 2010 12:46:21 -0000 1.606 +++ includes/theme.inc 24 Aug 2010 00:51:47 -0000 @@ -605,9 +605,7 @@ function list_themes($refresh = FALSE) { } } foreach ($theme->info['scripts'] as $script => $path) { - if (file_exists($path)) { - $theme->scripts[$script] = $path; - } + $theme->scripts[$script] = $path; } if (isset($theme->info['engine'])) { $theme->engine = $theme->info['engine']; @@ -2274,6 +2272,22 @@ function template_preprocess_page(&$vari if ($suggestions = theme_get_suggestions(arg(), 'page')) { $variables['theme_hook_suggestions'] = $suggestions; } + + // Add CSS and JS declared in module .info files. + foreach (system_get_info('module') as $module => $info) { + if (!empty($info['stylesheets'])) { + foreach ($info['stylesheets'] as $media => $stylesheets) { + foreach ($stylesheets as $stylesheet) { + drupal_add_css($stylesheet, array('media' => $media, 'preprocess' => TRUE)); + } + } + } + if (!empty($info['scripts'])) { + foreach ($info['scripts'] as $script) { + drupal_add_js($script, array('preprocess' => TRUE)); + } + } + } } /** * Process variables for html.tpl.php Index: modules/aggregator/aggregator.info =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.info,v retrieving revision 1.13 diff -u -p -r1.13 aggregator.info --- modules/aggregator/aggregator.info 17 Nov 2009 21:24:18 -0000 1.13 +++ modules/aggregator/aggregator.info 24 Aug 2010 00:51:47 -0000 @@ -13,3 +13,4 @@ files[] = aggregator.processor.inc files[] = aggregator.install files[] = aggregator.test configure = admin/config/services/aggregator/settings +stylesheets[all][] = aggregator.css Index: modules/aggregator/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v retrieving revision 1.442 diff -u -p -r1.442 aggregator.module --- modules/aggregator/aggregator.module 4 Aug 2010 03:54:54 -0000 1.442 +++ modules/aggregator/aggregator.module 24 Aug 2010 00:51:47 -0000 @@ -283,13 +283,6 @@ function _aggregator_category_title($cat } /** - * Implements hook_init(). - */ -function aggregator_init() { - drupal_add_css(drupal_get_path('module', 'aggregator') . '/aggregator.css', array('preprocess' => TRUE)); -} - -/** * Find out whether there are any aggregator categories. * * @return Index: modules/book/book.info =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.info,v retrieving revision 1.13 diff -u -p -r1.13 book.info --- modules/book/book.info 17 Nov 2009 21:24:18 -0000 1.13 +++ modules/book/book.info 24 Aug 2010 00:51:47 -0000 @@ -10,3 +10,4 @@ files[] = book.pages.inc files[] = book.install files[] = book.test configure = admin/content/book/settings +stylesheets[all][] = book.css Index: modules/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.549 diff -u -p -r1.549 book.module --- modules/book/book.module 17 Aug 2010 16:20:07 -0000 1.549 +++ modules/book/book.module 24 Aug 2010 00:51:47 -0000 @@ -219,13 +219,6 @@ function book_admin_paths() { } /** - * Implements hook_init(). - */ -function book_init() { - drupal_add_css(drupal_get_path('module', 'book') . '/book.css', array('preprocess' => TRUE)); -} - -/** * Implements hook_entity_info_alter(). */ function book_entity_info_alter(&$info) { Index: modules/comment/comment.info =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.info,v retrieving revision 1.13 diff -u -p -r1.13 comment.info --- modules/comment/comment.info 16 Aug 2010 20:57:22 -0000 1.13 +++ modules/comment/comment.info 24 Aug 2010 00:51:47 -0000 @@ -12,3 +12,4 @@ files[] = comment.install files[] = comment.test files[] = comment.tokens.inc configure = admin/content/comment +stylesheets[all][] = comment.css Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.892 diff -u -p -r1.892 comment.module --- modules/comment/comment.module 23 Aug 2010 14:53:50 -0000 1.892 +++ modules/comment/comment.module 24 Aug 2010 00:51:47 -0000 @@ -290,13 +290,6 @@ function comment_menu() { } /** - * Implements hook_init(). - */ -function comment_init() { - drupal_add_css(drupal_get_path('module', 'comment') . '/comment.css', array('preprocess' => TRUE)); -} - -/** * Implements hook_menu_alter(). */ function comment_menu_alter(&$items) { Index: modules/field/field.info =================================================================== RCS file: /cvs/drupal/drupal/modules/field/field.info,v retrieving revision 1.8 diff -u -p -r1.8 field.info --- modules/field/field.info 21 Jun 2010 02:27:47 -0000 1.8 +++ modules/field/field.info 24 Aug 2010 00:51:47 -0000 @@ -15,3 +15,4 @@ files[] = field.form.inc files[] = tests/field.test dependencies[] = field_sql_storage required = TRUE +stylesheets[all][] = theme/field.css Index: modules/field/field.module =================================================================== RCS file: /cvs/drupal/drupal/modules/field/field.module,v retrieving revision 1.82 diff -u -p -r1.82 field.module --- modules/field/field.module 22 Aug 2010 12:55:04 -0000 1.82 +++ modules/field/field.module 24 Aug 2010 00:51:47 -0000 @@ -166,13 +166,6 @@ function field_theme() { } /** - * Implements hook_init(). - */ -function field_init() { - drupal_add_css(drupal_get_path('module', 'field') . '/theme/field.css', array('preprocess' => TRUE)); -} - -/** * Implements hook_cron(). * * Purges some deleted Field API data, if any exists. Index: modules/forum/forum.info =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.info,v retrieving revision 1.13 diff -u -p -r1.13 forum.info --- modules/forum/forum.info 17 Nov 2009 21:24:18 -0000 1.13 +++ modules/forum/forum.info 24 Aug 2010 00:51:47 -0000 @@ -12,3 +12,4 @@ files[] = forum.pages.inc files[] = forum.install files[] = forum.test configure = admin/structure/forum +stylesheets[all][] = forum.css Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.573 diff -u -p -r1.573 forum.module --- modules/forum/forum.module 17 Aug 2010 16:20:07 -0000 1.573 +++ modules/forum/forum.module 24 Aug 2010 00:51:47 -0000 @@ -218,13 +218,6 @@ function forum_menu_local_tasks_alter(&$ } /** - * Implements hook_init(). - */ -function forum_init() { - drupal_add_css(drupal_get_path('module', 'forum') . '/forum.css', array('preprocess' => TRUE)); -} - -/** * Implements hook_entity_info_alter(). */ function forum_entity_info_alter(&$info) { Index: modules/locale/locale.module =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v retrieving revision 1.297 diff -u -p -r1.297 locale.module --- modules/locale/locale.module 5 Aug 2010 08:08:43 -0000 1.297 +++ modules/locale/locale.module 24 Aug 2010 00:51:47 -0000 @@ -811,7 +811,7 @@ function locale_system_update($component */ function locale_js_alter(&$javascript) { global $language; - +debug($javascript); $dir = 'public://' . variable_get('locale_js_directory', 'languages'); $parsed = variable_get('javascript_parsed', array()); $files = $new_files = FALSE; Index: modules/node/node.info =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.info,v retrieving revision 1.13 diff -u -p -r1.13 node.info --- modules/node/node.info 17 Nov 2009 21:24:18 -0000 1.13 +++ modules/node/node.info 24 Aug 2010 00:51:47 -0000 @@ -13,3 +13,4 @@ files[] = node.test files[] = node.tokens.inc required = TRUE configure = admin/structure/types +stylesheets[all][] = node.css Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.1293 diff -u -p -r1.1293 node.module --- modules/node/node.module 23 Aug 2010 22:15:34 -0000 1.1293 +++ modules/node/node.module 24 Aug 2010 00:51:47 -0000 @@ -2003,13 +2003,6 @@ function _node_custom_theme() { } } -/** - * Implements hook_init(). - */ -function node_init() { - drupal_add_css(drupal_get_path('module', 'node') . '/node.css', array('preprocess' => TRUE)); -} - function node_last_changed($nid) { return db_query('SELECT changed FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetch()->changed; } Index: modules/poll/poll.info =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.info,v retrieving revision 1.10 diff -u -p -r1.10 poll.info --- modules/poll/poll.info 19 Aug 2009 20:19:36 -0000 1.10 +++ modules/poll/poll.info 24 Aug 2010 00:51:47 -0000 @@ -9,3 +9,4 @@ files[] = poll.pages.inc files[] = poll.install files[] = poll.test files[] = poll.tokens.inc +stylesheets[all][] = poll.css Index: modules/poll/poll.module =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v retrieving revision 1.354 diff -u -p -r1.354 poll.module --- modules/poll/poll.module 30 Jul 2010 02:47:28 -0000 1.354 +++ modules/poll/poll.module 24 Aug 2010 00:51:48 -0000 @@ -28,13 +28,6 @@ function poll_help($path, $arg) { } /** - * Implements hook_init(). - */ -function poll_init() { - drupal_add_css(drupal_get_path('module', 'poll') . '/poll.css', array('preprocess' => TRUE)); -} - -/** * Implements hook_theme(). */ function poll_theme() { Index: modules/search/search.info =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.info,v retrieving revision 1.11 diff -u -p -r1.11 search.info --- modules/search/search.info 17 Nov 2009 21:24:18 -0000 1.11 +++ modules/search/search.info 24 Aug 2010 00:51:48 -0000 @@ -11,3 +11,4 @@ files[] = search.install files[] = search.test files[] = search.extender.inc configure = admin/config/search/settings +stylesheets[all][] = search.css Index: modules/search/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.module,v retrieving revision 1.358 diff -u -p -r1.358 search.module --- modules/search/search.module 18 Aug 2010 18:40:50 -0000 1.358 +++ modules/search/search.module 24 Aug 2010 00:51:48 -0000 @@ -98,13 +98,6 @@ function search_help($path, $arg) { } /** - * Implements hook_init(). - */ -function search_init() { - drupal_add_css(drupal_get_path('module', 'search') . '/search.css', array('preprocess' => TRUE)); -} - -/** * Implements hook_theme(). */ function search_theme() { Index: modules/system/system.info =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.info,v retrieving revision 1.20 diff -u -p -r1.20 system.info --- modules/system/system.info 15 Dec 2009 08:37:18 -0000 1.20 +++ modules/system/system.info 24 Aug 2010 00:51:48 -0000 @@ -17,3 +17,7 @@ files[] = system.updater.inc files[] = system.mail.inc required = TRUE configure = admin/config/system +stylesheets[all][] = system.css +stylesheets[all][] = system-behavior.css +stylesheets[all][] = system-menus.css +stylesheets[all][] = system-messages.css Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.957 diff -u -p -r1.957 system.module --- modules/system/system.module 22 Aug 2010 13:52:58 -0000 1.957 +++ modules/system/system.module 24 Aug 2010 00:51:48 -0000 @@ -1832,11 +1832,6 @@ function system_init() { if (arg(0) == 'admin' || (variable_get('node_admin_theme', '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit' || arg(2) == 'delete'))) { drupal_add_css($path . '/admin.css', array('weight' => CSS_SYSTEM)); } - drupal_add_css($path . '/system.css', array('weight' => CSS_SYSTEM, 'preprocess' => TRUE)); - drupal_add_css($path . '/system-behavior.css', array('weight' => CSS_SYSTEM, 'preprocess' => TRUE)); - drupal_add_css($path . '/system-menus.css', array('weight' => CSS_SYSTEM, 'preprocess' => TRUE)); - drupal_add_css($path . '/system-messages.css', array('weight' => CSS_SYSTEM, 'preprocess' => TRUE)); - // Ignore slave database servers for this request. // @@ -2290,6 +2285,15 @@ function _system_rebuild_module_data() { // Merge in defaults and save. $modules[$key]->info = $module->info + $defaults; + // Prefix stylesheets and scripts with module path. + $path = dirname($module->uri) . '/'; + if (isset($module->info['stylesheets'])) { + $module->info['stylesheets'] = system_info_add_prefix($module->info['stylesheets'], $path); + } + if (isset($module->info['scripts'])) { + $module->info['scripts'] = system_info_add_prefix($module->info['scripts'], $path); + } + // Install profiles are hidden by default, unless explicitly specified // otherwise in the .info file. if ($key == $profile && !isset($modules[$key]->info['hidden'])) { @@ -2381,6 +2385,8 @@ function _system_rebuild_theme_data() { 'features' => _system_default_theme_features(), 'screenshot' => 'screenshot.png', 'php' => DRUPAL_MINIMUM_PHP, + 'stylesheets' => array(), + 'scripts' => array(), ); $sub_themes = array(); @@ -2413,28 +2419,14 @@ function _system_rebuild_theme_data() { } } - // Give the stylesheets proper path information. - $pathed_stylesheets = array(); - if (isset($themes[$key]->info['stylesheets'])) { - foreach ($themes[$key]->info['stylesheets'] as $media => $stylesheets) { - foreach ($stylesheets as $stylesheet) { - $pathed_stylesheets[$media][$stylesheet] = dirname($themes[$key]->uri) . '/' . $stylesheet; - } - } - } - $themes[$key]->info['stylesheets'] = $pathed_stylesheets; + // Prefix stylesheets and scripts with module path. + $path = dirname($theme->uri) . '/'; + $theme->info['stylesheets'] = system_info_add_prefix($theme->info['stylesheets'], $path); + $theme->info['scripts'] = system_info_add_prefix($theme->info['scripts'], $path); - // Give the scripts proper path information. - $scripts = array(); - if (isset($themes[$key]->info['scripts'])) { - foreach ($themes[$key]->info['scripts'] as $script) { - $scripts[$script] = dirname($themes[$key]->uri) . '/' . $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]->uri) . '/' . $themes[$key]->info['screenshot']; + $themes[$key]->info['screenshot'] = $path . $themes[$key]->info['screenshot']; } } @@ -2482,6 +2474,27 @@ function system_rebuild_theme_data() { } /** + * Prefixes .info file array values with a string. + * + * @param $info + * A nested array of data of an .info file to be processed. + * @param $prefix + * The string to prepend before each value in $info. + */ +function system_info_add_prefix($info, $prefix) { + foreach ($info as $key => $value) { + if (is_array($value)) { + $info[$key] = system_info_add_prefix($info[$key], $prefix); + } + else { + unset($info[$key]); + $info[$value] = $prefix . $value; + } + } + return $info; +} + +/** * Returns an array of default theme features. */ function _system_default_theme_features() { Index: modules/user/user.info =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.info,v retrieving revision 1.13 diff -u -p -r1.13 user.info --- modules/user/user.info 17 Nov 2009 21:24:19 -0000 1.13 +++ modules/user/user.info 24 Aug 2010 00:51:48 -0000 @@ -12,3 +12,4 @@ files[] = user.test files[] = user.tokens.inc required = TRUE configure = admin/config/people +stylesheets[all][] = user.css Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.1195 diff -u -p -r1.1195 user.module --- modules/user/user.module 23 Aug 2010 14:53:50 -0000 1.1195 +++ modules/user/user.module 24 Aug 2010 00:51:48 -0000 @@ -1799,13 +1799,6 @@ function user_admin_paths() { } /** - * Implements hook_init(). - */ -function user_init() { - drupal_add_css(drupal_get_path('module', 'user') . '/user.css', array('preprocess' => TRUE)); -} - -/** * Load either a specified or the current user account. * * @param $uid Index: themes/bartik/bartik.info =================================================================== RCS file: /cvs/drupal/drupal/themes/bartik/bartik.info,v retrieving revision 1.3 diff -u -p -r1.3 bartik.info --- themes/bartik/bartik.info 28 Jul 2010 01:40:39 -0000 1.3 +++ themes/bartik/bartik.info 24 Aug 2010 00:51:48 -0000 @@ -12,7 +12,7 @@ stylesheets[all][] = css/style.css stylesheets[all][] = css/colors.css stylesheets[print][] = css/print.css -scripts[] = scripts/search.js +scripts[] = scripts/bartik.js regions[header] = Header regions[help] = Help