X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=setup%2Fclass_setup.inc;h=f59d5f68bd0f93cdc040017aed37f9b79a63d285;hb=e7c682a37ee231cdae9e969785f372375c9f2de3;hp=89949ecd27416681bd33c0f1d6a99f13df939aca;hpb=2847407c21d5b5bffc413bb62271394c822094a6;p=gosa.git diff --git a/setup/class_setup.inc b/setup/class_setup.inc index 89949ecd2..f59d5f68b 100644 --- a/setup/class_setup.inc +++ b/setup/class_setup.inc @@ -20,10 +20,10 @@ require_once("class_setupStep.inc"); -class setup extends plugin +class setup { - var $i_steps = 5; // Number of setup steps + var $i_steps = 7; // Number of setup steps var $i_current= 1; // Current step var $i_last = 1; // Last setup step; var $o_steps = array(); @@ -34,7 +34,14 @@ class setup extends plugin { for($i = 1 ; $i <= $this->i_steps; $i ++ ){ $class= "setup_step_".$i; - $this->o_steps[$i] = new $class(); + + if(class_exists($class)){ + $this->o_steps[$i] = new $class(); + }else{ + $this->o_steps[$i] = new setup_step(); + trigger_error("Try to create class '".$class."' but it is not available, possibly you have forgotten to add the include in setup.php"); + } + $this->o_steps[$i]->parent = $this; } } @@ -60,23 +67,45 @@ 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(); - } + /* Set parent */ + foreach($this->o_steps as $key => $value){ + $this->o_steps[$key]->parent = $this; + } + + /* 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 +114,7 @@ class setup extends plugin /* Create navigation menu */ function get_navigation_html() { - $str = ""; - + $str = ""; foreach($this->o_steps as $key => $step){ $s_title = $step -> get_title(); @@ -94,23 +122,25 @@ class setup extends plugin $b_active = $step -> is_active(); $b_enabled = $step -> is_enabled(); - $str .= ""; + $str .= "" ; } - $str .="
"; + $str .="
"; if($b_enabled){ - $str .= ""; - $str .= "".$s_title.""; if($b_active){ - $str .= "
"; - $str .= " ".$s_info.""; - $str .= "
"; + $str .= "
"; + $str .= ""; + $str .= ""; + $str .= "
\n"; + }else{ + $str .= ""; + $str .= ""; + $str .= "
\n"; } - $str .= ""; }else{ - $str .= "".$s_title.""; + $str .= ""; } - $str .= "

 

"; - $str .= "
"; return($str); } @@ -118,9 +148,26 @@ class setup extends plugin /* Create header entry */ function get_header_html() { - $str =""; + $str =""; + $str.="
"; + $str.="
"; + $str.=" "; $str.= $this->o_steps[$this->i_current]->get_long_title(); - $str.=""; + $str.=" "; + $str.="
"; + $str.="
"; + if(isset($this->o_steps[$this->i_current -1]) && $this->o_steps[$this->i_current -1]->is_enabled()){ + $str.=" "; + }else{ + $str.=" "; + } +# if(isset($this->o_steps[$this->i_current +1]) && $this->o_steps[$this->i_current +1]->is_enabled()){ + $str.=" "; +# }else{ +# $str.=" "; +# } + $str.= "
"; + $str.= "
"; return ($str); }