Hi.

first post (...english isnt my first language ;) )

lately i started to build users management part for my new "project"
using acl/roles using example from 
http://www.cakephpforum.net/index.php?showtopic=27&st=0

there is some acl managment action that output controller actions /
roles in grid to easier menagament of above (i uses ajax) i have
modified it a bit (view) - but i have some strange isues with this
under Firefox...

Firefox: http://img80.imageshack.us/img80/2607/ffcakehr1.jpg
at this screenshot actions "add" (both controllers) and "adjustperm"
are not visible - they are in html code but i cant see them - even
when i remove css file, i tested this a bit and i found that

<td id="<?php echo $controller.'_'.$action.'_'.$key; ?>">

id generated in this way generates this error, if i modify this to
look like

<td id="<?php echo $controller.$action.'_'.$key; ?>">       <- one "_"
less

i can see every actions but ajax wont update this cells

Firefox/IE generates this in my error.log (every time i hit ajax
link):

2008-08-19 08:07:49 Error: <script type="text/javascript">
//<![CDATA[
_elem = $('Roles_cleanupAcl_1'); Element.replace(_elem,
unescape("%3Ctd id=\"Roles_cleanupAcl_1\" class=\"actdanied\">denied
%3Ca href=\"\/test07\/index.php\/roles\/adjustperm\/1\/Roles\/
cleanupAcl\/allow\" id=\"link9470\" onclick=\" event.returnValue =
false; return false;\">allow?%3C\/a>%3Cscript type=\"text\/javascript
\">\r\n\/\/%3C![CDATA[\r\nEvent.observe('link9470', 'click',
function(event) { new Ajax.Updater('updacl','\/test07\/index.php\/
roles
\/adjustperm\/1\/Roles\/cleanupAcl\/allow', {asynchronous:true,
evalScripts:true, requestHeaders:['X-Update', 'updacl']}) }, false);\r
\n\/\/]]>\r\n%3C\/script>%3C\/td>"));
//]]>
</script>


he is the complete view/action code:

ACTION:

    function acl() {

        $avoidControllers   = array('Pages');
        $data               = $this->Role->findAll();
        $controllerList     = $this->ControllerList->get();

        // we loop on all action for all roles
        $inidbg =  Configure::read( 'debug');

        Configure::write( 'debug', '0' );

        foreach($controllerList as $controller => $actions) {

            if(in_array($controller, $avoidControllers)) {

                unset($controllerList[$controller]);
                continue;

            }
            foreach($actions as $key => $action) {

                $controllerList[$controller][$action] = array();
                unset($controllerList[$controller][$key]);
                foreach($data as $p)
                    $controllerList[$controller][$action][$p['Role']
['id']] = $this->Acl->check($p, $controller . '/'. $action, '*');

            }

        }

        Configure::write( 'debug', $inidbg);
        $this->set('actlist', $controllerList);
        $this->set('data', $data);

    }


VIEW:

<div class="x">

<table cellpadding="0" cellspacing="0">
<tr>
<th>Controller Action</th>
<?php foreach($data as $p): ?>
<th width="15%"><? echo $p['Role']['name']; ?></th>
<?php endforeach; ?>
</tr>

<?php $i = 0; foreach($actlist as $controller => $actions): ?>

<tr class="<?php echo ($i++ % 2 == 0) ? 'oddrow' : 'evenrow'; ?>">
<td class="controller" style="font-weight: bold;"><?php echo
$controller; ?></td>

<?php foreach($data as $val): ?>

<td>
<?php echo $ajax->link('Allow all', '/roles/adjustperm/'.
$val['Role']['id'].'/'.$controller.'/all/allow', array('update' =>
'updacl')); ?>
            <?php echo $ajax->link( 'Deny all', '/roles/adjustperm/'.
$val['Role']['id'].'/'.$controller.'/all/deny', array('update' =>
'updacl')); ?>
            </td>

<?php endforeach; ?>

</tr>

<?php foreach($actions as $action => $perm): ?>
<tr class="<?php echo ($i++ % 2 == 0) ? 'oddrow' : 'evenrow'; ?>">
<td><?php echo $action; ?></td>

<?php foreach($perm as $key => $val): ?>
<td id="<?php echo $controller.'_'.$action.'_'.$key; ?>" class="<?
php echo ($val == 1) ? 'actallowed' : 'actdanied'; ?>">
<?php echo ($val == 1) ? 'allowed '.$ajax->link('deny?', '/roles/
adjustperm/'.$key.'/'.$controller.'/'.$action.'/deny', array('update'
=> 'updacl')) :
  'denied '.$ajax->link('allow?', '/roles/adjustperm/'.$key.'/'.
$controller.'/'.$action.'/allow', array('update' => 'updacl')); ?>
</td>
<?php endforeach; ?>

</tr>
<?php endforeach; ?>

<?php endforeach; ?>

</table>


</div>
<div id="updacl"></div>









ps. it may double post - i send this post earlier but it didnt show up

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to