redirect = ''; function reportError(request) { /* Error reporting is disabled by default as some browsers like safari sometimes throw errors when a ajax request is delayed even if the ajax request worked. */ /*alert(request);*/ } function loadContentRefresh(pagename) { /* var pageContentCallbackRefresh = { success: function(o) { document.getElementById('pageContent').innerHTML = o.responseText; }, failure: function(o) { reportError('Ajax Request was not successful.'+pagename); } } */ if(document.getElementById('refreshinterval').value > 0) { /*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename+"&refresh="+document.getElementById('refreshinterval').value, pageContentCallbackRefresh);*/ var pageContentObject2 = jQuery.ajax({ type: "GET", url: pagename, data: "refresh="+document.getElementById('refreshinterval').value, dataType: "html", success: function(data, textStatus, jqXHR) { //document.getElementById('pageContent').innerHTML = jqXHR.responseText; jQuery('#pageContent').html(jqXHR.responseText); }, error: function() { reportError('Ajax Request was not successful.'+pagename); }, }); setTimeout( "loadContentRefresh('"+pagename+"&refresh="+document.getElementById('refreshinterval').value+"')", document.getElementById('refreshinterval').value*1000 ); } } function capp(module) { /* var cappCallback = { success: function(o) { if(o.responseText != '') { if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = o.responseText.split(':'); loadContent(parts[1]); } else { alert(o.responseText); } } loadMenus(); }, failure: function(o) { reportError('Ajax Request was not successful.'+module); } } */ /*var submitFormObj = YAHOO.util.Connect.asyncRequest('GET', 'capp.php?mod='+module, cappCallback);*/ var submitFormObj = jQuery.ajax({ type: "GET", url: "capp.php", data: "mod="+module, dataType: "html", success: function(data, textStatus, jqXHR) { if(jqXHR.responseText != '') { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = jqXHR.responseText.split(':'); loadContent(parts[1]); } else { alert(jqXHR.responseText); } } loadMenus(); }, error: function() { reportError('Ajax Request was not successful.'+module); }, }); } function submitLoginForm(formname) { //* Validate form. TODO: username and password with strip(); var frm = document.getElementById(formname); var userNameObj = frm.username; if(userNameObj.value == ''){ userNameObj.focus(); return; } var passwordObj = frm.passwort; if(passwordObj.value == ''){ passwordObj.focus(); return; } /*YAHOO.util.Connect.setForm(formname);*/ /*var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', 'content.php', submitFormCallback);*/ var submitFormObj = jQuery.ajax({ type: "POST", url: "content.php", data: jQuery('#'+formname).serialize(), dataType: "html", success: function(data, textStatus, jqXHR) { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = jqXHR.responseText.split(':'); //alert(parts[1]); loadContent(parts[1]); //redirect = parts[1]; //window.setTimeout('loadContent(redirect)', 1000); } else if (jqXHR.responseText.indexOf('LOGIN_REDIRECT:') > -1) { // Go to the login page document.location.href = 'index.php'; } else { //document.getElementById('pageContent').innerHTML = jqXHR.responseText; jQuery('#pageContent').html(jqXHR.responseText); } loadMenus(); }, error: function() { reportError('Ajax Request was not successful.110'); }, }); /* if(redirect != '') { loadContent(redirect); redirect = ''; } document.getElementById('footer').innerHTML = 'Powered by ISPConfig'; */ } function submitForm(formname,target) { /* var submitFormCallback = { success: function(o) { if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = o.responseText.split(':'); //alert(parts[1]); loadContent(parts[1]); //redirect = parts[1]; //window.setTimeout('loadContent(redirect)', 1000); } else { document.getElementById('pageContent').innerHTML = o.responseText; } }, failure: function(o) { var parts = o.responseText.split(':'); reportError('Ajax Request was not successful. 111'); } } */ /*YAHOO.util.Connect.setForm(formname);*/ /*var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', target, submitFormCallback);*/ var submitFormObj = jQuery.ajax({ type: "POST", url: target, data: jQuery('#'+formname).serialize(), dataType: "html", success: function(data, textStatus, jqXHR) { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = jqXHR.responseText.split(':'); //alert(parts[1]); loadContent(parts[1]); //redirect = parts[1]; //window.setTimeout('loadContent(redirect)', 1000); } else { //document.getElementById('pageContent').innerHTML = jqXHR.responseText; jQuery('#pageContent').html(jqXHR.responseText); } }, error: function(jqXHR, textStatus, errorThrown) { var parts = jqXHR.responseText.split(':'); reportError('Ajax Request was not successful. 111'); }, }); /* if(redirect != '') { loadContent(redirect); redirect = ''; } */ } function submitUploadForm(formname,target) { /* var submitFormCallback = { success: function(o) { if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = o.responseText.split(':'); //alert(parts[1]); loadContent(parts[1]); //redirect = parts[1]; //window.setTimeout('loadContent(redirect)', 1000); } else { document.getElementById('pageContent').innerHTML = o.responseText; } }, upload: function(o) { if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = o.responseText.split(':'); //alert(parts[1]); loadContent(parts[1]); //redirect = parts[1]; //window.setTimeout('loadContent(redirect)', 1000); } else { document.getElementById('pageContent').innerHTML = o.responseText; } }, failure: function(o) { reportError('Ajax Request was not successful. 112'); } } */ /*YAHOO.util.Connect.setForm(formname,true);*/ /*var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', target, submitFormCallback);*/ /* var submitFormObj = jQuery.ajax({ type: "POST", url: target, data: jQuery('#'+formname).serialize(), dataType: "html", success: function(data, textStatus, jqXHR) { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { var parts = jqXHR.responseText.split(':'); //alert(parts[1]); loadContent(parts[1]); //redirect = parts[1]; //window.setTimeout('loadContent(redirect)', 1000); } else { //document.getElementById('pageContent').innerHTML = jqXHR.responseText; jQuery('#pageContent').html(jqXHR.responseText); } }, error: function() { reportError('Ajax Request was not successful. 112'); }, }); */ //var submitFormObj = jQuery('input[type="file"]').ajaxfileupload({ 'action': target }); var handleResponse = function(loadedFrame) { var response, responseStr = loadedFrame.contentWindow.document.body.innerHTML; try { response = JSON.parse(responseStr); } catch(e) { response = responseStr; } var msg = ''; var okmsg = jQuery('#OKMsg',response).html(); if(okmsg){ msg = '
'+okmsg+'
'; } var errormsg = jQuery('#errorMsg',response).html(); if(errormsg){ msg = msg+'
'+errormsg+'
'; } return msg; }; var frame_id = 'ajaxUploader-iframe-' + Math.round(new Date().getTime() / 1000); jQuery('body').after('