This commit is contained in:
Wojciech Todryk 2011-09-16 19:44:29 +02:00
parent b4bc16ed14
commit 2afeebad53
49 changed files with 342 additions and 160 deletions

View file

@ -1,10 +1,12 @@
require 'tempfile'
class ContactsController < ApplicationController class ContactsController < ApplicationController
before_filter :check_current_user,:selected_folder, :get_current_folders before_filter :check_current_user,:selected_folder, :get_current_folders
before_filter :get_contacts, :only => [:index] before_filter :get_contacts, :only => [:index]
before_filter :prepare_ops_buttons, :only => [:index] before_filter :prepare_ops_buttons, :prepare_export_import_buttons,:only => [:index]
theme :theme_resolver theme :theme_resolver
@ -67,6 +69,40 @@ class ContactsController < ApplicationController
end end
end end
def external
if params["export"]
redirect_to :action => 'export'
return
elsif params["import"]
begin
raise t(:no_file_chosen,:scope=>:common) if not params[:upload]
raise t(:no_tmp_dir,:scope=>:common) if not File.exists?($defaults["msg_upload_dir"])
tmp_file = Tempfile.new($defaults["contact_tmp_filename"],$defaults["msg_upload_dir"])
tmp_file.write(params[:upload][:datafile].read)
tmp_file.flush
tmp_file.rewind
tmp_file.readlines.each do |line|
Contact.import(@current_user,line)
end
rescue Exception => e
flash[:error] = e.to_s
end
end
flash[:notice] = t(:were_imported,:scope=>:contact) if not flash[:error]
redirect_to :action => 'index'
end
def export
contacts = @current_user.contacts
s = ""
contacts.each do |c|
s += c.export + "\r\n"
end
headers['Content-type'] = "text/csv"
headers['Content-Disposition'] = %(attachment; filename="contacts.csv")
render :text => s
end
####################################### protected section ################################ ####################################### protected section ################################
protected protected
@ -78,6 +114,12 @@ class ContactsController < ApplicationController
@buttons << {:text => 'delete_selected',:scope=>'contact',:image => 'minus.png'} @buttons << {:text => 'delete_selected',:scope=>'contact',:image => 'minus.png'}
end end
def prepare_export_import_buttons
@ei_buttons = []
@ei_buttons << {:text => 'import',:scope=>'contact',:image => 'right.png'}
@ei_buttons << {:text => 'export',:scope=>'contact',:image => 'left.png'}
end
####################################### private section ################################## ####################################### private section ##################################
private private

View file

@ -1,2 +0,0 @@
class EventsController < ApplicationController
end

View file

@ -144,7 +144,7 @@ class FoldersController < ApplicationController
trash_folder.messages.destroy_all trash_folder.messages.destroy_all
trash_folder.update_attributes(:unseen => 0, :total => 0) trash_folder.update_attributes(:unseen => 0, :total => 0)
rescue Exception => e rescue Exception => e
flash[:error] = "#{t(:imap_error)} (#{e.to_s})" flash[:error] = "#{t(:imap_error,:scope=>:common)} (#{e.to_s})"
end end
redirect_to :controller => 'messages', :action => 'index' redirect_to :controller => 'messages', :action => 'index'
end end

View file

@ -1,8 +1,11 @@
class InternalController < ApplicationController class InternalController < ApplicationController
before_filter :check_current_user ,:selected_folder, :get_current_folders, :only => [:about]
theme :theme_resolver theme :theme_resolver
layout "simple" layout "simple"
ERRORS = [ ERRORS = [
:internal_server_error, :internal_server_error,
:not_found, :not_found,
@ -43,4 +46,8 @@ class InternalController < ApplicationController
redirect_to :controller=>'user', :action => 'login' redirect_to :controller=>'user', :action => 'login'
end end
def about
render 'internal/about', :layout => 'application'
end
end end

View file

@ -65,9 +65,23 @@ class MessagesController < ApplicationController
end end
def compose def compose
#before filter #before filter :prepare_compose_buttons, :create_message_with_params
@operation = :new @operation = :new
logger.custom('m',@message.inspect) if params["cid"].present?
contact = @current_user.contacts.find_by_id(params["cid"])
if not contact.nil?
@message.to_addr = contact.email
end
elsif params["cids"].present?
contacts = []
params["cids"].each do |c|
contact = @current_user.contacts.find_by_id(c)
if not contact.nil?
contacts << contact.email
end
end
@message.to_addr = contacts.join(';')
end
end end
def show def show

View file

@ -2,6 +2,7 @@ require 'imap_session'
require 'imap_mailbox' require 'imap_mailbox'
require 'imap_message' require 'imap_message'
require 'mail' require 'mail'
require 'mail_plugin_extension'
class MessagesOpsController < ApplicationController class MessagesOpsController < ApplicationController
@ -128,7 +129,7 @@ class MessagesOpsController < ApplicationController
@operation = :upload @operation = :upload
create_message_with_params create_message_with_params
if not params[:upload] if not params[:upload]
flash[:error] = t(:no_attach,:scope=>:compose) flash[:error] = t(:no_file_chosen,:scope=>:common)
else else
name = params[:upload][:datafile].original_filename name = params[:upload][:datafile].original_filename
upload_dir = $defaults["msg_upload_dir"] upload_dir = $defaults["msg_upload_dir"]
@ -188,11 +189,12 @@ class MessagesOpsController < ApplicationController
mail = Mail.new mail = Mail.new
mail.subject = params[:message][:subject] mail.subject = params[:message][:subject]
mail.from = @current_user.full_address 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.to = params[:message][:to_addr]
mail.body = params[:message][:body] mail.body = params[:message][:body]
attachments = Dir.glob(File.join($defaults["msg_upload_dir"],@current_user.username + "*")) attachments = Dir.glob(File.join($defaults["msg_upload_dir"],@current_user.username + "*"))
logger.custom('attach',attachments.inspect) #logger.custom('attach',attachments.inspect)
attachments.each do |a| attachments.each do |a|
mail.add_file :filename => File.basename(a.gsub(/#{@current_user.username}_/,"")), :content => File.read(a) mail.add_file :filename => File.basename(a.gsub(/#{@current_user.username}_/,"")), :content => File.read(a)
end end
@ -221,7 +223,7 @@ class MessagesOpsController < ApplicationController
@mailbox.append(@sent_folder.full_name,mail.to_s,[:Seen]) @mailbox.append(@sent_folder.full_name,mail.to_s,[:Seen])
rescue Exception => e rescue Exception => e
flash[:error] = "#{t(:imap_error)} (#{e.to_s})" flash[:error] = "#{t(:imap_err,:scope=>:internal)} (#{e.to_s})"
redirect_to :controller => 'messages', :action => 'index' redirect_to :controller => 'messages', :action => 'index'
return return
end end
@ -238,10 +240,13 @@ class MessagesOpsController < ApplicationController
if @drafts_folder.nil? if @drafts_folder.nil?
raise t(:not_configured_drafts,:scope=>:compose) raise t(:not_configured_drafts,:scope=>:compose)
end end
# TODO delete old one if was edit
@mailbox.append(@drafts_folder.full_name,mail.to_s,[:Seen]) @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 rescue Exception => e
flash[:error] = "#{t(:imap_error)} (#{e.to_s})" flash[:error] = "#{t(:imap_error,:scope=>:internal)} (#{e.to_s})"
redirect_to :controller => 'messages', :action => 'index' redirect_to :controller => 'messages', :action => 'index'
return return
end end
@ -250,24 +255,24 @@ class MessagesOpsController < ApplicationController
end end
end end
###################################### protected section #######################################
protected
#FIXME edit does not support attachments
def edit def edit
old_message = @current_user.messages.find(params[:id].first) old_message = @current_user.messages.find(params[:id])
@message = Message.new @message = Message.new
@message.to_addr = old_message.to_addr @message.to_addr = old_message.to_addr
@message.subject = old_message.subject @message.subject = old_message.subject
imap_message = @mailbox.fetch_body(old_message.uid) imap_message = @mailbox.fetch_body(old_message.uid)
mail = Mail.new(imap_message) mail = Mail.new(imap_message)
if mail.multipart? if mail.multipart?
@message.body = mail.text_part.decoded_and_charseted @message.body = mail.text_part.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
else else
@message.body = mail.decoded_and_charseted @message.body = mail.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
end end
@attachments = [] @attachments = []
@operation = :edit @operation = :edit
@olduid = old_message.uid
render 'messages/compose' render 'messages/compose'
end end
@ -280,7 +285,7 @@ class MessagesOpsController < ApplicationController
imap_message = @mailbox.fetch_body(old_message.uid) imap_message = @mailbox.fetch_body(old_message.uid)
mail = Mail.new(imap_message) mail = Mail.new(imap_message)
if mail.multipart? if mail.multipart?
@message.body = mail.text_part.decoded_and_charseted @message.body = mail.text_part.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
else else
@message.body = mail.decoded_and_charseted.gsub(/<\/?[^>]*>/, "") @message.body = mail.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
end end
@ -288,6 +293,11 @@ class MessagesOpsController < ApplicationController
@operation = :reply @operation = :reply
render 'messages/compose' render 'messages/compose'
end end
###################################### protected section #######################################
protected
############################################ set_mail_defaults #################################### ############################################ set_mail_defaults ####################################

View file

@ -252,6 +252,14 @@ end
# link_to( t(:prefs,:scope=>:prefs), prefs_look_path ) # link_to( t(:prefs,:scope=>:prefs), prefs_look_path )
#end #end
def single_navigation(label,scope)
s = ""
s += "<ul class=\"wat-cf\">"
s += "<li class=\"first active\">#{link_to(t(label,:scope=>scope),'#')}</li>"
s += "<li class=\"last\">&nbsp;</li>"
s += "</ul>"
end
def main_navigation(active) def main_navigation(active)
instance_variable_set("@#{active}", "active") instance_variable_set("@#{active}", "active")
s = "" s = ""
@ -310,8 +318,9 @@ def force_charset(text)
end end
def content_for_sidebar def content_for_sidebar
s = render :partial => 'folders/list' s = render :partial => 'sidebar/logo'
s += render :partial => 'events/calendar' s += render :partial => 'folders/list'
s += render :partial => 'sidebar/calendar_view'
s += render :partial => 'internal/version' s += render :partial => 'internal/version'
s s
end end

View file

@ -5,7 +5,7 @@ class Contact < ActiveRecord::Base
validates_length_of :email, :within => 5..50 validates_length_of :email, :within => 5..50
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
validates_length_of :info, :maximum => 50 validates_length_of :info, :maximum => 50
validate_on_create :check_unique_nick validate :check_unique_nick, :on => :create
belongs_to :user belongs_to :user
@ -32,4 +32,23 @@ class Contact < ActiveRecord::Base
end end
end end
def export
fields = []
fields << nick.presence || ""
fields << first_name || ""
fields << last_name || ""
fields << email || ""
fields << info || ""
fields.join(';')
end
def self.import(user,line)
fields = line.split(/;/)
contact = user.contacts.build( :nick => fields[0],
:first_name => fields[1],
:last_name => fields[2],
:email => fields[3],
:info => fields[4])
contact.save!
end
end end

View file

@ -2,6 +2,8 @@ require 'ezcrypto'
class User < ActiveRecord::Base class User < ActiveRecord::Base
#acts_as_notes_owner
validates_presence_of :first_name,:last_name validates_presence_of :first_name,:last_name
validates_uniqueness_of :email validates_uniqueness_of :email
has_many :servers, :dependent => :destroy has_many :servers, :dependent => :destroy

View file

@ -17,7 +17,7 @@ module Mailr
# Only load the plugins named here, in the order given (default is alphabetical). # Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named. # :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ] #config.plugins = [ :acts_as_notes_owner, :all ]
config.action_view.javascript_expansions[:defaults] = %w(jquery rails) config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

View file

@ -1,4 +1,4 @@
version: Build 2011-09-10 version: 0.8.3
theme: olive theme: olive
locale: pl locale: pl
@ -25,10 +25,12 @@ msg_address_length: 35
msg_search_fields: [subject, from, to] msg_search_fields: [subject, from, to]
msg_upload_dir: "tmp/uploads" msg_upload_dir: "tmp/uploads"
contact_tmp_filename: contact_import
# if encoding can not be get from data # if encoding can not be get from data
msg_unknown_charset: ISO-8859-2 msg_unknown_charset: ISO-8859-2
imap_debug: false imap_debug: true
imap_use_ssl: 'false' imap_use_ssl: 'false'
imap_port: 143 imap_port: 143
imap_ssl_port: 993 imap_ssl_port: 993
@ -43,4 +45,4 @@ session_password: asDD3s2@sAdc983#
mailbox_max_parent_folder_depth: 3 mailbox_max_parent_folder_depth: 3
# array of logins which only can login to application, comment it to allow everyone to login # array of logins which only can login to application, comment it to allow everyone to login
only_can_logins: [some_login] only_can_logins: [wtodryk]

View file

@ -14,6 +14,7 @@ pl:
invalid: "ma niepoprawny format " invalid: "ma niepoprawny format "
not_unique: "musi być unikalny " not_unique: "musi być unikalny "
taken: "musi być unikalny" taken: "musi być unikalny"
record_invalid: Nieprawidłowy format danych
models: models:
contact: Kontakt contact: Kontakt
attributes: attributes:
@ -60,6 +61,10 @@ pl:
no_entries: Brak kontaktów no_entries: Brak kontaktów
was_created: Kontakt został utworzony was_created: Kontakt został utworzony
are_you_sure_to_delete_contact: Czy na pewno chcesz usunąć kontakt? are_you_sure_to_delete_contact: Czy na pewno chcesz usunąć kontakt?
export: Export
import: Import
were_imported: Kontakty zostały zaimportowane
format_error: Nieprawidłowy format kontaktu
prefs: prefs:
prefs: Ustawienia prefs: Ustawienia
@ -138,7 +143,6 @@ pl:
send_file: Wyślij plik send_file: Wyślij plik
send: Wyślij send: Wyślij
save_as_draft: Zapisz w katalogu roboczym save_as_draft: Zapisz w katalogu roboczym
no_attach: Nie wybrano żadnego pliku
show: show:
reply: Odpowiedz reply: Odpowiedz
@ -166,15 +170,17 @@ pl:
not_found: Nie znaleziono żądanej strony not_found: Nie znaleziono żądanej strony
internal_server_error: Błąd aplikacji internal_server_error: Błąd aplikacji
unprocessable_entity: Błąd procesowania unprocessable_entity: Błąd procesowania
about: Informacje o programie
current_version: Aktualna wersja
common: common:
file_format_error: Błędny format pliku
no_tmp_dir: Brak katalogu tymczasowego
must_be_unique: musi być unikalny must_be_unique: musi być unikalny
some_add_info: jakieś dodatkowe informacje some_add_info: jakieś dodatkowe informacje
example: przykład example: przykład
create: Utwórz create: Utwórz
delete: Usuń delete: Usuń
mailr: MailR mailr: MailR
save: Zapisz save: Zapisz
copy: Skopiuj copy: Skopiuj
@ -186,11 +192,10 @@ pl:
kbytes: kB kbytes: kB
mbytes: MB mbytes: MB
site_link: https://github.com/lmanolov/mailr site_link: https://github.com/lmanolov/mailr
no_data: Brak danych no_data: Brak danych
download: Pobierz download: Pobierz
view: Pokaż view: Pokaż
version: Wersja version: Wersja
set: Ustaw set: Ustaw
logout: Wyloguj logout: Wyloguj
no_file_chosen: Nie wybrano żadnego pliku

View file

@ -10,9 +10,10 @@ Mailr::Application.routes.draw do
match "prefs/identity" => "prefs#identity", :as => :prefs_identity match "prefs/identity" => "prefs#identity", :as => :prefs_identity
match "prefs/servers" => "prefs#servers", :as => :prefs_servers match "prefs/servers" => "prefs#servers", :as => :prefs_servers
resources :contacts
post "contacts/ops" post "contacts/ops"
get "contacts/export"
match "contacts/external" => "contacts#external", :as => :contacts_external
resources :contacts
#resources :folders #resources :folders
match "folders/index" => 'folders#index', :as => :folders match "folders/index" => 'folders#index', :as => :folders
@ -30,15 +31,18 @@ Mailr::Application.routes.draw do
get "internal/imaperror" get "internal/imaperror"
get "internal/loginfailure" get "internal/loginfailure"
get "internal/onlycanlogins" get "internal/onlycanlogins"
match "internal/about" => 'internal#about' ,:as => :about
match "messages_ops/single" => 'messages_ops#single' match "messages_ops/single" => 'messages_ops#single'
match "messages_ops/multi" => 'messages_ops#multi' 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/sendout_or_save" => 'messages_ops#sendout_or_save' ,:as =>:sendout_or_save
match "messages_ops/upload" => 'messages_ops#upload',:as => :upload match "messages_ops/upload" => 'messages_ops#upload',:as => :upload
match "messages_ops/edit/:id" => 'messages_ops#edit', :as => :messages_ops_edit
root :to => "messages#index" root :to => "messages#index"
match "messages/index" => 'messages#index', :as => :messages match "messages/index" => 'messages#index', :as => :messages
match "messages/compose" => 'messages#compose', :as => :compose match "messages/compose" => 'messages#compose', :as => :compose
match "messages/compose/:cid" => 'messages#compose', :as => :compose_contact
#get "messages/refresh_status" #get "messages/refresh_status"
#get "messages/emptybin" #get "messages/emptybin"
#match "messages/select/:id" => 'messages#select', :as => :messages_select #match "messages/select/:id" => 'messages#select', :as => :messages_select
@ -64,8 +68,9 @@ Mailr::Application.routes.draw do
get "user/unknown" get "user/unknown"
themes_for_rails themes_for_rails
#acts_as_notes_owner
match '*a', :to => 'internal#not_found' #match '*a', :to => 'internal#not_found'
# The priority is based upon order of creation: # The priority is based upon order of creation:
# first created -> highest priority. # first created -> highest priority.

View file

@ -1,19 +0,0 @@
class CreateEvents < ActiveRecord::Migration
def self.up
create_table :events 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.timestamps
end
end
def self.down
drop_table :events
end
end

View file

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

View file

@ -40,6 +40,21 @@ module Mail
body.raw_source.size body.raw_source.size
end 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 end
class Field class Field

View file

@ -1,19 +0,0 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
user_id: 1
priority: 1
description: MyText
category: MyString
start: 2011-09-06 11:41:29
stop: 2011-09-06 11:41:29
allday: false
two:
user_id: 1
priority: 1
description: MyText
category: MyString
start: 2011-09-06 11:41:29
stop: 2011-09-06 11:41:29
allday: false

View file

@ -1,4 +0,0 @@
require 'test_helper'
class EventsHelperTest < ActionView::TestCase
end

BIN
themes/olive/images/left.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

BIN
themes/olive/images/right.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

View file

@ -342,11 +342,6 @@ ul.list li .item .avatar {
-webkit-border-bottom-right-radius: 4px; -webkit-border-bottom-right-radius: 4px;
} }
.block #logo {
height: 65;
background-color: #EFF3E4;
}
div.block div.actions-bar { div.block div.actions-bar {
margin: 5px; margin: 5px;
} }
@ -580,3 +575,11 @@ div.actiongroup {
margin: 5px 0; margin: 5px 0;
padding: 2px 0; padding: 2px 0;
} }
div.logo {
text-align: center;
}
div#logo {
background-color: #EFF3E4;
}

View file

@ -0,0 +1,7 @@
<td><%= check_box_tag "cids[]", contact.id %></td>
<td nowrap="nowrap"><%= link_to contact.nick,edit_contact_path(contact) %></td>
<td nowrap="nowrap"><%= contact.first_name %></td>
<td nowrap="nowrap"><%= contact.last_name %></td>
<td nowrap="nowrap"><%= link_to contact.email, compose_contact_path(contact.id) %></td>
<td colspan="2" nowrap="nowrap"><%= contact.info %></td>

View file

@ -0,0 +1,7 @@
<div class="ops">
<%= form_tag(contacts_external_path, :multipart => true) %>
<label for="upload_file"><%= t(:select_file,:scope=>:compose) %></label>:&nbsp;
<%= file_field 'upload', 'datafile' %>
<%= raw group_action(@ei_buttons) %>
</form>
</div>

View file

@ -1,9 +1,9 @@
<div class="params"> <div class="params">
<%= raw form_field(@contact,"nick",nil,"joe"+', '+t(:must_be_unique),@contact.nick) %> <%= raw form_field(@contact,"nick",nil,"joe"+', '+t(:must_be_unique,:scope=>:common),@contact.nick) %>
<%= raw form_field(@contact,"first_name",nil,"Joe",@contact.first_name) %> <%= raw form_field(@contact,"first_name",nil,"Joe",@contact.first_name) %>
<%= raw form_field(@contact,"last_name",nil,"Doe",@contact.last_name) %> <%= raw form_field(@contact,"last_name",nil,"Doe",@contact.last_name) %>
<%= raw form_field(@contact,"email",nil,"joe.doe@domain.com",@contact.email) %> <%= raw form_field(@contact,"email",nil,"joe.doe@domain.com",@contact.email) %>
<%= raw form_field(@contact,"info",nil,t(:some_add_info),@contact.info) %> <%= raw form_field(@contact,"info",nil,t(:some_add_info,:scope=>:common),@contact.info) %>
</div> </div>
<%= raw single_action('save','common','save.png') %> <%= raw single_action('save','common','save.png') %>

View file

@ -1,31 +1,25 @@
<div class="inner"> <div class="inner">
<div class="actions-bar wat-cf"> <div class="actions-bar wat-cf">
<span class="other_info"> <%= t(:total_entries,:scope=>:contact) %>: <%= @contacts.total_entries %></span> <span class="other_info"> <%= t(:total_entries,:scope=>:contact) %>: <%= @contacts.total_entries %></span>
</div>
<%= will_paginate @contacts %> <%= will_paginate @contacts %>
</div> </div>
<table class="table"> <table class="table">
<tbody> <tbody>
<tr> <tr>
<th class="first"><input id="togglechkbox" class="checkbox toggle" type="checkbox" name="allbox" onclick=toggleCheckBoxes(this.form); /></th> <th class="first"><input id="toggleall" class="checkbox toggle" type="checkbox" name="allbox"/></th>
<%= raw contacts_table_header %> <%= raw contacts_table_header %>
<th class="last"></th> <th class="last"></th>
</tr> </tr>
<% trclass = :even %> <% trclass = :even %>
<% @contacts.each do |c| %> <% @contacts.each do |c| %>
<tr class="<%= trclass.to_s %>"> <tr class="<%= trclass.to_s %>">
<%= render :partial => 'contacts/row', :object => c %> <%= render :partial => 'contacts/contact', :object => c %>
</tr> </tr>
<% trclass == :even ? trclass = :odd : trclass = :even %> <% trclass == :even ? trclass = :odd : trclass = :even %>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<div class="actions-bar wat-cf"> <div class="actions-bar wat-cf">
<%= will_paginate @contacts %> <%= will_paginate @contacts %>
</div> </div>
</div> </div>

View file

@ -1,5 +1,3 @@
<div id="ops" class="ops"> <div id="ops" class="ops">
<p>
<%= raw group_action(@buttons) %> <%= raw group_action(@buttons) %>
</p>
</div> </div>

View file

@ -1,7 +0,0 @@
<td><%= check_box_tag "cids[]", row.id %></td>
<td nowrap="nowrap"><%= link_to row.nick,edit_contact_path(row) %></td>
<td nowrap="nowrap"><%= row.first_name %></td>
<td nowrap="nowrap"><%= row.last_name %></td>
<td nowrap="nowrap"><%= link_to row.email, {:controller => 'messages',:action => 'compose' , :cids => row.id} %></td>
<td colspan="2" nowrap="nowrap"><%= row.info %></td>

View file

@ -12,16 +12,16 @@
</div> </div>
<div class="content"> <div class="content">
<%= form_tag(contacts_ops_path,{:name=>'contacts'})%> <%= form_tag(contacts_ops_path,{:name=>'contacts'})%>
<% if @contacts.size.zero? %> <% if @contacts.size.zero? %>
<h3><%= t(:no_entries,:scope=>:contact) %></h3> <h3><%= t(:no_entries,:scope=>:contact) %></h3>
<%= raw single_action('create_new','contact','plus.png') %> <%= raw single_action('create_new','contact','plus.png') %>
</form>
<% else %> <% else %>
<%= render :partial => 'ops' %> <%= render :partial => 'ops' %>
<%= render :partial => 'list' %> <%= render :partial => 'list' %>
<% end %>
</form> </form>
<% end %>
<%= render :partial => 'external' %>
</div> </div>
</div> </div>

View file

@ -1,3 +0,0 @@
<div class="block">
<%= raw calendar(1,2,3) %>
</div>

View file

@ -1,4 +1,4 @@
<p class="version"> <p class="version">
<%= t(:version) %>: <%= $defaults["version"] %> <%= link_to (t(:version,:scope=>:common) + " " + $defaults["version"]),about_path %>
</p> </p>

View file

@ -0,0 +1,27 @@
<% content_for :title do %>
- <%= t(:about,:scope=>:internal) %>
<% end %>
<% content_for :sidebar do %>
<%= content_for_sidebar %>
<% end %>
<div class="block" id="block-tables">
<div class="secondary-navigation">
<%= raw single_navigation(:about,:internal) %>
</div>
<div class="content">
<div class="actions-bar wat-cf">
<div class="header_info">
<%= t(:current_version,:scope=>:internal) + ": " + $defaults["version"] %>
</div></div>
<div class="render_text">
<pre>
<%= render :file => 'config/about.txt' %>
<%= render :text => "To do:\n" %>
<%= render :file => 'config/todo.txt' %>
</pre>
</div>
</div>
</div>

View file

@ -25,8 +25,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<div id="container"> <div id="container">
<div id="wrapper" class="wat-cf"> <div id="wrapper" class="wat-cf">
<div id="sidebar"> <div id="sidebar">
<div id="logo"><img src="<%= current_theme_image_path('logo_small.png')%>" alt="Mailr"/></div> <%= yield :sidebar %>
<div id="sidebar"><%= yield :sidebar %></div>
</div> </div>
<div id="main"> <div id="main">
<div class="flash"> <div class="flash">

View file

@ -11,6 +11,6 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
</head> </head>
<body> <body>
<%= yield %> <%= yield %>
<div id="footer"><a href="<%= t(:site_link,:scope=>:common) %>">Mailr</a> - open source web mail client</div> <div id="footer"><a href="<%= t(:site_link,:scope=>:common) %>"><%= t(:mailr,:scope=>:common) %></a> - open source web mail client</div>
</body> </body>
</html> </html>

View file

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

View file

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

View file

@ -21,6 +21,9 @@
20 20
) %> ) %>
</div> </div>
<% if !@olduid.nil? %>
<%= hidden_field_tag 'olduid', @olduid %>
<% end %>
<%= raw group_action(@buttons) %> <%= raw group_action(@buttons) %>
<%= render :partial=> 'messages/file_attachs' %> <%= render :partial=> 'messages/file_attachs' %>
</form> </form>

View file

@ -0,0 +1,3 @@
<div class="block">
<%= raw calendar_small %>
</div>

View file

@ -0,0 +1 @@
<div class="block logo"><img src="<%= current_theme_image_path('logo_small.png')%>" alt="Mailr"/></div>

View file

@ -4,7 +4,7 @@
<div id="box"> <div id="box">
<div class="block"> <div class="block">
<div id="logo"><a href="/"><img src="<%= current_theme_image_path('logo_small.png')%>" alt="<%= t(:mailr) %>"/></a> <div id="logo"><a href="/"><img src="<%= current_theme_image_path('logo_small.png')%>" alt="<%= t(:mailr,:scope=>:common) %>"/></a>
</div> </div>
<h2><%= t(:setup,:scope=>:user) %></h2> <h2><%= t(:setup,:scope=>:user) %></h2>
<div class="content"> <div class="content">

20
vendor/plugins/calendar_view/MIT-LICENSE vendored Executable file
View file

@ -0,0 +1,20 @@
Copyright (c) 2011 [name of plugin creator]
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

13
vendor/plugins/calendar_view/README vendored Executable file
View file

@ -0,0 +1,13 @@
CalendarView
============
Introduction goes here.
Example
=======
Example goes here.
Copyright (c) 2011 [name of plugin creator], released under the MIT license

23
vendor/plugins/calendar_view/Rakefile vendored Executable file
View file

@ -0,0 +1,23 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the calendar_view plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the calendar_view plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'CalendarView'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end

1
vendor/plugins/calendar_view/init.rb vendored Executable file
View file

@ -0,0 +1 @@
require 'calendar_view'

1
vendor/plugins/calendar_view/install.rb vendored Executable file
View file

@ -0,0 +1 @@
# Install hook code here

View file

@ -1,6 +1,5 @@
module EventsHelper module CalendarViewHelper
#DAYNAMES = [:mon, :tue, :wed, :thu, :fri, :sat, :sun] def calendar_small(options={})
def calendar(yeard,monthd,addMonths)
now = DateTime.now now = DateTime.now
first = Date.new(now.year,now.month,1) first = Date.new(now.year,now.month,1)
last = Date.new(now.year,now.month,-1) last = Date.new(now.year,now.month,-1)
@ -9,13 +8,15 @@ module EventsHelper
html << t(:month_names,:scope=>:date)[now.month] html << t(:month_names,:scope=>:date)[now.month]
html << "</h3><div class=\"content\">" html << "</h3><div class=\"content\">"
html << "<table class=\"side_calendar width100\">" html << "<table class=\"side_calendar width100\">"
html << "<tr><td></td>"
html << "<tr><td></td>"
1.upto(6) do |i| 1.upto(6) do |i|
html << "<td class=\"wday\">#{t(:abbr_day_names,:scope=>:date)[i]}</td>" html << "<td class=\"wday\">#{t(:abbr_day_names,:scope=>:date)[i]}</td>"
end end
html << "<td class=\"wday\">#{t(:abbr_day_names,:scope=>:date)[0]}</td>" html << "<td class=\"wday\">#{t(:abbr_day_names,:scope=>:date)[0]}</td>"
html << "</tr>" html << "</tr>"
html << "<tr>" html << "<tr>"
html << "<td class=\"week\">#{first.cweek}</td>" html << "<td class=\"week\">#{first.cweek}</td>"

View file

@ -0,0 +1,2 @@
require File.join(File.dirname(__FILE__), 'app', 'helpers', 'calendar_view_helper')
ActionController::Base.helper(CalendarViewHelper)

View file

@ -1,6 +1,6 @@
require 'test_helper' require 'test_helper'
class EventsControllerTest < ActionController::TestCase class CalendarViewTest < ActiveSupport::TestCase
# Replace this with your real tests. # Replace this with your real tests.
test "the truth" do test "the truth" do
assert true assert true

View file

@ -0,0 +1,3 @@
require 'rubygems'
require 'test/unit'
require 'active_support'

1
vendor/plugins/calendar_view/uninstall.rb vendored Executable file
View file

@ -0,0 +1 @@
# Uninstall hook code here