#-- # WebROaR - Ruby Application Server - http://webroar.in/ # Copyright (C) 2009 WebROaR # # This file is part of WebROaR. # # WebROaR is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # WebROaR is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with WebROaR. If not, see . #++ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper #This method is used to get the tabs image for the differnt tabs in the admin panel. def get_tab_class_name(controller_name,action_name) tab1 = ["home","home_ov"] tab2 = ["configuration","configuration_ov"] tab3 = ["analytics","analytics_ov"] tab4 = ["exceptions","exceptions_ov"] tab5 = ["settings","settings_ov"] if controller_name == 'admin' case action_name when "home" tab1 = ["home_ov",""] when "change_password_form" tab5 = ["settings_ov",""] when "change_password" tab5 = ["settings_ov",""] else tab2 = ["configuration_ov",""] end elsif controller_name == 'graph' tab3 = ["analytics_ov",""] elsif controller_name == 'exceptions' tab4 = ["exceptions_ov",""] end return tab1,tab2,tab3,tab4,tab5 end # Start the application def self.start_application(app_name) ctl = Control.new(app_name) reply = nil err_obj = nil begin reply = ctl.add rescue Exception => e err_obj = e reply = "An error occurred while sending 'start' request for application '#{app_name}'. Please refer the '/var/log/webroar/Admin_panel.production.log' file for details." end return reply, e end # Stop the application def self.stop_application(app_name) ctl = Control.new(app_name) reply = nil begin reply = ctl.delete rescue Exception => e reply = "An error occurred while sending 'stop' request for application '#{app_name}'. Please refer the '/var/log/webroar/Admin_panel.production.log' file for details." end return reply end # Restart the application def self.restart_application(app_name) ctl = Control.new(app_name) reply = nil begin reply = ctl.restart rescue Exception => e reply = "An error occurred while sending 'stop' request for application '#{app_name}'. Please refer the '/var/log/webroar/Admin_panel.production.log' file for details." end return reply end end