From f99b37f56dad8e3a1f844f8d3b33ee1ba4b86d62 Mon Sep 17 00:00:00 2001
From: latham <latham@ispconfig3>
Date: Wed, 25 May 2011 19:11:40 -0400
Subject: [PATCH] the altertable for the groups

---
 interface/web/js/scrigo.js.php |   84 +++++++++++++++++++++++++++++++-----------
 1 files changed, 62 insertions(+), 22 deletions(-)

diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php
index 1eac710..f1d4829 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -1,10 +1,19 @@
 <?php
 	session_start();
 	include('../../lib/config.inc.php');
-	include_once(ISPC_ROOT_PATH.'/web/strengthmeter/lib/lang/'.$_SESSION['s']['language'].'_strengthmeter.lng');
+	$lang = (isset($_SESSION['s']['language']) && $_SESSION['s']['language'] != '')?$_SESSION['s']['language']:'en';
+	include_once(ISPC_ROOT_PATH.'/web/strengthmeter/lib/lang/'.$lang.'_strengthmeter.lng');
 ?>
 
 redirect = '';
+
+function reportError(request) {
+	/* Error reporting is disabled by default as some browsers like safari 
+	   sometimes throw errors when a ajax request is delayed even if the 
+	   ajax request worked. */
+	   
+	/*alert(request);*/
+}
 
 function loadContentRefresh(pagename) {
 	var pageContentCallbackRefresh = {
@@ -12,7 +21,7 @@
 			document.getElementById('pageContent').innerHTML = o.responseText;
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.'+pagename);
+			reportError('Ajax Request was not successful.'+pagename);
 		}
 	}
 	
@@ -36,7 +45,7 @@
 			loadMenus();
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful.'+module);
 		}
 	}
 	var submitFormObj = YAHOO.util.Connect.asyncRequest('GET', 'capp.php?mod='+module, cappCallback);
@@ -61,7 +70,7 @@
 			loadMenus();
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful.110');
 		}
 	}
 	
@@ -84,8 +93,9 @@
 		loadContent(redirect);
 		redirect = '';
 	}
+	document.getElementById('footer').innerHTML = 'Powered by <a href="http://www.ispconfig.org" target="_blank">ISPConfig</a>';
 	*/
-	document.getElementById('footer').innerHTML = 'Powered by <a href="http://www.ispconfig.org" target="_blank">ISPConfig <?php echo ISPC_APP_VERSION ?></a>';
+	
 }
 
 function submitForm(formname,target) {
@@ -104,7 +114,7 @@
 		},
 		failure: function(o) {
 			var parts = o.responseText.split(':');
-			alert('Ajax Request was not successful. '+parts[1]);
+			reportError('Ajax Request was not successful. 111');
 		}
 	}
 	
@@ -144,7 +154,7 @@
 			}
         },
 		failure: function(o) {
-			alert('Ajax Request was not successful. 1');
+			reportError('Ajax Request was not successful. 112');
 		}
 	}
 	
@@ -172,7 +182,7 @@
 			}
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful. 113');
 		}
 	}
 	
@@ -206,7 +216,7 @@
 			*/
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful. 114');
 		}
 	}
 	
@@ -237,7 +247,10 @@
 			if(flag)break;
 		}
 */
-  document.pageForm.username.focus();
+	try {
+		document.pageForm.username.focus();
+	} catch (e) {
+	}
 }
 
 
@@ -248,7 +261,7 @@
 			document.getElementById('sideNav').innerHTML = o.responseText;
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful. 115');
 		}
 	}
 	
@@ -259,7 +272,7 @@
 			document.getElementById('topNav').innerHTML = o.responseText;
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful. 116');
 		}
 	}
 	
@@ -272,13 +285,6 @@
 	document.pageForm.next_tab.value = tab;
 	submitForm('pageForm',target);
 }
-
-
-
-function reportError(request)
-	{
-		alert('Sorry. There was an error.');
-	}
 	
 function del_record(link,confirmation) {
   if(window.confirm(confirmation)) {
@@ -292,12 +298,34 @@
 			document.getElementById(elementid).innerHTML = o.responseText;
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful. 118');
 		}
 	}
 	
 
   var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);
+}
+
+function loadOptionInto(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);
 }
 
 function keepalive() {
@@ -306,7 +334,7 @@
 			setTimeout( keepalive, 1000000 );
 		},
 		failure: function(o) {
-			alert('Sorry. There was an error.');
+			reportError('Session expired. Please login again.');
 		}
 	}
 	
@@ -437,11 +465,12 @@
 
 function addAdditionalTemplate(){
 	var tpl_add = document.getElementById('template_additional').value;
-	if(tpl_add != '') {
+	
 	  var tpl_list = document.getElementById('template_additional_list').innerHTML;
 	  var addTemplate = document.getElementById('tpl_add_select').value.split('|',2);
 	  var addTplId = addTemplate[0];
 	  var addTplText = addTemplate[1];
+	if(addTplId > 0) {
 	  var newVal = tpl_add + '/' + addTplId + '/';
 	  newVal = newVal.replace('//', '/');
 	  var newList = tpl_list + '<br>' + addTplText;
@@ -474,3 +503,14 @@
   }
   
 }
+
+function getInternetExplorerVersion() {
+    var rv = -1; // Return value assumes failure.
+    if (navigator.appName == 'Microsoft Internet Explorer') {
+        var ua = navigator.userAgent;
+        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
+        if (re.exec(ua) != null)
+            rv = parseFloat(RegExp.$1);
+    }
+    return rv;
+}

--
Gitblit v1.9.1