annotate .svn/pristine/8e/8e2b9fee089af39ba59ee64ccb9baee42d90cb0a.svn-base @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children
rev   line source
Chris@1295 1 # Redmine - project management software
Chris@1295 2 # Copyright (C) 2006-2012 Jean-Philippe Lang
Chris@1295 3 #
Chris@1295 4 # This program is free software; you can redistribute it and/or
Chris@1295 5 # modify it under the terms of the GNU General Public License
Chris@1295 6 # as published by the Free Software Foundation; either version 2
Chris@1295 7 # of the License, or (at your option) any later version.
Chris@1295 8 #
Chris@1295 9 # This program is distributed in the hope that it will be useful,
Chris@1295 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1295 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@1295 12 # GNU General Public License for more details.
Chris@1295 13 #
Chris@1295 14 # You should have received a copy of the GNU General Public License
Chris@1295 15 # along with this program; if not, write to the Free Software
Chris@1295 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@1295 17
Chris@1295 18 class ReportsController < ApplicationController
Chris@1295 19 menu_item :issues
Chris@1295 20 before_filter :find_project, :authorize, :find_issue_statuses
Chris@1295 21
Chris@1295 22 def issue_report
Chris@1295 23 @trackers = @project.trackers
Chris@1295 24 @versions = @project.shared_versions.sort
Chris@1295 25 @priorities = IssuePriority.all.reverse
Chris@1295 26 @categories = @project.issue_categories
Chris@1295 27 @assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
Chris@1295 28 @authors = @project.users.sort
Chris@1295 29 @subprojects = @project.descendants.visible
Chris@1295 30
Chris@1295 31 @issues_by_tracker = Issue.by_tracker(@project)
Chris@1295 32 @issues_by_version = Issue.by_version(@project)
Chris@1295 33 @issues_by_priority = Issue.by_priority(@project)
Chris@1295 34 @issues_by_category = Issue.by_category(@project)
Chris@1295 35 @issues_by_assigned_to = Issue.by_assigned_to(@project)
Chris@1295 36 @issues_by_author = Issue.by_author(@project)
Chris@1295 37 @issues_by_subproject = Issue.by_subproject(@project) || []
Chris@1295 38
Chris@1295 39 render :template => "reports/issue_report"
Chris@1295 40 end
Chris@1295 41
Chris@1295 42 def issue_report_details
Chris@1295 43 case params[:detail]
Chris@1295 44 when "tracker"
Chris@1295 45 @field = "tracker_id"
Chris@1295 46 @rows = @project.trackers
Chris@1295 47 @data = Issue.by_tracker(@project)
Chris@1295 48 @report_title = l(:field_tracker)
Chris@1295 49 when "version"
Chris@1295 50 @field = "fixed_version_id"
Chris@1295 51 @rows = @project.shared_versions.sort
Chris@1295 52 @data = Issue.by_version(@project)
Chris@1295 53 @report_title = l(:field_version)
Chris@1295 54 when "priority"
Chris@1295 55 @field = "priority_id"
Chris@1295 56 @rows = IssuePriority.all.reverse
Chris@1295 57 @data = Issue.by_priority(@project)
Chris@1295 58 @report_title = l(:field_priority)
Chris@1295 59 when "category"
Chris@1295 60 @field = "category_id"
Chris@1295 61 @rows = @project.issue_categories
Chris@1295 62 @data = Issue.by_category(@project)
Chris@1295 63 @report_title = l(:field_category)
Chris@1295 64 when "assigned_to"
Chris@1295 65 @field = "assigned_to_id"
Chris@1295 66 @rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
Chris@1295 67 @data = Issue.by_assigned_to(@project)
Chris@1295 68 @report_title = l(:field_assigned_to)
Chris@1295 69 when "author"
Chris@1295 70 @field = "author_id"
Chris@1295 71 @rows = @project.users.sort
Chris@1295 72 @data = Issue.by_author(@project)
Chris@1295 73 @report_title = l(:field_author)
Chris@1295 74 when "subproject"
Chris@1295 75 @field = "project_id"
Chris@1295 76 @rows = @project.descendants.visible
Chris@1295 77 @data = Issue.by_subproject(@project) || []
Chris@1295 78 @report_title = l(:field_subproject)
Chris@1295 79 end
Chris@1295 80
Chris@1295 81 respond_to do |format|
Chris@1295 82 if @field
Chris@1295 83 format.html {}
Chris@1295 84 else
Chris@1295 85 format.html { redirect_to :action => 'issue_report', :id => @project }
Chris@1295 86 end
Chris@1295 87 end
Chris@1295 88 end
Chris@1295 89
Chris@1295 90 private
Chris@1295 91
Chris@1295 92 def find_issue_statuses
Chris@1295 93 @statuses = IssueStatus.find(:all, :order => 'position')
Chris@1295 94 end
Chris@1295 95 end