From 0daf48781647eeeb3f7d02ceb06bb9dc79ac7ffd Mon Sep 17 00:00:00 2001 From: Wojciech Todryk Date: Sat, 24 Mar 2012 13:23:34 +0100 Subject: [PATCH] dev cont --- Gemfile | 0 Gemfile.lock | 0 Rakefile | 0 .../images/glyphicons-halflings-white.png | Bin app/assets/images/glyphicons-halflings.png | Bin app/assets/images/rails.png | Bin app/assets/javascripts/application.js | 0 app/assets/javascripts/bootstrap.min.js | 0 app/assets/javascripts/mailr.js | 10 + app/assets/stylesheets/application.css | 0 .../stylesheets/bootstrap-responsive.min.css | 0 app/assets/stylesheets/bootstrap.min.css | 4 +- app/assets/stylesheets/mailr.css.sass | 26 + app/controllers/application_controller.rb | 10 +- app/controllers/folders_controller.rb | 18 +- app/controllers/internal_controller.rb | 26 +- app/controllers/messages_controller.rb | 47 +- app/controllers/user_controller.rb | 42 +- app/helpers/application_helper.rb | 628 +++++++++--------- app/helpers/contacts_helper.rb | 17 + app/helpers/folder_helper.rb | 66 ++ app/helpers/internal_helper.rb | 2 + app/helpers/links_helper.rb | 17 + app/helpers/messages_helper.rb | 118 ++++ app/helpers/messages_ops_helper.rb | 2 + app/helpers/prefs_helper.rb | 16 + app/helpers/user_helper.rb | 2 + app/mailers/.gitkeep | 0 app/models/.gitkeep | 0 app/models/link.rb | 0 app/models/user.rb | 2 +- app/views/common/_button.html.haml | 19 + app/views/common/_click_button.html.haml | 6 + app/views/common/_form_button_icon.html.haml | 6 + .../common/_input_form_desc_field.html.haml | 30 +- app/views/common/_input_form_field.html.haml | 5 +- .../_input_password_form_field.html.haml | 5 + app/views/common/_logo.html.haml | 2 + app/views/common/_main_navigation.html.haml | 22 + app/views/common/_multiselect.html.haml | 22 + .../common/_select_for_folders.html.haml | 5 + app/views/common/_version.html.haml | 2 + app/views/contacts/index.html.haml | 8 + app/views/folders/_create.html.haml | 8 + app/views/folders/_delete.html.haml | 6 + app/views/folders/_list.html.haml | 16 + app/views/folders/_refresh.html.haml | 11 + app/views/folders/_system.html.haml | 9 + app/views/folders/index.html.haml | 16 + app/views/internal/_version.html.erb | 4 + app/views/internal/about.html.erb | 33 + app/views/internal/error.html.haml | 0 app/views/layouts/application.html.haml | 30 + app/views/links/index.html.haml | 8 + app/views/messages/_attachment.html.erb | 19 + app/views/messages/_attachment.html.haml | 14 + app/views/messages/_attachments.html.erb | 13 + app/views/messages/_attachments.html.haml | 9 + app/views/messages/_file_attach.html.erb | 4 + app/views/messages/_file_attachs.html.erb | 16 + app/views/messages/_file_select.html.erb | 9 + app/views/messages/_header.html.erb | 14 + app/views/messages/_header.html.haml | 39 ++ app/views/messages/_html_part.html.erb | 3 + app/views/messages/_image.html.erb | 8 + app/views/messages/_images.html.erb | 8 + app/views/messages/_message.html.haml | 38 ++ app/views/messages/_messages.html.haml | 32 + app/views/messages/_multi_ops.html.haml | 20 + app/views/messages/_new.html.erb | 27 + app/views/messages/_search.html.erb | 10 + app/views/messages/_single_ops.html.erb | 10 + app/views/messages/_single_ops.html.haml | 25 + app/views/messages/compose.html.erb | 23 + app/views/messages/compose.html.haml | 44 ++ app/views/messages/html_body.html.erb | 2 + app/views/messages/index.html.haml | 20 + app/views/messages/index2.html.erb | 33 + app/views/messages/show.html.erb | 43 ++ app/views/messages/show.html.haml | 29 + app/views/prefs/look.html.haml | 8 + app/views/sidebar/_calendar_view.html.haml | 0 app/views/sidebar/_sidebar.html.haml | 11 + app/views/user/login.html.haml | 6 +- app/views/user/setup.html.haml | 8 +- app/views/user/unknown.html.erb | 16 - config.ru | 0 config/application.rb | 0 config/boot.rb | 0 config/environment.rb | 0 config/environments/development.rb | 0 config/environments/production.rb | 0 config/environments/test.rb | 0 config/initializers/backtrace_silencers.rb | 0 config/initializers/inflections.rb | 0 config/initializers/mime_types.rb | 0 config/initializers/secret_token.rb | 0 config/initializers/session_store.rb | 0 config/initializers/wrap_parameters.rb | 0 config/locales/pl.yml | 14 +- config/routes.rb | 3 +- config/settings.yml.example | 0 .../20120303202800_create_all_tables.rb | 0 db/schema.rb | 0 db/seeds.rb | 0 doc/README_FOR_APP | 0 lib/assets/.gitkeep | 0 lib/mail_plugin_extension.rb | 184 ++--- lib/tasks/.gitkeep | 0 lib/tasks/clear_db.rake | 23 + log/.gitkeep | 0 public/404.html | 0 public/422.html | 0 public/500.html | 0 public/favicon.ico | 0 public/robots.txt | 0 test/fixtures/.gitkeep | 0 test/functional/.gitkeep | 0 test/integration/.gitkeep | 0 test/performance/browsing_test.rb | 0 test/test_helper.rb | 0 test/unit/.gitkeep | 0 vendor/assets/javascripts/.gitkeep | 0 vendor/assets/stylesheets/.gitkeep | 0 vendor/plugins/.gitkeep | 0 125 files changed, 1629 insertions(+), 482 deletions(-) mode change 100644 => 100755 Gemfile mode change 100644 => 100755 Gemfile.lock mode change 100644 => 100755 Rakefile mode change 100644 => 100755 app/assets/images/glyphicons-halflings-white.png mode change 100644 => 100755 app/assets/images/glyphicons-halflings.png mode change 100644 => 100755 app/assets/images/rails.png mode change 100644 => 100755 app/assets/javascripts/application.js mode change 100644 => 100755 app/assets/javascripts/bootstrap.min.js create mode 100755 app/assets/javascripts/mailr.js mode change 100644 => 100755 app/assets/stylesheets/application.css mode change 100644 => 100755 app/assets/stylesheets/bootstrap-responsive.min.css mode change 100644 => 100755 app/assets/stylesheets/bootstrap.min.css mode change 100644 => 100755 app/assets/stylesheets/mailr.css.sass create mode 100755 app/helpers/contacts_helper.rb create mode 100755 app/helpers/folder_helper.rb create mode 100755 app/helpers/internal_helper.rb create mode 100755 app/helpers/links_helper.rb create mode 100755 app/helpers/messages_helper.rb create mode 100755 app/helpers/messages_ops_helper.rb create mode 100755 app/helpers/prefs_helper.rb create mode 100755 app/helpers/user_helper.rb mode change 100644 => 100755 app/mailers/.gitkeep mode change 100644 => 100755 app/models/.gitkeep mode change 100644 => 100755 app/models/link.rb create mode 100755 app/views/common/_button.html.haml create mode 100755 app/views/common/_click_button.html.haml create mode 100755 app/views/common/_form_button_icon.html.haml create mode 100755 app/views/common/_input_password_form_field.html.haml create mode 100755 app/views/common/_logo.html.haml create mode 100755 app/views/common/_main_navigation.html.haml create mode 100755 app/views/common/_multiselect.html.haml create mode 100755 app/views/common/_select_for_folders.html.haml create mode 100755 app/views/common/_version.html.haml create mode 100755 app/views/contacts/index.html.haml create mode 100755 app/views/folders/_create.html.haml create mode 100755 app/views/folders/_delete.html.haml create mode 100755 app/views/folders/_list.html.haml create mode 100755 app/views/folders/_refresh.html.haml create mode 100755 app/views/folders/_system.html.haml create mode 100755 app/views/folders/index.html.haml create mode 100755 app/views/internal/_version.html.erb create mode 100755 app/views/internal/about.html.erb create mode 100755 app/views/internal/error.html.haml create mode 100755 app/views/layouts/application.html.haml create mode 100755 app/views/links/index.html.haml create mode 100755 app/views/messages/_attachment.html.erb create mode 100755 app/views/messages/_attachment.html.haml create mode 100755 app/views/messages/_attachments.html.erb create mode 100755 app/views/messages/_attachments.html.haml create mode 100755 app/views/messages/_file_attach.html.erb create mode 100755 app/views/messages/_file_attachs.html.erb create mode 100755 app/views/messages/_file_select.html.erb create mode 100755 app/views/messages/_header.html.erb create mode 100755 app/views/messages/_header.html.haml create mode 100755 app/views/messages/_html_part.html.erb create mode 100755 app/views/messages/_image.html.erb create mode 100755 app/views/messages/_images.html.erb create mode 100755 app/views/messages/_message.html.haml create mode 100755 app/views/messages/_messages.html.haml create mode 100755 app/views/messages/_multi_ops.html.haml create mode 100755 app/views/messages/_new.html.erb create mode 100755 app/views/messages/_search.html.erb create mode 100755 app/views/messages/_single_ops.html.erb create mode 100755 app/views/messages/_single_ops.html.haml create mode 100755 app/views/messages/compose.html.erb create mode 100755 app/views/messages/compose.html.haml create mode 100755 app/views/messages/html_body.html.erb create mode 100755 app/views/messages/index.html.haml create mode 100755 app/views/messages/index2.html.erb create mode 100755 app/views/messages/show.html.erb create mode 100755 app/views/messages/show.html.haml create mode 100755 app/views/prefs/look.html.haml create mode 100755 app/views/sidebar/_calendar_view.html.haml create mode 100755 app/views/sidebar/_sidebar.html.haml mode change 100644 => 100755 app/views/user/login.html.haml delete mode 100755 app/views/user/unknown.html.erb mode change 100644 => 100755 config.ru mode change 100644 => 100755 config/application.rb mode change 100644 => 100755 config/boot.rb mode change 100644 => 100755 config/environment.rb mode change 100644 => 100755 config/environments/development.rb mode change 100644 => 100755 config/environments/production.rb mode change 100644 => 100755 config/environments/test.rb mode change 100644 => 100755 config/initializers/backtrace_silencers.rb mode change 100644 => 100755 config/initializers/inflections.rb mode change 100644 => 100755 config/initializers/mime_types.rb mode change 100644 => 100755 config/initializers/secret_token.rb mode change 100644 => 100755 config/initializers/session_store.rb mode change 100644 => 100755 config/initializers/wrap_parameters.rb mode change 100644 => 100755 config/settings.yml.example mode change 100644 => 100755 db/migrate/20120303202800_create_all_tables.rb mode change 100644 => 100755 db/schema.rb mode change 100644 => 100755 db/seeds.rb mode change 100644 => 100755 doc/README_FOR_APP mode change 100644 => 100755 lib/assets/.gitkeep mode change 100644 => 100755 lib/tasks/.gitkeep create mode 100755 lib/tasks/clear_db.rake mode change 100644 => 100755 log/.gitkeep mode change 100644 => 100755 public/404.html mode change 100644 => 100755 public/422.html mode change 100644 => 100755 public/500.html mode change 100644 => 100755 public/favicon.ico mode change 100644 => 100755 public/robots.txt mode change 100644 => 100755 test/fixtures/.gitkeep mode change 100644 => 100755 test/functional/.gitkeep mode change 100644 => 100755 test/integration/.gitkeep mode change 100644 => 100755 test/performance/browsing_test.rb mode change 100644 => 100755 test/test_helper.rb mode change 100644 => 100755 test/unit/.gitkeep mode change 100644 => 100755 vendor/assets/javascripts/.gitkeep mode change 100644 => 100755 vendor/assets/stylesheets/.gitkeep mode change 100644 => 100755 vendor/plugins/.gitkeep diff --git a/Gemfile b/Gemfile old mode 100644 new mode 100755 diff --git a/Gemfile.lock b/Gemfile.lock old mode 100644 new mode 100755 diff --git a/Rakefile b/Rakefile old mode 100644 new mode 100755 diff --git a/app/assets/images/glyphicons-halflings-white.png b/app/assets/images/glyphicons-halflings-white.png old mode 100644 new mode 100755 diff --git a/app/assets/images/glyphicons-halflings.png b/app/assets/images/glyphicons-halflings.png old mode 100644 new mode 100755 diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/bootstrap.min.js b/app/assets/javascripts/bootstrap.min.js old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/mailr.js b/app/assets/javascripts/mailr.js new file mode 100755 index 0000000..ff47b09 --- /dev/null +++ b/app/assets/javascripts/mailr.js @@ -0,0 +1,10 @@ +$(function() { + console.log("ready"); + $("#toggleall").click(function() { + var checked_status = this.checked; + jQuery("input[type='checkbox']").each(function() { + this.checked = checked_status; + }); + }); + +}); diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/bootstrap-responsive.min.css b/app/assets/stylesheets/bootstrap-responsive.min.css old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/bootstrap.min.css b/app/assets/stylesheets/bootstrap.min.css old mode 100644 new mode 100755 index 30dcae0..731a1b1 --- a/app/assets/stylesheets/bootstrap.min.css +++ b/app/assets/stylesheets/bootstrap.min.css @@ -220,8 +220,8 @@ table .span9{float:none;width:684px;margin-left:0;} table .span10{float:none;width:764px;margin-left:0;} table .span11{float:none;width:844px;margin-left:0;} table .span12{float:none;width:924px;margin-left:0;} -[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat;*margin-right:.3em;}[class^="icon-"]:last-child,[class*=" icon-"]:last-child{*margin-left:0;} -.icon-white{background-image:url("../img/glyphicons-halflings-white.png");} +[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;line-height:14px;vertical-align:text-top;background-image:url("/assets/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat;*margin-right:.3em;}[class^="icon-"]:last-child,[class*=" icon-"]:last-child{*margin-left:0;} +.icon-white{background-image:url("/assets/glyphicons-halflings-white.png");} .icon-glass{background-position:0 0;} .icon-music{background-position:-24px 0;} .icon-search{background-position:-48px 0;} diff --git a/app/assets/stylesheets/mailr.css.sass b/app/assets/stylesheets/mailr.css.sass old mode 100644 new mode 100755 index 6dca155..32b115a --- a/app/assets/stylesheets/mailr.css.sass +++ b/app/assets/stylesheets/mailr.css.sass @@ -1,7 +1,33 @@ body.simple margin-top: 20px margin-bottom: 20px + #footer-simple text-align: center + .top-pix18 margin-top: 18px + +body.application + margin-top: 10px + margin-bottom: 10px + +#sidebar + .logo + img + margin-bottom: 10px + +p.version + text-align: center + +tr.unseen + font-weight: bold + +.bottom-pix18 + margin-bottom: 18px + +table.header + td.field_name + text-align: right + font-weight: bold + padding-right: 10px diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e38947f..8384d89 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,8 +2,9 @@ require 'yaml' class ApplicationController < ActionController::Base - protect_from_forgery - + #logger.custom("session",session.inspect) + #protect_from_forgery + before_filter :load_settings,:current_user,:set_locale #before_filter :plugins_configuration @@ -32,13 +33,14 @@ class ApplicationController < ActionController::Base end def current_user - @current_user ||= User.find(session[:user_id]) if session[:user_id] + @current_user ||= User.find(session[:user_id]) if session[:user_id] + logger.custom("current_user",@current_user.inspect) end def check_current_user if @current_user.nil? session["return_to"] = request.fullpath - redirect_to :controller => 'user', :action => 'login' + redirect_to :controller => 'user', :action => 'login' return false end end diff --git a/app/controllers/folders_controller.rb b/app/controllers/folders_controller.rb index a0717af..88bcbb5 100755 --- a/app/controllers/folders_controller.rb +++ b/app/controllers/folders_controller.rb @@ -3,16 +3,16 @@ require 'imap_session' class FoldersController < ApplicationController - include ImapMailboxModule + include ImapMailboxModule include ImapSessionModule - 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, :except => [:index,:show_hide,:system] after_filter :close_imap_session, :except => [:index,:show_hide,:system] before_filter :get_folders - before_filter :prepare_buttons_to_folders + #before_filter :prepare_buttons_to_folders #theme :theme_resolver @@ -153,16 +153,16 @@ 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 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 - #@folders_system = @current_user.folders.sys + @folders_system = @current_user.folders.sys @current_user.folders.inbox.first.nil? ? @folder_inbox = "" : @folder_inbox = @current_user.folders.inbox.first.id @current_user.folders.drafts.first.nil? ? @folder_drafts = "" : @folder_drafts = @current_user.folders.drafts.first.id @current_user.folders.sent.first.nil? ? @folder_sent = "" : @folder_sent = @current_user.folders.sent.first.id diff --git a/app/controllers/internal_controller.rb b/app/controllers/internal_controller.rb index 431b9d2..c257d6f 100755 --- a/app/controllers/internal_controller.rb +++ b/app/controllers/internal_controller.rb @@ -9,13 +9,14 @@ class InternalController < ApplicationController ERRORS = [ :internal_server_error, :not_found, - :unprocessable_entity + :unprocessable_entity, + :allready_configured ].freeze ERRORS.each do |e| define_method e do @title = t(e,:scope=>:internal) - @error = t(e,:scope=>:internal) + flash[:error] = t(e,:scope=>:internal) render 'error' end end @@ -29,7 +30,7 @@ class InternalController < ApplicationController @title = t(:imap_error,:scope => :internal) @error = params[:error] || t(:unspecified_error, :scope => :internal) logger.error "!!! InternalControllerImapError: " + @error - render 'error' + render 'error' end def loginfailure @@ -39,12 +40,19 @@ class InternalController < ApplicationController redirect_to :controller=>'user', :action => 'login' end - def onlycanlogins - reset_session - flash[:error] = t(:only_can_logins,:scope=>:user) - @current_user = nil - redirect_to :controller=>'user', :action => 'login' - end + #def onlycanlogins + #reset_session + #flash[:error] = t(:only_can_logins,:scope=>:user) + #@current_user = nil + #redirect_to :controller=>'user', :action => 'login' + #end + + #def onlycanlogins + #reset_session + #flash[:error] = t(:allready_configured,:scope=>:user) + #@current_user = nil + #redirect_to :controller=>'user', :action => 'login' + #end def about render 'internal/about', :layout => 'application' diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 9ac0bed..9259d87 100755 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -16,9 +16,9 @@ class MessagesController < ApplicationController before_filter :prepare_compose_buttons, :only => [:compose] before_filter :get_system_folders, :only => [:index] before_filter :create_message_with_params, :only => [:compose] - before_filter :prepare_multi1_buttons, :only => [:index,:show] - before_filter :prepare_multi2_buttons, :only => [:index] - before_filter :prepare_multi3_buttons, :only => [:show] + #before_filter :prepare_multi1_buttons, :only => [:index,:show] + #before_filter :prepare_multi2_buttons, :only => [:index] + #before_filter :prepare_multi3_buttons, :only => [:show] after_filter :close_imap_session #theme :theme_resolver @@ -129,7 +129,9 @@ class MessagesController < ApplicationController end end else - part = Mail::Part.new(mail) + logger.custom('mail',mail.inspect) + part = mail + #part = Mail::Part.new(mail) part.idx = 0 part.parent_id = @message.uid if part.isText? @@ -175,7 +177,8 @@ class MessagesController < ApplicationController if mail.multipart? == true attachments = mail.attachments else - attachments << Mail::Part.new(mail) + #attachments << Mail::Part.new(mail) + attachments << mail end a = attachments[params[:idx].to_i] headers['Content-type'] = a.main_type + "/" + a.sub_type @@ -188,23 +191,23 @@ class MessagesController < ApplicationController protected - def prepare_multi2_buttons - @multi2_buttons = [] - @multi2_buttons << {:text => 'trash',:scope=>:message,:image => 'trash.png'} - @multi2_buttons << {:text => 'set_unread',:scope=>:message,:image => 'unseen.png'} - @multi2_buttons << {:text => 'set_read',:scope=>:message,:image => 'seen.png'} - end + #def prepare_multi2_buttons + #@multi2_buttons = [] + #@multi2_buttons << {:text => 'trash',:scope=>:message,:image => 'trash.png'} + #@multi2_buttons << {:text => 'set_unread',:scope=>:message,:image => 'unseen.png'} + #@multi2_buttons << {:text => 'set_read',:scope=>:message,:image => 'seen.png'} + #end - def prepare_multi1_buttons - @multi1_buttons = [] - @multi1_buttons << {:text => 'copy',:scope=>:message,:image => 'copy.png'} - @multi1_buttons << {:text => 'move',:scope=>:message,:image => 'move.png'} - end + #def prepare_multi1_buttons + #@multi1_buttons = [] + #@multi1_buttons << {:text => 'copy',:scope=>:message,:image => 'copy.png'} + #@multi1_buttons << {:text => 'move',:scope=>:message,:image => 'move.png'} + #end - def prepare_multi3_buttons - @multi3_buttons = [] - @multi3_buttons << {:text => 'show_header',:scope=>:show,:image => 'zoom.png'} - @multi3_buttons << {:text => 'trash',:scope=>:show,:image => 'trash.png'} - @multi3_buttons << {:text => 'reply',:scope=>:show,:image => 'reply.png'} - end + #def prepare_multi3_buttons + #@multi3_buttons = [] + #@multi3_buttons << {:text => 'show_header',:scope=>:show,:image => 'zoom.png'} + #@multi3_buttons << {:text => 'trash',:scope=>:show,:image => 'trash.png'} + #@multi3_buttons << {:text => 'reply',:scope=>:show,:image => 'reply.png'} + #end end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index d8de62c..5e88477 100755 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -4,6 +4,12 @@ class UserController < ApplicationController layout "simple" def login + # database empty redirect to setup screen + users = User.all + if users.count.zero? + redirect_to :controller => 'user', :action => 'setup' + return false + end end def logout @@ -14,29 +20,31 @@ class UserController < ApplicationController def authenticate - users = User.all - if users.count.zero? - redirect_to :controller => 'user', :action => 'setup' - return false - end - + # check if user can use application if not $defaults["only_can_logins"].nil? if not $defaults["only_can_logins"].include?(params[:user][:login]) - redirect_to :controller => 'internal', :action => 'onlycanlogins' + flash[:error] = t(:only_can_logins,:scope=>:user) + redirect_to :action => 'login' return false end end user = User.find_by_login(params[:user][:login]) if user.nil? - redirect_to :action => 'unknown' ,:login=> params[:user][:login] + + flash[:error] = t(:login_failure,:scope=>:user) + redirect_to :action => 'login' + return false + else - session[:user_id] = user.id + + session[:user_id] = user.id user.set_cached_password(session,params[:user][:password]) if session["return_to"] - redirect_to(session["return_to"]) + redirect = session["return_to"] session["return_to"] = nil + redirect_to(redirect) else redirect_to :controller=> 'messages', :action=> 'index' end @@ -44,17 +52,19 @@ class UserController < ApplicationController end end - def loginfailure - end + #def loginfailure + #end def setup + users = User.all + if !users.count.zero? + redirect_to :controller => 'internal', :action => 'allready_configured' + return false + end @user = User.new @server = Server.new end - def unknown - end - def create @user = User.new @@ -62,7 +72,7 @@ class UserController < ApplicationController @user.first_name = params[:user][:first_name] @user.last_name = params[:user][:last_name] - @server = Server.new + @server = Server.new @server.name = params[:server][:name] if @user.valid? and @server.valid? diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 87fe879..be5f2ec 100755 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,333 +2,333 @@ 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 << "
" +#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 + #end - html << "" + #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 << "
" + #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 ) +#def show_param_view(object,field,value) + #model_name = eval(object.class.model_name) + #html = "" + #html << "
" + #html << "" + #html << value + #html << "
" + #html #end -def single_navigation(label,scope) - s = "" - s += "" -end +#def area_field(object,field,flabel,example,val,cols,rows) + #model_name = eval(object.class.model_name) + #html = "" + #html << "
" -def main_navigation(active) - instance_variable_set("@#{active}", "active") - s = "" - s += "" -end + #if not object.errors[field.to_sym].empty? + #html << "
" + #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 + #html << "" -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 + #if not object.errors[field.to_sym].empty? + #html << "" + #html << object.errors[field.to_sym].to_s + #html << "" + #html << "
" + #end -def force_charset(text) - begin - Iconv.iconv("UTF-8",$defaults["msg_unknown_charset"],text) - rescue - text - end -end + #name = object.class.name.downcase + '[' + field + ']' + #id = object.class.name.downcase+"_"+field + #value = val || object.instance_eval(field) || "" + #html << "" -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 + #desc = t(:example,:scope=>:common) + ": " + example + #html << "#{desc}" -def boolean_answer(answer) - answer == true ? t(:true_answer,:scope=>:common) : t(:false_answer,:scope=>:common) -end + #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 += "" +#end + +#def main_navigation(active) + #instance_variable_set("@#{active}", "active") + #s = "" + #s += "" +#end + +#def prefs_navigation(active) + #instance_variable_set("@#{active}", "active") + #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 + +#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 diff --git a/app/helpers/contacts_helper.rb b/app/helpers/contacts_helper.rb new file mode 100755 index 0000000..7632685 --- /dev/null +++ b/app/helpers/contacts_helper.rb @@ -0,0 +1,17 @@ +module ContactsHelper + + def contacts_table_header + html = "" + $defaults["contacts_table_fields"].each do |f| + html << "" + if params[:sort_field] == f + params[:sort_dir].nil? ? dir = 'desc' : dir = nil + end + + html << link_to(Contact.human_attribute_name(f), {:controller => 'contacts',:action => 'index',:sort_field => f,:sort_dir => dir}, {:class=>"header"}) + html << "" + end + html + end + +end diff --git a/app/helpers/folder_helper.rb b/app/helpers/folder_helper.rb new file mode 100755 index 0000000..1102dd9 --- /dev/null +++ b/app/helpers/folder_helper.rb @@ -0,0 +1,66 @@ +module FolderHelper + + def folder_link(folder) + + folder.parent.empty? ? name = folder.name : name = folder.parent.gsub(/\./,'#') + "#" + folder.name + + if folder.isInbox? + name_shown = t(:inbox_name,:scope => :folder) + elsif folder.isSent? + name_shown = t(:sent_name,:scope => :folder) + elsif folder.isDrafts? + name_shown = t(:drafts_name,:scope => :folder) + elsif folder.isTrash? + name_shown = t(:trash_name,:scope => :folder) + else + name_shown = folder.name.capitalize + end + + if folder.isTrash? + if not folder.total.zero? + name_shown += " " + #name_shown += raw link_to(t(:emptybin,:scope=>:folder),folders_emptybin_path) + #name_shown += ')' + end + else + if !folder.unseen.zero? + name_shown += ' (' + folder.unseen.to_s + ')' + end + end + + link_to name_shown.html_safe, folders_select_path(:id => name) + end + + def pretty_folder_name(folder) + if folder.nil? + t(:no_selected,:scope=>:folder) + else + if folder.isInbox? + t(:inbox_name,:scope => :folder) + elsif folder.isSent? + t(:sent_name,:scope => :folder) + elsif folder.isDrafts? + t(:drafts_name,:scope => :folder) + elsif folder.isTrash? + t(:trash_name,:scope => :folder) + else + folder.name.capitalize + end + end + end + + def select_for_folders(name,id,collection,label,choice,blank) + html = "" + html << "
" + html << "" + html << simple_select_for_folders(name,id,collection,choice,blank) + html << "
" + end + + def simple_select_for_folders(name,id,collection,choice,blank) + html = "" + html << select(name , id, options_from_collection_for_select(collection, 'id', 'full_name', choice),{ :include_blank => (blank == true ? true : false)}) + html + end + +end diff --git a/app/helpers/internal_helper.rb b/app/helpers/internal_helper.rb new file mode 100755 index 0000000..250e09f --- /dev/null +++ b/app/helpers/internal_helper.rb @@ -0,0 +1,2 @@ +module InternalHelper +end diff --git a/app/helpers/links_helper.rb b/app/helpers/links_helper.rb new file mode 100755 index 0000000..5df409d --- /dev/null +++ b/app/helpers/links_helper.rb @@ -0,0 +1,17 @@ +module LinksHelper + + def links_table_header + html = "" + $defaults["links_table_fields"].each do |f| + html << "" + if params[:sort_field] == f + params[:sort_dir].nil? ? dir = 'desc' : dir = nil + end + + html << link_to(Link.human_attribute_name(f), {:controller => 'links',:action => 'index',:sort_field => f,:sort_dir => dir}, {:class=>"header"}) + html << "" + end + html + end + +end diff --git a/app/helpers/messages_helper.rb b/app/helpers/messages_helper.rb new file mode 100755 index 0000000..f370e21 --- /dev/null +++ b/app/helpers/messages_helper.rb @@ -0,0 +1,118 @@ +module MessagesHelper + + def size_formatter(size) + if size <= 2**10 + "#{size} #{t(:bytes,:scope=>:common)}" + elsif size <= 2**20 + sprintf("%.1f #{t(:kbytes,:scope=>:common)}",size.to_f/2**10) + else + sprintf("%.1f #{t(:mbytes,:scope=>:common)}",size.to_f/2**20) + end + end + + def date_formatter(date) + date.nil? ? t(:no_date,:scope=>:message) : date.strftime("%Y-%m-%d %H:%M") + end + + def address_formatter(addr,op) + s = "" + return s if addr.nil? + length = $defaults["msg_address_length"].to_i + + case op + when :index + fs = addr.gsub(/\"/,"").split(/= length ? s = s[0,length]+"..." : s + return h(s) + when :show + #addr = addr[0].charseted.gsub(/\"/,"") + return h(addr.gsub(/\"/,"")) + when :raw + #fs = addr.gsub(/\"/,"").split(/" + s = h(addr) + return s + when :reply + return h(addr) + end + end + + def body_formatter(body,op) + case op + when :reply + s = "\n\n\n" + body.gsub(/^\s+/,"").split(/\n/).each do |line| + s += ">" + line + "\n" + end + s + when :edit + return body + end + end + + def subject_formatter(message,op) + case op + when :index + if message.subject.nil? or message.subject.size.zero? + s = t(:no_subject,:scope=>:message) + else + length = $defaults["msg_subject_length"].to_i + message.subject.length >= length ? s = message.subject[0,length]+"..." : s = message.subject + end + link_to s,{:controller => 'messages', :action => 'show', :id => message.uid} , :title => message.subject + when :show + if message.subject.nil? or message.subject.size.zero? + t(:no_subject,:scope=>:message) + else + message.subject + end + when :reply + if message.nil? or message.size.zero? + t(:reply_string,:scope=>:show) + else + t(:reply_string,:scope=>:show) + " " + message + end + end + end + + def attachment_formatter(message) + message.content_type =~ /^text\/plain/ ? "" : "" + end + + def headers_links + #if @current_folder.hasFullName?(@folder_sent_name) || @current_folder.hasFullName?(@folder_drafts_name) + if @current_folder == @sent_folder || @current_folder == @drafts_folder + fields = $defaults["msgs_sent_view_fields"] + else + fields = $defaults["msgs_inbox_view_fields"] + end + + html = "" + fields.each do |f| + html << "" + if params[:sort_field] == f + params[:sort_dir].nil? ? dir = 'desc' : dir = nil + end + + html << link_to(Message.human_attribute_name(f), {:controller => 'messages',:action => 'index',:sort_field => f,:sort_dir => dir}, {:class=>"header"}) + html << "" + end + html + end + + #def content_text_plain_for_render(text) + #html = "
"
+        ##html << text.gsub!(/\r\n/,"\n")
+        #html << h(text)
+        #html << "
" + #html + #end + + def humanize_attr(object,attr) + model_name = eval(object.class.model_name) + return model_name.human_attribute_name(attr) + end + +end + diff --git a/app/helpers/messages_ops_helper.rb b/app/helpers/messages_ops_helper.rb new file mode 100755 index 0000000..982ec32 --- /dev/null +++ b/app/helpers/messages_ops_helper.rb @@ -0,0 +1,2 @@ +module MessagesOpsHelper +end diff --git a/app/helpers/prefs_helper.rb b/app/helpers/prefs_helper.rb new file mode 100755 index 0000000..1d01dcf --- /dev/null +++ b/app/helpers/prefs_helper.rb @@ -0,0 +1,16 @@ +module PrefsHelper + def servers_table_header + html = "" + $defaults["servers_table_fields"].each do |f| + html << "" + if params[:sort_field] == f + params[:sort_dir].nil? ? dir = 'desc' : dir = nil + end + + html << link_to(Server.human_attribute_name(f), {:controller => 'prefs',:action => 'servers',:sort_field => f,:sort_dir => dir}, {:class=>"header"}) + html << "" + end + html + end + +end diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb new file mode 100755 index 0000000..0147c3f --- /dev/null +++ b/app/helpers/user_helper.rb @@ -0,0 +1,2 @@ +module UserHelper +end diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep old mode 100644 new mode 100755 diff --git a/app/models/.gitkeep b/app/models/.gitkeep old mode 100644 new mode 100755 diff --git a/app/models/link.rb b/app/models/link.rb old mode 100644 new mode 100755 diff --git a/app/models/user.rb b/app/models/user.rb index 1d4dac6..3df974b 100755 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -4,7 +4,7 @@ class User < ActiveRecord::Base #acts_as_notes_owner - validates_presence_of :first_name,:last_name + validates_presence_of :first_name,:last_name,:login validates_uniqueness_of :login has_many :servers, :dependent => :destroy has_one :prefs, :dependent => :destroy diff --git a/app/views/common/_button.html.haml b/app/views/common/_button.html.haml new file mode 100755 index 0000000..272c88b --- /dev/null +++ b/app/views/common/_button.html.haml @@ -0,0 +1,19 @@ + +- size ||= "btn-small" +- type ||= "btn-primary" +- icon ||= "" +- onclick ||= 'empty' + +- def isOnclick(value) + - if value != 'empty' + - {:onclick => "#{value}"} + - else + - {} + +%button{isOnclick(onclick),:class=>"btn #{size} #{type}", + :type=>"submit", + :name=>"#{name}"} + - if !icon.empty? + %i{:class=>"#{icon}"} + = caption + diff --git a/app/views/common/_click_button.html.haml b/app/views/common/_click_button.html.haml new file mode 100755 index 0000000..cf933d1 --- /dev/null +++ b/app/views/common/_click_button.html.haml @@ -0,0 +1,6 @@ +- size ||= "btn-small" +- type ||= "btn-primary" + +%button{:class=>"btn #{size} #{type}",:type=>"submit",:onclick=>"window.location='#{url}'"} + %i{:class=>"#{icon}"} + = t(text.to_sym, :scope => scope.to_sym) diff --git a/app/views/common/_form_button_icon.html.haml b/app/views/common/_form_button_icon.html.haml new file mode 100755 index 0000000..f1e33a6 --- /dev/null +++ b/app/views/common/_form_button_icon.html.haml @@ -0,0 +1,6 @@ +- size ||= "btn-small" +- type ||= "btn-primary" + +%button{:class=>"btn #{size} #{type}",:type=>"submit", :name=>"#{name}"} + %i{:class=>"#{icon_class}"} + = text diff --git a/app/views/common/_input_form_desc_field.html.haml b/app/views/common/_input_form_desc_field.html.haml index 91cbd26..ae92664 100755 --- a/app/views/common/_input_form_desc_field.html.haml +++ b/app/views/common/_input_form_desc_field.html.haml @@ -1,8 +1,26 @@ - model = eval(object.class.model_name) +- model_string = object.class.model_name.downcase - label.nil? ? model_label = model.human_attribute_name(attr) : model_label = t(label.to_sym) -.control-group - %label{:class=>"control-label",:for=>"#{attr}"} - = model_label - .controls - %input{:id=>"#{model}_#{attr}",:name=>"#{model}[#{attr}]"} - +- val = value || object.instance_eval(attr) || "" +- if object.errors[attr.to_sym].empty? + .control-group + %label{:class=>"control-label",:for=>"#{attr}"} + = model_label + .controls + %input{:id=>"#{model_string}_#{attr}",:name=>"#{model_string}[#{attr}]",:value=>"#{val}"} + %p{:class=>"help-block"} + = t(:example,:scope=>:common) + = example +- else + .control-group.error + %label{:class=>"control-label",:for=>"#{attr}"} + = model_label + .controls + %input{:id=>"#{model_string}_#{attr}",:name=>"#{model_string}[#{attr}]",:value=>"#{val}"} + %span{:class=>"help-inline"} + = object.errors[attr.to_sym].to_s + %p{:class=>"help-block"} + = t(:example,:scope=>:common) + = example + +-#= render :partial => "common/input_form_desc_field",:locals => {:object => @user,:attr => 'login',:label => nil,:example => 'joe.doe',:value => params[:user] ? params[:user][:login] : "" } diff --git a/app/views/common/_input_form_field.html.haml b/app/views/common/_input_form_field.html.haml index 8c40206..813b9f2 100755 --- a/app/views/common/_input_form_field.html.haml +++ b/app/views/common/_input_form_field.html.haml @@ -2,4 +2,7 @@ %label{:class=>"control-label",:for=>"#{attr}"} = model.capitalize.constantize.human_attribute_name(attr) .controls - %input{:id=>"#{model}_#{attr}",:name=>"#{model}[#{attr}]"} + %input{:type=>"text",:id=>"#{model}_#{attr}",:name=>"#{model}[#{attr}]"} + + +-#= render :partial => "common/input_form_field",:locals => { :model => 'user',:attr => 'login'} diff --git a/app/views/common/_input_password_form_field.html.haml b/app/views/common/_input_password_form_field.html.haml new file mode 100755 index 0000000..4f4b6a1 --- /dev/null +++ b/app/views/common/_input_password_form_field.html.haml @@ -0,0 +1,5 @@ +.control-group + %label{:class=>"control-label",:for=>"#{attr}"} + = model.capitalize.constantize.human_attribute_name(attr) + .controls + %input{:type=>"password",:id=>"#{model}_#{attr}",:name=>"#{model}[#{attr}]"} diff --git a/app/views/common/_logo.html.haml b/app/views/common/_logo.html.haml new file mode 100755 index 0000000..e4a95a1 --- /dev/null +++ b/app/views/common/_logo.html.haml @@ -0,0 +1,2 @@ +.logo + = link_to image_tag("logo.png",:alt=> t(:mailr,:scope=>:common)), root_path diff --git a/app/views/common/_main_navigation.html.haml b/app/views/common/_main_navigation.html.haml new file mode 100755 index 0000000..ac338c7 --- /dev/null +++ b/app/views/common/_main_navigation.html.haml @@ -0,0 +1,22 @@ +- messages ||= "" +- compose ||= "" +- folders ||= "" +- contacts ||= "" +- prefs ||= "" +- links ||= "" + +%ul{:class=>"nav nav-pills"} + %li{:class=>"#{messages}"} + %a{:href=>messages_path} + = t(:messages,:scope=>:message) + %li{:class=>"#{compose}"} + = link_to( t(:compose,:scope=>:compose), compose_path ) + %li{:class=>"#{folders}"} + = link_to( t(:folders,:scope=>:folder), folders_path ) + %li{:class=>"#{contacts}"} + = link_to( t(:contacts,:scope=>:contact), contacts_path ) + %li{:class=>"#{prefs}"} + = link_to( t(:prefs,:scope=>:prefs), prefs_look_path ) + %li{:class=>"#{links}"} + = link_to( t(:links,:scope=>:link), links_path ) + diff --git a/app/views/common/_multiselect.html.haml b/app/views/common/_multiselect.html.haml new file mode 100755 index 0000000..72cefd8 --- /dev/null +++ b/app/views/common/_multiselect.html.haml @@ -0,0 +1,22 @@ +%select{:multiple=>"multiple",:class=>"#{style}",:id=>"#{id}",:name=>"#{name}"} + - objects.each do |o| + - option_value = escape_once(o.send(value)) + - option_text = [option_value] + + - unless text.nil? + - option_text = [] + - text.each do |t| + - option_text << o.send(t) + - option_text = option_text.join(joiner) + - option_text.gsub!(/^\./,'') + + + - if selected_objects.include?(o) + %option{:value=>"#{option_value}",:selected=>"selected"} + = option_text + - else + %option{:value=>"#{option_value}"} + = option_text + +-#<%= raw multi_select("", 'folders_to_show[]', @folders, @folders_shown,t(:shown,:scope=>:folder),:id,"",{:text => [:parent,:delim,:name]}) %> +-#def multi_select(id, name, objects, selected_objects, label, value,joiner,content = {}) diff --git a/app/views/common/_select_for_folders.html.haml b/app/views/common/_select_for_folders.html.haml new file mode 100755 index 0000000..7164939 --- /dev/null +++ b/app/views/common/_select_for_folders.html.haml @@ -0,0 +1,5 @@ +.control-group + %label{:class=>"control-label"} + = label + .controls + = raw simple_select_for_folders(name,id,collection,choice,blank) diff --git a/app/views/common/_version.html.haml b/app/views/common/_version.html.haml new file mode 100755 index 0000000..f571186 --- /dev/null +++ b/app/views/common/_version.html.haml @@ -0,0 +1,2 @@ +%p{:class=>"version"} + = link_to (t(:version,:scope=>:common) + " " + $defaults["version"]),about_path diff --git a/app/views/contacts/index.html.haml b/app/views/contacts/index.html.haml new file mode 100755 index 0000000..ead45f5 --- /dev/null +++ b/app/views/contacts/index.html.haml @@ -0,0 +1,8 @@ += content_for :sidebar do + = render :partial => "sidebar/sidebar" + += content_for :title do + \- + = t(:contacts,:scope=>:contact) + += render :partial => 'common/main_navigation', :locals => { :contacts => :active } diff --git a/app/views/folders/_create.html.haml b/app/views/folders/_create.html.haml new file mode 100755 index 0000000..9c6cd55 --- /dev/null +++ b/app/views/folders/_create.html.haml @@ -0,0 +1,8 @@ +%form{:class=>"form-horizontal",:action=>folders_create_path,:method=>"post"} + %fieldset + = render :partial => "common/select_for_folders",:locals => { :label=> t(:parent,:scope=>:folder), :name => "folder", :id => "parent", :collection => @folders, :choice => "", :blank => true} + = render :partial => "common/input_form_field",:locals => { :model => 'folder',:attr => 'target'} + .control-group + .form-actions + = render :partial => "common/button",:locals => { :name=>:create, :caption => t(:create,:scope=>:common), :icon =>'icon-plus icon-white'} + diff --git a/app/views/folders/_delete.html.haml b/app/views/folders/_delete.html.haml new file mode 100755 index 0000000..c0a20ec --- /dev/null +++ b/app/views/folders/_delete.html.haml @@ -0,0 +1,6 @@ +%form{:class=>"form-horizontal",:action=>folders_delete_path,:method=>"post"} + %fieldset + = render :partial => "common/select_for_folders",:locals => { :label=> t(:to_delete,:scope=>:folder), :name => "folder", :id => "delete", :collection => @folders, :choice => "", :blank => true} + .control-group + .form-actions + = render :partial => "common/button",:locals => { :name=>:delete, :caption => t(:delete,:scope=>:common), :icon =>'icon-minus icon-white'} diff --git a/app/views/folders/_list.html.haml b/app/views/folders/_list.html.haml new file mode 100755 index 0000000..16b75d4 --- /dev/null +++ b/app/views/folders/_list.html.haml @@ -0,0 +1,16 @@ +.well{:style=>"padding: 8px 3pt;"} + - if @folders_shown.nil? or @folders_shown.size.zero? + %p + = t(:no_shown,:scope=>:folder) + = link_to t(:folders,:scope=>:folder), folders_path + - else + %ul{:class=>"nav nav-list"} + %li{:class=>"nav-header"} + =t(:folders,:scope=>:folder) + - @folders_shown.each do |folder| + - if folder == @current_folder + %li{:class=>"active"} + = folder_link(folder) + - else + %li + = folder_link(folder) diff --git a/app/views/folders/_refresh.html.haml b/app/views/folders/_refresh.html.haml new file mode 100755 index 0000000..d976b10 --- /dev/null +++ b/app/views/folders/_refresh.html.haml @@ -0,0 +1,11 @@ +%form{:class=>"form-horizontal",:action=>folders_refresh_path,:method=>"post"} + %fieldset + .control-group + %label{:class=>"control-label"} + = t(:presentation,:scope=>:folder) + .controls + = render :partial=>"common/multiselect",:locals => {:objects => @folders, :selected_objects => @folders_shown,:style=>"",:id=>"multiselect_form",:name=>"folders_to_show[]",:value=>:id,:joiner=>"",:text=>[:parent,:delim,:name]} + .control-group + .form-actions + = render :partial => "common/button",:locals => { :name=>:show_hide, :caption => t(:show_hide,:scope=>:folder), :icon =>'icon-eye-open icon-white'} + = render :partial => "common/button",:locals => { :name=>:refresh, :caption => t(:refresh,:scope=>:folder), :icon =>'icon-refresh icon-white'} diff --git a/app/views/folders/_system.html.haml b/app/views/folders/_system.html.haml new file mode 100755 index 0000000..b2643e1 --- /dev/null +++ b/app/views/folders/_system.html.haml @@ -0,0 +1,9 @@ +%form{:class=>"form-horizontal",:action=>folders_system_path,:method=>"post"} + %fieldset + = render :partial => "common/select_for_folders",:locals => { :label=> t(:folder,:scope => :folder) + " " + t(:inbox_name,:scope=>:folder), :name => "folder", :id => "mailbox_inbox", :collection => @folders, :choice => @folder_inbox, :blank => true} + = render :partial => "common/select_for_folders",:locals => { :label=> t(:folder,:scope => :folder) + " " + t(:trash_name,:scope=>:folder), :name => "folder", :id => "mailbox_trash", :collection => @folders, :choice => @folder_trash, :blank => true} + = render :partial => "common/select_for_folders",:locals => { :label=> t(:folder,:scope => :folder) + " " + t(:sent_name,:scope=>:folder), :name => "folder", :id => "mailbox_sent", :collection => @folders, :choice => @folder_sent, :blank => true} + = render :partial => "common/select_for_folders",:locals => { :label=> t(:folder,:scope => :folder) + " " + t(:drafts_name,:scope=>:folder), :name => "folder", :id => "mailbox_drafts", :collection => @folders, :choice => @folder_drafts, :blank => true} + .control-group + .form-actions + = render :partial => "common/button",:locals => { :name=>:set, :caption => t(:set,:scope=>:common), :icon =>'icon-cog icon-white'} diff --git a/app/views/folders/index.html.haml b/app/views/folders/index.html.haml new file mode 100755 index 0000000..cac4a66 --- /dev/null +++ b/app/views/folders/index.html.haml @@ -0,0 +1,16 @@ += content_for :sidebar do + = render :partial => "sidebar/sidebar" + += content_for :title do + \- + = t(:folders,:scope=>:folder) + += render :partial => 'common/main_navigation', :locals => { :folders => :active } + +.row + .span9 + = render :partial => "refresh" + = render :partial => "create" + = render :partial => "delete" + = render :partial => "system" + diff --git a/app/views/internal/_version.html.erb b/app/views/internal/_version.html.erb new file mode 100755 index 0000000..881c09d --- /dev/null +++ b/app/views/internal/_version.html.erb @@ -0,0 +1,4 @@ +

+<%= link_to (t(:version,:scope=>:common) + " " + $defaults["version"]),about_path %> +

+ diff --git a/app/views/internal/about.html.erb b/app/views/internal/about.html.erb new file mode 100755 index 0000000..4698b30 --- /dev/null +++ b/app/views/internal/about.html.erb @@ -0,0 +1,33 @@ +<% content_for :title do %> +- <%= t(:about,:scope=>:internal) %> +<% end %> + +<% content_for :sidebar do %> +<%= content_for_sidebar %> +<% end %> + +
+ +
+ +

+<%= t(:current_version,:scope=>:internal) + ": " + $defaults["version"] %> +

+ +
+<%= raw BlueCloth::new(render :file => 'README.markdown').to_html %> +
+ +
+<%= raw BlueCloth::new(render :file => 'CHANGES').to_html %> +
+ +
+<%= raw BlueCloth::new(render :file => 'TODO').to_html %> +
+ + +
+ diff --git a/app/views/internal/error.html.haml b/app/views/internal/error.html.haml new file mode 100755 index 0000000..e69de29 diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml new file mode 100755 index 0000000..628e512 --- /dev/null +++ b/app/views/layouts/application.html.haml @@ -0,0 +1,30 @@ +!!! +%html + %head + %title + =t(:mailr,:scope=>:common) + = yield :title + = stylesheet_link_tag "application", :media => "all" + = javascript_include_tag "application" + = csrf_meta_tags + %body{:class=>"application"} + .container + .row + .span3#sidebar + = yield :sidebar + .span9#main + - if flash[:error] + .alert.alert-error + = flash[:error] + - elsif flash[:info] + .alert.alert-info + = flash[:info] + - elsif flash[:success] + .alert.alert-success + = flash[:success] + = yield + %hr/ + .row + #footer-simple + %a{:href=>"https://github.com/musashimm/mailr"} MailR + \- open source web mail client diff --git a/app/views/links/index.html.haml b/app/views/links/index.html.haml new file mode 100755 index 0000000..33af4a1 --- /dev/null +++ b/app/views/links/index.html.haml @@ -0,0 +1,8 @@ += content_for :sidebar do + = render :partial => "sidebar/sidebar" + += content_for :title do + \- + = t(:links,:scope=>:link) + += render :partial => 'common/main_navigation', :locals => { :links => :active } diff --git a/app/views/messages/_attachment.html.erb b/app/views/messages/_attachment.html.erb new file mode 100755 index 0000000..0ff539b --- /dev/null +++ b/app/views/messages/_attachment.html.erb @@ -0,0 +1,19 @@ + +<%= link_to attachment.filename_charseted, attachment_download_path(attachment.parent_id,attachment.idx) %> + + +<%= attachment.main_type %>/<%= attachment.sub_type %> + + +<%= attachment.charset %> + + +<%= attachment.content_transfer_encoding %> + + +<%= size_formatter(attachment.getSize) %> + + +<%= link_to image_tag(current_theme_image_path('download.png')), attachment_download_path(attachment.parent_id,attachment.idx) %> + + diff --git a/app/views/messages/_attachment.html.haml b/app/views/messages/_attachment.html.haml new file mode 100755 index 0000000..61e0a63 --- /dev/null +++ b/app/views/messages/_attachment.html.haml @@ -0,0 +1,14 @@ +%td + = attachment.filename_charseted +%td + = attachment.main_type + \/ + = attachment.sub_type +%td + = attachment.charset +%td + = attachment.content_transfer_encoding +%td + = size_formatter(attachment.getSize) +%td + = link_to "".html_safe, attachment_download_path(attachment.parent_id,attachment.idx) diff --git a/app/views/messages/_attachments.html.erb b/app/views/messages/_attachments.html.erb new file mode 100755 index 0000000..5d051a7 --- /dev/null +++ b/app/views/messages/_attachments.html.erb @@ -0,0 +1,13 @@ +
+<%= t(:attachments,:scope=>:message) %> + + +<% trclass = :even %> +<% for idx in 0..@attachments.size-1 %> + + <%= render :partial => 'attachment', :object => @attachments[idx] %> + +<% trclass == :even ? trclass = :odd : trclass = :even %> +<% end %> +
+
diff --git a/app/views/messages/_attachments.html.haml b/app/views/messages/_attachments.html.haml new file mode 100755 index 0000000..ee41c72 --- /dev/null +++ b/app/views/messages/_attachments.html.haml @@ -0,0 +1,9 @@ +%h1 + %small + = t(:attachments,:scope=>:message) +%table{:class=>"table table-bordered"} + %tbody + - for idx in 0..@attachments.size-1 + %tr + = render :partial => 'attachment', :locals => { :attachment => @attachments[idx] } + diff --git a/app/views/messages/_file_attach.html.erb b/app/views/messages/_file_attach.html.erb new file mode 100755 index 0000000..a809654 --- /dev/null +++ b/app/views/messages/_file_attach.html.erb @@ -0,0 +1,4 @@ +<%= check_box_tag "files[]", file_attach[:name] %> +<%= file_attach[:name] %> +<%= size_formatter(file_attach[:size]) %> +  diff --git a/app/views/messages/_file_attachs.html.erb b/app/views/messages/_file_attachs.html.erb new file mode 100755 index 0000000..683b1f8 --- /dev/null +++ b/app/views/messages/_file_attachs.html.erb @@ -0,0 +1,16 @@ +
+<%= t(:attachments,:scope=>:message) %> +<% if not @attachments.size.zero? %> +<% trclass = :even %> + +<% @attachments.each do |a| %> + +<%= render :partial => 'messages/file_attach', :object => a %> + +<% trclass == :even ? trclass = :odd : trclass = :even %> +<% end %> +
+<%= raw single_action('delete_marked','compose','minus.png') %> +<% end %> +
+ diff --git a/app/views/messages/_file_select.html.erb b/app/views/messages/_file_select.html.erb new file mode 100755 index 0000000..3279115 --- /dev/null +++ b/app/views/messages/_file_select.html.erb @@ -0,0 +1,9 @@ +
+:  +<%= file_field 'file', 'data' %> +<%= raw single_action('upload','compose','up.png') %> +
+ + + + diff --git a/app/views/messages/_header.html.erb b/app/views/messages/_header.html.erb new file mode 100755 index 0000000..1017ea1 --- /dev/null +++ b/app/views/messages/_header.html.erb @@ -0,0 +1,14 @@ +
+ <%= raw show_param_view(@message,"from_addr",address_formatter(@from,:show)) %> + <%= raw show_param_view(@message,"to_addr",address_formatter(@to,:show)) %> + <% if not @cc.nil? %> + <%= raw show_param_view(@message,"cc_addr","CC jest") %> + <% end %> + <% if not @bcc.nil? %> + <%= raw show_param_view(@message,"bcc_addr","BCC jest ") %> + <% end %> + <%= raw show_param_view(@message,"subject",subject_formatter(@message,:show)) %> + <%= raw show_param_view(@message,"date",date_formatter(@date)) %> + <%= hidden_field_tag 'uids[]', @message.uid %> + <%= hidden_field_tag 'source', 'show' %> +
diff --git a/app/views/messages/_header.html.haml b/app/views/messages/_header.html.haml new file mode 100755 index 0000000..993919f --- /dev/null +++ b/app/views/messages/_header.html.haml @@ -0,0 +1,39 @@ +%table{:class=>"header bottom-pix18"} + %tbody + %tr + %td{:class=>"field_name"} + = humanize_attr(@message,'from_addr') + ':' + %td + = address_formatter(@from,:show) + %tr + %td{:class=>"field_name"} + = humanize_attr(@message,'to_addr') + ':' + %td + = address_formatter(@to,:show) + - if not @cc.nil? + %tr + %td{:class=>"field_name"} + = humanize_attr(@message,'cc_addr') + ':' + %td + "CC jest" + - if not @bcc.nil? + %tr + %td{:class=>"field_name"} + = humanize_attr(@message,'bcc_addr') + ':' + %td + "BCC jest" + %tr + %td{:class=>"field_name"} + = humanize_attr(@message,'subject') + ':' + %td + = subject_formatter(@message,:show) + %tr + %td{:class=>"field_name"} + = humanize_attr(@message,'date') + ':' + %td + = date_formatter(@date) + += hidden_field_tag 'uids[]', @message.uid += hidden_field_tag 'source', 'show' +%pre{:class=>"header_raw",:style=>"display: none;"} + = @plain_header diff --git a/app/views/messages/_html_part.html.erb b/app/views/messages/_html_part.html.erb new file mode 100755 index 0000000..7beb3d0 --- /dev/null +++ b/app/views/messages/_html_part.html.erb @@ -0,0 +1,3 @@ + + diff --git a/app/views/messages/_image.html.erb b/app/views/messages/_image.html.erb new file mode 100755 index 0000000..f9cc663 --- /dev/null +++ b/app/views/messages/_image.html.erb @@ -0,0 +1,8 @@ +
+<%= image_tag(attachment_download_path(image.parent_id,image.idx), :size => @current_user.prefs.msg_image_thumbnail_size, :alt=>image.filename, :title=>image.filename) %> +
+<%= link_to (image.filename,attachment_download_path(image.parent_id,image.idx)) %> +<%= size_formatter(image.getSize) %> +
+
+ diff --git a/app/views/messages/_images.html.erb b/app/views/messages/_images.html.erb new file mode 100755 index 0000000..afeea6d --- /dev/null +++ b/app/views/messages/_images.html.erb @@ -0,0 +1,8 @@ +
+ +<% for idx in 0..@images.size-1 %> +<%= render :partial => 'image', :object => @images[idx] %> +<% end %> + +
+
diff --git a/app/views/messages/_message.html.haml b/app/views/messages/_message.html.haml new file mode 100755 index 0000000..bd5cdbd --- /dev/null +++ b/app/views/messages/_message.html.haml @@ -0,0 +1,38 @@ +%td + = check_box_tag "uids[]", message.uid +%td + = raw attachment_formatter(message) +%td + - if @current_folder == @sent_folder || @current_folder == @drafts_folder + = address_formatter(message.to_addr,:index) + - else + = address_formatter(message.from_addr,:index) +%td + = subject_formatter(message,:index) +%td + = date_formatter(message.date) +%td + = size_formatter(message.size) +%td + - if @current_folder == @drafts_folder + = link_to(t(:edit,:scope=>:message),edit_path(message.uid)) + - else +   + + +-# + <%= check_box_tag "uids[]", message.uid %> + <%= attachment_formatter(message) %> + <% if @current_folder == @sent_folder || @current_folder == @drafts_folder %> + <%= address_formatter(message.to_addr,:index) %> + <% else %> + <%= address_formatter(message.from_addr,:index) %> + <% end %> + <%= subject_formatter(message,:index) %> + <%= date_formatter(message.date) %> + <%= size_formatter(message.size) %> + <% if @current_folder == @drafts_folder %> + <%= link_to(t(:edit,:scope=>:message),edit_path(message.uid)) %> + <% else %> + <%= raw(' ') %> + <% end %> diff --git a/app/views/messages/_messages.html.haml b/app/views/messages/_messages.html.haml new file mode 100755 index 0000000..3ac2ed8 --- /dev/null +++ b/app/views/messages/_messages.html.haml @@ -0,0 +1,32 @@ +.well{:style=>"padding: 5px 3pt;"} + %h3 + = t(:current,:scope=>:folder) + \: + = pretty_folder_name(@current_folder) + %h5 + = t(:total,:scope=>:message) + \: + = @messages.total_entries + += will_paginate @messages + +%table{:class=>"table table-bordered"} + %thead + %tr + %th + %input{:id=>"toggleall",:type=>"checkbox",:name=>"allbox"} + %th + %i{:class=>"icon-file"} + = raw headers_links + %th +   + %tbody + - @messages.each do |m| + - m.unseen == true ? unseen = "unseen" : unseen = "" + %tr{:class=>"#{unseen}"} + = render :partial => 'messages/message', :locals => {:message => m} + + += will_paginate @messages + + diff --git a/app/views/messages/_multi_ops.html.haml b/app/views/messages/_multi_ops.html.haml new file mode 100755 index 0000000..5980d61 --- /dev/null +++ b/app/views/messages/_multi_ops.html.haml @@ -0,0 +1,20 @@ +%p + = render :partial => "common/button", :locals => {:name=>'copy', + :caption=>t('copy',:scope=>'message'), + :icon=>'icon-tags icon-white'} + = render :partial => "common/button", :locals => {:name=>'move', + :caption=>t('move',:scope=>'message'), + :icon=>'icon-chevron-right icon-white'} + + = t(:to_folder,:scope=>:folder) + " " + = raw simple_select_for_folders("folder","target",@folders_shown,'',true) +%p + = render :partial => "common/button", :locals => {:name=>'trash', + :caption=>t('trash',:scope=>'message'), + :icon=>'icon-trash icon-white'} + = render :partial => "common/button", :locals => {:name=>'set_unread', + :caption=>t('set_unread',:scope=>'message'), + :icon=>'icon-eye-close icon-white'} + = render :partial => "common/button", :locals => {:name=>'set_read', + :caption=>t('set_read',:scope=>'message'), + :icon=>'icon-eye-open icon-white'} diff --git a/app/views/messages/_new.html.erb b/app/views/messages/_new.html.erb new file mode 100755 index 0000000..8ec1896 --- /dev/null +++ b/app/views/messages/_new.html.erb @@ -0,0 +1,27 @@ +
+<%= raw form_field( @message, + "to_addr", + nil, + "joe@domain.com"+', '+ t(:not_contain_at,:scope=>:compose), + address_formatter(@message.to_addr,@operation) + ) %> +<%= raw form_field( @message, + "subject", + nil, + t(:subject_of_the_message,:scope=>:compose), + subject_formatter(@message.subject,@operation) + ) %> +<%= raw area_field( @message, + "body", + nil, + t(:write_your_message_here,:scope=>:compose), + body_formatter(@message.body,@operation), + 80, + 20 + ) %> +
+<% if !@olduid.nil? %> +<%= hidden_field_tag 'olduid', @olduid %> +<% end %> +<%= raw group_action(@buttons) %> + diff --git a/app/views/messages/_search.html.erb b/app/views/messages/_search.html.erb new file mode 100755 index 0000000..cee5c10 --- /dev/null +++ b/app/views/messages/_search.html.erb @@ -0,0 +1,10 @@ + diff --git a/app/views/messages/_single_ops.html.erb b/app/views/messages/_single_ops.html.erb new file mode 100755 index 0000000..d38a73a --- /dev/null +++ b/app/views/messages/_single_ops.html.erb @@ -0,0 +1,10 @@ +
+<%= raw group_action_text(@multi1_buttons,t(:to_folder,:scope=>:folder)+ " " + simple_select_for_folders("folder","target",@folders_shown,'',true)) %> +<%= raw group_action(@multi3_buttons) %> + +
+
+        <%= @plain_header %>
+    
+
+
diff --git a/app/views/messages/_single_ops.html.haml b/app/views/messages/_single_ops.html.haml new file mode 100755 index 0000000..6388357 --- /dev/null +++ b/app/views/messages/_single_ops.html.haml @@ -0,0 +1,25 @@ +%p + = render :partial => "common/button", :locals => {:name=>'copy', + :caption=>t('copy',:scope=>'message'), + :icon=>'icon-tags icon-white'} + = render :partial => "common/button", :locals => {:name=>'move', + :caption=>t('move',:scope=>'message'), + :icon=>'icon-chevron-right icon-white'} + + = t(:to_folder,:scope=>:folder) + " " + = raw simple_select_for_folders("folder","target",@folders_shown,'',true) + +%p + = render :partial => "common/button", :locals => {:name=>'show_header', + :caption=>t('show_header',:scope=>'show'), + :icon=>'icon-zoom-in icon-white'} + = render :partial => "common/button", :locals => {:name=>'trash', + :caption=>t('trash',:scope=>'show'), + :icon=>'icon-trash icon-white'} + = render :partial => "common/button", :locals => {:name=>'reply', + :caption=>t('reply',:scope=>'show'), + :icon=>'icon-arrow-left icon-white'} + = render :partial => "common/button", :locals => {:name=>'forward', + :caption=>t('forward',:scope=>'show'), + :icon=>'icon-arrow-right icon-white'} + diff --git a/app/views/messages/compose.html.erb b/app/views/messages/compose.html.erb new file mode 100755 index 0000000..510cbbe --- /dev/null +++ b/app/views/messages/compose.html.erb @@ -0,0 +1,23 @@ +<% content_for :sidebar do %> +<%= content_for_sidebar %> +<% end %> + +<% content_for :title do %> +- <%= t(:compose,:scope=>:compose) %> +<% end %> + +
+ +
+

<%= t(:new_message,:scope=>:compose) %>

+
+ <%= form_tag(composed_path, :multipart => true) %> + <%= render :partial => 'messages/new' %> + <%= render :partial=> 'messages/file_attachs' %> + <%= render :partial => 'messages/file_select' %> + +
+
+ diff --git a/app/views/messages/compose.html.haml b/app/views/messages/compose.html.haml new file mode 100755 index 0000000..4a69de1 --- /dev/null +++ b/app/views/messages/compose.html.haml @@ -0,0 +1,44 @@ += content_for :sidebar do + = render :partial => "sidebar/sidebar" + += content_for :title do + = t(:compose,:scope=>:compose) + += render :partial => 'common/main_navigation', :locals => { :compose => :active } + +%form{:multipart => 'true',:class=>"form-horizontal",:action=>composed_path,:method=>"post"} + .well{:style=>"padding: 5px 3pt;"} + %h3 + = t(:new_message,:scope=>:compose) + %fieldset + = render :partial => "common/input_form_desc_field",:locals => {:object => @user,:attr => 'login',:label => nil,:example => 'joe.doe',:value => params[:user] ? params[:user][:login] : "" } + + + +-# +
+ <%= raw form_field( @message, + "to_addr", + nil, + "joe@domain.com"+', '+ t(:not_contain_at,:scope=>:compose), + address_formatter(@message.to_addr,@operation) + ) %> + <%= raw form_field( @message, + "subject", + nil, + t(:subject_of_the_message,:scope=>:compose), + subject_formatter(@message.subject,@operation) + ) %> + <%= raw area_field( @message, + "body", + nil, + t(:write_your_message_here,:scope=>:compose), + body_formatter(@message.body,@operation), + 80, + 20 + ) %> +
+ <% if !@olduid.nil? %> + <%= hidden_field_tag 'olduid', @olduid %> + <% end %> + <%= raw group_action(@buttons) %> diff --git a/app/views/messages/html_body.html.erb b/app/views/messages/html_body.html.erb new file mode 100755 index 0000000..b1f0d7c --- /dev/null +++ b/app/views/messages/html_body.html.erb @@ -0,0 +1,2 @@ +<%= raw @body -%> + diff --git a/app/views/messages/index.html.haml b/app/views/messages/index.html.haml new file mode 100755 index 0000000..d7e7d84 --- /dev/null +++ b/app/views/messages/index.html.haml @@ -0,0 +1,20 @@ += content_for :sidebar do + = render :partial => "sidebar/sidebar" + += content_for :title do + \- + = t(:messages,:scope=>:message) + += render :partial => 'common/main_navigation', :locals => { :messages => :active } + +%form{:class=>"form-horizontal top-pix18",:action=>"#{messages_ops_multi_path}",:method=>"post"} + - if @current_folder.nil? + .alert + = t(:no_selected,:scope=>:folder) + + - if @messages.size.zero? + .alert + = t(:no_in,:scope=>:message) + - else + = render :partial => 'multi_ops' + = render :partial => 'messages' diff --git a/app/views/messages/index2.html.erb b/app/views/messages/index2.html.erb new file mode 100755 index 0000000..d93e092 --- /dev/null +++ b/app/views/messages/index2.html.erb @@ -0,0 +1,33 @@ +<% content_for :sidebar do %> +<%= content_for_sidebar %> +<% end %> + +<% content_for :title do %> +- <%= t(:messages,:scope=>:message) %> +<% end %> + +
+ +
+ <%= form_tag({:controller=>'messages_ops', :action=>'multi'},{:name=>'messages'})%> + + <% if @current_folder.nil? %> +

<%= t(:no_selected,:scope=>:folder) %>

+ <% end %> + + <% if @messages.size.zero? %> +
+
<%= t(:no_in,:scope=>:message) %>
+
+ <% else %> + <%= render :partial => 'multi_ops' %> + <%= render :partial => 'messages' %> + <% end %> + + +
+
+ + diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb new file mode 100755 index 0000000..1718862 --- /dev/null +++ b/app/views/messages/show.html.erb @@ -0,0 +1,43 @@ +<% content_for :sidebar do %> +<%= content_for_sidebar %> +<% end %> + +<% content_for :title do %> +- <%= subject_formatter(@message,:show) %> +<% end %> + +
+ +
+ <%= form_tag(messages_ops_single_path)%> + <%= render :partial => 'header' %> + <%= render :partial => 'single_ops' %> + + <% if not @attachments.size.zero? %> + <%= render :partial => 'attachments' %> + <% end %> + + <% if not @images.size.zero? %> + <%= render :partial => 'images' %> + <% end %> + + <% if not @html_part.nil? %> + <%= render :partial => 'html_part' %> + <% else %> +
+ <% if @text_part.nil? %> +

+ <%= t(:no_content,:scope => :message) %> +

+ <% else %> + <%= raw content_text_plain_for_render(@text_part) %> + <% end %> +
+ <% end %> + +
+
+ + diff --git a/app/views/messages/show.html.haml b/app/views/messages/show.html.haml new file mode 100755 index 0000000..f37fb8b --- /dev/null +++ b/app/views/messages/show.html.haml @@ -0,0 +1,29 @@ += content_for :sidebar do + = render :partial => "sidebar/sidebar" + += content_for :title do + \- + = subject_formatter(@message,:show) + += render :partial => 'common/main_navigation', :locals => { :show => :active } + +%form{:class=>"form-horizontal top-pix18",:action=>"#{messages_ops_multi_path}",:method=>"post"} + = render :partial => 'header' + = render :partial => 'single_ops' + - if not @attachments.size.zero? + = render :partial => 'attachments' + - if not @images.size.zero? + render :partial => 'images' + - if not @html_part.nil? + = render :partial => 'html_part' + - else + - if @text_part.nil? + .alert + = t(:no_content,:scope => :message) + - else + %pre + = @text_part + + + + diff --git a/app/views/prefs/look.html.haml b/app/views/prefs/look.html.haml new file mode 100755 index 0000000..6c3ae77 --- /dev/null +++ b/app/views/prefs/look.html.haml @@ -0,0 +1,8 @@ += content_for :sidebar do + = render :partial => "sidebar/sidebar" + += content_for :title do + \- + = t(:look,:scope=>:prefs) + += render :partial => 'common/main_navigation', :locals => { :prefs => :active } diff --git a/app/views/sidebar/_calendar_view.html.haml b/app/views/sidebar/_calendar_view.html.haml new file mode 100755 index 0000000..e69de29 diff --git a/app/views/sidebar/_sidebar.html.haml b/app/views/sidebar/_sidebar.html.haml new file mode 100755 index 0000000..a02943f --- /dev/null +++ b/app/views/sidebar/_sidebar.html.haml @@ -0,0 +1,11 @@ += render :partial => "common/logo" += render :partial => "common/version" += render :partial => "folders/list" +%p + = render :partial => "common/button", :locals => {:name=>'logout', + :type=>"btn-danger", + :caption=>t('logout',:scope=>'user'), + :icon=>'icon-off icon-white', + :onclick=>"window.location='#{user_logout_path}'"} += render :partial => "sidebar/calendar_view" + diff --git a/app/views/user/login.html.haml b/app/views/user/login.html.haml old mode 100644 new mode 100755 index cd4ae34..4a39651 --- a/app/views/user/login.html.haml +++ b/app/views/user/login.html.haml @@ -5,8 +5,10 @@ %form{:class=>"form-horizontal top-pix18",:action=>"#{url_for(:controller => 'user', :action => 'authenticate')}",:method=>"post"} %fieldset = render :partial => "common/input_form_field",:locals => { :model => 'user',:attr => 'login'} - = render :partial => "common/input_form_field",:locals => { :model => 'user',:attr => 'password'} - = render :partial => "common/form_button",:locals => { :text => t(:please_login,:scope=>:user)} + = render :partial => "common/input_password_form_field",:locals => { :model => 'user',:attr => 'password'} + .control-group + .controls + = render :partial => "common/button",:locals => { :name=>'login', :caption => t(:please_login,:scope=>:user), :icon =>'icon-lock icon-white'} diff --git a/app/views/user/setup.html.haml b/app/views/user/setup.html.haml index d354d65..50bf954 100755 --- a/app/views/user/setup.html.haml +++ b/app/views/user/setup.html.haml @@ -2,8 +2,14 @@ \- = t(:setup,:scope=>:user) +%div{:class=>"alert alert-info"} + = t(:no_config,:scope=>:user) %form{:class=>"form-horizontal top-pix18",:action=>"#{url_for(:controller => 'user', :action => 'create')}",:method=>"post"} %legend = t(:setup,:scope=>:user) %fieldset - = render :partial => "common/input_form_desc_field",:locals => {:object => @user,:attr => 'login',:label => nil,:example => 'joe doe',:value => params[:user].nil? ? params[:login] : params[:user][:login]} + = render :partial => "common/input_form_desc_field",:locals => {:object => @user,:attr => 'login',:label => nil,:example => 'joe.doe',:value => params[:user] ? params[:user][:login] : "" } + = render :partial => "common/input_form_desc_field",:locals => {:object => @user,:attr => 'first_name',:label => nil,:example => 'Joe',:value => params[:user] ? params[:user][:first_name] : ""} + = render :partial => "common/input_form_desc_field",:locals => {:object => @user,:attr => 'last_name',:label => nil,:example => 'Doe',:value => params[:user] ? params[:user][:last_name] : ""} + = render :partial => "common/input_form_desc_field",:locals => {:object => @server,:attr => 'name',:label => nil,:example => 'server.domain',:value => params[:server] ? params[:server][:name] : ""} + = render :partial => "common/form_button_icon",:locals => { :text => t(:send_config,:scope=>:user), :icon_class =>'icon-ok icon-white'} diff --git a/app/views/user/unknown.html.erb b/app/views/user/unknown.html.erb deleted file mode 100755 index 0ef78a8..0000000 --- a/app/views/user/unknown.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -<% content_for :title do %> - <%= t(:unknown_title,:scope=>:user) %> -<% end %> - -
-
- -

<%= t(:unknown_title,:scope=>:user) %>

-
-

<%= t(:unknown_flash,:scope=>:user) %>

-

<%= t(:unknown_login,:scope=>:user) %> -> <%= link_to t(:login,:scope=>:user),user_login_path %>

-

<%= t(:unknown_setup,:scope=>:user) %> -> <%= link_to t(:setup,:scope=>:user),:controller => "user",:action => "setup",:login => params[:login] %>

-
-
-
diff --git a/config.ru b/config.ru old mode 100644 new mode 100755 diff --git a/config/application.rb b/config/application.rb old mode 100644 new mode 100755 diff --git a/config/boot.rb b/config/boot.rb old mode 100644 new mode 100755 diff --git a/config/environment.rb b/config/environment.rb old mode 100644 new mode 100755 diff --git a/config/environments/development.rb b/config/environments/development.rb old mode 100644 new mode 100755 diff --git a/config/environments/production.rb b/config/environments/production.rb old mode 100644 new mode 100755 diff --git a/config/environments/test.rb b/config/environments/test.rb old mode 100644 new mode 100755 diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb old mode 100644 new mode 100755 diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb old mode 100644 new mode 100755 diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb old mode 100644 new mode 100755 diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb old mode 100644 new mode 100755 diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb old mode 100644 new mode 100755 diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb old mode 100644 new mode 100755 diff --git a/config/locales/pl.yml b/config/locales/pl.yml index f54c166..42b02e6 100755 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -60,6 +60,9 @@ pl: for_imap: IMAP? for_smtp: SMTP? auth: Metoda autoryzacji + folder: + name: Nazwa folderu + contact: compose_to_selected: Napisz do wybranych @@ -99,7 +102,7 @@ pl: folder: folder: Folder folders: Foldery - no_shown: Nie prezentowany jest żaden folder. Skonfiguruj widok folderów w zakładce + no_shown: Nie jest prezentowany żaden folder. Skonfiguruj widok folderów w zakładce parent: Folder nadrzędny to_create: Folder do utworzenia to_delete: Folder do usunięcia @@ -127,6 +130,7 @@ pl: not_configured_inbox: Folder Odebrane nie został przypisany show_hide: Pokaż/Ukryj refresh: Odśwież + presentation: Prezentacja folderów message: messages: Wiadomości @@ -171,9 +175,10 @@ pl: delete: Usuń reply_string: "Odp: " trash: Usuń + forward: Przekaż user: - login_failure: Nieudane logowanie. Podano błędny e-mail lub hasło. + login_failure: Nieudane logowanie. Podano błędny login lub hasło. logged_out: Użytkownik wylogowany setup_done: Konfiguracja zakończona. Proszę się zalogować. please_login: Logowanie @@ -186,6 +191,8 @@ pl: only_can_logins: Podany identyfikator użytkownika nie uprawnia do korzystania z aplikacji logout: Wyloguj has_no_domain: Użytkownik nie ma ustawionej domeny + send_config: Wyślij + no_config: W bazie nie znaleziono żadnego użytkownika. Prawdopodobnie aplikacja nie została jeszcze skonfigurowana. Wypełnij poniższy formularz, aby dokonać podtsawowej konfiguracji. internal: imap_error: Błąd protokołu IMAP @@ -196,6 +203,7 @@ pl: about: Informacje o programie current_version: Aktualna wersja general_error: Błąd aplikacji + allready_configured: Podstawowe parametry aplikacji zostały już skonfigurowane. Zaloguj się na utworzonego użytkownika i dokonaj dodatkowej konfiguracji. common: false_answer: Nie @@ -204,7 +212,7 @@ pl: no_tmp_dir: Brak katalogu tymczasowego must_be_unique: musi być unikalny some_add_info: jakieś dodatkowe informacje - example: przykład + example: "przykład:" create: Utwórz delete: Usuń mailr: MailR diff --git a/config/routes.rb b/config/routes.rb index 9d2bf2d..755460a 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -43,11 +43,12 @@ Mailr::Application.routes.draw do get "imaperror" get "loginfailure" get "onlycanlogins" + get "allready_configured" end match "/internal/about" => 'internal#about' ,:as => :about match "/messages_ops/single" => 'messages_ops#single' - match "/messages_ops/multi" => 'messages_ops#multi' + match "/messages_ops/multi" => 'messages_ops#multi', :as => :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 diff --git a/config/settings.yml.example b/config/settings.yml.example old mode 100644 new mode 100755 diff --git a/db/migrate/20120303202800_create_all_tables.rb b/db/migrate/20120303202800_create_all_tables.rb old mode 100644 new mode 100755 diff --git a/db/schema.rb b/db/schema.rb old mode 100644 new mode 100755 diff --git a/db/seeds.rb b/db/seeds.rb old mode 100644 new mode 100755 diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP old mode 100644 new mode 100755 diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep old mode 100644 new mode 100755 diff --git a/lib/mail_plugin_extension.rb b/lib/mail_plugin_extension.rb index 3f71520..efd44bd 100755 --- a/lib/mail_plugin_extension.rb +++ b/lib/mail_plugin_extension.rb @@ -2,28 +2,24 @@ require 'iconv' module Mail - class Message + class Message + attr_accessor :idx,:parent_id + - def decoded_and_charseted - begin - if not charset.upcase == 'UTF-8' - charset.nil? ? source_charset = $defaults["msg_unknown_charset"] : source_charset = charset - charseted = Iconv.iconv("UTF-8",source_charset,decoded).first - else - charseted = decoded - end - rescue - decoded - end - - end - - end - - class Part - - attr_accessor :idx,:parent_id + #def decoded_and_charseted + #begin + #if not charset.upcase == 'UTF-8' + #charset.nil? ? source_charset = $defaults["msg_unknown_charset"] : source_charset = charset + #charseted = Iconv.iconv("UTF-8",source_charset,decoded).first + #else + #charseted = decoded + #end + #rescue + #decoded + #end + #end + def isImage? not (content_type =~ /^image/).nil? end @@ -39,61 +35,7 @@ module Mail def getSize body.raw_source.size end - - def decoded_and_charseted - begin - if not charset.upcase == 'UTF-8' - charset.nil? ? source_charset = $defaults["msg_unknown_charset"] : source_charset = charset - charseted = Iconv.iconv("UTF-8",source_charset,decoded).first - else - charseted = decoded - end - rescue - decoded - end - - end - - - end - - class Field - def charseted - begin - if value =~ /\=\?([\w\-]+)\?/ - source_charset = $1 - if source_charset.upcase == 'UTF-8' - return decoded - end - else - source_charset = $defaults["msg_unknown_charset"] - end - Iconv.iconv("UTF-8",source_charset,decoded).first - rescue - decoded - end - end - end - - class Address - def charseted - begin - if value =~ /\=\?([\w\-]+)\?/ - source_charset = $1 - if source_charset.upcase == 'UTF-8' - return decoded - end - else - source_charset = $defaults["msg_unknown_charset"] - end - Iconv.iconv("UTF-8",source_charset,decoded).first - rescue - decoded - end - end - end - - class Part + def filename_charseted begin if content_type =~ /\=\?([\w\-]+)\?/ @@ -109,6 +51,98 @@ module Mail filename end end + end + class Part + + attr_accessor :idx,:parent_id + + #def isImage? + #not (content_type =~ /^image/).nil? + #end + + #def isText? + #not (content_type =~ /^text\/plain/).nil? + #end + + #def isHtml? + #not (content_type =~ /^text\/html/).nil? + #end + + #def getSize + #body.raw_source.size + #end + + #def decoded_and_charseted + #begin + #if not charset.upcase == 'UTF-8' + #charset.nil? ? source_charset = $defaults["msg_unknown_charset"] : source_charset = charset + #charseted = Iconv.iconv("UTF-8",source_charset,decoded).first + #else + #charseted = decoded + #end + #rescue + #decoded + #end + + #end + + + end + + #class Field + #def charseted + #begin + #if value =~ /\=\?([\w\-]+)\?/ + #source_charset = $1 + #if source_charset.upcase == 'UTF-8' + #return decoded + #end + #else + #source_charset = $defaults["msg_unknown_charset"] + #end + #Iconv.iconv("UTF-8",source_charset,decoded).first + #rescue + #decoded + #end + #end + #end + + #class Address + #def charseted + #begin + #if value =~ /\=\?([\w\-]+)\?/ + #source_charset = $1 + #if source_charset.upcase == 'UTF-8' + #return decoded + #end + #else + #source_charset = $defaults["msg_unknown_charset"] + #end + #Iconv.iconv("UTF-8",source_charset,decoded).first + #rescue + #decoded + #end + #end + #end + + #class Part + #def filename_charseted + #begin + #if content_type =~ /\=\?([\w\-]+)\?/ + #source_charset = $1 + #if source_charset.upcase == 'UTF-8' + #return filename + #end + #else + #source_charset = $defaults["msg_unknown_charset"] + #end + #Iconv.iconv("UTF-8",source_charset,filename).first + #rescue + #filename + #end + #end + #end + end diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep old mode 100644 new mode 100755 diff --git a/lib/tasks/clear_db.rake b/lib/tasks/clear_db.rake new file mode 100755 index 0000000..b12913c --- /dev/null +++ b/lib/tasks/clear_db.rake @@ -0,0 +1,23 @@ +namespace :db do + + desc "Removes all users data from db" + task :remove_all_data => :environment do + users = User.all + puts "Number of users in db: #{users.size}" + puts "Deleting data....." + User.destroy_all + puts "Done" + end + + desc "Deletes users data (messages,folders,contacts)" + task :remove_users_data => :environment do + users = User.all + users.each do |u| + puts "Removing folders & messages for user #{u.email}" + u.folders.destroy_all + puts "Removing contacts for user #{u.email}" + u.contacts.destroy_all + end + end + +end diff --git a/log/.gitkeep b/log/.gitkeep old mode 100644 new mode 100755 diff --git a/public/404.html b/public/404.html old mode 100644 new mode 100755 diff --git a/public/422.html b/public/422.html old mode 100644 new mode 100755 diff --git a/public/500.html b/public/500.html old mode 100644 new mode 100755 diff --git a/public/favicon.ico b/public/favicon.ico old mode 100644 new mode 100755 diff --git a/public/robots.txt b/public/robots.txt old mode 100644 new mode 100755 diff --git a/test/fixtures/.gitkeep b/test/fixtures/.gitkeep old mode 100644 new mode 100755 diff --git a/test/functional/.gitkeep b/test/functional/.gitkeep old mode 100644 new mode 100755 diff --git a/test/integration/.gitkeep b/test/integration/.gitkeep old mode 100644 new mode 100755 diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb old mode 100644 new mode 100755 diff --git a/test/test_helper.rb b/test/test_helper.rb old mode 100644 new mode 100755 diff --git a/test/unit/.gitkeep b/test/unit/.gitkeep old mode 100644 new mode 100755 diff --git a/vendor/assets/javascripts/.gitkeep b/vendor/assets/javascripts/.gitkeep old mode 100644 new mode 100755 diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep old mode 100644 new mode 100755 diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep old mode 100644 new mode 100755