class ConfigBase
Public Instance Methods
get_url(url)
click to toggle source
# File Entities/ConfigBase.rb, line 256 def get_url(url) if url.class == Symbol url = ConfigBase.data_get(url) end url =~ /^https{0,1}:\/\// ? url : "http://#{url}" end
replace_function(old, new)
click to toggle source
# File Entities/ConfigBase.rb, line 215 def replace_function(old, new) func = self.functions.to_sym if func.index(old.to_sym) func -= [old.to_sym] func += [new.to_sym] end self.functions = func end
send_config()
click to toggle source
# File Entities/ConfigBase.rb, line 188 def send_config save_block_to_object :captive, Network::Captive Network::Captive.clean_config ConfigBase.has_function?(:internet_captive) and Network::Captive.setup save_block_to_object :operator, Network::Operator Network::Operator.clean_config if ConfigBase.samba_simul.to_s == "false" if ConfigBase.has_function?(:share) Platform.enable_start(:samba) else Platform.stop_disable(:samba) end end if ConfigBase.has_function?(:internet_mobile) start_mobile_control save_block_to_object :mobilecontrol, $MobileControl $MobileControl.autocharge = ConfigBase.has_function?(:internet_mobile_autocharge) else stop_mobile_control end if ConfigBase.has_function?(:accounting) && Entities.is_setup?(:Person) Persons.search_by_permissions('secretary').each{|p| p.update_accounts } end end
server_uri()
click to toggle source
# File Entities/ConfigBase.rb, line 252 def server_uri server_url =~ /^http/ ? server_url : "http://#{server_url}" end
start_mobile_control()
click to toggle source
# File Entities/ConfigBase.rb, line 224 def start_mobile_control return if $MobileControl dputs(1) { 'Starting mobile-control' } $MobileControl = Network::MobileControl.new @mobile_thread = Thread.new { state = nil loop { rescue_all 'Error with MobileControl' do $MobileControl.check_connection if state != $MobileControl.state_to_s dputs(2) { "#{Time.now.strftime('%y%m%d-%H%M')}: #{state = $MobileControl.state_to_s}" } end sleep 10 end } } end
stop_mobile_control()
click to toggle source
# File Entities/ConfigBase.rb, line 243 def stop_mobile_control if @mobile_thread @mobile_thread.kill @mobile_thread.join @mobile_thread = nil end $MobileControl = nil end
template_path(t)
click to toggle source
# File Entities/ConfigBase.rb, line 269 def template_path(t) return '' unless template_dir && card_student && card_responsible "#{template_dir}/" + case t when :card_student card_student.first.to_s when :card_responsible card_responsible.first.to_s end end
templates()
click to toggle source
# File Entities/ConfigBase.rb, line 263 def templates Dir.glob("#{template_dir}/*.od?"). collect { |f| f.sub(/^.*\//, '') }. sort end