require 'iconv'
module ApplicationHelper
#def form_field(object,field,flabel,example,val)
#model_name = eval(object.class.model_name)
#html = ""
#html << "
"
#if not object.errors[field.to_sym].empty?
#html << "
"
#end
#html << ""
#if not object.errors[field.to_sym].empty?
#html << " "
#html << object.errors[field.to_sym].to_s
#html << ""
#html << "
"
#end
#html << "
"
#html << "
"
#html << t(:example,:scope=>:common)
#html << ": "
#html << example
#html << ""
#html << "
"
#end
#def show_param_view(object,field,value)
#model_name = eval(object.class.model_name)
#html = ""
#html << ""
#html << ""
#html << value
#html << "
"
#html
#end
#def area_field(object,field,flabel,example,val,cols,rows)
#model_name = eval(object.class.model_name)
#html = ""
#html << ""
#if not object.errors[field.to_sym].empty?
#html << "
"
#end
#html << ""
#if not object.errors[field.to_sym].empty?
#html << ""
#html << object.errors[field.to_sym].to_s
#html << ""
#html << "
"
#end
#name = object.class.name.downcase + '[' + field + ']'
#id = object.class.name.downcase+"_"+field
#value = val || object.instance_eval(field) || ""
#html << "
"
#desc = t(:example,:scope=>:common) + ": " + example
#html << "
#{desc}"
#html << "
"
#end
#def form_button(text,image)
#html = ""
#html << ""
#html << "
"
#end
#def single_action(text,scope,image)
#html = ""
#html << ""
#html << "
"
#end
#def single_action_onclick(text,scope,image,onclick)
#html = ""
#html << ""
#html << "
"
#html << "
"
#end
#def group_action(buttons)
#html = ""
#html << ""
#buttons.each do |b|
#html << "
"
#end
#html << "
"
#end
#def group_action_text(buttons,text)
#html = ""
#html << ""
#buttons.each do |b|
#html << "
"
#end
#html << text
#html << "
"
#end
#def form_buttons(buttons)
#html = ""
#html << ""
#buttons.each do |b|
#html << "
"
#end
#html << "
"
#end
#def form_button_value(text,image,onclick)
#html = ""
#html << ""
#html << "
"
#end
#def simple_input_field(name,id,label,value)
#html = ""
#html << ""
#html << ""
#html << ""
#html << "
"
#end
#def select_field(name,object,label,blank)
#html = ""
#html << ""
#html << ""
#html << select(name, name, object.all.collect {|p| [ p.name, p.id ] }, { :include_blank => (blank == true ? true : false)})
#html << "
"
#end
#def select_field_table(object,field,table_choices,choice,blank)
#model_name = eval(object.class.model_name)
#html = ""
#html << ""
#html << ""
#html << select(object.class.to_s.downcase, field, options_for_select(table_choices,choice), {:include_blank => blank})
#html << "
"
#end
#def select_field_table_t(object,field,table_choices,choice,blank)
#model_name = eval(object.class.model_name)
#html = ""
#html << ""
#html << ""
#t = []
#table_choices.each do |c|
#t << [t(c.to_sym,:scope=>:prefs),c.to_s]
#end
#html << select(object.class.to_s.downcase, field, options_for_select(t,choice), {:include_blank => blank})
#html << "
"
#end
##def form_simle_field(name,label,value)
## html = ""
## html << ""
## html << ""
## html << ""
## html << "
"
##end
##def nav_to_folders
## link_to( t(:folders,:scope=>:folder), :controller=>:folders, :action=>:index )
##end
##
##def nav_to_messages
## link_to( t(:messages,:scope=>:message), :controller=>:messages, :action=>:index )
##end
##
##def nav_to_compose
## link_to( t(:compose,:scope=>:compose), :controller=>:messages, :action=>:compose )
##end
##
##def nav_to_contacts
## link_to( t(:contacts,:scope=>:contact), contacts_path )
##end
##
##def nav_to_prefs
## link_to( t(:prefs,:scope=>:prefs), prefs_look_path )
##end
#def single_navigation(label,scope)
#s = ""
#s += ""
#s += "- #{link_to(t(label,:scope=>scope),'#')}
"
#s += "-
"
#s += "
"
#end
#def main_navigation(active)
#instance_variable_set("@#{active}", "active")
#s = ""
#s += ""
#s += "- #{link_to( t(:messages,:scope=>:message), messages_path )}
"
#s += "- #{link_to( t(:compose,:scope=>:compose), compose_path )}
"
#s += "- #{link_to( t(:folders,:scope=>:folder), folders_path )}
"
#s += "- #{link_to( t(:contacts,:scope=>:contact), contacts_path )}
"
#s += "- #{link_to( t(:prefs,:scope=>:prefs), prefs_look_path )}
"
#s += "- #{link_to( t(:links,:scope=>:link), links_path )}
"
#s += "
"
#end
#def prefs_navigation(active)
#instance_variable_set("@#{active}", "active")
#s = ""
#s += ""
#s += "- #{link_to( t(:look,:scope=>:prefs), prefs_look_path )}
"
#s += "- #{link_to( t(:identity,:scope=>:prefs), prefs_identity_path )}
"
#s += "- #{link_to( t(:servers,:scope=>:prefs), prefs_servers_path )}
"
#s += "
"
#end
#def multi_select(id, name, objects, selected_objects, label, value,joiner,content = {})
#options = ""
#objects.each do |o|
#selected = selected_objects.include?(o) ? " selected=\"selected\"" : ""
#option_value = escape_once(o.send(value))
#text = [option_value]
#unless content[:text].nil?
#text = []
#content[:text].each do |t|
#text << o.send(t)
#end
#text = text.join(joiner)
#end
#text.gsub!(/^\./,'')
#bracket = []
#unless content[:bracket].nil?
#content[:bracket].each do |b|
#bracket << o.send(b)
#end
#bracket = bracket.join(joiner)
#end
#option_content = bracket.empty? ? "#{text}" : "#{text} (#{bracket})"
#options << "\n"
#end
#""
#end
#def force_charset(text)
#begin
#Iconv.iconv("UTF-8",$defaults["msg_unknown_charset"],text)
#rescue
#text
#end
#end
#def content_for_sidebar
#s = render :partial => 'sidebar/logo'
#s += render :partial => 'folders/list'
#s += render :partial => 'sidebar/calendar_view'
#s += render :partial => 'internal/version'
#s
#end
def boolean_answer(answer)
answer == true ? t(:true_answer,:scope=>:common) : t(:false_answer,:scope=>:common)
end
end