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) 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 = object.instance_eval(field) || val || "" html << "" desc = t(:example) + ": " + example html << "#{desc}" html << "
" end def form_button(text,image) html = "" html << "
" 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 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 main_navigation(active) s = "" s += "" end def prefs_navigation(active) look_active = "" identity_active = "" servers_active = "" case active when :look look_active = "active" when :identity identity_active ="active" when :servers servers_active ="active" end s = "" 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 end