forked from extern/egroupware
Added sorting back in and fixed rows being displayed oddly when there is an odd number of permissions
This commit is contained in:
parent
78ec4589dd
commit
fa169cd79f
@ -19,6 +19,16 @@
|
|||||||
include("../header.inc.php");
|
include("../header.inc.php");
|
||||||
include($phpgw_info["server"]["app_inc"]."/accounts_".$phpgw_info["server"]["account_repository"].".inc.php");
|
include($phpgw_info["server"]["app_inc"]."/accounts_".$phpgw_info["server"]["account_repository"].".inc.php");
|
||||||
|
|
||||||
|
function is_odd($n)
|
||||||
|
{
|
||||||
|
$ln = substr($n,-1);
|
||||||
|
if ($ln == 1 || $ln == 3 || $ln == 5 || $ln == 7 || $ln == 9) {
|
||||||
|
return True;
|
||||||
|
} else {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $account_id) {
|
if (! $account_id) {
|
||||||
Header("Location: " . $phpgw->link("accounts.php"));
|
Header("Location: " . $phpgw->link("accounts.php"));
|
||||||
}
|
}
|
||||||
@ -193,8 +203,8 @@
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$sorted_apps = $phpgw_info["apps"];
|
$sorted_apps = $phpgw_info["apps"];
|
||||||
// @asort($sorted_apps);
|
@asort($sorted_apps);
|
||||||
// @reset($sorted_apps);
|
@reset($sorted_apps);
|
||||||
while ($permission = each($phpgw_info["apps"])) {
|
while ($permission = each($phpgw_info["apps"])) {
|
||||||
if ($permission[1]["enabled"]) {
|
if ($permission[1]["enabled"]) {
|
||||||
$perm_display[$i][0] = $permission[0];
|
$perm_display[$i][0] = $permission[0];
|
||||||
@ -214,6 +224,10 @@
|
|||||||
$perm_html .= "></td>";
|
$perm_html .= "></td>";
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
|
if ($i == count($perm_display) && is_odd(count($perm_display))) {
|
||||||
|
$perm_html .= '<td colspan="2"> </td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
if (! $perm_display[$i][1]) break;
|
if (! $perm_display[$i][1]) break;
|
||||||
$perm_html .= '<td>' . lang($perm_display[$i][1]) . '</td>'
|
$perm_html .= '<td>' . lang($perm_display[$i][1]) . '</td>'
|
||||||
. '<td><input type="checkbox" name="new_permissions['
|
. '<td><input type="checkbox" name="new_permissions['
|
||||||
@ -221,7 +235,7 @@
|
|||||||
if ($new_permissions[$perm_display[$i][0]] || $db_perms[$perm_display[$i][0]]) {
|
if ($new_permissions[$perm_display[$i][0]] || $db_perms[$perm_display[$i][0]]) {
|
||||||
$perm_html .= " checked";
|
$perm_html .= " checked";
|
||||||
}
|
}
|
||||||
$perm_html .= "></td></tr>";
|
$perm_html .= "></td></tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,16 @@
|
|||||||
include("../header.inc.php");
|
include("../header.inc.php");
|
||||||
include($phpgw_info["server"]["app_inc"]."/accounts_".$phpgw_info["server"]["account_repository"].".inc.php");
|
include($phpgw_info["server"]["app_inc"]."/accounts_".$phpgw_info["server"]["account_repository"].".inc.php");
|
||||||
|
|
||||||
|
function is_odd($n)
|
||||||
|
{
|
||||||
|
$ln = substr($n,-1);
|
||||||
|
if ($ln == 1 || $ln == 3 || $ln == 5 || $ln == 7 || $ln == 9) {
|
||||||
|
return True;
|
||||||
|
} else {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($submit) {
|
if ($submit) {
|
||||||
$totalerrors = 0;
|
$totalerrors = 0;
|
||||||
|
|
||||||
@ -140,17 +150,21 @@
|
|||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
if (! $perm_display[$i][1]) break;
|
if ($i == count($perm_display) && is_odd(count($perm_display))) {
|
||||||
|
$perms_html .= '<td colspan="2"> </td></tr>';
|
||||||
$perms_html .= '<td>' . lang($perm_display[$i][1]) . '</td>'
|
}
|
||||||
. '<td><input type="checkbox" name="new_permissions['
|
|
||||||
. $perm_display[$i][0] . ']" value="True"';
|
if (! $perm_display[$i][1]) break;
|
||||||
if ($new_permissions[$perm_display[$i][0]]) {
|
|
||||||
$perms_html .= " checked";
|
$perms_html .= '<td>' . lang($perm_display[$i][1]) . '</td>'
|
||||||
}
|
. '<td><input type="checkbox" name="new_permissions['
|
||||||
$perms_html .= "></td></tr>";
|
. $perm_display[$i][0] . ']" value="True"';
|
||||||
|
if ($new_permissions[$perm_display[$i][0]]) {
|
||||||
$i++;
|
$perms_html .= " checked";
|
||||||
|
}
|
||||||
|
$perms_html .= "></td></tr>";
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
$phpgw->template->set_var("permissions_list",$perms_html);
|
$phpgw->template->set_var("permissions_list",$perms_html);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user