[Jifty-commit] r7197 - jifty/trunk/lib/Jifty/Plugin/Config

Jifty commits jifty-commit at lists.jifty.org
Mon Jun 8 06:15:11 EDT 2009


Author: sunnavy
Date: Mon Jun  8 06:15:10 2009
New Revision: 7197

Modified:
   jifty/trunk/lib/Jifty/Plugin/Config/View.pm

Log:
make the seconds auto-reduced in restart page

Modified: jifty/trunk/lib/Jifty/Plugin/Config/View.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Config/View.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Config/View.pm	Mon Jun  8 06:15:10 2009
@@ -68,16 +68,36 @@
                     content      => "$seconds;url=$url",
                 };
             };
+            Jifty->web->include_javascript;
+            
+            outs_raw( <<EOF );
+<script type="text/javascript">
+
+var interval_id;
+function reduceTime () {
+    var left = parseInt(jQuery('#seconds').html());
+    if ( left > 0 ) {
+        jQuery('#seconds').html(left-1 + '');
+    }
+    else {
+        clearInterval(interval_id);
+    }
+};
+
+jQuery( function(){ interval_id = setInterval('reduceTime()', 1000 ) } );
+</script>
+
+EOF
         };
         body {
-            p {
-                outs "Please wait a few moments so the server can restart, then we'll redirect you ";
-                hyperlink(
-                    label => "here",
-                    url   => $url,
-                );
-                outs ".";
-            }
+            outs "Please wait ";
+            div { attr { style => 'display: inline', id => 'seconds' } $seconds };
+            outs " seconds so the server can restart, then we'll redirect you "; 
+            hyperlink(
+                label => "here",
+                url   => $url,
+            );
+            outs ".";
         }
     };
 


More information about the Jifty-commit mailing list