From a84ff46ff8c731a321ae87bea0e05d3fef3aceae Mon Sep 17 00:00:00 2001 From: mcramer <m.cramer@pixcept.de> Date: Tue, 09 Oct 2012 07:29:34 -0400 Subject: [PATCH] Bugfix: removed some columns from being sortable --- interface/web/js/scrigo.js.php | 151 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 133 insertions(+), 18 deletions(-) diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php index 4146127..b3029f3 100644 --- a/interface/web/js/scrigo.js.php +++ b/interface/web/js/scrigo.js.php @@ -9,6 +9,9 @@ var tabChangeDiscardTxt = ''; var tabChangeWarning = false; var tabChangeDiscard = false; +var requestsRunning = 0; +var indicatorPaddingH = -1; +var indicatorPaddingW = -1; redirect = ''; function reportError(request) { @@ -19,6 +22,43 @@ /*alert(request);*/ } +function showLoadIndicator() { + requestsRunning += 1; + + 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; + + 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'); + + /*var atx = parent.offset().left; + var aty = parent.offset().top; + if(indicatorPaddingW == -1) indicatorPaddingW = parseInt(indicator.css('padding-left')) + parseInt(indicator.css('padding-right')); + if(indicatorPaddingH == -1) indicatorPaddingH = parseInt(indicator.css('padding-top')) + parseInt(indicator.css('padding-bottom')); + var atw = parent.outerWidth() - indicatorPaddingW; + var ath = parent.outerHeight() - indicatorPaddingH; + + indicator.css( {'left': atx, 'top': aty, 'width': atw, 'height': ath } ).fadeIn('fast');*/ +} + +function hideLoadIndicator() { + requestsRunning -= 1; + if(requestsRunning < 1) { + jQuery('#ajaxloader').fadeOut('fast', function() { jQuery('#ajaxloader').hide(); } ); + requestsRunning = 0; // just for the case... + } +} + +function onAfterContentLoad() { + $('#pageContent').find("select").combobox(); +} + function loadContentRefresh(pagename) { if(document.getElementById('refreshinterval').value > 0) { @@ -26,13 +66,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,7 +89,11 @@ url: "capp.php", data: "mod="+module+((redirect != undefined) ? '&redirect='+redirect : ''), dataType: "html", + beforeSend: function() { + showLoadIndicator(); + }, success: function(data, textStatus, jqXHR) { + hideLoadIndicator(); if(jqXHR.responseText != '') { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = jqXHR.responseText.split(':'); @@ -58,8 +108,9 @@ loadMenus(); }, error: function() { + hideLoadIndicator(); reportError('Ajax Request was not successful.'+module); - }, + } }); } @@ -80,7 +131,11 @@ url: "content.php", data: jQuery('#'+formname).serialize(), dataType: "html", + beforeSend: function() { + showLoadIndicator(); + }, success: function(data, textStatus, jqXHR) { + hideLoadIndicator(); if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = jqXHR.responseText.split(':'); //alert(parts[1]); @@ -92,13 +147,15 @@ document.location.href = 'index.php'; } else { jQuery('#pageContent').html(jqXHR.responseText); + onAfterContentLoad(); pageFormChanged = false; } loadMenus(); }, error: function() { + hideLoadIndicator(); reportError('Ajax Request was not successful.110'); - }, + } }); /* if(redirect != '') { @@ -115,7 +172,11 @@ url: target, data: jQuery('#'+formname).serialize(), dataType: "html", + beforeSend: function() { + showLoadIndicator(); + }, success: function(data, textStatus, jqXHR) { + hideLoadIndicator(); if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = jqXHR.responseText.split(':'); //alert(parts[1]); @@ -124,13 +185,15 @@ //window.setTimeout('loadContent(redirect)', 1000); } else { jQuery('#pageContent').html(jqXHR.responseText); + onAfterContentLoad(); pageFormChanged = false; } }, error: function(jqXHR, textStatus, errorThrown) { + hideLoadIndicator(); var parts = jqXHR.responseText.split(':'); reportError('Ajax Request was not successful. 111'); - }, + } }); /* if(redirect != '') { @@ -147,7 +210,11 @@ url: target, data: jQuery('#'+formname).serialize(), dataType: "html", + beforeSend: function() { + showLoadIndicator(); + }, success: function(data, textStatus, jqXHR) { + hideLoadIndicator(); if(successMessage) alert(successMessage); if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = jqXHR.responseText.split(':'); @@ -157,13 +224,15 @@ //window.setTimeout('loadContent(redirect)', 1000); } else { jQuery('#pageContent').html(jqXHR.responseText); + onAfterContentLoad(); pageFormChanged = false; } }, error: function(jqXHR, textStatus, errorThrown) { + hideLoadIndicator(); var parts = jqXHR.responseText.split(':'); reportError('Ajax Request was not successful. 111'); - }, + } }); } } @@ -216,9 +285,10 @@ 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) { + hideLoadIndicator(); if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = jqXHR.responseText.split(':'); loadContent(parts[1]); @@ -232,12 +302,14 @@ //jQuery.each(reponseScript, function(idx, val) { eval(val.text); } ); jQuery('#pageContent').html(jqXHR.responseText); + onAfterContentLoad(); pageFormChanged = false; } }, error: function() { + hideLoadIndicator(); reportError('Ajax Request was not successful. 113'); - }, + } }); } @@ -247,18 +319,24 @@ url: "content.php", data: "s_mod=login&s_pg=index", dataType: "html", + beforeSend: function() { + showLoadIndicator(); + }, success: function(data, textStatus, jqXHR) { + hideLoadIndicator(); if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = jqXHR.responseText.split(":"); loadContent(parts[1]); } else { jQuery('#pageContent').html(jqXHR.responseText); + onAfterContentLoad(); pageFormChanged = false; } }, error: function() { + hideLoadIndicator(); reportError('Ajax Request was not successful. 114'); - }, + } }); loadMenus(); @@ -269,7 +347,7 @@ function setFocus() { try { - document.pageForm.username.focus(); + jQuery('form#pageForm').find('input[name="username"]').focus(); } catch (e) { } } @@ -280,36 +358,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 +436,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 +454,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 +472,9 @@ } }, error: function() { + hideLoadIndicator(); reportError('Ajax Request was not successful. 119'); - }, + } }); } @@ -389,7 +487,7 @@ }, error: function() { reportError('Session expired. Please login again.'); - }, + } }); //setTimeout( keepalive, 1000000 ); } @@ -601,6 +699,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 +708,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 +736,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