summaryrefslogtreecommitdiff
path: root/includes/theme.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/theme.inc')
-rw-r--r--includes/theme.inc21
1 files changed, 19 insertions, 2 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index eb73fda0c..367befade 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -115,6 +115,21 @@ function _init_theme($theme, $base_theme = array()) {
}
}
+ // 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;
+ }
+ }
+ }
+
$theme_engine = NULL;
// Initialize the theme.
@@ -341,9 +356,12 @@ function list_themes($refresh = FALSE) {
while ($theme = db_fetch_object($result)) {
if (file_exists($theme->filename)) {
$theme->info = unserialize($theme->info);
- if (isset($theme->info['stylesheet'])) {
+ if (!empty($theme->info['stylesheet']) && file_exists($theme->info['stylesheet'])) {
$theme->stylesheet = $theme->info['stylesheet'];
}
+ if (!empty($theme->info['script']) && file_exists($theme->info['script'])) {
+ $theme->script = $theme->info['script'];
+ }
if (isset($theme->info['engine'])) {
$theme->engine = $theme->info['engine'];
}
@@ -1164,7 +1182,6 @@ function theme_table($header, $rows, $attributes = array(), $caption = NULL) {
* Returns a header cell for tables that have a select all functionality.
*/
function theme_table_select_header_cell() {
- drupal_add_js(array('tableSelect' => array('selectAll' => t('Select all rows in this table'), 'selectNone' => t('Deselect all rows in this table'))), 'setting');
drupal_add_js('misc/tableselect.js');
return array('class' => 'select-all');