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.

issues_controller.rb 40 kB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
10 years ago
​
10 years ago
​
10 years ago
​
10 years ago
​
​
​
​
​
10 years ago
​
​
10 years ago
​
10 years ago
​
10 years ago
​
​
​
​
​
​
​
​
10 years ago
​
​
​
​
​
​
10 years ago
​
​
​
​
​
​
​
​
​
​
​
10 years ago
10 years ago
​
​
​
​
​
​
​
10 years ago
​
​
​
​
​
​
​
​
​
​
10 years ago
​
​
​
​
​
​
​
​
​
​
​
​
10 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
10 years ago
10 years ago
​
​
​
10 years ago
​
10 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
10 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
11 years ago
​
​
​
​
​
11 years ago
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  1. #coding=utf-8
  2. # Redmine - project management software
  3. # Copyright (C) 2006-2013 Jean-Philippe Lang
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. class IssuesController < ApplicationController
  19. layout 'base_projects'#Added by young
  20. default_search_scope :issues
  21. before_filter :authorize1, :only => [:show]
  22. before_filter :find_issue, :only => [:show, :edit, :update,:add_journal, :add_journal_in_org]
  23. before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
  24. before_filter :find_project, :only => [:new, :create, :update_form, :issue_commits, :commit_for_issue, :issue_commit_delete]
  25. #before_filter :authorize, :except => [:index, :show]
  26. before_filter :authorize, :except => [:index,:add_journal, :add_journal_in_org,:delete_journal,:reply,:add_reply, :issue_commits, :commit_for_issue, :issue_commit_delete]
  27. before_filter :find_optional_project, :only => [:index]
  28. before_filter :check_for_default_issue_status, :only => [:new, :create]
  29. before_filter :build_new_issue_from_params, :only => [:new, :create, :update_form]
  30. accept_rss_auth :index, :show
  31. accept_api_auth :index, :show, :create, :update, :destroy
  32. rescue_from Query::StatementInvalid, :with => :query_statement_invalid
  33. helper :journals
  34. helper :projects
  35. include ProjectsHelper
  36. helper :custom_fields
  37. include CustomFieldsHelper
  38. helper :issue_relations
  39. include IssueRelationsHelper
  40. helper :watchers
  41. include WatchersHelper
  42. helper :attachments
  43. include AttachmentsHelper
  44. helper :queries
  45. include QueriesHelper
  46. helper :repositories
  47. include RepositoriesHelper
  48. helper :sort
  49. include SortHelper
  50. include IssuesHelper
  51. helper :timelog
  52. include Redmine::Export::PDF
  53. helper :project_score
  54. include ApplicationHelper
  55. # issue和代码提交id关联模块 --> over
  56. # 获取某个项目的commit_ids
  57. def issue_commits
  58. begin
  59. return render_404 if @project.gpid.nil?
  60. @issue_commit_ids = (params[:issue_commit_ids].is_a?(Array) ? params[:issue_commit_ids] : params[:issue_commit_ids].split(",")) unless params[:issue_commit_ids].nil?
  61. search = params[:search].to_s.strip
  62. @type = params[:type]
  63. limit = 15
  64. g = Gitlab.client
  65. g_project = g.project(@project.gpid)
  66. rev = params[:branch].nil? ? g_project.default_branch : params[:branch]
  67. @project_branches = g.branches(@project.gpid)
  68. @branch_names = @project_branches.map{|b| b.name}
  69. @default_branch = g_project.default_branch
  70. # 搜索的分页需要单独处理,因为搜索不容易获取总数
  71. if search.present?
  72. @commits = g.commits(@project.gpid, ref_name:rev, :search => search)
  73. @commits_count = @commits.count
  74. @commits_pages = Paginator.new @commits_count, limit, params['page'] || 1
  75. @offset ||= @commits_pages.offset
  76. @commits = paginateHelper @commits,limit
  77. else
  78. @commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s, ref_name:rev, :search => search)
  79. @commits_count = g.user_static(@project.gpid, :rev => rev).count
  80. @commits_pages = Redmine::Pagination::Paginator.new @commits_count, limit, params[:page]
  81. end
  82. rescue Exception => e
  83. puts e
  84. end
  85. end
  86. # 选择对应的Commit
  87. def commit_for_issue
  88. history_commit_ids = params[:issue_for_commit_ids].split(",") unless params[:issue_for_commit_ids].nil?
  89. @issue_commit_ids = (history_commit_ids.blank? ? params[:checkbox1] : params[:checkbox1] | history_commit_ids).uniq
  90. end
  91. def issue_commit_delete
  92. commit_id = params[:commit_id].split(",")
  93. issue_commit_ids = params[:issue_commit_ids]
  94. # issue_id存在则为issue详情或者编辑的时候,否则为新建Issue
  95. # 编辑和详情的时候需要在数据库中删除记录,新建的时候在内存中删除
  96. if params[:issue_id]
  97. commit_issue = CommitIssues.where(:commit_id => commit_id, :issue_id => params[:issue_id], :project_id => @project.id).first
  98. commit_issue.delete if commit_issue
  99. end
  100. @issue_commit_ids = issue_commit_ids - commit_id
  101. end
  102. # over
  103. def index
  104. # 顶部导航
  105. @project_menu_type = 2
  106. # 为了性能所有用了两种模式,issue的@query查询所有的没有优势
  107. # 但是对过滤条件很有有时
  108. if params[:set_filter] != "1"
  109. @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'
  110. if User.current.member_of?(@project)
  111. @issues_filter = Issue.where(:project_id => @project.id).order('updated_on desc')
  112. else
  113. @issues_filter = Issue.where(:project_id => @project.id, :is_private => 0).order('updated_on desc')
  114. end
  115. open_and_close_num(@project)
  116. @issue_count = @issues_filter.count
  117. @limit = 10
  118. @is_remote = true
  119. @issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
  120. @offset ||= @issue_pages.offset
  121. @issues = paginateHelper @issues_filter, @limit
  122. respond_to do |format|
  123. format.js
  124. format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young
  125. format.api {Issue.load_visible_relations(@issues) if include_in_api_response?('relations')}
  126. format.xls {filename = "#{@project.name.to_s}_#{l(:label_issue_list_xls)}.xls"
  127. send_data(issue_list_xls(@issues_filter), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
  128. }
  129. end
  130. else
  131. retrieve_query
  132. sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
  133. sort_update(@query.sortable_columns)
  134. @query.sort_criteria = sort_criteria.to_a
  135. @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'
  136. if @query.valid?
  137. @tracker_id = params[:tracker_id]
  138. @assign_to_id = params[:assigned_to_id]
  139. @author_id = params[:author_id]
  140. @priority_id = params[:priority_id]
  141. @status_id = params[:status_id]
  142. @subject = params[:subject]
  143. @done_ratio = params[:done_ratio]
  144. @fixed_version_id = params[:fixed_version_id]
  145. @issue_count = @query.issue_count
  146. @test = params[:test]
  147. @project_sort = 'issues.updated_on desc'
  148. if params[:test] != "0"
  149. case @test
  150. when "1"
  151. @project_sort = 'issues.created_on desc'
  152. when "2"
  153. @project_sort = 'issues.created_on asc'
  154. when "3"
  155. @project_sort = 'issues.updated_on desc'
  156. when "4"
  157. @project_sort = 'issues.updated_on asc'
  158. end
  159. end
  160. open_and_close_num(@project)
  161. @issues_filter_assign_count = @query.issues.select{|issue| issue.assigned_to_id == User.current.id }.count
  162. @issues_filter_author_count = @query.issues.select{|issue| issue.author_id == User.current.id }.count
  163. @issues_filter = @query.issues(:order => @project_sort)
  164. @limit = 10
  165. @is_remote = true
  166. @issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
  167. @offset ||= @issue_pages.offset
  168. @issues = paginateHelper @issues_filter, @limit
  169. respond_to do |format|
  170. format.js
  171. format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young
  172. format.api {Issue.load_visible_relations(@issues) if include_in_api_response?('relations')}
  173. # format.json { render :json => @issues.map { |issue| issue.to_json}} #:json => @issues.map { |issue| issue.to_json}
  174. format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") }
  175. format.csv { send_data(query_to_csv(@issues, @query, params), :type => 'text/csv; header=present', :filename => 'issues.csv') }
  176. format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'issues.pdf') }
  177. format.xls {filename = "#{@project.name.to_s}_#{l(:label_issue_list_xls)}.xls"
  178. send_data(issue_list_xls(@issues_filter), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
  179. }
  180. end
  181. else
  182. respond_to do |format|
  183. format.html { render(:template => 'issues/index', :layout => @project_base_tag) }#by young
  184. format.any(:atom, :csv, :pdf) { render(:nothing => true) }
  185. format.api { render_validation_errors(@query) }
  186. format.js
  187. end
  188. end
  189. end
  190. rescue ActiveRecord::RecordNotFound
  191. render_404
  192. end
  193. # 获取issue的开启统计数
  194. def open_and_close_num project
  195. if User.current.member_of?(project)
  196. @issue_open_count = Issue.where("project_id=#{project.id} and status_id in (1,2,3,4,6)").count
  197. @issue_close_count = Issue.where(:project_id => project.id, :status_id => 5 ).count
  198. else
  199. @issue_open_count = Issue.where("project_id=#{project.id} and status_id in (1,2,3,4,6) and is_private = 0").count
  200. @issue_close_count = Issue.where(:project_id => project.id, :status_id => 5, :is_private => 0).count
  201. end
  202. end
  203. def show
  204. # 顶部导航
  205. @project_menu_type = 2
  206. # 打开编辑内容
  207. @is_edit = true unless params[:edit].nil?
  208. # 当前用户查看指派给他的缺陷消息,则设置消息为已读
  209. query = ForgeMessage.where("forge_message_type =? and user_id =? and forge_message_id =?", "Issue", User.current, @issue).first
  210. query.update_attribute(:viewed, true) unless query.nil?
  211. # issue 关联的commit
  212. commit_issues = CommitIssues.where(:issue_id => @issue.id, :project_id => @issue.project_id)
  213. @issue_commit_ids = commit_issues.map{|commit_issue| commit_issue.commit_id}
  214. # issue 新建的at消息
  215. User.current.at_messages.unviewed('Issue', @issue.id).each {|x| x.viewed!}
  216. # 回复的at消息
  217. @issue.journals.each do |j|
  218. User.current.at_messages.unviewed('Journal', j.id).each {|x| x.viewed!}
  219. end
  220. # 缺陷状态消息更新
  221. query_journals_ids = @issue.journals.map{|journal| journal.id}
  222. if query_journals_ids.length > 0
  223. query_journals = ForgeMessage.where("user_id =? and forge_message_type =? and forge_message_id in (#{query_journals_ids.join(",")})", User.current.id, "Journal")
  224. query_journals.update_all(:viewed => true)
  225. end
  226. @jour_reply = Journal.new
  227. @journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id desc").all
  228. @journals = get_no_children_comments_all @journals
  229. @journals.each_with_index {|j,i| j.indice = i+1}
  230. @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
  231. @journals.reverse! if User.current.wants_comments_in_reverse_order?
  232. @changesets = @issue.changesets.visible.all
  233. @changesets.reverse! if User.current.wants_comments_in_reverse_order?
  234. @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
  235. @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
  236. @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
  237. @priorities = IssuePriority.active
  238. @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
  239. @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
  240. @available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
  241. @journal = Journal.new(:journalized => @issue)
  242. respond_to do |format|
  243. format.html {
  244. retrieve_previous_and_next_issue_ids
  245. render :template => 'issues/show', :layout => @project_base_tag#by young
  246. }
  247. format.js
  248. format.api
  249. format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
  250. format.pdf {
  251. pdf = issue_to_pdf(@issue, :journals => @journals)
  252. send_data(pdf, :type => 'application/pdf', :filename => filename_for_content_disposition("#{@project.identifier}-#{@issue.id}.pdf") )
  253. }
  254. end
  255. end
  256. # Add a new issue
  257. # The new issue will be created from an existing one if copy_from parameter is given
  258. def new
  259. # 顶部导航
  260. @project_menu_type = 2
  261. respond_to do |format|
  262. format.html { render :action => 'new', :layout => 'base_projects' }
  263. end
  264. end
  265. # 用户发布新issue
  266. def create
  267. call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
  268. @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
  269. # 给该issue在它所在的项目中所有的issues中所在的位置给一个序号
  270. @issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1
  271. @issue.fixed_version_id = nil if @issue.fixed_version_id == 0
  272. @issue.assigned_to_id = nil if @issue.assigned_to_id == 0
  273. if @issue.save
  274. # 关联commmit
  275. update_issue_commit params[:commit_ids]
  276. #params[:issue][:assigned_to_id] = nil if params[:issue][:assigned_to_id].to_i == 0
  277. senduser = User.find(params[:issue][:assigned_to_id])
  278. issue_id = @issue.id
  279. issue_title = params[:issue][:subject]
  280. priority_id = params[:issue][:priority_id]
  281. ps = ProjectsService.new
  282. if senduser.id != User.current.id
  283. ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
  284. end
  285. call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
  286. respond_to do |format|
  287. format.html {
  288. render_attachment_warning_if_needed(@issue)
  289. #flash[:notice] = l(:label_successful_create)
  290. #flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("#{@issue.subject}", issue_path(@issue), :title => @issue.subject))
  291. #flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject))
  292. if params[:continue]
  293. attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?}
  294. redirect_to new_project_issue_url(@issue.project, :issue => attrs)
  295. else
  296. redirect_to issue_url(@issue.id)
  297. end
  298. }
  299. format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) }
  300. end
  301. return
  302. else
  303. respond_to do |format|
  304. format.html { render :action => 'new' }
  305. format.api { render_validation_errors(@issue) }
  306. end
  307. end
  308. end
  309. def edit
  310. # 修改实例变量的值
  311. return unless update_issue_from_params
  312. # issue 关联的commit
  313. commit_issues = CommitIssues.where(:issue_id => @issue.id, :project_id => @issue.project_id)
  314. @issue_commit_ids = commit_issues.map{|commit_issue| commit_issue.commit_id}
  315. respond_to do |format|
  316. format.html {render :layout => 'base_projects' }#added by young
  317. format.xml { }
  318. end
  319. end
  320. # 用户编辑更改issue
  321. def update
  322. # params[:assigned_to_id] = nil if params[:assigned_to_id].to_i == 0
  323. # params[:fixed_version_id] = nil if params[:fixed_version_id].to_i == 0
  324. if params[:issue_detail]
  325. issue = Issue.find(params[:id])
  326. issue = update_user_issue_detail(issue, params)
  327. @saved = update_user_issue_detail(issue, params)
  328. return
  329. else
  330. # 修改实例变量的值
  331. return unless update_issue_from_params
  332. @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
  333. @issue.assigned_to_id = nil if @issue.assigned_to_id == 0
  334. @issue.fixed_version_id = nil if @issue.fixed_version_id == 0
  335. saved = false
  336. begin
  337. @saved = @issue.save_issue_with_child_records(params, @time_entry)
  338. rescue ActiveRecord::StaleObjectError
  339. @conflict = true
  340. if params[:last_journal_id]
  341. @conflict_journals = @issue.journals_after(params[:last_journal_id]).all
  342. @conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
  343. end
  344. end
  345. end
  346. if @saved
  347. # 更新commit关联情况
  348. update_issue_commit params[:commit_ids]
  349. #修改界面增加跟踪者
  350. watcherlist = @issue.watcher_users
  351. select_users = []
  352. if params[:issue]
  353. if params[:issue][:watcher_user_ids]
  354. params[:issue][:watcher_user_ids].each do |user_id|
  355. select_users << User.find(user_id)
  356. end
  357. end
  358. end
  359. select_users.each do |user|
  360. if watcherlist.include? user
  361. else
  362. @issue.add_watcher user
  363. end
  364. end
  365. watcherlist.each do |user|
  366. if select_users.include? user
  367. else
  368. @issue.remove_watcher user
  369. end
  370. end
  371. render_attachment_warning_if_needed(@issue)
  372. reply_id = params[:reference_user_id].to_i
  373. if reply_id > 0
  374. JournalReply.add_reply(@issue.current_journal.id, reply_id, User.current.id)
  375. end
  376. #flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? 去掉这个notice,因为现在更新都是ajax操作
  377. respond_to do |format|
  378. format.js
  379. format.html { redirect_to issue_url(@issue.id) }
  380. format.api { render_api_ok }
  381. end
  382. else
  383. respond_to do |format|
  384. format.js
  385. format.html { render :action => 'edit' }
  386. format.api { render_validation_errors(@issue) }
  387. end
  388. end
  389. end
  390. # 保存issue的时候相关的commit操作
  391. # commit_ids => "9b9845ff,poor56el"
  392. def update_issue_commit commit_ids
  393. # 关联commmit
  394. commit_ids = params[:commit_ids]
  395. unless commit_ids.blank?
  396. commit_ids = commit_ids.split(",").uniq
  397. if params[:action] == "update"
  398. exist_commit_ids = CommitIssues.where(:issue_id => @issue, :project_id => @issue.project_id)
  399. unless exist_commit_ids.blank?
  400. exist_commit_ids = exist_commit_ids.map{|commit| commit.commit_id}
  401. commit_ids = commit_ids - exist_commit_ids
  402. end
  403. end
  404. commit_ids.each do |commit_id|
  405. CommitIssues.create(:commit_id => commit_id, :project_id => @issue.project_id, :issue_id => @issue.id)
  406. end
  407. end
  408. end
  409. def update_user_issue_detail(issue, params)
  410. case params[:type]
  411. when "status"
  412. issue.update_attribute(:status_id, params[:status_id])
  413. when "assigned"
  414. issue.update_attribute(:assigned_to_id, params[:assigned_to_id])
  415. when "ratio"
  416. issue.update_attribute(:done_ratio, params[:done_ratio])
  417. when "prior"
  418. issue.update_attribute(:priority_id, params[:priority_id])
  419. end
  420. end
  421. # Updates the issue form when changing the project, status or tracker
  422. # on issue creation/update
  423. def update_form
  424. end
  425. # Bulk edit/copy a set of issues
  426. def bulk_edit
  427. @issues.sort!
  428. @copy = params[:copy].present?
  429. @notes = params[:notes]
  430. if User.current.allowed_to?(:move_issues, @projects)
  431. @allowed_projects = Issue.allowed_target_projects_on_move
  432. if params[:issue]
  433. @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:issue][:project_id].to_s}
  434. if @target_project
  435. target_projects = [@target_project]
  436. end
  437. end
  438. end
  439. target_projects ||= @projects
  440. if @copy
  441. @available_statuses = [IssueStatus.default]
  442. else
  443. @available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
  444. end
  445. @custom_fields = target_projects.map{|p|p.all_issue_custom_fields}.reduce(:&)
  446. @assignables = target_projects.map(&:assignable_users).reduce(:&)
  447. @trackers = target_projects.map(&:trackers).reduce(:&)
  448. @versions = target_projects.map {|p| p.shared_versions.open}.reduce(:&)
  449. @categories = target_projects.map {|p| p.issue_categories}.reduce(:&)
  450. if @copy
  451. @attachments_present = @issues.detect {|i| i.attachments.any?}.present?
  452. @subtasks_present = @issues.detect {|i| !i.leaf?}.present?
  453. end
  454. @safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&)
  455. render :layout => false if request.xhr?
  456. end
  457. def bulk_update
  458. @issues.sort!
  459. @copy = params[:copy].present?
  460. attributes = parse_params_for_bulk_issue_attributes(params)
  461. unsaved_issue_ids = []
  462. moved_issues = []
  463. if @copy && params[:copy_subtasks].present?
  464. # Descendant issues will be copied with the parent task
  465. # Don't copy them twice
  466. @issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}}
  467. end
  468. @issues.each do |issue|
  469. issue.reload
  470. if @copy
  471. issue = issue.copy({},
  472. :attachments => params[:copy_attachments].present?,
  473. :subtasks => params[:copy_subtasks].present?
  474. )
  475. end
  476. journal = issue.init_journal(User.current, params[:notes])
  477. issue.safe_attributes = attributes
  478. call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue })
  479. if issue.save
  480. moved_issues << issue
  481. else
  482. # Keep unsaved issue ids to display them in flash error
  483. unsaved_issue_ids << issue.id
  484. end
  485. end
  486. set_flash_from_bulk_issue_save(@issues, unsaved_issue_ids)
  487. if params[:follow]
  488. if @issues.size == 1 && moved_issues.size == 1
  489. redirect_to issue_url(moved_issues.first)
  490. elsif moved_issues.map(&:project).uniq.size == 1
  491. redirect_to project_issues_url(moved_issues.map(&:project).first)
  492. end
  493. else
  494. redirect_back_or_default _project_issues_path(@project)
  495. end
  496. end
  497. def destroy
  498. # 增加删除页面类型,如果是个人主页,则返回该主页,项目动态则返回项目动态页眉
  499. page_classify = params[:page_classify] unless params[:page_classify].nil?
  500. page_id = params[:page_id] unless params[:page_id].nil?
  501. @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f
  502. if @hours > 0
  503. case params[:todo]
  504. when 'destroy'
  505. # nothing to do
  506. when 'nullify'
  507. TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues])
  508. when 'reassign'
  509. reassign_to = @project.issues.find_by_id(params[:reassign_to_id])
  510. if reassign_to.nil?
  511. flash.now[:error] = l(:error_issue_not_found_in_project)
  512. return
  513. else
  514. TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues])
  515. end
  516. else
  517. # display the destroy form if it's a user request
  518. return unless api_request?
  519. end
  520. end
  521. @issues.each do |issue|
  522. begin
  523. issue.reload.destroy
  524. rescue ::ActiveRecord::RecordNotFound # raised by #reload if issue no longer exists
  525. # nothing to do, issue was already deleted (eg. by a parent)
  526. end
  527. end
  528. respond_to do |format|
  529. if page_classify
  530. format.html { redirect_back_or_default _project_issues_path(@project, page_classify, page_id) }
  531. else
  532. format.html { redirect_back_or_default _project_issues_path(@project) }
  533. end
  534. format.api { render_api_ok }
  535. end
  536. end
  537. def add_journal
  538. if User.current.logged?
  539. jour = Journal.new
  540. jour.user_id = User.current.id
  541. jour.notes = params[:notes]
  542. jour.journalized = @issue
  543. jour.save_attachments(params[:attachments])
  544. jour.save
  545. update_user_activity(@issue.class,@issue.id)
  546. update_forge_activity(@issue.class,@issue.id)
  547. @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
  548. @user_activity_id = params[:user_activity_id]
  549. @priorities = IssuePriority.active
  550. respond_to do |format|
  551. # Issue详情单独处理
  552. if params[:is_issue_show]
  553. format.js{redirect_to issue_path(@issue)}
  554. else
  555. format.js
  556. end
  557. end
  558. end
  559. end
  560. def add_journal_in_org
  561. if User.current.logged?
  562. jour = Journal.new
  563. jour.user_id = User.current.id
  564. jour.notes = params[:notes]
  565. jour.journalized = @issue
  566. jour.save
  567. org_activity = OrgActivity.where("org_act_type='Issue' and org_act_id =#{@issue.id}").first
  568. org_activity.updated_at = jour.created_on
  569. org_activity.save
  570. @user_activity_id = params[:user_activity_id]
  571. respond_to do |format|
  572. format.js
  573. end
  574. end
  575. end
  576. #对某个journ回复,显示回复框
  577. def reply
  578. @issue = Issue.find(params[:id])
  579. @jour = Journal.find(params[:journal_id])
  580. respond_to do |format|
  581. format.js
  582. end
  583. end
  584. #给issue添加journ。回复内容包含 对某个被回复的journ的内容
  585. def add_reply
  586. if User.current.logged?
  587. jour = Journal.find(params[:journal_id])
  588. @issue = Issue.find params[:id]
  589. @project = @issue.project
  590. @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
  591. @priorities = IssuePriority.active
  592. new_jour = Journal.new
  593. new_jour.user_id = User.current.id
  594. new_jour.reply_id = params[:journal_id]
  595. new_jour.parent_id = jour.id
  596. new_jour.notes = params[:content]
  597. new_jour.journalized = @issue
  598. new_jour.save_attachments(params[:attachments])
  599. # new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id)
  600. @user_activity_id = params[:user_activity_id]
  601. if new_jour.save
  602. update_user_activity(@issue.class,@issue.id)
  603. update_forge_activity(@issue.class,@issue.id)
  604. respond_to do |format|
  605. if params[:is_issue_show]
  606. format.js{redirect_to issue_path(@issue)}
  607. else
  608. format.js
  609. end
  610. end
  611. end
  612. end
  613. end
  614. # 需要刷新详情页面,代码同步一致
  615. # 获取project和issue状态是为了刷新页面
  616. # 值所以用delete是因为issue和journal在act_as_attachment中是同一个类型
  617. # 非动态页面直接刷新,动态页面手动刷新
  618. def delete_journal
  619. @is_project = params[:is_project]
  620. @issue = Issue.find(params[:id])
  621. begin
  622. forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id])
  623. forge_acts.destroy_all unless forge_acts.empty?
  624. at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id])
  625. at_message.destroy_all unless at_message.empty?
  626. Journal.delete(params[:journal_id])
  627. rescue Exception => e
  628. puts e
  629. end
  630. @user_activity_id = params[:user_activity_id]
  631. respond_to do |format|
  632. if @user_activity_id
  633. format.js
  634. else
  635. format.js{ redirect_to issue_url(@issue)}
  636. end
  637. end
  638. end
  639. def statistics
  640. @project = Project.find(params[:id])
  641. params[:author_id].to_i != 0 ? (@author = User.find(params[:author_id].to_i).show_name) : @author = 0
  642. case params[:tracker_id].to_i
  643. when 1
  644. @tracker = "缺陷"
  645. when 2
  646. @tracker = "功能"
  647. when 3
  648. @tracker = "支持"
  649. when 4
  650. @tracker = "任务"
  651. when 5
  652. @tracker = "周报"
  653. when 0
  654. @tracker = 0
  655. end
  656. params[:subject].blank? ? @search = 0 : @search = params[:subject]
  657. params[:assigned_to_id].to_i != 0 ? (@assigned = User.find(params[:assigned_to_id].to_i).show_name) : @assigned = 0
  658. params[:fixed_version_id].to_i != 0 ? (@version = Version.find(params[:fixed_version_id].to_i).name) : @version = 0
  659. params[:done_ratio].to_i != -1 ? (@done = params[:done_ratio].to_i) : @done = -1
  660. case params[:priority_id].to_i
  661. when 1
  662. @prior = "低"
  663. when 2
  664. @prior = "正常"
  665. when 3
  666. @prior = "高"
  667. when 4
  668. @prior = "紧急"
  669. when 5
  670. @prior = "立刻"
  671. when 0
  672. @prior = 0
  673. end
  674. case params[:status_id].to_i
  675. when 1
  676. @status = "新增"
  677. when 2
  678. @status = "正在解决"
  679. when 3
  680. @status = "已解决"
  681. when 4
  682. @status = "反馈"
  683. when 5
  684. @status = "关闭"
  685. when 6
  686. @status = "拒绝"
  687. when 0
  688. @status = 0
  689. end
  690. params[:issue_create_date_start].blank? ? @start_time = 0 : @start_time = params[:issue_create_date_start]
  691. params[:issue_create_date_end].blank? ? @end_time = 0 : @end_time = params[:issue_create_date_end]
  692. @filter_condition = true
  693. @filter_condition = false if (@author == 0 && @tracker == 0 && @search == 0 && @assigned == 0 && @version == 0 && @done == -1 && @prior ==0 && @status == 0 && @start_time ==0 && @end_time)
  694. if @project.nil?
  695. render_404
  696. end
  697. retrieve_query
  698. sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
  699. sort_update(@query.sortable_columns)
  700. @query.sort_criteria = sort_criteria.to_a
  701. @project_base_tag = 'base_projects'
  702. if @query.valid?
  703. @tracker_id = params[:tracker_id]
  704. @assign_to_id = params[:assigned_to_id]
  705. @author_id = params[:author_id]
  706. @priority_id = params[:priority_id]
  707. @status_id = params[:status_id]
  708. @subject = params[:subject]
  709. @done_ratio = params[:done_ratio]
  710. @fixed_version_id = params[:fixed_version_id]
  711. @issue_count = @query.issue_count
  712. @test = params[:test]
  713. @project_sort = 'issues.updated_on desc'
  714. if params[:test] != "0"
  715. case @test
  716. when "1"
  717. @project_sort = 'issues.created_on desc'
  718. when "2"
  719. @project_sort = 'issues.created_on asc'
  720. when "3"
  721. @project_sort = 'issues.updated_on desc'
  722. when "4"
  723. @project_sort = 'issues.updated_on asc'
  724. end
  725. end
  726. # 搜索结果
  727. # SELECT assigned_to_id, count(*) as ac FROM `issues` where project_id = @project.id group by assigned_to_id order by ac desc;
  728. @issues_filter = @query.issues.sort_by{ |i| Issue.where(:project_id => @project.id , :assigned_to_id => i.assigned_to_id).count }.reverse
  729. # @issues_filter = @query.issues(:order => @project_sort)
  730. # if params[:type] == 1 || params[:type].nil?
  731. # @results = @issues_filter
  732. # elsif params[:type] == "2"
  733. # @results = @issues_filter.collect{|result| result.status_id !=5 }
  734. # elsif params[:type] == "3"
  735. # @results = @issues_filter.collect{|result| result.status_id !=5 }
  736. # end
  737. #统计
  738. @results = {}
  739. #统计total
  740. @alltotal = {}
  741. for i in 0..5 do
  742. @alltotal[i] = 0
  743. end
  744. @opentotal = {}
  745. for i in 0..5 do
  746. @opentotal[i] = 0
  747. end
  748. @closetotal = {}
  749. for i in 0..5 do
  750. @closetotal[i] = 0
  751. end
  752. #开启关闭
  753. @issue_open_count = 0
  754. @issue_close_count = 0
  755. @issues_filter.each do |issue|
  756. @alltotal[0] = @alltotal[0] + 1
  757. @alltotal[issue.tracker_id.to_i] = @alltotal[issue.tracker_id.to_i] + 1
  758. user_id = issue.assigned_to_id
  759. if issue.assigned_to_id.nil?
  760. user_id = 0
  761. end
  762. if !@results[user_id].nil?
  763. @results[user_id][0] = @results[user_id][0] + 1
  764. @results[user_id][issue.tracker_id.to_i] = @results[user_id][issue.tracker_id.to_i] + 1
  765. if issue.status_id.to_i == 5
  766. @issue_close_count = @issue_close_count + 1
  767. @results[user_id][12] = @results[user_id][12]+1
  768. @results[user_id][12+issue.tracker_id.to_i] = @results[user_id][12+issue.tracker_id.to_i]+1
  769. @closetotal[0] = @closetotal[0] + 1
  770. @closetotal[issue.tracker_id.to_i] = @closetotal[issue.tracker_id.to_i] + 1
  771. else
  772. @issue_open_count = @issue_open_count + 1
  773. @results[user_id][6] = @results[user_id][6]+1
  774. @results[user_id][6+issue.tracker_id.to_i] = @results[user_id][6+issue.tracker_id.to_i]+1
  775. @opentotal[0] = @opentotal[0] + 1
  776. @opentotal[issue.tracker_id.to_i] = @opentotal[issue.tracker_id.to_i] + 1
  777. end
  778. else
  779. @results[user_id] = {}
  780. tmpuser = User.find(user_id)
  781. @results[user_id][:name] = tmpuser.nil? ? "" : tmpuser.show_name
  782. #所有的
  783. @results[user_id][0] = 1
  784. for i in 1..17 do
  785. @results[user_id][i] = 0
  786. end
  787. # @results[user_id][1] = 0
  788. # @results[user_id][2] = 0
  789. # @results[user_id][3] = 0
  790. # @results[user_id][4] = 0
  791. # @results[user_id][5] = 0
  792. @results[user_id][issue.tracker_id.to_i] = 1
  793. #开启的 status_id = 12346
  794. # @results[user_id][6] = 0
  795. # @results[user_id][7] = 0
  796. # @results[user_id][8] = 0
  797. # @results[user_id][9] = 0
  798. # @results[user_id][10] = 0
  799. # @results[user_id][11] = 0
  800. #关闭的 status_id = 5
  801. # @results[user_id][12] = 0
  802. # @results[user_id][13] = 0
  803. # @results[user_id][14] = 0
  804. # @results[user_id][15] = 0
  805. # @results[user_id][16] = 0
  806. # @results[user_id][17] = 0
  807. if issue.status_id.to_i == 5
  808. @results[user_id][12] = 1
  809. @results[user_id][12+issue.tracker_id.to_i] = 1
  810. @issue_close_count = @issue_close_count+1
  811. @closetotal[0] = @closetotal[0] + 1
  812. @closetotal[issue.tracker_id.to_i] = @closetotal[issue.tracker_id.to_i] + 1
  813. else
  814. @issue_open_count = @issue_open_count+1
  815. @results[user_id][6] = 1
  816. @results[user_id][6+issue.tracker_id.to_i] = 1
  817. @opentotal[0] = @opentotal[0] + 1
  818. @opentotal[issue.tracker_id.to_i] = @opentotal[issue.tracker_id.to_i] + 1
  819. end
  820. end
  821. end
  822. respond_to do |format|
  823. format.js
  824. end
  825. else
  826. render_404
  827. end
  828. end
  829. private
  830. def find_project
  831. project_id = params[:project_id] || (params[:issue] && params[:issue][:project_id])
  832. @project = Project.find(project_id)
  833. rescue ActiveRecord::RecordNotFound
  834. render_404
  835. end
  836. def retrieve_previous_and_next_issue_ids
  837. retrieve_query_from_session
  838. if @query
  839. sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
  840. sort_update(@query.sortable_columns, 'issues_index_sort')
  841. limit = 500
  842. issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version])
  843. if (idx = issue_ids.index(@issue.id)) && idx < limit
  844. if issue_ids.size < 500
  845. @issue_position = idx + 1
  846. @issue_count = issue_ids.size
  847. end
  848. @prev_issue_id = issue_ids[idx - 1] if idx > 0
  849. @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1)
  850. end
  851. end
  852. end
  853. # Used by #edit and #update to set some common instance variables
  854. # from the params
  855. # TODO: Refactor, not everything in here is needed by #edit
  856. def update_issue_from_params
  857. @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
  858. @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
  859. @time_entry.attributes = params[:time_entry]
  860. # 更新issue状态时,journal表产生记录,返回@current_journal
  861. @issue.init_journal(User.current)
  862. issue_attributes = params[:issue]
  863. if issue_attributes && params[:conflict_resolution]
  864. case params[:conflict_resolution]
  865. when 'overwrite'
  866. issue_attributes = issue_attributes.dup
  867. issue_attributes.delete(:lock_version)
  868. when 'add_notes'
  869. issue_attributes = issue_attributes.slice(:notes)
  870. when 'cancel'
  871. redirect_to issue_url(@issue)
  872. return false
  873. end
  874. end
  875. if params[:action] == "update"
  876. senduser = User.find(params[:issue][:assigned_to_id])
  877. if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
  878. issue_id = @issue.id
  879. issue_title = params[:issue][:subject]
  880. priority_id = params[:issue][:priority_id]
  881. ps = ProjectsService.new
  882. ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
  883. end
  884. end
  885. @issue.safe_attributes = issue_attributes
  886. @priorities = IssuePriority.active
  887. @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
  888. true
  889. end
  890. # TODO: Refactor, lots of extra code in here
  891. # TODO: Changing tracker on an existing issue should not trigger this
  892. def build_new_issue_from_params
  893. if params[:id].blank?
  894. @issue = Issue.new
  895. if params[:copy_from]
  896. begin
  897. @copy_from = Issue.visible.find(params[:copy_from])
  898. @copy_attachments = params[:copy_attachments].present? || request.get?
  899. @copy_subtasks = params[:copy_subtasks].present? || request.get?
  900. @issue.copy_from(@copy_from, :attachments => @copy_attachments, :subtasks => @copy_subtasks)
  901. rescue ActiveRecord::RecordNotFound
  902. render_404
  903. return
  904. end
  905. end
  906. @issue.project = @project
  907. else
  908. @issue = @project.issues.visible.find(params[:id])
  909. end
  910. @issue.project = @project
  911. @issue.author ||= User.current
  912. # Tracker must be set before custom field values
  913. @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)
  914. if @issue.tracker.nil?
  915. render_error l(:error_no_tracker_in_project)
  916. return false
  917. end
  918. @issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date?
  919. @issue.safe_attributes = params[:issue]
  920. @priorities = IssuePriority.active
  921. @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true)
  922. @available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
  923. end
  924. def check_for_default_issue_status
  925. if IssueStatus.default.nil?
  926. render_error l(:error_no_default_issue_status)
  927. return false
  928. end
  929. end
  930. def parse_params_for_bulk_issue_attributes(params)
  931. attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
  932. attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
  933. if custom = attributes[:custom_field_values]
  934. custom.reject! {|k,v| v.blank?}
  935. custom.keys.each do |k|
  936. if custom[k].is_a?(Array)
  937. custom[k] << '' if custom[k].delete('__none__')
  938. else
  939. custom[k] = '' if custom[k] == '__none__'
  940. end
  941. end
  942. end
  943. attributes
  944. end
  945. end

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