Mercurial > hg > soundsoftware-site
comparison app/controllers/projects_controller.rb @ 441:cbce1fd3b1b7 redmine-1.2
Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:24:13 +0100 |
parents | 8661b858af72 |
children | 753f1380d6bc 0c939c159af4 |
comparison
equal
deleted
inserted
replaced
245:051f544170fe | 441:cbce1fd3b1b7 |
---|---|
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. |
115 end | 115 end |
116 else | 116 else |
117 Mailer.with_deliveries(params[:notifications] == '1') do | 117 Mailer.with_deliveries(params[:notifications] == '1') do |
118 @project = Project.new | 118 @project = Project.new |
119 @project.safe_attributes = params[:project] | 119 @project.safe_attributes = params[:project] |
120 @project.enabled_module_names = params[:enabled_modules] | |
121 if validate_parent_id && @project.copy(@source_project, :only => params[:only]) | 120 if validate_parent_id && @project.copy(@source_project, :only => params[:only]) |
122 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') | 121 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') |
123 flash[:notice] = l(:notice_successful_create) | 122 flash[:notice] = l(:notice_successful_create) |
124 redirect_to :controller => 'projects', :action => 'settings', :id => @project | 123 redirect_to :controller => 'projects', :action => 'settings', :id => @project |
125 elsif !@project.new_record? | 124 elsif !@project.new_record? |
141 # try to redirect to the requested menu item | 140 # try to redirect to the requested menu item |
142 redirect_to_project_menu_item(@project, params[:jump]) && return | 141 redirect_to_project_menu_item(@project, params[:jump]) && return |
143 end | 142 end |
144 | 143 |
145 @users_by_role = @project.users_by_role | 144 @users_by_role = @project.users_by_role |
146 @subprojects = @project.children.visible | 145 @subprojects = @project.children.visible.all |
147 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") | 146 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") |
148 @trackers = @project.rolled_up_trackers | 147 @trackers = @project.rolled_up_trackers |
149 | 148 |
150 cond = @project.project_condition(Setting.display_subprojects_issues?) | 149 cond = @project.project_condition(Setting.display_subprojects_issues?) |
151 | 150 |
154 :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false]) | 153 :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false]) |
155 @total_issues_by_tracker = Issue.visible.count(:group => :tracker, | 154 @total_issues_by_tracker = Issue.visible.count(:group => :tracker, |
156 :include => [:project, :status, :tracker], | 155 :include => [:project, :status, :tracker], |
157 :conditions => cond) | 156 :conditions => cond) |
158 | 157 |
159 TimeEntry.visible_by(User.current) do | 158 if User.current.allowed_to?(:view_time_entries, @project) |
160 @total_hours = TimeEntry.sum(:hours, | 159 @total_hours = TimeEntry.visible.sum(:hours, :include => :project, :conditions => cond).to_f |
161 :include => :project, | 160 end |
162 :conditions => cond).to_f | 161 |
163 end | |
164 @key = User.current.rss_key | 162 @key = User.current.rss_key |
165 | 163 |
166 respond_to do |format| | 164 respond_to do |format| |
167 format.html | 165 format.html |
168 format.api | 166 format.api |