ref: refs/heads/network commit 23e573c8fb848d1e8c89b6e73acf3a0e890f900c Author: Josef Reidinger <jreidinger@suse.cz> Date: Thu Aug 20 14:12:17 2009 +0200 update to new workflow base system module --- .../app/controllers/controlpanel_controller.rb | 61 ++++++++++++++------ webclient/app/views/layouts/main.rhtml | 3 +- 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/webclient/app/controllers/controlpanel_controller.rb b/webclient/app/controllers/controlpanel_controller.rb index 55ef658..1ccfcd9 100644 --- a/webclient/app/controllers/controlpanel_controller.rb +++ b/webclient/app/controllers/controlpanel_controller.rb @@ -37,11 +37,25 @@ class ControlpanelController < ApplicationController def nextstep - logger.debug "next step in base system" - proxy = YaST::ServiceResource.proxy_for 'org.opensuse.yast.modules.basesystem' - basesystem = proxy.find - basesystem.current = session[:wizard_mode] - basesystem.save + steps = session[:wizard_steps].split "," + if (steps.last == session[:wizard_current]) + proxy = YaST::ServiceResource.proxy_for 'org.opensuse.yast.modules.basesystem' + basesystem = proxy.find + basesystem.current = FINAL_STEP + basesystem.steps = [] + basesystem.save + session[:wizard_current] = FINAL_STEP + else + session[:wizard_current] = steps[steps.index(session[:wizard_current])+1] + end + redirect_to "/controlpanel" + end + + def backstep + steps = session[:wizard_steps].split "," + if session[:wizard_current] != steps.first + session[:wizard_current] = steps[steps.index(session[:wizard_current])+1] + end redirect_to "/controlpanel" end @@ -88,21 +102,32 @@ class ControlpanelController < ApplicationController # +warn+: must be synchronized with same constant in base system module FINAL_STEP = "FINISH" # Checks if basic system modul need show another module instead control panel + # TODO check if wizard from config exists def need_redirect - session[:wizard_mode] = nil #clean wizard mode request from session - basesystem = load_proxy 'org.opensuse.yast.modules.basesystem' - unless basesystem - erase_redirect_results #reset all error redirects - erase_render_results #erase all error render - flash.clear #no error flash from load_proxy - logger.warn "Error occure during loading basesystem information" - return false - end + if session[:wizard_current] + return false if session[:wizard_current] == FINAL_STEP + redirect_to :controller => session[:wizard_current] + return true + else + basesystem = load_proxy 'org.opensuse.yast.modules.basesystem' + unless basesystem + erase_redirect_results #reset all error redirects + erase_render_results #erase all error render + flash.clear #no error flash from load_proxy + logger.warn "Error occure during loading basesystem information" + return false + end - return false if basesystem.current.upcase == FINAL_STEP + if basesystem.steps.empty? or basesystem.current == FINAL_STEP + session[:wizard_current] = FINAL_STEP + return false + end - session[:wizard_mode] = basesystem.current - redirect_to :controller => basesystem.current - return true + logger.debug basesystem.steps.inspect + session[:wizard_steps] = basesystem.steps.join(",") + session[:wizard_current] = basesystem.steps.first + redirect_to :controller => basesystem.current + return true + end end end diff --git a/webclient/app/views/layouts/main.rhtml b/webclient/app/views/layouts/main.rhtml index fd0d55a..6f029b1 100644 --- a/webclient/app/views/layouts/main.rhtml +++ b/webclient/app/views/layouts/main.rhtml @@ -79,7 +79,8 @@ </div> <div id="footer" class=""> - <%- if session[:wizard_mode] -%> + <%- if session[:wizard_current] and session[:wizard_current] != "FINISH" -%> + <%= button_to "Back", :controller => "controlpanel", :action => "backstep" %> <span> Wizard mode </span> <%= button_to "Next", :controller => "controlpanel", :action => "nextstep" %> <% end -%> -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org