From d2212dda734bb8c4b899faab848fa1bd7c1bf66e Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Sun, 19 Sep 2010 08:01:47 -0400
Subject: [PATCH] Fixed bug in maildirmake function: http://www.howtoforge.com/forums/showthread.php?t=48890

---
 interface/web/js/scrigo.js.php |   93 ++++++++++++++++++++++++++++++++++++----------
 1 files changed, 73 insertions(+), 20 deletions(-)

diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php
index 7414d72..cd72445 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -1,10 +1,18 @@
 <?php
 	session_start();
 	include('../../lib/config.inc.php');
-	include_once(ISPC_ROOT_PATH.'/web/js/lib/lang/'.$_SESSION['s']['language'].'_javascript.lng');
+	include_once(ISPC_ROOT_PATH.'/web/strengthmeter/lib/lang/'.$_SESSION['s']['language'].'_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 +20,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 +44,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 +69,7 @@
 			loadMenus();
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful.110');
 		}
 	}
 	
@@ -84,7 +92,9 @@
 		loadContent(redirect);
 		redirect = '';
 	}
+	document.getElementById('footer').innerHTML = 'Powered by <a href="http://www.ispconfig.org" target="_blank">ISPConfig</a>';
 	*/
+	
 }
 
 function submitForm(formname,target) {
@@ -103,7 +113,7 @@
 		},
 		failure: function(o) {
 			var parts = o.responseText.split(':');
-			alert('Ajax Request was not successful. '+parts[1]);
+			reportError('Ajax Request was not successful. 111');
 		}
 	}
 	
@@ -143,7 +153,7 @@
 			}
         },
 		failure: function(o) {
-			alert('Ajax Request was not successful. 1');
+			reportError('Ajax Request was not successful. 112');
 		}
 	}
 	
@@ -171,7 +181,7 @@
 			}
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful. 113');
 		}
 	}
 	
@@ -205,7 +215,7 @@
 			*/
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful. 114');
 		}
 	}
 	
@@ -213,8 +223,35 @@
   
   loadMenus();
   keepalive();
+  setTimeout("setFocus()",1000);
 
 }
+
+function setFocus() {
+/*
+	var flag=false;
+		for(z=0;z<document.forms.length;z++) {
+			var form = document.forms[z];
+			var elements = form.elements;
+			for (var i=0;i<elements.length;i++) {
+				var element = elements[i];
+				if(element.type == 'text' &&
+					!element.readOnly &&
+					!element.disabled) {
+						element.focus();
+						flag=true;
+						break;
+					}
+			}
+			if(flag)break;
+		}
+*/
+	try {
+		document.pageForm.username.focus();
+	} catch (e) {
+	}
+}
+
 
 function loadMenus() {
 	
@@ -223,7 +260,7 @@
 			document.getElementById('sideNav').innerHTML = o.responseText;
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful. 115');
 		}
 	}
 	
@@ -234,7 +271,7 @@
 			document.getElementById('topNav').innerHTML = o.responseText;
 		},
 		failure: function(o) {
-			alert('Ajax Request was not successful.');
+			reportError('Ajax Request was not successful. 116');
 		}
 	}
 	
@@ -247,13 +284,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)) {
@@ -267,12 +297,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() {
@@ -281,7 +333,7 @@
 			setTimeout( keepalive, 1000000 );
 		},
 		failure: function(o) {
-			alert('Sorry. There was an error.');
+			reportError('Session expired. Please login again.');
 		}
 	}
 	
@@ -412,11 +464,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;

--
Gitblit v1.9.1