This commit is contained in:
Wojciech Todryk 2011-07-21 11:14:07 +02:00
parent abfba98334
commit a7dd8c90c9
4 changed files with 96 additions and 0 deletions

43
app/models/imap_message.rb Executable file
View file

@ -0,0 +1,43 @@
require 'mail2screen'
class ImapMessage < ActiveRecord::Base
include Mail2Screen
def set_folder(folder)
@folder = folder
end
def full_body
@folder.mailbox.imap.uid_fetch(uid, "BODY[]").first.attr["BODY[]"]
end
def from_addr=(fa)
self.from = fa.to_yaml
self.from_flat = short_address(fa)
end
def from_addr
begin
YAML::load(from)
rescue Object
from
end
end
def to_addr=(ta)
self.to = ta.to_yaml
self.to_flat = short_address(ta)
end
def to_addr
begin
YAML::load(to)
rescue Object
to
end
end
def self.getAll(userName,folderName,sortOrder='date desc')
self.all(:conditions => ["username = ? and folder_name = ?", userName, folderName],:order => sortOrder)
end
end

View file

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

View file

@ -0,0 +1,31 @@
<h2 class="title"><%= @folder_name %></h2>
<% if @messages.size.zero? %>
<div class="flash"><div class="message notice"><p><%= t :no_messages_found %></p></div></div>
<% else %>
<div class="inner">
<table class="table">
<tbody>
<tr>
<th class="first"><input type="checkbox" name="allbox" onclick="checkAll(this.form)"/></th>
<% if @folder_name == CDF::CONFIG[:mail_sent] %>
<th><%= link_to(t(:to), :controller=>:webmail, :action=>:messages, :op=>'SORT', :page=>@page, :scc=>'to_flat')%></th>
<% else %>
<th><%= link_to(t(:from), :controller=>:webmail, :action=>:messages, :op=>'SORT', :page=>@page, :scc=>'from_flat')%></th>
<% end%>
<th><%= link_to(t(:subject), :controller=>:webmail, :action=>:messages, :op=>'SORT', :page=>@page, :scc=>'subject')%></th>
<th><%= link_to(t(:date), :controller=>:webmail, :action=>:messages, :op=>'SORT', :page=>@page, :scc=>'date')%></th>
<th><%= link_to(t(:size), :controller=>:webmail, :action=>:messages, :op=>'SORT', :page=>@page, :scc=>'size')%></th>
<th class="last">&nbsp;</th>
</tr>
<% for message in @messages %>
<%= render :partial => 'message_row', :object => message %>
<% end %>
</tbody>
</table>
<div class="actions-bar wat-cf">
<div class="pagination">
<span class="disabled prev_page">« Previous</span><span class="current">1</span><a rel="next" href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="#">6</a><a href="#">7</a><a href="#">8</a><a href="#">9</a><a href="#">10</a><a href="#">11</a><a rel="next" class="next_page" href="#">Next »</a>
</div>
</div>
<% end %>
</div>

View file

@ -0,0 +1,21 @@
<div id="msgops" class='<%=@ops_class%>'>
<p>
<%= submit_tag(t(:copy), :name=> 'op')%>
<%= submit_tag(t(:move), :name=>'op')%>
<%= t :marked_messages %>
<%= t :to_folder %>
<span id="destp">
<select name="cpdest" size="1">
<% for folder in @folders %>
<option value="<%=folder.name%>"><%=folder.name%></option>
<% end %>
</select>
</span>
</p>
<p>
<%= t :marked_messages %>
<%= submit_tag(t(:delete), :name=>'op')%>
<%= submit_tag(t(:mark_read), :name=>'op')%>
<%= submit_tag(t(:mark_unread), :name=>'op')%>
</p>
</div>