ServerSpecificationController

Public Instance Methods

add_text_box() click to toggle source

This method is to add div for changing the server specifications. This action is called as a ajax call when user click on the edit button of the server specification block in the configuration page.

# File app/controllers/server_specification_controller.rb, line 88
def add_text_box
  @path = CONFIG_FILE_PATH
  render :partial => 'add_div'
end
cancel_edit() click to toggle source

This method is to close the edit box for the server specification. This is called if user doesnot wants to made the changes in the server specification.

# File app/controllers/server_specification_controller.rb, line 95
def cancel_edit
  text = params[:old_value].to_s    
  render :text =>   text
end
disable_ssl_support() click to toggle source

This method is used to disable the ssl support.

# File app/controllers/server_specification_controller.rb, line 26
def disable_ssl_support
  info = YAML::load_file(CONFIG_FILE_PATH) rescue nil
  ssl_specification = Hash['ssl_support' => 'disabled',
    'certificate_file' => info['Server Specification']['SSL Specification']['certificate'],
    'key_file' => info['Server Specification']['SSL Specification']['key'],
    'ssl_port' => info['Server Specification']['SSL Specification']['port']]
  server_specification = Hash['port' => info['Server Specification']['port'],
    'log_level' => info['Server Specification']['log_level'],
    'min_worker' => info['Server Specification']['min_worker'],
    'max_worker' => info['Server Specification']['max_worker'],
    'access_log' => info['Server Specification']['access_log'],
    'SSL Specification' => ssl_specification]
  ServerSpecification.write(info, server_specification)
  redirect_to configuration_path
end
enable_ssl_support() click to toggle source

This method is used to enable the ssl support.

# File app/controllers/server_specification_controller.rb, line 43
def enable_ssl_support
  info= YAML::load_file(CONFIG_FILE_PATH) rescue nil
  str = check_for_ssl_validation(params[:ssl])
  if str.length == 0
    ssl_specification = Hash['ssl_support' => 'enabled',
      'certificate_file' => params[:ssl][:certificate_path],
      'key_file' => params[:ssl][:key_path],
      'ssl_port' => params[:ssl][:port]]
    server_specification = Hash['port' => info['Server Specification']['port'],
      'log_level' => info['Server Specification']['log_level'],
      'min_worker' => info['Server Specification']['min_worker'],
      'max_worker' => info['Server Specification']['max_worker'],
      'access_log' => info['Server Specification']['access_log'],
      'SSL Specification' => ssl_specification]
    ServerSpecification.write(info, server_specification)
    flash[:error] = RESTART_SERVER_MESSAGE
    redirect_to configuration_path
  else
    flash[:ssl_errors] = str  
    redirect_to :controller => 'admin', :action=>'configuration', :ssl => params[:ssl]
  end
end
save_data() click to toggle source

This function is to add server specification. This action is used to save the changes made through configuration page.

# File app/controllers/server_specification_controller.rb, line 74
def save_data
  text = params[:old_value].to_s    
  if !params[:data][:value].empty?
    text, error_message = ServerSpecification.validate_and_write( params[:div_id], params[:data][:value])
    if error_message.length > 0
      render :text =>         text.to_s + " <span id='error_div'>#{error_message}</span>"
    else
      render :text =>         text.to_s + " <span id='error_div'>#{RESTART_SERVER_MESSAGE}</span>"
    end
  end
end
ssl_support_form() click to toggle source

This method is to render ssl_support_form partial

# File app/controllers/server_specification_controller.rb, line 67
def ssl_support_form
  @ssl_spec = Hash[:certificate_path => "", :key_path => "", :port => 443]
  render :partial => 'ssl_support_form'
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.