Commit eee9102c authored by Falko Timme's avatar Falko Timme
Browse files

- FS#1667 - Replace YUI with jquery in ISPConfig

parent 402bb36d
This diff is collapsed.
...@@ -16,6 +16,7 @@ function reportError(request) { ...@@ -16,6 +16,7 @@ function reportError(request) {
} }
function loadContentRefresh(pagename) { function loadContentRefresh(pagename) {
/*
var pageContentCallbackRefresh = { var pageContentCallbackRefresh = {
success: function(o) { success: function(o) {
document.getElementById('pageContent').innerHTML = o.responseText; document.getElementById('pageContent').innerHTML = o.responseText;
...@@ -24,14 +25,26 @@ function loadContentRefresh(pagename) { ...@@ -24,14 +25,26 @@ function loadContentRefresh(pagename) {
reportError('Ajax Request was not successful.'+pagename); reportError('Ajax Request was not successful.'+pagename);
} }
} }
*/
if(document.getElementById('refreshinterval').value > 0) { if(document.getElementById('refreshinterval').value > 0) {
var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename+"&refresh="+document.getElementById('refreshinterval').value, pageContentCallbackRefresh); /*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,
success: function(data, textStatus, jqXHR) {
document.getElementById('pageContent').innerHTML = jqXHR.responseText;
},
error: function() {
reportError('Ajax Request was not successful.'+pagename);
},
});
setTimeout( "loadContentRefresh('"+pagename+"&refresh="+document.getElementById('refreshinterval').value+"')", document.getElementById('refreshinterval').value*1000 ); setTimeout( "loadContentRefresh('"+pagename+"&refresh="+document.getElementById('refreshinterval').value+"')", document.getElementById('refreshinterval').value*1000 );
} }
} }
function capp(module) { function capp(module) {
/*
var cappCallback = { var cappCallback = {
success: function(o) { success: function(o) {
if(o.responseText != '') { if(o.responseText != '') {
...@@ -48,31 +61,30 @@ function capp(module) { ...@@ -48,31 +61,30 @@ function capp(module) {
reportError('Ajax Request was not successful.'+module); reportError('Ajax Request was not successful.'+module);
} }
} }
var submitFormObj = YAHOO.util.Connect.asyncRequest('GET', 'capp.php?mod='+module, cappCallback); */
} /*var submitFormObj = YAHOO.util.Connect.asyncRequest('GET', 'capp.php?mod='+module, cappCallback);*/
var submitFormObj = jQuery.ajax({ type: "GET",
function submitLoginForm(formname) { url: "capp.php",
data: "mod="+module,
var submitFormCallback = { success: function(data, textStatus, jqXHR) {
success: function(o) { if(jqXHR.responseText != '') {
if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
var parts = o.responseText.split(':'); var parts = jqXHR.responseText.split(':');
//alert(parts[1]);
loadContent(parts[1]); loadContent(parts[1]);
//redirect = parts[1];
//window.setTimeout('loadContent(redirect)', 1000);
} else if (o.responseText.indexOf('LOGIN_REDIRECT:') > -1) {
// Go to the login page
document.location.href = 'index.php';
} else { } else {
document.getElementById('pageContent').innerHTML = o.responseText; alert(jqXHR.responseText);
}
} }
loadMenus(); loadMenus();
}, },
failure: function(o) { error: function() {
reportError('Ajax Request was not successful.110'); reportError('Ajax Request was not successful.'+module);
} },
} });
}
function submitLoginForm(formname) {
//* Validate form. TODO: username and password with strip(); //* Validate form. TODO: username and password with strip();
var frm = document.getElementById(formname); var frm = document.getElementById(formname);
...@@ -86,8 +98,30 @@ function submitLoginForm(formname) { ...@@ -86,8 +98,30 @@ function submitLoginForm(formname) {
passwordObj.focus(); passwordObj.focus();
return; return;
} }
YAHOO.util.Connect.setForm(formname); /*YAHOO.util.Connect.setForm(formname);*/
var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', 'content.php', submitFormCallback); /*var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', 'content.php', submitFormCallback);*/
var submitFormObj = jQuery.ajax({ type: "POST",
url: "content.php",
data: jQuery('#'+formname).serialize(),
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;
}
loadMenus();
},
error: function() {
reportError('Ajax Request was not successful.110');
},
});
/* /*
if(redirect != '') { if(redirect != '') {
loadContent(redirect); loadContent(redirect);
...@@ -99,7 +133,7 @@ function submitLoginForm(formname) { ...@@ -99,7 +133,7 @@ function submitLoginForm(formname) {
} }
function submitForm(formname,target) { function submitForm(formname,target) {
/*
var submitFormCallback = { var submitFormCallback = {
success: function(o) { success: function(o) {
if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
...@@ -117,9 +151,29 @@ function submitForm(formname,target) { ...@@ -117,9 +151,29 @@ function submitForm(formname,target) {
reportError('Ajax Request was not successful. 111'); reportError('Ajax Request was not successful. 111');
} }
} }
*/
YAHOO.util.Connect.setForm(formname); /*YAHOO.util.Connect.setForm(formname);*/
var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', target, submitFormCallback); /*var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', target, submitFormCallback);*/
var submitFormObj = jQuery.ajax({ type: "POST",
url: target,
data: jQuery('#'+formname).serialize(),
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;
}
},
error: function(jqXHR, textStatus, errorThrown) {
var parts = jqXHR.responseText.split(':');
reportError('Ajax Request was not successful. 111');
},
});
/* /*
if(redirect != '') { if(redirect != '') {
loadContent(redirect); loadContent(redirect);
...@@ -129,7 +183,7 @@ function submitForm(formname,target) { ...@@ -129,7 +183,7 @@ function submitForm(formname,target) {
} }
function submitUploadForm(formname,target) { function submitUploadForm(formname,target) {
/*
var submitFormCallback = { var submitFormCallback = {
success: function(o) { success: function(o) {
if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
...@@ -157,9 +211,65 @@ function submitUploadForm(formname,target) { ...@@ -157,9 +211,65 @@ function submitUploadForm(formname,target) {
reportError('Ajax Request was not successful. 112'); 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(),
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;
}
},
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 = '<div id="OKMsg">'+okmsg+'</div>';
}
var errormsg = jQuery('#errorMsg',response).html();
if(errormsg){
msg = msg+'<div id="errorMsg">'+errormsg+'</div>';
}
return msg;
};
var frame_id = 'ajaxUploader-iframe-' + Math.round(new Date().getTime() / 1000);
jQuery('body').after('<iframe width="0" height="0" style="display:none;" name="'+frame_id+'" id="'+frame_id+'"/>');
var submitFormObj = jQuery('input[type="file"]').closest("form").attr({target: frame_id, action: target}).submit();
jQuery('#'+frame_id).load(function() {
var msg = handleResponse(this);
jQuery('#errorMsg').remove();
jQuery('#OKMsg').remove();
jQuery('input[name="id"]').before(msg);
});
//jQuery('#'+frame_id).remove();
YAHOO.util.Connect.setForm(formname,true);
var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', target, submitFormCallback);
/* /*
if(redirect != '') { if(redirect != '') {
loadContent(redirect); loadContent(redirect);
...@@ -169,6 +279,7 @@ function submitUploadForm(formname,target) { ...@@ -169,6 +279,7 @@ function submitUploadForm(formname,target) {
} }
function loadContent(pagename) { function loadContent(pagename) {
/*
var pageContentCallback2 = { var pageContentCallback2 = {
success: function(o) { success: function(o) {
if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
...@@ -185,14 +296,31 @@ function loadContent(pagename) { ...@@ -185,14 +296,31 @@ function loadContent(pagename) {
reportError('Ajax Request was not successful. 113'); reportError('Ajax Request was not successful. 113');
} }
} }
*/
/*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, pageContentCallback2);*/
var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, pageContentCallback2); var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename,
success: function(data, textStatus, jqXHR) {
if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
var parts = jqXHR.responseText.split(':');
loadContent(parts[1]);
} else if (jqXHR.responseText.indexOf('URL_REDIRECT:') > -1) {
var newUrl= jqXHR.responseText.substr(jqXHR.responseText.indexOf('URL_REDIRECT:') + "URL_REDIRECT:".length);
document.location.href = newUrl;
} else {
document.getElementById('pageContent').innerHTML = jqXHR.responseText;
}
},
error: function() {
reportError('Ajax Request was not successful. 113');
},
});
} }
function loadInitContent() { function loadInitContent() {
/*
var pageContentCallback = { var pageContentCallback = {
success: function(o) { success: function(o) {
if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
...@@ -201,26 +329,28 @@ function loadInitContent() { ...@@ -201,26 +329,28 @@ function loadInitContent() {
} else { } else {
document.getElementById('pageContent').innerHTML = o.responseText; document.getElementById('pageContent').innerHTML = o.responseText;
} }
/*
var items = document.getElementsByTagName('input');
for(i=0;i<items.length;i++) {
//var oButton = new YAHOO.widget.Button(items[i].id);
if(items[i].type == 'button') {
//alert(items[i].id);
var oButton = new YAHOO.widget.Button(items[i].id);
oButton.addListener("click",submitLoginForm);
}
}
//var oButton = new YAHOO.widget.Button("submit");
*/
}, },
failure: function(o) { failure: function(o) {
reportError('Ajax Request was not successful. 114'); reportError('Ajax Request was not successful. 114');
} }
} }
*/
var pageContentObject = YAHOO.util.Connect.asyncRequest('GET', 'content.php?s_mod=login&s_pg=index', pageContentCallback); /*var pageContentObject = YAHOO.util.Connect.asyncRequest('GET', 'content.php?s_mod=login&s_pg=index', pageContentCallback);*/
var pageContentObject = jQuery.ajax({ type: "GET",
url: "content.php",
data: "s_mod=login&s_pg=index",
success: function(data, textStatus, jqXHR) {
if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
var parts = jqXHR.responseText.split(":");
loadContent(parts[1]);
} else {
document.getElementById('pageContent').innerHTML = jqXHR.responseText;
}
},
error: function() {
reportError('Ajax Request was not successful. 114');
},
});
loadMenus(); loadMenus();
keepalive(); keepalive();
...@@ -255,7 +385,7 @@ function setFocus() { ...@@ -255,7 +385,7 @@ function setFocus() {
function loadMenus() { function loadMenus() {
/*
var sideNavCallback = { var sideNavCallback = {
success: function(o) { success: function(o) {
document.getElementById('sideNav').innerHTML = o.responseText; document.getElementById('sideNav').innerHTML = o.responseText;
...@@ -264,9 +394,21 @@ function loadMenus() { ...@@ -264,9 +394,21 @@ function loadMenus() {
reportError('Ajax Request was not successful. 115'); reportError('Ajax Request was not successful. 115');
} }
} }
*/
var sideNavObject = YAHOO.util.Connect.asyncRequest('GET', 'nav.php?nav=side', sideNavCallback); /*var sideNavObject = YAHOO.util.Connect.asyncRequest('GET', 'nav.php?nav=side', sideNavCallback);*/
var sideNavObject = jQuery.ajax({ type: "GET",
url: "nav.php",
data: "nav=side",
success: function(data, textStatus, jqXHR) {
document.getElementById('sideNav').innerHTML = jqXHR.responseText;
},
error: function() {
reportError('Ajax Request was not successful. 115');
},
});
/*
var topNavCallback = { var topNavCallback = {
success: function(o) { success: function(o) {
document.getElementById('topNav').innerHTML = o.responseText; document.getElementById('topNav').innerHTML = o.responseText;
...@@ -275,8 +417,19 @@ function loadMenus() { ...@@ -275,8 +417,19 @@ function loadMenus() {
reportError('Ajax Request was not successful. 116'); reportError('Ajax Request was not successful. 116');
} }
} }
*/
var topNavObject = YAHOO.util.Connect.asyncRequest('GET', 'nav.php?nav=top', topNavCallback); /*var topNavObject = YAHOO.util.Connect.asyncRequest('GET', 'nav.php?nav=top', topNavCallback);*/
var topNavObject = jQuery.ajax({ type: "GET",
url: "nav.php",
data: "nav=top",
success: function(data, textStatus, jqXHR) {
document.getElementById('topNav').innerHTML = jqXHR.responseText;
},
error: function(o) {
reportError('Ajax Request was not successful. 116');
},
});
} }
...@@ -293,6 +446,7 @@ function del_record(link,confirmation) { ...@@ -293,6 +446,7 @@ function del_record(link,confirmation) {
} }
function loadContentInto(elementid,pagename) { function loadContentInto(elementid,pagename) {
/*
var itemContentCallback = { var itemContentCallback = {
success: function(o) { success: function(o) {
document.getElementById(elementid).innerHTML = o.responseText; document.getElementById(elementid).innerHTML = o.responseText;
...@@ -301,12 +455,23 @@ function loadContentInto(elementid,pagename) { ...@@ -301,12 +455,23 @@ function loadContentInto(elementid,pagename) {
reportError('Ajax Request was not successful. 118'); reportError('Ajax Request was not successful. 118');
} }
} }
*/
var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback); /*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/
var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename,
success: function(data, textStatus, jqXHR) {
document.getElementById(elementid).innerHTML = jqXHR.responseText;
},
error: function() {
reportError('Ajax Request was not successful. 118');
},
});
} }
function loadOptionInto(elementid,pagename) { function loadOptionInto(elementid,pagename) {
/*
var itemContentCallback = { var itemContentCallback = {
success: function(o) { success: function(o) {
var teste = o.responseText; var teste = o.responseText;
...@@ -325,10 +490,31 @@ function loadOptionInto(elementid,pagename) { ...@@ -325,10 +490,31 @@ function loadOptionInto(elementid,pagename) {
reportError('Ajax Request was not successful. 119'); reportError('Ajax Request was not successful. 119');
} }
} }
var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback); */
/*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/
var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename,
success: function(data, textStatus, jqXHR) {
var teste = jqXHR.responseText;
var elemente = teste.split('#');
el=document.getElementById(elementid);
el.innerHTML='';
for (var i = 0; i < elemente.length; ++i){
var foo2 = document.createElement("option");
foo2.appendChild(document.createTextNode(elemente[i]));
foo2.value=elemente[i];
el.appendChild(foo2);
}
},
error: function() {
reportError('Ajax Request was not successful. 119');
},
});
} }
function keepalive() { function keepalive() {
/*
var pageContentCallbackKeepalive = { var pageContentCallbackKeepalive = {
success: function(o) { success: function(o) {
setTimeout( keepalive, 1000000 ); setTimeout( keepalive, 1000000 );
...@@ -337,8 +523,18 @@ function keepalive() { ...@@ -337,8 +523,18 @@ function keepalive() {
reportError('Session expired. Please login again.'); reportError('Session expired. Please login again.');
} }
} }
*/
var pageContentObject3 = YAHOO.util.Connect.asyncRequest('GET', 'keepalive.php', pageContentCallbackKeepalive); /*var pageContentObject3 = YAHOO.util.Connect.asyncRequest('GET', 'keepalive.php', pageContentCallbackKeepalive);*/
var pageContentObject3 = jQuery.ajax({ type: "GET",
url: "keepalive.php",
success: function(data, textStatus, jqXHR) {
setTimeout( keepalive, 1000000 );
},
error: function() {
reportError('Session expired. Please login again.');
},
});
//setTimeout( keepalive, 1000000 ); //setTimeout( keepalive, 1000000 );
} }
...@@ -514,3 +710,50 @@ function getInternetExplorerVersion() { ...@@ -514,3 +710,50 @@ function getInternetExplorerVersion() {
} }
return rv; return rv;
} }
function loadwebip(elementid,pagename) {
/*
var itemContentCallback = {
success: function(o) {
var teste = o.responseText;
var elemente = teste.split('#');
el=document.getElementById(elementid);
el.innerHTML='';
for (var i = 0; i < elemente.length; ++i){
var foo2 = document.createElement("option");
foo2.appendChild(document.createTextNode(elemente[i]));
foo2.value=elemente[i];
el.appendChild(foo2);
}
},
failure: function(o) {
reportError('Ajax Request was not successful. 119');
}
}
*/
/*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/
var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename,
success: function(data, textStatus, jqXHR) {
var teste = jqXHR.responseText;
var elemente = teste.split('#');
el=document.getElementById(elementid);
el.innerHTML='';
for (var i = 0; i < elemente.length; ++i){
var foo2 = document.createElement("option");
foo2.appendChild(document.createTextNode(elemente[i]));
foo2.value=elemente[i];
el.appendChild(foo2);
}
},
error: function() {
reportError('Ajax Request was not successful. 119');
},
});
var ruby = document.getElementById('ruby');
ruby.style.display = 'none';
}
...@@ -54,9 +54,8 @@ ...@@ -54,9 +54,8 @@
</style> </style>
<![endif]--> <![endif]-->
<link rel="shortcut icon" href="/themes/default/images/favicon.ico" /> <link rel="shortcut icon" href="/themes/default/images/favicon.ico" />
<script type="text/javascript" src="js/yui-combo.js"></script> <script type="text/javascript" src="js/jquery-1.6.3.min.js"></script>
<script type="text/javascript" src="js/scrigo.js.php"></script> <script type="text/javascript" src="js/scrigo.js.php"></script>
<script type="text/javascript" src="js/uni-form/jquery.js"></script>
<script type="text/javascript" src="js/uni-form/uni-form.jquery.js"></script> <script type="text/javascript" src="js/uni-form/uni-form.jquery.js"></script>
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
...@@ -65,15 +64,21 @@ ...@@ -65,15 +64,21 @@
style.innerHTML = '#page_margins { min-width: 980px; max-width: 80%; background: #fff; display: table;}'; style.innerHTML = '#page_margins { min-width: 980px; max-width: 80%; background: #fff; display: table;}';
document.getElementsByTagName("head")[0].appendChild(style); document.getElementsByTagName("head")[0].appendChild(style);
} }
jQuery(document).ready(function() {