Added possibility to get plain email.

This commit is contained in:
Martin Edenhofer 2012-07-02 14:47:09 +02:00
parent 89316584f7
commit 7ef022c662
5 changed files with 34 additions and 2 deletions

View file

@ -21,8 +21,10 @@
<div class="row article" data-id="<%= article.id %>"> <div class="row article" data-id="<%= article.id %>">
<div class="avatar span1 thumbnails"> <div class="avatar span1 thumbnails">
<img class="thumbnail user-data" data-id="<%= article.created_by_id %>" src="<%= article.created_by.image %>" alt=""> <img class="thumbnail user-data" data-id="<%= article.created_by_id %>" src="<%= article.created_by.image %>" alt="">
<ul>
<li><% if article.article_type.name is 'email': %><a href="/ticket_article_plain/<%= article.id %>">Plain</a><% end %></li>
</ul>
</div> </div>
<div class="span8 well-muted article-message <% if article.internal is true: %> internal<% end %>"> <div class="span8 well-muted article-message <% if article.internal is true: %> internal<% end %>">
<% if article.from: %> <% if article.from: %>
<div> <div>

View file

@ -288,6 +288,26 @@ class TicketOverviewsController < ApplicationController
) )
end end
# GET /ticket_article_plain/1
def ticket_article_plain
# permissin check
list = Store.list(
:object => 'Ticket::Article::Mail',
:o_id => params[:id],
)
# find file
if list
file = Store.find(list.first)
send_data(
file.store_file.data,
:filename => file.filename,
:type => 'message/rfc822',
:disposition => 'inline'
)
end
end
# GET /ticket_customer # GET /ticket_customer
# GET /tickets_customer # GET /tickets_customer
def ticket_customer def ticket_customer

View file

@ -277,7 +277,7 @@ class Channel::EmailParser
:object => 'Ticket::Article::Mail', :object => 'Ticket::Article::Mail',
:o_id => article.id, :o_id => article.id,
:data => msg, :data => msg,
:filename => 'plain.msg', :filename => "ticket-#{ticket.number}-#{article.id}.eml",
:preferences => {} :preferences => {}
) )

View file

@ -250,6 +250,15 @@ class Ticket < ActiveRecord::Base
:attachments => self.attachments :attachments => self.attachments
} }
) )
# store mail plain
Store.add(
:object => 'Ticket::Article::Mail',
:o_id => self.id,
:data => message.to_s,
:filename => "ticket-#{ticket.number}-#{self.id}.eml",
:preferences => {}
)
end end
end end

View file

@ -10,6 +10,7 @@ module ExtraRoutes
map.match '/ticket_full/:id', :to => 'ticket_overviews#ticket_full' map.match '/ticket_full/:id', :to => 'ticket_overviews#ticket_full'
map.match '/ticket_attachment/:id', :to => 'ticket_overviews#ticket_attachment' map.match '/ticket_attachment/:id', :to => 'ticket_overviews#ticket_attachment'
map.match '/ticket_attachment_new', :to => 'ticket_overviews#ticket_attachment_new' map.match '/ticket_attachment_new', :to => 'ticket_overviews#ticket_attachment_new'
map.match '/ticket_article_plain/:id', :to => 'ticket_overviews#ticket_article_plain'
map.match '/ticket_history/:id', :to => 'ticket_overviews#ticket_history' map.match '/ticket_history/:id', :to => 'ticket_overviews#ticket_history'
map.match '/ticket_customer', :to => 'ticket_overviews#ticket_customer' map.match '/ticket_customer', :to => 'ticket_overviews#ticket_customer'
map.match '/ticket_overviews', :to => 'ticket_overviews#show' map.match '/ticket_overviews', :to => 'ticket_overviews#show'