Вход Регистрация
Файл: base-sys/admin/views/controllers/users_roles.html
Строк: 138
<?php
{script}
{
literal}
$(
document).ready(function(){
    $(
'#roles').sortable({
        
items'tr.role',
        
helper'clone',
        
placeholder'placeholder',
        
start: function(eventui){
            $(
ui.placeholder).append('<td colspan="4"></td>');
        },
        
update: function(eventui){
            var 
set = {};

            $(
'#roles tr.role td input:checkbox[name="role[]"]').each(function(i){
                var 
id = $(this).val();
                
set['order['+id+']'] = ++i;
            });

            
url '{/literal}{url_for for="ADMIN_CTRL_Users:ajaxReorder"}{literal}';

            $.
posturlset );
        },
        
stop: function(eventui){

            
$set = $('#roles tr.role td input:checkbox[name="role[]"]');
             
            
$set.attr('disabled'false);

            $( 
$set[0] ).attr('disabled''disabled').attr('checked'false);

            $(
'td span.default-role:visible'this).hide();

            $(
'td input:checkbox[name]')
            
            $( $(
this).sortable('option''items'), this ).each(function(i){
                if(
== 0)
                    $(
'td span.default-role'this).show();

                var 
isEven = (i+1) % === 0;

                
remClass isEven 'peep_alt1':'peep_alt2';
                
addClass isEven 'peep_alt2':'peep_alt1';
                
                if( $(
this).hasClass(remClass) )
                    $(
this).removeClassremClass );

                if( !$(
this).hasClass(addClass) )
                    $(
this).addClassaddClass );

            })
        }
    });

    $(
".edit_role""#roles").click(function(){
        var 
roleId = $(this).attr("rel");

        
editRoleFloatBox PEEP.ajaxFloatBox(
            
"ADMIN_CMP_AuthorizationRoleEdit"
            { 
roleIdroleId }, 
            { 
width:400iconClass"peep_ic_edit"titlePEEP.getLanguageText('admin''permissions_edit_role_btn') }
        );
    });
});

{/
literal}
{/
script}

{
style}
{
literal}
tr.placeholder td{
    
border1px dashed grey;
    
height35px;
    
width100%;
}

.
role{
    
cursormove;
}
{/
literal}
{/
style}

<
div class="peep_automargin peep_wide">
    <
form action="{url_for for="ADMIN_CTRL_Users:deleteRoles"}" method="POST">
        <
table id="roles" class="peep_table_2 peep_form peep_stdmargin peep_center">
            <
tr class="peep_tr_first">
                <
th width="1"></th>
                <
th>{text key='admin+permissions_user_role'}</th>
                <
th width="1">{text key='admin+permissions_number_of_users'}</th>
                <
th width="1"><span class="peep_nowrap">{text key='admin+avatar_label'}</span></th>
            </
tr>

            {foreach 
name="roles" from=$set item='item'}
                {
assign var='role' value=$item.dto}
                {
assign var='roleId' value=$role->id}
                <
tr class="{cycle values='peep_alt1, peep_alt2'} role">
                    <
td>
                        <
input type="checkbox" name="role[]" value="{$role->id}{if $smarty.foreach.roles.first}disabled="disabled"{/if} />
                    </
td>
                    <
td class="peep_txtleft">
                        {
text_edit key="base+authorization_role_`$role->name`"}  
                        <
span class="peep_mild_green peep_small default-role" style="display:{if $smarty.foreach.roles.first}inline{else}none{/if};">
                            {
text key='admin+permissions_default_role'}
                        </
span>
                    </
td>
                    <
td class="peep_nowrap">
                        {
math equation="(x/y)*100" x=$item.userCount y=$total assign='percent'}
                        <
a href="{url_for_route for="admin_users_browse_membership_owners:[roleId=>`$roleId`]"}">{$item.userCount}</a> | {$percent|string_format:'%.1f'}%
                    </
td>
                    <
td style="min-width: 40px;">
                    {if 
$role->displayLabel}
                        <
class="peep_lbutton edit_role" rel="{$role->id}href="javascript://"{if !empty($role->custom)} style="background-color: {$role->custom}"{/if}>
                            {
text key='base+yes'}
                        </
a>
                    {else}
                        <
a href="javascript://" rel="{$role->id}class="edit_role">{text key='base+no'}</a>
                    {/if}
                    </
td>
                </
tr>
                {/foreach}
            <
tr class="peep_tr_last">
                <
td>
                    <
input id="check_all" type="checkbox" onclick="$('#roles tr.role td input:checkbox:enabled').attr('checked', this.checked );" />
                </
td>
                <
td colspan="3" style="text-align: left;">
                    <
label for="check_all">{text key='admin+permissions_check_all_selected'}</label>
                    <
form>
                                                {
capture name="selectRoleAlert"}{text key='admin+permissions_please_select_role'}{/capture}
                                                {
capture name="areYouSure"}{text key='admin+permissions_please_select_role'}{/capture}
                                            
                        <
script type="text/javascript">
                            
window.delRoles = function(){
                                if( $(
'#roles tr.role td input:checkbox:checked').size() == ){ 
                                    
alert('{$smarty.capture.selectRoleAlert|escape:"quotes"}');
                                    return 
false;
                                }

                                return 
confirm('{$smarty.capture.areYouSure|escape:"quotes"}');
                            };
                        </
script>
                        {
decorator name='button' type='submit' langLabel='admin+permissions_delete_role' class='peep_button peep_red peep_ic_delete' onclick="return delRoles()"}
                    </
form>                                    
                </
td>
            </
tr>
        </
table>
    </
form>

    {
block_decorator name='box' addClass='peep_stdmargin peep_center' type='empty' langLabel='admin+add_new_role_block_cap_label' iconClass='peep_ic_add'}
            {
form name="add-role"}
                {
label name="label"} {input name="label" style="width: 270px;"}
                {
submit name="submit" class=" peep_mild_green peep_ic_add"}
            {/
form}
    {/
block_decorator}
    {
block_decorator name='box' addClass='peep_stdmargin' type='empty' langLabel='admin+user_role_permissions_cap_label' iconClass='peep_ic_gear_wheel'}
        {
capture assign="permissionsPageUrl"}{url_for for='ADMIN_CTRL_Permissions:roles'}{/capture}
        {
text key='admin+permissions_go_to_permissions_page' url="$permissionsPageUrl"}
    {/
block_decorator}
</
div>
?>
Онлайн: 0
Реклама