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