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