From bb55f808f938aae17691dcbd80fe6f7e2206297d Mon Sep 17 00:00:00 2001
From: PavelBegunkov <asml.Silence@gmail.com>
Date: Mon, 22 Sep 2014 21:23:42 +0400
Subject: [PATCH] errors: The ancient Evil

---
 ~dev_rating/media/js/errDialog.js | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/~dev_rating/media/js/errDialog.js b/~dev_rating/media/js/errDialog.js
index 1e3f80480..f27a9f0b5 100644
--- a/~dev_rating/media/js/errDialog.js
+++ b/~dev_rating/media/js/errDialog.js
@@ -20,7 +20,7 @@ $(document).ready(function() {
 		{
 			$.getJSON(URLdir + "handler/ErrMessages/getRequests", {}, function(data){
 				if(typeof(data[0]) == "undefined")
-					alert("Вы еще ничего не написали");
+					EventInspector_ShowMsg('Вы еще ничего не написали', 'error');
 				else
 				{
 					var valHeight = 0;
@@ -52,16 +52,17 @@ $(document).ready(function() {
 		$('.dialogMyMessagesBtn').click(dialogMyMessagesBtn);
 		$('#dialogSendButton').click(function dialogSendButton() 
 		{
-			var thisObj = $(this);
-    		$(this).attr("disabled", true);
 			var mesTitle = $('#messageTitle').val();
 			var mesText = $('#message').val();
-			
-			if(mesTitle == '')
-				alert("Вы не ввели сообщение");
-			else if(mesText == '')
-				alert("Вы не ввели тему сообщения");
+			if(mesTitle.length == 0)
+				EventInspector_ShowMsg('Вы не ввели тему сообщения', 'error');
+			else if(mesText.length == 0)
+				EventInspector_ShowMsg('Вы не ввели сообщение', 'error');
 			else 
+			{
+				var thisObj = $(this);
+	    		$(this).attr("disabled", true);
+
 				$.ajax({
 						type: "POST",
 						url: URLdir + "handler/ErrMessages/createRequest",       
@@ -79,7 +80,8 @@ $(document).ready(function() {
 								EventInspector_ShowMsg('Сообщение не отправлено', 'error');
 							thisObj.removeAttr('disabled');
 						}
-				});					
+				});
+			}					
 		});	                  	
 	});
 
-- 
GitLab