From 1e45da277b6e28ff65967d38c12b298872efb059 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 01 Aug 2008 17:37:59 -0400
Subject: [PATCH] Added translation functions for the tabs of forms.

---
 interface/web/js/scrigo.js |   64 ++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/interface/web/js/scrigo.js b/interface/web/js/scrigo.js
index 703c626..1b51dd0 100644
--- a/interface/web/js/scrigo.js
+++ b/interface/web/js/scrigo.js
@@ -6,7 +6,7 @@
 			document.getElementById('pageContent').innerHTML = o.responseText;
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			alert('Ajax Request was not successful.'+pagename);
 		}
 	}
 	
@@ -46,6 +46,9 @@
 				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;
 			}
@@ -107,6 +110,46 @@
 	*/
 }
 
+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) {
+			alert('Ajax Request was not successful. 1');
+		}
+	}
+	
+	YAHOO.util.Connect.setForm(formname,true);
+	var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', target, submitFormCallback);
+	/*
+	if(redirect != '') {
+		loadContent(redirect);
+		redirect = '';
+	}
+	*/
+}
+
 function loadContent(pagename) {
 	var pageContentCallback2 = {
 		success: function(o) {
@@ -159,6 +202,7 @@
   var pageContentObject = YAHOO.util.Connect.asyncRequest('GET', 'content.php?s_mod=login&s_pg=index', pageContentCallback);
   
   loadMenus();
+  keepalive();
 
 }
 
@@ -201,8 +245,8 @@
 		alert('Sorry. There was an error.');
 	}
 	
-	function del_record(link) {
-  if(window.confirm("<tmpl_var name='delete_confirmation'>")) {
+function del_record(link,confirmation) {
+  if(window.confirm(confirmation)) {
           loadContent(link);
   }
 }
@@ -219,4 +263,18 @@
 	
 
   var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);
+}
+
+function keepalive() {
+	var pageContentCallbackKeepalive = {
+		success: function(o) {
+			setTimeout( keepalive, 1000000 );
+		},
+		failure: function(o) {
+			alert('Sorry. There was an error.');
+		}
+	}
+	
+  	var pageContentObject3 = YAHOO.util.Connect.asyncRequest('GET', 'keepalive.php', pageContentCallbackKeepalive);
+  	//setTimeout( keepalive, 1000000 );
 }
\ No newline at end of file

--
Gitblit v1.9.1