You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

context_menus_controller.rb 3.6 kB

13 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # Redmine - project management software
  2. # Copyright (C) 2006-2013 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 ContextMenusController < ApplicationController
  18. helper :watchers
  19. helper :issues
  20. def issues
  21. @issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project)
  22. (render_404; return) unless @issues.present?
  23. if (@issues.size == 1)
  24. @issue = @issues.first
  25. end
  26. @issue_ids = @issues.map(&:id).sort
  27. @allowed_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
  28. @projects = @issues.collect(&:project).compact.uniq
  29. @project = @projects.first if @projects.size == 1
  30. @can = {:edit => User.current.allowed_to?(:edit_issues, @projects),
  31. :log_time => (@project && User.current.allowed_to?(:log_time, @project)),
  32. :update => (User.current.allowed_to?(:edit_issues, @projects) || (User.current.allowed_to?(:change_status, @projects) && !@allowed_statuses.blank?)),
  33. :move => (@project && User.current.allowed_to?(:move_issues, @project)),
  34. :copy => (@issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project)),
  35. :delete => User.current.allowed_to?(:delete_issues, @projects)
  36. }
  37. if @project
  38. if @issue
  39. @assignables = @issue.assignable_users
  40. else
  41. @assignables = @project.assignable_users
  42. end
  43. @trackers = @project.trackers
  44. else
  45. #when multiple projects, we only keep the intersection of each set
  46. @assignables = @projects.map(&:assignable_users).reduce(:&)
  47. @trackers = @projects.map(&:trackers).reduce(:&)
  48. end
  49. @versions = @projects.map {|p| p.shared_versions.open}.reduce(:&)
  50. @priorities = IssuePriority.active.reverse
  51. @back = back_url
  52. @options_by_custom_field = {}
  53. if @can[:edit]
  54. custom_fields = @issues.map(&:available_custom_fields).reduce(:&).select do |f|
  55. %w(bool list user version).include?(f.field_format) && !f.multiple?
  56. end
  57. custom_fields.each do |field|
  58. values = field.possible_values_options(@projects)
  59. if values.any?
  60. @options_by_custom_field[field] = values
  61. end
  62. end
  63. end
  64. @safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&)
  65. render :layout => false
  66. end
  67. def time_entries
  68. @time_entries = TimeEntry.all(
  69. :conditions => {:id => params[:ids]}, :include => :project)
  70. (render_404; return) unless @time_entries.present?
  71. @projects = @time_entries.collect(&:project).compact.uniq
  72. @project = @projects.first if @projects.size == 1
  73. @activities = TimeEntryActivity.shared.active
  74. @can = {:edit => User.current.allowed_to?(:edit_time_entries, @projects),
  75. :delete => User.current.allowed_to?(:edit_time_entries, @projects)
  76. }
  77. @back = back_url
  78. render :layout => false
  79. end
  80. end

软件技术创新是当今国家整体创新能力的重要基础和发展引擎。近年来,大众参与的软件创新与创业活动已经成为网络时代软件开发和应用的新形态,正在快速改变着全球软件创新模式和软件产业格局。 ...