Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.254
diff -u -F^f -r1.254 theme.inc
--- includes/theme.inc 18 Aug 2005 22:07:14 -0000 1.254
+++ includes/theme.inc 20 Aug 2005 04:52:54 -0000
@@ -87,27 +87,33 @@ function init_theme() {
*
* @param $refresh
* Whether to reload the list of themes from the database.
+ * @param $user_only
+ * Whether to only return themes available to be user-selected.
* @return
* An array of the currently available themes.
*/
-function list_themes($refresh = FALSE) {
- static $list;
+function list_themes($refresh = FALSE, $user_only = FALSE) {
+ static $list, $user_list;
if ($refresh) {
unset($list);
+ unset($user_list);
}
if (!$list) {
$list = array();
- $result = db_query("SELECT * FROM {system} WHERE type = 'theme' AND status = 1");
+ $result = db_query("SELECT * FROM {system} WHERE type = 'theme'");
while ($theme = db_fetch_object($result)) {
if (file_exists($theme->filename)) {
$list[$theme->name] = $theme;
+ if ($theme->status) {
+ $user_list[$theme->name] = $theme;
+ }
}
}
}
- return $list;
+ return ($user_only ? $list : $user_list);
}
/**
Index: modules/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system.module,v
retrieving revision 1.225
diff -u -F^f -r1.225 system.module
--- modules/system.module 18 Aug 2005 22:07:13 -0000 1.225
+++ modules/system.module 20 Aug 2005 04:43:46 -0000
@@ -93,7 +93,7 @@ function system_menu($may_cache) {
foreach (list_themes() as $theme) {
$items[] = array('path' => 'admin/themes/settings/'. $theme->name, 'title' => $theme->name,
'callback' => 'system_theme_settings', 'callback arguments' => array($theme->name), 'access' => $access,
- 'type' => MENU_LOCAL_TASK);
+ 'type' => ($theme->status ? MENU_LOCAL_TASK : MENU_CALLBACK));
}
// Modules:
@@ -126,7 +126,7 @@ function system_test() {
*/
function system_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') {
- $themes = list_themes();
+ $themes = list_themes(FALSE, TRUE);
ksort($themes);
if (count($themes) > 1) {
@@ -475,7 +475,7 @@ function system_theme_listing() {
// Information field.
$row[] = "$info->name
" . dirname($info->filename) . '';
- // enabled, default, and operations columns
+ // user-selectable, default, and operations columns
$row[] = array('data' => form_checkbox('', 'status]['. $info->name, 1, $info->status), 'align' => 'center');
$row[] = array('data' => form_radio('', 'theme_default', $info->name, (variable_get('theme_default', 'bluemarine') == $info->name) ? 1 : 0), 'align' => 'center');
if ($info->status && (function_exists($info->prefix . '_settings') || function_exists($info->prefix . '_features'))) {
@@ -487,7 +487,7 @@ function system_theme_listing() {
$rows[] = $row;
}
- $header = array(t('Screenshot'), t('Name'), t('Enabled'), t('Default'), t('Operations'));
+ $header = array(t('Screenshot'), t('Name'), t('User-selectable'), t('Default'), t('Operations'));
$output = form_hidden('type', 'theme');
$output .= theme('table', $header, $rows);
return $output;
@@ -552,7 +552,7 @@ function system_listing_save($edit = arr
if ($op == t('Save configuration')) {
db_query("UPDATE {system} SET status = 0 WHERE type = '%s'", $edit['type']);
foreach ($edit['status'] as $name => $status) {
- // Make certain that the default theme is enabled to avoid user error
+ // Make certain that the default theme is user-selectable to avoid user error
if (($edit['type'] == 'theme') && ($edit['theme_default'] == $name)) {
$status = 1;
}