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
before_filter :check_current_user,:selected_folder, :get_current_folders
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
@ -67,6 +69,40 @@ class ContactsController < ApplicationController
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
@ -78,6 +114,12 @@ class ContactsController < ApplicationController
@buttons << {:text => 'delete_selected',:scope=>'contact',:image => 'minus.png'}
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

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.update_attributes(:unseen => 0, :total => 0)
rescue Exception => e
flash[:error] = "#{t(:imap_error)} (#{e.to_s})"
flash[:error] = "#{t(:imap_error,:scope=>:common)} (#{e.to_s})"
end
redirect_to :controller => 'messages', :action => 'index'
end

View file

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

View file

@ -65,9 +65,23 @@ class MessagesController < ApplicationController
end
def compose
#before filter
#before filter :prepare_compose_buttons, :create_message_with_params
@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
def show

View file

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

View file

@ -252,6 +252,14 @@ end
# link_to( t(:prefs,:scope=>:prefs), prefs_look_path )
#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)
instance_variable_set("@#{active}", "active")
s = ""
@ -310,8 +318,9 @@ def force_charset(text)
end
def content_for_sidebar
s = render :partial => 'folders/list'
s += render :partial => 'events/calendar'
s = render :partial => 'sidebar/logo'
s += render :partial => 'folders/list'
s += render :partial => 'sidebar/calendar_view'
s += render :partial => 'internal/version'
s
end

View file

@ -5,7 +5,7 @@ class Contact < ActiveRecord::Base
validates_length_of :email, :within => 5..50
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
validates_length_of :info, :maximum => 50
validate_on_create :check_unique_nick
validate :check_unique_nick, :on => :create
belongs_to :user
@ -32,4 +32,23 @@ class Contact < ActiveRecord::Base
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

View file

@ -2,6 +2,8 @@ require 'ezcrypto'
class User < ActiveRecord::Base
#acts_as_notes_owner
validates_presence_of :first_name,:last_name
validates_uniqueness_of :email
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).
# :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)

View file

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

View file

@ -14,6 +14,7 @@ pl:
invalid: "ma niepoprawny format "
not_unique: "musi być unikalny "
taken: "musi być unikalny"
record_invalid: Nieprawidłowy format danych
models:
contact: Kontakt
attributes:
@ -60,6 +61,10 @@ pl:
no_entries: Brak kontaktów
was_created: Kontakt został utworzony
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: Ustawienia
@ -138,7 +143,6 @@ pl:
send_file: Wyślij plik
send: Wyślij
save_as_draft: Zapisz w katalogu roboczym
no_attach: Nie wybrano żadnego pliku
show:
reply: Odpowiedz
@ -166,15 +170,17 @@ pl:
not_found: Nie znaleziono żądanej strony
internal_server_error: Błąd aplikacji
unprocessable_entity: Błąd procesowania
about: Informacje o programie
current_version: Aktualna wersja
common:
file_format_error: Błędny format pliku
no_tmp_dir: Brak katalogu tymczasowego
must_be_unique: musi być unikalny
some_add_info: jakieś dodatkowe informacje
example: przykład
create: Utwórz
delete: Usuń
mailr: MailR
save: Zapisz
copy: Skopiuj
@ -186,11 +192,10 @@ pl:
kbytes: kB
mbytes: MB
site_link: https://github.com/lmanolov/mailr
no_data: Brak danych
download: Pobierz
view: Pokaż
version: Wersja
set: Ustaw
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/servers" => "prefs#servers", :as => :prefs_servers
resources :contacts
post "contacts/ops"
get "contacts/export"
match "contacts/external" => "contacts#external", :as => :contacts_external
resources :contacts
#resources :folders
match "folders/index" => 'folders#index', :as => :folders
@ -30,15 +31,18 @@ Mailr::Application.routes.draw do
get "internal/imaperror"
get "internal/loginfailure"
get "internal/onlycanlogins"
match "internal/about" => 'internal#about' ,:as => :about
match "messages_ops/single" => 'messages_ops#single'
match "messages_ops/multi" => 'messages_ops#multi'
match "messages_ops/sendout_or_save" => 'messages_ops#sendout_or_save' ,:as =>:sendout_or_save
match "messages_ops/upload" => 'messages_ops#upload',:as => :upload
match "messages_ops/edit/:id" => 'messages_ops#edit', :as => :messages_ops_edit
root :to => "messages#index"
match "messages/index" => 'messages#index', :as => :messages
match "messages/compose" => 'messages#compose', :as => :compose
match "messages/compose/:cid" => 'messages#compose', :as => :compose_contact
#get "messages/refresh_status"
#get "messages/emptybin"
#match "messages/select/:id" => 'messages#select', :as => :messages_select
@ -64,8 +68,9 @@ Mailr::Application.routes.draw do
get "user/unknown"
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:
# 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.
ActiveRecord::Schema.define(:version => 20110908094506) do
ActiveRecord::Schema.define(:version => 20110913114841) do
create_table "contacts", :force => true do |t|
t.string "nick"
@ -23,18 +23,6 @@ ActiveRecord::Schema.define(:version => 20110908094506) do
t.datetime "updated_at"
end
create_table "events", :force => true do |t|
t.integer "user_id"
t.integer "priority"
t.text "description"
t.string "category"
t.datetime "start"
t.datetime "stop"
t.boolean "allday"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "folders", :force => true do |t|
t.string "name"
t.string "delim"
@ -66,6 +54,17 @@ ActiveRecord::Schema.define(:version => 20110908094506) do
t.datetime "updated_at"
end
create_table "notes", :force => true do |t|
t.integer "owner_id"
t.string "owner_type"
t.string "title"
t.text "content"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "notes", ["owner_id", "owner_type"], :name => "index_notes_on_owner_id_and_owner_type"
create_table "prefs", :force => true do |t|
t.string "theme"
t.string "locale"

View file

@ -40,6 +40,21 @@ module Mail
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

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;
}
.block #logo {
height: 65;
background-color: #EFF3E4;
}
div.block div.actions-bar {
margin: 5px;
}
@ -580,3 +575,11 @@ div.actiongroup {
margin: 5px 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">
<%= 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,"last_name",nil,"Doe",@contact.last_name) %>
<%= 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>
<%= raw single_action('save','common','save.png') %>

View file

@ -1,31 +1,25 @@
<div class="inner">
<div class="actions-bar wat-cf">
<span class="other_info"> <%= t(:total_entries,:scope=>:contact) %>: <%= @contacts.total_entries %></span>
</div>
<%= will_paginate @contacts %>
</div>
<table class="table">
<tbody>
<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 %>
<th class="last"></th>
</tr>
<% trclass = :even %>
<% @contacts.each do |c| %>
<tr class="<%= trclass.to_s %>">
<%= render :partial => 'contacts/row', :object => c %>
<%= render :partial => 'contacts/contact', :object => c %>
</tr>
<% trclass == :even ? trclass = :odd : trclass = :even %>
<% end %>
</tbody>
</table>
<div class="actions-bar wat-cf">
<%= will_paginate @contacts %>
</div>
</div>

View file

@ -1,5 +1,3 @@
<div id="ops" class="ops">
<p>
<%= raw group_action(@buttons) %>
</p>
</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 class="content">
<%= form_tag(contacts_ops_path,{:name=>'contacts'})%>
<% if @contacts.size.zero? %>
<h3><%= t(:no_entries,:scope=>:contact) %></h3>
<%= raw single_action('create_new','contact','plus.png') %>
</form>
<% else %>
<%= render :partial => 'ops' %>
<%= render :partial => 'list' %>
<% end %>
</form>
<% end %>
<%= render :partial => 'external' %>
</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">
<%= t(:version) %>: <%= $defaults["version"] %>
<%= link_to (t(:version,:scope=>:common) + " " + $defaults["version"]),about_path %>
</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="wrapper" class="wat-cf">
<div id="sidebar">
<div id="logo"><img src="<%= current_theme_image_path('logo_small.png')%>" alt="Mailr"/></div>
<div id="sidebar"><%= yield :sidebar %></div>
<%= yield :sidebar %>
</div>
<div id="main">
<div class="flash">

View file

@ -11,6 +11,6 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
</head>
<body>
<%= 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>
</html>

View file

@ -1,5 +1,5 @@
<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;
<%= file_field 'upload', 'datafile' %>
<%= raw single_action('send_file','compose','up.png') %>

View file

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

View file

@ -21,6 +21,9 @@
20
) %>
</div>
<% if !@olduid.nil? %>
<%= hidden_field_tag 'olduid', @olduid %>
<% end %>
<%= raw group_action(@buttons) %>
<%= render :partial=> 'messages/file_attachs' %>
</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 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>
<h2><%= t(:setup,:scope=>:user) %></h2>
<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
#DAYNAMES = [:mon, :tue, :wed, :thu, :fri, :sat, :sun]
def calendar(yeard,monthd,addMonths)
module CalendarViewHelper
def calendar_small(options={})
now = DateTime.now
first = 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 << "</h3><div class=\"content\">"
html << "<table class=\"side_calendar width100\">"
html << "<tr><td></td>"
html << "<tr><td></td>"
1.upto(6) do |i|
html << "<td class=\"wday\">#{t(:abbr_day_names,:scope=>:date)[i]}</td>"
end
html << "<td class=\"wday\">#{t(:abbr_day_names,:scope=>:date)[0]}</td>"
html << "</tr>"
html << "<tr>"
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'
class EventsControllerTest < ActionController::TestCase
class CalendarViewTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
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