// Rivisat_ajax.js // Created on Mar 30, 2007 // @author Habes Alkhraisat node_array= new Array(); label_array= new Array(); errorflag=0; var RivistaAjax = { result:false, url:"/core/ajaxserver.php?sid=" + new Date().getTime(), ER:"We're so sorry, the server is busy right now please try again", iconon_array :new Array(), iconoff_array: new Array(), asynchronous:false, doAjaxCall:function(params,method,callback){ var myAjax = new Ajax.Request( this.url, { method: method, parameters: params, asynchronous:this.asynchronous, setrequestheaders:['Cache-Control: no-store, no-cache, must-revalidate','Accept-Encoding: compress, gzip'], onfailure:function(){alert(this.ER);}, onComplete: callback }); }, doToggleField: function(node,params,label,iconon,iconoff) { label_array.push(label); node_array.push(node); params = "req=toggle&"+params; RivistaAjax.iconon_array.push(iconon); RivistaAjax.iconoff_array.push(iconoff); node.childNodes[0].src = "/admin/media/images/ajax-loader.gif"; RivistaAjax.doAjaxCall(params,"GET",RivistaAjax.doToggleField_handler); }, doToggleField_handler:function(transport){ if (transport.readyState == 4 && transport.status == 200){ if(transport.responseText){ node_t = node_array.shift(); iconon=RivistaAjax.iconon_array.shift(); iconoff=RivistaAjax.iconoff_array.shift(); label_t = label_array.shift().split('|'); if(transport.responseText.trim()=='f'){ node_t.childNodes[0].src = "/admin/media/images/red-button.gif"; node_t.childNodes[0].alt= label_t[0]; node_t.childNodes[0].title= label_t[0]; RivistaAjax.changeAllRelated(node_t.childNodes[0].src,node_t.childNodes[0].id,label_t[0]); } else{ node_t.childNodes[0].src = "/admin/media/images/green-button.gif"; node_t.childNodes[0].alt= label_t[1]; node_t.childNodes[0].title= label_t[1]; RivistaAjax.changeAllRelated(node_t.childNodes[0].src,node_t.childNodes[0].id,label_t[1]); } } } }, changeAllRelated:function(imgsrc,id,n_label){ var imgs; imgs =document.getElementsByTagName('img'); for (i=0;i"); $('eventContainer').hide(); $('ajaxloader').show(); RivistaAjax.doAjaxCall(params,"GET",RivistaAjax.loadCalendar_handler); }, loadCalendar_handler:function(transport){ if(transport.responseText){ if($('mini_view')!=null && $('mini_view').innerHTML !='') $('eventContainer').update(transport.responseText); else $('calendar').replace(transport.responseText); $('ajaxloader').hide(); $('eventContainer').show(); } }, doSwitch:function(obj,container,newClass,classStyle){ $(container).select('.'+classStyle).each(function (element){element.removeClassName(classStyle);}); obj.className=classStyle; } }