Top Level Namespace

Defined Under Namespace

Classes: Cgi_is_retarded, Knjappserver

Instance Method Summary collapse

Instance Method Details

#_(str) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/include/gettext_funcs.rb', line 3

def _(str)
	kas = _kas
	session = _session
	locale = nil
	
	if Thread.current[:locale].to_s.length > 0
    locale = Thread.current[:locale]
  elsif session and session[:locale].to_s.strip.length > 0
    locale = session[:locale]
  elsif kas and kas.config[:locale_default].to_s.strip.length > 0
    session[:locale] = kas.config[:locale_default] if session
    locale = kas.config[:locale_default]
  elsif !session and !kas
    return str
  else
    raise "No locale set for session and ':locale_default' not set in config."
  end
  
	return kas.gettext.trans(locale, str)
end

#_bufObject

This function makes it possible to define methods in ERubis-parsed files (else _buf-variable wouldnt be globally available).



59
60
61
# File 'lib/include/magic_methods.rb', line 59

def _buf
  return $stdout
end


1
2
3
# File 'lib/include/magic_methods.rb', line 1

def _cookie
	return Thread.current[:knjappserver][:cookie] if Thread.current[:knjappserver]
end

#_dbObject



53
54
55
56
# File 'lib/include/magic_methods.rb', line 53

def _db
	return Thread.current[:knjappserver][:db] if Thread.current[:knjappserver] and Thread.current[:knjappserver][:db] #This is the default use from a .rhtml-file.
	return Thread.current[:knjappserver][:kas].db_handler if Thread.current[:knjappserver] and Thread.current[:knjappserver][:kas] #This is useually used when using autoload-argument for the appserver.
end

#_getObject



5
6
7
# File 'lib/include/magic_methods.rb', line 5

def _get
	return Thread.current[:knjappserver][:get] if Thread.current[:knjappserver]
end

#_httpsessionObject



33
34
35
# File 'lib/include/magic_methods.rb', line 33

def _httpsession
	return Thread.current[:knjappserver][:httpsession] if Thread.current[:knjappserver]
end

#_httpsession_varObject



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

def _httpsession_var
  return Thread.current[:knjappserver][:httpsession].httpsession_var if Thread.current[:knjappserver]
end

#_kasObject



45
46
47
# File 'lib/include/magic_methods.rb', line 45

def _kas
	return Thread.current[:knjappserver][:kas] if Thread.current[:knjappserver]
end

#_metaObject



13
14
15
# File 'lib/include/magic_methods.rb', line 13

def _meta
  return Thread.current[:knjappserver][:meta] if Thread.current[:knjappserver]
end

#_postObject



9
10
11
# File 'lib/include/magic_methods.rb', line 9

def _post
	return Thread.current[:knjappserver][:post] if Thread.current[:knjappserver]
end

#_requestdataObject



41
42
43
# File 'lib/include/magic_methods.rb', line 41

def _requestdata
	return Thread.current[:knjappserver] if Thread.current[:knjappserver]
end

#_serverObject



17
18
19
# File 'lib/include/magic_methods.rb', line 17

def _server
  return Thread.current[:knjappserver][:meta] if Thread.current[:knjappserver]
end

#_sessionObject



21
22
23
# File 'lib/include/magic_methods.rb', line 21

def _session
	return Thread.current[:knjappserver][:session].sess_data if Thread.current[:knjappserver] and Thread.current[:knjappserver][:session]
end

#_session_hashObject



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

def _session_hash
	return Thread.current[:knjappserver][:session].edata if Thread.current[:knjappserver] and Thread.current[:knjappserver][:session]
end

#_session_objObject



29
30
31
# File 'lib/include/magic_methods.rb', line 29

def _session_obj
	return Thread.current[:knjappserver][:session] if Thread.current[:knjappserver] and Thread.current[:knjappserver][:session]
end

#_varsObject



49
50
51
# File 'lib/include/magic_methods.rb', line 49

def _vars
  return Thread.current[:knjappserver][:kas].vars if Thread.current[:knjappserver]
end