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) {
}
function loadContentRefresh(pagename) {
/*
var pageContentCallbackRefresh = {
success: function(o) {
document.getElementById('pageContent').innerHTML = o.responseText;
......@@ -24,14 +25,26 @@ function loadContentRefresh(pagename) {
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 = 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 );
}
}
function capp(module) {
/*
var cappCallback = {
success: function(o) {
if(o.responseText != '') {
......@@ -48,31 +61,30 @@ function capp(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",
url: "capp.php",
data: "mod="+module,
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) {
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 if (o.responseText.indexOf('LOGIN_REDIRECT:') > -1) {
// Go to the login page
document.location.href = 'index.php';
} else {
document.getElementById('pageContent').innerHTML = o.responseText;
}
loadMenus();
},
failure: function(o) {
reportError('Ajax Request was not successful.110');
}
}
//* Validate form. TODO: username and password with strip();
var frm = document.getElementById(formname);
......@@ -86,8 +98,30 @@ function submitLoginForm(formname) {
passwordObj.focus();
return;
}
YAHOO.util.Connect.setForm(formname);
var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', 'content.php', submitFormCallback);
/*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(),
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 != '') {
loadContent(redirect);
......@@ -99,7 +133,7 @@ function submitLoginForm(formname) {
}
function submitForm(formname,target) {
/*
var submitFormCallback = {
success: function(o) {
if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
......@@ -117,9 +151,29 @@ function submitForm(formname,target) {
reportError('Ajax Request was not successful. 111');
}
}
*/
YAHOO.util.Connect.setForm(formname);
var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', target, submitFormCallback);
/*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(),
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 != '') {
loadContent(redirect);
......@@ -129,7 +183,7 @@ function submitForm(formname,target) {
}
function submitUploadForm(formname,target) {
/*
var submitFormCallback = {
success: function(o) {
if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
......@@ -157,9 +211,65 @@ function submitUploadForm(formname,target) {
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 });
YAHOO.util.Connect.setForm(formname,true);
var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', target, submitFormCallback);
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();
/*
if(redirect != '') {
loadContent(redirect);
......@@ -169,6 +279,7 @@ function submitUploadForm(formname,target) {
}
function loadContent(pagename) {
/*
var pageContentCallback2 = {
success: function(o) {
if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
......@@ -185,14 +296,31 @@ function loadContent(pagename) {
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() {
/*
var pageContentCallback = {
success: function(o) {
if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
......@@ -201,26 +329,28 @@ function loadInitContent() {
} else {
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) {
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();
keepalive();
......@@ -255,7 +385,7 @@ function setFocus() {
function loadMenus() {
/*
var sideNavCallback = {
success: function(o) {
document.getElementById('sideNav').innerHTML = o.responseText;
......@@ -264,9 +394,21 @@ function loadMenus() {
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 = {
success: function(o) {
document.getElementById('topNav').innerHTML = o.responseText;
......@@ -275,8 +417,19 @@ function loadMenus() {
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) {
}
function loadContentInto(elementid,pagename) {
/*
var itemContentCallback = {
success: function(o) {
document.getElementById(elementid).innerHTML = o.responseText;
......@@ -301,12 +455,23 @@ function loadContentInto(elementid,pagename) {
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) {
/*
var itemContentCallback = {
success: function(o) {
var teste = o.responseText;
......@@ -325,10 +490,31 @@ function loadOptionInto(elementid,pagename) {
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() {
/*
var pageContentCallbackKeepalive = {
success: function(o) {
setTimeout( keepalive, 1000000 );
......@@ -337,8 +523,18 @@ function keepalive() {
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 );
}
......@@ -514,3 +710,50 @@ function getInternetExplorerVersion() {
}
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 @@
</style>
<![endif]-->
<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/uni-form/jquery.js"></script>
<script type="text/javascript" src="js/uni-form/uni-form.jquery.js"></script>
<script language="JavaScript" type="text/javascript">
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
......@@ -65,15 +64,21 @@
style.innerHTML = '#page_margins { min-width: 980px; max-width: 80%; background: #fff; display: table;}';
document.getElementsByTagName("head")[0].appendChild(style);
}
jQuery(document).ready(function() {
loadInitContent();
});
//Use jQuery submit with kespress Enter in panel filterbar
jQuery(document).bind("keypress", function(event) {
if (event.which == '13' && $(".panel #Filter").length > 0) {
$(".panel #Filter").attr("onsubmit",$(".panel #Filter").attr("onclick")).submit();
}
});
</script>
</head>
<body onload="loadInitContent()">
<body>
<div id="page_margins">
<div id="page">
<div id="header">
......
......@@ -55,9 +55,8 @@
<![endif]-->
<link href="themes/default_64_navimg/css/additional.css" rel="stylesheet" type="text/css"/>
<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/uni-form/jquery.js"></script>
<script type="text/javascript" src="js/uni-form/uni-form.jquery.js"></script>
<script language="JavaScript" type="text/javascript">
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
......@@ -66,15 +65,21 @@
style.innerHTML = '#page_margins { min-width: 980px; max-width: 80%; background: #fff; display: table;}';
document.getElementsByTagName("head")[0].appendChild(style);
}
jQuery(document).ready(function() {
loadInitContent();
});
//Use jQuery submit with kespress Enter in panel filterbar
jQuery(document).bind("keypress", function(event) {
if (event.which == '13' && $(".panel #Filter").length > 0) {
$(".panel #Filter").attr("onsubmit",$(".panel #Filter").attr("onclick")).submit();
}
});
</script>
</head>
<body onload="loadInitContent()">
<body>
<div id="page_margins">
<div id="page">
<div id="header">
......
......@@ -55,9 +55,8 @@
<![endif]-->
<link href="themes/default_no_navimg/css/additional.css" rel="stylesheet" type="text/css"/>
<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/uni-form/jquery.js"></script>
<script type="text/javascript" src="js/uni-form/uni-form.jquery.js"></script>
<script language="JavaScript" type="text/javascript">
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
......@@ -66,15 +65,21 @@
style.innerHTML = '#page_margins { min-width: 980px; max-width: 80%; background: #fff; display: table;}';
document.getElementsByTagName("head")[0].appendChild(style);
}
jQuery(document).ready(function() {
loadInitContent();
});
//Use jQuery submit with kespress Enter in panel filterbar
jQuery(document).bind("keypress", function(event) {
if (event.which == '13' && $(".panel #Filter").length > 0) {
$(".panel #Filter").attr("onsubmit",$(".panel #Filter").attr("onclick")).submit();
}
});
</script>
</head>
<body onload="loadInitContent()">
<body>
<div id="page_margins">
<div id="page">
<div id="header">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment