@@ -1,44 +1,44 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 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 IssueCategoriesController < ApplicationController |
|
18 | class IssueCategoriesController < ApplicationController | |
19 |
|
|
19 | layout 'base' | |
20 |
|
|
20 | before_filter :find_project, :authorize | |
21 |
|
21 | |||
22 | def edit |
|
22 | def edit | |
23 | if request.post? and @category.update_attributes(params[:category]) |
|
23 | if request.post? and @category.update_attributes(params[:category]) | |
24 | flash[:notice] = l(:notice_successful_update) |
|
24 | flash[:notice] = l(:notice_successful_update) | |
25 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project |
|
25 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project | |
26 | end |
|
26 | end | |
27 | end |
|
27 | end | |
28 |
|
28 | |||
29 | def destroy |
|
29 | def destroy | |
30 | @category.destroy |
|
30 | @category.destroy | |
31 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project |
|
31 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project | |
32 | rescue |
|
32 | rescue | |
33 | flash[:notice] = "Categorie can't be deleted" |
|
33 | flash[:notice] = "Categorie can't be deleted" | |
34 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project |
|
34 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project | |
35 | end |
|
35 | end | |
36 |
|
36 | |||
37 | private |
|
37 | private | |
38 | def find_project |
|
38 | def find_project | |
39 | @category = IssueCategory.find(params[:id]) |
|
39 | @category = IssueCategory.find(params[:id]) | |
40 | @project = @category.project |
|
40 | @project = @category.project | |
41 | rescue ActiveRecord::RecordNotFound |
|
41 | rescue ActiveRecord::RecordNotFound | |
42 | render_404 |
|
42 | render_404 | |
43 | end |
|
43 | end | |
44 | end |
|
44 | end |
@@ -1,69 +1,67 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 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 IssueStatusesController < ApplicationController |
|
18 | class IssueStatusesController < ApplicationController | |
19 |
|
|
19 | layout 'base' | |
20 |
|
|
20 | before_filter :require_admin | |
21 |
|
21 | |||
22 | def index |
|
22 | def index | |
23 | list |
|
23 | list | |
24 | render :action => 'list' unless request.xhr? |
|
24 | render :action => 'list' unless request.xhr? | |
25 | end |
|
25 | end | |
26 |
|
26 | |||
27 | def list |
|
27 | def list | |
28 | @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 10 |
|
28 | @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 10 | |
29 | render :action => "list", :layout => false if request.xhr? |
|
29 | render :action => "list", :layout => false if request.xhr? | |
30 | end |
|
30 | end | |
31 |
|
31 | |||
32 | def new |
|
32 | def new | |
33 | @issue_status = IssueStatus.new |
|
33 | @issue_status = IssueStatus.new | |
34 | end |
|
34 | end | |
35 |
|
35 | |||
36 | def create |
|
36 | def create | |
37 | @issue_status = IssueStatus.new(params[:issue_status]) |
|
37 | @issue_status = IssueStatus.new(params[:issue_status]) | |
38 | if @issue_status.save |
|
38 | if @issue_status.save | |
39 | flash[:notice] = l(:notice_successful_create) |
|
39 | flash[:notice] = l(:notice_successful_create) | |
40 | redirect_to :action => 'list' |
|
40 | redirect_to :action => 'list' | |
41 | else |
|
41 | else | |
42 | render :action => 'new' |
|
42 | render :action => 'new' | |
43 | end |
|
43 | end | |
44 | end |
|
44 | end | |
45 |
|
45 | |||
46 | def edit |
|
46 | def edit | |
47 | @issue_status = IssueStatus.find(params[:id]) |
|
47 | @issue_status = IssueStatus.find(params[:id]) | |
48 | end |
|
48 | end | |
49 |
|
49 | |||
50 | def update |
|
50 | def update | |
51 | @issue_status = IssueStatus.find(params[:id]) |
|
51 | @issue_status = IssueStatus.find(params[:id]) | |
52 | if @issue_status.update_attributes(params[:issue_status]) |
|
52 | if @issue_status.update_attributes(params[:issue_status]) | |
53 | flash[:notice] = l(:notice_successful_update) |
|
53 | flash[:notice] = l(:notice_successful_update) | |
54 | redirect_to :action => 'list' |
|
54 | redirect_to :action => 'list' | |
55 | else |
|
55 | else | |
56 | render :action => 'edit' |
|
56 | render :action => 'edit' | |
57 | end |
|
57 | end | |
58 | end |
|
58 | end | |
59 |
|
59 | |||
60 | def destroy |
|
60 | def destroy | |
61 | IssueStatus.find(params[:id]).destroy |
|
61 | IssueStatus.find(params[:id]).destroy | |
62 | redirect_to :action => 'list' |
|
62 | redirect_to :action => 'list' | |
63 | rescue |
|
63 | rescue | |
64 | flash[:notice] = "Unable to delete issue status" |
|
64 | flash[:notice] = "Unable to delete issue status" | |
65 | redirect_to :action => 'list' |
|
65 | redirect_to :action => 'list' | |
66 | end |
|
66 | end | |
67 |
|
||||
68 |
|
||||
69 | end |
|
67 | end |
@@ -1,43 +1,42 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 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 MembersController < ApplicationController |
|
18 | class MembersController < ApplicationController | |
19 | layout 'base' |
|
19 | layout 'base' | |
20 | before_filter :find_project, :authorize |
|
20 | before_filter :find_project, :authorize | |
21 |
|
21 | |||
22 | def edit |
|
22 | def edit | |
23 | if request.post? and @member.update_attributes(params[:member]) |
|
23 | if request.post? and @member.update_attributes(params[:member]) | |
24 | flash[:notice] = l(:notice_successful_update) |
|
24 | flash[:notice] = l(:notice_successful_update) | |
25 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project |
|
25 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project | |
26 | end |
|
26 | end | |
27 | end |
|
27 | end | |
28 |
|
28 | |||
29 | def destroy |
|
29 | def destroy | |
30 | @member.destroy |
|
30 | @member.destroy | |
31 | flash[:notice] = l(:notice_successful_delete) |
|
31 | flash[:notice] = l(:notice_successful_delete) | |
32 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project |
|
32 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project | |
33 | end |
|
33 | end | |
34 |
|
34 | |||
35 | private |
|
35 | private | |
36 | def find_project |
|
36 | def find_project | |
37 | @member = Member.find(params[:id]) |
|
37 | @member = Member.find(params[:id]) | |
38 | @project = @member.project |
|
38 | @project = @member.project | |
39 | rescue ActiveRecord::RecordNotFound |
|
39 | rescue ActiveRecord::RecordNotFound | |
40 | render_404 |
|
40 | render_404 | |
41 |
end |
|
41 | end | |
42 |
|
||||
43 | end |
|
42 | end |
@@ -1,60 +1,60 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 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 NewsController < ApplicationController |
|
18 | class NewsController < ApplicationController | |
19 |
|
|
19 | layout 'base' | |
20 |
|
|
20 | before_filter :find_project, :authorize | |
21 |
|
21 | |||
22 | def show |
|
22 | def show | |
23 | end |
|
23 | end | |
24 |
|
24 | |||
25 | def edit |
|
25 | def edit | |
26 | if request.post? and @news.update_attributes(params[:news]) |
|
26 | if request.post? and @news.update_attributes(params[:news]) | |
27 | flash[:notice] = l(:notice_successful_update) |
|
27 | flash[:notice] = l(:notice_successful_update) | |
28 | redirect_to :action => 'show', :id => @news |
|
28 | redirect_to :action => 'show', :id => @news | |
29 | end |
|
29 | end | |
30 | end |
|
30 | end | |
31 |
|
31 | |||
32 | def add_comment |
|
32 | def add_comment | |
33 | @comment = Comment.new(params[:comment]) |
|
33 | @comment = Comment.new(params[:comment]) | |
34 | @comment.author = logged_in_user |
|
34 | @comment.author = logged_in_user | |
35 | if @news.comments << @comment |
|
35 | if @news.comments << @comment | |
36 | flash[:notice] = l(:label_comment_added) |
|
36 | flash[:notice] = l(:label_comment_added) | |
37 | redirect_to :action => 'show', :id => @news |
|
37 | redirect_to :action => 'show', :id => @news | |
38 | else |
|
38 | else | |
39 | render :action => 'show' |
|
39 | render :action => 'show' | |
40 | end |
|
40 | end | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
43 | def destroy_comment |
|
43 | def destroy_comment | |
44 | @news.comments.find(params[:comment_id]).destroy |
|
44 | @news.comments.find(params[:comment_id]).destroy | |
45 | redirect_to :action => 'show', :id => @news |
|
45 | redirect_to :action => 'show', :id => @news | |
46 | end |
|
46 | end | |
47 |
|
47 | |||
48 |
|
|
48 | def destroy | |
49 |
|
|
49 | @news.destroy | |
50 |
|
|
50 | redirect_to :controller => 'projects', :action => 'list_news', :id => @project | |
51 |
|
|
51 | end | |
52 |
|
52 | |||
53 | private |
|
53 | private | |
54 | def find_project |
|
54 | def find_project | |
55 | @news = News.find(params[:id]) |
|
55 | @news = News.find(params[:id]) | |
56 | @project = @news.project |
|
56 | @project = @news.project | |
57 | rescue ActiveRecord::RecordNotFound |
|
57 | rescue ActiveRecord::RecordNotFound | |
58 | render_404 |
|
58 | render_404 | |
59 | end |
|
59 | end | |
60 | end |
|
60 | end |
@@ -1,167 +1,167 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 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 ReportsController < ApplicationController |
|
18 | class ReportsController < ApplicationController | |
19 |
|
|
19 | layout 'base' | |
20 |
|
|
20 | before_filter :find_project, :authorize | |
21 |
|
21 | |||
22 | def issue_report |
|
22 | def issue_report | |
23 | @statuses = IssueStatus.find :all |
|
23 | @statuses = IssueStatus.find :all | |
24 |
|
24 | |||
25 | case params[:detail] |
|
25 | case params[:detail] | |
26 | when "tracker" |
|
26 | when "tracker" | |
27 | @field = "tracker_id" |
|
27 | @field = "tracker_id" | |
28 | @rows = Tracker.find :all |
|
28 | @rows = Tracker.find :all | |
29 | @data = issues_by_tracker |
|
29 | @data = issues_by_tracker | |
30 | @report_title = l(:field_tracker) |
|
30 | @report_title = l(:field_tracker) | |
31 | render :template => "reports/issue_report_details" |
|
31 | render :template => "reports/issue_report_details" | |
32 | when "priority" |
|
32 | when "priority" | |
33 | @field = "priority_id" |
|
33 | @field = "priority_id" | |
34 | @rows = Enumeration::get_values('IPRI') |
|
34 | @rows = Enumeration::get_values('IPRI') | |
35 | @data = issues_by_priority |
|
35 | @data = issues_by_priority | |
36 | @report_title = l(:field_priority) |
|
36 | @report_title = l(:field_priority) | |
37 | render :template => "reports/issue_report_details" |
|
37 | render :template => "reports/issue_report_details" | |
38 | when "category" |
|
38 | when "category" | |
39 | @field = "category_id" |
|
39 | @field = "category_id" | |
40 | @rows = @project.issue_categories |
|
40 | @rows = @project.issue_categories | |
41 | @data = issues_by_category |
|
41 | @data = issues_by_category | |
42 | @report_title = l(:field_category) |
|
42 | @report_title = l(:field_category) | |
43 | render :template => "reports/issue_report_details" |
|
43 | render :template => "reports/issue_report_details" | |
44 | when "author" |
|
44 | when "author" | |
45 | @field = "author_id" |
|
45 | @field = "author_id" | |
46 | @rows = @project.members.collect { |m| m.user } |
|
46 | @rows = @project.members.collect { |m| m.user } | |
47 | @data = issues_by_author |
|
47 | @data = issues_by_author | |
48 | @report_title = l(:field_author) |
|
48 | @report_title = l(:field_author) | |
49 | render :template => "reports/issue_report_details" |
|
49 | render :template => "reports/issue_report_details" | |
50 | else |
|
50 | else | |
51 | @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)] |
|
51 | @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)] | |
52 | @trackers = Tracker.find(:all) |
|
52 | @trackers = Tracker.find(:all) | |
53 | @priorities = Enumeration::get_values('IPRI') |
|
53 | @priorities = Enumeration::get_values('IPRI') | |
54 | @categories = @project.issue_categories |
|
54 | @categories = @project.issue_categories | |
55 | @authors = @project.members.collect { |m| m.user } |
|
55 | @authors = @project.members.collect { |m| m.user } | |
56 | issues_by_tracker |
|
56 | issues_by_tracker | |
57 | issues_by_priority |
|
57 | issues_by_priority | |
58 | issues_by_category |
|
58 | issues_by_category | |
59 | issues_by_author |
|
59 | issues_by_author | |
60 | render :template => "reports/issue_report" |
|
60 | render :template => "reports/issue_report" | |
61 | end |
|
61 | end | |
62 | end |
|
62 | end | |
63 |
|
63 | |||
64 | def delays |
|
64 | def delays | |
65 | @trackers = Tracker.find(:all) |
|
65 | @trackers = Tracker.find(:all) | |
66 | if request.get? |
|
66 | if request.get? | |
67 | @selected_tracker_ids = @trackers.collect {|t| t.id.to_s } |
|
67 | @selected_tracker_ids = @trackers.collect {|t| t.id.to_s } | |
68 | else |
|
68 | else | |
69 | @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array |
|
69 | @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array | |
70 | end |
|
70 | end | |
71 | @selected_tracker_ids ||= [] |
|
71 | @selected_tracker_ids ||= [] | |
72 | @raw = |
|
72 | @raw = | |
73 | ActiveRecord::Base.connection.select_all("SELECT datediff( a.created_on, b.created_on ) as delay, count(a.id) as total |
|
73 | ActiveRecord::Base.connection.select_all("SELECT datediff( a.created_on, b.created_on ) as delay, count(a.id) as total | |
74 | FROM issue_histories a, issue_histories b, issues i |
|
74 | FROM issue_histories a, issue_histories b, issues i | |
75 | WHERE a.status_id =5 |
|
75 | WHERE a.status_id =5 | |
76 | AND a.issue_id = b.issue_id |
|
76 | AND a.issue_id = b.issue_id | |
77 | AND a.issue_id = i.id |
|
77 | AND a.issue_id = i.id | |
78 | AND i.tracker_id in (#{@selected_tracker_ids.join(',')}) |
|
78 | AND i.tracker_id in (#{@selected_tracker_ids.join(',')}) | |
79 | AND b.id = ( |
|
79 | AND b.id = ( | |
80 | SELECT min( c.id ) |
|
80 | SELECT min( c.id ) | |
81 | FROM issue_histories c |
|
81 | FROM issue_histories c | |
82 | WHERE b.issue_id = c.issue_id ) |
|
82 | WHERE b.issue_id = c.issue_id ) | |
83 | GROUP BY delay") unless @selected_tracker_ids.empty? |
|
83 | GROUP BY delay") unless @selected_tracker_ids.empty? | |
84 | @raw ||=[] |
|
84 | @raw ||=[] | |
85 |
|
85 | |||
86 | @x_from = 0 |
|
86 | @x_from = 0 | |
87 | @x_to = 0 |
|
87 | @x_to = 0 | |
88 | @y_from = 0 |
|
88 | @y_from = 0 | |
89 | @y_to = 0 |
|
89 | @y_to = 0 | |
90 | @sum_total = 0 |
|
90 | @sum_total = 0 | |
91 | @sum_delay = 0 |
|
91 | @sum_delay = 0 | |
92 | @raw.each do |r| |
|
92 | @raw.each do |r| | |
93 | @x_to = [r['delay'].to_i, @x_to].max |
|
93 | @x_to = [r['delay'].to_i, @x_to].max | |
94 | @y_to = [r['total'].to_i, @y_to].max |
|
94 | @y_to = [r['total'].to_i, @y_to].max | |
95 | @sum_total = @sum_total + r['total'].to_i |
|
95 | @sum_total = @sum_total + r['total'].to_i | |
96 | @sum_delay = @sum_delay + r['total'].to_i * r['delay'].to_i |
|
96 | @sum_delay = @sum_delay + r['total'].to_i * r['delay'].to_i | |
97 | end |
|
97 | end | |
98 | end |
|
98 | end | |
99 |
|
99 | |||
100 | private |
|
100 | private | |
101 | # Find project of id params[:id] |
|
101 | # Find project of id params[:id] | |
102 | def find_project |
|
102 | def find_project | |
103 | @project = Project.find(params[:id]) |
|
103 | @project = Project.find(params[:id]) | |
104 | rescue ActiveRecord::RecordNotFound |
|
104 | rescue ActiveRecord::RecordNotFound | |
105 | render_404 |
|
105 | render_404 | |
106 | end |
|
106 | end | |
107 |
|
107 | |||
108 |
|
|
108 | def issues_by_tracker | |
109 | @issues_by_tracker ||= |
|
109 | @issues_by_tracker ||= | |
110 | ActiveRecord::Base.connection.select_all("select s.id as status_id, |
|
110 | ActiveRecord::Base.connection.select_all("select s.id as status_id, | |
111 | s.is_closed as closed, |
|
111 | s.is_closed as closed, | |
112 | t.id as tracker_id, |
|
112 | t.id as tracker_id, | |
113 | count(i.id) as total |
|
113 | count(i.id) as total | |
114 | from |
|
114 | from | |
115 | issues i, issue_statuses s, trackers t |
|
115 | issues i, issue_statuses s, trackers t | |
116 | where |
|
116 | where | |
117 | i.status_id=s.id |
|
117 | i.status_id=s.id | |
118 | and i.tracker_id=t.id |
|
118 | and i.tracker_id=t.id | |
119 | and i.project_id=#{@project.id} |
|
119 | and i.project_id=#{@project.id} | |
120 | group by s.id, s.is_closed, t.id") |
|
120 | group by s.id, s.is_closed, t.id") | |
121 |
|
|
121 | end | |
122 |
|
122 | |||
123 |
|
|
123 | def issues_by_priority | |
124 | @issues_by_priority ||= |
|
124 | @issues_by_priority ||= | |
125 | ActiveRecord::Base.connection.select_all("select s.id as status_id, |
|
125 | ActiveRecord::Base.connection.select_all("select s.id as status_id, | |
126 | s.is_closed as closed, |
|
126 | s.is_closed as closed, | |
127 | p.id as priority_id, |
|
127 | p.id as priority_id, | |
128 | count(i.id) as total |
|
128 | count(i.id) as total | |
129 | from |
|
129 | from | |
130 | issues i, issue_statuses s, enumerations p |
|
130 | issues i, issue_statuses s, enumerations p | |
131 | where |
|
131 | where | |
132 | i.status_id=s.id |
|
132 | i.status_id=s.id | |
133 | and i.priority_id=p.id |
|
133 | and i.priority_id=p.id | |
134 | and i.project_id=#{@project.id} |
|
134 | and i.project_id=#{@project.id} | |
135 | group by s.id, s.is_closed, p.id") |
|
135 | group by s.id, s.is_closed, p.id") | |
136 |
|
|
136 | end | |
137 |
|
137 | |||
138 |
|
|
138 | def issues_by_category | |
139 | @issues_by_category ||= |
|
139 | @issues_by_category ||= | |
140 | ActiveRecord::Base.connection.select_all("select s.id as status_id, |
|
140 | ActiveRecord::Base.connection.select_all("select s.id as status_id, | |
141 | s.is_closed as closed, |
|
141 | s.is_closed as closed, | |
142 | c.id as category_id, |
|
142 | c.id as category_id, | |
143 | count(i.id) as total |
|
143 | count(i.id) as total | |
144 | from |
|
144 | from | |
145 | issues i, issue_statuses s, issue_categories c |
|
145 | issues i, issue_statuses s, issue_categories c | |
146 | where |
|
146 | where | |
147 | i.status_id=s.id |
|
147 | i.status_id=s.id | |
148 | and i.category_id=c.id |
|
148 | and i.category_id=c.id | |
149 | and i.project_id=#{@project.id} |
|
149 | and i.project_id=#{@project.id} | |
150 | group by s.id, s.is_closed, c.id") |
|
150 | group by s.id, s.is_closed, c.id") | |
151 |
|
|
151 | end | |
152 |
|
152 | |||
153 |
|
|
153 | def issues_by_author | |
154 | @issues_by_author ||= |
|
154 | @issues_by_author ||= | |
155 | ActiveRecord::Base.connection.select_all("select s.id as status_id, |
|
155 | ActiveRecord::Base.connection.select_all("select s.id as status_id, | |
156 | s.is_closed as closed, |
|
156 | s.is_closed as closed, | |
157 | a.id as author_id, |
|
157 | a.id as author_id, | |
158 | count(i.id) as total |
|
158 | count(i.id) as total | |
159 | from |
|
159 | from | |
160 | issues i, issue_statuses s, users a |
|
160 | issues i, issue_statuses s, users a | |
161 | where |
|
161 | where | |
162 | i.status_id=s.id |
|
162 | i.status_id=s.id | |
163 | and i.author_id=a.id |
|
163 | and i.author_id=a.id | |
164 | and i.project_id=#{@project.id} |
|
164 | and i.project_id=#{@project.id} | |
165 | group by s.id, s.is_closed, a.id") |
|
165 | group by s.id, s.is_closed, a.id") | |
166 |
|
|
166 | end | |
167 | end |
|
167 | end |
@@ -1,84 +1,84 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 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 RolesController < ApplicationController |
|
18 | class RolesController < ApplicationController | |
19 |
|
|
19 | layout 'base' | |
20 |
|
|
20 | before_filter :require_admin | |
21 |
|
21 | |||
22 | def index |
|
22 | def index | |
23 | list |
|
23 | list | |
24 | render :action => 'list' unless request.xhr? |
|
24 | render :action => 'list' unless request.xhr? | |
25 | end |
|
25 | end | |
26 |
|
26 | |||
27 | def list |
|
27 | def list | |
28 | @role_pages, @roles = paginate :roles, :per_page => 10 |
|
28 | @role_pages, @roles = paginate :roles, :per_page => 10 | |
29 | render :action => "list", :layout => false if request.xhr? |
|
29 | render :action => "list", :layout => false if request.xhr? | |
30 | end |
|
30 | end | |
31 |
|
31 | |||
32 | def new |
|
32 | def new | |
33 | @role = Role.new(params[:role]) |
|
33 | @role = Role.new(params[:role]) | |
34 | if request.post? |
|
34 | if request.post? | |
35 | @role.permissions = Permission.find(params[:permission_ids]) if params[:permission_ids] |
|
35 | @role.permissions = Permission.find(params[:permission_ids]) if params[:permission_ids] | |
36 | if @role.save |
|
36 | if @role.save | |
37 | flash[:notice] = l(:notice_successful_create) |
|
37 | flash[:notice] = l(:notice_successful_create) | |
38 | redirect_to :action => 'list' |
|
38 | redirect_to :action => 'list' | |
39 | end |
|
39 | end | |
40 | end |
|
40 | end | |
41 | @permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC') |
|
41 | @permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC') | |
42 | end |
|
42 | end | |
43 |
|
43 | |||
44 | def edit |
|
44 | def edit | |
45 | @role = Role.find(params[:id]) |
|
45 | @role = Role.find(params[:id]) | |
46 | if request.post? and @role.update_attributes(params[:role]) |
|
46 | if request.post? and @role.update_attributes(params[:role]) | |
47 | @role.permissions = Permission.find(params[:permission_ids] || []) |
|
47 | @role.permissions = Permission.find(params[:permission_ids] || []) | |
48 | Permission.allowed_to_role_expired |
|
48 | Permission.allowed_to_role_expired | |
49 | flash[:notice] = l(:notice_successful_update) |
|
49 | flash[:notice] = l(:notice_successful_update) | |
50 | redirect_to :action => 'list' |
|
50 | redirect_to :action => 'list' | |
51 | end |
|
51 | end | |
52 | @permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC') |
|
52 | @permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC') | |
53 | end |
|
53 | end | |
54 |
|
54 | |||
55 | def destroy |
|
55 | def destroy | |
56 | @role = Role.find(params[:id]) |
|
56 | @role = Role.find(params[:id]) | |
57 | unless @role.members.empty? |
|
57 | unless @role.members.empty? | |
58 | flash[:notice] = 'Some members have this role. Can\'t delete it.' |
|
58 | flash[:notice] = 'Some members have this role. Can\'t delete it.' | |
59 | else |
|
59 | else | |
60 | @role.destroy |
|
60 | @role.destroy | |
61 | end |
|
61 | end | |
62 | redirect_to :action => 'list' |
|
62 | redirect_to :action => 'list' | |
63 | end |
|
63 | end | |
64 |
|
64 | |||
65 | def workflow |
|
65 | def workflow | |
66 | @role = Role.find_by_id(params[:role_id]) |
|
66 | @role = Role.find_by_id(params[:role_id]) | |
67 | @tracker = Tracker.find_by_id(params[:tracker_id]) |
|
67 | @tracker = Tracker.find_by_id(params[:tracker_id]) | |
68 |
|
68 | |||
69 | if request.post? |
|
69 | if request.post? | |
70 | Workflow.destroy_all( ["role_id=? and tracker_id=?", @role.id, @tracker.id]) |
|
70 | Workflow.destroy_all( ["role_id=? and tracker_id=?", @role.id, @tracker.id]) | |
71 | (params[:issue_status] || []).each { |old, news| |
|
71 | (params[:issue_status] || []).each { |old, news| | |
72 | news.each { |new| |
|
72 | news.each { |new| | |
73 | @role.workflows.build(:tracker_id => @tracker.id, :old_status_id => old, :new_status_id => new) |
|
73 | @role.workflows.build(:tracker_id => @tracker.id, :old_status_id => old, :new_status_id => new) | |
74 | } |
|
74 | } | |
75 | } |
|
75 | } | |
76 | if @role.save |
|
76 | if @role.save | |
77 | flash[:notice] = l(:notice_successful_update) |
|
77 | flash[:notice] = l(:notice_successful_update) | |
78 | end |
|
78 | end | |
79 | end |
|
79 | end | |
80 | @roles = Role.find :all |
|
80 | @roles = Role.find :all | |
81 | @trackers = Tracker.find :all |
|
81 | @trackers = Tracker.find :all | |
82 | @statuses = IssueStatus.find(:all, :include => :workflows) |
|
82 | @statuses = IssueStatus.find(:all, :include => :workflows) | |
83 | end |
|
83 | end | |
84 | end |
|
84 | end |
@@ -1,61 +1,60 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 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 TrackersController < ApplicationController |
|
18 | class TrackersController < ApplicationController | |
19 | layout 'base' |
|
19 | layout 'base' | |
20 | before_filter :require_admin |
|
20 | before_filter :require_admin | |
21 |
|
21 | |||
22 | def index |
|
22 | def index | |
23 | list |
|
23 | list | |
24 | render :action => 'list' unless request.xhr? |
|
24 | render :action => 'list' unless request.xhr? | |
25 | end |
|
25 | end | |
26 |
|
26 | |||
27 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) |
|
27 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) | |
28 | verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :list } |
|
28 | verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :list } | |
29 |
|
29 | |||
30 | def list |
|
30 | def list | |
31 | @tracker_pages, @trackers = paginate :trackers, :per_page => 10 |
|
31 | @tracker_pages, @trackers = paginate :trackers, :per_page => 10 | |
32 | render :action => "list", :layout => false if request.xhr? |
|
32 | render :action => "list", :layout => false if request.xhr? | |
33 | end |
|
33 | end | |
34 |
|
34 | |||
35 | def new |
|
35 | def new | |
36 | @tracker = Tracker.new(params[:tracker]) |
|
36 | @tracker = Tracker.new(params[:tracker]) | |
37 | if request.post? and @tracker.save |
|
37 | if request.post? and @tracker.save | |
38 | flash[:notice] = l(:notice_successful_create) |
|
38 | flash[:notice] = l(:notice_successful_create) | |
39 | redirect_to :action => 'list' |
|
39 | redirect_to :action => 'list' | |
40 | end |
|
40 | end | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
43 | def edit |
|
43 | def edit | |
44 | @tracker = Tracker.find(params[:id]) |
|
44 | @tracker = Tracker.find(params[:id]) | |
45 | if request.post? and @tracker.update_attributes(params[:tracker]) |
|
45 | if request.post? and @tracker.update_attributes(params[:tracker]) | |
46 | flash[:notice] = l(:notice_successful_update) |
|
46 | flash[:notice] = l(:notice_successful_update) | |
47 | redirect_to :action => 'list' |
|
47 | redirect_to :action => 'list' | |
48 | end |
|
48 | end | |
49 | end |
|
49 | end | |
50 |
|
50 | |||
51 | def destroy |
|
51 | def destroy | |
52 | @tracker = Tracker.find(params[:id]) |
|
52 | @tracker = Tracker.find(params[:id]) | |
53 | unless @tracker.issues.empty? |
|
53 | unless @tracker.issues.empty? | |
54 | flash[:notice] = "This tracker contains issues and can\'t be deleted." |
|
54 | flash[:notice] = "This tracker contains issues and can\'t be deleted." | |
55 | else |
|
55 | else | |
56 | @tracker.destroy |
|
56 | @tracker.destroy | |
57 | end |
|
57 | end | |
58 | redirect_to :action => 'list' |
|
58 | redirect_to :action => 'list' | |
59 | end |
|
59 | end | |
60 |
|
||||
61 | end |
|
60 | end |
General Comments 0
You need to be logged in to leave comments.
Login now