Mercurial > hg > soundsoftware-site
comparison app/controllers/projects_controller.rb @ 442:753f1380d6bc cannam
Merge from branch "redmine-1.2"
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:41:04 +0100 |
parents | 73ff0e6a11b1 cbce1fd3b1b7 |
children | 350acce374a2 |
comparison
equal
deleted
inserted
replaced
252:adc8466df404 | 442:753f1380d6bc |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2009 Jean-Philippe Lang | 2 # Copyright (C) 2006-2011 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
126 end | 126 end |
127 else | 127 else |
128 Mailer.with_deliveries(params[:notifications] == '1') do | 128 Mailer.with_deliveries(params[:notifications] == '1') do |
129 @project = Project.new | 129 @project = Project.new |
130 @project.safe_attributes = params[:project] | 130 @project.safe_attributes = params[:project] |
131 @project.enabled_module_names = params[:enabled_modules] | |
132 if validate_parent_id && @project.copy(@source_project, :only => params[:only]) | 131 if validate_parent_id && @project.copy(@source_project, :only => params[:only]) |
133 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') | 132 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') |
134 flash[:notice] = l(:notice_successful_create) | 133 flash[:notice] = l(:notice_successful_create) |
135 redirect_to :controller => 'projects', :action => 'settings', :id => @project | 134 redirect_to :controller => 'projects', :action => 'settings', :id => @project |
136 elsif !@project.new_record? | 135 elsif !@project.new_record? |
152 # try to redirect to the requested menu item | 151 # try to redirect to the requested menu item |
153 redirect_to_project_menu_item(@project, params[:jump]) && return | 152 redirect_to_project_menu_item(@project, params[:jump]) && return |
154 end | 153 end |
155 | 154 |
156 @users_by_role = @project.users_by_role | 155 @users_by_role = @project.users_by_role |
157 @subprojects = @project.children.visible | 156 @subprojects = @project.children.visible.all |
158 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") | 157 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") |
159 @trackers = @project.rolled_up_trackers | 158 @trackers = @project.rolled_up_trackers |
160 | 159 |
161 cond = @project.project_condition(Setting.display_subprojects_issues?) | 160 cond = @project.project_condition(Setting.display_subprojects_issues?) |
162 | 161 |
165 :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false]) | 164 :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false]) |
166 @total_issues_by_tracker = Issue.visible.count(:group => :tracker, | 165 @total_issues_by_tracker = Issue.visible.count(:group => :tracker, |
167 :include => [:project, :status, :tracker], | 166 :include => [:project, :status, :tracker], |
168 :conditions => cond) | 167 :conditions => cond) |
169 | 168 |
170 TimeEntry.visible_by(User.current) do | 169 if User.current.allowed_to?(:view_time_entries, @project) |
171 @total_hours = TimeEntry.sum(:hours, | 170 @total_hours = TimeEntry.visible.sum(:hours, :include => :project, :conditions => cond).to_f |
172 :include => :project, | 171 end |
173 :conditions => cond).to_f | 172 |
174 end | |
175 @key = User.current.rss_key | 173 @key = User.current.rss_key |
176 | 174 |
177 respond_to do |format| | 175 respond_to do |format| |
178 format.html | 176 format.html |
179 format.api | 177 format.api |