	[% META title="Resources &raquo; User Permissions" %]
<!-- BEGIN [% template.name %] -->

    [% # PROCESS dumper.tt dump = data %]
    [% # PROCESS dumper.tt dump = functions %]

    <h2>[% c.cfg('settings').lab_name_abbreviation %] user permissions</h2>

    <script type="text/javascript" src="/js/floating-1.8.js"></script>  
    <script type="text/javascript">  
        floatingMenu.add('floatdiv',  
            {  
                // Represents distance from left or right browser window  
                // border depending upon property used. Only one should be  
                // specified.  
                // targetLeft: 0,  
                targetRight: 50,  
      
                // Represents distance from top or bottom browser window  
                // border depending upon property used. Only one should be  
                // specified.  
                targetTop: 200,  
                // targetBottom: 0,  
      
                // Uncomment one of those if you need centering on  
                // X- or Y- axis.  
                // centerX: true,  
                // centerY: true,  
      
                // Remove this one if you don't want snap effect (snap into position)
                snap: true  
            });  
    </script>        
    
    [% nsorted_functions = natural_sort(functions.keys); # PROCESS dumper.tt dump = nsorted_functions %]

    [% BLOCK header %]
    <tr>
        <td align="right">Function ID:</td>
        [% FOREACH f IN nsorted_functions %]
            <th>
                <span class="acronym" title="[% functions.item(f) %]">[% f %]</span>
            </th>
        [% END %]
    </tr>
    [% END %]

    <div id="floatdiv" style="  
        position:absolute;  
        width:300px; height:50px; top:10px; right:10px;  
        padding: 0px; background:#fff;  
        border:none;  
        z-index:100">  
        <table class="tiny bkgd_grey">
        [% FOREACH f IN nsorted_functions %]
            <tr>
                <td align="right">[% f %]</td>
                <td>[% functions.item(f) %]</td>
            </tr>
        [% END %]        
        </table>
    </div>  
      
    <form action="[% c.query.self_url %]">
        <p class="indent">Select function to restrict:
            <select name="function_id" onchange="submit()">
                <option value=""></option>
                [% FOREACH f IN functions.sort %]
                    <option value="[% f %]"
                        [% 'selected' IF f == c.query.param('function_id') %]>
                        [% functions.item(f) %]
                    </option>
                [% END %]
            </select>
            [% # site.html.go_btn # using onchange %]
        </p>        
    </form>

    <table class="tiny indent">
    [% INCLUDE header %]
    [% FOREACH user IN data.keys.sort; # PROCESS dumper.tt dump = user;
        NEXT IF c.query.param('function_id')
            AND NOT data.item(user).item( c.query.param('function_id') ) %]
        <tr>
            <td>
                [% IF c.user_can('do_admin') %]
                <a href="[% app_url %]/admin/user/get_user?username=[% user %]"
                   target="_new">[% user | upper %]</a>
                [% ELSE; user | upper; END %]
            </td>
            [% FOREACH f IN nsorted_functions;
                
                bkgd = # data.item(user).item(f) ? 'f00' : 'fff'; # using tick.gif now
                    'fff' %]
                <td style="background: #[% bkgd %]">
                    [% IF data.item(user).item(f) %]
                        <img src="/images/tick.gif" />
                    [% END %]
                </td>
            [% END %]
        [% INCLUDE header IF loop.count.match(0) # every 10 rows %]
        </tr>
    [% END %]
    [% # INCLUDE header %]
    </table>
<!-- END [% template.name %] -->
