From c09ae944aa6100661ff904f72a20b1322da0ad72 Mon Sep 17 00:00:00 2001
From: PavelBegunkov <asml.Silence@gmail.com>
Date: Mon, 22 Sep 2014 20:39:27 +0400
Subject: [PATCH] errorMessaging *&#! and edit settings

---
 db/StoredProcedures.sql                       |   2 +-
 .../classes/Controller/Handler/BaseDialog.php |  34 ---
 ~dev_rating/application/views/base.twig       |  20 +-
 ~dev_rating/media/css/error.css               | 222 +++++++++++++++-
 ~dev_rating/media/css/errorButton.css         | 243 ------------------
 .../media/js/discipline/CreateDiscipline.js   |  23 +-
 .../media/js/discipline/EditSettings.js       |  63 +++--
 ~dev_rating/media/js/errDialog.js             |  72 +++---
 ~dev_rating/media/js/errDialogControl.js      |  42 ---
 9 files changed, 331 insertions(+), 390 deletions(-)
 delete mode 100644 ~dev_rating/application/classes/Controller/Handler/BaseDialog.php
 delete mode 100644 ~dev_rating/media/css/errorButton.css
 delete mode 100644 ~dev_rating/media/js/errDialogControl.js

diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql
index 106db0124..d3843bc34 100644
--- a/db/StoredProcedures.sql
+++ b/db/StoredProcedures.sql
@@ -2260,7 +2260,7 @@ BEGIN
 	THEN
 		IF ExamType = 'exam' THEN
 			SET checker = GetDisciplineMaxRate(DisciplineID);
-			IF checker > 60 THEN
+			IF checker >= 61 THEN
 				RETURN 1;
 			END IF;
 			SET checker = AddModuleExam(TeacherID, DisciplineID);
diff --git a/~dev_rating/application/classes/Controller/Handler/BaseDialog.php b/~dev_rating/application/classes/Controller/Handler/BaseDialog.php
deleted file mode 100644
index f77ed24c6..000000000
--- a/~dev_rating/application/classes/Controller/Handler/BaseDialog.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php defined('SYSPATH') or die('No direct script access.');
-
-class Controller_Handler_BaseDialog extends Controller_Handler {
-		
-        public function before() {
-          //  $this->model = new Model_baseDialog;
-            $this->setAccessLevel(self::ACCESS_USER);
-            parent::before();
-        }
-        
-        public function action_returnDialogHtml() {
-        	$str = '<div class="dialogTopText">
-						Если вы нашли ошибку или у вас есть предложение по улучшению системы, сообщите об этом разработчикам.
-					</div>
-					<div class="dialogMyMessagesBtn">Мои сообщения</div>
-					<div class="dialogMyMessages"></div>
-
-					<div class="dialogMessageTitle">
-						<input id="messageTitle" placeholder="Тема сообщения" maxlength="60">
-					</div>
-
-					<div class="dialogTextMessage">
-						<textarea id="message" placeholder="Сообщение"></textarea>
-					</div>
-
-
-					<div class="dialogSendButton">
-						<div class="buttonText">Сообщить</div>
-					</div>';
-
-			$this->response->body($str); 
-        }
-
-}
diff --git a/~dev_rating/application/views/base.twig b/~dev_rating/application/views/base.twig
index 7b7f68e67..b10348322 100644
--- a/~dev_rating/application/views/base.twig
+++ b/~dev_rating/application/views/base.twig
@@ -29,9 +29,13 @@
 	{{ HTML.script('media/js/profile.js')|raw }}	
 	{{ HTML.script('media/js/ui/external/jquery/jquery.js')|raw }}
 	{{ HTML.script('media/js/ui/jquery-ui.js')|raw }}
+
+	{{ HTML.style('media/js/event_inspector/event_inspector.css')|raw }}
+	{{ HTML.script('media/js/event_inspector/event_inspector.js')|raw }}
 	
 	{{ HTML.style('media/css/theme/jquery-ui.css')|raw }}	
-	{{ HTML.style('media/css/errorButton.css')|raw }}
+	{{ HTML.style('media/css/error.css')|raw }}
+	{{ HTML.script('media/js/errDialog.js')|raw }}
 
 	{% block media %}{% endblock %}
 </head> 
@@ -90,10 +94,22 @@
 	</div>
 
 	<div id="errDialog" title="Сообщение об ошибке">
+		<div class="dialogTopText">Если вы нашли ошибку или у вас есть предложение по улучшению системы, сообщите об этом разработчикам.		</div>
+		<div class="dialogMyMessagesBtn">Мои сообщения</div>
+		<div class="dialogMyMessages"></div>
+
+		<div class="dialogMessageTitle">
+			<input id="messageTitle" placeholder="Тема сообщения" maxlength="60">
+		</div>
 
+		<div class="dialogTextMessage">
+			<textarea id="message" placeholder="Сообщение"></textarea>
+		</div>
+
+		<button class="default_BlueButton" id="dialogSendButton">Сообщить</button>
 	</div>
 
-{{ HTML.script('media/js/errDialog.js')|raw }}
+
 
 </div>
 </body>
diff --git a/~dev_rating/media/css/error.css b/~dev_rating/media/css/error.css
index 780db939a..417128d67 100644
--- a/~dev_rating/media/css/error.css
+++ b/~dev_rating/media/css/error.css
@@ -43,4 +43,224 @@ body
 }
 
 
-    
\ No newline at end of file
+/* Buttons */
+* {font-family: Arial, Tahoma, Lucida Grande, Sans-Serif, Lucida Sans;}
+
+#errButton {
+    position: fixed;
+    top: 300px;
+    left: 0;
+    width: 35px;
+    height: 73px;
+    /*padding: 12px 0;*/
+    text-align: center;
+    background-color: #3a84a6; /*#6DAD53;*/
+    -webkit-border-radius: 0 5px 5px 0;
+    -moz-border-radius: 0 5px 5px 0;
+    border-radius: 0 5px 5px 0;
+}
+
+#errButton:hover {
+    background-color: #3399cc;
+    cursor: pointer;
+}
+
+#errButton:active {
+    border: 1px inset #3399cc;
+}
+
+#errButton_img {
+    width: 12px;
+    height: 72px;
+    margin: 0 auto;
+    background-image: url(icons/feedback.png);
+    background-repeat: no-repeat;
+}
+
+/*------------------------ Dialog options -------------------------------[*/
+#errDialog {
+    height: 400px;
+}
+
+.ui-dialog .ui-dialog-titlebar 
+{
+    height: 15px; /* or whatever you want */
+    font-size: 12px;
+}
+
+
+.dialogTopText {
+    text-align: center;
+    font: 11pt sans-serif;  
+    color: #787977; 
+}
+
+
+
+.dialogMyMessagesBtn {
+    margin: 10px auto 5px auto;
+    text-align: center;
+
+    -webkit-border-radius: 5px;
+    -moz-border-radius: 5px;
+    border-radius: 5px;
+
+    background-color: #3a84a6;
+    font: 10pt sans-serif;  
+    color: #FFFFFF;     
+}
+
+.dialogMyMessagesBtn:hover {
+    background-color: #3399cc;
+    cursor: pointer;    
+}
+
+.dialogMyMessagesBtn:active {
+    background-color: #3399aa;
+}
+
+.dialogMyMessages {
+    margin-left: 15px;
+    margin-right: 15px;
+    margin-top: 5px;
+
+    height: 0;
+    background-color: #fff5d7;
+
+    font: 9pt sans-serif;  
+    color: #000000;         
+}
+
+
+.dialogMessageTitle {
+    margin-left: 13px;
+    margin-right: 13px;
+    margin-top: 5px;
+
+    padding-right: 22px;
+    padding-bottom: 5px;
+    padding-left: 2px;
+    padding-top: 2px;       
+}
+
+#messageTitle {
+    height: 100%;
+    width: 100%;
+    padding: 9px;
+    border: solid 1px #E5E5E5;
+    outline: 0;
+    font: normal 13px/100% Verdana,  Tahoma, sans-serif;
+
+    box-shadow: rgba(0,0,0, 0.1) 0px 0px  8px;
+    -moz-box-shadow: rgba(0,0,0, 0.1)  0px 0px 8px;
+    -webkit-box-shadow: rgba(0,0,0, 0.1)  0px 0px 8px;  
+    
+}
+
+.dialogTextMessage {
+/*  border: 1px solid black;*/
+    margin-left: 13px;
+    margin-right: 13px;
+    margin-top: 5px;
+    height: 150px;
+    padding-right: 22px;
+    padding-bottom: 30px;
+    padding-left: 3px;
+    padding-top: 2px;
+}
+
+#message {
+
+    resize: none;
+    overflow: auto;
+    width: 100%;
+    height: 100%;
+    /*border: 1px solid black*/
+
+
+    padding: 9px;
+    border: solid 1px #E5E5E5;
+    outline: 0;
+    font: normal 13px/100% Verdana,  Tahoma, sans-serif;
+
+    box-shadow: rgba(0,0,0, 0.1) 0px 0px  8px;
+    -moz-box-shadow: rgba(0,0,0, 0.1)  0px 0px 8px;
+    -webkit-box-shadow: rgba(0,0,0, 0.1)  0px 0px 8px;  
+
+}
+
+
+#dialogSendButton {
+    text-align: center;
+    float: right;
+    margin-right: 15px;
+    margin-top: 5px;
+    text-align: center;
+
+    padding: 5px;
+/*  width: 70px;
+    height: 20px;*/
+    -webkit-border-radius: 3px;
+    -moz-border-radius: 3px;
+    border-radius: 3px;
+
+    background-color: #3a84a6;
+    font: 9pt sans-serif;  
+    color: #FFFFFF;     
+}
+
+
+#dialogSendButton:hover {
+    background-color: #3399cc;
+    cursor: pointer;    
+}
+
+#dialogSendButton:active {
+    background-color: #3399aa;
+}
+
+.imgMes {
+    display: inline-block;
+    float: left;
+    width: 32px;
+    height: 32px;
+    background-image: url(icons/ok.png);
+    background-repeat: no-repeat;
+}
+
+.textMes {
+    display: inline-block;
+    float: left;
+    vertical-align: middle;
+    margin-top: 10px;
+    margin-left: 2px;
+}
+
+.request {
+    margin-left: 5px;
+    margin-right: 5px;
+    margin-top: 5px;
+    margin-bottom: 5px;
+    font: 8pt sans-serif;  
+    color: #000000; 
+}
+
+.request:hover {
+    background-color: #f8e19c;
+    cursor: pointer;
+}
+
+
+.dateReq {
+    display: inline-block;
+    font: 8pt sans-serif;  
+    color: #3399cc;     
+}
+
+.titleReq {
+    margin-left: 5px;
+    display: inline-block;
+    font: 8pt sans-serif;  
+    color: #000000;     
+}
+
diff --git a/~dev_rating/media/css/errorButton.css b/~dev_rating/media/css/errorButton.css
deleted file mode 100644
index c6d51afe5..000000000
--- a/~dev_rating/media/css/errorButton.css
+++ /dev/null
@@ -1,243 +0,0 @@
-* {font-family: Arial, Tahoma, Lucida Grande, Sans-Serif, Lucida Sans;}
-
-#errButton {
-	position: fixed;
-	top: 300px;
-	left: 0;
-	width: 35px;
-	height: 73px;
-	/*padding: 12px 0;*/
-	text-align: center;
-	background-color: #3a84a6; /*#6DAD53;*/
-	-webkit-border-radius: 0 5px 5px 0;
-	-moz-border-radius: 0 5px 5px 0;
-	border-radius: 0 5px 5px 0;
-}
-
-#errButton:hover {
-	background-color: #3399cc;
-	cursor: pointer;
-}
-
-#errButton:active {
-	border: 1px inset #3399cc;
-}
-
-#errButton_img {
-	width: 12px;
-	height: 72px;
-	margin: 0 auto;
-	background-image: url(icons/feedback.png);
-	background-repeat: no-repeat;
-}
-
-/*------------------------ Dialog options -------------------------------[*/
-#errDialog {
-	height: 400px;
-}
-
-.ui-dialog .ui-dialog-titlebar 
-{
-    height: 15px; /* or whatever you want */
-    font-size: 12px;
-}
-
-
-.dialogTopText {
-	text-align: center;
-	font: 11pt sans-serif;  
-	color: #787977; 
-}
-
-
-
-.dialogMyMessagesBtn {
-	margin-left: 15px;
-	margin-right: 15px;
-	margin-top: 10px;
-	text-align: center;
-
-	-webkit-border-radius: 5px;
-	-moz-border-radius: 5px;
-	border-radius: 5px;
-
-	background-color: #3a84a6;
-	font: 10pt sans-serif;  
-	color: #FFFFFF; 	
-}
-
-.dialogMyMessagesBtn:hover {
-	background-color: #3399cc;
-	cursor: pointer;	
-}
-
-.dialogMyMessagesBtn:active {
-	background-color: #3399aa;
-}
-
-.dialogMyMessages {
-	margin-left: 15px;
-	margin-right: 15px;
-	margin-top: 5px;
-
-	height: 0;
-	background-color: #fff5d7;
-
-	font: 9pt sans-serif;  
-	color: #000000; 		
-}
-
-
-.dialogMessageTitle {
-	margin-left: 13px;
-	margin-right: 13px;
-	margin-top: 5px;
-
-	padding-right: 22px;
-	padding-bottom: 5px;
-	padding-left: 2px;
-	padding-top: 2px; 		
-}
-
-#messageTitle {
-	height: 100%;
-	width: 100%;
-    padding: 9px;
-    border: solid 1px #E5E5E5;
-    outline: 0;
-    font: normal 13px/100% Verdana,  Tahoma, sans-serif;
-
-    box-shadow: rgba(0,0,0, 0.1) 0px 0px  8px;
-    -moz-box-shadow: rgba(0,0,0, 0.1)  0px 0px 8px;
-    -webkit-box-shadow: rgba(0,0,0, 0.1)  0px 0px 8px;	
-   	
-}
-
-.dialogTextMessage {
-/*	border: 1px solid black;*/
-	margin-left: 13px;
-	margin-right: 13px;
-	margin-top: 5px;
-	height: 150px;
-	padding-right: 22px;
-	padding-bottom: 30px;
-	padding-left: 3px;
-	padding-top: 2px;
-}
-
-#message {
-
-	resize: none;
-	overflow: auto;
-	width: 100%;
-	height: 100%;
-	/*border: 1px solid black*/
-
-
-    padding: 9px;
-    border: solid 1px #E5E5E5;
-    outline: 0;
-    font: normal 13px/100% Verdana,  Tahoma, sans-serif;
-
-    box-shadow: rgba(0,0,0, 0.1) 0px 0px  8px;
-    -moz-box-shadow: rgba(0,0,0, 0.1)  0px 0px 8px;
-    -webkit-box-shadow: rgba(0,0,0, 0.1)  0px 0px 8px;	
-
-}
-
-
-.dialogSendButton {
-	text-align: center;
-	float: right;
-	margin-right: 15px;
-	margin-top: 5px;
-	text-align: center;
-
-	padding: 5px;
-/*	width: 70px;
-	height: 20px;*/
-	-webkit-border-radius: 3px;
-	-moz-border-radius: 3px;
-	border-radius: 3px;
-
-	background-color: #3a84a6;
-	font: 9pt sans-serif;  
-	color: #FFFFFF; 	
-}
-
-
-.dialogSendButton:hover {
-	background-color: #3399cc;
-	cursor: pointer;	
-}
-
-.dialogSendButton:active {
-	background-color: #3399aa;
-}
-
-.trueMessageOfQuery {
-	height: 30px;
-	width: 180px;
-	font: 9pt sans-serif;  
-	color: #FFFFFF; 
-	position: absolute;
-	margin-top: 10px;
-	margin-left: 400px;
-
-	background-color: #3399aa;
-
-	text-align: center;
-	vertical-align: middle;
-	-webkit-border-radius: 3px;
-	-moz-border-radius: 3px;
-	border-radius: 3px;
-
-}
-
-.imgMes {
-	display: inline-block;
-	float: left;
-	width: 32px;
-	height: 32px;
-	background-image: url(icons/ok.png);
-	background-repeat: no-repeat;
-}
-
-.textMes {
-	display: inline-block;
-	float: left;
-	vertical-align: middle;
-	margin-top: 10px;
-	margin-left: 2px;
-}
-
-.request {
-	margin-left: 5px;
-	margin-right: 5px;
-	margin-top: 5px;
-	margin-bottom: 5px;
-	font: 8pt sans-serif;  
-	color: #000000; 
-}
-
-.request:hover {
-	background-color: #f8e19c;
-	cursor: pointer;
-}
-
-
-.dateReq {
-	display: inline-block;
-	font: 8pt sans-serif;  
-	color: #3399cc; 	
-}
-
-.titleReq {
-	margin-left: 5px;
-	display: inline-block;
-	font: 8pt sans-serif;  
-	color: #000000; 	
-}
-
-
-
diff --git a/~dev_rating/media/js/discipline/CreateDiscipline.js b/~dev_rating/media/js/discipline/CreateDiscipline.js
index e896a0cda..23e796910 100644
--- a/~dev_rating/media/js/discipline/CreateDiscipline.js
+++ b/~dev_rating/media/js/discipline/CreateDiscipline.js
@@ -2,27 +2,28 @@ var $ = jQuery;
 $(function() {
 
 	// Изменения базовых параметров дисциплины
-    $(".AddDiscipline").click(function(){
+    $(".AddDiscipline").click(function()
+    {
 		var thisObj = $(this);
     	$(this).attr("disabled", true);
-		var BonusRate = $(".BonusRate").first().prop("checked");
+		var BonusRate = $(".BonusRate").prop("checked");
 		$.post(
 			URLdir + 'handler/map/AddDiscipline',
 			{
-				'Grade': $('select.SelectGrade').first().val(),
-				'SubjectID': $('select.SelectSubject').first().val(),
+				'Grade': $('select.SelectGrade').val(),
+				'SubjectID': $('select.SelectSubject').val(),
 				'BonusRate': BonusRate,
-				'ExamType': $('input.InputText').filter(':radio:checked').first().val(),
-				'LectionCount': $('input.InputLectionCount').first().val(),
-				'PracticeCount': $('input.InputPracticeCount').first().val(),
-				'FacultyID': $('select.SelectFaculty').first().val()
+				'ExamType': $('input.InputText').filter(':radio:checked').val(),
+				'LectionCount': $('input.InputLectionCount').val(),
+				'PracticeCount': $('input.InputPracticeCount').val(),
+				'FacultyID': $('select.SelectFaculty').val()
 			},
-			function(data){
+			function(data)
+			{
 				data = $.parseJSON(data);
 				if(data.success === true) {
-					//thisObj.hide();
 					EventInspector_ShowMsg('Дисциплина добавлена', 'success');
-					setTimeout('location.replace("'+URLdir+'discipline/structure/'+data.DisciplineID+'")', 1000); 
+					setTimeout('location.replace("'+URLdir+'discipline/structure/'+data.DisciplineID+'")', 800); 
 				} else {
 					thisObj.removeAttr('disabled');
 					EventInspector_ShowMsg('Ошибка при добавлении дисциплины', 'error');
diff --git a/~dev_rating/media/js/discipline/EditSettings.js b/~dev_rating/media/js/discipline/EditSettings.js
index 113c37fd1..790f77276 100644
--- a/~dev_rating/media/js/discipline/EditSettings.js
+++ b/~dev_rating/media/js/discipline/EditSettings.js
@@ -4,14 +4,16 @@ $(function() {
 // ---- Изменения базовых параметров дисциплины ---
 	
 	// Изменение предмета
-	$('select.SelectSubject').change(function(){
+	$('select.SelectSubject').change(function()
+	{
 		$.post(
 			URLdir + 'handler/map/ChangeDisciplineSubject',
 			{
 				'DisciplineID': DisciplineID,
 				'SubjectID': $(this).val()
 			},
-			function(data) {
+			function(data) 
+			{
 				data = $.parseJSON(data);
 				if(data.success === true)
 					EventInspector_ShowMsg('Предмет изменен', 'success');
@@ -21,24 +23,33 @@ $(function() {
 	});
 	
 	// Изменение курса
-	$('select.SelectDisGrade').change(function(){ // SelectGrade совпадает с другим, поэтому SelectDisGrade
+	$('select.SelectDisGrade').change(function()
+	{ // SelectGrade совпадает с другим, поэтому SelectDisGrade
+		thisObj = $(this);
+		$(this).prop('disabled', true);
  		$.post(
 			URLdir + 'handler/map/ChangeDisciplineGrade',
 			{
 				'DisciplineID': DisciplineID,
 				'GradeID': $(this).val()
 			},
-			function(data) {
+			function(data)
+			{
 				data = $.parseJSON(data);
 				if(data.success === true)
 					EventInspector_ShowMsg('Курс изменен', 'success');
 				else EventInspector_ShowMsg('Ошибка: Изменение курса', 'error');
+				thisObj.removeAttr('disabled');
 			}
+			
 		);
 	});
 	
 	// Бонусные баллы
-	$('input.BonusRate').change(function(){
+	$('input.BonusRate').change(function()
+	{
+		var thisObj = $(this);
+		$(this).attr('disabled', true);
 		$.post(
 			URLdir + 'handler/map/ChangeStatusBonusModule',
 			{
@@ -52,16 +63,20 @@ $(function() {
 														: 	'Бонусные баллы удалены';
 					EventInspector_ShowMsg(message, 'success');
 				}
-				else EventInspector_ShowMsg('Ошибка: Бонусные баллы', 'error');
+				else {
+					EventInspector_ShowMsg('Ошибка: Бонусные баллы', 'error');
+					$(this).prop("checked", ! thisObj.prop("checked"));
+				}
+				thisObj.removeAttr('disabled');
 			}
 		);
 	});
 	
 	// Изменение контроля
-	$('input.ExamType').change(function(){
+	$('input.ExamType').change(function()
+	{
 		var thisObj = $(this);
-		thisObj.parent().children('.ExamType[value="exam"]').attr("disabled", true);
-		thisObj.parent().children('.ExamType[value="credit"]').attr("disabled", true);
+		thisObj.parent().children('input.ExamType').attr("disabled", true);
 		$.post(
 			URLdir + 'handler/map/ChangeDisciplineControl',
 			{
@@ -70,16 +85,16 @@ $(function() {
 			},
 			function(data) {
 				data = $.parseJSON(data);
+				var list = thisObj.parent().children('input.ExamType'); 
 				if(data.success == 0)
 					EventInspector_ShowMsg('Форма контроля изменена', 'success');
 				else if (data.success > 0) {
-					EventInspector_ShowMsg('Превышено максимальное кол-во баллов', 'error');
-					thisObj.parent().children('.ExamType[value="exam"]').removeAttr('disabled');
-					thisObj.parent().children('.ExamType[value="credit"]')
-						.removeAttr('disabled')
-						.prop('checked', true);
+					EventInspector_ShowMsg('Превышено максимальное кол-во баллов', 'error');	
+					list.not(thisObj).prop('checked', true);
 				}
 				else EventInspector_ShowMsg('Ошибка: Изменение формы контроля', 'error');
+
+				list.removeAttr('disabled');
 			}
 		);
 	});
@@ -91,7 +106,10 @@ $(function() {
 	};
 
 	// Изменение лекционных часов
-	$('input.InputLectionCount').focusout(function(){
+	$('input.InputLectionCount').focusout(function()
+	{
+		thisObj = $(this);
+		$(this).prop('disabled', true);
 		$.post(
 			URLdir + 'handler/map/ChangeDisciplineHours',
 			{
@@ -99,17 +117,23 @@ $(function() {
 				'Hours': $(this).val(),
 				'Type': LessonType.Lection
 			},
-			function(data) {
+			function(data) 
+			{
 				data = $.parseJSON(data);
 				if(data.success === true)
 					EventInspector_ShowMsg('Лекционные часы изменен', 'success');
 				else EventInspector_ShowMsg('Ошибка: Изменение лекционных часов', 'error');
+
+				thisObj.removeAttr('disabled');
 			}
 		);
 	});
 	
 	// Изменение практических часов
-	$('input.InputPracticeCount').focusout(function(){
+	$('input.InputPracticeCount').focusout(function()
+	{
+		thisObj = $(this);
+		$(this).prop('disabled', true);
 		$.post(
 			URLdir + 'handler/map/ChangeDisciplineHours',
 			{
@@ -117,11 +141,14 @@ $(function() {
 				'Hours': $(this).val(),
 				'Type': LessonType.Practice
 			},
-			function(data) {
+			function(data) 
+			{
 				data = $.parseJSON(data);
 				if(data.success === true)
 					EventInspector_ShowMsg('Практические часы изменен', 'success');
 				else EventInspector_ShowMsg('Ошибка: Изменение практических часов', 'error');
+
+				thisObj.removeAttr('disabled');
 			}
 		);
 	});
diff --git a/~dev_rating/media/js/errDialog.js b/~dev_rating/media/js/errDialog.js
index 15c06a437..e0df9d5c0 100644
--- a/~dev_rating/media/js/errDialog.js
+++ b/~dev_rating/media/js/errDialog.js
@@ -45,47 +45,43 @@ $(document).ready(function() {
 	}
 
 
-	function dialogSendButton() {
-		var mesTitle = $('#messageTitle').val();
-		var mesText = $('#message').val();
-		
-		if(mesTitle == '')
-			alert("Вы не ввели сообщение");
-		else if(mesText == '')
-			alert("Вы не ввели тему сообщения");
-		else 
-			$.ajax({
-					type: "POST",
-					url: URLdir + "handler/ErrMessages/createRequest",       
-					data: {title: mesTitle, text: mesText},
-					success: function(html){ 
-						$('#errDialog').dialog("close");
-
-						$('.main').prepend('<div class="trueMessageOfQuery"><div class="imgMes"></div><div class="textMes">Сообщение отправлено!</div></div>');
-						$('.trueMessageOfQuery').hide("fade", 4500, function() {
-					    	$('.trueMessageOfQuery').remove();	
-						});
-					}
-			});					
-	}
 
+	$('#errButton').click(function()
+	{
+		$('#errDialog').dialog("open");
+		$('.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("Вы не ввели тему сообщения");
+			else 
+				$.ajax({
+						type: "POST",
+						url: URLdir + "handler/ErrMessages/createRequest",       
+						data: 	{	title: mesTitle, 
+									text: mesText
+								},
+						success: function(data){ 
+							data = $.parseJSON(data);
+							$('#messageTitle').val('');
+							$('#message').val('');
 
-	$('#errButton').click(function(){
-		$.ajax({
-				type: "POST",
-				url: URLdir + "handler/BaseDialog/returnDialogHtml",    
-				data: {},
-				success: function(html){ 
-					data = html;
-					$('#errDialog').html(html).dialog("open");
-					$('.dialogMyMessagesBtn').click(dialogMyMessagesBtn);
-					$('.dialogSendButton').click(dialogSendButton);
-				}
-		});		                  	
+							//if(data.success === true)
+								EventInspector_ShowMsg('Сообщение успешно отправлено!', 'success');
+							//else 
+							//	EventInspector_ShowMsg('Сообщение не отправлено', 'error');
+							thisObj.removeAttr('disabled');
+						}
+				});					
+		});	                  	
 	});
 
 
-	//$('#errDialog').dialog("open");
-
-
 });
diff --git a/~dev_rating/media/js/errDialogControl.js b/~dev_rating/media/js/errDialogControl.js
deleted file mode 100644
index ab4796db3..000000000
--- a/~dev_rating/media/js/errDialogControl.js
+++ /dev/null
@@ -1,42 +0,0 @@
-	
-
-	$('.dialogSendButton').click(function(){
-		var mesTitle = $('#messageTitle').val();
-		var mesText = $('#message').val();
-		
-		// $.ajax({
-		// 		type: "POST",
-		// 		url: "",
-		// 		data: {title: mesTitle, text: mesText},
-		// 		success: function(html){ 	
-		// 			$('#errDialog').html(html);
-		// 		}
-		// });
-
-		$('#errDialog').prepend('<div class="trueMessageOfQuery"><div class="imgMes"></div><div class="textMes">Сообщение отправлено!</div></div>');
-
-		$('.trueMessageOfQuery').hide("fade", 4500, function() {
-		   $('.trueMessageOfQuery').remove();
-		});
-
-
-		$('#messageTitle').val('');
-		$('#message').val('');
-
-	});
-
-
-	$('.dialogMyMessagesBtn').click(function(){
-
-		if(!checkMessages)
-		{
-			$('.dialogMyMessages').animate({height: "100px"}, 500);
-		//	$('#errDialog').animate({height: "400px"}, 500);
-			checkMessages = true;
-		}
-		else
-		{
-			$('.dialogMyMessages').animate({height: "0px"}, 500);
-			checkMessages = false;			
-		}
-	});
-- 
GitLab