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

- Changed scrigo.js.php to allow JavaScript inside content loaded through Ajax.

parent 472ad25a
...@@ -30,10 +30,12 @@ function loadContentRefresh(pagename) { ...@@ -30,10 +30,12 @@ function loadContentRefresh(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", var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename, url: pagename,
data: "refresh="+document.getElementById('refreshinterval').value, data: "refresh="+document.getElementById('refreshinterval').value,
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
document.getElementById('pageContent').innerHTML = jqXHR.responseText; //document.getElementById('pageContent').innerHTML = jqXHR.responseText;
jQuery('#pageContent').html(jqXHR.responseText);
}, },
error: function() { error: function() {
reportError('Ajax Request was not successful.'+pagename); reportError('Ajax Request was not successful.'+pagename);
...@@ -66,6 +68,7 @@ function capp(module) { ...@@ -66,6 +68,7 @@ function capp(module) {
var submitFormObj = jQuery.ajax({ type: "GET", var submitFormObj = jQuery.ajax({ type: "GET",
url: "capp.php", url: "capp.php",
data: "mod="+module, data: "mod="+module,
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
if(jqXHR.responseText != '') { if(jqXHR.responseText != '') {
if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
...@@ -103,6 +106,7 @@ function submitLoginForm(formname) { ...@@ -103,6 +106,7 @@ function submitLoginForm(formname) {
var submitFormObj = jQuery.ajax({ type: "POST", var submitFormObj = jQuery.ajax({ type: "POST",
url: "content.php", url: "content.php",
data: jQuery('#'+formname).serialize(), data: jQuery('#'+formname).serialize(),
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
var parts = jqXHR.responseText.split(':'); var parts = jqXHR.responseText.split(':');
...@@ -114,7 +118,8 @@ function submitLoginForm(formname) { ...@@ -114,7 +118,8 @@ function submitLoginForm(formname) {
// Go to the login page // Go to the login page
document.location.href = 'index.php'; document.location.href = 'index.php';
} else { } else {
document.getElementById('pageContent').innerHTML = jqXHR.responseText; //document.getElementById('pageContent').innerHTML = jqXHR.responseText;
jQuery('#pageContent').html(jqXHR.responseText);
} }
loadMenus(); loadMenus();
}, },
...@@ -158,6 +163,7 @@ function submitForm(formname,target) { ...@@ -158,6 +163,7 @@ function submitForm(formname,target) {
var submitFormObj = jQuery.ajax({ type: "POST", var submitFormObj = jQuery.ajax({ type: "POST",
url: target, url: target,
data: jQuery('#'+formname).serialize(), data: jQuery('#'+formname).serialize(),
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
var parts = jqXHR.responseText.split(':'); var parts = jqXHR.responseText.split(':');
...@@ -166,7 +172,8 @@ function submitForm(formname,target) { ...@@ -166,7 +172,8 @@ function submitForm(formname,target) {
//redirect = parts[1]; //redirect = parts[1];
//window.setTimeout('loadContent(redirect)', 1000); //window.setTimeout('loadContent(redirect)', 1000);
} else { } else {
document.getElementById('pageContent').innerHTML = jqXHR.responseText; //document.getElementById('pageContent').innerHTML = jqXHR.responseText;
jQuery('#pageContent').html(jqXHR.responseText);
} }
}, },
error: function(jqXHR, textStatus, errorThrown) { error: function(jqXHR, textStatus, errorThrown) {
...@@ -219,6 +226,7 @@ function submitUploadForm(formname,target) { ...@@ -219,6 +226,7 @@ function submitUploadForm(formname,target) {
var submitFormObj = jQuery.ajax({ type: "POST", var submitFormObj = jQuery.ajax({ type: "POST",
url: target, url: target,
data: jQuery('#'+formname).serialize(), data: jQuery('#'+formname).serialize(),
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
var parts = jqXHR.responseText.split(':'); var parts = jqXHR.responseText.split(':');
...@@ -227,7 +235,8 @@ function submitUploadForm(formname,target) { ...@@ -227,7 +235,8 @@ function submitUploadForm(formname,target) {
//redirect = parts[1]; //redirect = parts[1];
//window.setTimeout('loadContent(redirect)', 1000); //window.setTimeout('loadContent(redirect)', 1000);
} else { } else {
document.getElementById('pageContent').innerHTML = jqXHR.responseText; //document.getElementById('pageContent').innerHTML = jqXHR.responseText;
jQuery('#pageContent').html(jqXHR.responseText);
} }
}, },
error: function() { error: function() {
...@@ -297,10 +306,10 @@ function loadContent(pagename) { ...@@ -297,10 +306,10 @@ function loadContent(pagename) {
} }
} }
*/ */
/*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, pageContentCallback2);*/ /*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, pageContentCallback2);*/
var pageContentObject2 = jQuery.ajax({ type: "GET", var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename, url: pagename,
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
var parts = jqXHR.responseText.split(':'); var parts = jqXHR.responseText.split(':');
...@@ -309,8 +318,13 @@ function loadContent(pagename) { ...@@ -309,8 +318,13 @@ function loadContent(pagename) {
var newUrl= jqXHR.responseText.substr(jqXHR.responseText.indexOf('URL_REDIRECT:') + "URL_REDIRECT:".length); var newUrl= jqXHR.responseText.substr(jqXHR.responseText.indexOf('URL_REDIRECT:') + "URL_REDIRECT:".length);
document.location.href = newUrl; document.location.href = newUrl;
} else { } else {
document.getElementById('pageContent').innerHTML = jqXHR.responseText; //document.getElementById('pageContent').innerHTML = jqXHR.responseText;
//var reponse = jQuery(jqXHR.responseText);
//var reponseScript = reponse.filter("script");
//jQuery.each(reponseScript, function(idx, val) { eval(val.text); } );
jQuery('#pageContent').html(jqXHR.responseText);
} }
}, },
error: function() { error: function() {
reportError('Ajax Request was not successful. 113'); reportError('Ajax Request was not successful. 113');
...@@ -339,12 +353,14 @@ function loadInitContent() { ...@@ -339,12 +353,14 @@ function loadInitContent() {
var pageContentObject = jQuery.ajax({ type: "GET", var pageContentObject = jQuery.ajax({ type: "GET",
url: "content.php", url: "content.php",
data: "s_mod=login&s_pg=index", data: "s_mod=login&s_pg=index",
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
var parts = jqXHR.responseText.split(":"); var parts = jqXHR.responseText.split(":");
loadContent(parts[1]); loadContent(parts[1]);
} else { } else {
document.getElementById('pageContent').innerHTML = jqXHR.responseText; //document.getElementById('pageContent').innerHTML = jqXHR.responseText;
jQuery('#pageContent').html(jqXHR.responseText);
} }
}, },
error: function() { error: function() {
...@@ -400,8 +416,10 @@ function loadMenus() { ...@@ -400,8 +416,10 @@ function loadMenus() {
var sideNavObject = jQuery.ajax({ type: "GET", var sideNavObject = jQuery.ajax({ type: "GET",
url: "nav.php", url: "nav.php",
data: "nav=side", data: "nav=side",
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
document.getElementById('sideNav').innerHTML = jqXHR.responseText; //document.getElementById('sideNav').innerHTML = jqXHR.responseText;
jQuery('#sideNav').html(jqXHR.responseText);
}, },
error: function() { error: function() {
reportError('Ajax Request was not successful. 115'); reportError('Ajax Request was not successful. 115');
...@@ -423,8 +441,10 @@ function loadMenus() { ...@@ -423,8 +441,10 @@ function loadMenus() {
var topNavObject = jQuery.ajax({ type: "GET", var topNavObject = jQuery.ajax({ type: "GET",
url: "nav.php", url: "nav.php",
data: "nav=top", data: "nav=top",
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
document.getElementById('topNav').innerHTML = jqXHR.responseText; //document.getElementById('topNav').innerHTML = jqXHR.responseText;
jQuery('#topNav').html(jqXHR.responseText);
}, },
error: function(o) { error: function(o) {
reportError('Ajax Request was not successful. 116'); reportError('Ajax Request was not successful. 116');
...@@ -461,8 +481,10 @@ function loadContentInto(elementid,pagename) { ...@@ -461,8 +481,10 @@ function loadContentInto(elementid,pagename) {
/*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/ /*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/
var pageContentObject2 = jQuery.ajax({ type: "GET", var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename, url: pagename,
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
document.getElementById(elementid).innerHTML = jqXHR.responseText; //document.getElementById(elementid).innerHTML = jqXHR.responseText;
jQuery('#'+elementid).html(jqXHR.responseText);
}, },
error: function() { error: function() {
reportError('Ajax Request was not successful. 118'); reportError('Ajax Request was not successful. 118');
...@@ -494,6 +516,7 @@ function loadOptionInto(elementid,pagename) { ...@@ -494,6 +516,7 @@ function loadOptionInto(elementid,pagename) {
/*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/ /*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/
var pageContentObject2 = jQuery.ajax({ type: "GET", var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename, url: pagename,
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
var teste = jqXHR.responseText; var teste = jqXHR.responseText;
var elemente = teste.split('#'); var elemente = teste.split('#');
...@@ -528,6 +551,7 @@ function keepalive() { ...@@ -528,6 +551,7 @@ function keepalive() {
/*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", var pageContentObject3 = jQuery.ajax({ type: "GET",
url: "keepalive.php", url: "keepalive.php",
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
setTimeout( keepalive, 1000000 ); setTimeout( keepalive, 1000000 );
}, },
...@@ -735,6 +759,7 @@ function loadwebip(elementid,pagename) { ...@@ -735,6 +759,7 @@ function loadwebip(elementid,pagename) {
/*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/ /*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/
var pageContentObject2 = jQuery.ajax({ type: "GET", var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename, url: pagename,
dataType: "html",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
var teste = jqXHR.responseText; var teste = jqXHR.responseText;
var elemente = teste.split('#'); var elemente = teste.split('#');
......
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