Вход Регистрация
Файл: public/js/ips.warn.js
Строк: 215
<?php
/************************************************/
/* IPB3 Javascript                                */
/* -------------------------------------------- */
/* ips.warn.js - Warning system javascript        */
/* (c) IPS, Inc 2011                            */
/* -------------------------------------------- */
/* Author: Mark Wade                            */
/************************************************/


var _idx window.IPBoard;

_idx.prototype.warn = {
    
    
/*------------------------------*/
    /* Constructor                     */
    
init: function()
    {
        
document.observe("dom:loaded", function(){
            $(
'reason-select').observe('change'ipb.warn.changeReason.bindAsEventListenerthis ) );
            $(
'points-field').observe('change'ipb.warn.changeReason.bindAsEventListenerthis ) );
            $(
'mq_perm').observe('change'ipb.warn.showTime.bindAsEventListenerthis'mq' ) );
            $(
'rpa_perm').observe('change'ipb.warn.showTime.bindAsEventListenerthis'rpa' ) );
            $(
'suspend_perm').observe('change'ipb.warn.showTime.bindAsEventListenerthis'suspend' ) );
            $(
'change-punishment-button').observe('click'ipb.warn.showCustom.bindAsEventListenerthis ) );
            $(
'points-explain-button').observe('click'ipb.warn.explainPoints.bindAsEventListenerthis ) );
            });
    },
    
    
/*------------------------------*/
    /* Change Reason Select Box        */
    
changeReason: function( )
    {
        if ( $(
'reason-select').value != '' )
        {
            if( 
e.target.id == 'reason-select' )
            {
                $(
'points-field').value '';
            }
        
            new 
Ajax.Requestipb.vars['base_url'] + "app=members&section=warnings&module=ajax&do=form&md5check=" ipb.vars['secure_hash'],
            {
                
method'post',
                
evalJSON'force',
                
parameters: {
                    
id: $('reason-select').value,
                    
memberwindow.location.toString().toQueryParams().member,
                    
points: $('points-field').value
                
},
                
onSuccess: function(t)
                {
                    if( 
Object.isUndefinedt.responseJSON ) )
                    {
                        
alertipb.lang['action_failed'] );
                        return;
                    }
                    
                    if ( 
t.responseJSON['error'] )
                    {
                        
alertt.responseJSON['error'] );
                    }
                    else
                    {
                        if ( 
t.responseJSON['manuallySetPoints'] == )
                        {
                            new 
Effect.Appear( $('points-li'), { duration0.3 } );
                        }
                        else
                        {
                            new 
Effect.Fade( $('points-li'), { duration0.3 } );
                        }
                        
                        if ( 
t.responseJSON['allowCustomRemovePoints'] == )
                        {
                            new 
Effect.Appear( $('remove-points-li'), { duration0.3 } );
                            $(
'remove_input').value t.responseJSON['removePoints'];
                            $(
'remove_unit_select').value t.responseJSON['removePointsUnit'];
                        }
                        else
                        {
                            new 
Effect.Fade( $('remove-points-li'), { duration0.3 } );
                        }
                        
                        if ( 
t.responseJSON['setPoints'] )
                        {
                            $(
'points-field').value t.responseJSON['setPoints'];
                        }
                        else
                        {
                            $(
'points-field').value '';
                        }
                        
                        $(
'specified-punishment').innerHTML t.responseJSON['setPunishment'];
                        
                        if ( 
t.responseJSON['allowCustomPunishment'] == )
                        {
                            $(
'change-punishment-button').show();
                        }
                        else
                        {
                            $(
'change-punishment-button').hide();
                        }
                        
                        if ( 
t.responseJSON['mq'] == -)
                        {
                            $(
'mq_perm').checked 'checked';
                            $(
'mq_time').hide();
                        }
                        else
                        {
                            $(
'mq_perm').checked '';
                            $(
'mq_time').show();
                            $(
'mq_input').value t.responseJSON['mq'];
                        }
                        $(
'mq_unit_select').value t.responseJSON['mq_unit'];
                        
                        if ( 
t.responseJSON['rpa'] == -)
                        {
                            $(
'rpa_perm').checked 'checked';
                            $(
'rpa_time').hide();
                        }
                        else
                        {
                            $(
'rpa_perm').checked '';
                            $(
'rpa_time').show();
                            $(
'rpa_input').value t.responseJSON['rpa'];
                        }
                        $(
'rpa_unit_select').value t.responseJSON['rpa_unit'];
                        
                        if ( 
t.responseJSON['suspend'] == -)
                        {
                            $(
'suspend_perm').checked 'checked';
                            $(
'suspend_time').hide();
                        }
                        else
                        {
                            $(
'suspend_perm').checked '';
                            $(
'suspend_time').show();
                            $(
'suspend_input').value t.responseJSON['suspend'];
                        }
                        $(
'suspend_unit_select').value t.responseJSON['suspend_unit'];
                        
                        if ( 
t.responseJSON['ban_group'] == )
                        {
                            $(
'ban_group').checked 'checked';
                        }
                        else
                        {
                            $(
'ban_group').checked '';
                        }
                        
                    }
                }
            });
        }
    },
            
    
/*------------------------------*/
    /* Show/hide time frames         */
    
showTime: function( etype )
    {
        if ( $( 
type '_perm' ).checked )
        {
            new 
Effect.Fade( $( type '_time' ), { duration0.2 } );
        }
        else
        {
            new 
Effect.Appear( $( type '_time' ), { duration0.2 } );
        }
        
        $( 
type '_perm' ).observe('change'ipb.warn.showTime.bindAsEventListenerthistype ) );
    },
    
    
/*------------------------------*/
    /* Show custom options             */
    
showCustom: function( etype )
    {
        
Event.stop(e);
        
        new 
Effect.Fade( $( 'punishment_li' ), { duration0.2 } );
        new 
Effect.Appear( $( 'mq_li' ), { duration0.2 } );
        new 
Effect.Appear( $( 'rpa_li' ), { duration0.2 } );
        new 
Effect.Appear( $( 'suspend_li' ), { duration0.2 } );
    },
    
    
/*------------------------------*/
    /* Explain points                 */
    
explainPoints: function( etype )
    {
        
url ipb.vars['base_url'] + "&app=members&module=ajax&secure_key=" ipb.vars['secure_hash'] + '&section=warnings&do=explain_points';
        
popup = new ipb.Popup'attachments', { type'pane'modalfalsew'800px'h'900px'ajaxURLurlhideAtStartfalse } );
    }

};

ipb.warn.init();
?>
Онлайн: 1
Реклама