Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

reports_controller.rb 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # Redmine - project management software
  2. # Copyright (C) 2006-2011 Jean-Philippe Lang
  3. #
  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. #
  9. # 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. #
  14. # 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. class ReportsController < ApplicationController
  18. menu_item :issues
  19. before_filter :find_project, :authorize, :find_issue_statuses
  20. def issue_report
  21. @trackers = @project.trackers
  22. @versions = @project.shared_versions.sort
  23. @priorities = IssuePriority.all
  24. @categories = @project.issue_categories
  25. @assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
  26. @authors = @project.users.sort
  27. @subprojects = @project.descendants.visible
  28. @issues_by_tracker = Issue.by_tracker(@project)
  29. @issues_by_version = Issue.by_version(@project)
  30. @issues_by_priority = Issue.by_priority(@project)
  31. @issues_by_category = Issue.by_category(@project)
  32. @issues_by_assigned_to = Issue.by_assigned_to(@project)
  33. @issues_by_author = Issue.by_author(@project)
  34. @issues_by_subproject = Issue.by_subproject(@project) || []
  35. render :template => "reports/issue_report"
  36. end
  37. def issue_report_details
  38. case params[:detail]
  39. when "tracker"
  40. @field = "tracker_id"
  41. @rows = @project.trackers
  42. @data = Issue.by_tracker(@project)
  43. @report_title = l(:field_tracker)
  44. when "version"
  45. @field = "fixed_version_id"
  46. @rows = @project.shared_versions.sort
  47. @data = Issue.by_version(@project)
  48. @report_title = l(:field_version)
  49. when "priority"
  50. @field = "priority_id"
  51. @rows = IssuePriority.all
  52. @data = Issue.by_priority(@project)
  53. @report_title = l(:field_priority)
  54. when "category"
  55. @field = "category_id"
  56. @rows = @project.issue_categories
  57. @data = Issue.by_category(@project)
  58. @report_title = l(:field_category)
  59. when "assigned_to"
  60. @field = "assigned_to_id"
  61. @rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
  62. @data = Issue.by_assigned_to(@project)
  63. @report_title = l(:field_assigned_to)
  64. when "author"
  65. @field = "author_id"
  66. @rows = @project.users.sort
  67. @data = Issue.by_author(@project)
  68. @report_title = l(:field_author)
  69. when "subproject"
  70. @field = "project_id"
  71. @rows = @project.descendants.visible
  72. @data = Issue.by_subproject(@project) || []
  73. @report_title = l(:field_subproject)
  74. end
  75. respond_to do |format|
  76. if @field
  77. format.html {}
  78. else
  79. format.html { redirect_to :action => 'issue_report', :id => @project }
  80. end
  81. end
  82. end
  83. private
  84. def find_issue_statuses
  85. @statuses = IssueStatus.find(:all, :order => 'position')
  86. end
  87. end