summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-11-20 22:10:42 +0000
committerDries Buytaert <dries@buytaert.net>2003-11-20 22:10:42 +0000
commite128d493ee5544b1b09213b7d421b17d95db2e96 (patch)
tree9c7daa676de1aebc2852f56db939fc8e08080042 /modules
parent4bdac4333ba34adc61e19180b5f1bcde692615e2 (diff)
downloadbrdo-e128d493ee5544b1b09213b7d421b17d95db2e96.tar.gz
brdo-e128d493ee5544b1b09213b7d421b17d95db2e96.tar.bz2
- Improved theme configuration page. Modified version of Adrian.
Diffstat (limited to 'modules')
-rw-r--r--modules/system.module34
-rw-r--r--modules/system/system.module34
2 files changed, 40 insertions, 28 deletions
diff --git a/modules/system.module b/modules/system.module
index 8e6f3bf4c..32149bc28 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -294,7 +294,12 @@ function system_listing($type, $directory, $required = array()) {
ksort($files);
- $header = array(t("name"), t("description"), t("status"));
+ if ($type == "module") {
+ $header = array(t("name"), t("description"), t("status"));
+ }
+ else {
+ $header = array(t("name"), t("description"), t("enable"), t("default"));
+ }
foreach ($files as $filename => $file) {
include_once($filename);
@@ -311,27 +316,28 @@ function system_listing($type, $directory, $required = array()) {
}
}
elseif ($type == "theme") {
- $info->name = $file->name;
- $info->description = module_invoke($file->name, "help", "admin/system/themes#description");
- $themes[] = $info->name;
+ $info->name = $file->name;
+ $info->description = module_invoke($file->name, "help", "admin/system/themes#description");
+ $themes[] = $info->name;
+
+ // Enable the default theme:
+ if ($info->name == variable_get("theme_default", 0)) {
+ $file->status = 1;
+ }
}
// Update the contents of the system table:
db_query("DELETE FROM {system} WHERE filename = '%s' AND type = '%s'", $filename, $type);
db_query("INSERT INTO {system} (name, description, type, filename, status, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d)", $info->name, $info->description, $type, $filename, $file->status, $bootstrap);
- $rows[] = array($info->name, $info->description, array("data" => (in_array($filename, $required) ? form_hidden("status][$filename", 1) . t("required") : form_checkbox("", "status][$filename", 1, $file->status)), "align" => "center"));
+ $row = array($info->name, $info->description, array("data" => (in_array($filename, $required) ? form_hidden("status][$filename", 1) . t("required") : form_checkbox("", "status][$filename", 1, $file->status)), "align" => "center"));
+ if ($type == "theme") {
+ $row[] = array("data" => form_radio("","theme_default",$info->name,(variable_get("theme_default",0) == $info->name) ? 1 : 0), "align" => "center");
+ }
+ $rows[] = $row;
}
- $output = theme("table", $header, $rows);
-
- // If we're doing themes, stick the default one here...
- if ($type == "theme") {
- $output .= "<hr />\n";
- foreach ($themes as $theme)
- $options .= "<option value=\"$theme\"". (variable_get("theme_default", 0) == $theme ? " selected=\"selected\"" : "") .">$theme</option>\n";
- $output .= form_item(t("Default theme"), "<select name=\"edit[theme_default]\">$options</select>", t("The default theme as seen by visitors or anonymous users. Make sure a valid theme is selected here (i.e. one that has its box checked above.)"));
- }
+ $output = theme("table", $header, $rows);
$output .= form_hidden("type", $type);
return $output;
diff --git a/modules/system/system.module b/modules/system/system.module
index 8e6f3bf4c..32149bc28 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -294,7 +294,12 @@ function system_listing($type, $directory, $required = array()) {
ksort($files);
- $header = array(t("name"), t("description"), t("status"));
+ if ($type == "module") {
+ $header = array(t("name"), t("description"), t("status"));
+ }
+ else {
+ $header = array(t("name"), t("description"), t("enable"), t("default"));
+ }
foreach ($files as $filename => $file) {
include_once($filename);
@@ -311,27 +316,28 @@ function system_listing($type, $directory, $required = array()) {
}
}
elseif ($type == "theme") {
- $info->name = $file->name;
- $info->description = module_invoke($file->name, "help", "admin/system/themes#description");
- $themes[] = $info->name;
+ $info->name = $file->name;
+ $info->description = module_invoke($file->name, "help", "admin/system/themes#description");
+ $themes[] = $info->name;
+
+ // Enable the default theme:
+ if ($info->name == variable_get("theme_default", 0)) {
+ $file->status = 1;
+ }
}
// Update the contents of the system table:
db_query("DELETE FROM {system} WHERE filename = '%s' AND type = '%s'", $filename, $type);
db_query("INSERT INTO {system} (name, description, type, filename, status, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d)", $info->name, $info->description, $type, $filename, $file->status, $bootstrap);
- $rows[] = array($info->name, $info->description, array("data" => (in_array($filename, $required) ? form_hidden("status][$filename", 1) . t("required") : form_checkbox("", "status][$filename", 1, $file->status)), "align" => "center"));
+ $row = array($info->name, $info->description, array("data" => (in_array($filename, $required) ? form_hidden("status][$filename", 1) . t("required") : form_checkbox("", "status][$filename", 1, $file->status)), "align" => "center"));
+ if ($type == "theme") {
+ $row[] = array("data" => form_radio("","theme_default",$info->name,(variable_get("theme_default",0) == $info->name) ? 1 : 0), "align" => "center");
+ }
+ $rows[] = $row;
}
- $output = theme("table", $header, $rows);
-
- // If we're doing themes, stick the default one here...
- if ($type == "theme") {
- $output .= "<hr />\n";
- foreach ($themes as $theme)
- $options .= "<option value=\"$theme\"". (variable_get("theme_default", 0) == $theme ? " selected=\"selected\"" : "") .">$theme</option>\n";
- $output .= form_item(t("Default theme"), "<select name=\"edit[theme_default]\">$options</select>", t("The default theme as seen by visitors or anonymous users. Make sure a valid theme is selected here (i.e. one that has its box checked above.)"));
- }
+ $output = theme("table", $header, $rows);
$output .= form_hidden("type", $type);
return $output;