From aa78fde6a92f66b84d626e114d8b54a5fb6ece0c Mon Sep 17 00:00:00 2001 From: ftimme <ft@falkotimme.com> Date: Wed, 14 Nov 2012 07:19:43 -0500 Subject: [PATCH] - Added function for IPv6 prefixes in multiserver mirror setups to nginx plugin. --- interface/web/js/scrigo.js.php | 150 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 132 insertions(+), 18 deletions(-) diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php index 4146127..1051905 100644 --- a/interface/web/js/scrigo.js.php +++ b/interface/web/js/scrigo.js.php @@ -9,6 +9,10 @@ var tabChangeDiscardTxt = ''; var tabChangeWarning = false; var tabChangeDiscard = false; +var requestsRunning = 0; +var indicatorPaddingH = -1; +var indicatorPaddingW = -1; +var indicatorCompleted = false; redirect = ''; function reportError(request) { @@ -19,6 +23,41 @@ /*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) { @@ -26,13 +65,19 @@ 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); - }, + } }); setTimeout( "loadContentRefresh('"+pagename+"&refresh="+document.getElementById('refreshinterval').value+"')", document.getElementById('refreshinterval').value*1000 ); } @@ -43,6 +88,9 @@ 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) { @@ -56,10 +104,12 @@ } } loadMenus(); + hideLoadIndicator(); }, error: function() { + hideLoadIndicator(); reportError('Ajax Request was not successful.'+module); - }, + } }); } @@ -80,6 +130,9 @@ 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(':'); @@ -92,13 +145,16 @@ 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'); - }, + } }); /* if(redirect != '') { @@ -115,6 +171,9 @@ 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(':'); @@ -124,13 +183,16 @@ //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'); - }, + } }); /* if(redirect != '') { @@ -147,6 +209,9 @@ 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) { @@ -157,13 +222,16 @@ //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'); - }, + } }); } } @@ -216,7 +284,7 @@ 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) { @@ -232,12 +300,15 @@ //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'); - }, + } }); } @@ -247,18 +318,24 @@ 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'); - }, + } }); loadMenus(); @@ -269,7 +346,7 @@ function setFocus() { try { - document.pageForm.username.focus(); + jQuery('form#pageForm').find('input[name="username"]').focus(); } catch (e) { } } @@ -280,36 +357,46 @@ 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'); - }, + } }); var topNavObject = jQuery.ajax({ type: "GET", 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'); - }, + } }); } -function changeTab(tab,target) { +function changeTab(tab,target,force) { //document.forms[0].next_tab.value = tab; document.pageForm.next_tab.value = tab; var idel = jQuery('form#pageForm').find('[name="id"]'); var id = null; if(idel.length > 0) id = idel.val(); - if(tabChangeDiscard == 'y') { + if(tabChangeDiscard == 'y' && !force) { if((idel.length < 1 || id) && (pageFormChanged == false || window.confirm(tabChangeDiscardTxt))) { var next_tab = tab; if(id) loadContent(target, {'next_tab': next_tab, 'id': id}); @@ -348,12 +435,17 @@ 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'); - }, + } }); } @@ -361,7 +453,11 @@ 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); @@ -375,8 +471,9 @@ } }, error: function() { +// hideLoadIndicator(); reportError('Ajax Request was not successful. 119'); - }, + } }); } @@ -389,7 +486,7 @@ }, error: function() { reportError('Session expired. Please login again.'); - }, + } }); //setTimeout( keepalive, 1000000 ); } @@ -601,6 +698,8 @@ newPWField.attr('id', passwordFieldID).val(pword).trigger('keyup'); } +var funcDisableClick = function(e) { e.preventDefault(); return false; }; + function checkPassMatch(pwField1,pwField2){ var rpass = jQuery('#'+pwField2).val(); var npass = jQuery('#'+pwField1).val(); @@ -608,13 +707,22 @@ jQuery('#confirmpasswordOK').hide(); jQuery('#confirmpasswordError').show(); jQuery('button.positive').attr('disabled','disabled'); - jQuery('.tabbox_tabs ul li a').attr('onclick','return false;'); + jQuery('.tabbox_tabs ul li a').each(function() { + var $this = $(this); + $this.data('saved_onclick', $this.attr('onclick')); + $this.removeAttr('onclick'); + $this.click(funcDisableClick); + }); return false; } else { jQuery('#confirmpasswordError').hide(); jQuery('#confirmpasswordOK').show(); jQuery('button.positive').removeAttr('disabled'); - jQuery('.tabbox_tabs ul li a').removeAttr('onclick'); + jQuery('.tabbox_tabs ul li a').each(function() { + var $this = $(this); + $this.unbind('click', funcDisableClick); + if($this.data('saved_onclick') && !$this.attr('onclick')) $this.attr('onclick', $this.data('saved_onclick')); + }); } } @@ -627,6 +735,12 @@ var template = jQuery(this).siblings(':input'); template.insertAtCaret(placeholderText); }); + +jQuery('.addPlaceholderContent').live("click", function(){ + var placeholderContentText = jQuery(this).find('.addPlaceholderContent').text(); + var template2 = jQuery(this).siblings(':input'); + template2.insertAtCaret(placeholderContentText); +}); jQuery.fn.extend({ insertAtCaret: function(myValue){ -- Gitblit v1.9.1