Module: Configuration

Included in:
Admin::ApplicationController, ApplicationController, User, UserMailer, UserObserver
Defined in:
lib/configuration.rb

Overview

Configuration for Blank Application

Blank Application is configured through the SuperAdministration module accessible to the 'superadmin' user

Major Application Configurations can be set up using this module.

The settings are stored in a YAML file.

Initially the /config/customs/default_config.yml file is loaded(default settings).

After the Superadministrator has setup the Superadministration Module the configurations will be stored in the /config/customs/sa_config.yml file

The setttings are accessed through the following methods in the Application

Instance Method Summary collapse

Instance Method Details

Get Selected Items List

will return a array of string of available items



37
38
39
# File 'lib/configuration.rb', line 37

def available_containers_links
	return @configuration['sa_containers'] || CONTAINERS
end

#available_items_listObject

Get Selected Items List

will return a array of string of available items



44
45
46
# File 'lib/configuration.rb', line 44

def available_items_list
	return @configuration['sa_items']
end

#available_languagesObject

Get Available Languages

will return a array of string of available languages if not empty array



51
52
53
# File 'lib/configuration.rb', line 51

def available_languages
   return (@configuration['sa_languages'].nil? || @configuration['sa_languages'].empty?) ? [] : @configuration['sa_languages']
end

#available_layoutsObject

will return a array of string of available layouts if not empty array



69
70
71
# File 'lib/configuration.rb', line 69

def available_layouts
	return (@configuration['sa_layouts'].nil? || @configuration['sa_layouts'].empty?) ? [] : @configuration['sa_layouts']
end

#encoding_activated?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/configuration.rb', line 93

def encoding_activated?
  @configuration['sa_activate_encoding'] == 'true'
end

#get_configurationObject



64
65
66
# File 'lib/configuration.rb', line 64

def get_configuration
	@configuration ||= get_sa_config
end

#get_fcke_item_typesObject

Get the Item types available for FCKE



85
86
87
# File 'lib/configuration.rb', line 85

def get_fcke_item_types
	return ['page', 'image', 'cms_file', 'video', 'audio', 'bookmark']
end

#get_per_page_valueObject

Set PerPage Values for Pagination(default 10)



74
75
76
77
78
79
80
81
82
# File 'lib/configuration.rb', line 74

def get_per_page_value
   if current_user.u_per_page
     current_user.u_per_page
	elsif (res=@configuration['sa_per_page_default']).to_i > 0
		return res
	else
		return 10
	end
end

#get_sa_configObject

Load the SuperAdmin Configuration



56
57
58
59
60
61
62
# File 'lib/configuration.rb', line 56

def get_sa_config
	if File.exist?("#{RAILS_ROOT}/config/customs/sa_config.yml")
		return YAML.load_file("#{RAILS_ROOT}/config/customs/sa_config.yml")
	else
		return YAML.load_file("#{RAILS_ROOT}/config/customs/default_config.yml")
	end
end

#is_allowed_free_user_creation?Boolean

Free User Creation

Check setting to verify if User can register directly with the application

Returns:

  • (Boolean)


20
21
22
# File 'lib/configuration.rb', line 20

def is_allowed_free_user_creation?
	return @configuration['sa_allowed_free_user_creation']=='true'
end

#is_given_private_workspaceObject

Check if Automatic Private Workspace Creation is Allowed



25
26
27
# File 'lib/configuration.rb', line 25

def is_given_private_workspace
	return @configuration['sa_automatic_private_workspace']=='true'
end

#is_mandatory_user_activation?Boolean

Check if Email Activation for User is Mandatory

Returns:

  • (Boolean)


30
31
32
# File 'lib/configuration.rb', line 30

def is_mandatory_user_activation?
	return @configuration['sa_mandatory_user_activation']=='true'
end

#rss_activated?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/configuration.rb', line 89

def rss_activated?
  @configuration['sa_activate_rss'] == 'true'
end

#search_activated?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/configuration.rb', line 97

def search_activated?
  @configuration['sa_activate_search'] == 'true'
end