diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-09-30 21:48:32 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-09-30 21:48:32 +0000 |
commit | 392304da5f4a6f86d8ab8b5f91d38a698d1dcc88 (patch) | |
tree | 9f314e3b0d3545219e4b11ad91ba93414ace489f | |
parent | 6baa7d7c218549f898366b60cc4257c010efee71 (diff) | |
download | brdo-392304da5f4a6f86d8ab8b5f91d38a698d1dcc88.tar.gz brdo-392304da5f4a6f86d8ab8b5f91d38a698d1dcc88.tar.bz2 |
- Moved the locale settings from the user module to the locale module.
Patch by Stefan.
- Moved the theme settings from the user module to the system module and
made the code more intelligent. Patch by Stefan.
-rw-r--r-- | modules/locale.module | 8 | ||||
-rw-r--r-- | modules/locale/locale.module | 8 | ||||
-rw-r--r-- | modules/system.module | 16 | ||||
-rw-r--r-- | modules/system/system.module | 16 | ||||
-rw-r--r-- | modules/user.module | 18 | ||||
-rw-r--r-- | modules/user/user.module | 18 |
6 files changed, 60 insertions, 24 deletions
diff --git a/modules/locale.module b/modules/locale.module index 588f860e0..f6e8851e2 100644 --- a/modules/locale.module +++ b/modules/locale.module @@ -87,6 +87,14 @@ function locale_link($type) { } } +function locale_user($type, &$edit, &$user) { + global $languages; + if ($type == "edit_form" && count($languages) > 1) { + $output = form_select(t("Language"), "language", $user->language, $languages, t("Selecting a different language will change the language of the site.")); + } + return $output; +} + function locale_delete($lid) { db_query("DELETE FROM {locales} WHERE lid = %d", $lid); locale_refresh_cache(); diff --git a/modules/locale/locale.module b/modules/locale/locale.module index 588f860e0..f6e8851e2 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -87,6 +87,14 @@ function locale_link($type) { } } +function locale_user($type, &$edit, &$user) { + global $languages; + if ($type == "edit_form" && count($languages) > 1) { + $output = form_select(t("Language"), "language", $user->language, $languages, t("Selecting a different language will change the language of the site.")); + } + return $output; +} + function locale_delete($lid) { db_query("DELETE FROM {locales} WHERE lid = %d", $lid); locale_refresh_cache(); diff --git a/modules/system.module b/modules/system.module index cd25b0d79..ef465d1d7 100644 --- a/modules/system.module +++ b/modules/system.module @@ -84,6 +84,22 @@ function system_link($type) { } } +function system_user($type, &$edit, $user) { + $options = "<option value=\"\"". (("" == $key) ? " selected=\"selected\"" : "") .">". t("Default theme") ."</option>\n"; + if ($type == "edit_form" && count($themes = theme_list()) > 1) { + foreach ($themes as $key => $value) { + $options .= "<option value=\"$key\"". (($edit["theme"] == $key) ? " selected=\"selected\"" : "") .">$key - $value->description</option>\n"; + } + $output .= form_item(t("Theme"), "<select name=\"edit[theme]\">$options</select>", t("Selecting a different theme will change the look and feel of the site.")); + } + if ($type == "edit_form") { + for ($zone = -43200; $zone <= 46800; $zone += 3600) $zones[$zone] = date(variable_get("date_format_long", "l, F dS, Y - g:ia"), time() - date("Z") + $zone) ." (GMT ". $zone / 3600 .")"; + $output .= form_select(t("Time zone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your time zone settings will be set appropriate.")); + } + + return $output; +} + function system_view_general() { global $conf, $cmodes, $corder; diff --git a/modules/system/system.module b/modules/system/system.module index cd25b0d79..ef465d1d7 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -84,6 +84,22 @@ function system_link($type) { } } +function system_user($type, &$edit, $user) { + $options = "<option value=\"\"". (("" == $key) ? " selected=\"selected\"" : "") .">". t("Default theme") ."</option>\n"; + if ($type == "edit_form" && count($themes = theme_list()) > 1) { + foreach ($themes as $key => $value) { + $options .= "<option value=\"$key\"". (($edit["theme"] == $key) ? " selected=\"selected\"" : "") .">$key - $value->description</option>\n"; + } + $output .= form_item(t("Theme"), "<select name=\"edit[theme]\">$options</select>", t("Selecting a different theme will change the look and feel of the site.")); + } + if ($type == "edit_form") { + for ($zone = -43200; $zone <= 46800; $zone += 3600) $zones[$zone] = date(variable_get("date_format_long", "l, F dS, Y - g:ia"), time() - date("Z") + $zone) ." (GMT ". $zone / 3600 .")"; + $output .= form_select(t("Time zone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your time zone settings will be set appropriate.")); + } + + return $output; +} + function system_view_general() { global $conf, $cmodes, $corder; diff --git a/modules/user.module b/modules/user.module index 2b739f1e6..d3bd79d35 100644 --- a/modules/user.module +++ b/modules/user.module @@ -454,8 +454,11 @@ function user_block($op = "list", $delta = 0) { } return $block; case 1: - $block["subject"] = $user->uid ? $user->name : t("Navigation"); - $block["content"] = "<div id=\"menu\">". menu_tree() ."</div>"; + if ($menu = menu_tree()) { + $block["subject"] = $user->uid ? $user->name : t("Navigation"); + $block["content"] = "<div id=\"menu\">". $menu ."</div>"; + } + return $block; case 2: if (user_access("access content")) { @@ -975,7 +978,7 @@ function user_delete() { } function user_edit($edit = array()) { - global $user, $languages; + global $user; if ($user->uid) { if ($edit["name"]) { @@ -1065,15 +1068,6 @@ function user_edit($edit = array()) { $output .= implode("\n", module_invoke_all ("user", "edit_form", $edit, $user)); - $options = "<option value=\"\"". (("" == $key) ? " selected=\"selected\"" : "") .">". t("Default theme") ."</option>\n"; - foreach (theme_list() as $key => $value) { - $options .= "<option value=\"$key\"". (($edit["theme"] == $key) ? " selected=\"selected\"" : "") .">$key - $value->description</option>\n"; - } - - $output .= form_item(t("Theme"), "<select name=\"edit[theme]\">$options</select>", t("Selecting a different theme will change the look and feel of the site.")); - for ($zone = -43200; $zone <= 46800; $zone += 3600) $zones[$zone] = date(variable_get("date_format_long", "l, F dS, Y - g:ia"), time() - date("Z") + $zone) ." (GMT ". $zone / 3600 .")"; - $output .= form_select(t("Time zone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your time zone settings will be set appropriate.")); - $output .= form_select(t("Language"), "language", $edit["language"], $languages, t("Selecting a different language will change the language of the site.")); $output .= form_item(t("Password"), "<input type=\"password\" name=\"edit[pass1]\" size=\"12\" maxlength=\"24\" /> <input type=\"password\" name=\"edit[pass2]\" size=\"12\" maxlength=\"24\" />", t("Enter your new password twice if you want to change your current password or leave it blank if you are happy with your current password.")); $output .= form_submit(t("Save user information")); diff --git a/modules/user/user.module b/modules/user/user.module index 2b739f1e6..d3bd79d35 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -454,8 +454,11 @@ function user_block($op = "list", $delta = 0) { } return $block; case 1: - $block["subject"] = $user->uid ? $user->name : t("Navigation"); - $block["content"] = "<div id=\"menu\">". menu_tree() ."</div>"; + if ($menu = menu_tree()) { + $block["subject"] = $user->uid ? $user->name : t("Navigation"); + $block["content"] = "<div id=\"menu\">". $menu ."</div>"; + } + return $block; case 2: if (user_access("access content")) { @@ -975,7 +978,7 @@ function user_delete() { } function user_edit($edit = array()) { - global $user, $languages; + global $user; if ($user->uid) { if ($edit["name"]) { @@ -1065,15 +1068,6 @@ function user_edit($edit = array()) { $output .= implode("\n", module_invoke_all ("user", "edit_form", $edit, $user)); - $options = "<option value=\"\"". (("" == $key) ? " selected=\"selected\"" : "") .">". t("Default theme") ."</option>\n"; - foreach (theme_list() as $key => $value) { - $options .= "<option value=\"$key\"". (($edit["theme"] == $key) ? " selected=\"selected\"" : "") .">$key - $value->description</option>\n"; - } - - $output .= form_item(t("Theme"), "<select name=\"edit[theme]\">$options</select>", t("Selecting a different theme will change the look and feel of the site.")); - for ($zone = -43200; $zone <= 46800; $zone += 3600) $zones[$zone] = date(variable_get("date_format_long", "l, F dS, Y - g:ia"), time() - date("Z") + $zone) ." (GMT ". $zone / 3600 .")"; - $output .= form_select(t("Time zone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your time zone settings will be set appropriate.")); - $output .= form_select(t("Language"), "language", $edit["language"], $languages, t("Selecting a different language will change the language of the site.")); $output .= form_item(t("Password"), "<input type=\"password\" name=\"edit[pass1]\" size=\"12\" maxlength=\"24\" /> <input type=\"password\" name=\"edit[pass2]\" size=\"12\" maxlength=\"24\" />", t("Enter your new password twice if you want to change your current password or leave it blank if you are happy with your current password.")); $output .= form_submit(t("Save user information")); |