From 74d315b34a31fb1046e8688b79599c67d0d12d6e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 29 Dec 2002 13:46:30 +0000 Subject: - Usability improvement: made the remaining user administration pages use the new table rendering functions; access rule table, permission table, role table, etc. - Usability improvement: made the permission table translatable. Requested by Stefan. - Code improvement: removed some redundant check_output()s. --- modules/user.module | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'modules/user.module') diff --git a/modules/user.module b/modules/user.module index cb1c44949..dbb25ef73 100644 --- a/modules/user.module +++ b/modules/user.module @@ -1186,23 +1186,24 @@ function user_admin_access($edit = array()) { db_query("DELETE FROM access WHERE aid = '%s'", $id); } - $output .= ""; - $output .= " "; + $header = array(t("type"), t("mask"), t("operations")); $result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '1' ORDER BY mask", $type); while ($rule = db_fetch_object($result)) { - $output .= ""; + $rows[] = array(t("Allow"), $rule->mask, array("data" => la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)), "align" => "center")); } $result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '0' ORDER BY mask", $type); while ($rule = db_fetch_object($result)) { - $output .= ""; + $rows[] = array(t("Deny"), $rule->mask, la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid))); } - $output .= " "; - $output .= "
" . t("type") . "" . t("mask") . "" . t("operations") . "
" . t("Allow") . "". check_output($rule->mask) ."". la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)) ."
" . t("Deny") . "". check_output($rule->mask) ."". la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)). "
"; + $rows[] = array("", "", ""); + + $output .= table($header, $rows); + $output .= "

%: " . t("Matches any number of characters, even zero characters") . ".
_: " . t("Matches exactly one character.") . "

"; if ($type != "user") { @@ -1273,7 +1274,7 @@ function user_admin_perm($edit = array()) { } $result = db_query("SELECT rid, name FROM role ORDER BY name"); - $role_names = array (); + $role_names = array(); while ($role = db_fetch_object($result)) { $role_names[$role->rid] = $role->name; } @@ -1282,22 +1283,22 @@ function user_admin_perm($edit = array()) { ** Render roles / permission overview: */ - $output .= ""; - $output .= " "; + $header = array_merge(array(" "), $role_names); + foreach ($perms as $perm) { - $output .= " "; - $output .= " "; + $row[] = t($perm); foreach ($role_names as $rid => $name) { - $output .= " "; + $row[] = ""; } - $output .= " "; + $rows[] = $row; + unset($row); } - $output .= "
 ". implode("", array_values($role_names)) ."
". check_output($perm) ."
"; + + $output = table($header, $rows); $output .= form_hidden("tid", $tid); $output .= form_submit(t("Save permissions")); return form($output); - } function user_admin_role($edit = array()) { @@ -1334,14 +1335,13 @@ function user_admin_role($edit = array()) { $result = db_query("SELECT * FROM role ORDER BY name"); - $output .= ""; - $output .= " "; + $header = array(t("name"), t("operations")); while ($role = db_fetch_object($result)) { - $output .= ""; + $rows[] = array($role->name, array("data" => la(t("edit role"), array("mod" => "user", "op" => "role", "id" => $role->rid)), "align" => "center")); } - $output .= " "; - $output .= "
" . t("name") . "" . t("operations") . "
". check_output($role->name) ."". la(t("edit role"), array("mod" => "user", "op" => "role", "id" => $role->rid)) ."
"; + $rows[] = array("", ""); + $output = table($header, $rows); $output = form($output); } -- cgit v1.2.3