works but need some cleanup
This commit is contained in:
parent
0ec83db287
commit
e40a859b7d
752 changed files with 4866 additions and 27923 deletions
0
app/helpers/application_helper.rb
Normal file → Executable file
0
app/helpers/application_helper.rb
Normal file → Executable file
0
app/helpers/contact_group_helper.rb
Normal file → Executable file
0
app/helpers/contact_group_helper.rb
Normal file → Executable file
0
app/helpers/contacts_helper.rb
Normal file → Executable file
0
app/helpers/contacts_helper.rb
Normal file → Executable file
0
app/helpers/folders_helper.rb
Normal file → Executable file
0
app/helpers/folders_helper.rb
Normal file → Executable file
0
app/helpers/navigation_helper.rb
Normal file → Executable file
0
app/helpers/navigation_helper.rb
Normal file → Executable file
63
app/helpers/webmail_helper.rb
Normal file → Executable file
63
app/helpers/webmail_helper.rb
Normal file → Executable file
|
@ -6,35 +6,35 @@ module WebmailHelper
|
|||
def link_compose_new
|
||||
link_to(t(:compose_txt), :controller=>"webmail", :action=>"compose")
|
||||
end
|
||||
|
||||
|
||||
def link_refresh
|
||||
link_to(t(:refresh), :controller=>"webmail", :action=>"refresh")
|
||||
end
|
||||
|
||||
|
||||
def link_message_list
|
||||
link_to(_('Message list'), :controller=>"webmail", :action=>"messages")
|
||||
end
|
||||
|
||||
|
||||
def link_reply_to_sender(msg_id)
|
||||
link_to(t(:reply), :controller=>"webmail", :action=>"reply", :params=>{"msg_id"=>msg_id})
|
||||
end
|
||||
|
||||
|
||||
def link_forward_message(msg_id)
|
||||
link_to(t(:forward), :controller=>"webmail", :action=>"forward", :params=>{"msg_id"=>msg_id})
|
||||
end
|
||||
|
||||
|
||||
def link_flag_for_deletion(msg_id)
|
||||
link_to(t(:delete), :controller=>"webmail", :action=>"delete", :params=>{"msg_id"=>msg_id})
|
||||
end
|
||||
|
||||
|
||||
def link_view_source(msg_id)
|
||||
link_to(t(:view_source), {:controller=>"webmail", :action=>"view_source", :params=>{"msg_id"=>msg_id}}, {'target'=>"_blank"})
|
||||
end
|
||||
|
||||
|
||||
def link_filter_add
|
||||
link_to(t(:add_filter), :controller=>'webmail', :action=>'filter_add')
|
||||
end
|
||||
|
||||
|
||||
def folder_link(folder)
|
||||
return folder.name if folder.attribs.include?(:Noselect)
|
||||
folder_name = short_fn(folder)
|
||||
|
@ -42,7 +42,8 @@ module WebmailHelper
|
|||
title = folder.unseen > 0 ? "#{folder_name} (#{folder.unseen})" : "#{folder_name}"
|
||||
link = link_to title, :controller => 'webmail', :action => 'messages', :folder_name => folder.name
|
||||
link = content_tag('b', link) if folder.name == @folder_name
|
||||
link += ' ' + empty_trash_link(folder.name) if folder.trash?
|
||||
link += raw(' ' + empty_trash_link(folder.name)) if folder.trash?
|
||||
logger.info link
|
||||
link
|
||||
end
|
||||
|
||||
|
@ -58,7 +59,7 @@ module WebmailHelper
|
|||
d.strftime("%H:%M")
|
||||
else
|
||||
d.strftime("%Y-%m-%d")
|
||||
end
|
||||
end
|
||||
rescue
|
||||
begin
|
||||
d = imap2time(datestr)
|
||||
|
@ -66,43 +67,43 @@ module WebmailHelper
|
|||
d.strftime("%H:%M")
|
||||
else
|
||||
d.strftime("%Y-%m-%d")
|
||||
end
|
||||
end
|
||||
rescue
|
||||
datestr
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def attachment(att, index)
|
||||
ret = "#{att.filename}"
|
||||
# todo: add link to delete attachment
|
||||
#ret <<
|
||||
#ret <<
|
||||
ret << "<input type='hidden' name='att_files[#{index}]' value='#{att.filename}'/>"
|
||||
ret << "<input type='hidden' name='att_tfiles[#{index}]' value='#{att.temp_filename}'/>"
|
||||
ret << "<input type='hidden' name='att_ctypes[#{index}]' value='#{att.content_type}'/>"
|
||||
end
|
||||
|
||||
|
||||
def link_filter_up(filter_id)
|
||||
link_to(_('Up'), :controller=>"webmail", :action=>"filter_up", :id=>filter_id)
|
||||
end
|
||||
|
||||
|
||||
def link_filter_down(filter_id)
|
||||
link_to(_('Down'), :controller=>"webmail", :action=>"filter_down", :id=>filter_id)
|
||||
end
|
||||
|
||||
|
||||
def link_filter_edit(filter_id)
|
||||
link_to(_('Edit'), :controller=>"webmail", :action=>"filter", :id=>filter_id)
|
||||
end
|
||||
|
||||
|
||||
def link_filter_delete(filter_id)
|
||||
link_to(_('Delete'), :controller=>"webmail", :action=>"filter_delete", :id=>filter_id)
|
||||
end
|
||||
|
||||
|
||||
def page_navigation_webmail(pages)
|
||||
nav = "<p class='paginator'><small>"
|
||||
|
||||
|
||||
nav << "(#{pages.length} #{t :pages}) "
|
||||
|
||||
|
||||
window_pages = pages.current.window.pages
|
||||
nav << "..." unless window_pages[0].first?
|
||||
for page in window_pages
|
||||
|
@ -114,27 +115,27 @@ module WebmailHelper
|
|||
end
|
||||
nav << "..." unless window_pages[-1].last?
|
||||
nav << " "
|
||||
|
||||
|
||||
nav << link_to(t(:first), :controller=>"webmail", :action=>'messages', :page=>@pages.first.number) << " | " unless @pages.current.first?
|
||||
nav << link_to(t(:prev), :controller=>"webmail", :action=>'messages', :page=>@pages.current.previous.number) << " | " if @pages.current.previous
|
||||
nav << link_to(t(:next), :controller=>"webmail", :action=>'messages', :page=>@pages.current.next.number) << " | " if @pages.current.next
|
||||
nav << link_to(t(:last), :controller=>"webmail", :action=>'messages', :page=>@pages.last.number) << " | " unless @pages.current.last?
|
||||
|
||||
|
||||
nav << "</small></p>"
|
||||
|
||||
|
||||
return nav
|
||||
end
|
||||
|
||||
def parse_subject(subject)
|
||||
begin
|
||||
if mime_encoded?(subject)
|
||||
if mime_decode(subject) == ''
|
||||
if mime_decode(subject) == ''
|
||||
_('(No subject)')
|
||||
else
|
||||
mime_decode(subject)
|
||||
end
|
||||
else
|
||||
if from_qp(subject) == ''
|
||||
if from_qp(subject) == ''
|
||||
_('(No subject)')
|
||||
else
|
||||
from_qp(subject)
|
||||
|
@ -143,17 +144,17 @@ module WebmailHelper
|
|||
rescue Exception => ex
|
||||
RAILS_DEFAULT_LOGGER.debug('Exception occured - #{ex}')
|
||||
return ""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def message_size(size)
|
||||
|
||||
def message_size(size)
|
||||
if size / (1024*1024) > 0
|
||||
return "#{(size / (1024*1024)).round} MB"
|
||||
elsif size / 1024 > 0
|
||||
elsif size / 1024 > 0
|
||||
return "#{(size / (1024)).round} KB"
|
||||
else
|
||||
return "#{size} B"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -161,6 +162,6 @@ module WebmailHelper
|
|||
def empty_trash_link(folder_name)
|
||||
link_to( "(#{t :empty})",
|
||||
{ :controller => "webmail", :action => "empty", :params=>{"folder_name"=>folder_name}},
|
||||
:confirm => t(:want_to_empty_trash_message))
|
||||
:confirm => t(:want_to_empty_trash_message))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue