1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-08 17:56:52 +02:00

say hello to role descriptions, role ordering and tooltips on role selects

git-svn-id: file:///svn/phpbb/trunk@5791 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2006-04-17 22:36:43 +00:00
parent a0f8e1323a
commit 8d456a0fd7
20 changed files with 369 additions and 33 deletions

View File

@@ -150,6 +150,7 @@ class acp_permission_roles
case 'add':
$role_name = request_var('role_name', '', true);
$role_description = request_var('role_description', '', true);
$role_group_ids = request_var('role_group_ids', array(0));
$pre_select = request_var('pre_select', 'custom');
$auth_settings = request_var('setting', array('' => 0));
@@ -275,6 +276,7 @@ class acp_permission_roles
$sql_ary = array(
'role_name' => (string) $role_name,
'role_description' => (string) $role_description,
'role_type' => (string) $permission_type,
'role_group_ids' => (string) implode(':', $role_group_ids),
);
@@ -288,6 +290,16 @@ class acp_permission_roles
}
else
{
// Get maximum role order for inserting a new role...
$sql = 'SELECT MAX(role_order) as max_order
FROM ' . ACL_ROLES_TABLE . "
WHERE role_type = '" . $db->sql_escape($permission_type) . "'";
$result = $db->sql_query($sql);
$max_order = (int) $db->sql_fetchfield('max_order');
$db->sql_freeresult($result);
$sql_ary['role_order'] = $max_order + 1;
$sql = 'INSERT INTO ' . ACL_ROLES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);
@@ -302,6 +314,7 @@ class acp_permission_roles
trigger_error($user->lang['ROLE_' . strtoupper($action) . '_SUCCESS'] . adm_back_link($this->u_action));
break;
}
}
@@ -314,6 +327,7 @@ class acp_permission_roles
$role_row = array(
'role_name' => request_var('role_name', '', true),
'role_description' => request_var('role_description', '', true),
'role_type' => $permission_type,
'role_group_ids' => implode(':', request_var('role_group_ids', array(0))),
);
@@ -400,6 +414,7 @@ class acp_permission_roles
'U_BACK' => $this->u_action,
'ROLE_NAME' => $role_row['role_name'],
'ROLE_DESCRIPTION' => $role_row['role_description'],
'L_ACL_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)],
)
);
@@ -445,13 +460,49 @@ class acp_permission_roles
return;
break;
case 'move_up':
case 'move_down':
$order = request_var('order', 0);
$order_total = $order * 2 + (($action == 'move_up') ? -1 : 1);
$sql = 'UPDATE ' . ACL_ROLES_TABLE . '
SET role_order = ' . $order_total . " - role_order
WHERE role_type = '" . $db->sql_escape($permission_type) . "'
AND role_order IN ($order, " . (($action == 'move_up') ? $order - 1 : $order + 1) . ')';
$db->sql_query($sql);
break;
}
// By default, check that image_order is valid and fix it if necessary
$sql = 'SELECT role_id, role_order
FROM ' . ACL_ROLES_TABLE . "
WHERE role_type = '" . $db->sql_escape($permission_type) . "'
ORDER BY role_order";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$order = 0;
do
{
$order++;
if ($row['role_order'] != $order)
{
$db->sql_query('UPDATE ' . ACL_ROLES_TABLE . " SET role_order = $order WHERE role_id = {$row['role_id']}");
}
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
// Select existing roles
$sql = 'SELECT *
FROM ' . ACL_ROLES_TABLE . "
WHERE role_type = '" . $db->sql_escape($permission_type) . "'
ORDER BY role_name ASC";
ORDER BY role_order ASC";
$result = $db->sql_query($sql);
$roles = $groups = $group_ids = $group_info = array();
@@ -490,12 +541,15 @@ class acp_permission_roles
foreach ($roles as $row)
{
$template->assign_block_vars('roles', array(
'NAME' => $row['role_name'],
'ROLE_NAME' => $row['role_name'],
'ROLE_DESCRIPTION' => nl2br($row['role_description']),
'S_GROUP' => ($row['role_group_ids']) ? true : false,
'U_EDIT' => $this->u_action . '&action=edit&role_id=' . $row['role_id'],
'U_REMOVE' => $this->u_action . '&action=remove&role_id=' . $row['role_id'],
'U_MOVE_UP' => $this->u_action . '&action=move_up&order=' . $row['role_order'],
'U_MOVE_DOWN' => $this->u_action . '&action=move_down&order=' . $row['role_order'],
'U_DISPLAY_ITEMS' => ($row['role_id'] == $display_item) ? '' : $this->u_action . '&display_item=' . $row['role_id'] . '#assigned_to')
);

View File

@@ -285,7 +285,8 @@ class auth_admin extends auth
// Get available roles
$sql = 'SELECT *
FROM ' . ACL_ROLES_TABLE . "
WHERE role_type = '" . $db->sql_escape($permission_type) . "'";
WHERE role_type = '" . $db->sql_escape($permission_type) . "'
ORDER BY role_order ASC";
$result = $db->sql_query($sql);
$roles = array();
@@ -413,7 +414,8 @@ class auth_admin extends auth
{
if ($role_id == $current_role_id || !sizeof($role_row['groups']) || ($user_mode == 'group' && in_array($ug_id, $role_row['groups'])))
{
$s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . '>' . $role_row['role_name'] . '</option>';
$title = ($role_row['role_description']) ? ' title="' . nl2br($role_row['role_description']) . '"' : '';
$s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_row['role_name'] . '</option>';
}
}

View File

@@ -833,7 +833,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
'U_POST_ID' => $row['post_id'],
'U_MINI_POST' => "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;p=" . $row['post_id'] . '#p' . $row['post_id'],
'U_MCP_DETAILS' => ($auth->acl_get('m_', $forum_id)) ? "{$phpbb_root_path}mcp.$phpEx$SID&amp;mode=post_details&amp;p=" . $row['post_id'] : '',
'U_MCP_DETAILS' => ($auth->acl_get('m_info', $forum_id)) ? "{$phpbb_root_path}mcp.$phpEx$SID&amp;mode=post_details&amp;p=" . $row['post_id'] : '',
'U_QUOTE' => ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) ? 'javascript:addquote(' . $row['post_id'] . ", '" . str_replace("'", "\\'", $poster) . "')" : '')
);
unset($rowset[$i]);

View File

@@ -106,7 +106,7 @@ class mcp_queue
$template->assign_vars(array(
'S_MCP_QUEUE' => true,
'S_APPROVE_ACTION' => "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=queue&amp;p=$post_id&amp;f=$forum_id",
'S_CAN_VIEWIP' => $auth->acl_get('m_ip', $post_info['forum_id']),
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
'S_POST_REPORTED' => $post_info['post_reported'],
'S_POST_UNAPPROVED' => !$post_info['post_approved'],
'S_POST_LOCKED' => $post_info['post_edit_locked'],

View File

@@ -113,7 +113,7 @@ class mcp_reports
$template->assign_vars(array(
'S_MCP_REPORT' => true,
'S_CLOSE_ACTION' => "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=reports&amp;p=$post_id&amp;f=$forum_id",
'S_CAN_VIEWIP' => $auth->acl_get('m_ip', $post_info['forum_id']),
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
'S_POST_REPORTED' => $post_info['post_reported'],
'S_POST_UNAPPROVED' => !$post_info['post_approved'],
'S_POST_LOCKED' => $post_info['post_edit_locked'],

View File

@@ -187,7 +187,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
'SIGNATURE' => ($message_row['enable_sig']) ? $signature : '',
'EDITED_MESSAGE' => $l_edited_by,
'U_INFO' => ($auth->acl_get('m_') && $message_row['forwarded']) ? "{$phpbb_root_path}mcp.$phpEx$SID&amp;mode=pm_details&amp;p=" . $message_row['msg_id'] : '',
'U_INFO' => ($auth->acl_get('m_info') && $message_row['forwarded']) ? "{$phpbb_root_path}mcp.$phpEx$SID&amp;mode=pm_details&amp;p=" . $message_row['msg_id'] : '',
'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&amp;mode=compose&amp;action=delete&amp;f=$folder_id&amp;p=" . $message_row['msg_id'] : '',
'U_AUTHOR_PROFILE' => "{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $author_id,
'U_EMAIL' => $user_info['email'],