@@ -1,195 +1,197 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class IssuesController < ApplicationController |
|
18 | class IssuesController < ApplicationController | |
19 | layout 'base', :except => :export_pdf |
|
19 | layout 'base', :except => :export_pdf | |
20 | before_filter :find_project, :authorize, :except => :index |
|
20 | before_filter :find_project, :authorize, :except => :index | |
21 | accept_key_auth :index |
|
21 | accept_key_auth :index | |
22 |
|
22 | |||
23 | cache_sweeper :issue_sweeper, :only => [ :edit, :change_status, :destroy ] |
|
23 | cache_sweeper :issue_sweeper, :only => [ :edit, :change_status, :destroy ] | |
24 |
|
24 | |||
25 | helper :projects |
|
25 | helper :projects | |
26 | include ProjectsHelper |
|
26 | include ProjectsHelper | |
27 | helper :custom_fields |
|
27 | helper :custom_fields | |
28 | include CustomFieldsHelper |
|
28 | include CustomFieldsHelper | |
29 | helper :ifpdf |
|
29 | helper :ifpdf | |
30 | include IfpdfHelper |
|
30 | include IfpdfHelper | |
31 | helper :issue_relations |
|
31 | helper :issue_relations | |
32 | include IssueRelationsHelper |
|
32 | include IssueRelationsHelper | |
33 | helper :watchers |
|
33 | helper :watchers | |
34 | include WatchersHelper |
|
34 | include WatchersHelper | |
35 | helper :attachments |
|
35 | helper :attachments | |
36 | include AttachmentsHelper |
|
36 | include AttachmentsHelper | |
37 | helper :queries |
|
37 | helper :queries | |
38 | helper :sort |
|
38 | helper :sort | |
39 | include SortHelper |
|
39 | include SortHelper | |
40 |
|
40 | |||
41 | def index |
|
41 | def index | |
42 | sort_init "#{Issue.table_name}.id", "desc" |
|
42 | sort_init "#{Issue.table_name}.id", "desc" | |
43 | sort_update |
|
43 | sort_update | |
44 | retrieve_query |
|
44 | retrieve_query | |
45 | if @query.valid? |
|
45 | if @query.valid? | |
46 | @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement) |
|
46 | @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement) | |
47 | @issue_pages = Paginator.new self, @issue_count, 25, params['page'] |
|
47 | @issue_pages = Paginator.new self, @issue_count, 25, params['page'] | |
48 | @issues = Issue.find :all, :order => sort_clause, |
|
48 | @issues = Issue.find :all, :order => sort_clause, | |
49 | :include => [ :assigned_to, :status, :tracker, :project, :priority, :category ], |
|
49 | :include => [ :assigned_to, :status, :tracker, :project, :priority, :category ], | |
50 | :conditions => @query.statement, |
|
50 | :conditions => @query.statement, | |
51 | :limit => @issue_pages.items_per_page, |
|
51 | :limit => @issue_pages.items_per_page, | |
52 | :offset => @issue_pages.current.offset |
|
52 | :offset => @issue_pages.current.offset | |
53 | end |
|
53 | end | |
54 | respond_to do |format| |
|
54 | respond_to do |format| | |
55 | format.html { render :layout => false if request.xhr? } |
|
55 | format.html { render :layout => false if request.xhr? } | |
56 | format.atom { render_feed(@issues, :title => l(:label_issue_plural)) } |
|
56 | format.atom { render_feed(@issues, :title => l(:label_issue_plural)) } | |
57 | end |
|
57 | end | |
58 | end |
|
58 | end | |
59 |
|
59 | |||
60 | def show |
|
60 | def show | |
61 | @status_options = @issue.status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker) if logged_in_user |
|
|||
62 | @custom_values = @issue.custom_values.find(:all, :include => :custom_field) |
|
61 | @custom_values = @issue.custom_values.find(:all, :include => :custom_field) | |
63 | @journals = @issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC") |
|
62 | @journals = @issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC") | |
64 | end |
|
|||
65 |
|
63 | |||
66 | def export_pdf |
|
64 | if params[:format]=='pdf' | |
67 | @custom_values = @issue.custom_values.find(:all, :include => :custom_field) |
|
|||
68 | @options_for_rfpdf ||= {} |
|
65 | @options_for_rfpdf ||= {} | |
69 |
@options_for_rfpdf[:file_name] = "#{@project. |
|
66 | @options_for_rfpdf[:file_name] = "#{@project.identifier}-#{@issue.id}.pdf" | |
|
67 | render :template => 'issues/show.rfpdf', :layout => false | |||
|
68 | else | |||
|
69 | @status_options = @issue.status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker) if logged_in_user | |||
|
70 | render :template => 'issues/show.rhtml' | |||
|
71 | end | |||
70 | end |
|
72 | end | |
71 |
|
73 | |||
72 | def edit |
|
74 | def edit | |
73 | @priorities = Enumeration::get_values('IPRI') |
|
75 | @priorities = Enumeration::get_values('IPRI') | |
74 | if request.get? |
|
76 | if request.get? | |
75 | @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| @issue.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x, :customized => @issue) } |
|
77 | @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| @issue.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x, :customized => @issue) } | |
76 | else |
|
78 | else | |
77 | begin |
|
79 | begin | |
78 | @issue.init_journal(self.logged_in_user) |
|
80 | @issue.init_journal(self.logged_in_user) | |
79 | # Retrieve custom fields and values |
|
81 | # Retrieve custom fields and values | |
80 | @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) } |
|
82 | @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) } | |
81 | @issue.custom_values = @custom_values |
|
83 | @issue.custom_values = @custom_values | |
82 | @issue.attributes = params[:issue] |
|
84 | @issue.attributes = params[:issue] | |
83 | if @issue.save |
|
85 | if @issue.save | |
84 | flash[:notice] = l(:notice_successful_update) |
|
86 | flash[:notice] = l(:notice_successful_update) | |
85 | redirect_to :action => 'show', :id => @issue |
|
87 | redirect_to :action => 'show', :id => @issue | |
86 | end |
|
88 | end | |
87 | rescue ActiveRecord::StaleObjectError |
|
89 | rescue ActiveRecord::StaleObjectError | |
88 | # Optimistic locking exception |
|
90 | # Optimistic locking exception | |
89 | flash[:error] = l(:notice_locking_conflict) |
|
91 | flash[:error] = l(:notice_locking_conflict) | |
90 | end |
|
92 | end | |
91 | end |
|
93 | end | |
92 | end |
|
94 | end | |
93 |
|
95 | |||
94 | def add_note |
|
96 | def add_note | |
95 | unless params[:notes].empty? |
|
97 | unless params[:notes].empty? | |
96 | journal = @issue.init_journal(self.logged_in_user, params[:notes]) |
|
98 | journal = @issue.init_journal(self.logged_in_user, params[:notes]) | |
97 | if @issue.save |
|
99 | if @issue.save | |
98 | params[:attachments].each { |file| |
|
100 | params[:attachments].each { |file| | |
99 | next unless file.size > 0 |
|
101 | next unless file.size > 0 | |
100 | a = Attachment.create(:container => @issue, :file => file, :author => logged_in_user) |
|
102 | a = Attachment.create(:container => @issue, :file => file, :author => logged_in_user) | |
101 | journal.details << JournalDetail.new(:property => 'attachment', |
|
103 | journal.details << JournalDetail.new(:property => 'attachment', | |
102 | :prop_key => a.id, |
|
104 | :prop_key => a.id, | |
103 | :value => a.filename) unless a.new_record? |
|
105 | :value => a.filename) unless a.new_record? | |
104 | } if params[:attachments] and params[:attachments].is_a? Array |
|
106 | } if params[:attachments] and params[:attachments].is_a? Array | |
105 | flash[:notice] = l(:notice_successful_update) |
|
107 | flash[:notice] = l(:notice_successful_update) | |
106 | Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') |
|
108 | Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') | |
107 | redirect_to :action => 'show', :id => @issue |
|
109 | redirect_to :action => 'show', :id => @issue | |
108 | return |
|
110 | return | |
109 | end |
|
111 | end | |
110 | end |
|
112 | end | |
111 | show |
|
113 | show | |
112 | render :action => 'show' |
|
114 | render :action => 'show' | |
113 | end |
|
115 | end | |
114 |
|
116 | |||
115 | def change_status |
|
117 | def change_status | |
116 | @status_options = @issue.status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker) if logged_in_user |
|
118 | @status_options = @issue.status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker) if logged_in_user | |
117 | @new_status = IssueStatus.find(params[:new_status_id]) |
|
119 | @new_status = IssueStatus.find(params[:new_status_id]) | |
118 | if params[:confirm] |
|
120 | if params[:confirm] | |
119 | begin |
|
121 | begin | |
120 | journal = @issue.init_journal(self.logged_in_user, params[:notes]) |
|
122 | journal = @issue.init_journal(self.logged_in_user, params[:notes]) | |
121 | @issue.status = @new_status |
|
123 | @issue.status = @new_status | |
122 | if @issue.update_attributes(params[:issue]) |
|
124 | if @issue.update_attributes(params[:issue]) | |
123 | # Save attachments |
|
125 | # Save attachments | |
124 | params[:attachments].each { |file| |
|
126 | params[:attachments].each { |file| | |
125 | next unless file.size > 0 |
|
127 | next unless file.size > 0 | |
126 | a = Attachment.create(:container => @issue, :file => file, :author => logged_in_user) |
|
128 | a = Attachment.create(:container => @issue, :file => file, :author => logged_in_user) | |
127 | journal.details << JournalDetail.new(:property => 'attachment', |
|
129 | journal.details << JournalDetail.new(:property => 'attachment', | |
128 | :prop_key => a.id, |
|
130 | :prop_key => a.id, | |
129 | :value => a.filename) unless a.new_record? |
|
131 | :value => a.filename) unless a.new_record? | |
130 | } if params[:attachments] and params[:attachments].is_a? Array |
|
132 | } if params[:attachments] and params[:attachments].is_a? Array | |
131 |
|
133 | |||
132 | # Log time |
|
134 | # Log time | |
133 | if current_role.allowed_to?(:log_time) |
|
135 | if current_role.allowed_to?(:log_time) | |
134 | @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => logged_in_user, :spent_on => Date.today) |
|
136 | @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => logged_in_user, :spent_on => Date.today) | |
135 | @time_entry.attributes = params[:time_entry] |
|
137 | @time_entry.attributes = params[:time_entry] | |
136 | @time_entry.save |
|
138 | @time_entry.save | |
137 | end |
|
139 | end | |
138 |
|
140 | |||
139 | flash[:notice] = l(:notice_successful_update) |
|
141 | flash[:notice] = l(:notice_successful_update) | |
140 | Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') |
|
142 | Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') | |
141 | redirect_to :action => 'show', :id => @issue |
|
143 | redirect_to :action => 'show', :id => @issue | |
142 | end |
|
144 | end | |
143 | rescue ActiveRecord::StaleObjectError |
|
145 | rescue ActiveRecord::StaleObjectError | |
144 | # Optimistic locking exception |
|
146 | # Optimistic locking exception | |
145 | flash[:error] = l(:notice_locking_conflict) |
|
147 | flash[:error] = l(:notice_locking_conflict) | |
146 | end |
|
148 | end | |
147 | end |
|
149 | end | |
148 | @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user } |
|
150 | @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user } | |
149 | @activities = Enumeration::get_values('ACTI') |
|
151 | @activities = Enumeration::get_values('ACTI') | |
150 | end |
|
152 | end | |
151 |
|
153 | |||
152 | def destroy |
|
154 | def destroy | |
153 | @issue.destroy |
|
155 | @issue.destroy | |
154 | redirect_to :controller => 'projects', :action => 'list_issues', :id => @project |
|
156 | redirect_to :controller => 'projects', :action => 'list_issues', :id => @project | |
155 | end |
|
157 | end | |
156 |
|
158 | |||
157 | def destroy_attachment |
|
159 | def destroy_attachment | |
158 | a = @issue.attachments.find(params[:attachment_id]) |
|
160 | a = @issue.attachments.find(params[:attachment_id]) | |
159 | a.destroy |
|
161 | a.destroy | |
160 | journal = @issue.init_journal(self.logged_in_user) |
|
162 | journal = @issue.init_journal(self.logged_in_user) | |
161 | journal.details << JournalDetail.new(:property => 'attachment', |
|
163 | journal.details << JournalDetail.new(:property => 'attachment', | |
162 | :prop_key => a.id, |
|
164 | :prop_key => a.id, | |
163 | :old_value => a.filename) |
|
165 | :old_value => a.filename) | |
164 | journal.save |
|
166 | journal.save | |
165 | redirect_to :action => 'show', :id => @issue |
|
167 | redirect_to :action => 'show', :id => @issue | |
166 | end |
|
168 | end | |
167 |
|
169 | |||
168 | private |
|
170 | private | |
169 | def find_project |
|
171 | def find_project | |
170 | @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category]) |
|
172 | @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category]) | |
171 | @project = @issue.project |
|
173 | @project = @issue.project | |
172 | rescue ActiveRecord::RecordNotFound |
|
174 | rescue ActiveRecord::RecordNotFound | |
173 | render_404 |
|
175 | render_404 | |
174 | end |
|
176 | end | |
175 |
|
177 | |||
176 | # Retrieve query from session or build a new query |
|
178 | # Retrieve query from session or build a new query | |
177 | def retrieve_query |
|
179 | def retrieve_query | |
178 | if params[:set_filter] or !session[:query] or session[:query].project_id |
|
180 | if params[:set_filter] or !session[:query] or session[:query].project_id | |
179 | # Give it a name, required to be valid |
|
181 | # Give it a name, required to be valid | |
180 | @query = Query.new(:name => "_", :executed_by => logged_in_user) |
|
182 | @query = Query.new(:name => "_", :executed_by => logged_in_user) | |
181 | if params[:fields] and params[:fields].is_a? Array |
|
183 | if params[:fields] and params[:fields].is_a? Array | |
182 | params[:fields].each do |field| |
|
184 | params[:fields].each do |field| | |
183 | @query.add_filter(field, params[:operators][field], params[:values][field]) |
|
185 | @query.add_filter(field, params[:operators][field], params[:values][field]) | |
184 | end |
|
186 | end | |
185 | else |
|
187 | else | |
186 | @query.available_filters.keys.each do |field| |
|
188 | @query.available_filters.keys.each do |field| | |
187 | @query.add_short_filter(field, params[field]) if params[field] |
|
189 | @query.add_short_filter(field, params[field]) if params[field] | |
188 | end |
|
190 | end | |
189 | end |
|
191 | end | |
190 | session[:query] = @query |
|
192 | session[:query] = @query | |
191 | else |
|
193 | else | |
192 | @query = session[:query] |
|
194 | @query = session[:query] | |
193 | end |
|
195 | end | |
194 | end |
|
196 | end | |
195 | end |
|
197 | end |
@@ -1,100 +1,102 | |||||
1 | <% pdf.SetFontStyle('B',11) |
|
1 | <% pdf.SetFontStyle('B',11) | |
2 | pdf.Cell(190,10, "#{issue.project.name} - #{issue.tracker.name} # #{issue.id}: #{issue.subject}") |
|
2 | pdf.Cell(190,10, "#{issue.project.name} - #{issue.tracker.name} # #{issue.id}: #{issue.subject}") | |
3 | pdf.Ln |
|
3 | pdf.Ln | |
4 |
|
4 | |||
5 | y0 = pdf.GetY |
|
5 | y0 = pdf.GetY | |
6 |
|
6 | |||
7 | pdf.SetFontStyle('B',9) |
|
7 | pdf.SetFontStyle('B',9) | |
8 | pdf.Cell(35,5, l(:field_status) + ":","LT") |
|
8 | pdf.Cell(35,5, l(:field_status) + ":","LT") | |
9 | pdf.SetFontStyle('',9) |
|
9 | pdf.SetFontStyle('',9) | |
10 | pdf.Cell(60,5, issue.status.name,"RT") |
|
10 | pdf.Cell(60,5, issue.status.name,"RT") | |
11 | pdf.SetFontStyle('B',9) |
|
11 | pdf.SetFontStyle('B',9) | |
12 | pdf.Cell(35,5, l(:field_priority) + ":","LT") |
|
12 | pdf.Cell(35,5, l(:field_priority) + ":","LT") | |
13 | pdf.SetFontStyle('',9) |
|
13 | pdf.SetFontStyle('',9) | |
14 | pdf.Cell(60,5, issue.priority.name,"RT") |
|
14 | pdf.Cell(60,5, issue.priority.name,"RT") | |
15 | pdf.Ln |
|
15 | pdf.Ln | |
16 |
|
16 | |||
17 | pdf.SetFontStyle('B',9) |
|
17 | pdf.SetFontStyle('B',9) | |
18 | pdf.Cell(35,5, l(:field_author) + ":","L") |
|
18 | pdf.Cell(35,5, l(:field_author) + ":","L") | |
19 | pdf.SetFontStyle('',9) |
|
19 | pdf.SetFontStyle('',9) | |
20 | pdf.Cell(60,5, issue.author.name,"R") |
|
20 | pdf.Cell(60,5, issue.author.name,"R") | |
21 | pdf.SetFontStyle('B',9) |
|
21 | pdf.SetFontStyle('B',9) | |
22 | pdf.Cell(35,5, l(:field_category) + ":","L") |
|
22 | pdf.Cell(35,5, l(:field_category) + ":","L") | |
23 | pdf.SetFontStyle('',9) |
|
23 | pdf.SetFontStyle('',9) | |
24 | pdf.Cell(60,5, (issue.category ? issue.category.name : "-"),"R") |
|
24 | pdf.Cell(60,5, (issue.category ? issue.category.name : "-"),"R") | |
25 | pdf.Ln |
|
25 | pdf.Ln | |
26 |
|
26 | |||
27 | pdf.SetFontStyle('B',9) |
|
27 | pdf.SetFontStyle('B',9) | |
28 | pdf.Cell(35,5, l(:field_created_on) + ":","L") |
|
28 | pdf.Cell(35,5, l(:field_created_on) + ":","L") | |
29 | pdf.SetFontStyle('',9) |
|
29 | pdf.SetFontStyle('',9) | |
30 | pdf.Cell(60,5, format_date(issue.created_on),"R") |
|
30 | pdf.Cell(60,5, format_date(issue.created_on),"R") | |
31 | pdf.SetFontStyle('B',9) |
|
31 | pdf.SetFontStyle('B',9) | |
32 | pdf.Cell(35,5, l(:field_assigned_to) + ":","L") |
|
32 | pdf.Cell(35,5, l(:field_assigned_to) + ":","L") | |
33 | pdf.SetFontStyle('',9) |
|
33 | pdf.SetFontStyle('',9) | |
34 | pdf.Cell(60,5, (issue.assigned_to ? issue.assigned_to.name : "-"),"R") |
|
34 | pdf.Cell(60,5, (issue.assigned_to ? issue.assigned_to.name : "-"),"R") | |
35 | pdf.Ln |
|
35 | pdf.Ln | |
36 |
|
36 | |||
37 | pdf.SetFontStyle('B',9) |
|
37 | pdf.SetFontStyle('B',9) | |
38 | pdf.Cell(35,5, l(:field_updated_on) + ":","LB") |
|
38 | pdf.Cell(35,5, l(:field_updated_on) + ":","LB") | |
39 | pdf.SetFontStyle('',9) |
|
39 | pdf.SetFontStyle('',9) | |
40 | pdf.Cell(60,5, format_date(issue.updated_on),"RB") |
|
40 | pdf.Cell(60,5, format_date(issue.updated_on),"RB") | |
41 | pdf.SetFontStyle('B',9) |
|
41 | pdf.SetFontStyle('B',9) | |
42 | pdf.Cell(35,5, l(:field_due_date) + ":","LB") |
|
42 | pdf.Cell(35,5, l(:field_due_date) + ":","LB") | |
43 | pdf.SetFontStyle('',9) |
|
43 | pdf.SetFontStyle('',9) | |
44 | pdf.Cell(60,5, format_date(issue.due_date),"RB") |
|
44 | pdf.Cell(60,5, format_date(issue.due_date),"RB") | |
45 | pdf.Ln |
|
45 | pdf.Ln | |
46 |
|
46 | |||
47 | for custom_value in issue.custom_values |
|
47 | for custom_value in issue.custom_values | |
48 | pdf.SetFontStyle('B',9) |
|
48 | pdf.SetFontStyle('B',9) | |
49 | pdf.Cell(35,5, custom_value.custom_field.name + ":","L") |
|
49 | pdf.Cell(35,5, custom_value.custom_field.name + ":","L") | |
50 | pdf.SetFontStyle('',9) |
|
50 | pdf.SetFontStyle('',9) | |
51 | pdf.MultiCell(155,5, (show_value custom_value),"R") |
|
51 | pdf.MultiCell(155,5, (show_value custom_value),"R") | |
52 | end |
|
52 | end | |
53 |
|
53 | |||
54 | pdf.SetFontStyle('B',9) |
|
54 | pdf.SetFontStyle('B',9) | |
55 | pdf.Cell(35,5, l(:field_subject) + ":","LTB") |
|
55 | pdf.Cell(35,5, l(:field_subject) + ":","LTB") | |
56 | pdf.SetFontStyle('',9) |
|
56 | pdf.SetFontStyle('',9) | |
57 | pdf.Cell(155,5, issue.subject,"RTB") |
|
57 | pdf.Cell(155,5, issue.subject,"RTB") | |
58 | pdf.Ln |
|
58 | pdf.Ln | |
59 |
|
59 | |||
60 | pdf.SetFontStyle('B',9) |
|
60 | pdf.SetFontStyle('B',9) | |
61 | pdf.Cell(35,5, l(:field_description) + ":") |
|
61 | pdf.Cell(35,5, l(:field_description) + ":") | |
62 | pdf.SetFontStyle('',9) |
|
62 | pdf.SetFontStyle('',9) | |
63 | pdf.MultiCell(155,5, issue.description,"BR") |
|
63 | pdf.MultiCell(155,5, issue.description,"BR") | |
64 |
|
64 | |||
65 | pdf.Line(pdf.GetX, y0, pdf.GetX, pdf.GetY) |
|
65 | pdf.Line(pdf.GetX, y0, pdf.GetX, pdf.GetY) | |
66 | pdf.Line(pdf.GetX, pdf.GetY, 170, pdf.GetY) |
|
66 | pdf.Line(pdf.GetX, pdf.GetY, 170, pdf.GetY) | |
67 |
|
67 | |||
68 | pdf.Ln |
|
68 | pdf.Ln | |
69 |
|
69 | |||
70 | pdf.SetFontStyle('B',9) |
|
70 | pdf.SetFontStyle('B',9) | |
71 | pdf.Cell(190,5, l(:label_history), "B") |
|
71 | pdf.Cell(190,5, l(:label_history), "B") | |
72 | pdf.Ln |
|
72 | pdf.Ln | |
73 |
for journal in issue.journals.find(:all, :include => :user, :order => " |
|
73 | for journal in issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC") | |
74 | pdf.SetFontStyle('B',8) |
|
74 | pdf.SetFontStyle('B',8) | |
75 | pdf.Cell(190,5, format_time(journal.created_on) + " - " + journal.user.name) |
|
75 | pdf.Cell(190,5, format_time(journal.created_on) + " - " + journal.user.name) | |
76 | pdf.Ln |
|
76 | pdf.Ln | |
77 | pdf.SetFontStyle('I',8) |
|
77 | pdf.SetFontStyle('I',8) | |
78 | for detail in journal.details |
|
78 | for detail in journal.details | |
79 | pdf.Cell(190,5, "- " + show_detail(detail, true)) |
|
79 | pdf.Cell(190,5, "- " + show_detail(detail, true)) | |
80 | pdf.Ln |
|
80 | pdf.Ln | |
81 | end |
|
81 | end | |
82 | if journal.notes? |
|
82 | if journal.notes? | |
83 | pdf.SetFontStyle('',8) |
|
83 | pdf.SetFontStyle('',8) | |
84 | pdf.MultiCell(190,5, journal.notes) |
|
84 | pdf.MultiCell(190,5, journal.notes) | |
85 | end |
|
85 | end | |
86 | pdf.Ln |
|
86 | pdf.Ln | |
87 | end |
|
87 | end | |
88 |
|
88 | |||
|
89 | if issue.attachments.any? | |||
89 | pdf.SetFontStyle('B',9) |
|
90 | pdf.SetFontStyle('B',9) | |
90 | pdf.Cell(190,5, l(:label_attachment_plural), "B") |
|
91 | pdf.Cell(190,5, l(:label_attachment_plural), "B") | |
91 | pdf.Ln |
|
92 | pdf.Ln | |
92 | for attachment in issue.attachments |
|
93 | for attachment in issue.attachments | |
93 | pdf.SetFontStyle('',8) |
|
94 | pdf.SetFontStyle('',8) | |
94 | pdf.Cell(80,5, attachment.filename) |
|
95 | pdf.Cell(80,5, attachment.filename) | |
95 | pdf.Cell(20,5, number_to_human_size(attachment.filesize),0,0,"R") |
|
96 | pdf.Cell(20,5, number_to_human_size(attachment.filesize),0,0,"R") | |
96 | pdf.Cell(25,5, format_date(attachment.created_on),0,0,"R") |
|
97 | pdf.Cell(25,5, format_date(attachment.created_on),0,0,"R") | |
97 | pdf.Cell(65,5, attachment.author.name,0,0,"R") |
|
98 | pdf.Cell(65,5, attachment.author.name,0,0,"R") | |
98 | pdf.Ln |
|
99 | pdf.Ln | |
99 | end |
|
100 | end | |
|
101 | end | |||
100 | %> |
|
102 | %> |
1 | NO CONTENT: modified file, file renamed from app/views/issues/export_pdf.rfpdf to app/views/issues/show.rfpdf |
|
NO CONTENT: modified file, file renamed from app/views/issues/export_pdf.rfpdf to app/views/issues/show.rfpdf |
@@ -1,122 +1,122 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <%= show_and_goto_link(l(:label_add_note), 'add-note', :class => 'icon icon-note') if authorize_for('issues', 'add_note') %> |
|
2 | <%= show_and_goto_link(l(:label_add_note), 'add-note', :class => 'icon icon-note') if authorize_for('issues', 'add_note') %> | |
3 | <%= link_to_if_authorized l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon icon-edit', :accesskey => accesskey(:edit) %> |
|
3 | <%= link_to_if_authorized l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon icon-edit', :accesskey => accesskey(:edit) %> | |
4 | <%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue}, :class => 'icon icon-time' %> |
|
4 | <%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue}, :class => 'icon icon-time' %> | |
5 | <%= watcher_tag(@issue, User.current) %> |
|
5 | <%= watcher_tag(@issue, User.current) %> | |
6 | <%= link_to_if_authorized l(:button_move), {:controller => 'projects', :action => 'move_issues', :id => @project, "issue_ids[]" => @issue.id }, :class => 'icon icon-move' %> |
|
6 | <%= link_to_if_authorized l(:button_move), {:controller => 'projects', :action => 'move_issues', :id => @project, "issue_ids[]" => @issue.id }, :class => 'icon icon-move' %> | |
7 | <%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
7 | <%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> | |
8 | </div> |
|
8 | </div> | |
9 |
|
9 | |||
10 | <h2><%= @issue.tracker.name %> #<%= @issue.id %></h2> |
|
10 | <h2><%= @issue.tracker.name %> #<%= @issue.id %></h2> | |
11 |
|
11 | |||
12 | <div class="issue"> |
|
12 | <div class="issue"> | |
13 | <h3><%=h @issue.subject %></h3> |
|
13 | <h3><%=h @issue.subject %></h3> | |
14 | <p class="author"> |
|
14 | <p class="author"> | |
15 | <%= authoring @issue.created_on, @issue.author %>. |
|
15 | <%= authoring @issue.created_on, @issue.author %>. | |
16 | <%= l(:label_updated_time, distance_of_time_in_words(Time.now, @issue.updated_on)) if @issue.created_on != @issue.updated_on %>. |
|
16 | <%= l(:label_updated_time, distance_of_time_in_words(Time.now, @issue.updated_on)) if @issue.created_on != @issue.updated_on %>. | |
17 | </p> |
|
17 | </p> | |
18 |
|
18 | |||
19 | <table width="100%"> |
|
19 | <table width="100%"> | |
20 | <tr> |
|
20 | <tr> | |
21 | <td style="width:15%"><b><%=l(:field_status)%> :</b></td><td style="width:35%"><%= @issue.status.name %></td> |
|
21 | <td style="width:15%"><b><%=l(:field_status)%> :</b></td><td style="width:35%"><%= @issue.status.name %></td> | |
22 | <td style="width:15%"><b><%=l(:field_start_date)%> :</b></td><td style="width:35%"><%= format_date(@issue.start_date) %></td> |
|
22 | <td style="width:15%"><b><%=l(:field_start_date)%> :</b></td><td style="width:35%"><%= format_date(@issue.start_date) %></td> | |
23 | </tr> |
|
23 | </tr> | |
24 | <tr> |
|
24 | <tr> | |
25 | <td><b><%=l(:field_priority)%> :</b></td><td><%= @issue.priority.name %></td> |
|
25 | <td><b><%=l(:field_priority)%> :</b></td><td><%= @issue.priority.name %></td> | |
26 | <td><b><%=l(:field_due_date)%> :</b></td><td><%= format_date(@issue.due_date) %></td> |
|
26 | <td><b><%=l(:field_due_date)%> :</b></td><td><%= format_date(@issue.due_date) %></td> | |
27 | </tr> |
|
27 | </tr> | |
28 | <tr> |
|
28 | <tr> | |
29 | <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td> |
|
29 | <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td> | |
30 | <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= @issue.done_ratio %> %</td> |
|
30 | <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= @issue.done_ratio %> %</td> | |
31 | </tr> |
|
31 | </tr> | |
32 | <tr> |
|
32 | <tr> | |
33 | <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td> |
|
33 | <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td> | |
34 | <% if User.current.allowed_to?(:view_time_entries, @project) %> |
|
34 | <% if User.current.allowed_to?(:view_time_entries, @project) %> | |
35 | <td><b><%=l(:label_spent_time)%> :</b></td> |
|
35 | <td><b><%=l(:label_spent_time)%> :</b></td> | |
36 | <td><%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :issue_id => @issue}, :class => 'icon icon-time') : "-" %></td> |
|
36 | <td><%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :issue_id => @issue}, :class => 'icon icon-time') : "-" %></td> | |
37 | <% end %> |
|
37 | <% end %> | |
38 | </tr> |
|
38 | </tr> | |
39 | <tr> |
|
39 | <tr> | |
40 | <td><b><%=l(:field_fixed_version)%> :</b></td><td><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td> |
|
40 | <td><b><%=l(:field_fixed_version)%> :</b></td><td><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td> | |
41 | <% if @issue.estimated_hours %> |
|
41 | <% if @issue.estimated_hours %> | |
42 | <td><b><%=l(:field_estimated_hours)%> :</b></td><td><%= lwr(:label_f_hour, @issue.estimated_hours) %></td> |
|
42 | <td><b><%=l(:field_estimated_hours)%> :</b></td><td><%= lwr(:label_f_hour, @issue.estimated_hours) %></td> | |
43 | <% end %> |
|
43 | <% end %> | |
44 | </tr> |
|
44 | </tr> | |
45 | <tr> |
|
45 | <tr> | |
46 | <% n = 0 |
|
46 | <% n = 0 | |
47 | for custom_value in @custom_values %> |
|
47 | for custom_value in @custom_values %> | |
48 | <td valign="top"><b><%= custom_value.custom_field.name %> :</b></td><td valign="top"><%= simple_format(h(show_value(custom_value))) %></td> |
|
48 | <td valign="top"><b><%= custom_value.custom_field.name %> :</b></td><td valign="top"><%= simple_format(h(show_value(custom_value))) %></td> | |
49 | <% n = n + 1 |
|
49 | <% n = n + 1 | |
50 | if (n > 1) |
|
50 | if (n > 1) | |
51 | n = 0 %> |
|
51 | n = 0 %> | |
52 | </tr><tr> |
|
52 | </tr><tr> | |
53 | <%end |
|
53 | <%end | |
54 | end %> |
|
54 | end %> | |
55 | </tr> |
|
55 | </tr> | |
56 | </table> |
|
56 | </table> | |
57 | <hr /> |
|
57 | <hr /> | |
58 |
|
58 | |||
59 | <% if @issue.changesets.any? %> |
|
59 | <% if @issue.changesets.any? %> | |
60 | <div style="float:right;"> |
|
60 | <div style="float:right;"> | |
61 | <em><%= l(:label_revision_plural) %>: <%= @issue.changesets.collect{|changeset| link_to(changeset.revision, :controller => 'repositories', :action => 'revision', :id => @project, :rev => changeset.revision)}.join(", ") %></em> |
|
61 | <em><%= l(:label_revision_plural) %>: <%= @issue.changesets.collect{|changeset| link_to(changeset.revision, :controller => 'repositories', :action => 'revision', :id => @project, :rev => changeset.revision)}.join(", ") %></em> | |
62 | </div> |
|
62 | </div> | |
63 | <% end %> |
|
63 | <% end %> | |
64 |
|
64 | |||
65 | <p><strong><%=l(:field_description)%></strong></p> |
|
65 | <p><strong><%=l(:field_description)%></strong></p> | |
66 | <%= textilizable @issue.description, :attachments => @issue.attachments %> |
|
66 | <%= textilizable @issue.description, :attachments => @issue.attachments %> | |
67 |
|
67 | |||
68 | <% if @issue.attachments.any? %> |
|
68 | <% if @issue.attachments.any? %> | |
69 | <%= link_to_attachments @issue.attachments, :delete_url => (authorize_for('issues', 'destroy_attachment') ? {:controller => 'issues', :action => 'destroy_attachment', :id => @issue} : nil) %> |
|
69 | <%= link_to_attachments @issue.attachments, :delete_url => (authorize_for('issues', 'destroy_attachment') ? {:controller => 'issues', :action => 'destroy_attachment', :id => @issue} : nil) %> | |
70 | <% end %> |
|
70 | <% end %> | |
71 |
|
71 | |||
72 | <% if authorize_for('issue_relations', 'new') || @issue.relations.any? %> |
|
72 | <% if authorize_for('issue_relations', 'new') || @issue.relations.any? %> | |
73 | <hr /> |
|
73 | <hr /> | |
74 | <div id="relations"> |
|
74 | <div id="relations"> | |
75 | <%= render :partial => 'relations' %> |
|
75 | <%= render :partial => 'relations' %> | |
76 | </div> |
|
76 | </div> | |
77 | <% end %> |
|
77 | <% end %> | |
78 |
|
78 | |||
79 | </div> |
|
79 | </div> | |
80 |
|
80 | |||
81 | <% if authorize_for('issues', 'change_status') and @status_options and !@status_options.empty? %> |
|
81 | <% if authorize_for('issues', 'change_status') and @status_options and !@status_options.empty? %> | |
82 | <% form_tag({:controller => 'issues', :action => 'change_status', :id => @issue}) do %> |
|
82 | <% form_tag({:controller => 'issues', :action => 'change_status', :id => @issue}) do %> | |
83 | <p><%=l(:label_change_status)%> : |
|
83 | <p><%=l(:label_change_status)%> : | |
84 | <select name="new_status_id"> |
|
84 | <select name="new_status_id"> | |
85 | <%= options_from_collection_for_select @status_options, "id", "name" %> |
|
85 | <%= options_from_collection_for_select @status_options, "id", "name" %> | |
86 | </select> |
|
86 | </select> | |
87 | <%= submit_tag l(:button_change) %></p> |
|
87 | <%= submit_tag l(:button_change) %></p> | |
88 | <% end %> |
|
88 | <% end %> | |
89 | <% end %> |
|
89 | <% end %> | |
90 |
|
90 | |||
91 | <% if @journals.any? %> |
|
91 | <% if @journals.any? %> | |
92 | <div id="history"> |
|
92 | <div id="history"> | |
93 | <h3><%=l(:label_history)%></h3> |
|
93 | <h3><%=l(:label_history)%></h3> | |
94 | <%= render :partial => 'history', :locals => { :journals => @journals } %> |
|
94 | <%= render :partial => 'history', :locals => { :journals => @journals } %> | |
95 | </div> |
|
95 | </div> | |
96 | <% end %> |
|
96 | <% end %> | |
97 |
|
97 | |||
98 | <% if authorize_for('issues', 'add_note') %> |
|
98 | <% if authorize_for('issues', 'add_note') %> | |
99 | <a name="add-note-anchor"></a> |
|
99 | <a name="add-note-anchor"></a> | |
100 | <div id="add-note" class="box" style="display:none;"> |
|
100 | <div id="add-note" class="box" style="display:none;"> | |
101 | <h3><%= l(:label_add_note) %></h3> |
|
101 | <h3><%= l(:label_add_note) %></h3> | |
102 | <% form_tag({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular", :multipart => true) do %> |
|
102 | <% form_tag({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular", :multipart => true) do %> | |
103 | <p><label for="notes"><%=l(:field_notes)%></label> |
|
103 | <p><label for="notes"><%=l(:field_notes)%></label> | |
104 | <%= text_area_tag 'notes', '', :cols => 60, :rows => 10, :class => 'wiki-edit' %></p> |
|
104 | <%= text_area_tag 'notes', '', :cols => 60, :rows => 10, :class => 'wiki-edit' %></p> | |
105 | <%= wikitoolbar_for 'notes' %> |
|
105 | <%= wikitoolbar_for 'notes' %> | |
106 | <%= render :partial => 'attachments/form' %> |
|
106 | <%= render :partial => 'attachments/form' %> | |
107 | <%= submit_tag l(:button_add) %> |
|
107 | <%= submit_tag l(:button_add) %> | |
108 | <%= toggle_link l(:button_cancel), 'add-note' %> |
|
108 | <%= toggle_link l(:button_cancel), 'add-note' %> | |
109 | <% end %> |
|
109 | <% end %> | |
110 | </div> |
|
110 | </div> | |
111 | <% end %> |
|
111 | <% end %> | |
112 |
|
112 | |||
113 | <div class="contextual"> |
|
113 | <div class="contextual"> | |
114 |
<%= l(:label_export_to) %><%= link_to 'PDF', {:a |
|
114 | <%= l(:label_export_to) %><%= link_to 'PDF', {:format => 'pdf'}, :class => 'icon icon-pdf' %> | |
115 | </div> |
|
115 | </div> | |
116 | |
|
116 | | |
117 |
|
117 | |||
118 | <% set_html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> |
|
118 | <% set_html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> | |
119 |
|
119 | |||
120 | <% content_for :sidebar do %> |
|
120 | <% content_for :sidebar do %> | |
121 | <%= render :partial => 'issues/sidebar' %> |
|
121 | <%= render :partial => 'issues/sidebar' %> | |
122 | <% end %> |
|
122 | <% end %> |
@@ -1,101 +1,101 | |||||
1 | require 'redmine/access_control' |
|
1 | require 'redmine/access_control' | |
2 | require 'redmine/menu_manager' |
|
2 | require 'redmine/menu_manager' | |
3 | require 'redmine/mime_type' |
|
3 | require 'redmine/mime_type' | |
4 | require 'redmine/plugin' |
|
4 | require 'redmine/plugin' | |
5 |
|
5 | |||
6 | begin |
|
6 | begin | |
7 | require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick) |
|
7 | require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick) | |
8 | rescue LoadError |
|
8 | rescue LoadError | |
9 | # RMagick is not available |
|
9 | # RMagick is not available | |
10 | end |
|
10 | end | |
11 |
|
11 | |||
12 | REDMINE_SUPPORTED_SCM = %w( Subversion Darcs Mercurial Cvs ) |
|
12 | REDMINE_SUPPORTED_SCM = %w( Subversion Darcs Mercurial Cvs ) | |
13 |
|
13 | |||
14 | # Permissions |
|
14 | # Permissions | |
15 | Redmine::AccessControl.map do |map| |
|
15 | Redmine::AccessControl.map do |map| | |
16 | map.permission :view_project, {:projects => [:show, :activity]}, :public => true |
|
16 | map.permission :view_project, {:projects => [:show, :activity]}, :public => true | |
17 | map.permission :search_project, {:search => :index}, :public => true |
|
17 | map.permission :search_project, {:search => :index}, :public => true | |
18 | map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member |
|
18 | map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member | |
19 | map.permission :select_project_modules, {:projects => :modules}, :require => :member |
|
19 | map.permission :select_project_modules, {:projects => :modules}, :require => :member | |
20 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy]}, :require => :member |
|
20 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy]}, :require => :member | |
21 | map.permission :manage_versions, {:projects => [:settings, :add_version], :versions => [:edit, :destroy]}, :require => :member |
|
21 | map.permission :manage_versions, {:projects => [:settings, :add_version], :versions => [:edit, :destroy]}, :require => :member | |
22 |
|
22 | |||
23 | map.project_module :issue_tracking do |map| |
|
23 | map.project_module :issue_tracking do |map| | |
24 | # Issue categories |
|
24 | # Issue categories | |
25 | map.permission :manage_categories, {:projects => [:settings, :add_issue_category], :issue_categories => [:edit, :destroy]}, :require => :member |
|
25 | map.permission :manage_categories, {:projects => [:settings, :add_issue_category], :issue_categories => [:edit, :destroy]}, :require => :member | |
26 | # Issues |
|
26 | # Issues | |
27 | map.permission :view_issues, {:projects => [:list_issues, :export_issues_csv, :export_issues_pdf, :changelog, :roadmap], |
|
27 | map.permission :view_issues, {:projects => [:list_issues, :export_issues_csv, :export_issues_pdf, :changelog, :roadmap], | |
28 |
:issues => |
|
28 | :issues => :show, | |
29 | :queries => :index, |
|
29 | :queries => :index, | |
30 | :reports => :issue_report}, :public => true |
|
30 | :reports => :issue_report}, :public => true | |
31 | map.permission :add_issues, {:projects => :add_issue}, :require => :loggedin |
|
31 | map.permission :add_issues, {:projects => :add_issue}, :require => :loggedin | |
32 | map.permission :edit_issues, {:issues => [:edit, :destroy_attachment]}, :require => :loggedin |
|
32 | map.permission :edit_issues, {:issues => [:edit, :destroy_attachment]}, :require => :loggedin | |
33 | map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}, :require => :loggedin |
|
33 | map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}, :require => :loggedin | |
34 | map.permission :add_issue_notes, {:issues => :add_note}, :require => :loggedin |
|
34 | map.permission :add_issue_notes, {:issues => :add_note}, :require => :loggedin | |
35 | map.permission :change_issue_status, {:issues => :change_status}, :require => :loggedin |
|
35 | map.permission :change_issue_status, {:issues => :change_status}, :require => :loggedin | |
36 | map.permission :move_issues, {:projects => :move_issues}, :require => :loggedin |
|
36 | map.permission :move_issues, {:projects => :move_issues}, :require => :loggedin | |
37 | map.permission :delete_issues, {:issues => :destroy}, :require => :member |
|
37 | map.permission :delete_issues, {:issues => :destroy}, :require => :member | |
38 | # Queries |
|
38 | # Queries | |
39 | map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member |
|
39 | map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member | |
40 | map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin |
|
40 | map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin | |
41 | # Gantt & calendar |
|
41 | # Gantt & calendar | |
42 | map.permission :view_gantt, :projects => :gantt |
|
42 | map.permission :view_gantt, :projects => :gantt | |
43 | map.permission :view_calendar, :projects => :calendar |
|
43 | map.permission :view_calendar, :projects => :calendar | |
44 | end |
|
44 | end | |
45 |
|
45 | |||
46 | map.project_module :time_tracking do |map| |
|
46 | map.project_module :time_tracking do |map| | |
47 | map.permission :log_time, {:timelog => :edit}, :require => :loggedin |
|
47 | map.permission :log_time, {:timelog => :edit}, :require => :loggedin | |
48 | map.permission :view_time_entries, :timelog => [:details, :report] |
|
48 | map.permission :view_time_entries, :timelog => [:details, :report] | |
49 | end |
|
49 | end | |
50 |
|
50 | |||
51 | map.project_module :news do |map| |
|
51 | map.project_module :news do |map| | |
52 | map.permission :manage_news, {:projects => :add_news, :news => [:edit, :destroy, :destroy_comment]}, :require => :member |
|
52 | map.permission :manage_news, {:projects => :add_news, :news => [:edit, :destroy, :destroy_comment]}, :require => :member | |
53 | map.permission :view_news, {:projects => :list_news, :news => :show}, :public => true |
|
53 | map.permission :view_news, {:projects => :list_news, :news => :show}, :public => true | |
54 | map.permission :comment_news, {:news => :add_comment}, :require => :loggedin |
|
54 | map.permission :comment_news, {:news => :add_comment}, :require => :loggedin | |
55 | end |
|
55 | end | |
56 |
|
56 | |||
57 | map.project_module :documents do |map| |
|
57 | map.project_module :documents do |map| | |
58 | map.permission :manage_documents, {:projects => :add_document, :documents => [:edit, :destroy, :add_attachment, :destroy_attachment]}, :require => :loggedin |
|
58 | map.permission :manage_documents, {:projects => :add_document, :documents => [:edit, :destroy, :add_attachment, :destroy_attachment]}, :require => :loggedin | |
59 | map.permission :view_documents, :projects => :list_documents, :documents => [:show, :download] |
|
59 | map.permission :view_documents, :projects => :list_documents, :documents => [:show, :download] | |
60 | end |
|
60 | end | |
61 |
|
61 | |||
62 | map.project_module :files do |map| |
|
62 | map.project_module :files do |map| | |
63 | map.permission :manage_files, {:projects => :add_file, :versions => :destroy_file}, :require => :loggedin |
|
63 | map.permission :manage_files, {:projects => :add_file, :versions => :destroy_file}, :require => :loggedin | |
64 | map.permission :view_files, :projects => :list_files, :versions => :download |
|
64 | map.permission :view_files, :projects => :list_files, :versions => :download | |
65 | end |
|
65 | end | |
66 |
|
66 | |||
67 | map.project_module :wiki do |map| |
|
67 | map.project_module :wiki do |map| | |
68 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member |
|
68 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member | |
69 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member |
|
69 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member | |
70 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member |
|
70 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member | |
71 | map.permission :view_wiki_pages, :wiki => [:index, :history, :diff, :special] |
|
71 | map.permission :view_wiki_pages, :wiki => [:index, :history, :diff, :special] | |
72 | map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment, :destroy_attachment] |
|
72 | map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment, :destroy_attachment] | |
73 | end |
|
73 | end | |
74 |
|
74 | |||
75 | map.project_module :repository do |map| |
|
75 | map.project_module :repository do |map| | |
76 | map.permission :manage_repository, {:repositories => [:edit, :destroy]}, :require => :member |
|
76 | map.permission :manage_repository, {:repositories => [:edit, :destroy]}, :require => :member | |
77 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :changes, :diff, :stats, :graph] |
|
77 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :changes, :diff, :stats, :graph] | |
78 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] |
|
78 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] | |
79 | end |
|
79 | end | |
80 |
|
80 | |||
81 | map.project_module :boards do |map| |
|
81 | map.project_module :boards do |map| | |
82 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member |
|
82 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member | |
83 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true |
|
83 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true | |
84 | map.permission :add_messages, {:messages => [:new, :reply]}, :require => :loggedin |
|
84 | map.permission :add_messages, {:messages => [:new, :reply]}, :require => :loggedin | |
85 | end |
|
85 | end | |
86 | end |
|
86 | end | |
87 |
|
87 | |||
88 | # Project menu configuration |
|
88 | # Project menu configuration | |
89 | Redmine::MenuManager.map :project_menu do |menu| |
|
89 | Redmine::MenuManager.map :project_menu do |menu| | |
90 | menu.push :label_overview, :controller => 'projects', :action => 'show' |
|
90 | menu.push :label_overview, :controller => 'projects', :action => 'show' | |
91 | menu.push :label_activity, :controller => 'projects', :action => 'activity' |
|
91 | menu.push :label_activity, :controller => 'projects', :action => 'activity' | |
92 | menu.push :label_roadmap, :controller => 'projects', :action => 'roadmap' |
|
92 | menu.push :label_roadmap, :controller => 'projects', :action => 'roadmap' | |
93 | menu.push :label_issue_plural, :controller => 'projects', :action => 'list_issues' |
|
93 | menu.push :label_issue_plural, :controller => 'projects', :action => 'list_issues' | |
94 | menu.push :label_news_plural, :controller => 'projects', :action => 'list_news' |
|
94 | menu.push :label_news_plural, :controller => 'projects', :action => 'list_news' | |
95 | menu.push :label_document_plural, :controller => 'projects', :action => 'list_documents' |
|
95 | menu.push :label_document_plural, :controller => 'projects', :action => 'list_documents' | |
96 | menu.push :label_wiki, { :controller => 'wiki', :action => 'index', :page => nil }, :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } |
|
96 | menu.push :label_wiki, { :controller => 'wiki', :action => 'index', :page => nil }, :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } | |
97 | menu.push :label_board_plural, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, :if => Proc.new { |p| p.boards.any? } |
|
97 | menu.push :label_board_plural, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, :if => Proc.new { |p| p.boards.any? } | |
98 | menu.push :label_attachment_plural, :controller => 'projects', :action => 'list_files' |
|
98 | menu.push :label_attachment_plural, :controller => 'projects', :action => 'list_files' | |
99 | menu.push :label_repository, { :controller => 'repositories', :action => 'show' }, :if => Proc.new { |p| p.repository && !p.repository.new_record? } |
|
99 | menu.push :label_repository, { :controller => 'repositories', :action => 'show' }, :if => Proc.new { |p| p.repository && !p.repository.new_record? } | |
100 | menu.push :label_settings, :controller => 'projects', :action => 'settings' |
|
100 | menu.push :label_settings, :controller => 'projects', :action => 'settings' | |
101 | end |
|
101 | end |
General Comments 0
You need to be logged in to leave comments.
Login now