Navigation Menu

Skip to content

Commit

Permalink
Bug 703: Authorization system in Cat management works now with well o…
Browse files Browse the repository at this point in the history
…rdered lists

(Minor: Admin theme changes)

git-svn-id: http://piwigo.org/svn/trunk@2349 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
vdigital committed May 17, 2008
1 parent 6ee69cf commit 069748a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
9 changes: 6 additions & 3 deletions admin/cat_perm.php
Expand Up @@ -231,12 +231,13 @@
WHERE cat_id = '.$page['cat'].'
;';
$group_granted_ids = array_from_query($query, 'group_id');
$group_granted_ids = order_by_name($group_granted_ids, $groups);
$template->assign('group_granted_ids', $group_granted_ids);


// groups denied
$template->assign('group_denied_ids',
array_diff(array_keys($groups), $group_granted_ids)
order_by_name(array_diff(array_keys($groups), $group_granted_ids), $groups)
);

// users...
Expand All @@ -257,7 +258,7 @@
WHERE cat_id = '.$page['cat'].'
;';
$user_granted_direct_ids = array_from_query($query, 'user_id');

$user_granted_direct_ids = order_by_name($user_granted_direct_ids, $users);
$template->assign('user_granted_direct_ids', $user_granted_direct_ids);


Expand Down Expand Up @@ -294,7 +295,8 @@

$user_granted_indirect_ids = array_diff($user_granted_by_group_ids,
$user_granted_direct_ids);

$user_granted_indirect_ids =
order_by_name($user_granted_indirect_ids, $users);
foreach ($user_granted_indirect_ids as $user_id)
{
foreach ($granted_groups as $group_id => $group_users)
Expand All @@ -317,6 +319,7 @@
$user_denied_ids = array_diff(array_keys($users),
$user_granted_indirect_ids,
$user_granted_direct_ids);
$user_denied_ids = order_by_name($user_denied_ids, $users);
$template->assign('user_denied_ids', $user_denied_ids);


Expand Down
17 changes: 17 additions & 0 deletions include/functions_html.inc.php
Expand Up @@ -731,4 +731,21 @@ function render_category_literal_description($desc)
{
return strip_tags($desc, '<span><p><a><br><b><i><small><big><strong><em>');
}

/** returns the argument_ids array with new sequenced keys based on related
* names. Sequence is not case sensitive.
* Warning: By definition, this function breaks original keys
*/
function order_by_name($element_ids,$name)
{
$ordered_element_ids = array();
foreach ($element_ids as $k_id => $element_id)
{
$key = strtolower($name[$element_id]) .'-'. $name[$element_id] .'-'. $k_id;
$ordered_element_ids[$key] = $element_id;
}
ksort($ordered_element_ids);
return $ordered_element_ids;
}

?>
Binary file added template/yoga/theme/admin/images/header_bottom.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed template/yoga/theme/admin/images/logo23.jpg
Binary file not shown.
Binary file removed template/yoga/theme/admin/images/select_bt.png
Binary file not shown.

0 comments on commit 069748a

Please sign in to comment.