Вход Регистрация
Файл: IPBMafia.ru_IPB_3.4.6_Final_Rus _Nulled/board/upload/admin/js/acp.hooks.js
Строк: 238
<?php
/************************************************/
/* IPB3 Javascript                                */
/* -------------------------------------------- */
/* acp.uagents.js - User agent mapping            */
/* (c) IPS, Inc 2008                            */
/* -------------------------------------------- */
/* Author: Rikki Tissier                         */
/************************************************/

var _hooks window.IPBACP;
_hooks.prototype.hooks = {
    
popups: {},
    
fields: {},
    
languageMaxnull,
    
    
init: function()
    {
        
Debug.write("Initializing acp.hooks.js");
        
document.observe("dom:loaded", function(){
    
        });
    },
    
    
generateStrings: function( )
    {
        
Debug.write("Getting strings...");
        
        var 
selected_cat $F('language_' );

        
url ipb.vars['base_url'] + "app=core&amp;module=ajax&amp;section=hooks&amp;do=getStrings&amp;group=" selected_cat '&secure_key=' ipb.vars['md5_hash'] + "&id=" acp.hooks.hookID "&i=" i;
        
url url.replace( /&amp;/g'&' );
        
        new 
Ajax.Requesturl,
                          {
                            
method'GET',
                            
evalJSONtrue,
                            
onSuccess: function(t)
                            {
                                if( 
Object.isUndefinedt.responseJSON ) || t.responseJSON == null )
                                {
                                    
                                    $(
'container_' i).updatet.responseText ).show();
                                    $(
'container_desc_' i).show();
                                }
                                else
                                {
                                    if( 
t.responseJSON['error'] )
                                    {
                                        $(
'container_' i).updatet.responseJSON['error'] ).show();
                                    }
                                    else if( 
t.responseJSON['success'] )
                                    {
                                        $(
'container_' i).updatet.responseJSON['html'] ).show();
                                        $(
'container_desc_' i).show();
                                    }
                                    else
                                    {
                                        $(
'container_' i).updatet.responseText ).show();
                                        $(
'container_desc_' i).show();
                                    }
                                }
                            }
                        });
                                    
    },
    
    
generateTemplates: function( )
    {
        var 
selected_cat $F('skin_' );

        
url ipb.vars['base_url'] + "app=core&amp;module=ajax&amp;section=hooks&amp;do=getTemplates&amp;group=" selected_cat '&secure_key=' ipb.vars['md5_hash'] + "&id=" acp.hooks.hookID "&i=" i;
        
url url.replace( /&amp;/g'&' );
        
        new 
Ajax.Requesturl,
                          {
                            
method'GET',
                            
evalJSONtrue,
                            
onSuccess: function(t)
                            {
                                if( 
Object.isUndefinedt.responseJSON ) || t.responseJSON == null )
                                {
                                    
                                    $(
's_container_' i).updatet.responseText ).show();
                                    $(
's_container_desc_' i).show();
                                }
                                else
                                {
                                    if( 
t.responseJSON['error'] )
                                    {
                                        $(
's_container_' i).updatet.responseJSON['error'] ).show();
                                    }
                                    else if( 
t.responseJSON['success'] )
                                    {
                                        $(
's_container_' i).updatet.responseJSON['html'] ).show();
                                        $(
's_container_desc_' i).show();
                                    }
                                    else
                                    {
                                        $(
's_container_' i).updatet.responseText ).show();
                                        $(
's_container_desc_' i).show();
                                    }
                                }
                            }
                        });
    },
    
    
generateFields: function( )
    {
        
        var 
selected_type $F('type_' );

        if( $(
'd_container_' i) != null )
        {
            $(
'd_container_' i).update('');
        }
        
        var 
template '';
        
        switch( 
selected_type )
        {
            case 
'create':
                
template ipb.templates['db_create'].evaluate( { id} );
                
acp.hooks.fields['MF__database']['fields'].push"name_" );
                
acp.hooks.fields['MF__database']['fields'].push"fields_" );
                
acp.hooks.fields['MF__database']['fields'].push"tabletype_" );
            break;
            case 
'alter':
                
template ipb.templates['db_alter'].evaluate( { id} );
                
acp.hooks.fields['MF__database']['fields'].push"altertype_" );
                
acp.hooks.fields['MF__database']['fields'].push"table_" );
                
acp.hooks.fields['MF__database']['fields'].push"field_" );
                
acp.hooks.fields['MF__database']['fields'].push"newfield_" );
                
acp.hooks.fields['MF__database']['fields'].push"fieldtype_" );
                
acp.hooks.fields['MF__database']['fields'].push"default_" );
            break;
            case 
'update':
                
template ipb.templates['db_update'].evaluate( { id} );
                
acp.hooks.fields['MF__database']['fields'].push"table_" );
                
acp.hooks.fields['MF__database']['fields'].push"field_" );
                
acp.hooks.fields['MF__database']['fields'].push"newvalue_" );
                
acp.hooks.fields['MF__database']['fields'].push"oldvalue_" );
                
acp.hooks.fields['MF__database']['fields'].push"where_" );
            break;
            case 
'insert':
                
template ipb.templates['db_insert'].evaluate( { id} );
                
acp.hooks.fields['MF__database']['fields'].push"table_" );
                
acp.hooks.fields['MF__database']['fields'].push"updates" );
                
acp.hooks.fields['MF__database']['fields'].push"fordelete" );
            break;
            default:
                return;
            break;
        }
                 
        $(
'd_container_' i).inserttemplate ).show();
        $(
'd_container_desc_' i).show();
    },
    
    
addAnotherLanguage: function( )
    {
        
Event.stop(e);
        
        var 
id parseIntacp.hooks.languageMax ) + 1;
        
        var 
url ipb.vars['base_url'] + "app=core&amp;module=ajax&amp;section=hooks&amp;do=getLangFiles&amp;secure_key=" ipb.vars['md5_hash'] + "&id=" acp.hooks.hookID "&i=" id;
        
url url.replace( /&amp;/g'&' );
        
        new 
Ajax.Requesturl,
                        {
                            
method'GET',
                            
evalJSONtrue,
                            
onSuccess: function(t)
                            {
                                if( 
Object.isUndefinedt.responseJSON ) || t.responseJSON == null )
                                {
                                    var 
template ipb.templates['lang_row'].evaluate({ 'containerid'id'control't.responseText});
                                    $(
'language_wrap').inserttemplate );
                                    
                                    
acp.hooks.fields['MF__language']['fields'].push("language_" id);
                                    
acp.hooks.fields['MF__language']['fields'].push("strings_" id);
                                    
acp.hooks.languageMax id;
                                }
                                else
                                {
                                    if( 
t.responseJSON['error'] )
                                    {
                                        
alertt.responseJSON['error'] );
                                    }
                                    else if( 
t.responseJSON['success'] )
                                    {
                                        $(
'container_' id).updatet.responseJSON['html'] ).show();
                                    }
                                    else
                                    {
                                        
alertt.responseText );
                                    }
                                }
                                
                            }
                        });
                        
        
Debug.writeacp.hooks.languageMax );
        
    },
    
    
addAnotherTemplate: function( )
    {
        
Event.stop(e);
        
        var 
id parseIntacp.hooks.skinMax ) + 1;
        
        var 
url ipb.vars['base_url'] + "app=core&amp;module=ajax&amp;section=hooks&amp;do=getSkinFiles&amp;secure_key=" ipb.vars['md5_hash'] + "&id=" acp.hooks.hookID "&i=" id;
        
url url.replace( /&amp;/g'&' );
        
        new 
Ajax.Requesturl,
                        {
                            
method'GET',
                            
evalJSONtrue,
                            
onSuccess: function(t)
                            {
                                if( 
Object.isUndefinedt.responseJSON ) || t.responseJSON == null )
                                {
                                    var 
template ipb.templates['skin_row'].evaluate({ 'containerid'id'control't.responseText});
                                    $(
'skin_wrap').inserttemplate );
                                    
                                    
acp.hooks.fields['MF__templates']['fields'].push("templates_" id);
                                    
acp.hooks.fields['MF__templates']['fields'].push("skin_" id);
                                    
acp.hooks.skinMax id;
                                }
                                else
                                {
                                    if( 
t.responseJSON['error'] )
                                    {
                                        
alertt.responseJSON['error'] );
                                    }
                                    else if( 
t.responseJSON['success'] )
                                    {
                                        $(
's_container_' id).updatet.responseJSON['html'] ).show();
                                    }
                                    else
                                    {
                                        
alertt.responseText );
                                    }
                                }
                                
                            }
                        });
                        
        
Debug.writeacp.hooks.skinMax );
        
    },
    
    
addAnotherDB: function( )
    {
        
Event.stop(e);
        
        var 
id parseIntacp.hooks.dbMax ) + 1;
        var 
wrapper ipb.templates['db_row'].evaluate( { 'id'id } );
        
        $(
'database_wrap').insertwrapper );
        
        
acp.hooks.dbMax id;
        
acp.hooks.fields['MF__database']['fields'].push"type_" id );
    },
    
    
exportHook: function( eidlangurl )
    {
        
Event.stop(e);
        
        
url ipb.vars['base_url'] + url '&secure_key=' ipb.vars['md5_hash'];
        
url url.replace( /&amp;/g'&' );
        
        var 
afterInit = function( popup ){
                            $( 
id '_save' ).observe('click'acp.hooks.saveField.bindAsEventListenerthisid ) );
                            
//Debug.write("This is the callback");
                        
}.bind(this);
                        
        var 
afterHide = function( popup ){
                            $( 
popup.getObj() ).remove();
                            
acp.hooks.popupsid ] = null;
                        }.
bind(this);
        
        
acp.hooks.popupsid ] = new ipb.Popup('m_' id, { type'pane'modaltruehideAtStartfalsew'600px'ajaxURLurl }, { 'afterInit'afterInit'afterHide'afterHide } );
        
        
Debug.write("Hook " id);
    },
    
    
saveField: function( eid )
    {
        
Event.stop(e);

        var 
url acp.hooks.fieldsid ]['url'];
        
        if( !
url ){ alert("Невозможно сохранить; отсутствует url"); return; }
        
        
url ipb.vars['base_url'] + url '&secure_key=' ipb.vars['md5_hash'];
        
url url.replace( /&amp;/g'&' );
        
        
//-----------------

        
var fields acp.hooks.fieldsid ]['fields'];
        var 
_params = {};
        
        if ( 
fields.length )
        {
            for( var 
<= fields.length i++ )
            {
                if( $( 
fields[i] ) )
                {
                    try 
                    {
                        if ( $( 
fields[i] ).type == 'select-multiple' )
                        {
                            
_paramsfields[i] + '[]' ] = $Ffields[i] );
                        }
                        else
                        {
                            
_paramsfields[i] ] = $Ffields[i] );
                        }
                    }
                    catch( 
)
                    {
                        try
                        {
                            
_paramsfields[i] ] = $Ffields[i] + '_yes' );
                        }
                        catch( 
){}
                    }
                }
            }
        }
        
            
// Send request
            
new Ajax.Request(     url, {
                                
method'post',
                                
parameters_params,
                                
evalJSON'force',
                                
onSuccess: function(t)
                                {
                                    if( 
Object.isUndefinedt.responseJSON ) )
                                    {
                                        
alert("An error occurred: " t.responseJSON);
                                        return;
                                    }

                                    if( !
t.responseJSON['success'] )
                                    {
                                        
alert("An error occurred: " t.responseJSON['error'] );
                                        return;
                                    }
                                    else
                                    {
                                        if( 
acp.hooks.fieldsid ]['callback'] )
                                        {
                                            
acp.hooks.fieldsid ]['callback']( tt.responseJSON );
                                        }

                                        
acp.hooks.popupsid ].hide();

                                    }

                                    
Debug.write("Success");
                                },
                                
onException: function(t){ alert("An error occurred: " t.responseText); },
                                
onFailure: function(t){ alert("An error occurred: " t.responseText ); }
                            } );
    }
};

acp.hooks.init();
?>
Онлайн: 3
Реклама