Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/02/2009, 06:33
Avatar de MaTyS
MaTyS
 
Fecha de Ingreso: enero-2009
Ubicación: Mar del Plata
Mensajes: 220
Antigüedad: 15 años, 10 meses
Puntos: 18
Respuesta: [APORTE] Calendario {usando: AJAX, PHP y MySQL}

ajax_queue.js {PARTE 2}
Código PHP:
c_ajax_object.prototype.CallXMLHTTPObjectPOSTParam = function ( in_urlin_callbackin_param ) {
    return 
this.CallXMLHTTPObject in_urlin_callback"POST"in_paramnull);
}
c_ajax_object.prototype.CallXMLHTTPObjectPOSTParamPartial = function ( in_urlin_callbackin_paramin_pcallbackin_param2 ) {
    return 
this.CallXMLHTTPObject in_urlin_callback"POST"in_paramin_pcallbackin_param2);
}
c_ajax_object.prototype.CallXMLHTTPObjectPOSTParamPartialPhase = function ( in_urlin_callbackin_paramin_pcallbackin_param2in_phase ) {
    return 
this.CallXMLHTTPObject in_urlin_callback"POST"in_paramin_pcallbackin_param2in_phase );
}
c_ajax_object.prototype.CallXMLHTTPObject = function ( in_urlin_callbackin_methodin_paramin_pcallbackin_param2in_phase ) {
    
this._dm_pre_queue_in_url=in_url;
    
this._dm_pre_queue_in_callback=in_callback;
    
this._dm_pre_queue_in_method=in_method;
    
this._dm_pre_queue_in_param=in_param;
    
this._dm_pre_queue_in_pcallback=in_pcallback;
    
this._dm_pre_queue_in_param2=in_param2;
    
this._dm_pre_queue_in_c2_phase=in_phase;
    if ( (
this._dm_pre_queue_in_c2_phase 1) || (this._dm_pre_queue_in_c2_phase 3) ) {
        
this._dm_pre_queue_in_c2_phase 3;
        }
    
this.Enqueue();
    return 
true;
};
c_ajax_object.prototype.Enqueue = function ( ) {
    
this._dm_queue[this._dm_queue.length] = new Array ( this._dm_pre_queue_in_urlthis._dm_pre_queue_in_callback,
        
this._dm_pre_queue_in_methodthis._dm_pre_queue_in_paramthis._dm_pre_queue_in_pcallback,
        
this._dm_pre_queue_in_param2this._dm_pre_queue_in_c2_phase );
    
this._dm_pre_queue_in_url=null;
    
this._dm_pre_queue_in_callback=null;
    
this._dm_pre_queue_in_method=null;
    
this._dm_pre_queue_in_param=null;
    
this._dm_pre_queue_in_pcallback=null;
    
this._dm_pre_queue_in_param2=null;
    
this._dm_pre_queue_in_c2_phase=0;
    if ( !
this._dm_xmlhttprequestobject ) {
        
this.Dequeue();
        }
};
c_ajax_object.prototype.Dequeue = function ( ) {
    var 
command null;
    var 
ret=false;
    
    if ( 
this._dm_queue.length && this._dm_queue_state ) {
        
command this._dm_queue[0];
        
        var 
url command[0];
        
this._dm_callback_function command[1];
        var 
method command[2];
        
this._dm_param command[3];
        
this._dm_partialcallback_function command[4];    
        
this._dm_param2 command[5];    
        
this._dm_phase command[6];
        
        for ( var 
counter 1counter this._dm_queue.lengthcounter++ ) {
            
this._dm_queue[counter 1] = this._dm_queue[counter];
            }
        
        
this._dm_queue.length counter 1;
        }
    
    if ( 
url && method ) {
        
ret this._CallXMLHTTPObject urlmethod );
        }
    
    return 
ret;
};
c_ajax_object.prototype._CallXMLHTTPObject = function ( in_urlin_method ) {
    try {
        var 
sVars null;
        if ( 
in_method == "POST" ) {
            var 
rmatch = /^([^?]*)?(.*)$/.exec in_url );
            
in_url rmatch[1];
            
sVars unescape rmatch[2] );
            }
        
        
this._dm_committed false;
        
this.GetNewRequestObject();
        
this._dm_xmlhttprequestobject.open(in_methodin_urltrue);
        
        if ( 
in_method == "POST" ) {
          
this._dm_xmlhttprequestobject.setRequestHeader("Method""POST "+in_url+" HTTP/1.1");
          
this._dm_xmlhttprequestobject.setRequestHeader("Content-Type""application/x-www-form-urlencoded");
            }
        
        
this._dm_xmlhttprequestobject.onreadystatechange Handle_HTTP_Response;
        
this._dm_xmlhttprequestobject.send(sVars);
        
        return 
true;
        }
    catch ( 
) { }
    
    return 
false;
};
function 
Handle_HTTP_Response () {
    var 
ie navigator.appName=='Microsoft Internet Explorer';
    
    if ( 
g_ajax_obj && g_ajax_obj._dm_xmlhttprequestobject ) {    
        if ( 
g_ajax_obj._dm_xmlhttprequestobject.readyState == ) {
            }
        else {
            if ( 
g_ajax_obj._dm_xmlhttprequestobject.readyState == ) {
                if ( 
g_ajax_obj._dm_phase == g_ajax_obj._dm_xmlhttprequestobject.readyState ) {
                    if ( 
g_ajax_obj._dm_partialcallback_function ) {
                        var 
resp;
                        if(!
ie && g_ajax_obj._dm_xmlhttprequestobject.responseText){
                            
resp=g_ajax_obj._dm_xmlhttprequestobject.responseText;
                            }
                        
g_ajax_obj._dm_partialcallback_function respg_ajax_obj._dm_param2 g_ajax_obj._dm_param2 g_ajax_obj._dm_param );
                        }
                    }
                }
            else {
                if ( 
g_ajax_obj._dm_xmlhttprequestobject.readyState == ) {
                    if ( 
g_ajax_obj._dm_phase == g_ajax_obj._dm_xmlhttprequestobject.readyState ) {
                        if ( 
g_ajax_obj._dm_partialcallback_function ) {
                            var 
resp;
                            if(!
ie && g_ajax_obj._dm_xmlhttprequestobject.responseText){
                                
resp=g_ajax_obj._dm_xmlhttprequestobject.responseText;
                                }
                            
g_ajax_obj._dm_partialcallback_function respg_ajax_obj._dm_param2 g_ajax_obj._dm_param2 g_ajax_obj._dm_param );
                            }
                        }
                    }
                else {
                    if ( 
g_ajax_obj._dm_xmlhttprequestobject.readyState == ) {    // Interactive
                        
g_ajax_obj._dm_committed true;
                        if ( 
g_ajax_obj._dm_phase == g_ajax_obj._dm_xmlhttprequestobject.readyState ) {
                            if ( 
g_ajax_obj._dm_partialcallback_function ) {
                                var 
resp;
                                if(!
ie && g_ajax_obj._dm_xmlhttprequestobject.responseText){
                                    
resp=g_ajax_obj._dm_xmlhttprequestobject.responseText;
                                    }
                                
g_ajax_obj._dm_partialcallback_function respg_ajax_obj._dm_param2 g_ajax_obj._dm_param2 g_ajax_obj._dm_param );
                                }
                            }
                        }
                    else {
                        if ( 
g_ajax_obj._dm_xmlhttprequestobject.readyState == ) {    // We're done. Back to you.
                            
g_ajax_obj._dm_callback_function g_ajax_obj._dm_xmlhttprequestobject.responseTextg_ajax_obj._dm_paramg_ajax_obj._dm_param2 );
                            if( 
typeof g_ajax_obj != 'undefined' ) { // Just in case they nuked the object in the callback.
                                
g_ajax_obj._dm_xmlhttprequestobject null;    // Kill the request object. we're done.
                                
g_ajax_obj._dm_committed false;
                                
g_ajax_obj._dm_phase 0;
                                
g_ajax_obj.Dequeue();
                                }}}}}}}
return 
true;
};
if (
typeof SupportsAjax == 'undefined'){    // In case we included ajax_threads.js
    
function SupportsAjax ( ) {
        var 
test_obj = new c_ajax_object;
        
        if( 
typeof test_obj != 'undefined' ) {
            
test_obj.GetNewRequestObject();
            
            if ( 
test_obj._dm_xmlhttprequestobject ) {
                
test_obj._dm_xmlhttprequestobject null;
                
test_obj null;
                return 
true;
                }
            
            
test_obj null;
            }        
        return 
false;
    };}
function 
SimpleAJAXCall in_uriin_callbackin_methodin_param ) {
    if ( (
typeof in_method == 'undefined') || ((in_method != 'GET')&&(in_method != 'POST')) ) {
        
in_method 'GET';
        }
    
in_method in_method.toUpperCase();
    if ( 
SupportsAjax() && (typeof in_uri != 'undefined') && in_uri && (typeof in_callback == 'function') ) {
        if ( 
in_method == 'POST' ) {
            return 
g_ajax_obj.CallXMLHTTPObjectPOSTParam in_uriin_callbackin_param );
            } else {            return 
g_ajax_obj.CallXMLHTTPObjectGETParam in_uriin_callbackin_param );
            }        } else {            return 
false;        }}; 
Continua en otro post...