Permission Box Vertical Scroll Edit

inebriated

Joined: 2012-07-05
Posts: 9
Posted: Fri, 2012-07-06 15:08

Hi there,

I have a gallery with several different groups, when you go to set permissions you have to scroll left / right to find the user you are looking for.

What I would like is to reverse the table so that Groups are displayed vertically (new row for each) and the permissions horizontally (edit, add, view etc.

For example

VIEW--------VIEW FULLSIZE--------EDIT---------ADD
Group1-------Y------Y-------------N------------N
Group2-------Y------Y-------------N------------N
Group3-------Y------Y-------------N------------N
Group4-------Y------Y-------------N------------N
Group5-------Y------Y-------------N------------N
Group6-------Y------Y-------------N------------N

Is this possible, I have tried editing the permissions_form.html.php file but with no sucess.

---------------------------------------------------

/// Contents of permissions_form.html.php ////
<?php defined("SYSPATH") or die("No direct script access.") ?>
<fieldset>
<legend> <?= t('Edit Permissions') ?> </legend>
<table>
<tr>
<th> </th>
<? foreach ($groups as $group): ?>
<th> <?= html::clean($group->name) ?> </th>
<? endforeach ?>
</tr>

<? foreach ($permissions as $permission): ?>
<tr>
<td> <?= t($permission->display_name) ?>
</td>
<? foreach ($groups as $group): ?>
<? $intent = access::group_intent($group, $permission->name, $item) ?>
<? $allowed = access::group_can($group, $permission->name, $item) ?>
<? $lock = access::locked_by($group, $permission->name, $item) ?>

<? if ($lock): ?>
<td class="g-denied">
<img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>"
title="<?= t('denied and locked through parent album')->for_html_attr() ?>"
alt="<?= t('denied icon')->for_html_attr() ?>" />
<a href="javascript:show(<?= $lock->id ?>)" title="<?= t('click to go to parent album')->for_html_attr() ?>">
<img src="<?= url::file(gallery::find_file("images", "ico-lock.png")) ?>" alt="<?= t('locked icon')->for_html_attr() ?>" />
</a>
</td>
<? else: ?>
<? if ($intent === access::INHERIT): ?>
<? if ($allowed): ?>
<td class="g-allowed">
<a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('allowed through parent album, click to allow explicitly')->for_html_attr() ?>">
<img src="<?= url::file(gallery::find_file("images", "ico-success-passive.png")) ?>" alt="<?= t('passive allowed icon')->for_html_attr() ?>" />
</a>
<a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
title="<?= t('click to deny')->for_html_attr() ?>">
<img src="<?= url::file(gallery::find_file("images", "ico-denied-inactive.png")) ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" />
</a>
</td>
<? else: ?>
<td class="g-denied">
<a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
title="<?= t('click to allow')->for_html_attr() ?>">
<img src="<?= url::file(gallery::find_file("images", "ico-success-inactive.png")) ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" />
</a>
<a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
title="<?= t('denied through parent album, click to deny explicitly')->for_html_attr() ?>">
<img src="<?= url::file(gallery::find_file("images", "ico-denied-passive.png")) ?>" alt="<?= t('passive denied icon')->for_html_attr() ?>" />
</a>
</td>
<? endif ?>

<? elseif ($intent === access::DENY): ?>
<td class="g-denied">
<a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
title="<?= t('click to allow')->for_html_attr() ?>">
<img src="<?= url::file(gallery::find_file("images", "ico-success-inactive.png")) ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" />
</a>
<? if ($item->id == 1): ?>
<img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>" alt="<?= t('denied icon')->for_html_attr() ?>" title="<?= t('denied')->for_html_attr() ?>"/>
<? else: ?>
<a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
title="<?= t('denied, click to reset')->for_html_attr() ?>">
<img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>" alt="<?= t('denied icon')->for_html_attr() ?>" />
</a>
<? endif ?>
</td>
<? elseif ($intent === access::ALLOW): ?>
<td class="g-allowed">
<? if ($item->id == 1): ?>
<img src="<?= url::file(gallery::find_file("images", "ico-success.png")) ?>" title="<?= t("allowed")->for_html_attr() ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" />
<? else: ?>
<a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
title="<?= t('allowed, click to reset')->for_html_attr() ?>">
<img src="<?= url::file(gallery::find_file("images", "ico-success.png")) ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" />
</a>
<? endif ?>
<a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
title="<?= t('click to deny')->for_html_attr() ?>">
<img src="<?= url::file(gallery::find_file("images", "ico-denied-inactive.png")) ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" />
</a>
</td>
<? endif ?>
<? endif ?>
</td>
<? endforeach ?>
</tr>
<? endforeach ?>
</table>
</fieldset>

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25961
Posted: Fri, 2012-07-06 18:35

Does the attached work better?
I did not test much.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

AttachmentSize
permissions_form.html_.php_.txt5.24 KB
Login or register to post comments
inebriated

Joined: 2012-07-05
Posts: 9
Posted: Fri, 2012-07-06 22:16

Yes that works perfect :)

Many thanks floridave, much appreciated.

This mod is kind of essential for sites with alot of groups, or even with only a few groups in my opinion is alot more logical this way.

Regards
Andy

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25961
Posted: Sat, 2012-07-07 00:49

Perhaps I'll make it a module.
Glad it worked out.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25961
Posted: Mon, 2012-07-09 16:42
Login or register to post comments
inebriated

Joined: 2012-07-05
Posts: 9
Posted: Mon, 2012-07-09 17:40

Great work Dave

Makes much more sense this way :)

Login or register to post comments
smallIT

Joined: 2012-10-28
Posts: 7
Posted: Sun, 2012-10-28 20:23

Awesome! A module that I didn't even know I needed until I found it. Cheers to both for the contribution!

Login or register to post comments