identity,servers view
This commit is contained in:
parent
9bb5f3a20f
commit
ef0b894ad8
2
CHANGES
Normal file → Executable file
2
CHANGES
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
|||
## Changes
|
||||
|
||||
#### 0.8.5 candidate
|
||||
#### 0.8.5
|
||||
|
||||
* servers view
|
||||
* identity modification
|
||||
|
|
4
Gemfile
4
Gemfile
|
@ -1,10 +1,10 @@
|
|||
source 'http://rubygems.org'
|
||||
|
||||
gem 'rails', '~>3.0.9'
|
||||
gem 'rails', '~>3.0.7'
|
||||
|
||||
gem 'mysql2' , '~>0.2.7'
|
||||
gem 'will_paginate', '~> 3.0.beta'
|
||||
gem 'themes_for_rails'
|
||||
gem "ezcrypto", "~> 0.7.2"
|
||||
gem "calendar_view", "~> 0.0.3"
|
||||
gem "calendar_view", "~> 0.0.4"
|
||||
gem 'bluecloth', '>= 2.0.0'
|
||||
|
|
7
TODO
Normal file → Executable file
7
TODO
Normal file → Executable file
|
@ -11,11 +11,10 @@ app/controllers/messages_controller.rb:
|
|||
|
||||
app/controllers/messages_ops_controller.rb:
|
||||
|
||||
* [128] [FIXME] check if uploads directory exists
|
||||
* [176] [FIXME] check if domain is set
|
||||
* [192] [TODO] check if email address is valid if not get address from contacts
|
||||
* [259] [FIXME] edit does not support attachments
|
||||
* [249] [FIXME] edit does not support attachments
|
||||
* [304] [TODO] check if email address is valid if not get address from contacts
|
||||
|
||||
app/models/prefs.rb:
|
||||
|
||||
* [ 19] [TODO] move refresh to prefs and make refresh page with messages
|
||||
|
||||
|
|
|
@ -63,15 +63,15 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def prepare_compose_buttons
|
||||
@buttons = []
|
||||
@buttons << {:text => 'send',:scope=>:compose,:image => 'email.png'}
|
||||
@buttons << {:text => 'save_as_draft',:scope=>:compose,:image => 'save.png'}
|
||||
@buttons << {:text => 'sendout',:scope=>:compose,:image => 'email.png'}
|
||||
@buttons << {:text => 'save',:scope=>:compose,:image => 'save.png'}
|
||||
end
|
||||
|
||||
def create_message_with_params
|
||||
@message = Message.new
|
||||
if params[:message]
|
||||
@message.update_attributes(params[:message])
|
||||
end
|
||||
@message = Message.new(params[:message])
|
||||
# if params[:message]
|
||||
# @message.update_attributes(params[:message])
|
||||
# end
|
||||
files = Dir.glob(File.join($defaults["msg_upload_dir"],@current_user.username + "*"))
|
||||
@attachments = []
|
||||
files.each do |f|
|
||||
|
|
|
@ -12,13 +12,12 @@ class FoldersController < ApplicationController
|
|||
after_filter :close_imap_session, :except => [:index,:show_hide,:system]
|
||||
|
||||
before_filter :get_folders
|
||||
before_filter :prepare_buttons_to_folders
|
||||
|
||||
theme :theme_resolver
|
||||
|
||||
def index
|
||||
@buttons = []
|
||||
@buttons << {:text => 'show_hide',:scope=>'folder',:image => 'flag.png'}
|
||||
@buttons << {:text => 'refresh',:scope=>'folder',:image => 'refresh.png'}
|
||||
#before_filter
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -154,6 +153,12 @@ class FoldersController < ApplicationController
|
|||
|
||||
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
|
||||
@folders = @current_user.folders
|
||||
@folders_shown = @current_user.folders.shown
|
||||
|
|
|
@ -3,6 +3,7 @@ require 'imap_mailbox'
|
|||
require 'imap_message'
|
||||
require 'mail'
|
||||
require 'mail_plugin_extension'
|
||||
require 'net/smtp'
|
||||
|
||||
class MessagesOpsController < ApplicationController
|
||||
|
||||
|
@ -14,8 +15,9 @@ class MessagesOpsController < ApplicationController
|
|||
before_filter :check_current_user ,:selected_folder,:get_current_folders
|
||||
before_filter :open_imap_session, :select_imap_folder
|
||||
before_filter :prepare_compose_buttons
|
||||
before_filter :get_system_folders, :only => [:sendout_or_save,:single,:multi]
|
||||
before_filter :create_message_with_params , :only => [:sendout_or_save]
|
||||
before_filter :get_system_folders, :only => [:composed,:single,:multi]
|
||||
before_filter :prepare_composed , :only => [:composed]
|
||||
before_filter :create_message_with_params, :only=> [:composed,:single,:multi]
|
||||
after_filter :close_imap_session
|
||||
theme :theme_resolver
|
||||
|
||||
|
@ -125,17 +127,20 @@ class MessagesOpsController < ApplicationController
|
|||
end
|
||||
|
||||
def upload
|
||||
#FIXME check if uploads directory exists
|
||||
@operation = :upload
|
||||
create_message_with_params
|
||||
if not params[:upload]
|
||||
flash[:error] = t(:no_file_chosen,:scope=>:common)
|
||||
else
|
||||
name = params[:upload][:datafile].original_filename
|
||||
begin
|
||||
raise MailrException.new :cause=>:no_tmp_dir,:scope=>:common if not File.exists?($defaults["msg_upload_dir"])
|
||||
raise MailrException.new :cause=>:no_file_chosen,:scope=>:common if not params[:upload]
|
||||
@operation = :upload
|
||||
name = params[:file][:data].original_filename
|
||||
upload_dir = $defaults["msg_upload_dir"]
|
||||
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
|
||||
create_message_with_params
|
||||
render 'messages/compose'
|
||||
end
|
||||
|
||||
|
@ -168,13 +173,7 @@ class MessagesOpsController < ApplicationController
|
|||
# if File.exist?("#{RAILS_ROOT}/dirname/#{@filename}")
|
||||
# end
|
||||
|
||||
|
||||
############################################### sendout_or_save ############################
|
||||
|
||||
def sendout_or_save
|
||||
|
||||
#FIXME check if domain is set
|
||||
|
||||
def composed
|
||||
if params[:delete_marked] and params[:files]
|
||||
params[:files].each do |filename|
|
||||
path = File.join(Rails.root,$defaults["msg_upload_dir"],@current_user.username + "_" +filename)
|
||||
|
@ -184,77 +183,70 @@ class MessagesOpsController < ApplicationController
|
|||
@operation = :new
|
||||
render 'messages/compose'
|
||||
return
|
||||
end
|
||||
|
||||
mail = Mail.new
|
||||
mail.subject = params[:message][:subject]
|
||||
mail.from = @current_user.full_address
|
||||
#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 + "*"))
|
||||
#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)
|
||||
elsif params[:upload]
|
||||
upload
|
||||
elsif params[:save]
|
||||
save
|
||||
elsif params[:sendout]
|
||||
sendout
|
||||
else
|
||||
redirect_to :controller => 'messages', :action => 'index'
|
||||
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
|
||||
def edit
|
||||
|
@ -266,7 +258,7 @@ class MessagesOpsController < ApplicationController
|
|||
imap_message = @mailbox.fetch_body(old_message.uid)
|
||||
mail = Mail.new(imap_message)
|
||||
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
|
||||
@message.body = mail.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
|
||||
end
|
||||
|
@ -285,7 +277,7 @@ class MessagesOpsController < ApplicationController
|
|||
imap_message = @mailbox.fetch_body(old_message.uid)
|
||||
mail = Mail.new(imap_message)
|
||||
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
|
||||
@message.body = mail.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
|
||||
end
|
||||
|
@ -297,7 +289,28 @@ class MessagesOpsController < ApplicationController
|
|||
|
||||
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 ####################################
|
||||
|
||||
|
@ -313,7 +326,7 @@ class MessagesOpsController < ApplicationController
|
|||
authentication = server.auth
|
||||
enable_starttls_auto = server.use_tls
|
||||
openssl_verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
user_name = user.full_address
|
||||
user_name = user.login
|
||||
end
|
||||
Mail.defaults do
|
||||
delivery_method :smtp, {:address => server.name,
|
||||
|
|
|
@ -22,10 +22,18 @@ class PrefsController < ApplicationController
|
|||
end
|
||||
|
||||
def update_identity
|
||||
if params[:user]
|
||||
@current_user.update_attributes(params[:user])
|
||||
if 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
|
||||
redirect_to :action => 'identity'
|
||||
end
|
||||
|
||||
def look
|
||||
|
@ -33,7 +41,6 @@ class PrefsController < ApplicationController
|
|||
end
|
||||
|
||||
def identity
|
||||
@identity = @curent_user
|
||||
end
|
||||
|
||||
def servers
|
||||
|
|
|
@ -15,15 +15,15 @@ class UserController < ApplicationController
|
|||
def authenticate
|
||||
|
||||
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'
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
user = User.find_by_email(params[:user][:email])
|
||||
user = User.find_by_login(params[:user][:login])
|
||||
if user.nil?
|
||||
redirect_to :action => 'unknown' ,:email=> params[:user][:email]
|
||||
redirect_to :action => 'unknown' ,:login=> params[:user][:login]
|
||||
else
|
||||
session[:user_id] = user.id
|
||||
user.set_cached_password(session,params[:user][:password])
|
||||
|
@ -52,7 +52,7 @@ class UserController < ApplicationController
|
|||
def create
|
||||
|
||||
@user = User.new
|
||||
@user.email = params[:user][:email]
|
||||
@user.login = params[:user][:login]
|
||||
@user.first_name = params[:user][:first_name]
|
||||
@user.last_name = params[:user][:last_name]
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ module ApplicationHelper
|
|||
def form_field(object,field,flabel,example,val)
|
||||
model_name = eval(object.class.model_name)
|
||||
html = ""
|
||||
html << "<div class=\"group\">"
|
||||
html << "<div class=\"param_group\">"
|
||||
if not object.errors[field.to_sym].empty?
|
||||
html << "<div class=\"fieldWithErrors\">"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ class User < ActiveRecord::Base
|
|||
#acts_as_notes_owner
|
||||
|
||||
validates_presence_of :first_name,:last_name
|
||||
validates_uniqueness_of :email
|
||||
validates_uniqueness_of :login
|
||||
has_many :servers, :dependent => :destroy
|
||||
has_one :prefs, :dependent => :destroy
|
||||
has_many :folders, :dependent => :destroy
|
||||
|
@ -33,21 +33,31 @@ class User < ActiveRecord::Base
|
|||
(0...8).map{65.+(rand(25)).chr}.join
|
||||
end
|
||||
|
||||
def full_name
|
||||
def name
|
||||
first_name + " " + last_name
|
||||
end
|
||||
|
||||
def full_address
|
||||
d = domain.presence || ""
|
||||
if email =~ /\@/
|
||||
email
|
||||
def full_id
|
||||
(name + " <" + email + ">") if email
|
||||
end
|
||||
|
||||
def email
|
||||
if login =~ /\@/
|
||||
login
|
||||
else
|
||||
email + "@" + d
|
||||
(login + "@" + domain) if domain.presence
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
|
|
|
@ -51,3 +51,7 @@ class ActiveSupport::BufferedLogger
|
|||
end
|
||||
end
|
||||
|
||||
class MailrException < Exception
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version: 0.8.4
|
||||
version: 0.8.5
|
||||
|
||||
theme: olive
|
||||
locale: pl
|
||||
|
@ -47,4 +47,4 @@ session_password: asDD3s2@sAdc983#
|
|||
mailbox_max_parent_folder_depth: 3
|
||||
|
||||
# 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]
|
||||
|
|
|
@ -46,6 +46,7 @@ pl:
|
|||
password: Hasło
|
||||
first_name: Imię
|
||||
last_name: Nazwisko
|
||||
domain: Domena
|
||||
server:
|
||||
name: Nazwa serwera
|
||||
port: Port
|
||||
|
@ -147,9 +148,9 @@ pl:
|
|||
not_configured_smtp: Brak konfiguracji SMTP
|
||||
select_file: Wybierz plik
|
||||
delete_marked: Usuń zaznaczone
|
||||
send_file: Wyślij plik
|
||||
send: Wyślij
|
||||
save_as_draft: Zapisz w katalogu roboczym
|
||||
upload: Wyślij plik
|
||||
sendout: Wyślij
|
||||
save: Zapisz w katalogu roboczym
|
||||
|
||||
show:
|
||||
reply: Odpowiedz
|
||||
|
@ -171,6 +172,7 @@ pl:
|
|||
login: Logowanie
|
||||
only_can_logins: Podany identyfikator użytkownika nie uprawnia do korzystania z aplikacji
|
||||
logout: Wyloguj
|
||||
has_no_domain: Użytkownik nie ma ustawionej domeny
|
||||
|
||||
internal:
|
||||
imap_error: Błąd protokołu IMAP
|
||||
|
@ -180,6 +182,7 @@ pl:
|
|||
unprocessable_entity: Błąd procesowania
|
||||
about: Informacje o programie
|
||||
current_version: Aktualna wersja
|
||||
general_error: Błąd aplikacji
|
||||
|
||||
common:
|
||||
false_answer: Nie
|
||||
|
|
170
config/routes.rb
170
config/routes.rb
|
@ -1,130 +1,70 @@
|
|||
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"
|
||||
post "prefs/update_identity"
|
||||
post "prefs/update_servers"
|
||||
namespace :contacts do
|
||||
post "ops"
|
||||
get "export"
|
||||
end
|
||||
match "/external" => "contacts#external", :as => :external
|
||||
|
||||
match "prefs/look" => "prefs#look", :as => :prefs_look
|
||||
match "prefs/identity" => "prefs#identity", :as => :prefs_identity
|
||||
match "prefs/servers" => "prefs#servers", :as => :prefs_servers
|
||||
resources :contacts
|
||||
|
||||
post "contacts/ops"
|
||||
get "contacts/export"
|
||||
match "contacts/external" => "contacts#external", :as => :contacts_external
|
||||
resources :contacts
|
||||
namespace :folders do
|
||||
post "create"
|
||||
post "delete"
|
||||
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
|
||||
match "folders/index" => 'folders#index', :as => :folders
|
||||
post "folders/create"
|
||||
post "folders/delete"
|
||||
post "folders/system"
|
||||
post "folders/show_hide"
|
||||
post "folders/refresh"
|
||||
get "folders/refresh_status"
|
||||
post "folders/refresh"
|
||||
match "folders/select/:id" => 'folders#select', :as => :folders_select
|
||||
get "folders/emptybin"
|
||||
namespace :internal do
|
||||
get "error"
|
||||
get "imaperror"
|
||||
get "loginfailure"
|
||||
get "onlycanlogins"
|
||||
end
|
||||
match "/internal/about" => 'internal#about' ,:as => :about
|
||||
|
||||
get "internal/error"
|
||||
get "internal/imaperror"
|
||||
get "internal/loginfailure"
|
||||
get "internal/onlycanlogins"
|
||||
match "internal/about" => 'internal#about' ,:as => :about
|
||||
|
||||
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
|
||||
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 => :edit
|
||||
match "/messages_ops/composed" => 'messages_ops#composed', :as => :composed
|
||||
|
||||
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/reply/:id" => 'messages#reply'
|
||||
match "/messages/index" => 'messages#index', :as => :messages
|
||||
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'
|
||||
#match "messages/body/:id/:idx" => 'messages#body' , :as => :messages_part_body
|
||||
match "messages/html_body/:id" => 'messages#html_body' , :as => :messages_html_body
|
||||
match "messages/attachment/:id/:idx" => 'messages#attachment', :as => :messages_attachment_download
|
||||
|
||||
get "user/logout"
|
||||
post "user/authenticate"
|
||||
post "user/create"
|
||||
get "user/login"
|
||||
get "user/setup"
|
||||
match 'user/setup/:id' => 'user#setup'
|
||||
get "user/unknown"
|
||||
namespace :user do
|
||||
get "logout"
|
||||
post "authenticate"
|
||||
post "create"
|
||||
get "login"
|
||||
get "setup"
|
||||
get "unknown"
|
||||
end
|
||||
match "/user/setup/:login" => 'user#setup'
|
||||
|
||||
themes_for_rails
|
||||
#acts_as_notes_owner
|
||||
|
||||
#match '*a', :to => 'internal#not_found'
|
||||
|
||||
# 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)))'
|
||||
#match '*a', :to => 'internal#not_found'
|
||||
#match ':controller(/:action(/:id(.:format)))'
|
||||
end
|
||||
|
|
9
db/migrate/20110927091830_rename_email_in_user.rb
Executable file
9
db/migrate/20110927091830_rename_email_in_user.rb
Executable 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
|
27
db/schema.rb
27
db/schema.rb
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# 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|
|
||||
t.string "nick"
|
||||
|
@ -23,6 +23,18 @@ ActiveRecord::Schema.define(:version => 20110913114841) do
|
|||
t.datetime "updated_at"
|
||||
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|
|
||||
t.string "name"
|
||||
t.string "delim"
|
||||
|
@ -54,17 +66,6 @@ ActiveRecord::Schema.define(:version => 20110913114841) do
|
|||
t.datetime "updated_at"
|
||||
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|
|
||||
t.string "theme"
|
||||
t.string "locale"
|
||||
|
@ -91,7 +92,7 @@ ActiveRecord::Schema.define(:version => 20110913114841) do
|
|||
end
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "email"
|
||||
t.string "login"
|
||||
t.string "first_name"
|
||||
t.string "last_name"
|
||||
t.datetime "created_at"
|
||||
|
|
|
@ -6,7 +6,7 @@ module ImapSessionModule
|
|||
def open_imap_session
|
||||
begin
|
||||
@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
|
||||
redirect_to :controller => 'internal', :action => 'loginfailure'
|
||||
end
|
||||
|
|
|
@ -403,6 +403,7 @@ div.param_group {
|
|||
|
||||
div.param_group label.label {
|
||||
margin-right: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.params div.group {
|
||||
|
@ -441,14 +442,15 @@ div.params input, div.params textarea, div.params select {
|
|||
border:1px solid #CFCFCF;
|
||||
}
|
||||
|
||||
div.params div.group .description {
|
||||
div.params div.group .description, div.params div.param_group .description{
|
||||
font-style: italic;
|
||||
color: #8C8C8C;
|
||||
font-size: .9em;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
div.params div.group .fieldWithErrors .error {
|
||||
.fieldWithErrors .error {
|
||||
color: red;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
div.attachments {
|
||||
|
|
0
themes/olive/views/layouts/_flash.html.erb
Normal file → Executable file
0
themes/olive/views/layouts/_flash.html.erb
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
|||
<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>
|
||||
<%= attachment.main_type %>/<%= attachment.sub_type %>
|
||||
|
@ -14,6 +14,6 @@
|
|||
<%= size_formatter(attachment.getSize) %>
|
||||
</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>
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<div class="fileselect">
|
||||
<%= form_tag(upload_path, :multipart => true) %>
|
||||
<label for="upload_file"><%= t(:select_file,:scope=>:compose) %></label>:
|
||||
<%= file_field 'upload', 'datafile' %>
|
||||
<%= raw single_action('send_file','compose','up.png') %>
|
||||
</form>
|
||||
<%= file_field 'file', 'data' %>
|
||||
<%= raw single_action('upload','compose','up.png') %>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<iframe frameborder="0" src="<%= messages_html_body_path(@message.uid) %>">
|
||||
<iframe frameborder="0" src="<%= html_body_path(@message.uid) %>">
|
||||
</iframe>
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<td nowrap="nowrap"><%= date_formatter(message.date) %></td>
|
||||
</td><td nowrap="nowrap"><%= size_formatter(message.size) %></td>
|
||||
<% 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 %>
|
||||
<td><%= raw(' ') %></td>
|
||||
<% end %>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<%= form_tag(sendout_or_save_path)%>
|
||||
<div class="params">
|
||||
<%= raw form_field( @message,
|
||||
"to_addr",
|
||||
|
@ -25,6 +24,4 @@
|
|||
<%= hidden_field_tag 'olduid', @olduid %>
|
||||
<% end %>
|
||||
<%= raw group_action(@buttons) %>
|
||||
<%= render :partial=> 'messages/file_attachs' %>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -13,9 +13,11 @@
|
|||
<div class="content">
|
||||
<h2><%= t(:new_message,:scope=>:compose) %></h2>
|
||||
<div class="inner">
|
||||
<%= form_tag(composed_path, :multipart => true) %>
|
||||
<%= render :partial => 'messages/new' %>
|
||||
<%= render :partial=> 'messages/file_attachs' %>
|
||||
<%= render :partial => 'messages/file_select' %>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
|
||||
<div class="params">
|
||||
<p>
|
||||
<%= h @current_user.full_name %>
|
||||
</p>
|
||||
<p>
|
||||
<%= h @current_user.full_address %>
|
||||
</p>
|
||||
<%= raw form_field(@current_user,
|
||||
"first_name",
|
||||
nil,
|
||||
"Joe",
|
||||
@current_user.first_name
|
||||
) %>
|
||||
<%= 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>
|
||||
<%= raw single_action('save','common','save.png') %>
|
||||
|
|
0
themes/olive/views/prefs/_server.html.erb
Normal file → Executable file
0
themes/olive/views/prefs/_server.html.erb
Normal file → Executable file
0
themes/olive/views/prefs/_servers_list.html.erb
Normal file → Executable file
0
themes/olive/views/prefs/_servers_list.html.erb
Normal file → Executable file
|
@ -18,10 +18,10 @@
|
|||
<form action="<%=url_for(:controller => 'user', :action => 'authenticate')%>" method="post" class="form login">
|
||||
<div class="group wat-cf">
|
||||
<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 class="right">
|
||||
<%= text_field "user", "email" %>
|
||||
<%= text_field "user", "login" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group wat-cf">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<h2><%= t(:setup,:scope=>:user) %></h2>
|
||||
<div class="content">
|
||||
<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,"last_name",nil,"Doe","") %>
|
||||
<%= raw form_field(@server,"name",nil,"server.domain","") %>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<div class="content">
|
||||
<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_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>
|
||||
|
|
Loading…
Reference in a new issue