From 9aac5357c8ac94c0afd050695f0052fbaae3c542 Mon Sep 17 00:00:00 2001
From: pimka <pimka@ro.ru>
Date: Fri, 26 Dec 2014 02:27:23 +0300
Subject: [PATCH] authentication timeout modal window

---
 ~dev_rating/application/views/base.twig | 26 +++++++
 ~dev_rating/media/css/base.css          | 91 +++++++++++++++++++++++++
 ~dev_rating/media/js/profile.js         | 39 +++--------
 3 files changed, 125 insertions(+), 31 deletions(-)

diff --git a/~dev_rating/application/views/base.twig b/~dev_rating/application/views/base.twig
index 224775bdb..fc75c530f 100644
--- a/~dev_rating/application/views/base.twig
+++ b/~dev_rating/application/views/base.twig
@@ -124,5 +124,31 @@
 		</div>
 
 	</div>
+
+<div class="popup_overlay">
+    <div class="popup">
+	    <form action="sign" method='POST' id='signin_f'>
+            <div class="session_info">Пожалуйста, авторизируйтесь заново</div>
+            <div class='auth_error'>Неправильный логин/E-Mail или пароль</div>
+            <div class='inputs'>
+                <div class="auth_form">
+                    <input type="text" id="login" name="login" placeholder="Логин или E-Mail">
+                </div>
+                <div class="auth_form">
+                    <input type="text" id="password" name="password" placeholder="Пароль">
+                </div>
+            </div>
+            
+          <!--   {{ sign.input('signin_b', 'button', 'Войти') }} -->
+            <div class="auth_form">
+                <input type="button" id="signin_b" name="button" value="Войти">
+            </div>
+	    </form>
+	    <div class='actiongrid'>
+	        {# {{ HTML.anchor('remind', 'Забыли пароль?')|raw }} | #}
+	        {{ HTML.anchor('sign/up', 'Активировать аккаунт')|raw }} | {{ HTML.anchor('remind', 'Забыли пароль?')|raw }}
+	    </div>
+    </div>
+</div>	
 </body>
 </html>
\ No newline at end of file
diff --git a/~dev_rating/media/css/base.css b/~dev_rating/media/css/base.css
index 8133da592..3f1ae32ab 100644
--- a/~dev_rating/media/css/base.css
+++ b/~dev_rating/media/css/base.css
@@ -299,8 +299,99 @@ h2.BlueTitle{
 
 
 
+/*----------------  модальное окно  -------------------*/
+.session_info {
+    font: 9pt;
+    color: #aaaaaa;
+}
+
+.auth_form
+{
+    padding: 3px;
+    margin: 0 auto;
+    text-align: center;
+}
+
+.auth_form input
+{
+    margin: 0 auto;
+    margin: 1px 0;
+    border: 1px solid;
+    border-radius: 3px;
+}
+
+.auth_form input[type=text], .auth_form input[type=password]
+{
+    font-size: 9pt;
+    width: 90%;
+    border-color: #aaaaaa;
+    overflow: hidden;
+    padding: 7px; 
+}
+
+.auth_form input[type=button], .auth_form input[type=submit]
+{
+    margin: 0 auto;
+    width: 95%;
+    overflow: hidden;
+    padding: 7px;
+    background-color: #009933;
+    border: none;
+    color: #ffffff;
+}
 
+.auth_form input[type=button]:hover, .auth_form input[type=submit]:hover
+{
+    cursor: pointer;
+    background-color: #009000;
+}
+
+
+.popup_overlay {
+	z-index: 9999;
+    display: none;
+    position: fixed;
+    left: 0;
+    top: 0;
+    width: 100%;
+    height: 100%;
+    background: rgba(0,0,0,.7);
+    text-align: center;
+}
+
+.popup_overlay:after {
+    display: inline-block;
+    height: 100%;
+    width: 0;
+    vertical-align: middle;
+    content: '';
+}
 
+.popup {
+    display: inline-block;
+    position: relative;
+    max-width: 300px;
+    padding: 20px;
+    border: 3px solid #fff;
+    border-radius: 10px;
+    box-shadow: inset 0 1px 2px 1px rgba(0,0,0,.4);
+    background: #fff;
+    vertical-align: middle
+}
+
+
+.auth_error {
+    display: none;
+}
 
+.inputs {
+    margin: 0 auto;
+    margin-top: 5px;
+}
+
+.actiongrid {
+	margin-top: 5px;
+}
 
 
+/*----------------------------------------------------*/
diff --git a/~dev_rating/media/js/profile.js b/~dev_rating/media/js/profile.js
index 1b9bdbda8..21f97b82e 100644
--- a/~dev_rating/media/js/profile.js
+++ b/~dev_rating/media/js/profile.js
@@ -34,10 +34,15 @@ $(function()
 
 
     function closeSession() {
+       
+ 
+
         $.ajax({
             type: "POST",
             url: URLdir + "handler/Session/closeSession",
-            success: function(data) {window.location.replace(URLdir);}
+            success: function(data) {
+                $('.popup_overlay').css('display', 'block');
+            }
         });
     }
 
@@ -52,7 +57,7 @@ $(function()
                     data = $.parseJSON(data);
                     wait = parseInt(data, 10);
                     if (wait <= 10) {
-                        closeSession(wait);
+                        closeSession();
                         return;
                     } else {
                         setSessionTimer(wait-10); 
@@ -63,33 +68,5 @@ $(function()
     }
 
     setSessionTimer(1);
-
-
-
-
-    // $(document).bind('mousemove keydown scroll', function(){
-    //     clearTimeout(timer); // отменяем прежний временной отрезок
-
-    //     timer = setTimeout(function(){ 
-    //       // Действия на отсутствие пользователя
-    //         $.ajax({
-    //             type: "POST",
-    //             url: URLdir + "handler/Sign2/getSessionTime",       
-    //             success: function(data)
-    //             { 
-    //                 data = $.parseJSON(data);
-    //                 wait2 = data.duration;
-    //             }
-    //         }); 
-            
-            
-    //         if (wait < 10) {
-    //             alert("Простите, но Вы были неактивны более " + wait/(60 * 1000) + " минут. \n\
-    //                 Если Вы хотите продолжить работу, снова войдите в систему на странице авторизации.");
-    //             document.location.href = URLdir + "/sign/out"; 
-    //         }
-    //     }, wait);
-    // });
-
-    //$("body").trigger("mousemove"); // сгенерируем ложное событие, для запуска скрипта    
+  
 });
\ No newline at end of file
-- 
GitLab