diff --git a/mailing_lists/app/controllers/mailing_lists_controller.rb b/mailing_lists/app/controllers/mailing_lists_controller.rb index ff05fbea7..c41bcda0d 100644 --- a/mailing_lists/app/controllers/mailing_lists_controller.rb +++ b/mailing_lists/app/controllers/mailing_lists_controller.rb @@ -22,6 +22,22 @@ class MailingListsController < ApplicationController # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy ] + + def messages + if params[:year] and params[:year].to_i > 1900 + @year = params[:year].to_i + if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 + @month = params[:month].to_i + end + end + @year ||= Date.today.year + @month ||= Date.today.month + @date_from = Date.civil(@year, @month, 1) + @date_to = (@date_from >> 1)-1 + + @messages = @mailing_list.messages.find(:all, :conditions => ["parent_id is null and sent_on>=? and sent_on<=?", @date_from, @date_to]) + render :layout => false if request.xhr? + end def add @mailing_list = MailingList.new(:project => @project, :admin => logged_in_user) diff --git a/mailing_lists/app/controllers/mailing_messages_controller.rb b/mailing_lists/app/controllers/mailing_messages_controller.rb new file mode 100644 index 000000000..05256ca37 --- /dev/null +++ b/mailing_lists/app/controllers/mailing_messages_controller.rb @@ -0,0 +1,34 @@ +# redMine - project management software +# Copyright (C) 2006-2007 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class MailingMessagesController < ApplicationController + layout 'base' + + before_filter :find_project, :authorize + + def show + + end + +private + def find_project + @message = MailingMessage.find(params[:id], :include => :mailing_list) + @project = @message.mailing_list.project + rescue ActiveRecord::RecordNotFound + render_404 + end +end diff --git a/mailing_lists/app/controllers/projects_controller.rb b/mailing_lists/app/controllers/projects_controller.rb index 0bd50fdb2..e546fecd9 100644 --- a/mailing_lists/app/controllers/projects_controller.rb +++ b/mailing_lists/app/controllers/projects_controller.rb @@ -79,6 +79,7 @@ class ProjectsController < ApplicationController def show @custom_values = @project.custom_values.find(:all, :include => :custom_field) @members = @project.members.find(:all, :include => [:user, :role]) + @mailing_lists = @project.mailing_lists @subprojects = @project.children if @project.children.size > 0 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC") @trackers = Tracker.find(:all, :order => 'position') diff --git a/mailing_lists/app/helpers/mailing_messages_helper.rb b/mailing_lists/app/helpers/mailing_messages_helper.rb new file mode 100644 index 000000000..d2446463d --- /dev/null +++ b/mailing_lists/app/helpers/mailing_messages_helper.rb @@ -0,0 +1,19 @@ +# redMine - project management software +# Copyright (C) 2006-2007 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module MailingMessagesHelper +end diff --git a/mailing_lists/app/models/mailing_message.rb b/mailing_lists/app/models/mailing_message.rb index 06e92e8cb..b1969f3bd 100644 --- a/mailing_lists/app/models/mailing_message.rb +++ b/mailing_lists/app/models/mailing_message.rb @@ -1,3 +1,20 @@ +# redMine - project management software +# Copyright (C) 2006-2007 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + class MailingMessage < ActiveRecord::Base belongs_to :mailing_list acts_as_tree :order => 'sent_on' diff --git a/mailing_lists/app/views/mailing_lists/_thread.rhtml b/mailing_lists/app/views/mailing_lists/_thread.rhtml new file mode 100644 index 000000000..35714c247 --- /dev/null +++ b/mailing_lists/app/views/mailing_lists/_thread.rhtml @@ -0,0 +1,9 @@ +<% unless messages.nil? || messages.empty? %> +
<%= l(:label_no_data) %>
+<% else %> +<%= render :partial => 'thread', :locals => {:messages => @messages} %> +<% end %> + +| + <%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), + {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }}, + {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))} + %> + | ++ <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'), + {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }}, + {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))} + %> + | +
<%= @message.from %>, <%= format_time(@message.sent_on) %>
+ +