diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-02-07 16:59:34 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-02-07 16:59:34 +0000 |
commit | e28bbf67397166b7256150301a1c4e931ea8314b (patch) | |
tree | d632581c73f3409a9efe92037b48ae5bdca525e4 | |
parent | 5a8129e0fbf762c9dc6891d574dac386e959c262 (diff) | |
download | brdo-e28bbf67397166b7256150301a1c4e931ea8314b.tar.gz brdo-e28bbf67397166b7256150301a1c4e931ea8314b.tar.bz2 |
- Batch two with profile module improvements:
+ Reworked the 'account administration' page.
+ Fixed bug in the 'edit account' page.
+ Removed some dead code from the system.module.
-rw-r--r-- | modules/block.module | 2 | ||||
-rw-r--r-- | modules/block/block.module | 2 | ||||
-rw-r--r-- | modules/profile.module | 2 | ||||
-rw-r--r-- | modules/profile/profile.module | 2 | ||||
-rw-r--r-- | modules/system.module | 10 | ||||
-rw-r--r-- | modules/system/system.module | 10 | ||||
-rw-r--r-- | modules/user.module | 14 | ||||
-rw-r--r-- | modules/user/user.module | 14 |
8 files changed, 30 insertions, 26 deletions
diff --git a/modules/block.module b/modules/block.module index d18c84b15..b89075f4a 100644 --- a/modules/block.module +++ b/modules/block.module @@ -321,7 +321,7 @@ function block_admin() { } } -function block_user($type, &$edit, &$user) { +function block_user($type, $edit, &$user) { switch ($type) { case "edit_form": $result = db_query("SELECT * FROM {blocks} WHERE custom = %d ORDER BY module, delta", 1); diff --git a/modules/block/block.module b/modules/block/block.module index d18c84b15..b89075f4a 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -321,7 +321,7 @@ function block_admin() { } } -function block_user($type, &$edit, &$user) { +function block_user($type, $edit, &$user) { switch ($type) { case "edit_form": $result = db_query("SELECT * FROM {blocks} WHERE custom = %d ORDER BY module, delta", 1); diff --git a/modules/profile.module b/modules/profile.module index d74b75e12..638332016 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -75,7 +75,7 @@ function profile_settings() { $row[$i][] = form_checkbox("", "profile_required_fields][", $key, in_array($key, $profile_required_fields)); $i++; } - + $avatar = form_textfield(t("Avatar image path"), "profile_avatar_path", variable_get("profile_avatar_path", "avatars"), 30, 255, t("Subdirectory in the directory '%dir' where avatars will be stored.", array('%dir' => variable_get('file_directory_path', 'files') . FILE_SEPARATOR)) . $error['profile_avatar_path']); $avatar .= form_textfield(t("Avatar maximum dimensions"), "profile_avatar_dimensions", variable_get("profile_avatar_dimensions", "85x85"), 10, 10, t("Maximum dimensions for avatars.")); $avatar .= form_textfield(t("Avatar maximum file size"), "profile_avatar_file_size", variable_get("profile_avatar_file_size", "30"), 10, 10, t("Maximum file size for avatars, in kB.")); diff --git a/modules/profile/profile.module b/modules/profile/profile.module index d74b75e12..638332016 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -75,7 +75,7 @@ function profile_settings() { $row[$i][] = form_checkbox("", "profile_required_fields][", $key, in_array($key, $profile_required_fields)); $i++; } - + $avatar = form_textfield(t("Avatar image path"), "profile_avatar_path", variable_get("profile_avatar_path", "avatars"), 30, 255, t("Subdirectory in the directory '%dir' where avatars will be stored.", array('%dir' => variable_get('file_directory_path', 'files') . FILE_SEPARATOR)) . $error['profile_avatar_path']); $avatar .= form_textfield(t("Avatar maximum dimensions"), "profile_avatar_dimensions", variable_get("profile_avatar_dimensions", "85x85"), 10, 10, t("Maximum dimensions for avatars.")); $avatar .= form_textfield(t("Avatar maximum file size"), "profile_avatar_file_size", variable_get("profile_avatar_file_size", "30"), 10, 10, t("Maximum file size for avatars, in kB.")); diff --git a/modules/system.module b/modules/system.module index ea5e703b8..cf1d72d5c 100644 --- a/modules/system.module +++ b/modules/system.module @@ -76,9 +76,9 @@ function system_link($type) { } } -function system_user($type, &$edit, $user) { +function system_user($type, $edit, &$user) { if ($type == "edit_form") { - $options = "<option value=\"\"". (("" == $key) ? " selected=\"selected\"" : "") .">". t("Default theme") ."</option>\n"; + $options = "<option value=\"\">". t("Default theme") ."</option>\n"; if (count($themes = list_themes()) > 1) { foreach ($themes as $key => $value) { $options .= "<option value=\"$key\"". (($edit["theme"] == $key) ? " selected=\"selected\"" : "") .">$key - $value->description</option>\n"; @@ -92,9 +92,11 @@ function system_user($type, &$edit, $user) { $zones["$zone"] = date(variable_get("date_format_long", "l, F dS, Y - g:ia"), time() - date("Z") + $zone) . sprintf(" (GMT %s%02d:%02d)\n", ($offset >= 0) ? "+" : "-", floor(abs($offset)), (abs($offset) * 60) % 60); } $data[t('Locale settings')] = 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 $data; + } + else { + return $edit; } - - return $data; } function system_view_general() { diff --git a/modules/system/system.module b/modules/system/system.module index ea5e703b8..cf1d72d5c 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -76,9 +76,9 @@ function system_link($type) { } } -function system_user($type, &$edit, $user) { +function system_user($type, $edit, &$user) { if ($type == "edit_form") { - $options = "<option value=\"\"". (("" == $key) ? " selected=\"selected\"" : "") .">". t("Default theme") ."</option>\n"; + $options = "<option value=\"\">". t("Default theme") ."</option>\n"; if (count($themes = list_themes()) > 1) { foreach ($themes as $key => $value) { $options .= "<option value=\"$key\"". (($edit["theme"] == $key) ? " selected=\"selected\"" : "") .">$key - $value->description</option>\n"; @@ -92,9 +92,11 @@ function system_user($type, &$edit, $user) { $zones["$zone"] = date(variable_get("date_format_long", "l, F dS, Y - g:ia"), time() - date("Z") + $zone) . sprintf(" (GMT %s%02d:%02d)\n", ($offset >= 0) ? "+" : "-", floor(abs($offset)), (abs($offset) * 60) % 60); } $data[t('Locale settings')] = 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 $data; + } + else { + return $edit; } - - return $data; } function system_view_general() { diff --git a/modules/user.module b/modules/user.module index a46fe3809..75eca8a87 100644 --- a/modules/user.module +++ b/modules/user.module @@ -951,7 +951,7 @@ function user_edit($edit = array()) { $output .= form_textfield(t("E-mail address"), "mail", $edit['mail'], 30, 55, t("Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.")); $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_group(t('Account information'), $output); - $output .= _user_settings(); + $output .= _user_profile($user); $output .= form_submit(t("Save user information")); $output = form($output, "post", 0, array("enctype" => "multipart/form-data")); @@ -964,10 +964,10 @@ function user_edit($edit = array()) { return $output; } -function _user_settings($style = 'edit_form') { +function _user_profile($account) { foreach (module_list() as $module) { - if ($data = module_invoke($module, 'user', $style, $edit, $user)) { + if ($data = module_invoke($module, 'user', 'edit_form', $edit, $account)) { foreach ($data as $title => $form) { $groups[$title] .= $form; } @@ -1433,13 +1433,13 @@ function user_admin_edit($edit = array()) { $output .= form_item(t("User ID"), $account->uid); $output .= form_textfield(t("Username"), 'name', $account->name, 30, 55, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $account->mail, 30, 55, t("Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.")); - - $output .= implode("\n", module_invoke_all('user', "edit_form", $edit, $account)); - $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 a new password twice if you want to change the current password for this user or leave it blank if you are happy with the current password.")); - $output .= form_radios(t("Status"), "status", $account->status, array(t("blocked"), t("active"))); + $output .= form_radios(t("Status"), "status", $account->status, array(t("Blocked"), t("Active"))); $output .= form_radios(t("Role"), "rid", $account->rid, user_roles(1)); + $output = form_group(t('Account information'), $output); + $output .= _user_profile($account); + $output .= form_submit(t("Save account")); $output .= form_submit(t("Delete account")); diff --git a/modules/user/user.module b/modules/user/user.module index a46fe3809..75eca8a87 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -951,7 +951,7 @@ function user_edit($edit = array()) { $output .= form_textfield(t("E-mail address"), "mail", $edit['mail'], 30, 55, t("Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.")); $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_group(t('Account information'), $output); - $output .= _user_settings(); + $output .= _user_profile($user); $output .= form_submit(t("Save user information")); $output = form($output, "post", 0, array("enctype" => "multipart/form-data")); @@ -964,10 +964,10 @@ function user_edit($edit = array()) { return $output; } -function _user_settings($style = 'edit_form') { +function _user_profile($account) { foreach (module_list() as $module) { - if ($data = module_invoke($module, 'user', $style, $edit, $user)) { + if ($data = module_invoke($module, 'user', 'edit_form', $edit, $account)) { foreach ($data as $title => $form) { $groups[$title] .= $form; } @@ -1433,13 +1433,13 @@ function user_admin_edit($edit = array()) { $output .= form_item(t("User ID"), $account->uid); $output .= form_textfield(t("Username"), 'name', $account->name, 30, 55, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $account->mail, 30, 55, t("Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.")); - - $output .= implode("\n", module_invoke_all('user', "edit_form", $edit, $account)); - $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 a new password twice if you want to change the current password for this user or leave it blank if you are happy with the current password.")); - $output .= form_radios(t("Status"), "status", $account->status, array(t("blocked"), t("active"))); + $output .= form_radios(t("Status"), "status", $account->status, array(t("Blocked"), t("Active"))); $output .= form_radios(t("Role"), "rid", $account->rid, user_roles(1)); + $output = form_group(t('Account information'), $output); + $output .= _user_profile($account); + $output .= form_submit(t("Save account")); $output .= form_submit(t("Delete account")); |