| | |
| | | var tabChangeDiscardTxt = ''; |
| | | var tabChangeWarning = false; |
| | | var tabChangeDiscard = false; |
| | | var requestsRunning = 0; |
| | | var indicatorPaddingH = -1; |
| | | var indicatorPaddingW = -1; |
| | | var indicatorCompleted = false; |
| | | redirect = ''; |
| | | |
| | | function reportError(request) { |
| | |
| | | /*alert(request);*/ |
| | | } |
| | | |
| | | function showLoadIndicator() { |
| | | requestsRunning += 1; |
| | | |
| | | if(requestsRunning < 2) { |
| | | var indicator = jQuery('#ajaxloader'); |
| | | if(indicator.length < 1) { |
| | | indicator = jQuery('<div id="ajaxloader" style="display: none;"></div>'); |
| | | indicator.appendTo('body'); |
| | | } |
| | | var parent = jQuery('#content'); |
| | | if(parent.length < 1) return; |
| | | indicatorCompleted = false; |
| | | |
| | | var atx = parent.offset().left + 150; //((parent.outerWidth(true) - indicator.outerWidth(true)) / 2); |
| | | var aty = parent.offset().top + 150; |
| | | indicator.css( {'left': atx, 'top': aty } ).fadeIn('fast', function() { |
| | | // check if loader should be hidden immediately |
| | | indicatorCompleted = true; |
| | | if(requestsRunning < 1) $(this).fadeOut('fast', function() { $(this).hide();}); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | function hideLoadIndicator() { |
| | | requestsRunning -= 1; |
| | | if(requestsRunning < 1) { |
| | | requestsRunning = 0; // just for the case... |
| | | if(indicatorCompleted == true) jQuery('#ajaxloader').fadeOut('fast', function() { jQuery('#ajaxloader').hide(); } ); |
| | | } |
| | | } |
| | | |
| | | function onAfterContentLoad() { |
| | | $('#pageContent').find("select").combobox(); |
| | | } |
| | | |
| | | function loadContentRefresh(pagename) { |
| | | |
| | | if(document.getElementById('refreshinterval').value > 0) { |
| | |
| | | url: pagename, |
| | | data: "refresh="+document.getElementById('refreshinterval').value, |
| | | dataType: "html", |
| | | beforeSend: function() { |
| | | showLoadIndicator(); |
| | | }, |
| | | success: function(data, textStatus, jqXHR) { |
| | | hideLoadIndicator(); |
| | | jQuery('#pageContent').html(jqXHR.responseText); |
| | | onAfterContentLoad(); |
| | | pageFormChanged = false; |
| | | }, |
| | | error: function() { |
| | | hideLoadIndicator(); |
| | | reportError('Ajax Request was not successful.'+pagename); |
| | | } |
| | | }); |
| | |
| | | url: "capp.php", |
| | | data: "mod="+module+((redirect != undefined) ? '&redirect='+redirect : ''), |
| | | dataType: "html", |
| | | beforeSend: function() { |
| | | showLoadIndicator(); |
| | | }, |
| | | success: function(data, textStatus, jqXHR) { |
| | | if(jqXHR.responseText != '') { |
| | | if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { |
| | |
| | | } |
| | | } |
| | | loadMenus(); |
| | | hideLoadIndicator(); |
| | | }, |
| | | error: function() { |
| | | hideLoadIndicator(); |
| | | reportError('Ajax Request was not successful.'+module); |
| | | } |
| | | }); |
| | |
| | | url: "content.php", |
| | | data: jQuery('#'+formname).serialize(), |
| | | dataType: "html", |
| | | beforeSend: function() { |
| | | showLoadIndicator(); |
| | | }, |
| | | success: function(data, textStatus, jqXHR) { |
| | | if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { |
| | | var parts = jqXHR.responseText.split(':'); |
| | |
| | | document.location.href = 'index.php'; |
| | | } else { |
| | | jQuery('#pageContent').html(jqXHR.responseText); |
| | | onAfterContentLoad(); |
| | | pageFormChanged = false; |
| | | } |
| | | loadMenus(); |
| | | hideLoadIndicator(); |
| | | }, |
| | | error: function() { |
| | | hideLoadIndicator(); |
| | | reportError('Ajax Request was not successful.110'); |
| | | } |
| | | }); |
| | |
| | | url: target, |
| | | data: jQuery('#'+formname).serialize(), |
| | | dataType: "html", |
| | | beforeSend: function() { |
| | | showLoadIndicator(); |
| | | }, |
| | | success: function(data, textStatus, jqXHR) { |
| | | if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { |
| | | var parts = jqXHR.responseText.split(':'); |
| | |
| | | //window.setTimeout('loadContent(redirect)', 1000); |
| | | } else { |
| | | jQuery('#pageContent').html(jqXHR.responseText); |
| | | onAfterContentLoad(); |
| | | pageFormChanged = false; |
| | | } |
| | | hideLoadIndicator(); |
| | | }, |
| | | error: function(jqXHR, textStatus, errorThrown) { |
| | | hideLoadIndicator(); |
| | | var parts = jqXHR.responseText.split(':'); |
| | | reportError('Ajax Request was not successful. 111'); |
| | | } |
| | |
| | | url: target, |
| | | data: jQuery('#'+formname).serialize(), |
| | | dataType: "html", |
| | | beforeSend: function() { |
| | | showLoadIndicator(); |
| | | }, |
| | | success: function(data, textStatus, jqXHR) { |
| | | if(successMessage) alert(successMessage); |
| | | if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { |
| | |
| | | //window.setTimeout('loadContent(redirect)', 1000); |
| | | } else { |
| | | jQuery('#pageContent').html(jqXHR.responseText); |
| | | onAfterContentLoad(); |
| | | pageFormChanged = false; |
| | | } |
| | | hideLoadIndicator(); |
| | | }, |
| | | error: function(jqXHR, textStatus, errorThrown) { |
| | | hideLoadIndicator(); |
| | | var parts = jqXHR.responseText.split(':'); |
| | | reportError('Ajax Request was not successful. 111'); |
| | | } |
| | |
| | | data: (params ? params : null), |
| | | dataType: "html", |
| | | beforeSend: function() { |
| | | jQuery('#pageContent').html('<div id="ajaxloader"><img src="themes/default/images/ajax-loader.gif" /></div>'); |
| | | showLoadIndicator(); |
| | | }, |
| | | success: function(data, textStatus, jqXHR) { |
| | | if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { |
| | |
| | | //jQuery.each(reponseScript, function(idx, val) { eval(val.text); } ); |
| | | |
| | | jQuery('#pageContent').html(jqXHR.responseText); |
| | | onAfterContentLoad(); |
| | | pageFormChanged = false; |
| | | } |
| | | hideLoadIndicator(); |
| | | }, |
| | | error: function() { |
| | | hideLoadIndicator(); |
| | | reportError('Ajax Request was not successful. 113'); |
| | | } |
| | | }); |
| | |
| | | url: "content.php", |
| | | data: "s_mod=login&s_pg=index", |
| | | dataType: "html", |
| | | beforeSend: function() { |
| | | showLoadIndicator(); |
| | | }, |
| | | success: function(data, textStatus, jqXHR) { |
| | | if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { |
| | | var parts = jqXHR.responseText.split(":"); |
| | | loadContent(parts[1]); |
| | | } else { |
| | | jQuery('#pageContent').html(jqXHR.responseText); |
| | | onAfterContentLoad(); |
| | | pageFormChanged = false; |
| | | } |
| | | hideLoadIndicator(); |
| | | }, |
| | | error: function() { |
| | | hideLoadIndicator(); |
| | | reportError('Ajax Request was not successful. 114'); |
| | | } |
| | | }); |
| | |
| | | url: "nav.php", |
| | | data: "nav=side", |
| | | dataType: "html", |
| | | beforeSend: function() { |
| | | showLoadIndicator(); |
| | | }, |
| | | success: function(data, textStatus, jqXHR) { |
| | | hideLoadIndicator(); |
| | | jQuery('#sideNav').html(jqXHR.responseText); |
| | | }, |
| | | error: function() { |
| | | hideLoadIndicator(); |
| | | reportError('Ajax Request was not successful. 115'); |
| | | } |
| | | }); |
| | |
| | | url: "nav.php", |
| | | data: "nav=top", |
| | | dataType: "html", |
| | | beforeSend: function() { |
| | | showLoadIndicator(); |
| | | }, |
| | | success: function(data, textStatus, jqXHR) { |
| | | hideLoadIndicator(); |
| | | jQuery('#topNav').html(jqXHR.responseText); |
| | | }, |
| | | error: function(o) { |
| | | hideLoadIndicator(); |
| | | reportError('Ajax Request was not successful. 116'); |
| | | } |
| | | }); |
| | |
| | | var pageContentObject2 = jQuery.ajax({ type: "GET", |
| | | url: pagename, |
| | | dataType: "html", |
| | | beforeSend: function() { |
| | | // showLoadIndicator(); |
| | | }, |
| | | success: function(data, textStatus, jqXHR) { |
| | | // hideLoadIndicator(); |
| | | jQuery('#'+elementid).html(jqXHR.responseText); |
| | | }, |
| | | error: function() { |
| | | // hideLoadIndicator(); |
| | | reportError('Ajax Request was not successful. 118'); |
| | | } |
| | | }); |
| | |
| | | var pageContentObject2 = jQuery.ajax({ type: "GET", |
| | | url: pagename, |
| | | dataType: "html", |
| | | beforeSend: function() { |
| | | // showLoadIndicator(); |
| | | }, |
| | | success: function(data, textStatus, jqXHR) { |
| | | // hideLoadIndicator(); |
| | | var teste = jqXHR.responseText; |
| | | var elemente = teste.split('#'); |
| | | el=document.getElementById(elementid); |
| | |
| | | } |
| | | }, |
| | | error: function() { |
| | | // hideLoadIndicator(); |
| | | reportError('Ajax Request was not successful. 119'); |
| | | } |
| | | }); |