@@ -0,0 +1,10 | |||
|
1 | class AddRolePosition < ActiveRecord::Migration | |
|
2 | def self.up | |
|
3 | add_column :roles, :position, :integer, :default => 1, :null => false | |
|
4 | Role.find(:all).each_with_index {|role, i| role.update_attribute(:position, i+1)} | |
|
5 | end | |
|
6 | ||
|
7 | def self.down | |
|
8 | remove_column :roles, :position | |
|
9 | end | |
|
10 | end |
@@ -1,562 +1,562 | |||
|
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 | require 'csv' |
|
19 | 19 | |
|
20 | 20 | class ProjectsController < ApplicationController |
|
21 | 21 | layout 'base' |
|
22 | 22 | before_filter :find_project, :authorize, :except => [ :index, :list, :add ] |
|
23 | 23 | before_filter :require_admin, :only => [ :add, :destroy ] |
|
24 | 24 | |
|
25 | 25 | helper :sort |
|
26 | 26 | include SortHelper |
|
27 | 27 | helper :custom_fields |
|
28 | 28 | include CustomFieldsHelper |
|
29 | 29 | helper :ifpdf |
|
30 | 30 | include IfpdfHelper |
|
31 | 31 | helper IssuesHelper |
|
32 | 32 | helper :queries |
|
33 | 33 | include QueriesHelper |
|
34 | 34 | |
|
35 | 35 | def index |
|
36 | 36 | list |
|
37 | 37 | render :action => 'list' unless request.xhr? |
|
38 | 38 | end |
|
39 | 39 | |
|
40 | 40 | # Lists public projects |
|
41 | 41 | def list |
|
42 | 42 | sort_init 'name', 'asc' |
|
43 | 43 | sort_update |
|
44 | 44 | @project_count = Project.count(:all, :conditions => ["is_public=?", true]) |
|
45 | 45 | @project_pages = Paginator.new self, @project_count, |
|
46 | 46 | 15, |
|
47 | 47 | params['page'] |
|
48 | 48 | @projects = Project.find :all, :order => sort_clause, |
|
49 | 49 | :conditions => ["is_public=?", true], |
|
50 | 50 | :limit => @project_pages.items_per_page, |
|
51 | 51 | :offset => @project_pages.current.offset |
|
52 | 52 | |
|
53 | 53 | render :action => "list", :layout => false if request.xhr? |
|
54 | 54 | end |
|
55 | 55 | |
|
56 | 56 | # Add a new project |
|
57 | 57 | def add |
|
58 | 58 | @custom_fields = IssueCustomField.find(:all) |
|
59 | 59 | @root_projects = Project.find(:all, :conditions => "parent_id is null") |
|
60 | 60 | @project = Project.new(params[:project]) |
|
61 | 61 | if request.get? |
|
62 | 62 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) } |
|
63 | 63 | else |
|
64 | 64 | @project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] |
|
65 | 65 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } |
|
66 | 66 | @project.custom_values = @custom_values |
|
67 | 67 | if params[:repository_enabled] && params[:repository_enabled] == "1" |
|
68 | 68 | @project.repository = Repository.new |
|
69 | 69 | @project.repository.attributes = params[:repository] |
|
70 | 70 | end |
|
71 | 71 | if @project.save |
|
72 | 72 | flash[:notice] = l(:notice_successful_create) |
|
73 | 73 | redirect_to :controller => 'admin', :action => 'projects' |
|
74 | 74 | end |
|
75 | 75 | end |
|
76 | 76 | end |
|
77 | 77 | |
|
78 | 78 | # Show @project |
|
79 | 79 | def show |
|
80 | 80 | @custom_values = @project.custom_values.find(:all, :include => :custom_field) |
|
81 | 81 | @members = @project.members.find(:all, :include => [:user, :role]) |
|
82 | 82 | @subprojects = @project.children if @project.children.size > 0 |
|
83 | 83 | @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC") |
|
84 | 84 | @trackers = Tracker.find(:all) |
|
85 | 85 | @open_issues_by_tracker = Issue.count(:group => :tracker, :joins => "INNER JOIN issue_statuses ON issue_statuses.id = issues.status_id", :conditions => ["project_id=? and issue_statuses.is_closed=?", @project.id, false]) |
|
86 | 86 | @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id]) |
|
87 | 87 | end |
|
88 | 88 | |
|
89 | 89 | def settings |
|
90 | 90 | @root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id]) |
|
91 | 91 | @custom_fields = IssueCustomField.find(:all) |
|
92 | 92 | @issue_category ||= IssueCategory.new |
|
93 | 93 | @member ||= @project.members.new |
|
94 | @roles = Role.find(:all) | |
|
94 | @roles = Role.find(:all, :order => 'position') | |
|
95 | 95 | @users = User.find_active(:all) - @project.users |
|
96 | 96 | @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) } |
|
97 | 97 | end |
|
98 | 98 | |
|
99 | 99 | # Edit @project |
|
100 | 100 | def edit |
|
101 | 101 | if request.post? |
|
102 | 102 | @project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] |
|
103 | 103 | if params[:custom_fields] |
|
104 | 104 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } |
|
105 | 105 | @project.custom_values = @custom_values |
|
106 | 106 | end |
|
107 | 107 | if params[:repository_enabled] |
|
108 | 108 | case params[:repository_enabled] |
|
109 | 109 | when "0" |
|
110 | 110 | @project.repository = nil |
|
111 | 111 | when "1" |
|
112 | 112 | @project.repository ||= Repository.new |
|
113 | 113 | @project.repository.attributes = params[:repository] |
|
114 | 114 | end |
|
115 | 115 | end |
|
116 | 116 | @project.attributes = params[:project] |
|
117 | 117 | if @project.save |
|
118 | 118 | flash[:notice] = l(:notice_successful_update) |
|
119 | 119 | redirect_to :action => 'settings', :id => @project |
|
120 | 120 | else |
|
121 | 121 | settings |
|
122 | 122 | render :action => 'settings' |
|
123 | 123 | end |
|
124 | 124 | end |
|
125 | 125 | end |
|
126 | 126 | |
|
127 | 127 | # Delete @project |
|
128 | 128 | def destroy |
|
129 | 129 | if request.post? and params[:confirm] |
|
130 | 130 | @project.destroy |
|
131 | 131 | redirect_to :controller => 'admin', :action => 'projects' |
|
132 | 132 | end |
|
133 | 133 | end |
|
134 | 134 | |
|
135 | 135 | # Add a new issue category to @project |
|
136 | 136 | def add_issue_category |
|
137 | 137 | if request.post? |
|
138 | 138 | @issue_category = @project.issue_categories.build(params[:issue_category]) |
|
139 | 139 | if @issue_category.save |
|
140 | 140 | flash[:notice] = l(:notice_successful_create) |
|
141 | 141 | redirect_to :action => 'settings', :tab => 'categories', :id => @project |
|
142 | 142 | else |
|
143 | 143 | settings |
|
144 | 144 | render :action => 'settings' |
|
145 | 145 | end |
|
146 | 146 | end |
|
147 | 147 | end |
|
148 | 148 | |
|
149 | 149 | # Add a new version to @project |
|
150 | 150 | def add_version |
|
151 | 151 | @version = @project.versions.build(params[:version]) |
|
152 | 152 | if request.post? and @version.save |
|
153 | 153 | flash[:notice] = l(:notice_successful_create) |
|
154 | 154 | redirect_to :action => 'settings', :tab => 'versions', :id => @project |
|
155 | 155 | end |
|
156 | 156 | end |
|
157 | 157 | |
|
158 | 158 | # Add a new member to @project |
|
159 | 159 | def add_member |
|
160 | 160 | @member = @project.members.build(params[:member]) |
|
161 | 161 | if request.post? |
|
162 | 162 | if @member.save |
|
163 | 163 | flash[:notice] = l(:notice_successful_create) |
|
164 | 164 | redirect_to :action => 'settings', :tab => 'members', :id => @project |
|
165 | 165 | else |
|
166 | 166 | settings |
|
167 | 167 | render :action => 'settings' |
|
168 | 168 | end |
|
169 | 169 | end |
|
170 | 170 | end |
|
171 | 171 | |
|
172 | 172 | # Show members list of @project |
|
173 | 173 | def list_members |
|
174 | 174 | @members = @project.members |
|
175 | 175 | end |
|
176 | 176 | |
|
177 | 177 | # Add a new document to @project |
|
178 | 178 | def add_document |
|
179 | 179 | @categories = Enumeration::get_values('DCAT') |
|
180 | 180 | @document = @project.documents.build(params[:document]) |
|
181 | 181 | if request.post? and @document.save |
|
182 | 182 | # Save the attachments |
|
183 | 183 | params[:attachments].each { |a| |
|
184 | 184 | Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0 |
|
185 | 185 | } if params[:attachments] and params[:attachments].is_a? Array |
|
186 | 186 | flash[:notice] = l(:notice_successful_create) |
|
187 | 187 | Mailer.deliver_document_add(@document) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? |
|
188 | 188 | redirect_to :action => 'list_documents', :id => @project |
|
189 | 189 | end |
|
190 | 190 | end |
|
191 | 191 | |
|
192 | 192 | # Show documents list of @project |
|
193 | 193 | def list_documents |
|
194 | 194 | @documents = @project.documents.find :all, :include => :category |
|
195 | 195 | end |
|
196 | 196 | |
|
197 | 197 | # Add a new issue to @project |
|
198 | 198 | def add_issue |
|
199 | 199 | @tracker = Tracker.find(params[:tracker_id]) |
|
200 | 200 | @priorities = Enumeration::get_values('IPRI') |
|
201 | 201 | @issue = Issue.new(:project => @project, :tracker => @tracker) |
|
202 | 202 | if request.get? |
|
203 | 203 | @issue.start_date = Date.today |
|
204 | 204 | @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) } |
|
205 | 205 | else |
|
206 | 206 | @issue.attributes = params[:issue] |
|
207 | 207 | @issue.author_id = self.logged_in_user.id if self.logged_in_user |
|
208 | 208 | # Multiple file upload |
|
209 | 209 | @attachments = [] |
|
210 | 210 | params[:attachments].each { |a| |
|
211 | 211 | @attachments << Attachment.new(:container => @issue, :file => a, :author => logged_in_user) unless a.size == 0 |
|
212 | 212 | } if params[:attachments] and params[:attachments].is_a? Array |
|
213 | 213 | @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) } |
|
214 | 214 | @issue.custom_values = @custom_values |
|
215 | 215 | if @issue.save |
|
216 | 216 | @attachments.each(&:save) |
|
217 | 217 | flash[:notice] = l(:notice_successful_create) |
|
218 | 218 | Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? |
|
219 | 219 | redirect_to :action => 'list_issues', :id => @project |
|
220 | 220 | end |
|
221 | 221 | end |
|
222 | 222 | end |
|
223 | 223 | |
|
224 | 224 | # Show filtered/sorted issues list of @project |
|
225 | 225 | def list_issues |
|
226 | 226 | sort_init 'issues.id', 'desc' |
|
227 | 227 | sort_update |
|
228 | 228 | |
|
229 | 229 | retrieve_query |
|
230 | 230 | |
|
231 | 231 | @results_per_page_options = [ 15, 25, 50, 100 ] |
|
232 | 232 | if params[:per_page] and @results_per_page_options.include? params[:per_page].to_i |
|
233 | 233 | @results_per_page = params[:per_page].to_i |
|
234 | 234 | session[:results_per_page] = @results_per_page |
|
235 | 235 | else |
|
236 | 236 | @results_per_page = session[:results_per_page] || 25 |
|
237 | 237 | end |
|
238 | 238 | |
|
239 | 239 | if @query.valid? |
|
240 | 240 | @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement) |
|
241 | 241 | @issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page'] |
|
242 | 242 | @issues = Issue.find :all, :order => sort_clause, |
|
243 | 243 | :include => [ :author, :status, :tracker, :project ], |
|
244 | 244 | :conditions => @query.statement, |
|
245 | 245 | :limit => @issue_pages.items_per_page, |
|
246 | 246 | :offset => @issue_pages.current.offset |
|
247 | 247 | end |
|
248 | 248 | @trackers = Tracker.find :all |
|
249 | 249 | render :layout => false if request.xhr? |
|
250 | 250 | end |
|
251 | 251 | |
|
252 | 252 | # Export filtered/sorted issues list to CSV |
|
253 | 253 | def export_issues_csv |
|
254 | 254 | sort_init 'issues.id', 'desc' |
|
255 | 255 | sort_update |
|
256 | 256 | |
|
257 | 257 | retrieve_query |
|
258 | 258 | render :action => 'list_issues' and return unless @query.valid? |
|
259 | 259 | |
|
260 | 260 | @issues = Issue.find :all, :order => sort_clause, |
|
261 | 261 | :include => [ :author, :status, :tracker, :priority, {:custom_values => :custom_field} ], |
|
262 | 262 | :conditions => @query.statement |
|
263 | 263 | |
|
264 | 264 | ic = Iconv.new('ISO-8859-1', 'UTF-8') |
|
265 | 265 | export = StringIO.new |
|
266 | 266 | CSV::Writer.generate(export, l(:general_csv_separator)) do |csv| |
|
267 | 267 | # csv header fields |
|
268 | 268 | headers = [ "#", l(:field_status), |
|
269 | 269 | l(:field_tracker), |
|
270 | 270 | l(:field_priority), |
|
271 | 271 | l(:field_subject), |
|
272 | 272 | l(:field_author), |
|
273 | 273 | l(:field_start_date), |
|
274 | 274 | l(:field_due_date), |
|
275 | 275 | l(:field_done_ratio), |
|
276 | 276 | l(:field_created_on), |
|
277 | 277 | l(:field_updated_on) |
|
278 | 278 | ] |
|
279 | 279 | for custom_field in @project.all_custom_fields |
|
280 | 280 | headers << custom_field.name |
|
281 | 281 | end |
|
282 | 282 | csv << headers.collect {|c| ic.iconv(c) } |
|
283 | 283 | # csv lines |
|
284 | 284 | @issues.each do |issue| |
|
285 | 285 | fields = [issue.id, issue.status.name, |
|
286 | 286 | issue.tracker.name, |
|
287 | 287 | issue.priority.name, |
|
288 | 288 | issue.subject, |
|
289 | 289 | issue.author.display_name, |
|
290 | 290 | issue.start_date ? l_date(issue.start_date) : nil, |
|
291 | 291 | issue.due_date ? l_date(issue.due_date) : nil, |
|
292 | 292 | issue.done_ratio, |
|
293 | 293 | l_datetime(issue.created_on), |
|
294 | 294 | l_datetime(issue.updated_on) |
|
295 | 295 | ] |
|
296 | 296 | for custom_field in @project.all_custom_fields |
|
297 | 297 | fields << (show_value issue.custom_value_for(custom_field)) |
|
298 | 298 | end |
|
299 | 299 | csv << fields.collect {|c| ic.iconv(c.to_s) } |
|
300 | 300 | end |
|
301 | 301 | end |
|
302 | 302 | export.rewind |
|
303 | 303 | send_data(export.read, :type => 'text/csv; header=present', :filename => 'export.csv') |
|
304 | 304 | end |
|
305 | 305 | |
|
306 | 306 | # Export filtered/sorted issues to PDF |
|
307 | 307 | def export_issues_pdf |
|
308 | 308 | sort_init 'issues.id', 'desc' |
|
309 | 309 | sort_update |
|
310 | 310 | |
|
311 | 311 | retrieve_query |
|
312 | 312 | render :action => 'list_issues' and return unless @query.valid? |
|
313 | 313 | |
|
314 | 314 | @issues = Issue.find :all, :order => sort_clause, |
|
315 | 315 | :include => [ :author, :status, :tracker, :project, :custom_values ], |
|
316 | 316 | :conditions => @query.statement |
|
317 | 317 | |
|
318 | 318 | @options_for_rfpdf ||= {} |
|
319 | 319 | @options_for_rfpdf[:file_name] = "export.pdf" |
|
320 | 320 | render :layout => false |
|
321 | 321 | end |
|
322 | 322 | |
|
323 | 323 | def move_issues |
|
324 | 324 | @issues = @project.issues.find(params[:issue_ids]) if params[:issue_ids] |
|
325 | 325 | redirect_to :action => 'list_issues', :id => @project and return unless @issues |
|
326 | 326 | @projects = [] |
|
327 | 327 | # find projects to which the user is allowed to move the issue |
|
328 | 328 | @logged_in_user.memberships.each {|m| @projects << m.project if Permission.allowed_to_role("projects/move_issues", m.role_id)} |
|
329 | 329 | # issue can be moved to any tracker |
|
330 | 330 | @trackers = Tracker.find(:all) |
|
331 | 331 | if request.post? and params[:new_project_id] and params[:new_tracker_id] |
|
332 | 332 | new_project = Project.find(params[:new_project_id]) |
|
333 | 333 | new_tracker = Tracker.find(params[:new_tracker_id]) |
|
334 | 334 | @issues.each { |i| |
|
335 | 335 | # project dependent properties |
|
336 | 336 | unless i.project_id == new_project.id |
|
337 | 337 | i.category = nil |
|
338 | 338 | i.fixed_version = nil |
|
339 | 339 | end |
|
340 | 340 | # move the issue |
|
341 | 341 | i.project = new_project |
|
342 | 342 | i.tracker = new_tracker |
|
343 | 343 | i.save |
|
344 | 344 | } |
|
345 | 345 | flash[:notice] = l(:notice_successful_update) |
|
346 | 346 | redirect_to :action => 'list_issues', :id => @project |
|
347 | 347 | end |
|
348 | 348 | end |
|
349 | 349 | |
|
350 | 350 | def add_query |
|
351 | 351 | @query = Query.new(params[:query]) |
|
352 | 352 | @query.project = @project |
|
353 | 353 | @query.user = logged_in_user |
|
354 | 354 | |
|
355 | 355 | params[:fields].each do |field| |
|
356 | 356 | @query.add_filter(field, params[:operators][field], params[:values][field]) |
|
357 | 357 | end if params[:fields] |
|
358 | 358 | |
|
359 | 359 | if request.post? and @query.save |
|
360 | 360 | flash[:notice] = l(:notice_successful_create) |
|
361 | 361 | redirect_to :controller => 'reports', :action => 'issue_report', :id => @project |
|
362 | 362 | end |
|
363 | 363 | render :layout => false if request.xhr? |
|
364 | 364 | end |
|
365 | 365 | |
|
366 | 366 | # Add a news to @project |
|
367 | 367 | def add_news |
|
368 | 368 | @news = News.new(:project => @project) |
|
369 | 369 | if request.post? |
|
370 | 370 | @news.attributes = params[:news] |
|
371 | 371 | @news.author_id = self.logged_in_user.id if self.logged_in_user |
|
372 | 372 | if @news.save |
|
373 | 373 | flash[:notice] = l(:notice_successful_create) |
|
374 | 374 | redirect_to :action => 'list_news', :id => @project |
|
375 | 375 | end |
|
376 | 376 | end |
|
377 | 377 | end |
|
378 | 378 | |
|
379 | 379 | # Show news list of @project |
|
380 | 380 | def list_news |
|
381 | 381 | @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC" |
|
382 | 382 | render :action => "list_news", :layout => false if request.xhr? |
|
383 | 383 | end |
|
384 | 384 | |
|
385 | 385 | def add_file |
|
386 | 386 | if request.post? |
|
387 | 387 | @version = @project.versions.find_by_id(params[:version_id]) |
|
388 | 388 | # Save the attachments |
|
389 | 389 | @attachments = [] |
|
390 | 390 | params[:attachments].each { |file| |
|
391 | 391 | next unless file.size > 0 |
|
392 | 392 | a = Attachment.create(:container => @version, :file => file, :author => logged_in_user) |
|
393 | 393 | @attachments << a unless a.new_record? |
|
394 | 394 | } if params[:attachments] and params[:attachments].is_a? Array |
|
395 | 395 | Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? |
|
396 | 396 | redirect_to :controller => 'projects', :action => 'list_files', :id => @project |
|
397 | 397 | end |
|
398 | 398 | @versions = @project.versions |
|
399 | 399 | end |
|
400 | 400 | |
|
401 | 401 | def list_files |
|
402 | 402 | @versions = @project.versions |
|
403 | 403 | end |
|
404 | 404 | |
|
405 | 405 | # Show changelog for @project |
|
406 | 406 | def changelog |
|
407 | 407 | @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true]) |
|
408 | 408 | if request.get? |
|
409 | 409 | @selected_tracker_ids = @trackers.collect {|t| t.id.to_s } |
|
410 | 410 | else |
|
411 | 411 | @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array |
|
412 | 412 | end |
|
413 | 413 | @selected_tracker_ids ||= [] |
|
414 | 414 | @fixed_issues = @project.issues.find(:all, |
|
415 | 415 | :include => [ :fixed_version, :status, :tracker ], |
|
416 | 416 | :conditions => [ "issue_statuses.is_closed=? and issues.tracker_id in (#{@selected_tracker_ids.join(',')}) and issues.fixed_version_id is not null", true], |
|
417 | 417 | :order => "versions.effective_date DESC, issues.id DESC" |
|
418 | 418 | ) unless @selected_tracker_ids.empty? |
|
419 | 419 | @fixed_issues ||= [] |
|
420 | 420 | end |
|
421 | 421 | |
|
422 | 422 | def activity |
|
423 | 423 | if params[:year] and params[:year].to_i > 1900 |
|
424 | 424 | @year = params[:year].to_i |
|
425 | 425 | if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 |
|
426 | 426 | @month = params[:month].to_i |
|
427 | 427 | end |
|
428 | 428 | end |
|
429 | 429 | @year ||= Date.today.year |
|
430 | 430 | @month ||= Date.today.month |
|
431 | 431 | |
|
432 | 432 | @date_from = Date.civil(@year, @month, 1) |
|
433 | 433 | @date_to = (@date_from >> 1)-1 |
|
434 | 434 | |
|
435 | 435 | @events_by_day = {} |
|
436 | 436 | |
|
437 | 437 | unless params[:show_issues] == "0" |
|
438 | 438 | @project.issues.find(:all, :include => [:author, :status], :conditions => ["issues.created_on>=? and issues.created_on<=?", @date_from, @date_to] ).each { |i| |
|
439 | 439 | @events_by_day[i.created_on.to_date] ||= [] |
|
440 | 440 | @events_by_day[i.created_on.to_date] << i |
|
441 | 441 | } |
|
442 | 442 | @show_issues = 1 |
|
443 | 443 | end |
|
444 | 444 | |
|
445 | 445 | unless params[:show_news] == "0" |
|
446 | 446 | @project.news.find(:all, :conditions => ["news.created_on>=? and news.created_on<=?", @date_from, @date_to], :include => :author ).each { |i| |
|
447 | 447 | @events_by_day[i.created_on.to_date] ||= [] |
|
448 | 448 | @events_by_day[i.created_on.to_date] << i |
|
449 | 449 | } |
|
450 | 450 | @show_news = 1 |
|
451 | 451 | end |
|
452 | 452 | |
|
453 | 453 | unless params[:show_files] == "0" |
|
454 | 454 | Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN versions ON versions.id = attachments.container_id", :conditions => ["attachments.container_type='Version' and versions.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i| |
|
455 | 455 | @events_by_day[i.created_on.to_date] ||= [] |
|
456 | 456 | @events_by_day[i.created_on.to_date] << i |
|
457 | 457 | } |
|
458 | 458 | @show_files = 1 |
|
459 | 459 | end |
|
460 | 460 | |
|
461 | 461 | unless params[:show_documents] == "0" |
|
462 | 462 | @project.documents.find(:all, :conditions => ["documents.created_on>=? and documents.created_on<=?", @date_from, @date_to] ).each { |i| |
|
463 | 463 | @events_by_day[i.created_on.to_date] ||= [] |
|
464 | 464 | @events_by_day[i.created_on.to_date] << i |
|
465 | 465 | } |
|
466 | 466 | Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i| |
|
467 | 467 | @events_by_day[i.created_on.to_date] ||= [] |
|
468 | 468 | @events_by_day[i.created_on.to_date] << i |
|
469 | 469 | } |
|
470 | 470 | @show_documents = 1 |
|
471 | 471 | end |
|
472 | 472 | |
|
473 | 473 | render :layout => false if request.xhr? |
|
474 | 474 | end |
|
475 | 475 | |
|
476 | 476 | def calendar |
|
477 | 477 | if params[:year] and params[:year].to_i > 1900 |
|
478 | 478 | @year = params[:year].to_i |
|
479 | 479 | if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 |
|
480 | 480 | @month = params[:month].to_i |
|
481 | 481 | end |
|
482 | 482 | end |
|
483 | 483 | @year ||= Date.today.year |
|
484 | 484 | @month ||= Date.today.month |
|
485 | 485 | |
|
486 | 486 | @date_from = Date.civil(@year, @month, 1) |
|
487 | 487 | @date_to = (@date_from >> 1)-1 |
|
488 | 488 | # start on monday |
|
489 | 489 | @date_from = @date_from - (@date_from.cwday-1) |
|
490 | 490 | # finish on sunday |
|
491 | 491 | @date_to = @date_to + (7-@date_to.cwday) |
|
492 | 492 | |
|
493 | 493 | @issues = @project.issues.find(:all, :include => [:tracker, :status, :assigned_to, :priority], :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to]) |
|
494 | 494 | render :layout => false if request.xhr? |
|
495 | 495 | end |
|
496 | 496 | |
|
497 | 497 | def gantt |
|
498 | 498 | if params[:year] and params[:year].to_i >0 |
|
499 | 499 | @year_from = params[:year].to_i |
|
500 | 500 | if params[:month] and params[:month].to_i >=1 and params[:month].to_i <= 12 |
|
501 | 501 | @month_from = params[:month].to_i |
|
502 | 502 | else |
|
503 | 503 | @month_from = 1 |
|
504 | 504 | end |
|
505 | 505 | else |
|
506 | 506 | @month_from ||= (Date.today << 1).month |
|
507 | 507 | @year_from ||= (Date.today << 1).year |
|
508 | 508 | end |
|
509 | 509 | |
|
510 | 510 | @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2 |
|
511 | 511 | @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6 |
|
512 | 512 | |
|
513 | 513 | @date_from = Date.civil(@year_from, @month_from, 1) |
|
514 | 514 | @date_to = (@date_from >> @months) - 1 |
|
515 | 515 | @issues = @project.issues.find(:all, :order => "start_date, due_date", :include => [:tracker, :status, :assigned_to, :priority], :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to]) |
|
516 | 516 | |
|
517 | 517 | if params[:output]=='pdf' |
|
518 | 518 | @options_for_rfpdf ||= {} |
|
519 | 519 | @options_for_rfpdf[:file_name] = "gantt.pdf" |
|
520 | 520 | render :template => "projects/gantt.rfpdf", :layout => false |
|
521 | 521 | else |
|
522 | 522 | render :template => "projects/gantt.rhtml" |
|
523 | 523 | end |
|
524 | 524 | end |
|
525 | 525 | |
|
526 | 526 | private |
|
527 | 527 | # Find project of id params[:id] |
|
528 | 528 | # if not found, redirect to project list |
|
529 | 529 | # Used as a before_filter |
|
530 | 530 | def find_project |
|
531 | 531 | @project = Project.find(params[:id]) |
|
532 | 532 | @html_title = @project.name |
|
533 | 533 | rescue ActiveRecord::RecordNotFound |
|
534 | 534 | render_404 |
|
535 | 535 | end |
|
536 | 536 | |
|
537 | 537 | # Retrieve query from session or build a new query |
|
538 | 538 | def retrieve_query |
|
539 | 539 | if params[:query_id] |
|
540 | 540 | @query = @project.queries.find(params[:query_id]) |
|
541 | 541 | session[:query] = @query |
|
542 | 542 | else |
|
543 | 543 | if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id |
|
544 | 544 | # Give it a name, required to be valid |
|
545 | 545 | @query = Query.new(:name => "_") |
|
546 | 546 | @query.project = @project |
|
547 | 547 | if params[:fields] and params[:fields].is_a? Array |
|
548 | 548 | params[:fields].each do |field| |
|
549 | 549 | @query.add_filter(field, params[:operators][field], params[:values][field]) |
|
550 | 550 | end |
|
551 | 551 | else |
|
552 | 552 | @query.available_filters.keys.each do |field| |
|
553 | 553 | @query.add_short_filter(field, params[field]) if params[field] |
|
554 | 554 | end |
|
555 | 555 | end |
|
556 | 556 | session[:query] = @query |
|
557 | 557 | else |
|
558 | 558 | @query = session[:query] |
|
559 | 559 | end |
|
560 | 560 | end |
|
561 | 561 | end |
|
562 | 562 | end |
@@ -1,84 +1,102 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006 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 RolesController < ApplicationController |
|
19 | 19 | layout 'base' |
|
20 | 20 | before_filter :require_admin |
|
21 | 21 | |
|
22 | verify :method => :post, :only => [ :destroy, :move ], | |
|
23 | :redirect_to => { :action => :list } | |
|
24 | ||
|
22 | 25 | def index |
|
23 | 26 | list |
|
24 | 27 | render :action => 'list' unless request.xhr? |
|
25 | 28 | end |
|
26 | 29 | |
|
27 | 30 | def list |
|
28 | @role_pages, @roles = paginate :roles, :per_page => 10 | |
|
31 | @role_pages, @roles = paginate :roles, :per_page => 10, :order => "position" | |
|
29 | 32 | render :action => "list", :layout => false if request.xhr? |
|
30 | 33 | end |
|
31 | 34 | |
|
32 | 35 | def new |
|
33 | 36 | @role = Role.new(params[:role]) |
|
34 | 37 | if request.post? |
|
35 | 38 | @role.permissions = Permission.find(params[:permission_ids]) if params[:permission_ids] |
|
36 | 39 | if @role.save |
|
37 | 40 | flash[:notice] = l(:notice_successful_create) |
|
38 | 41 | redirect_to :action => 'list' |
|
39 | 42 | end |
|
40 | 43 | end |
|
41 | 44 | @permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC') |
|
42 | 45 | end |
|
43 | 46 | |
|
44 | 47 | def edit |
|
45 | 48 | @role = Role.find(params[:id]) |
|
46 | 49 | if request.post? and @role.update_attributes(params[:role]) |
|
47 | 50 | @role.permissions = Permission.find(params[:permission_ids] || []) |
|
48 | 51 | Permission.allowed_to_role_expired |
|
49 | 52 | flash[:notice] = l(:notice_successful_update) |
|
50 | 53 | redirect_to :action => 'list' |
|
51 | 54 | end |
|
52 | 55 | @permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC') |
|
53 | 56 | end |
|
54 | 57 | |
|
55 | 58 | def destroy |
|
56 | 59 | @role = Role.find(params[:id]) |
|
57 | 60 | unless @role.members.empty? |
|
58 | 61 | flash[:notice] = 'Some members have this role. Can\'t delete it.' |
|
59 | 62 | else |
|
60 | 63 | @role.destroy |
|
61 | 64 | end |
|
62 | 65 | redirect_to :action => 'list' |
|
63 | 66 | end |
|
64 | 67 | |
|
68 | def move | |
|
69 | @role = Role.find(params[:id]) | |
|
70 | case params[:position] | |
|
71 | when 'highest' | |
|
72 | @role.move_to_top | |
|
73 | when 'higher' | |
|
74 | @role.move_higher | |
|
75 | when 'lower' | |
|
76 | @role.move_lower | |
|
77 | when 'lowest' | |
|
78 | @role.move_to_bottom | |
|
79 | end if params[:position] | |
|
80 | redirect_to :action => 'list' | |
|
81 | end | |
|
82 | ||
|
65 | 83 | def workflow |
|
66 | 84 | @role = Role.find_by_id(params[:role_id]) |
|
67 | 85 | @tracker = Tracker.find_by_id(params[:tracker_id]) |
|
68 | 86 | |
|
69 | 87 | if request.post? |
|
70 | 88 | Workflow.destroy_all( ["role_id=? and tracker_id=?", @role.id, @tracker.id]) |
|
71 | 89 | (params[:issue_status] || []).each { |old, news| |
|
72 | 90 | news.each { |new| |
|
73 | 91 | @role.workflows.build(:tracker_id => @tracker.id, :old_status_id => old, :new_status_id => new) |
|
74 | 92 | } |
|
75 | 93 | } |
|
76 | 94 | if @role.save |
|
77 | 95 | flash[:notice] = l(:notice_successful_update) |
|
78 | 96 | end |
|
79 | 97 | end |
|
80 |
@roles = Role.find : |
|
|
98 | @roles = Role.find(:all, :order => 'position') | |
|
81 | 99 | @trackers = Tracker.find :all |
|
82 | 100 | @statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position') |
|
83 | 101 | end |
|
84 | 102 | end |
@@ -1,113 +1,113 | |||
|
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 UsersController < ApplicationController |
|
19 | 19 | layout 'base' |
|
20 | 20 | before_filter :require_admin |
|
21 | 21 | |
|
22 | 22 | helper :sort |
|
23 | 23 | include SortHelper |
|
24 | 24 | helper :custom_fields |
|
25 | 25 | include CustomFieldsHelper |
|
26 | 26 | |
|
27 | 27 | def index |
|
28 | 28 | list |
|
29 | 29 | render :action => 'list' unless request.xhr? |
|
30 | 30 | end |
|
31 | 31 | |
|
32 | 32 | def list |
|
33 | 33 | sort_init 'login', 'asc' |
|
34 | 34 | sort_update |
|
35 | 35 | @user_count = User.count |
|
36 | 36 | @user_pages = Paginator.new self, @user_count, |
|
37 | 37 | 15, |
|
38 | 38 | params['page'] |
|
39 | 39 | @users = User.find :all,:order => sort_clause, |
|
40 | 40 | :limit => @user_pages.items_per_page, |
|
41 | 41 | :offset => @user_pages.current.offset |
|
42 | 42 | |
|
43 | 43 | render :action => "list", :layout => false if request.xhr? |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | def add |
|
47 | 47 | if request.get? |
|
48 | 48 | @user = User.new(:language => Setting.default_language) |
|
49 | 49 | @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) } |
|
50 | 50 | else |
|
51 | 51 | @user = User.new(params[:user]) |
|
52 | 52 | @user.admin = params[:user][:admin] || false |
|
53 | 53 | @user.login = params[:user][:login] |
|
54 | 54 | @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless @user.auth_source_id |
|
55 | 55 | @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) } |
|
56 | 56 | @user.custom_values = @custom_values |
|
57 | 57 | if @user.save |
|
58 | 58 | flash[:notice] = l(:notice_successful_create) |
|
59 | 59 | redirect_to :action => 'list' |
|
60 | 60 | end |
|
61 | 61 | end |
|
62 | 62 | @auth_sources = AuthSource.find(:all) |
|
63 | 63 | end |
|
64 | 64 | |
|
65 | 65 | def edit |
|
66 | 66 | @user = User.find(params[:id]) |
|
67 | 67 | if request.get? |
|
68 | 68 | @custom_values = UserCustomField.find(:all).collect { |x| @user.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) } |
|
69 | 69 | else |
|
70 | 70 | @user.admin = params[:user][:admin] if params[:user][:admin] |
|
71 | 71 | @user.login = params[:user][:login] if params[:user][:login] |
|
72 | 72 | @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless params[:password].nil? or params[:password].empty? or @user.auth_source_id |
|
73 | 73 | if params[:custom_fields] |
|
74 | 74 | @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) } |
|
75 | 75 | @user.custom_values = @custom_values |
|
76 | 76 | end |
|
77 | 77 | if @user.update_attributes(params[:user]) |
|
78 | 78 | flash[:notice] = l(:notice_successful_update) |
|
79 | 79 | redirect_to :action => 'list' |
|
80 | 80 | end |
|
81 | 81 | end |
|
82 | 82 | @auth_sources = AuthSource.find(:all) |
|
83 |
@roles = Role.find : |
|
|
83 | @roles = Role.find(:all, :order => 'position') | |
|
84 | 84 | @projects = Project.find(:all) - @user.projects |
|
85 | 85 | @membership ||= Member.new |
|
86 | 86 | end |
|
87 | 87 | |
|
88 | 88 | def edit_membership |
|
89 | 89 | @user = User.find(params[:id]) |
|
90 | 90 | @membership = params[:membership_id] ? Member.find(params[:membership_id]) : Member.new(:user => @user) |
|
91 | 91 | @membership.attributes = params[:membership] |
|
92 | 92 | if request.post? and @membership.save |
|
93 | 93 | flash[:notice] = l(:notice_successful_update) |
|
94 | 94 | end |
|
95 | 95 | redirect_to :action => 'edit', :id => @user and return |
|
96 | 96 | end |
|
97 | 97 | |
|
98 | 98 | def destroy_membership |
|
99 | 99 | @user = User.find(params[:id]) |
|
100 | 100 | if request.post? and Member.find(params[:membership_id]).destroy |
|
101 | 101 | flash[:notice] = l(:notice_successful_update) |
|
102 | 102 | end |
|
103 | 103 | redirect_to :action => 'edit', :id => @user and return |
|
104 | 104 | end |
|
105 | 105 | |
|
106 | 106 | def destroy |
|
107 | 107 | User.find(params[:id]).destroy |
|
108 | 108 | redirect_to :action => 'list' |
|
109 | 109 | rescue |
|
110 | 110 | flash[:notice] = "Unable to delete user" |
|
111 | 111 | redirect_to :action => 'list' |
|
112 | 112 | end |
|
113 | 113 | end |
@@ -1,32 +1,33 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006 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 Role < ActiveRecord::Base |
|
19 | 19 | before_destroy :check_integrity |
|
20 | 20 | has_and_belongs_to_many :permissions |
|
21 | 21 | has_many :workflows, :dependent => :delete_all |
|
22 | 22 | has_many :members |
|
23 | acts_as_list | |
|
23 | 24 | |
|
24 | 25 | validates_presence_of :name |
|
25 | 26 | validates_uniqueness_of :name |
|
26 | 27 | validates_format_of :name, :with => /^[\w\s\'\-]*$/i |
|
27 | 28 | |
|
28 | 29 | private |
|
29 | 30 | def check_integrity |
|
30 | 31 | raise "Can't delete role" if Member.find(:first, :conditions =>["role_id=?", self.id]) |
|
31 | 32 | end |
|
32 | 33 | end |
@@ -1,11 +1,11 | |||
|
1 | 1 | <h2><%=l(:label_member_plural)%></h2> |
|
2 | 2 | |
|
3 | 3 | <% members = @members.group_by {|m| m.role } %> |
|
4 | <% members.each do |role, member| %> | |
|
4 | <% members.keys.sort{|x,y| x.position <=> y.position}.each do |role| %> | |
|
5 | 5 | <h3><%= role.name %></h3> |
|
6 | 6 | <ul> |
|
7 | <% member.each do |m| %> | |
|
7 | <% members[role].each do |m| %> | |
|
8 | 8 | <li><%= link_to m.user.display_name, :controller => 'account', :action => 'show', :id => m.user %> (<%= format_date m.created_on %>)</li> |
|
9 | 9 | <% end %> |
|
10 | 10 | </ul> |
|
11 | 11 | <% end %> |
@@ -1,115 +1,115 | |||
|
1 | 1 | <h2><%=l(:label_settings)%></h2> |
|
2 | 2 | |
|
3 | 3 | <div class="tabs"> |
|
4 | 4 | <ul> |
|
5 | 5 | <li><%= link_to l(:label_information_plural), {}, :id=> "tab-info", :onclick => "showTab('info'); this.blur(); return false;" %></li> |
|
6 | 6 | <li><%= link_to l(:label_member_plural), {}, :id=> "tab-members", :onclick => "showTab('members'); this.blur(); return false;" %></li> |
|
7 | 7 | <li><%= link_to l(:label_version_plural), {}, :id=> "tab-versions", :onclick => "showTab('versions'); this.blur(); return false;" %></li> |
|
8 | 8 | <li><%= link_to l(:label_issue_category_plural), {}, :id=> "tab-categories", :onclick => "showTab('categories'); this.blur(); return false;" %></li> |
|
9 | 9 | </ul> |
|
10 | 10 | </div> |
|
11 | 11 | |
|
12 | 12 | <div id="tab-content-info" class="tab-content"> |
|
13 | 13 | <% if authorize_for('projects', 'edit') %> |
|
14 | 14 | <% labelled_tabular_form_for :project, @project, :url => { :action => "edit", :id => @project } do |f| %> |
|
15 | 15 | <%= render :partial => 'form', :locals => { :f => f } %> |
|
16 | 16 | <%= submit_tag l(:button_save) %> |
|
17 | 17 | <% end %> |
|
18 | 18 | <% end %> |
|
19 | 19 | </div> |
|
20 | 20 | |
|
21 | 21 | <div id="tab-content-members" class="tab-content" style="display:none;"> |
|
22 | 22 | <%= error_messages_for 'member' %> |
|
23 | 23 | <table class="list"> |
|
24 | 24 | <thead><th><%= l(:label_user) %></th><th><%= l(:label_role) %></th><th></th></thead> |
|
25 | 25 | <tbody> |
|
26 | <% for member in @project.members.find(:all, :include => :user) %> | |
|
26 | <% @project.members.find(:all, :include => [:role, :user]).sort{|x,y| x.role.position <=> y.role.position}.each do |member| %> | |
|
27 | 27 | <% unless member.new_record? %> |
|
28 | 28 | <tr class="<%= cycle 'odd', 'even' %>"> |
|
29 | 29 | <td><%= member.user.display_name %></td> |
|
30 | 30 | <td align="center"> |
|
31 | 31 | <% if authorize_for('members', 'edit') %> |
|
32 | 32 | <% form_tag({:controller => 'members', :action => 'edit', :id => member}) do %> |
|
33 | 33 | <select name="member[role_id]"> |
|
34 | 34 | <%= options_from_collection_for_select @roles, "id", "name", member.role_id %> |
|
35 | 35 | </select> |
|
36 | 36 | <%= submit_tag l(:button_change), :class => "button-small" %> |
|
37 | 37 | <% end %> |
|
38 | 38 | <% end %> |
|
39 | 39 | </td> |
|
40 | 40 | <td align="center"> |
|
41 | 41 | <%= link_to_if_authorized l(:button_delete), {:controller => 'members', :action => 'destroy', :id => member}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
42 | 42 | </td> |
|
43 | 43 | </tr> |
|
44 | 44 | <% end %> |
|
45 | 45 | </tbody> |
|
46 | 46 | <% end; reset_cycle %> |
|
47 | 47 | </table> |
|
48 | 48 | <% if authorize_for('projects', 'add_member') %> |
|
49 | 49 | <label><%=l(:label_member_new)%></label><br/> |
|
50 | 50 | <% form_tag({:controller => 'projects', :action => 'add_member', :tab => 'members', :id => @project}) do %> |
|
51 | 51 | <select name="member[user_id]"> |
|
52 | 52 | <%= options_from_collection_for_select @users, "id", "display_name", @member.user_id %> |
|
53 | 53 | </select> |
|
54 | 54 | <select name="member[role_id]"> |
|
55 | 55 | <%= options_from_collection_for_select @roles, "id", "name", @member.role_id %> |
|
56 | 56 | </select> |
|
57 | 57 | <%= submit_tag l(:button_add) %> |
|
58 | 58 | <% end %> |
|
59 | 59 | <% end %> |
|
60 | 60 | </div> |
|
61 | 61 | |
|
62 | 62 | <div id="tab-content-versions" class="tab-content" style="display:none;"> |
|
63 | 63 | <table class="list"> |
|
64 | 64 | <thead><th><%= l(:label_version) %></th><th><%= l(:field_effective_date) %></th><th><%= l(:field_description) %></th><th></th><th></th></thead> |
|
65 | 65 | <tbody> |
|
66 | 66 | <% for version in @project.versions %> |
|
67 | 67 | <tr class="<%= cycle 'odd', 'even' %>"> |
|
68 | 68 | <td><strong><%=h version.name %></strong></td> |
|
69 | 69 | <td align="center"><%= format_date(version.effective_date) %></td> |
|
70 | 70 | <td><%=h version.description %></td> |
|
71 | 71 | <td align="center"><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></td> |
|
72 | 72 | <td align="center"><%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></td> |
|
73 | 73 | </td> |
|
74 | 74 | </tr> |
|
75 | 75 | <% end; reset_cycle %> |
|
76 | 76 | </tbody> |
|
77 | 77 | </table> |
|
78 | 78 | <%= link_to_if_authorized l(:label_version_new), :controller => 'projects', :action => 'add_version', :id => @project %> |
|
79 | 79 | </div> |
|
80 | 80 | |
|
81 | 81 | <div id="tab-content-categories" class="tab-content" style="display:none;"> |
|
82 | 82 | <table class="list"> |
|
83 | 83 | <thead><th><%= l(:label_issue_category) %></th><th></th></thead> |
|
84 | 84 | <tbody> |
|
85 | 85 | <% for @category in @project.issue_categories %> |
|
86 | 86 | <% unless @category.new_record? %> |
|
87 | 87 | <tr class="<%= cycle 'odd', 'even' %>"> |
|
88 | 88 | <td> |
|
89 | 89 | <% form_tag({:controller => 'issue_categories', :action => 'edit', :id => @category}) do %> |
|
90 | 90 | <%= text_field 'category', 'name', :size => 25 %> |
|
91 | 91 | <% if authorize_for('issue_categories', 'edit') %> |
|
92 | 92 | <%= submit_tag l(:button_save), :class => "button-small" %> |
|
93 | 93 | <% end %> |
|
94 | 94 | <% end %> |
|
95 | 95 | </td> |
|
96 | 96 | <td align="center"> |
|
97 | 97 | <%= link_to_if_authorized l(:button_delete), {:controller => 'issue_categories', :action => 'destroy', :id => @category}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
98 | 98 | </td> |
|
99 | 99 | </tr> |
|
100 | 100 | <% end %> |
|
101 | 101 | <% end %> |
|
102 | 102 | </tbody> |
|
103 | 103 | </table> |
|
104 | 104 | <% if authorize_for('projects', 'add_issue_category') %> |
|
105 | 105 | <% form_tag({:action => 'add_issue_category', :tab => 'categories', :id => @project}) do %> |
|
106 | 106 | <label for="issue_category_name"><%=l(:label_issue_category_new)%></label><br/> |
|
107 | 107 | <%= error_messages_for 'issue_category' %> |
|
108 | 108 | <%= text_field 'issue_category', 'name', :size => 25 %> |
|
109 | 109 | <%= submit_tag l(:button_create) %> |
|
110 | 110 | <% end %> |
|
111 | 111 | <% end %> |
|
112 | 112 | </div> |
|
113 | 113 | |
|
114 | 114 | <%= tab = params[:tab] ? h(params[:tab]) : 'info' |
|
115 | 115 | javascript_tag "showTab('#{tab}');" %> No newline at end of file |
@@ -1,23 +1,30 | |||
|
1 | 1 | <div class="contextual"> |
|
2 | 2 | <%= link_to l(:label_role_new), {:action => 'new'}, :class => 'icon icon-add' %> |
|
3 | 3 | </div> |
|
4 | 4 | |
|
5 | 5 | <h2><%=l(:label_role_plural)%></h2> |
|
6 | 6 | |
|
7 | 7 | <table class="list"> |
|
8 | 8 | <thead><tr> |
|
9 | 9 | <th><%=l(:label_role)%></th> |
|
10 | <th><%=l(:button_sort)%></th> | |
|
10 | 11 | <th></th> |
|
11 | 12 | </tr></thead> |
|
12 | 13 | <tbody> |
|
13 | 14 | <% for role in @roles %> |
|
14 | 15 | <tr class="<%= cycle("odd", "even") %>"> |
|
15 | 16 | <td><%= link_to role.name, :action => 'edit', :id => role %></td> |
|
16 | 17 | <td align="center"> |
|
18 | <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => role, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %> | |
|
19 | <%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => role, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> - | |
|
20 | <%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:action => 'move', :id => role, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %> | |
|
21 | <%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => role, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %> | |
|
22 | </td> | |
|
23 | <td align="center"> | |
|
17 | 24 | <%= button_to l(:button_delete), { :action => 'destroy', :id => role }, :confirm => l(:text_are_you_sure), :class => "button-small" %> |
|
18 | 25 | </tr> |
|
19 | 26 | <% end %> |
|
20 | 27 | </tbody> |
|
21 | 28 | </table> |
|
22 | 29 | |
|
23 | 30 | <%= pagination_links_full @role_pages %> No newline at end of file |
@@ -1,129 +1,129 | |||
|
1 | 1 | == redMine changelog |
|
2 | 2 | |
|
3 | 3 | redMine - project management software |
|
4 | 4 | Copyright (C) 2006-2007 Jean-Philippe Lang |
|
5 | 5 | http://redmine.rubyforge.org/ |
|
6 | 6 | |
|
7 | 7 | |
|
8 | 8 | == xx/xx/2006 v0.4.2 |
|
9 | 9 | |
|
10 | 10 | * Rails 1.2 is now required |
|
11 | 11 | * settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used) |
|
12 | 12 | * mail notifications added when a document, a file or an attachment is added |
|
13 | 13 | * tooltips added on Gantt chart and calender to view the details of the issues |
|
14 | * ability to set the sort order for issue statuses | |
|
14 | * ability to set the sort order for roles, issue statuses | |
|
15 | 15 | * added missing fields to csv export: priority, start date, due date, done ratio |
|
16 | 16 | * all icons replaced (new icons are based on GPL icon set: "KDE Crystal Diamond 2.5" -by paolino- and "kNeu! Alpha v0.1" -by Pablo Fabregat-) |
|
17 | 17 | * added back "fixed version" field on issue screen and in filters |
|
18 | 18 | * project settings screen split in 4 tabs |
|
19 | 19 | * fixed: subprojects count is always 0 on projects list |
|
20 | 20 | * fixed: setting an issue status as default status leads to an sql error with SQLite |
|
21 | 21 | * fixed: unable to delete an issue status even if it's not used yet |
|
22 | 22 | * fixed: filters ignored when exporting a predefined query to csv/pdf |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | == 01/03/2006 v0.4.1 |
|
26 | 26 | |
|
27 | 27 | * fixed: emails have no recipient when one of the project members has notifications disabled |
|
28 | 28 | |
|
29 | 29 | |
|
30 | 30 | == 01/02/2006 v0.4.0 |
|
31 | 31 | |
|
32 | 32 | * simple SVN browser added (just needs svn binaries in PATH) |
|
33 | 33 | * comments can now be added on news |
|
34 | 34 | * "my page" is now customizable |
|
35 | 35 | * more powerfull and savable filters for issues lists |
|
36 | 36 | * improved issues change history |
|
37 | 37 | * new functionality: move an issue to another project or tracker |
|
38 | 38 | * new functionality: add a note to an issue |
|
39 | 39 | * new report: project activity |
|
40 | 40 | * "start date" and "% done" fields added on issues |
|
41 | 41 | * project calendar added |
|
42 | 42 | * gantt chart added (exportable to pdf) |
|
43 | 43 | * single/multiple issues pdf export added |
|
44 | 44 | * issues reports improvements |
|
45 | 45 | * multiple file upload for issues, documents and files |
|
46 | 46 | * option to set maximum size of uploaded files |
|
47 | 47 | * textile formating of issue and news descritions (RedCloth required) |
|
48 | 48 | * integration of DotClear jstoolbar for textile formatting |
|
49 | 49 | * calendar date picker for date fields (LGPL DHTML Calendar http://sourceforge.net/projects/jscalendar) |
|
50 | 50 | * new filter in issues list: Author |
|
51 | 51 | * ajaxified paginators |
|
52 | 52 | * news rss feed added |
|
53 | 53 | * option to set number of results per page on issues list |
|
54 | 54 | * localized csv separator (comma/semicolon) |
|
55 | 55 | * csv output encoded to ISO-8859-1 |
|
56 | 56 | * user custom field displayed on account/show |
|
57 | 57 | * default configuration improved (default roles, trackers, status, permissions and workflows) |
|
58 | 58 | * language for default configuration data can now be chosen when running 'load_default_data' task |
|
59 | 59 | * javascript added on custom field form to show/hide fields according to the format of custom field |
|
60 | 60 | * fixed: custom fields not in csv exports |
|
61 | 61 | * fixed: project settings now displayed according to user's permissions |
|
62 | 62 | * fixed: application error when no version is selected on projects/add_file |
|
63 | 63 | * fixed: public actions not authorized for members of non public projects |
|
64 | 64 | * fixed: non public projects were shown on welcome screen even if current user is not a member |
|
65 | 65 | |
|
66 | 66 | |
|
67 | 67 | == 10/08/2006 v0.3.0 |
|
68 | 68 | |
|
69 | 69 | * user authentication against multiple LDAP (optional) |
|
70 | 70 | * token based "lost password" functionality |
|
71 | 71 | * user self-registration functionality (optional) |
|
72 | 72 | * custom fields now available for issues, users and projects |
|
73 | 73 | * new custom field format "text" (displayed as a textarea field) |
|
74 | 74 | * project & administration drop down menus in navigation bar for quicker access |
|
75 | 75 | * text formatting is preserved for long text fields (issues, projects and news descriptions) |
|
76 | 76 | * urls and emails are turned into clickable links in long text fields |
|
77 | 77 | * "due date" field added on issues |
|
78 | 78 | * tracker selection filter added on change log |
|
79 | 79 | * Localization plugin replaced with GLoc 1.1.0 (iconv required) |
|
80 | 80 | * error messages internationalization |
|
81 | 81 | * german translation added (thanks to Karim Trott) |
|
82 | 82 | * data locking for issues to prevent update conflicts (using ActiveRecord builtin optimistic locking) |
|
83 | 83 | * new filter in issues list: "Fixed version" |
|
84 | 84 | * active filters are displayed with colored background on issues list |
|
85 | 85 | * custom configuration is now defined in config/config_custom.rb |
|
86 | 86 | * user object no more stored in session (only user_id) |
|
87 | 87 | * news summary field is no longer required |
|
88 | 88 | * tables and forms redesign |
|
89 | 89 | * Fixed: boolean custom field not working |
|
90 | 90 | * Fixed: error messages for custom fields are not displayed |
|
91 | 91 | * Fixed: invalid custom fields should have a red border |
|
92 | 92 | * Fixed: custom fields values are not validated on issue update |
|
93 | 93 | * Fixed: unable to choose an empty value for 'List' custom fields |
|
94 | 94 | * Fixed: no issue categories sorting |
|
95 | 95 | * Fixed: incorrect versions sorting |
|
96 | 96 | |
|
97 | 97 | |
|
98 | 98 | == 07/12/2006 - v0.2.2 |
|
99 | 99 | |
|
100 | 100 | * Fixed: bug in "issues list" |
|
101 | 101 | |
|
102 | 102 | |
|
103 | 103 | == 07/09/2006 - v0.2.1 |
|
104 | 104 | |
|
105 | 105 | * new databases supported: Oracle, PostgreSQL, SQL Server |
|
106 | 106 | * projects/subprojects hierarchy (1 level of subprojects only) |
|
107 | 107 | * environment information display in admin/info |
|
108 | 108 | * more filter options in issues list (rev6) |
|
109 | 109 | * default language based on browser settings (Accept-Language HTTP header) |
|
110 | 110 | * issues list exportable to CSV (rev6) |
|
111 | 111 | * simple_format and auto_link on long text fields |
|
112 | 112 | * more data validations |
|
113 | 113 | * Fixed: error when all mail notifications are unchecked in admin/mail_options |
|
114 | 114 | * Fixed: all project news are displayed on project summary |
|
115 | 115 | * Fixed: Can't change user password in users/edit |
|
116 | 116 | * Fixed: Error on tables creation with PostgreSQL (rev5) |
|
117 | 117 | * Fixed: SQL error in "issue reports" view with PostgreSQL (rev5) |
|
118 | 118 | |
|
119 | 119 | |
|
120 | 120 | == 06/25/2006 - v0.1.0 |
|
121 | 121 | |
|
122 | 122 | * multiple users/multiple projects |
|
123 | 123 | * role based access control |
|
124 | 124 | * issue tracking system |
|
125 | 125 | * fully customizable workflow |
|
126 | 126 | * documents/files repository |
|
127 | 127 | * email notifications on issue creation and update |
|
128 | 128 | * multilanguage support (except for error messages):english, french, spanish |
|
129 | 129 | * online manual in french (unfinished) No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now