Commit e28bbf67 authored by Dries's avatar Dries

- 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.
parent 5a8129e0
......@@ -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);
......
......@@ -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);
......
......@@ -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."));
......
......@@ -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."));
......
......@@ -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() {
......
......@@ -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() {
......
......@@ -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"));
......
......@@ -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"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment