Code

Updated setup
[gosa.git] / setup / class_setup.inc
index 89949ecd27416681bd33c0f1d6a99f13df939aca..83812649cc24fad9c19b4a134efc1b73475bf6a0 100644 (file)
@@ -60,23 +60,40 @@ class setup extends plugin
       $this->captured_values[$name] = $value;
     }
 
-    /* check if current setup step is completed now 
-        and activate the next step if possible */
-    for($i = 1 ; $i <= $this->i_steps ; $i ++ ){
-      if($this->o_steps[$i]->is_completed()){
-        if(isset($this->o_steps[($i+1)])){
-          $this->o_steps[($i+1)]->set_enabled();
-        }
+    /* Check if image button requests next page */
+    foreach($_POST as $name => $value){
+      if(preg_match("/^next_(x|y)/",$name)){
+        $_POST['next'] = TRUE;
+      }
+      if(preg_match("/^last_(x|y)/",$name)){
+        $_POST['last'] = TRUE;
       }
     }
 
     /* Check if step was selected */
-    if(isset($_GET['step'])){
-      $step = $_GET['step'];
+    if(isset($_GET['step']) || isset($_POST['next']) || isset($_POST['last'])){
+
+      /* check if current setup step is completed now 
+          and activate the next step if possible */
+      for($i = 1 ; $i <= $this->i_steps ; $i ++ ){
+        if($this->o_steps[$i]->is_completed()){
+          if(isset($this->o_steps[($i+1)])){
+            $this->o_steps[($i+1)]->set_enabled();
+          }
+        }
+      }
+
+      if(isset($_GET['step'])){
+        $step = $_GET['step'];
+      }elseif(isset($_POST['next'])){
+        $step = $this->i_current + 1;
+      }elseif(isset($_POST['last'])){
+        $step = $this->i_current - 1;
+      }
 
       if($this->selectable_step($step)){
         $this->i_last    = $this->i_current;
-        $this->i_current = $_GET['step'];
+        $this->i_current = $step;
       }
     }
   }
@@ -85,8 +102,7 @@ class setup extends plugin
   /* Create navigation menu */
   function get_navigation_html()
   {
-    $str = "<table>";
-  
+    $str = "";
     foreach($this->o_steps as $key => $step){
 
       $s_title    = $step -> get_title();
@@ -94,23 +110,25 @@ class setup extends plugin
       $b_active   = $step -> is_active();
       $b_enabled  = $step -> is_enabled();
 
-      $str .= "<tr><td>";  
+      $str .="<div >";
       if($b_enabled){
-        $str .= "<a href='?step=".$key."'>";
-        $str .= "<font color='darkblue' style='font-size:14pt;'>".$s_title."</font>";
         if($b_active){
-          $str .= "<div style='padding-left:16px;'>";
-          $str .= "  <font style='font-size:10pt;'>".$s_info."</font>";
-          $str .= "</div>";
+          $str .= "<a href='?step=".$key."' class='navigation_element_active'>";
+          $str .= "<div class='navigation_title_active'>".$s_title."</div>";
+          $str .= "<div class='navigation_info'>".$s_info."</div>";
+          $str .= "</a><br>\n";
+        }else{
+          $str .= "<a href='?step=".$key."' class='navigation_element'>";
+          $str .= "<div class='navigation_title_inactive'>".$s_title."</div>";
+          $str .= "</a><br>\n";
         }
-        $str .= "</a>";
       }else{
-        $str .= "<font color='darkgrey' style='font-size:14pt;'>".$s_title."</font>";
+        $str .= "<div class='navigation_element'>";
+        $str .= "<div class='navigation_title_disabled'>".$s_title."</div>";
+        $str .= "</div>";
       }
-      $str .= "<p class='seperator'>&nbsp;</p>";
-      $str .= "</td></tr>";
+      $str .= "</div>" ;
     }
-    $str .="</table>";
     return($str);
   }
 
@@ -118,9 +136,26 @@ class setup extends plugin
   /* Create header entry */
   function get_header_html()
   {
-    $str ="<font style='font-size:20px;' color='darkblue'>";
+    $str ="";
+    $str.=" <div >";
+    $str.="   <div>";
+    $str.="     <font style='font-size:20px;float:top'>";
     $str.=   $this->o_steps[$this->i_current]->get_long_title();
-    $str.="</font>";
+    $str.="     </font>";
+    $str.="   </div>";
+    $str.="   <div style='text-align:right;float:top;'>";
+    if(isset($this->o_steps[$this->i_current -1]) && $this->o_steps[$this->i_current -1]->is_enabled()){
+      $str.="   <input class='center' type='image' name='last' src='images/setup_step_back.png'  title='"._("Last step")."'>";
+    }else{
+      $str.="   <img class='center' src='images/setup_step_back_gray.png' title='"._("Last step")."'>";
+    }
+#   if(isset($this->o_steps[$this->i_current +1]) && $this->o_steps[$this->i_current +1]->is_enabled()){
+      $str.="   <input class='center' type='image' name='next' src='images/setup_step_forward.png'  title='"._("Next step")."'>";
+#   }else{
+#     $str.="   <img class='center' src='images/setup_step_forward_gray.png'  title='"._("Next step")."'>";
+#   }
+    $str.= "  </div>";
+    $str.= "</div>";
     return ($str);
   }