##// END OF EJS Templates
Account information can now be sent to the user when creating an account....
Account information can now be sent to the user when creating an account. ActionMailer logger set to nil for production environment to disable email contents output in production.log git-svn-id: http://redmine.rubyforge.org/svn/trunk@546 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r517:df0a49ff1447
r543:f04225321c3e
Show More
feeds_controller.rb
98 lines | 3.8 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
* news rss feed added...
r118 # redMine - project management software
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 # Copyright (C) 2006-2007 Jean-Philippe Lang
Jean-Philippe Lang
* news rss feed added...
r118 #
# 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 FeedsController < ApplicationController
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 before_filter :find_scope
Jean-Philippe Lang
* news rss feed added...
r118 session :off
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336
helper :issues
include IssuesHelper
helper :custom_fields
include CustomFieldsHelper
# news feeds
Jean-Philippe Lang
* news rss feed added...
r118 def news
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 News.with_scope(:find => @find_options) do
Jean-Philippe Lang
added a setting option to set the feeds content limit...
r343 @news = News.find :all, :order => "#{News.table_name}.created_on DESC", :include => [ :author, :project ]
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 end
Jean-Philippe Lang
deprecated @headers replaced...
r191 headers["Content-Type"] = "application/rss+xml"
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 render :action => 'news_atom' if 'atom' == params[:format]
end
# issue feeds
def issues
Jean-Philippe Lang
fixed #9398 RSS feed on custom reports not displaying subproject changes...
r355 if @project && params[:query_id]
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 query = Query.find(params[:query_id])
Jean-Philippe Lang
"me" value is now available in queries for "assigned to" and "author" filters....
r517 query.executed_by = @user
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 # ignore query if it's not valid
query = nil unless query.valid?
Jean-Philippe Lang
fixed #9398 RSS feed on custom reports not displaying subproject changes...
r355 # override with query conditions
@find_options[:conditions] = query.statement if query.valid? and @project == query.project
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 end
Issue.with_scope(:find => @find_options) do
Jean-Philippe Lang
Fixed: error when using a custom query feed with custom field filter....
r454 @issues = Issue.find :all, :include => [:project, :author, :tracker, :status, :custom_values],
Jean-Philippe Lang
fixed #9398 RSS feed on custom reports not displaying subproject changes...
r355 :order => "#{Issue.table_name}.created_on DESC"
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 end
@title = (@project ? @project.name : Setting.app_title) + ": " + (query ? query.name : l(:label_reported_issues))
headers["Content-Type"] = "application/rss+xml"
render :action => 'issues_atom' if 'atom' == params[:format]
end
# issue changes feeds
Jean-Philippe Lang
fixed #9398 RSS feed on custom reports not displaying subproject changes...
r355 def history
if @project && params[:query_id]
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 query = Query.find(params[:query_id])
Jean-Philippe Lang
"me" value is now available in queries for "assigned to" and "author" filters....
r517 query.executed_by = @user
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 # ignore query if it's not valid
query = nil unless query.valid?
Jean-Philippe Lang
fixed #9398 RSS feed on custom reports not displaying subproject changes...
r355 # override with query conditions
@find_options[:conditions] = query.statement if query.valid? and @project == query.project
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 end
Journal.with_scope(:find => @find_options) do
Jean-Philippe Lang
Fixed: error when using a custom query feed with custom field filter....
r454 @journals = Journal.find :all, :include => [ :details, :user, {:issue => [:project, :author, :tracker, :status, :custom_values]} ],
Jean-Philippe Lang
fixed #9398 RSS feed on custom reports not displaying subproject changes...
r355 :order => "#{Journal.table_name}.created_on DESC"
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 end
@title = (@project ? @project.name : Setting.app_title) + ": " + (query ? query.name : l(:label_reported_issues))
headers["Content-Type"] = "application/rss+xml"
render :action => 'history_atom' if 'atom' == params[:format]
end
private
# override for feeds specific authentication
def check_if_login_required
@user = User.find_by_rss_key(params[:key])
render(:nothing => true, :status => 403) and return false if !@user && Setting.login_required?
end
def find_scope
if params[:project_id]
# project feed
# check if project is public or if the user is a member
@project = Project.find(params[:project_id])
Jean-Philippe Lang
Various code cleaning, mainly on User, Permission and IssueStatus models....
r411 render(:nothing => true, :status => 403) and return false unless @project.is_public? || (@user && @user.role_for_project(@project))
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 scope = ["#{Project.table_name}.id=?", params[:project_id].to_i]
else
# global feed
scope = ["#{Project.table_name}.is_public=?", true]
end
Jean-Philippe Lang
added a setting option to set the feeds content limit...
r343 @find_options = {:conditions => scope, :limit => Setting.feeds_limit}
Jean-Philippe Lang
added rss/atom feeds at project levels for:...
r336 return true
Jean-Philippe Lang
* news rss feed added...
r118 end
end