Triggers must be displaid when page is loaded via ajax.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 6 Jan 2009 21:35:04 +0000 (22:35 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 6 Jan 2009 21:35:04 +0000 (22:35 +0100)
Can configure ajax animation.

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/plwizard.php
templates/plwizard.tpl

index 06e6914..43a8762 100644 (file)
@@ -70,13 +70,14 @@ class PlWizard
     protected $layout;
     protected $stateless;
     protected $ajax;
+    protected $ajax_animated;
 
     protected $pages;
     protected $titles;
     protected $lookup;
     protected $inv_lookup;
 
-    public function __construct($name, $layout, $stateless = false, $ajax = true)
+    public function __construct($name, $layout, $stateless = false, $ajax = true, $ajax_animated = true)
     {
         $this->name      = 'wiz_' . $name;
         $this->layout    = $layout;
@@ -85,6 +86,7 @@ class PlWizard
         $this->lookup = array();
         $this->titles = array();
         $this->ajax   = $ajax;
+        $this->ajax_animated = $ajax_animated;
         if (!isset($_SESSION[$this->name])) {
             $_SESSION[$this->name] = array();
             $_SESSION[$this->name . '_page']  = null;
@@ -212,7 +214,8 @@ class PlWizard
         }
         if ($mode == 'ajax') {
             header('Content-Type: text/html; charset=utf-8');
-            $smarty->changeTpl($page->template(), NO_SKIN);
+            $smarty->changeTpl($this->layout, NO_SKIN);
+            $smarty->assign('wiz_run_ajax', true);
         } else {
             $smarty->changeTpl($this->layout);
         }
@@ -222,6 +225,7 @@ class PlWizard
         $smarty->assign('stateless', $this->stateless);
         $smarty->assign('wiz_baseurl', $baseurl);
         $smarty->assign('wiz_ajax', $this->ajax);
+        $smarty->assign('wiz_animated', $this->ajax_animated);
         $smarty->assign('tab_width', (int)(99 / count($this->pages)));
         $smarty->assign('wiz_page', $page->template());
         $smarty->assign('pl_no_errors', true);
index 3fd0145..b44d80e 100644 (file)
@@ -20,6 +20,7 @@
 {*                                                                        *}
 {**************************************************************************}
 
+{if !$wiz_run_ajax}
 <script type="text/javascript">//<![CDATA[
   {if ($stateless || $id gt $current) && $wiz_ajax}
   {literal}
@@ -33,7 +34,7 @@
                       document.location = myUrl;
                     },
              success: function(data) {
-                        if (is_IE) {
+                        if ({/literal}{if !$wiz_animated}true || {/if}{literal}is_IE) {
                           $(".wiz_tab").removeClass("active");
                           $("#wiz_tab_" + id).addClass("active");
                           $(".wiz_content").html(data);
     <div style="clear: both"></div>
   </div>
   <div class="wiz_content" style="clear: both">
+  {/if}
+    <div style="width: 100%; height: 100%; margin: 0; padding: 0">
     {include core=triggers.tpl}
     {include file=$wiz_page}
+    </div>
+  {if !$wiz_run_ajax}
   </div>
 </div>
 
@@ -102,5 +107,5 @@ if (typeof wizPage_onLoad == 'function') {
 }
 {/literal}
 </script>
-
+{/if}
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}