From 4907ead7fde70af1df6a328aeb5a2bf8aa038f12 Mon Sep 17 00:00:00 2001 From: PavelBegunkov <asml.Silence@gmail.com> Date: Mon, 22 Sep 2014 21:29:00 +0400 Subject: [PATCH] errors: latent threat --- ~dev_rating/media/js/errDialog.js | 78 ++++++++++++++++--------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/~dev_rating/media/js/errDialog.js b/~dev_rating/media/js/errDialog.js index f27a9f0b5..1ba200523 100644 --- a/~dev_rating/media/js/errDialog.js +++ b/~dev_rating/media/js/errDialog.js @@ -14,7 +14,9 @@ $(document).ready(function() { } }); - function dialogMyMessagesBtn() + + + $('.dialogMyMessagesBtn').click(function() { if(!checkMessages) { @@ -42,47 +44,49 @@ $(document).ready(function() { $('.dialogMyMessages').animate({height: "0px"}, 500).html(''); checkMessages = false; } - } + }); - $('#errButton').click(function() + $('#dialogSendButton').click(function() { - $('#errDialog').dialog("open"); - $('.dialogMyMessagesBtn').click(dialogMyMessagesBtn); - $('#dialogSendButton').click(function dialogSendButton() + var mesTitle = $('#messageTitle').val(); + var mesText = $('#message').val(); + if(mesTitle.length == 0) + EventInspector_ShowMsg('Вы не ввели тему сообщения', 'error'); + else if(mesText.length == 0) + EventInspector_ShowMsg('Вы не ввели сообщение', 'error'); + else { - var mesTitle = $('#messageTitle').val(); - var mesText = $('#message').val(); - 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", - data: { title: mesTitle, - text: mesText - }, - success: function(data){ - data = $.parseJSON(data); - $('#messageTitle').val(''); - $('#message').val(''); - - if(data.success === true) - EventInspector_ShowMsg('Сообщение успешно отправлено!', 'success'); - else - EventInspector_ShowMsg('Сообщение не отправлено', 'error'); - thisObj.removeAttr('disabled'); - } - }); - } - }); + var thisObj = $(this); + $(this).attr("disabled", true); + + $.ajax({ + type: "POST", + url: URLdir + "handler/ErrMessages/createRequest", + data: { title: mesTitle, + text: mesText + }, + success: function(data){ + data = $.parseJSON(data); + $('#messageTitle').val(''); + $('#message').val(''); + + if(data.success === true) + EventInspector_ShowMsg('Сообщение успешно отправлено!', 'success'); + else + EventInspector_ShowMsg('Сообщение не отправлено', 'error'); + thisObj.removeAttr('disabled'); + } + }); + } + }); + + + + $('#errButton').click(function() + { + $('#errDialog').dialog("open"); }); -- GitLab