From 528ac3b8fac377fc10c20c167f42d92a711eb722 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Thu, 03 May 2012 10:00:53 -0400
Subject: [PATCH] - Fixed FS#2197.

---
 interface/web/js/scrigo.js.php |   38 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php
index ecfcf83..25e2128 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -43,8 +43,11 @@
 													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 {
-														alert(jqXHR.responseText);
+														//alert(jqXHR.responseText);
 													}
 												}
 												loadMenus();
@@ -101,7 +104,7 @@
 	
 }
 
-function submitForm(formname,target) {	
+function submitForm(formname,target) {
 	var submitFormObj = jQuery.ajax({		type: "POST", 
 											url: target,
 											data: jQuery('#'+formname).serialize(),
@@ -128,6 +131,31 @@
 		redirect = '';
 	}
 	*/
+}
+
+function submitFormConfirm(formname,target,confirmation) {
+	if(window.confirm(confirmation)) {
+		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 {
+													jQuery('#pageContent').html(jqXHR.responseText);
+												}
+											},
+											error: function(jqXHR, textStatus, errorThrown) {
+												var parts = jqXHR.responseText.split(':');
+												reportError('Ajax Request was not successful. 111');
+											},
+									});
+	}
 }
 
 function submitUploadForm(formname,target) {		
@@ -269,6 +297,12 @@
   }
 }
 
+function confirm_action(link,confirmation) {
+  if(window.confirm(confirmation)) {
+          loadContent(link);
+  }
+}
+
 function loadContentInto(elementid,pagename) {
   var pageContentObject2 = jQuery.ajax({	type: "GET", 
 											url: pagename,

--
Gitblit v1.9.1