Вход Регистрация
Файл: IPBMafia.ru_IPB_3.4.6_Final_Rus _Nulled/board/upload/admin/applications/forums/js/acp.archive.js
Строк: 258
<?php
/************************************************/
/* IPB3 Javascript                                */
/* -------------------------------------------- */
/* acp.archive.js - Archive javascript             */
/* (c) IPS, Inc 2011                            */
/* -------------------------------------------- */
/* Author: Matt Mecham                            */
/************************************************/

IPBoard.prototype.ACPArchive = {
    
inSectionnull,
    
ruleDatanull,
    
keys: [ 'approved''forum''member''pinned''poll''post''rating''lastpost''state''view' ],
    
lastBlur0,
    
ajaxPendingfalse,
    
popUps: {},
    
autoCompletenull,
    
    
init: function()
    {
        
Debug.write("Initializing acp.archive.js");
        
        
document.observe("dom:loaded", function()
        {
            
/* Set up the handles */
            
if ( this.inSection == 'rules' )
            {
                
this.setUpRulesPage();
            }
        }.
bind(this) );
    },
    
    
/**
     * Remove a member
     * @param e
     * @param elem
     */
    
deleteMember: function(eleme)
    {
        
Event.stop(e);
        
        var 
type elem.readAttribute('data-type');
        var 
id   elem.readAttribute('data-id');
        
        var 
url = ( ipb.vars['base_url'] + 'app=forums&module=ajax&section=archive&withApp=forums&do=deleteMember&type=' type '&id=' id '&md5check=' ipb.vars['md5_hash'] ).replace( /&amp;/g'&');
        
        
Debug.writeurl );
        new 
Ajax.Requesturl,
                {
                    
method'post',
                    
hideLoadertrue,
                    
evalJSON'force',
                    
onSuccess: function(t)
                    {
                        if ( 
t.responseJSON )
                        {
                            
Debug.writet.responseJSON );
                                                        
                            
this._updateMemberst.responseJSON['data'], t.responseJSON['count'], type );
                            $(
type '_field_member_text').value t.responseJSON['ids'];
                            
                            
/* Update stats */
                            
this.lastBlur this.getUnixTime();
                            
this.updateStats();
                        }
                    }.
bind(this)
                } );
    },
    
/**
     * Save the dialog box
     * @param e
     * @param elem
     */
    
saveAddMemberDialog: function(eleme)
    {
        
Event.stop(e);
        
        var 
type elem.readAttribute('data-type');
        
        var 
url = ( ipb.vars['base_url'] + 'app=forums&module=ajax&section=archive&withApp=forums&do=saveAddMemberDialog&type=' type '&md5check=' ipb.vars['md5_hash'] ).replace( /&amp;/g'&');
        
        
Debug.writeurl );
        new 
Ajax.Requesturl,
                {
                    
method'post',
                    
hideLoadertrue,
                    
parameters: { addName$F('addName') },
                    
evalJSON'force',
                    
onSuccess: function(t)
                    {
                        
/* close box */
                        
this.popUps['lmd'].hide();
                        
                        if ( 
t.responseJSON )
                        {
                            
Debug.writet.responseJSON );
                                                        
                            
this._updateMemberst.responseJSON['data'], t.responseJSON['count'], type );
                            $(
type '_field_member_text').value t.responseJSON['ids'];
                            
                            
/* Update stats */
                            
this.lastBlur this.getUnixTime();
                            
this.updateStats();
                        }
                    }.
bind(this)
                } );
    },
    
    
/**
     * Show the add member dialog box
     * @param e
     * @param elem
     */
    
launchAddMemberDialog: function(eleme)
    {
        
Event.stop(e);
        
        if ( ! 
Object.isUndefinedthis.popUps['lmd'] ) )
        {
            
//this.popUps['lmd'].kill();
        
}
        
        var 
type elem.readAttribute('data-type');
        
        var 
url = ( ipb.vars['base_url'] + 'app=forums&module=ajax&section=archive&withApp=forums&do=showAddMemberDialog&type=' type '&md5check=' ipb.vars['md5_hash'] ).replace( /&amp;/g'&');
        
        
Debug.writeurl );
        
        new 
Ajax.Requesturl,
                {
                    
method'post',
                    
hideLoadertrue,
                    
onSuccess: function(t)
                    {
                        if ( 
t.responseText )
                        {
                            
/* Create the pop-up */
                            
if ( ! Object.isUndefinedthis.popUps['lmd'] ) )
                            {
                                
this.popUps['lmd'].show();
                                $(
'addName').value '';
                            }
                            else
                            {
                                
this.popUps['lmd'] = new ipb.Popup'lmd', { type'pane',
                                                                             
modaltrue,
                                                                             
initialt.responseText,
                                                                             
hideAtStartfalse,
                                                                             
w'550px' } );
                                
                                
setTimeout( function ()
                                        {
                                            
this.autoComplete = new ipb.Autocomplete( $('addName'), { multiboxfalseurlacp.autocompleteUrltemplates: { wrapacp.autocompleteWrapitemacp.autocompleteItem } } );
                                        }.
bind(this), 1000 );
                            }
                        }
                    }.
bind(this)
                } );
    },
    
    
/**
     * Save the dialog box
     * @param e
     * @param elem
     */
    
saveAddForumDialog: function(eleme)
    {
        
Event.stop(e);
        
        var 
type elem.readAttribute('data-type');
        
        var 
url = ( ipb.vars['base_url'] + 'app=forums&module=ajax&section=archive&withApp=forums&do=saveAddForumDialog&type=' type '&md5check=' ipb.vars['md5_hash'] ).replace( /&amp;/g'&');
        
        
Debug.writeurl );
        
Debug.dir$F('forumIds') );
        new 
Ajax.Requesturl,
                {
                    
method'post',
                    
hideLoadertrue,
                    
parameters: $('forumIds').serialize(true),
                    
evalJSON'force',
                    
onSuccess: function(t)
                    {
                        
/* close box */
                        
this.popUps['lfd'].hide();
                        
                        if ( 
t.responseJSON )
                        {
                            
Debug.writet.responseJSON );
                                                        
                            
this._updateForumst.responseJSON['data'], type );
                            $(
type '_field_forum_text').value t.responseJSON['ids'];
                            
                            
/* Update stats */
                            
this.lastBlur this.getUnixTime();
                            
this.updateStats();
                        }
                    }.
bind(this)
                } );
    },
    
    
/**
     * Show the add forum dialog box
     * @param e
     * @param elem
     */
    
launchAddForumDialog: function(eleme)
    {
        
Event.stop(e);
        
        var 
type elem.readAttribute('data-type');
        
        var 
url = ( ipb.vars['base_url'] + 'app=forums&module=ajax&section=archive&withApp=forums&do=showAddForumDialog&type=' type '&md5check=' ipb.vars['md5_hash'] ).replace( /&amp;/g'&');
        
        
Debug.writeurl );
        
        new 
Ajax.Requesturl,
                {
                    
method'post',
                    
hideLoadertrue,
                    
onSuccess: function(t)
                    {
                        if ( 
t.responseText )
                        {
                            
/* Create the pop-up */
                            
this.popUps['lfd'] = new ipb.Popup'lfd', { type'pane',
                                                                         
modaltrue,
                                                                         
initialt.responseText,
                                                                         
hideAtStartfalse,
                                                                         
w'550px' } );
                        }
                    }.
bind(this)
                } );
    },
    
    
/**
     * Fetch dialog to set unarchive preferences
     * 
     */
    
showRestorePrefs: function()
    {
        var 
url = ( ipb.vars['base_url'] + 'app=forums&module=ajax&section=archive&withApp=forums&do=showRestoreDialog&md5check=' ipb.vars['md5_hash'] ).replace( /&amp;/g'&');
        
        
Debug.writeurl );
        
        new 
Ajax.Requesturl,
                {
                    
method'post',
                    
hideLoadertrue,
                    
onSuccess: function(t)
                    {
                        if ( 
t.responseText )
                        {
                            
/* Create the pop-up */
                            
new ipb.Popup'rpd', { type'pane',
                                                    
modaltrue,
                                                    
initialt.responseText,
                                                    
hideAtStartfalse,
                                                    
w'550px' } );
                        }
                    }.
bind(this)
                } );
    },
    
    
/**
     * Set up rules page
     */
    
setUpRulesPage: function()
    {
        
Debug.dirthis.ruleData );
        
        
/* Set current values */
        
$Hthis.ruleData['archive'] ).each( function( data )
        {
            var 
_key data.key;
            var 
_val data.value;

            
this._setUpField_key_valtrue );
        }.
bind(this) );
        
        
$Hthis.ruleData['skip'] ).each( function( data )
        {
            var 
_key data.key;
            var 
_val data.value;

            
this._setUpField_key_valfalse );
        }.
bind(this) );
        
        
/* Got anything for forums? */
        
if ( ! Object.isUndefinedthis.ruleData['archive']['forum']['_parseData'] ) )
        {
            
this._updateForumsthis.ruleData['archive']['forum']['_parseData'], 'archive' );
            $(
'archive_field_forum_text').value this.ruleData['archive']['forum']['text'];
        }
        
        
/* Got anything for members? */
        
if ( ! Object.isUndefinedthis.ruleData['archive']['member']['_parseData'] ) )
        {
            
this._updateMembersthis.ruleData['archive']['member']['_parseData']['data'], this.ruleData['archive']['member']['_parseData']['count'], 'archive' );
            $(
'archive_field_member_text').value this.ruleData['archive']['member']['text'];
        }
        
        
/* set up blurs */
        
this.keys.each( function(key)
        {
            if ( $( 
'archive_field_' key ) )
            {
                $( 
'archive_field_' key ).on('blur'this._blur.bindAsEventListener(this) );
            }
            
            if ( $( 
'archive_field_' key '_text' ) )
            {
                $( 
'archive_field_' key '_text' ).on('blur'this._blur.bindAsEventListener(this) );
            }
            
            if ( $( 
'archive_field_' key '_unit' ) )
            {
                $( 
'archive_field_' key '_unit' ).on('blur'this._blur.bindAsEventListener(this) );
            }
            
            if ( $( 
'skip_field_' key ) )
            {
                $( 
'skip_field_' key ).on('blur'this._blur.bindAsEventListener(this) );
            }
            
            if ( $( 
'skip_field_' key '_text' ) )
            {
                $( 
'skip_field_' key '_text' ).on('blur'this._blur.bindAsEventListener(this) );
            }
            
            if ( $( 
'skip_field_' key '_unit' ) )
            {
                $( 
'skip_field_' key '_unit' ).on('blur'this._blur.bindAsEventListener(this) );
            }
        }.
bind(this) );
        
        
setInterval( function() { this.updateStats() }.bind(this), 1000 );
    },
    
    
/**
     * Number of seconds since epoch aka unixtime
     * @returns int
     */
    
getUnixTime: function()
    {
        return 
Math.round( new Date().getTime() / 1000 );
    },
    
    
/**
     * Update stats
     */
    
updateStats: function()
    {
        if ( 
this.lastBlur && ( ( this.getUnixTime() - this.lastBlur ) <= 20 ) )
        {
            if ( 
this.ajaxPending === false )
            {
                
/* Reset */
                
this.ajaxPending true;
                
                
/* Get the data */
                
var postParams = $('archiveForm').serialize(true);
                var 
url        = ( ipb.vars['base_url'] + 'app=forums&module=ajax&section=archive&withApp=forums&do=updateCounter&md5check=' ipb.vars['md5_hash'] ).replace( /&amp;/g'&');
                
                
Debug.writeurl );
                
Debug.dirpostParams);
                
                new 
Ajax.Requesturl,
                {
                    
method'post',
                    
parameterspostParams,
                    
hideLoadertrue,
                    
onSuccess: function(t)
                    {
                        
/* Save it sister */
                        
this.ajaxPending false;
                        
this.lastBlur    0;
                        
                        if ( 
t.responseJSON['textString'] )
                        {
                            $(
'archiveCount').updatet.responseJSON['textString'] );
                            
                            
/* Pervy flashing */
                            
var bg = $('archiveCount').getStyle('backgroundColor');
                            
                            new 
Effect.Highlight( $('archiveCount'), { 'startcolor''#ffff99''restorecolor'bg'keepBackgroundImage'true } );
                        }
                    }.
bind(this)
                } );
            }
        }
    },
    
    
/**
     * Set up row
     */
    
_setUpField: function( keyobjisArchive )
    {
        var 
prefix = ( isArchive ) ? 'archive' 'skip';
        
        switch( 
key )
        {
            case 
'approved':
            case 
'pinned':
            case 
'poll':
            case 
'state':
                var 
seek = ( obj.value == '-' ) ? 'any' obj.value;
                
                $( 
prefix '_field_' key '_' seek ).selected true;
            break;
            case 
'post':
            case 
'rating':
            case 
'view':
                var 
seek = ( obj.value == '<' ) ? 'less' 'more';
                
                $( 
prefix '_field_' key '_' seek ).selected true;
                $( 
prefix '_field_' key '_text').value obj.text;
            break;
            case 
'forum':
            case 
'member':
                var 
seek = ( obj.value == '-' ) ? 'more' 'less';
                
                $( 
prefix '_field_' key '_' seek ).selected true;
            break;
            case 
'lastpost':
                var 
seek = ( obj.value == '<' ) ? 'less' 'more';
                
                $( 
prefix '_field_' key '_' seek ).selected true;                
                $( 
prefix '_field_' key '_text').value obj.text;
                
                $( 
prefix '_field_' key '_unit_' obj.unit ).selected true;
            break;
        }
    },
    
    
/**
     * It's all a bit of a
     */
    
_blur: function( )
    {
        var 
elem Event.findElement(e);
        
        
this.lastBlur this.getUnixTime();
    },
    
    
/**
     * Update members box out
     */
    
_updateMembers: function( objcounttype )
    {
        
/* Wipe it */
        
$(type '_membersGoHere').show().update('');
        
        
/* Do it */
        
if ( count )
        {
            
$H(obj).each( function( data )
            {
                var 
val data.value;
                var 
img '<a href="#" data-clicklaunch="deleteMember" data-scope="ACPArchive" data-type="' type '" data-id="' val.member_id '"><img src="' ipb.vars['image_acp_url'] + 'icons/delete.png"  /></a>&nbsp; &nbsp;';
                $(
type '_membersGoHere').insert( new Element('div').updateimg val['photoTag'] + ' <strong>' val['members_display_name'] + '</strong> (' val['g_title'] + ')' ) );
            } );
        }
        else
        {
            $(
type '_membersGoHere').hide();
        }
        
        $$(
"[data-clicklaunch]").invoke('clickLaunch');
    },
    
    
/**
     * Update forums box out
     */
    
_updateForums: function( objtype )
    {
        
/* Wipe it */
        
$(type '_forumsGoHere').show().update('');
        
        
/* Do it */
        
$H(obj).each( function( data )
        {
            var 
val data.value;
            
            $(
type '_forumsGoHere').insert( new Element('div').updateval.nav ' ' val.data.name ) );
        } );
    }
};

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