identity,servers view

This commit is contained in:
Wojciech Todryk 2011-09-29 21:16:40 +02:00
parent 9bb5f3a20f
commit ef0b894ad8
31 changed files with 281 additions and 280 deletions

2
CHANGES Normal file → Executable file
View file

@ -1,6 +1,6 @@
## Changes ## Changes
#### 0.8.5 candidate #### 0.8.5
* servers view * servers view
* identity modification * identity modification

View file

@ -1,10 +1,10 @@
source 'http://rubygems.org' source 'http://rubygems.org'
gem 'rails', '~>3.0.9' gem 'rails', '~>3.0.7'
gem 'mysql2' , '~>0.2.7' gem 'mysql2' , '~>0.2.7'
gem 'will_paginate', '~> 3.0.beta' gem 'will_paginate', '~> 3.0.beta'
gem 'themes_for_rails' gem 'themes_for_rails'
gem "ezcrypto", "~> 0.7.2" gem "ezcrypto", "~> 0.7.2"
gem "calendar_view", "~> 0.0.3" gem "calendar_view", "~> 0.0.4"
gem 'bluecloth', '>= 2.0.0' gem 'bluecloth', '>= 2.0.0'

7
TODO Normal file → Executable file
View file

@ -11,11 +11,10 @@ app/controllers/messages_controller.rb:
app/controllers/messages_ops_controller.rb: app/controllers/messages_ops_controller.rb:
* [128] [FIXME] check if uploads directory exists * [249] [FIXME] edit does not support attachments
* [176] [FIXME] check if domain is set * [304] [TODO] check if email address is valid if not get address from contacts
* [192] [TODO] check if email address is valid if not get address from contacts
* [259] [FIXME] edit does not support attachments
app/models/prefs.rb: app/models/prefs.rb:
* [ 19] [TODO] move refresh to prefs and make refresh page with messages * [ 19] [TODO] move refresh to prefs and make refresh page with messages

View file

@ -63,15 +63,15 @@ class ApplicationController < ActionController::Base
def prepare_compose_buttons def prepare_compose_buttons
@buttons = [] @buttons = []
@buttons << {:text => 'send',:scope=>:compose,:image => 'email.png'} @buttons << {:text => 'sendout',:scope=>:compose,:image => 'email.png'}
@buttons << {:text => 'save_as_draft',:scope=>:compose,:image => 'save.png'} @buttons << {:text => 'save',:scope=>:compose,:image => 'save.png'}
end end
def create_message_with_params def create_message_with_params
@message = Message.new @message = Message.new(params[:message])
if params[:message] # if params[:message]
@message.update_attributes(params[:message]) # @message.update_attributes(params[:message])
end # end
files = Dir.glob(File.join($defaults["msg_upload_dir"],@current_user.username + "*")) files = Dir.glob(File.join($defaults["msg_upload_dir"],@current_user.username + "*"))
@attachments = [] @attachments = []
files.each do |f| files.each do |f|

View file

@ -12,13 +12,12 @@ class FoldersController < ApplicationController
after_filter :close_imap_session, :except => [:index,:show_hide,:system] after_filter :close_imap_session, :except => [:index,:show_hide,:system]
before_filter :get_folders before_filter :get_folders
before_filter :prepare_buttons_to_folders
theme :theme_resolver theme :theme_resolver
def index def index
@buttons = [] #before_filter
@buttons << {:text => 'show_hide',:scope=>'folder',:image => 'flag.png'}
@buttons << {:text => 'refresh',:scope=>'folder',:image => 'refresh.png'}
end end
def create def create
@ -154,6 +153,12 @@ class FoldersController < ApplicationController
protected protected
def prepare_buttons_to_folders
@buttons = []
@buttons << {:text => 'show_hide',:scope=>'folder',:image => 'flag.png'}
@buttons << {:text => 'refresh',:scope=>'folder',:image => 'refresh.png'}
end
def get_folders def get_folders
@folders = @current_user.folders @folders = @current_user.folders
@folders_shown = @current_user.folders.shown @folders_shown = @current_user.folders.shown

View file

@ -3,6 +3,7 @@ require 'imap_mailbox'
require 'imap_message' require 'imap_message'
require 'mail' require 'mail'
require 'mail_plugin_extension' require 'mail_plugin_extension'
require 'net/smtp'
class MessagesOpsController < ApplicationController class MessagesOpsController < ApplicationController
@ -14,8 +15,9 @@ class MessagesOpsController < ApplicationController
before_filter :check_current_user ,:selected_folder,:get_current_folders before_filter :check_current_user ,:selected_folder,:get_current_folders
before_filter :open_imap_session, :select_imap_folder before_filter :open_imap_session, :select_imap_folder
before_filter :prepare_compose_buttons before_filter :prepare_compose_buttons
before_filter :get_system_folders, :only => [:sendout_or_save,:single,:multi] before_filter :get_system_folders, :only => [:composed,:single,:multi]
before_filter :create_message_with_params , :only => [:sendout_or_save] before_filter :prepare_composed , :only => [:composed]
before_filter :create_message_with_params, :only=> [:composed,:single,:multi]
after_filter :close_imap_session after_filter :close_imap_session
theme :theme_resolver theme :theme_resolver
@ -125,17 +127,20 @@ class MessagesOpsController < ApplicationController
end end
def upload def upload
#FIXME check if uploads directory exists begin
@operation = :upload raise MailrException.new :cause=>:no_tmp_dir,:scope=>:common if not File.exists?($defaults["msg_upload_dir"])
create_message_with_params raise MailrException.new :cause=>:no_file_chosen,:scope=>:common if not params[:upload]
if not params[:upload] @operation = :upload
flash[:error] = t(:no_file_chosen,:scope=>:common) name = params[:file][:data].original_filename
else
name = params[:upload][:datafile].original_filename
upload_dir = $defaults["msg_upload_dir"] upload_dir = $defaults["msg_upload_dir"]
path = File.join(upload_dir, @current_user.username + "_" + name) path = File.join(upload_dir, @current_user.username + "_" + name)
File.open(path, "wb") { |f| f.write(params[:upload][:datafile].read) } File.open(path, "wb") { |f| f.write(params[:file][:data].read) }
rescue MailrException => e
flash[:error] = t(e.message[:cause],:scope => e.message[:scope])
rescue Exception => e
flash[:error] = t(:general_error,:scope=>:internal) + " (" + e.class.name + " " + e.to_s + ")"
end end
create_message_with_params
render 'messages/compose' render 'messages/compose'
end end
@ -168,13 +173,7 @@ class MessagesOpsController < ApplicationController
# if File.exist?("#{RAILS_ROOT}/dirname/#{@filename}") # if File.exist?("#{RAILS_ROOT}/dirname/#{@filename}")
# end # end
def composed
############################################### sendout_or_save ############################
def sendout_or_save
#FIXME check if domain is set
if params[:delete_marked] and params[:files] if params[:delete_marked] and params[:files]
params[:files].each do |filename| params[:files].each do |filename|
path = File.join(Rails.root,$defaults["msg_upload_dir"],@current_user.username + "_" +filename) path = File.join(Rails.root,$defaults["msg_upload_dir"],@current_user.username + "_" +filename)
@ -184,77 +183,70 @@ class MessagesOpsController < ApplicationController
@operation = :new @operation = :new
render 'messages/compose' render 'messages/compose'
return return
end elsif params[:upload]
upload
mail = Mail.new elsif params[:save]
mail.subject = params[:message][:subject] save
mail.from = @current_user.full_address elsif params[:sendout]
#TODO check if email address is valid if not get address from contacts sendout
mail.to = params[:message][:to_addr] else
mail.body = params[:message][:body]
attachments = Dir.glob(File.join($defaults["msg_upload_dir"],@current_user.username + "*"))
#logger.custom('attach',attachments.inspect)
attachments.each do |a|
mail.add_file :filename => File.basename(a.gsub(/#{@current_user.username}_/,"")), :content => File.read(a)
end
if params[:send]
smtp_server = @current_user.servers.primary_for_smtp
if smtp_server.nil?
flash[:error] = t(:not_configured_smtp,:scope => :compose)
@operation = :new
render 'messages/compose'
return
end
begin
set_mail_defaults(@current_user,smtp_server,session)
logger.custom('mail',Mail.delivery_method.inspect)
@response = mail.deliver!
logger.custom('response',@response.inspect)
if @sent_folder.nil?
raise t(:not_configured_sent,:scope=>:compose)
end
@mailbox.append(@sent_folder.full_name,mail.to_s,[:Seen])
rescue Exception => e
flash[:error] = "#{t(:imap_err,:scope=>:internal)} (#{e.to_s})"
redirect_to :controller => 'messages', :action => 'index'
return
end
attachments.each do |filename|
path = File.join(Rails.root,filename)
File.delete(path) if File.exist?(path)
end
flash[:notice] = t(:was_sent,:scope => :compose)
redirect_to :controller => 'messages', :action => 'index'
elsif params[:save_as_draft]
begin
if @drafts_folder.nil?
raise t(:not_configured_drafts,:scope=>:compose)
end
@mailbox.append(@drafts_folder.full_name,mail.to_s,[:Seen])
if params[:olduid].present?
@mailbox.move_message(params[:olduid],@trash_folder.full_name)
@mailbox.expunge
end
rescue Exception => e
flash[:error] = "#{t(:imap_error,:scope=>:internal)} (#{e.to_s})"
redirect_to :controller => 'messages', :action => 'index'
return
end
flash[:notice] = t(:was_saved,:scope => :compose)
redirect_to :controller => 'messages', :action => 'index' redirect_to :controller => 'messages', :action => 'index'
end end
end end
def sendout
begin
smtp_server = @current_user.servers.primary_for_smtp
raise MailrException.new :cause=>:not_configured_smtp,:scope => :compose if smtp_server.nil?
raise MailrException.new :cause=>:has_no_domain,:scope=>:user if @current_user.has_domain?.nil?
raise MailrException.new :cause=>:not_configured_sent,:scope=>:compose if @sent_folder.nil?
send_mail_message( smtp_server,
@current_user.has_domain?,
@current_user.login,
@current_user.get_cached_password(session),
@mail.to_s,
@current_user.email,
params[:message][:to_addr]
)
upload_dir = $defaults["msg_upload_dir"]
@attachments.each do |file|
path = File.join(upload_dir, @current_user.username + "_" + file[:name])
File.delete(path) if File.exist?(path)
end
rescue MailrException => e
flash[:error] = t(e.message[:cause],:scope => e.message[:scope])
rescue Exception => e
flash[:error] = t(:general_error,:scope=>:internal) + " (" + e.class.name + " " + e.to_s + ")"
else
flash[:notice] = t(:was_sent,:scope => :compose)
redirect_to :controller => 'messages', :action => 'index'
return
end
@operation = :new
render 'messages/compose'
end
def save
begin
raise MailrException.new :cause=>:not_configured_drafts,:scope=>:folder if @drafts_folder.nil?
@mailbox.append(@drafts_folder.full_name,@mail.to_s,[:Seen])
if params[:olduid].present?
@mailbox.move_message(params[:olduid],@trash_folder.full_name)
@mailbox.expunge
end
rescue MailrException => e
flash[:error] = t(e.message[:cause],:scope => e.message[:scope])
rescue Exception => e
flash[:error] = t(:general_error,:scope=>:internal) + " (" + e.class.name + " " + e.to_s + ")"
else
@attachments.each do |filename|
path = File.join(Rails.root,filename)
File.delete(path) if File.exist?(path)
end
flash[:notice] = t(:was_saved,:scope => :compose)
end
redirect_to :controller => 'messages', :action => 'index'
end
#FIXME edit does not support attachments #FIXME edit does not support attachments
def edit def edit
@ -266,7 +258,7 @@ class MessagesOpsController < ApplicationController
imap_message = @mailbox.fetch_body(old_message.uid) imap_message = @mailbox.fetch_body(old_message.uid)
mail = Mail.new(imap_message) mail = Mail.new(imap_message)
if mail.multipart? if mail.multipart?
@message.body = mail.text_part.decoded_and_charseted.gsub(/<\/?[^>]*>/, "") @message.body = mail.text_part.nil? ? "" : mail.text_part.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
else else
@message.body = mail.decoded_and_charseted.gsub(/<\/?[^>]*>/, "") @message.body = mail.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
end end
@ -285,7 +277,7 @@ class MessagesOpsController < ApplicationController
imap_message = @mailbox.fetch_body(old_message.uid) imap_message = @mailbox.fetch_body(old_message.uid)
mail = Mail.new(imap_message) mail = Mail.new(imap_message)
if mail.multipart? if mail.multipart?
@message.body = mail.text_part.decoded_and_charseted.gsub(/<\/?[^>]*>/, "") @message.body = mail.text_part.nil? ? "" : mail.text_part.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
else else
@message.body = mail.decoded_and_charseted.gsub(/<\/?[^>]*>/, "") @message.body = mail.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
end end
@ -297,7 +289,28 @@ class MessagesOpsController < ApplicationController
protected protected
def send_mail_message(smtp_server,domain,username,password,msgstr,from,to)
if smtp_server.auth.nil?
smtp = Net::SMTP.start(smtp_server.name, smtp_server.port, domain)
else
smtp = Net::SMTP.start(smtp_server.name, smtp_server.port, domain, username, password, smtp_server.auth)
end
smtp.send_message msgstr, from, to
smtp.finish
end
def prepare_composed
@mail = Mail.new
@mail.subject = params[:message][:subject]
@mail.from = @current_user.full_id
#TODO check if email address is valid if not get address from contacts
@mail.to = params[:message][:to_addr]
@mail.body = params[:message][:body]
@attachments = Dir.glob(File.join($defaults["msg_upload_dir"],@current_user.username + "*"))
@attachments.each do |a|
@mail.add_file :filename => File.basename(a.gsub(/#{@current_user.username}_/,"")), :content => File.read(a)
end
end
############################################ set_mail_defaults #################################### ############################################ set_mail_defaults ####################################
@ -313,7 +326,7 @@ class MessagesOpsController < ApplicationController
authentication = server.auth authentication = server.auth
enable_starttls_auto = server.use_tls enable_starttls_auto = server.use_tls
openssl_verify_mode = OpenSSL::SSL::VERIFY_NONE openssl_verify_mode = OpenSSL::SSL::VERIFY_NONE
user_name = user.full_address user_name = user.login
end end
Mail.defaults do Mail.defaults do
delivery_method :smtp, {:address => server.name, delivery_method :smtp, {:address => server.name,

View file

@ -22,10 +22,18 @@ class PrefsController < ApplicationController
end end
def update_identity def update_identity
if params[:user] if params[:user]
@current_user.update_attributes(params[:user]) @current_user.first_name = params[:user][:first_name]
@current_user.last_name = params[:user][:last_name]
@current_user.domain = params[:user][:domain]
if @current_user.valid?
@current_user.save
flash[:notice] = t(:were_saved,:scope=>:prefs)
redirect_to :action => 'identity'
else
render 'prefs/identity'
end
end end
redirect_to :action => 'identity'
end end
def look def look
@ -33,7 +41,6 @@ class PrefsController < ApplicationController
end end
def identity def identity
@identity = @curent_user
end end
def servers def servers

View file

@ -15,15 +15,15 @@ class UserController < ApplicationController
def authenticate def authenticate
if not $defaults["only_can_logins"].nil? if not $defaults["only_can_logins"].nil?
if not $defaults["only_can_logins"].include?(params[:user][:email]) if not $defaults["only_can_logins"].include?(params[:user][:login])
redirect_to :controller => 'internal', :action => 'onlycanlogins' redirect_to :controller => 'internal', :action => 'onlycanlogins'
return false return false
end end
end end
user = User.find_by_email(params[:user][:email]) user = User.find_by_login(params[:user][:login])
if user.nil? if user.nil?
redirect_to :action => 'unknown' ,:email=> params[:user][:email] redirect_to :action => 'unknown' ,:login=> params[:user][:login]
else else
session[:user_id] = user.id session[:user_id] = user.id
user.set_cached_password(session,params[:user][:password]) user.set_cached_password(session,params[:user][:password])
@ -52,7 +52,7 @@ class UserController < ApplicationController
def create def create
@user = User.new @user = User.new
@user.email = params[:user][:email] @user.login = params[:user][:login]
@user.first_name = params[:user][:first_name] @user.first_name = params[:user][:first_name]
@user.last_name = params[:user][:last_name] @user.last_name = params[:user][:last_name]

View file

@ -5,7 +5,7 @@ module ApplicationHelper
def form_field(object,field,flabel,example,val) def form_field(object,field,flabel,example,val)
model_name = eval(object.class.model_name) model_name = eval(object.class.model_name)
html = "" html = ""
html << "<div class=\"group\">" html << "<div class=\"param_group\">"
if not object.errors[field.to_sym].empty? if not object.errors[field.to_sym].empty?
html << "<div class=\"fieldWithErrors\">" html << "<div class=\"fieldWithErrors\">"

View file

@ -5,7 +5,7 @@ class User < ActiveRecord::Base
#acts_as_notes_owner #acts_as_notes_owner
validates_presence_of :first_name,:last_name validates_presence_of :first_name,:last_name
validates_uniqueness_of :email validates_uniqueness_of :login
has_many :servers, :dependent => :destroy has_many :servers, :dependent => :destroy
has_one :prefs, :dependent => :destroy has_one :prefs, :dependent => :destroy
has_many :folders, :dependent => :destroy has_many :folders, :dependent => :destroy
@ -33,21 +33,31 @@ class User < ActiveRecord::Base
(0...8).map{65.+(rand(25)).chr}.join (0...8).map{65.+(rand(25)).chr}.join
end end
def full_name def name
first_name + " " + last_name first_name + " " + last_name
end end
def full_address def full_id
d = domain.presence || "" (name + " <" + email + ">") if email
if email =~ /\@/ end
email
def email
if login =~ /\@/
login
else else
email + "@" + d (login + "@" + domain) if domain.presence
end end
end end
def username def username
email.gsub(/\@/,"_").gsub(/\./,"_") login.gsub(/\@/,"_").gsub(/\./,"_")
end
def has_domain?
return domain if domain.presence
if login =~ /\@/
login.split(/\@/)[1]
end
end end
end end

View file

@ -51,3 +51,7 @@ class ActiveSupport::BufferedLogger
end end
end end
class MailrException < Exception
end

View file

@ -1,4 +1,4 @@
version: 0.8.4 version: 0.8.5
theme: olive theme: olive
locale: pl locale: pl
@ -47,4 +47,4 @@ session_password: asDD3s2@sAdc983#
mailbox_max_parent_folder_depth: 3 mailbox_max_parent_folder_depth: 3
# array of logins which only can login to application, comment it to allow everyone to login # array of logins which only can login to application, comment it to allow everyone to login
only_can_logins: [soldier] only_can_logins: [somelogin1, somelogin2]

View file

@ -46,6 +46,7 @@ pl:
password: Hasło password: Hasło
first_name: Imię first_name: Imię
last_name: Nazwisko last_name: Nazwisko
domain: Domena
server: server:
name: Nazwa serwera name: Nazwa serwera
port: Port port: Port
@ -147,9 +148,9 @@ pl:
not_configured_smtp: Brak konfiguracji SMTP not_configured_smtp: Brak konfiguracji SMTP
select_file: Wybierz plik select_file: Wybierz plik
delete_marked: Usuń zaznaczone delete_marked: Usuń zaznaczone
send_file: Wyślij plik upload: Wyślij plik
send: Wyślij sendout: Wyślij
save_as_draft: Zapisz w katalogu roboczym save: Zapisz w katalogu roboczym
show: show:
reply: Odpowiedz reply: Odpowiedz
@ -171,6 +172,7 @@ pl:
login: Logowanie login: Logowanie
only_can_logins: Podany identyfikator użytkownika nie uprawnia do korzystania z aplikacji only_can_logins: Podany identyfikator użytkownika nie uprawnia do korzystania z aplikacji
logout: Wyloguj logout: Wyloguj
has_no_domain: Użytkownik nie ma ustawionej domeny
internal: internal:
imap_error: Błąd protokołu IMAP imap_error: Błąd protokołu IMAP
@ -180,6 +182,7 @@ pl:
unprocessable_entity: Błąd procesowania unprocessable_entity: Błąd procesowania
about: Informacje o programie about: Informacje o programie
current_version: Aktualna wersja current_version: Aktualna wersja
general_error: Błąd aplikacji
common: common:
false_answer: Nie false_answer: Nie

View file

@ -1,130 +1,70 @@
Mailr::Application.routes.draw do Mailr::Application.routes.draw do
#match "prefs/index" => "prefs#index", :as => :prefs namespace :prefs do
post "update_look"
post "update_identity"
post "update_servers"
end
match "prefs/look" => "prefs#look", :as => :prefs_look
match "prefs/identity" => "prefs#identity", :as => :prefs_identity
match "prefs/servers" => "prefs#servers", :as => :prefs_servers
post "prefs/update_look" namespace :contacts do
post "prefs/update_identity" post "ops"
post "prefs/update_servers" get "export"
end
match "/external" => "contacts#external", :as => :external
match "prefs/look" => "prefs#look", :as => :prefs_look resources :contacts
match "prefs/identity" => "prefs#identity", :as => :prefs_identity
match "prefs/servers" => "prefs#servers", :as => :prefs_servers
post "contacts/ops" namespace :folders do
get "contacts/export" post "create"
match "contacts/external" => "contacts#external", :as => :contacts_external post "delete"
resources :contacts post "system"
post "show_hide"
post "refresh"
get "refresh_status"
get "emptybin"
end
match "/folders/index" => 'folders#index', :as => :folders
match "/folders/select/:id" => 'folders#select', :as => :folders_select
#resources :folders namespace :internal do
match "folders/index" => 'folders#index', :as => :folders get "error"
post "folders/create" get "imaperror"
post "folders/delete" get "loginfailure"
post "folders/system" get "onlycanlogins"
post "folders/show_hide" end
post "folders/refresh" match "/internal/about" => 'internal#about' ,:as => :about
get "folders/refresh_status"
post "folders/refresh"
match "folders/select/:id" => 'folders#select', :as => :folders_select
get "folders/emptybin"
get "internal/error" match "/messages_ops/single" => 'messages_ops#single'
get "internal/imaperror" match "/messages_ops/multi" => 'messages_ops#multi'
get "internal/loginfailure" match "/messages_ops/sendout_or_save" => 'messages_ops#sendout_or_save' ,:as =>:sendout_or_save
get "internal/onlycanlogins" match "/messages_ops/upload" => 'messages_ops#upload',:as => :upload
match "internal/about" => 'internal#about' ,:as => :about match "/messages_ops/edit/:id" => 'messages_ops#edit', :as => :edit
match "/messages_ops/composed" => 'messages_ops#composed', :as => :composed
match "messages_ops/single" => 'messages_ops#single'
match "messages_ops/multi" => 'messages_ops#multi'
match "messages_ops/sendout_or_save" => 'messages_ops#sendout_or_save' ,:as =>:sendout_or_save
match "messages_ops/upload" => 'messages_ops#upload',:as => :upload
match "messages_ops/edit/:id" => 'messages_ops#edit', :as => :messages_ops_edit
root :to => "messages#index" root :to => "messages#index"
match "messages/index" => 'messages#index', :as => :messages
match "messages/compose" => 'messages#compose', :as => :compose
match "messages/compose/:cid" => 'messages#compose', :as => :compose_contact
#get "messages/refresh_status"
#get "messages/emptybin"
#match "messages/select/:id" => 'messages#select', :as => :messages_select
get "messages/index"
#match 'messages/folder/:id' => 'messages#folder', :as => :messages_folder
#post "messages/ops"
#post "messages/msgops"
#match "messages/edit/:id" => 'messages#edit' ,:as => :messages_edit match "/messages/index" => 'messages#index', :as => :messages
#match "messages/reply/:id" => 'messages#reply' match "/messages/compose" => 'messages#compose', :as => :compose
match "/messages/compose/:cid" => 'messages#compose', :as => :compose_contact
match "/messages/show/:id" => 'messages#show'
match "/messages/html_body/:id" => 'messages#html_body' , :as => :html_body
match "/messages/attachment/:id/:idx" => 'messages#attachment', :as => :attachment_download
match "messages/show/:id" => 'messages#show' namespace :user do
#match "messages/body/:id/:idx" => 'messages#body' , :as => :messages_part_body get "logout"
match "messages/html_body/:id" => 'messages#html_body' , :as => :messages_html_body post "authenticate"
match "messages/attachment/:id/:idx" => 'messages#attachment', :as => :messages_attachment_download post "create"
get "login"
get "user/logout" get "setup"
post "user/authenticate" get "unknown"
post "user/create" end
get "user/login" match "/user/setup/:login" => 'user#setup'
get "user/setup"
match 'user/setup/:id' => 'user#setup'
get "user/unknown"
themes_for_rails themes_for_rails
#acts_as_notes_owner
#match '*a', :to => 'internal#not_found' #match '*a', :to => 'internal#not_found'
#match ':controller(/:action(/:id(.:format)))'
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end end

View file

@ -0,0 +1,9 @@
class RenameEmailInUser < ActiveRecord::Migration
def self.up
rename_column :users, :email, :login
end
def self.down
rename_column :users, :login, :email
end
end

View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20110913114841) do ActiveRecord::Schema.define(:version => 20110927091830) do
create_table "contacts", :force => true do |t| create_table "contacts", :force => true do |t|
t.string "nick" t.string "nick"
@ -23,6 +23,18 @@ ActiveRecord::Schema.define(:version => 20110913114841) do
t.datetime "updated_at" t.datetime "updated_at"
end end
create_table "events", :force => true do |t|
t.integer "user_id"
t.integer "priority"
t.text "description"
t.string "category"
t.datetime "start"
t.datetime "stop"
t.boolean "allday"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "folders", :force => true do |t| create_table "folders", :force => true do |t|
t.string "name" t.string "name"
t.string "delim" t.string "delim"
@ -54,17 +66,6 @@ ActiveRecord::Schema.define(:version => 20110913114841) do
t.datetime "updated_at" t.datetime "updated_at"
end end
create_table "notes", :force => true do |t|
t.integer "owner_id"
t.string "owner_type"
t.string "title"
t.text "content"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "notes", ["owner_id", "owner_type"], :name => "index_notes_on_owner_id_and_owner_type"
create_table "prefs", :force => true do |t| create_table "prefs", :force => true do |t|
t.string "theme" t.string "theme"
t.string "locale" t.string "locale"
@ -91,7 +92,7 @@ ActiveRecord::Schema.define(:version => 20110913114841) do
end end
create_table "users", :force => true do |t| create_table "users", :force => true do |t|
t.string "email" t.string "login"
t.string "first_name" t.string "first_name"
t.string "last_name" t.string "last_name"
t.datetime "created_at" t.datetime "created_at"

View file

@ -6,7 +6,7 @@ module ImapSessionModule
def open_imap_session def open_imap_session
begin begin
@mailbox ||= ImapMailboxModule::IMAPMailbox.new(logger,$defaults["imap_debug"]) @mailbox ||= ImapMailboxModule::IMAPMailbox.new(logger,$defaults["imap_debug"])
@mailbox.connect(@current_user.servers.primary_for_imap,@current_user.email, @current_user.get_cached_password(session)) @mailbox.connect(@current_user.servers.primary_for_imap,@current_user.login, @current_user.get_cached_password(session))
rescue Exception => ex rescue Exception => ex
redirect_to :controller => 'internal', :action => 'loginfailure' redirect_to :controller => 'internal', :action => 'loginfailure'
end end

View file

@ -403,6 +403,7 @@ div.param_group {
div.param_group label.label { div.param_group label.label {
margin-right: 5px; margin-right: 5px;
font-weight: bold;
} }
div.params div.group { div.params div.group {
@ -441,14 +442,15 @@ div.params input, div.params textarea, div.params select {
border:1px solid #CFCFCF; border:1px solid #CFCFCF;
} }
div.params div.group .description { div.params div.group .description, div.params div.param_group .description{
font-style: italic; font-style: italic;
color: #8C8C8C; color: #8C8C8C;
font-size: .9em; font-size: 10px;
} }
div.params div.group .fieldWithErrors .error { .fieldWithErrors .error {
color: red; color: red;
font-size: 10px;
} }
div.attachments { div.attachments {

0
themes/olive/views/layouts/_flash.html.erb Normal file → Executable file
View file

View file

@ -1,5 +1,5 @@
<td> <td>
<%= link_to attachment.filename_charseted, messages_attachment_download_path(attachment.parent_id,attachment.idx) %> <%= link_to attachment.filename_charseted, attachment_download_path(attachment.parent_id,attachment.idx) %>
</td> </td>
<td> <td>
<%= attachment.main_type %>/<%= attachment.sub_type %> <%= attachment.main_type %>/<%= attachment.sub_type %>
@ -14,6 +14,6 @@
<%= size_formatter(attachment.getSize) %> <%= size_formatter(attachment.getSize) %>
</td> </td>
<td> <td>
<%= link_to image_tag(current_theme_image_path('download.png')), messages_attachment_download_path(attachment.parent_id,attachment.idx) %> <%= link_to image_tag(current_theme_image_path('download.png')), attachment_download_path(attachment.parent_id,attachment.idx) %>
</td> </td>

View file

@ -1,9 +1,7 @@
<div class="fileselect"> <div class="fileselect">
<%= form_tag(upload_path, :multipart => true) %>
<label for="upload_file"><%= t(:select_file,:scope=>:compose) %></label>:&nbsp; <label for="upload_file"><%= t(:select_file,:scope=>:compose) %></label>:&nbsp;
<%= file_field 'upload', 'datafile' %> <%= file_field 'file', 'data' %>
<%= raw single_action('send_file','compose','up.png') %> <%= raw single_action('upload','compose','up.png') %>
</form>
</div> </div>

View file

@ -1,3 +1,3 @@
<iframe frameborder="0" src="<%= messages_html_body_path(@message.uid) %>"> <iframe frameborder="0" src="<%= html_body_path(@message.uid) %>">
</iframe> </iframe>

View file

@ -11,7 +11,7 @@
<td nowrap="nowrap"><%= date_formatter(message.date) %></td> <td nowrap="nowrap"><%= date_formatter(message.date) %></td>
</td><td nowrap="nowrap"><%= size_formatter(message.size) %></td> </td><td nowrap="nowrap"><%= size_formatter(message.size) %></td>
<% if @current_folder == @drafts_folder %> <% if @current_folder == @drafts_folder %>
<td><%= link_to(t(:edit,:scope=>:message),messages_ops_edit_path(message.uid)) %></td> <td><%= link_to(t(:edit,:scope=>:message),edit_path(message.uid)) %></td>
<% else %> <% else %>
<td><%= raw('&nbsp;') %></td> <td><%= raw('&nbsp;') %></td>
<% end %> <% end %>

View file

@ -1,4 +1,3 @@
<%= form_tag(sendout_or_save_path)%>
<div class="params"> <div class="params">
<%= raw form_field( @message, <%= raw form_field( @message,
"to_addr", "to_addr",
@ -25,6 +24,4 @@
<%= hidden_field_tag 'olduid', @olduid %> <%= hidden_field_tag 'olduid', @olduid %>
<% end %> <% end %>
<%= raw group_action(@buttons) %> <%= raw group_action(@buttons) %>
<%= render :partial=> 'messages/file_attachs' %>
</form>

View file

@ -13,9 +13,11 @@
<div class="content"> <div class="content">
<h2><%= t(:new_message,:scope=>:compose) %></h2> <h2><%= t(:new_message,:scope=>:compose) %></h2>
<div class="inner"> <div class="inner">
<%= form_tag(composed_path, :multipart => true) %>
<%= render :partial => 'messages/new' %> <%= render :partial => 'messages/new' %>
<%= render :partial=> 'messages/file_attachs' %>
<%= render :partial => 'messages/file_select' %> <%= render :partial => 'messages/file_select' %>
</div> </form>
</div> </div>
</div> </div>

View file

@ -1,10 +1,21 @@
<div class="params"> <div class="params">
<p> <%= raw form_field(@current_user,
<%= h @current_user.full_name %> "first_name",
</p> nil,
<p> "Joe",
<%= h @current_user.full_address %> @current_user.first_name
</p> ) %>
<%= raw form_field(@current_user,
"last_name",
nil,
"Doe",
@current_user.last_name
) %>
<%= raw form_field(@current_user,
"domain",
nil,
"domain.com",
@current_user.domain
) %>
</div> </div>
<%= raw single_action('save','common','save.png') %> <%= raw single_action('save','common','save.png') %>

0
themes/olive/views/prefs/_server.html.erb Normal file → Executable file
View file

0
themes/olive/views/prefs/_servers_list.html.erb Normal file → Executable file
View file

View file

@ -18,10 +18,10 @@
<form action="<%=url_for(:controller => 'user', :action => 'authenticate')%>" method="post" class="form login"> <form action="<%=url_for(:controller => 'user', :action => 'authenticate')%>" method="post" class="form login">
<div class="group wat-cf"> <div class="group wat-cf">
<div class="left"> <div class="left">
<label class="label right"><%= User.human_attribute_name('email') %></label> <label class="label right"><%= User.human_attribute_name('login') %></label>
</div> </div>
<div class="right"> <div class="right">
<%= text_field "user", "email" %> <%= text_field "user", "login" %>
</div> </div>
</div> </div>
<div class="group wat-cf"> <div class="group wat-cf">

View file

@ -9,7 +9,7 @@
<h2><%= t(:setup,:scope=>:user) %></h2> <h2><%= t(:setup,:scope=>:user) %></h2>
<div class="content"> <div class="content">
<form action="<%=url_for(:controller => 'user', :action => 'create')%>" method="post" class="form"> <form action="<%=url_for(:controller => 'user', :action => 'create')%>" method="post" class="form">
<%= raw form_field(@user,"email",nil,"joe.doe@domain.domain",params[:user].nil? ? params[:email] : params[:user][:email]) %> <%= raw form_field(@user,"login",nil,"joe.doe",params[:user].nil? ? params[:login] : params[:user][:login]) %>
<%= raw form_field(@user,"first_name",nil,"Joe","") %> <%= raw form_field(@user,"first_name",nil,"Joe","") %>
<%= raw form_field(@user,"last_name",nil,"Doe","") %> <%= raw form_field(@user,"last_name",nil,"Doe","") %>
<%= raw form_field(@server,"name",nil,"server.domain","") %> <%= raw form_field(@server,"name",nil,"server.domain","") %>

View file

@ -10,7 +10,7 @@
<div class="content"> <div class="content">
<div class="flash"><div class="message warning"><p><%= t(:unknown_flash,:scope=>:user) %></p></div></div> <div class="flash"><div class="message warning"><p><%= t(:unknown_flash,:scope=>:user) %></p></div></div>
<p><%= t(:unknown_login,:scope=>:user) %> -> <%= link_to t(:login,:scope=>:user),user_login_path %></p> <p><%= t(:unknown_login,:scope=>:user) %> -> <%= link_to t(:login,:scope=>:user),user_login_path %></p>
<p><%= t(:unknown_setup,:scope=>:user) %> -> <%= link_to t(:setup,:scope=>:user),:controller => "user",:action => "setup",:email => params['email'] %></p> <p><%= t(:unknown_setup,:scope=>:user) %> -> <%= link_to t(:setup,:scope=>:user),:controller => "user",:action => "setup",:login => params[:login] %></p>
</div> </div>
</div> </div>
</div> </div>