@@ -1,619 +1,619 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require 'csv' |
|
18 | require 'csv' | |
19 |
|
19 | |||
20 | class ProjectsController < ApplicationController |
|
20 | class ProjectsController < ApplicationController | |
21 | layout 'base' |
|
21 | layout 'base' | |
22 | before_filter :find_project, :authorize, :except => [ :index, :list, :add ] |
|
22 | before_filter :find_project, :authorize, :except => [ :index, :list, :add ] | |
23 | before_filter :require_admin, :only => [ :add, :destroy ] |
|
23 | before_filter :require_admin, :only => [ :add, :destroy ] | |
24 |
|
24 | |||
25 | helper :sort |
|
25 | helper :sort | |
26 | include SortHelper |
|
26 | include SortHelper | |
27 | helper :custom_fields |
|
27 | helper :custom_fields | |
28 | include CustomFieldsHelper |
|
28 | include CustomFieldsHelper | |
29 | helper :ifpdf |
|
29 | helper :ifpdf | |
30 | include IfpdfHelper |
|
30 | include IfpdfHelper | |
31 | helper IssuesHelper |
|
31 | helper IssuesHelper | |
32 | helper :queries |
|
32 | helper :queries | |
33 | include QueriesHelper |
|
33 | include QueriesHelper | |
34 |
|
34 | |||
35 | def index |
|
35 | def index | |
36 | list |
|
36 | list | |
37 | render :action => 'list' unless request.xhr? |
|
37 | render :action => 'list' unless request.xhr? | |
38 | end |
|
38 | end | |
39 |
|
39 | |||
40 | # Lists public projects |
|
40 | # Lists public projects | |
41 | def list |
|
41 | def list | |
42 | sort_init 'name', 'asc' |
|
42 | sort_init 'name', 'asc' | |
43 | sort_update |
|
43 | sort_update | |
44 | @project_count = Project.count(:all, :conditions => ["is_public=?", true]) |
|
44 | @project_count = Project.count(:all, :conditions => ["is_public=?", true]) | |
45 | @project_pages = Paginator.new self, @project_count, |
|
45 | @project_pages = Paginator.new self, @project_count, | |
46 | 15, |
|
46 | 15, | |
47 | params['page'] |
|
47 | params['page'] | |
48 | @projects = Project.find :all, :order => sort_clause, |
|
48 | @projects = Project.find :all, :order => sort_clause, | |
49 | :conditions => ["is_public=?", true], |
|
49 | :conditions => ["is_public=?", true], | |
50 | :limit => @project_pages.items_per_page, |
|
50 | :limit => @project_pages.items_per_page, | |
51 | :offset => @project_pages.current.offset |
|
51 | :offset => @project_pages.current.offset | |
52 |
|
52 | |||
53 | render :action => "list", :layout => false if request.xhr? |
|
53 | render :action => "list", :layout => false if request.xhr? | |
54 | end |
|
54 | end | |
55 |
|
55 | |||
56 | # Add a new project |
|
56 | # Add a new project | |
57 | def add |
|
57 | def add | |
58 | @custom_fields = IssueCustomField.find(:all) |
|
58 | @custom_fields = IssueCustomField.find(:all) | |
59 | @root_projects = Project.find(:all, :conditions => "parent_id is null") |
|
59 | @root_projects = Project.find(:all, :conditions => "parent_id is null") | |
60 | @project = Project.new(params[:project]) |
|
60 | @project = Project.new(params[:project]) | |
61 | if request.get? |
|
61 | if request.get? | |
62 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) } |
|
62 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) } | |
63 | else |
|
63 | else | |
64 | @project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] |
|
64 | @project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] | |
65 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } |
|
65 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } | |
66 | @project.custom_values = @custom_values |
|
66 | @project.custom_values = @custom_values | |
67 | if params[:repository_enabled] && params[:repository_enabled] == "1" |
|
67 | if params[:repository_enabled] && params[:repository_enabled] == "1" | |
68 | @project.repository = Repository.new |
|
68 | @project.repository = Repository.new | |
69 | @project.repository.attributes = params[:repository] |
|
69 | @project.repository.attributes = params[:repository] | |
70 | end |
|
70 | end | |
71 | if "1" == params[:wiki_enabled] |
|
71 | if "1" == params[:wiki_enabled] | |
72 | @project.wiki = Wiki.new |
|
72 | @project.wiki = Wiki.new | |
73 | @project.wiki.attributes = params[:wiki] |
|
73 | @project.wiki.attributes = params[:wiki] | |
74 | end |
|
74 | end | |
75 | if @project.save |
|
75 | if @project.save | |
76 | flash[:notice] = l(:notice_successful_create) |
|
76 | flash[:notice] = l(:notice_successful_create) | |
77 | redirect_to :controller => 'admin', :action => 'projects' |
|
77 | redirect_to :controller => 'admin', :action => 'projects' | |
78 | end |
|
78 | end | |
79 | end |
|
79 | end | |
80 | end |
|
80 | end | |
81 |
|
81 | |||
82 | # Show @project |
|
82 | # Show @project | |
83 | def show |
|
83 | def show | |
84 | @custom_values = @project.custom_values.find(:all, :include => :custom_field) |
|
84 | @custom_values = @project.custom_values.find(:all, :include => :custom_field) | |
85 | @members = @project.members.find(:all, :include => [:user, :role]) |
|
85 | @members = @project.members.find(:all, :include => [:user, :role], :order => 'position') | |
86 | @subprojects = @project.children if @project.children.size > 0 |
|
86 | @subprojects = @project.children if @project.children.size > 0 | |
87 | @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") |
|
87 | @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") | |
88 | @trackers = Tracker.find(:all, :order => 'position') |
|
88 | @trackers = Tracker.find(:all, :order => 'position') | |
89 | @open_issues_by_tracker = Issue.count(:group => :tracker, :joins => "INNER JOIN #{IssueStatus.table_name} ON #{IssueStatus.table_name}.id = #{Issue.table_name}.status_id", :conditions => ["project_id=? and #{IssueStatus.table_name}.is_closed=?", @project.id, false]) |
|
89 | @open_issues_by_tracker = Issue.count(:group => :tracker, :joins => "INNER JOIN #{IssueStatus.table_name} ON #{IssueStatus.table_name}.id = #{Issue.table_name}.status_id", :conditions => ["project_id=? and #{IssueStatus.table_name}.is_closed=?", @project.id, false]) | |
90 | @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id]) |
|
90 | @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id]) | |
91 | end |
|
91 | end | |
92 |
|
92 | |||
93 | def settings |
|
93 | def settings | |
94 | @root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id]) |
|
94 | @root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id]) | |
95 | @custom_fields = IssueCustomField.find(:all) |
|
95 | @custom_fields = IssueCustomField.find(:all) | |
96 | @issue_category ||= IssueCategory.new |
|
96 | @issue_category ||= IssueCategory.new | |
97 | @member ||= @project.members.new |
|
97 | @member ||= @project.members.new | |
98 | @roles = Role.find(:all, :order => 'position') |
|
98 | @roles = Role.find(:all, :order => 'position') | |
99 | @users = User.find_active(:all) - @project.users |
|
99 | @users = User.find_active(:all) - @project.users | |
100 | @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) } |
|
100 | @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) } | |
101 | end |
|
101 | end | |
102 |
|
102 | |||
103 | # Edit @project |
|
103 | # Edit @project | |
104 | def edit |
|
104 | def edit | |
105 | if request.post? |
|
105 | if request.post? | |
106 | @project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] |
|
106 | @project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] | |
107 | if params[:custom_fields] |
|
107 | if params[:custom_fields] | |
108 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } |
|
108 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } | |
109 | @project.custom_values = @custom_values |
|
109 | @project.custom_values = @custom_values | |
110 | end |
|
110 | end | |
111 | if params[:repository_enabled] |
|
111 | if params[:repository_enabled] | |
112 | case params[:repository_enabled] |
|
112 | case params[:repository_enabled] | |
113 | when "0" |
|
113 | when "0" | |
114 | @project.repository = nil |
|
114 | @project.repository = nil | |
115 | when "1" |
|
115 | when "1" | |
116 | @project.repository ||= Repository.new |
|
116 | @project.repository ||= Repository.new | |
117 | @project.repository.update_attributes params[:repository] |
|
117 | @project.repository.update_attributes params[:repository] | |
118 | end |
|
118 | end | |
119 | end |
|
119 | end | |
120 | if params[:wiki_enabled] |
|
120 | if params[:wiki_enabled] | |
121 | case params[:wiki_enabled] |
|
121 | case params[:wiki_enabled] | |
122 | when "0" |
|
122 | when "0" | |
123 | @project.wiki.destroy if @project.wiki |
|
123 | @project.wiki.destroy if @project.wiki | |
124 | when "1" |
|
124 | when "1" | |
125 | @project.wiki ||= Wiki.new |
|
125 | @project.wiki ||= Wiki.new | |
126 | @project.wiki.update_attributes params[:wiki] |
|
126 | @project.wiki.update_attributes params[:wiki] | |
127 | end |
|
127 | end | |
128 | end |
|
128 | end | |
129 | @project.attributes = params[:project] |
|
129 | @project.attributes = params[:project] | |
130 | if @project.save |
|
130 | if @project.save | |
131 | flash[:notice] = l(:notice_successful_update) |
|
131 | flash[:notice] = l(:notice_successful_update) | |
132 | redirect_to :action => 'settings', :id => @project |
|
132 | redirect_to :action => 'settings', :id => @project | |
133 | else |
|
133 | else | |
134 | settings |
|
134 | settings | |
135 | render :action => 'settings' |
|
135 | render :action => 'settings' | |
136 | end |
|
136 | end | |
137 | end |
|
137 | end | |
138 | end |
|
138 | end | |
139 |
|
139 | |||
140 | # Delete @project |
|
140 | # Delete @project | |
141 | def destroy |
|
141 | def destroy | |
142 | if request.post? and params[:confirm] |
|
142 | if request.post? and params[:confirm] | |
143 | @project.destroy |
|
143 | @project.destroy | |
144 | redirect_to :controller => 'admin', :action => 'projects' |
|
144 | redirect_to :controller => 'admin', :action => 'projects' | |
145 | end |
|
145 | end | |
146 | end |
|
146 | end | |
147 |
|
147 | |||
148 | # Add a new issue category to @project |
|
148 | # Add a new issue category to @project | |
149 | def add_issue_category |
|
149 | def add_issue_category | |
150 | if request.post? |
|
150 | if request.post? | |
151 | @issue_category = @project.issue_categories.build(params[:issue_category]) |
|
151 | @issue_category = @project.issue_categories.build(params[:issue_category]) | |
152 | if @issue_category.save |
|
152 | if @issue_category.save | |
153 | flash[:notice] = l(:notice_successful_create) |
|
153 | flash[:notice] = l(:notice_successful_create) | |
154 | redirect_to :action => 'settings', :tab => 'categories', :id => @project |
|
154 | redirect_to :action => 'settings', :tab => 'categories', :id => @project | |
155 | else |
|
155 | else | |
156 | settings |
|
156 | settings | |
157 | render :action => 'settings' |
|
157 | render :action => 'settings' | |
158 | end |
|
158 | end | |
159 | end |
|
159 | end | |
160 | end |
|
160 | end | |
161 |
|
161 | |||
162 | # Add a new version to @project |
|
162 | # Add a new version to @project | |
163 | def add_version |
|
163 | def add_version | |
164 | @version = @project.versions.build(params[:version]) |
|
164 | @version = @project.versions.build(params[:version]) | |
165 | if request.post? and @version.save |
|
165 | if request.post? and @version.save | |
166 | flash[:notice] = l(:notice_successful_create) |
|
166 | flash[:notice] = l(:notice_successful_create) | |
167 | redirect_to :action => 'settings', :tab => 'versions', :id => @project |
|
167 | redirect_to :action => 'settings', :tab => 'versions', :id => @project | |
168 | end |
|
168 | end | |
169 | end |
|
169 | end | |
170 |
|
170 | |||
171 | # Add a new member to @project |
|
171 | # Add a new member to @project | |
172 | def add_member |
|
172 | def add_member | |
173 | @member = @project.members.build(params[:member]) |
|
173 | @member = @project.members.build(params[:member]) | |
174 | if request.post? |
|
174 | if request.post? | |
175 | if @member.save |
|
175 | if @member.save | |
176 | flash[:notice] = l(:notice_successful_create) |
|
176 | flash[:notice] = l(:notice_successful_create) | |
177 | redirect_to :action => 'settings', :tab => 'members', :id => @project |
|
177 | redirect_to :action => 'settings', :tab => 'members', :id => @project | |
178 | else |
|
178 | else | |
179 | settings |
|
179 | settings | |
180 | render :action => 'settings' |
|
180 | render :action => 'settings' | |
181 | end |
|
181 | end | |
182 | end |
|
182 | end | |
183 | end |
|
183 | end | |
184 |
|
184 | |||
185 | # Show members list of @project |
|
185 | # Show members list of @project | |
186 | def list_members |
|
186 | def list_members | |
187 | @members = @project.members.find(:all) |
|
187 | @members = @project.members.find(:all) | |
188 | end |
|
188 | end | |
189 |
|
189 | |||
190 | # Add a new document to @project |
|
190 | # Add a new document to @project | |
191 | def add_document |
|
191 | def add_document | |
192 | @categories = Enumeration::get_values('DCAT') |
|
192 | @categories = Enumeration::get_values('DCAT') | |
193 | @document = @project.documents.build(params[:document]) |
|
193 | @document = @project.documents.build(params[:document]) | |
194 | if request.post? and @document.save |
|
194 | if request.post? and @document.save | |
195 | # Save the attachments |
|
195 | # Save the attachments | |
196 | params[:attachments].each { |a| |
|
196 | params[:attachments].each { |a| | |
197 | Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0 |
|
197 | Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0 | |
198 | } if params[:attachments] and params[:attachments].is_a? Array |
|
198 | } if params[:attachments] and params[:attachments].is_a? Array | |
199 | flash[:notice] = l(:notice_successful_create) |
|
199 | flash[:notice] = l(:notice_successful_create) | |
200 | Mailer.deliver_document_add(@document) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? |
|
200 | Mailer.deliver_document_add(@document) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? | |
201 | redirect_to :action => 'list_documents', :id => @project |
|
201 | redirect_to :action => 'list_documents', :id => @project | |
202 | end |
|
202 | end | |
203 | end |
|
203 | end | |
204 |
|
204 | |||
205 | # Show documents list of @project |
|
205 | # Show documents list of @project | |
206 | def list_documents |
|
206 | def list_documents | |
207 | @documents = @project.documents.find :all, :include => :category |
|
207 | @documents = @project.documents.find :all, :include => :category | |
208 | end |
|
208 | end | |
209 |
|
209 | |||
210 | # Add a new issue to @project |
|
210 | # Add a new issue to @project | |
211 | def add_issue |
|
211 | def add_issue | |
212 | @tracker = Tracker.find(params[:tracker_id]) |
|
212 | @tracker = Tracker.find(params[:tracker_id]) | |
213 | @priorities = Enumeration::get_values('IPRI') |
|
213 | @priorities = Enumeration::get_values('IPRI') | |
214 | @issue = Issue.new(:project => @project, :tracker => @tracker) |
|
214 | @issue = Issue.new(:project => @project, :tracker => @tracker) | |
215 | if request.get? |
|
215 | if request.get? | |
216 | @issue.start_date = Date.today |
|
216 | @issue.start_date = Date.today | |
217 | @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) } |
|
217 | @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) } | |
218 | else |
|
218 | else | |
219 | @issue.attributes = params[:issue] |
|
219 | @issue.attributes = params[:issue] | |
220 | @issue.author_id = self.logged_in_user.id if self.logged_in_user |
|
220 | @issue.author_id = self.logged_in_user.id if self.logged_in_user | |
221 | # Multiple file upload |
|
221 | # Multiple file upload | |
222 | @attachments = [] |
|
222 | @attachments = [] | |
223 | params[:attachments].each { |a| |
|
223 | params[:attachments].each { |a| | |
224 | @attachments << Attachment.new(:container => @issue, :file => a, :author => logged_in_user) unless a.size == 0 |
|
224 | @attachments << Attachment.new(:container => @issue, :file => a, :author => logged_in_user) unless a.size == 0 | |
225 | } if params[:attachments] and params[:attachments].is_a? Array |
|
225 | } if params[:attachments] and params[:attachments].is_a? Array | |
226 | @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]) } |
|
226 | @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]) } | |
227 | @issue.custom_values = @custom_values |
|
227 | @issue.custom_values = @custom_values | |
228 | if @issue.save |
|
228 | if @issue.save | |
229 | @attachments.each(&:save) |
|
229 | @attachments.each(&:save) | |
230 | flash[:notice] = l(:notice_successful_create) |
|
230 | flash[:notice] = l(:notice_successful_create) | |
231 | Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? |
|
231 | Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? | |
232 | redirect_to :action => 'list_issues', :id => @project |
|
232 | redirect_to :action => 'list_issues', :id => @project | |
233 | end |
|
233 | end | |
234 | end |
|
234 | end | |
235 | end |
|
235 | end | |
236 |
|
236 | |||
237 | # Show filtered/sorted issues list of @project |
|
237 | # Show filtered/sorted issues list of @project | |
238 | def list_issues |
|
238 | def list_issues | |
239 | sort_init "#{Issue.table_name}.id", "desc" |
|
239 | sort_init "#{Issue.table_name}.id", "desc" | |
240 | sort_update |
|
240 | sort_update | |
241 |
|
241 | |||
242 | retrieve_query |
|
242 | retrieve_query | |
243 |
|
243 | |||
244 | @results_per_page_options = [ 15, 25, 50, 100 ] |
|
244 | @results_per_page_options = [ 15, 25, 50, 100 ] | |
245 | if params[:per_page] and @results_per_page_options.include? params[:per_page].to_i |
|
245 | if params[:per_page] and @results_per_page_options.include? params[:per_page].to_i | |
246 | @results_per_page = params[:per_page].to_i |
|
246 | @results_per_page = params[:per_page].to_i | |
247 | session[:results_per_page] = @results_per_page |
|
247 | session[:results_per_page] = @results_per_page | |
248 | else |
|
248 | else | |
249 | @results_per_page = session[:results_per_page] || 25 |
|
249 | @results_per_page = session[:results_per_page] || 25 | |
250 | end |
|
250 | end | |
251 |
|
251 | |||
252 | if @query.valid? |
|
252 | if @query.valid? | |
253 | @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement) |
|
253 | @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement) | |
254 | @issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page'] |
|
254 | @issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page'] | |
255 | @issues = Issue.find :all, :order => sort_clause, |
|
255 | @issues = Issue.find :all, :order => sort_clause, | |
256 | :include => [ :author, :status, :tracker, :project, :priority ], |
|
256 | :include => [ :author, :status, :tracker, :project, :priority ], | |
257 | :conditions => @query.statement, |
|
257 | :conditions => @query.statement, | |
258 | :limit => @issue_pages.items_per_page, |
|
258 | :limit => @issue_pages.items_per_page, | |
259 | :offset => @issue_pages.current.offset |
|
259 | :offset => @issue_pages.current.offset | |
260 | end |
|
260 | end | |
261 | @trackers = Tracker.find :all, :order => 'position' |
|
261 | @trackers = Tracker.find :all, :order => 'position' | |
262 | render :layout => false if request.xhr? |
|
262 | render :layout => false if request.xhr? | |
263 | end |
|
263 | end | |
264 |
|
264 | |||
265 | # Export filtered/sorted issues list to CSV |
|
265 | # Export filtered/sorted issues list to CSV | |
266 | def export_issues_csv |
|
266 | def export_issues_csv | |
267 | sort_init "#{Issue.table_name}.id", "desc" |
|
267 | sort_init "#{Issue.table_name}.id", "desc" | |
268 | sort_update |
|
268 | sort_update | |
269 |
|
269 | |||
270 | retrieve_query |
|
270 | retrieve_query | |
271 | render :action => 'list_issues' and return unless @query.valid? |
|
271 | render :action => 'list_issues' and return unless @query.valid? | |
272 |
|
272 | |||
273 | @issues = Issue.find :all, :order => sort_clause, |
|
273 | @issues = Issue.find :all, :order => sort_clause, | |
274 | :include => [ :author, :status, :tracker, :priority, {:custom_values => :custom_field} ], |
|
274 | :include => [ :author, :status, :tracker, :priority, {:custom_values => :custom_field} ], | |
275 | :conditions => @query.statement, |
|
275 | :conditions => @query.statement, | |
276 | :limit => Setting.issues_export_limit |
|
276 | :limit => Setting.issues_export_limit | |
277 |
|
277 | |||
278 | ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') |
|
278 | ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') | |
279 | export = StringIO.new |
|
279 | export = StringIO.new | |
280 | CSV::Writer.generate(export, l(:general_csv_separator)) do |csv| |
|
280 | CSV::Writer.generate(export, l(:general_csv_separator)) do |csv| | |
281 | # csv header fields |
|
281 | # csv header fields | |
282 | headers = [ "#", l(:field_status), |
|
282 | headers = [ "#", l(:field_status), | |
283 | l(:field_tracker), |
|
283 | l(:field_tracker), | |
284 | l(:field_priority), |
|
284 | l(:field_priority), | |
285 | l(:field_subject), |
|
285 | l(:field_subject), | |
286 | l(:field_author), |
|
286 | l(:field_author), | |
287 | l(:field_start_date), |
|
287 | l(:field_start_date), | |
288 | l(:field_due_date), |
|
288 | l(:field_due_date), | |
289 | l(:field_done_ratio), |
|
289 | l(:field_done_ratio), | |
290 | l(:field_created_on), |
|
290 | l(:field_created_on), | |
291 | l(:field_updated_on) |
|
291 | l(:field_updated_on) | |
292 | ] |
|
292 | ] | |
293 | for custom_field in @project.all_custom_fields |
|
293 | for custom_field in @project.all_custom_fields | |
294 | headers << custom_field.name |
|
294 | headers << custom_field.name | |
295 | end |
|
295 | end | |
296 | csv << headers.collect {|c| ic.iconv(c) } |
|
296 | csv << headers.collect {|c| ic.iconv(c) } | |
297 | # csv lines |
|
297 | # csv lines | |
298 | @issues.each do |issue| |
|
298 | @issues.each do |issue| | |
299 | fields = [issue.id, issue.status.name, |
|
299 | fields = [issue.id, issue.status.name, | |
300 | issue.tracker.name, |
|
300 | issue.tracker.name, | |
301 | issue.priority.name, |
|
301 | issue.priority.name, | |
302 | issue.subject, |
|
302 | issue.subject, | |
303 | issue.author.display_name, |
|
303 | issue.author.display_name, | |
304 | issue.start_date ? l_date(issue.start_date) : nil, |
|
304 | issue.start_date ? l_date(issue.start_date) : nil, | |
305 | issue.due_date ? l_date(issue.due_date) : nil, |
|
305 | issue.due_date ? l_date(issue.due_date) : nil, | |
306 | issue.done_ratio, |
|
306 | issue.done_ratio, | |
307 | l_datetime(issue.created_on), |
|
307 | l_datetime(issue.created_on), | |
308 | l_datetime(issue.updated_on) |
|
308 | l_datetime(issue.updated_on) | |
309 | ] |
|
309 | ] | |
310 | for custom_field in @project.all_custom_fields |
|
310 | for custom_field in @project.all_custom_fields | |
311 | fields << (show_value issue.custom_value_for(custom_field)) |
|
311 | fields << (show_value issue.custom_value_for(custom_field)) | |
312 | end |
|
312 | end | |
313 | csv << fields.collect {|c| ic.iconv(c.to_s) } |
|
313 | csv << fields.collect {|c| ic.iconv(c.to_s) } | |
314 | end |
|
314 | end | |
315 | end |
|
315 | end | |
316 | export.rewind |
|
316 | export.rewind | |
317 | send_data(export.read, :type => 'text/csv; header=present', :filename => 'export.csv') |
|
317 | send_data(export.read, :type => 'text/csv; header=present', :filename => 'export.csv') | |
318 | end |
|
318 | end | |
319 |
|
319 | |||
320 | # Export filtered/sorted issues to PDF |
|
320 | # Export filtered/sorted issues to PDF | |
321 | def export_issues_pdf |
|
321 | def export_issues_pdf | |
322 | sort_init "#{Issue.table_name}.id", "desc" |
|
322 | sort_init "#{Issue.table_name}.id", "desc" | |
323 | sort_update |
|
323 | sort_update | |
324 |
|
324 | |||
325 | retrieve_query |
|
325 | retrieve_query | |
326 | render :action => 'list_issues' and return unless @query.valid? |
|
326 | render :action => 'list_issues' and return unless @query.valid? | |
327 |
|
327 | |||
328 | @issues = Issue.find :all, :order => sort_clause, |
|
328 | @issues = Issue.find :all, :order => sort_clause, | |
329 | :include => [ :author, :status, :tracker, :priority ], |
|
329 | :include => [ :author, :status, :tracker, :priority ], | |
330 | :conditions => @query.statement, |
|
330 | :conditions => @query.statement, | |
331 | :limit => Setting.issues_export_limit |
|
331 | :limit => Setting.issues_export_limit | |
332 |
|
332 | |||
333 | @options_for_rfpdf ||= {} |
|
333 | @options_for_rfpdf ||= {} | |
334 | @options_for_rfpdf[:file_name] = "export.pdf" |
|
334 | @options_for_rfpdf[:file_name] = "export.pdf" | |
335 | render :layout => false |
|
335 | render :layout => false | |
336 | end |
|
336 | end | |
337 |
|
337 | |||
338 | def move_issues |
|
338 | def move_issues | |
339 | @issues = @project.issues.find(params[:issue_ids]) if params[:issue_ids] |
|
339 | @issues = @project.issues.find(params[:issue_ids]) if params[:issue_ids] | |
340 | redirect_to :action => 'list_issues', :id => @project and return unless @issues |
|
340 | redirect_to :action => 'list_issues', :id => @project and return unless @issues | |
341 | @projects = [] |
|
341 | @projects = [] | |
342 | # find projects to which the user is allowed to move the issue |
|
342 | # find projects to which the user is allowed to move the issue | |
343 | @logged_in_user.memberships.each {|m| @projects << m.project if Permission.allowed_to_role("projects/move_issues", m.role_id)} |
|
343 | @logged_in_user.memberships.each {|m| @projects << m.project if Permission.allowed_to_role("projects/move_issues", m.role_id)} | |
344 | # issue can be moved to any tracker |
|
344 | # issue can be moved to any tracker | |
345 | @trackers = Tracker.find(:all) |
|
345 | @trackers = Tracker.find(:all) | |
346 | if request.post? and params[:new_project_id] and params[:new_tracker_id] |
|
346 | if request.post? and params[:new_project_id] and params[:new_tracker_id] | |
347 | new_project = Project.find(params[:new_project_id]) |
|
347 | new_project = Project.find(params[:new_project_id]) | |
348 | new_tracker = Tracker.find(params[:new_tracker_id]) |
|
348 | new_tracker = Tracker.find(params[:new_tracker_id]) | |
349 | @issues.each { |i| |
|
349 | @issues.each { |i| | |
350 | # project dependent properties |
|
350 | # project dependent properties | |
351 | unless i.project_id == new_project.id |
|
351 | unless i.project_id == new_project.id | |
352 | i.category = nil |
|
352 | i.category = nil | |
353 | i.fixed_version = nil |
|
353 | i.fixed_version = nil | |
354 | end |
|
354 | end | |
355 | # move the issue |
|
355 | # move the issue | |
356 | i.project = new_project |
|
356 | i.project = new_project | |
357 | i.tracker = new_tracker |
|
357 | i.tracker = new_tracker | |
358 | i.save |
|
358 | i.save | |
359 | } |
|
359 | } | |
360 | flash[:notice] = l(:notice_successful_update) |
|
360 | flash[:notice] = l(:notice_successful_update) | |
361 | redirect_to :action => 'list_issues', :id => @project |
|
361 | redirect_to :action => 'list_issues', :id => @project | |
362 | end |
|
362 | end | |
363 | end |
|
363 | end | |
364 |
|
364 | |||
365 | def add_query |
|
365 | def add_query | |
366 | @query = Query.new(params[:query]) |
|
366 | @query = Query.new(params[:query]) | |
367 | @query.project = @project |
|
367 | @query.project = @project | |
368 | @query.user = logged_in_user |
|
368 | @query.user = logged_in_user | |
369 |
|
369 | |||
370 | params[:fields].each do |field| |
|
370 | params[:fields].each do |field| | |
371 | @query.add_filter(field, params[:operators][field], params[:values][field]) |
|
371 | @query.add_filter(field, params[:operators][field], params[:values][field]) | |
372 | end if params[:fields] |
|
372 | end if params[:fields] | |
373 |
|
373 | |||
374 | if request.post? and @query.save |
|
374 | if request.post? and @query.save | |
375 | flash[:notice] = l(:notice_successful_create) |
|
375 | flash[:notice] = l(:notice_successful_create) | |
376 | redirect_to :controller => 'reports', :action => 'issue_report', :id => @project |
|
376 | redirect_to :controller => 'reports', :action => 'issue_report', :id => @project | |
377 | end |
|
377 | end | |
378 | render :layout => false if request.xhr? |
|
378 | render :layout => false if request.xhr? | |
379 | end |
|
379 | end | |
380 |
|
380 | |||
381 | # Add a news to @project |
|
381 | # Add a news to @project | |
382 | def add_news |
|
382 | def add_news | |
383 | @news = News.new(:project => @project) |
|
383 | @news = News.new(:project => @project) | |
384 | if request.post? |
|
384 | if request.post? | |
385 | @news.attributes = params[:news] |
|
385 | @news.attributes = params[:news] | |
386 | @news.author_id = self.logged_in_user.id if self.logged_in_user |
|
386 | @news.author_id = self.logged_in_user.id if self.logged_in_user | |
387 | if @news.save |
|
387 | if @news.save | |
388 | flash[:notice] = l(:notice_successful_create) |
|
388 | flash[:notice] = l(:notice_successful_create) | |
389 | redirect_to :action => 'list_news', :id => @project |
|
389 | redirect_to :action => 'list_news', :id => @project | |
390 | end |
|
390 | end | |
391 | end |
|
391 | end | |
392 | end |
|
392 | end | |
393 |
|
393 | |||
394 | # Show news list of @project |
|
394 | # Show news list of @project | |
395 | def list_news |
|
395 | def list_news | |
396 | @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "#{News.table_name}.created_on DESC" |
|
396 | @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "#{News.table_name}.created_on DESC" | |
397 | render :action => "list_news", :layout => false if request.xhr? |
|
397 | render :action => "list_news", :layout => false if request.xhr? | |
398 | end |
|
398 | end | |
399 |
|
399 | |||
400 | def add_file |
|
400 | def add_file | |
401 | if request.post? |
|
401 | if request.post? | |
402 | @version = @project.versions.find_by_id(params[:version_id]) |
|
402 | @version = @project.versions.find_by_id(params[:version_id]) | |
403 | # Save the attachments |
|
403 | # Save the attachments | |
404 | @attachments = [] |
|
404 | @attachments = [] | |
405 | params[:attachments].each { |file| |
|
405 | params[:attachments].each { |file| | |
406 | next unless file.size > 0 |
|
406 | next unless file.size > 0 | |
407 | a = Attachment.create(:container => @version, :file => file, :author => logged_in_user) |
|
407 | a = Attachment.create(:container => @version, :file => file, :author => logged_in_user) | |
408 | @attachments << a unless a.new_record? |
|
408 | @attachments << a unless a.new_record? | |
409 | } if params[:attachments] and params[:attachments].is_a? Array |
|
409 | } if params[:attachments] and params[:attachments].is_a? Array | |
410 | Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? |
|
410 | Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? | |
411 | redirect_to :controller => 'projects', :action => 'list_files', :id => @project |
|
411 | redirect_to :controller => 'projects', :action => 'list_files', :id => @project | |
412 | end |
|
412 | end | |
413 | @versions = @project.versions |
|
413 | @versions = @project.versions | |
414 | end |
|
414 | end | |
415 |
|
415 | |||
416 | def list_files |
|
416 | def list_files | |
417 | @versions = @project.versions |
|
417 | @versions = @project.versions | |
418 | end |
|
418 | end | |
419 |
|
419 | |||
420 | # Show changelog for @project |
|
420 | # Show changelog for @project | |
421 | def changelog |
|
421 | def changelog | |
422 | @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position') |
|
422 | @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position') | |
423 | if request.get? |
|
423 | if request.get? | |
424 | @selected_tracker_ids = @trackers.collect {|t| t.id.to_s } |
|
424 | @selected_tracker_ids = @trackers.collect {|t| t.id.to_s } | |
425 | else |
|
425 | else | |
426 | @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array |
|
426 | @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array | |
427 | end |
|
427 | end | |
428 | @selected_tracker_ids ||= [] |
|
428 | @selected_tracker_ids ||= [] | |
429 | @fixed_issues = @project.issues.find(:all, |
|
429 | @fixed_issues = @project.issues.find(:all, | |
430 | :include => [ :fixed_version, :status, :tracker ], |
|
430 | :include => [ :fixed_version, :status, :tracker ], | |
431 | :conditions => [ "#{IssueStatus.table_name}.is_closed=? and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}) and #{Issue.table_name}.fixed_version_id is not null", true], |
|
431 | :conditions => [ "#{IssueStatus.table_name}.is_closed=? and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}) and #{Issue.table_name}.fixed_version_id is not null", true], | |
432 | :order => "#{Version.table_name}.effective_date DESC, #{Issue.table_name}.id DESC" |
|
432 | :order => "#{Version.table_name}.effective_date DESC, #{Issue.table_name}.id DESC" | |
433 | ) unless @selected_tracker_ids.empty? |
|
433 | ) unless @selected_tracker_ids.empty? | |
434 | @fixed_issues ||= [] |
|
434 | @fixed_issues ||= [] | |
435 | end |
|
435 | end | |
436 |
|
436 | |||
437 | def roadmap |
|
437 | def roadmap | |
438 | @trackers = Tracker.find(:all, :conditions => ["is_in_roadmap=?", true], :order => 'position') |
|
438 | @trackers = Tracker.find(:all, :conditions => ["is_in_roadmap=?", true], :order => 'position') | |
439 | if request.get? |
|
439 | if request.get? | |
440 | @selected_tracker_ids = @trackers.collect {|t| t.id.to_s } |
|
440 | @selected_tracker_ids = @trackers.collect {|t| t.id.to_s } | |
441 | else |
|
441 | else | |
442 | @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array |
|
442 | @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array | |
443 | end |
|
443 | end | |
444 | @selected_tracker_ids ||= [] |
|
444 | @selected_tracker_ids ||= [] | |
445 | @versions = @project.versions.find(:all, |
|
445 | @versions = @project.versions.find(:all, | |
446 | :conditions => [ "#{Version.table_name}.effective_date>?", Date.today], |
|
446 | :conditions => [ "#{Version.table_name}.effective_date>?", Date.today], | |
447 | :order => "#{Version.table_name}.effective_date ASC" |
|
447 | :order => "#{Version.table_name}.effective_date ASC" | |
448 | ) |
|
448 | ) | |
449 | end |
|
449 | end | |
450 |
|
450 | |||
451 | def activity |
|
451 | def activity | |
452 | if params[:year] and params[:year].to_i > 1900 |
|
452 | if params[:year] and params[:year].to_i > 1900 | |
453 | @year = params[:year].to_i |
|
453 | @year = params[:year].to_i | |
454 | if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 |
|
454 | if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 | |
455 | @month = params[:month].to_i |
|
455 | @month = params[:month].to_i | |
456 | end |
|
456 | end | |
457 | end |
|
457 | end | |
458 | @year ||= Date.today.year |
|
458 | @year ||= Date.today.year | |
459 | @month ||= Date.today.month |
|
459 | @month ||= Date.today.month | |
460 |
|
460 | |||
461 | @date_from = Date.civil(@year, @month, 1) |
|
461 | @date_from = Date.civil(@year, @month, 1) | |
462 | @date_to = (@date_from >> 1)-1 |
|
462 | @date_to = (@date_from >> 1)-1 | |
463 |
|
463 | |||
464 | @events_by_day = {} |
|
464 | @events_by_day = {} | |
465 |
|
465 | |||
466 | unless params[:show_issues] == "0" |
|
466 | unless params[:show_issues] == "0" | |
467 | @project.issues.find(:all, :include => [:author, :status], :conditions => ["#{Issue.table_name}.created_on>=? and #{Issue.table_name}.created_on<=?", @date_from, @date_to] ).each { |i| |
|
467 | @project.issues.find(:all, :include => [:author, :status], :conditions => ["#{Issue.table_name}.created_on>=? and #{Issue.table_name}.created_on<=?", @date_from, @date_to] ).each { |i| | |
468 | @events_by_day[i.created_on.to_date] ||= [] |
|
468 | @events_by_day[i.created_on.to_date] ||= [] | |
469 | @events_by_day[i.created_on.to_date] << i |
|
469 | @events_by_day[i.created_on.to_date] << i | |
470 | } |
|
470 | } | |
471 | @show_issues = 1 |
|
471 | @show_issues = 1 | |
472 | end |
|
472 | end | |
473 |
|
473 | |||
474 | unless params[:show_news] == "0" |
|
474 | unless params[:show_news] == "0" | |
475 | @project.news.find(:all, :conditions => ["#{News.table_name}.created_on>=? and #{News.table_name}.created_on<=?", @date_from, @date_to], :include => :author ).each { |i| |
|
475 | @project.news.find(:all, :conditions => ["#{News.table_name}.created_on>=? and #{News.table_name}.created_on<=?", @date_from, @date_to], :include => :author ).each { |i| | |
476 | @events_by_day[i.created_on.to_date] ||= [] |
|
476 | @events_by_day[i.created_on.to_date] ||= [] | |
477 | @events_by_day[i.created_on.to_date] << i |
|
477 | @events_by_day[i.created_on.to_date] << i | |
478 | } |
|
478 | } | |
479 | @show_news = 1 |
|
479 | @show_news = 1 | |
480 | end |
|
480 | end | |
481 |
|
481 | |||
482 | unless params[:show_files] == "0" |
|
482 | unless params[:show_files] == "0" | |
483 | Attachment.find(:all, :select => "#{Attachment.table_name}.*", :joins => "LEFT JOIN #{Version.table_name} ON #{Version.table_name}.id = #{Attachment.table_name}.container_id", :conditions => ["#{Attachment.table_name}.container_type='Version' and #{Version.table_name}.project_id=? and #{Attachment.table_name}.created_on>=? and #{Attachment.table_name}.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i| |
|
483 | Attachment.find(:all, :select => "#{Attachment.table_name}.*", :joins => "LEFT JOIN #{Version.table_name} ON #{Version.table_name}.id = #{Attachment.table_name}.container_id", :conditions => ["#{Attachment.table_name}.container_type='Version' and #{Version.table_name}.project_id=? and #{Attachment.table_name}.created_on>=? and #{Attachment.table_name}.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i| | |
484 | @events_by_day[i.created_on.to_date] ||= [] |
|
484 | @events_by_day[i.created_on.to_date] ||= [] | |
485 | @events_by_day[i.created_on.to_date] << i |
|
485 | @events_by_day[i.created_on.to_date] << i | |
486 | } |
|
486 | } | |
487 | @show_files = 1 |
|
487 | @show_files = 1 | |
488 | end |
|
488 | end | |
489 |
|
489 | |||
490 | unless params[:show_documents] == "0" |
|
490 | unless params[:show_documents] == "0" | |
491 | @project.documents.find(:all, :conditions => ["#{Document.table_name}.created_on>=? and #{Document.table_name}.created_on<=?", @date_from, @date_to] ).each { |i| |
|
491 | @project.documents.find(:all, :conditions => ["#{Document.table_name}.created_on>=? and #{Document.table_name}.created_on<=?", @date_from, @date_to] ).each { |i| | |
492 | @events_by_day[i.created_on.to_date] ||= [] |
|
492 | @events_by_day[i.created_on.to_date] ||= [] | |
493 | @events_by_day[i.created_on.to_date] << i |
|
493 | @events_by_day[i.created_on.to_date] << i | |
494 | } |
|
494 | } | |
495 | Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN #{Document.table_name} ON #{Document.table_name}.id = #{Attachment.table_name}.container_id", :conditions => ["#{Attachment.table_name}.container_type='Document' and #{Document.table_name}.project_id=? and #{Attachment.table_name}.created_on>=? and #{Attachment.table_name}.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i| |
|
495 | Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN #{Document.table_name} ON #{Document.table_name}.id = #{Attachment.table_name}.container_id", :conditions => ["#{Attachment.table_name}.container_type='Document' and #{Document.table_name}.project_id=? and #{Attachment.table_name}.created_on>=? and #{Attachment.table_name}.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i| | |
496 | @events_by_day[i.created_on.to_date] ||= [] |
|
496 | @events_by_day[i.created_on.to_date] ||= [] | |
497 | @events_by_day[i.created_on.to_date] << i |
|
497 | @events_by_day[i.created_on.to_date] << i | |
498 | } |
|
498 | } | |
499 | @show_documents = 1 |
|
499 | @show_documents = 1 | |
500 | end |
|
500 | end | |
501 |
|
501 | |||
502 | render :layout => false if request.xhr? |
|
502 | render :layout => false if request.xhr? | |
503 | end |
|
503 | end | |
504 |
|
504 | |||
505 | def calendar |
|
505 | def calendar | |
506 | if params[:year] and params[:year].to_i > 1900 |
|
506 | if params[:year] and params[:year].to_i > 1900 | |
507 | @year = params[:year].to_i |
|
507 | @year = params[:year].to_i | |
508 | if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 |
|
508 | if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 | |
509 | @month = params[:month].to_i |
|
509 | @month = params[:month].to_i | |
510 | end |
|
510 | end | |
511 | end |
|
511 | end | |
512 | @year ||= Date.today.year |
|
512 | @year ||= Date.today.year | |
513 | @month ||= Date.today.month |
|
513 | @month ||= Date.today.month | |
514 |
|
514 | |||
515 | @date_from = Date.civil(@year, @month, 1) |
|
515 | @date_from = Date.civil(@year, @month, 1) | |
516 | @date_to = (@date_from >> 1)-1 |
|
516 | @date_to = (@date_from >> 1)-1 | |
517 | # start on monday |
|
517 | # start on monday | |
518 | @date_from = @date_from - (@date_from.cwday-1) |
|
518 | @date_from = @date_from - (@date_from.cwday-1) | |
519 | # finish on sunday |
|
519 | # finish on sunday | |
520 | @date_to = @date_to + (7-@date_to.cwday) |
|
520 | @date_to = @date_to + (7-@date_to.cwday) | |
521 |
|
521 | |||
522 | @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]) |
|
522 | @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]) | |
523 | render :layout => false if request.xhr? |
|
523 | render :layout => false if request.xhr? | |
524 | end |
|
524 | end | |
525 |
|
525 | |||
526 | def gantt |
|
526 | def gantt | |
527 | if params[:year] and params[:year].to_i >0 |
|
527 | if params[:year] and params[:year].to_i >0 | |
528 | @year_from = params[:year].to_i |
|
528 | @year_from = params[:year].to_i | |
529 | if params[:month] and params[:month].to_i >=1 and params[:month].to_i <= 12 |
|
529 | if params[:month] and params[:month].to_i >=1 and params[:month].to_i <= 12 | |
530 | @month_from = params[:month].to_i |
|
530 | @month_from = params[:month].to_i | |
531 | else |
|
531 | else | |
532 | @month_from = 1 |
|
532 | @month_from = 1 | |
533 | end |
|
533 | end | |
534 | else |
|
534 | else | |
535 | @month_from ||= (Date.today << 1).month |
|
535 | @month_from ||= (Date.today << 1).month | |
536 | @year_from ||= (Date.today << 1).year |
|
536 | @year_from ||= (Date.today << 1).year | |
537 | end |
|
537 | end | |
538 |
|
538 | |||
539 | @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2 |
|
539 | @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2 | |
540 | @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6 |
|
540 | @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6 | |
541 |
|
541 | |||
542 | @date_from = Date.civil(@year_from, @month_from, 1) |
|
542 | @date_from = Date.civil(@year_from, @month_from, 1) | |
543 | @date_to = (@date_from >> @months) - 1 |
|
543 | @date_to = (@date_from >> @months) - 1 | |
544 | @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]) |
|
544 | @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]) | |
545 |
|
545 | |||
546 | if params[:output]=='pdf' |
|
546 | if params[:output]=='pdf' | |
547 | @options_for_rfpdf ||= {} |
|
547 | @options_for_rfpdf ||= {} | |
548 | @options_for_rfpdf[:file_name] = "gantt.pdf" |
|
548 | @options_for_rfpdf[:file_name] = "gantt.pdf" | |
549 | render :template => "projects/gantt.rfpdf", :layout => false |
|
549 | render :template => "projects/gantt.rfpdf", :layout => false | |
550 | else |
|
550 | else | |
551 | render :template => "projects/gantt.rhtml" |
|
551 | render :template => "projects/gantt.rhtml" | |
552 | end |
|
552 | end | |
553 | end |
|
553 | end | |
554 |
|
554 | |||
555 | def search |
|
555 | def search | |
556 | @question = params[:q] || "" |
|
556 | @question = params[:q] || "" | |
557 | @question.strip! |
|
557 | @question.strip! | |
558 | @all_words = params[:all_words] || (params[:submit] ? false : true) |
|
558 | @all_words = params[:all_words] || (params[:submit] ? false : true) | |
559 | @scope = params[:scope] || (params[:submit] ? [] : %w(issues news documents wiki) ) |
|
559 | @scope = params[:scope] || (params[:submit] ? [] : %w(issues news documents wiki) ) | |
560 | if !@question.empty? |
|
560 | if !@question.empty? | |
561 | # tokens must be at least 3 character long |
|
561 | # tokens must be at least 3 character long | |
562 | @tokens = @question.split.uniq.select {|w| w.length > 2 } |
|
562 | @tokens = @question.split.uniq.select {|w| w.length > 2 } | |
563 | # no more than 5 tokens to search for |
|
563 | # no more than 5 tokens to search for | |
564 | @tokens.slice! 5..-1 if @tokens.size > 5 |
|
564 | @tokens.slice! 5..-1 if @tokens.size > 5 | |
565 | # strings used in sql like statement |
|
565 | # strings used in sql like statement | |
566 | like_tokens = @tokens.collect {|w| "%#{w}%"} |
|
566 | like_tokens = @tokens.collect {|w| "%#{w}%"} | |
567 | operator = @all_words ? " AND " : " OR " |
|
567 | operator = @all_words ? " AND " : " OR " | |
568 | limit = 10 |
|
568 | limit = 10 | |
569 | @results = [] |
|
569 | @results = [] | |
570 | @results += @project.issues.find(:all, :limit => limit, :include => :author, :conditions => [ (["(LOWER(subject) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'issues' |
|
570 | @results += @project.issues.find(:all, :limit => limit, :include => :author, :conditions => [ (["(LOWER(subject) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'issues' | |
571 | @results += @project.news.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort], :include => :author ) if @scope.include? 'news' |
|
571 | @results += @project.news.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort], :include => :author ) if @scope.include? 'news' | |
572 | @results += @project.documents.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'documents' |
|
572 | @results += @project.documents.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'documents' | |
573 | @results += @project.wiki.pages.find(:all, :limit => limit, :include => :content, :conditions => [ (["(LOWER(title) like ? OR LOWER(text) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @project.wiki && @scope.include?('wiki') |
|
573 | @results += @project.wiki.pages.find(:all, :limit => limit, :include => :content, :conditions => [ (["(LOWER(title) like ? OR LOWER(text) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @project.wiki && @scope.include?('wiki') | |
574 | @question = @tokens.join(" ") |
|
574 | @question = @tokens.join(" ") | |
575 | end |
|
575 | end | |
576 | end |
|
576 | end | |
577 |
|
577 | |||
578 | def feeds |
|
578 | def feeds | |
579 | @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)] |
|
579 | @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)] | |
580 | @key = logged_in_user.get_or_create_rss_key.value if logged_in_user |
|
580 | @key = logged_in_user.get_or_create_rss_key.value if logged_in_user | |
581 | end |
|
581 | end | |
582 |
|
582 | |||
583 | private |
|
583 | private | |
584 | # Find project of id params[:id] |
|
584 | # Find project of id params[:id] | |
585 | # if not found, redirect to project list |
|
585 | # if not found, redirect to project list | |
586 | # Used as a before_filter |
|
586 | # Used as a before_filter | |
587 | def find_project |
|
587 | def find_project | |
588 | @project = Project.find(params[:id]) |
|
588 | @project = Project.find(params[:id]) | |
589 | @html_title = @project.name |
|
589 | @html_title = @project.name | |
590 | rescue ActiveRecord::RecordNotFound |
|
590 | rescue ActiveRecord::RecordNotFound | |
591 | render_404 |
|
591 | render_404 | |
592 | end |
|
592 | end | |
593 |
|
593 | |||
594 | # Retrieve query from session or build a new query |
|
594 | # Retrieve query from session or build a new query | |
595 | def retrieve_query |
|
595 | def retrieve_query | |
596 | if params[:query_id] |
|
596 | if params[:query_id] | |
597 | @query = @project.queries.find(params[:query_id]) |
|
597 | @query = @project.queries.find(params[:query_id]) | |
598 | session[:query] = @query |
|
598 | session[:query] = @query | |
599 | else |
|
599 | else | |
600 | if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id |
|
600 | if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id | |
601 | # Give it a name, required to be valid |
|
601 | # Give it a name, required to be valid | |
602 | @query = Query.new(:name => "_") |
|
602 | @query = Query.new(:name => "_") | |
603 | @query.project = @project |
|
603 | @query.project = @project | |
604 | if params[:fields] and params[:fields].is_a? Array |
|
604 | if params[:fields] and params[:fields].is_a? Array | |
605 | params[:fields].each do |field| |
|
605 | params[:fields].each do |field| | |
606 | @query.add_filter(field, params[:operators][field], params[:values][field]) |
|
606 | @query.add_filter(field, params[:operators][field], params[:values][field]) | |
607 | end |
|
607 | end | |
608 | else |
|
608 | else | |
609 | @query.available_filters.keys.each do |field| |
|
609 | @query.available_filters.keys.each do |field| | |
610 | @query.add_short_filter(field, params[field]) if params[field] |
|
610 | @query.add_short_filter(field, params[field]) if params[field] | |
611 | end |
|
611 | end | |
612 | end |
|
612 | end | |
613 | session[:query] = @query |
|
613 | session[:query] = @query | |
614 | else |
|
614 | else | |
615 | @query = session[:query] |
|
615 | @query = session[:query] | |
616 | end |
|
616 | end | |
617 | end |
|
617 | end | |
618 | end |
|
618 | end | |
619 | end |
|
619 | end |
@@ -1,149 +1,147 | |||||
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
2 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
|
2 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
3 | <head> |
|
3 | <head> | |
4 | <title><%= Setting.app_title + (@html_title ? ": #{@html_title}" : "") %></title> |
|
4 | <title><%= Setting.app_title + (@html_title ? ": #{@html_title}" : "") %></title> | |
5 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
|
5 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
6 | <meta name="description" content="redMine" /> |
|
6 | <meta name="description" content="redMine" /> | |
7 | <meta name="keywords" content="issue,bug,tracker" /> |
|
7 | <meta name="keywords" content="issue,bug,tracker" /> | |
8 | <!--[if IE]> |
|
8 | <!--[if IE]> | |
9 | <style type="text/css"> |
|
9 | <style type="text/css"> | |
10 | body {behavior: url(<%= stylesheet_path "csshover.htc" %>);} |
|
10 | body {behavior: url(<%= stylesheet_path "csshover.htc" %>);} | |
11 | </style> |
|
11 | </style> | |
12 | <![endif]--> |
|
12 | <![endif]--> | |
13 | <%= stylesheet_link_tag "application" %> |
|
13 | <%= stylesheet_link_tag "application" %> | |
14 | <%= stylesheet_link_tag "print", :media => "print" %> |
|
14 | <%= stylesheet_link_tag "print", :media => "print" %> | |
15 | <%= javascript_include_tag :defaults %> |
|
15 | <%= javascript_include_tag :defaults %> | |
16 | <%= javascript_include_tag 'menu' %> |
|
16 | <%= javascript_include_tag 'menu' %> | |
17 | <%= stylesheet_link_tag 'jstoolbar' %> |
|
17 | <%= stylesheet_link_tag 'jstoolbar' %> | |
18 | <!-- page specific tags --><%= yield :header_tags %> |
|
18 | <!-- page specific tags --><%= yield :header_tags %> | |
19 | </head> |
|
19 | </head> | |
20 |
|
20 | |||
21 | <body> |
|
21 | <body> | |
22 | <div id="container" > |
|
22 | <div id="container" > | |
23 |
|
23 | |||
24 | <div id="header"> |
|
24 | <div id="header"> | |
25 | <div style="float: left;"> |
|
25 | <div style="float: left;"> | |
26 | <h1><%= Setting.app_title %></h1> |
|
26 | <h1><%= Setting.app_title %></h1> | |
27 | <h2><%= Setting.app_subtitle %></h2> |
|
27 | <h2><%= Setting.app_subtitle %></h2> | |
28 | </div> |
|
28 | </div> | |
29 | <div style="float: right; padding-right: 1em; padding-top: 0.2em;"> |
|
29 | <div style="float: right; padding-right: 1em; padding-top: 0.2em;"> | |
30 | <% if loggedin? %><small><%=l(:label_logged_as)%> <b><%= @logged_in_user.login %></b></small><% end %> |
|
30 | <% if loggedin? %><small><%=l(:label_logged_as)%> <b><%= @logged_in_user.login %></b></small><% end %> | |
31 | </div> |
|
31 | </div> | |
32 | </div> |
|
32 | </div> | |
33 |
|
33 | |||
34 | <div id="navigation"> |
|
34 | <div id="navigation"> | |
35 | <ul> |
|
35 | <ul> | |
36 | <li><%= link_to l(:label_home), { :controller => 'welcome' }, :class => "icon icon-home" %></li> |
|
36 | <li><%= link_to l(:label_home), { :controller => 'welcome' }, :class => "icon icon-home" %></li> | |
37 | <li><%= link_to l(:label_my_page), { :controller => 'my', :action => 'page'}, :class => "icon icon-mypage" %></li> |
|
37 | <li><%= link_to l(:label_my_page), { :controller => 'my', :action => 'page'}, :class => "icon icon-mypage" %></li> | |
38 | <li><%= link_to l(:label_project_plural), { :controller => 'projects' }, :class => "icon icon-projects" %></li> |
|
38 | <li><%= link_to l(:label_project_plural), { :controller => 'projects' }, :class => "icon icon-projects" %></li> | |
39 |
|
39 | |||
40 | <% unless @project.nil? || @project.id.nil? %> |
|
40 | <% unless @project.nil? || @project.id.nil? %> | |
41 | <li class="submenu"><%= link_to @project.name, { :controller => 'projects', :action => 'show', :id => @project }, :class => "icon icon-projects", :onmouseover => "buttonMouseover(event, 'menuProject');" %></li> |
|
41 | <li class="submenu"><%= link_to @project.name, { :controller => 'projects', :action => 'show', :id => @project }, :class => "icon icon-projects", :onmouseover => "buttonMouseover(event, 'menuProject');" %></li> | |
42 | <% end %> |
|
42 | <% end %> | |
43 |
|
43 | |||
44 | <% if loggedin? %> |
|
44 | <% if loggedin? %> | |
45 | <li><%= link_to l(:label_my_account), { :controller => 'my', :action => 'account' }, :class => "icon icon-user" %></li> |
|
45 | <li><%= link_to l(:label_my_account), { :controller => 'my', :action => 'account' }, :class => "icon icon-user" %></li> | |
46 | <% end %> |
|
46 | <% end %> | |
47 |
|
47 | |||
48 | <% if admin_loggedin? %> |
|
48 | <% if admin_loggedin? %> | |
49 | <li class="submenu"><%= link_to l(:label_administration), { :controller => 'admin' }, :class => "icon icon-admin", :onmouseover => "buttonMouseover(event, 'menuAdmin');" %></li> |
|
49 | <li class="submenu"><%= link_to l(:label_administration), { :controller => 'admin' }, :class => "icon icon-admin", :onmouseover => "buttonMouseover(event, 'menuAdmin');" %></li> | |
50 | <% end %> |
|
50 | <% end %> | |
51 |
|
51 | |||
52 | <li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => params[:controller], :page => params[:action] }, :onclick => "window.open(this.href); return false;", :class => "icon icon-help" %></li> |
|
52 | <li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => params[:controller], :page => params[:action] }, :onclick => "window.open(this.href); return false;", :class => "icon icon-help" %></li> | |
53 |
|
53 | |||
54 | <% if loggedin? %> |
|
54 | <% if loggedin? %> | |
55 | <li class="right"><%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => "icon icon-user" %></li> |
|
55 | <li class="right"><%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => "icon icon-user" %></li> | |
56 | <% else %> |
|
56 | <% else %> | |
57 | <li class="right"><%= link_to l(:label_login), { :controller => 'account', :action => 'login' }, :class => "icon icon-user" %></li> |
|
57 | <li class="right"><%= link_to l(:label_login), { :controller => 'account', :action => 'login' }, :class => "icon icon-user" %></li> | |
58 | <% end %> |
|
58 | <% end %> | |
59 | </ul> |
|
59 | </ul> | |
60 | </div> |
|
60 | </div> | |
61 |
|
61 | |||
62 | <% if admin_loggedin? %> |
|
62 | <% if admin_loggedin? %> | |
63 | <div id="menuAdmin" class="menu" onmouseover="menuMouseover(event)"> |
|
63 | <div id="menuAdmin" class="menu" onmouseover="menuMouseover(event)"> | |
64 | <a class="menuItem" href="<%= url_for :controller => 'admin', :action => 'projects' %>" onmouseover="menuItemMouseover(event,'menuProjects');"><span class="menuItemText"><%=l(:label_project_plural)%></span><span class="menuItemArrow">▶</span></a> |
|
64 | <a class="menuItem" href="<%= url_for :controller => 'admin', :action => 'projects' %>" onmouseover="menuItemMouseover(event,'menuProjects');"><span class="menuItemText"><%=l(:label_project_plural)%></span><span class="menuItemArrow">▶</span></a> | |
65 | <a class="menuItem" href="<%= url_for :controller => 'users' %>" onmouseover="menuItemMouseover(event,'menuUsers');"><span class="menuItemText"><%=l(:label_user_plural)%></span><span class="menuItemArrow">▶</span></a> |
|
65 | <a class="menuItem" href="<%= url_for :controller => 'users' %>" onmouseover="menuItemMouseover(event,'menuUsers');"><span class="menuItemText"><%=l(:label_user_plural)%></span><span class="menuItemArrow">▶</span></a> | |
66 | <%= link_to l(:label_role_and_permissions), {:controller => 'roles' }, :class => "menuItem" %> |
|
66 | <%= link_to l(:label_role_and_permissions), {:controller => 'roles' }, :class => "menuItem" %> | |
67 | <a class="menuItem" href="<%= url_for :controller => 'trackers' %>" onmouseover="menuItemMouseover(event,'menuTrackers');"><span class="menuItemText"><%=l(:label_tracker_plural)%></span><span class="menuItemArrow">▶</span></a> |
|
67 | <a class="menuItem" href="<%= url_for :controller => 'trackers' %>" onmouseover="menuItemMouseover(event,'menuTrackers');"><span class="menuItemText"><%=l(:label_tracker_plural)%></span><span class="menuItemArrow">▶</span></a> | |
68 | <%= link_to l(:label_custom_field_plural), {:controller => 'custom_fields' }, :class => "menuItem" %> |
|
68 | <%= link_to l(:label_custom_field_plural), {:controller => 'custom_fields' }, :class => "menuItem" %> | |
69 | <%= link_to l(:label_enumerations), {:controller => 'enumerations' }, :class => "menuItem" %> |
|
69 | <%= link_to l(:label_enumerations), {:controller => 'enumerations' }, :class => "menuItem" %> | |
70 | <%= link_to l(:field_mail_notification), {:controller => 'admin', :action => 'mail_options' }, :class => "menuItem" %> |
|
70 | <%= link_to l(:field_mail_notification), {:controller => 'admin', :action => 'mail_options' }, :class => "menuItem" %> | |
71 | <%= link_to l(:label_authentication), {:controller => 'auth_sources' }, :class => "menuItem" %> |
|
71 | <%= link_to l(:label_authentication), {:controller => 'auth_sources' }, :class => "menuItem" %> | |
72 | <%= link_to l(:label_settings), {:controller => 'settings' }, :class => "menuItem" %> |
|
72 | <%= link_to l(:label_settings), {:controller => 'settings' }, :class => "menuItem" %> | |
73 | <%= link_to l(:label_information_plural), {:controller => 'admin', :action => 'info' }, :class => "menuItem" %> |
|
73 | <%= link_to l(:label_information_plural), {:controller => 'admin', :action => 'info' }, :class => "menuItem" %> | |
74 | </div> |
|
74 | </div> | |
75 | <div id="menuTrackers" class="menu"> |
|
75 | <div id="menuTrackers" class="menu"> | |
76 | <%= link_to l(:label_issue_status_plural), {:controller => 'issue_statuses' }, :class => "menuItem" %> |
|
76 | <%= link_to l(:label_issue_status_plural), {:controller => 'issue_statuses' }, :class => "menuItem" %> | |
77 | <%= link_to l(:label_workflow), {:controller => 'roles', :action => 'workflow' }, :class => "menuItem" %> |
|
77 | <%= link_to l(:label_workflow), {:controller => 'roles', :action => 'workflow' }, :class => "menuItem" %> | |
78 | </div> |
|
78 | </div> | |
79 | <div id="menuProjects" class="menu"><%= link_to l(:label_new), {:controller => 'projects', :action => 'add' }, :class => "menuItem" %></div> |
|
79 | <div id="menuProjects" class="menu"><%= link_to l(:label_new), {:controller => 'projects', :action => 'add' }, :class => "menuItem" %></div> | |
80 | <div id="menuUsers" class="menu"><%= link_to l(:label_new), {:controller => 'users', :action => 'add' }, :class => "menuItem" %></a></div> |
|
80 | <div id="menuUsers" class="menu"><%= link_to l(:label_new), {:controller => 'users', :action => 'add' }, :class => "menuItem" %></a></div> | |
81 | <% end %> |
|
81 | <% end %> | |
82 |
|
82 | |||
83 | <% unless @project.nil? || @project.id.nil? %> |
|
83 | <% unless @project.nil? || @project.id.nil? %> | |
84 | <div id="menuProject" class="menu" onmouseover="menuMouseover(event)"> |
|
84 | <div id="menuProject" class="menu" onmouseover="menuMouseover(event)"> | |
85 | <%= link_to l(:label_calendar), {:controller => 'projects', :action => 'calendar', :id => @project }, :class => "menuItem" %> |
|
85 | <%= link_to l(:label_calendar), {:controller => 'projects', :action => 'calendar', :id => @project }, :class => "menuItem" %> | |
86 | <%= link_to l(:label_gantt), {:controller => 'projects', :action => 'gantt', :id => @project }, :class => "menuItem" %> |
|
86 | <%= link_to l(:label_gantt), {:controller => 'projects', :action => 'gantt', :id => @project }, :class => "menuItem" %> | |
87 | <%= link_to l(:label_issue_plural), {:controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 }, :class => "menuItem" %> |
|
87 | <%= link_to l(:label_issue_plural), {:controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 }, :class => "menuItem" %> | |
88 | <%= link_to l(:label_report_plural), {:controller => 'reports', :action => 'issue_report', :id => @project }, :class => "menuItem" %> |
|
88 | <%= link_to l(:label_report_plural), {:controller => 'reports', :action => 'issue_report', :id => @project }, :class => "menuItem" %> | |
89 | <%= link_to l(:label_activity), {:controller => 'projects', :action => 'activity', :id => @project }, :class => "menuItem" %> |
|
89 | <%= link_to l(:label_activity), {:controller => 'projects', :action => 'activity', :id => @project }, :class => "menuItem" %> | |
90 | <%= link_to l(:label_news_plural), {:controller => 'projects', :action => 'list_news', :id => @project }, :class => "menuItem" %> |
|
90 | <%= link_to l(:label_news_plural), {:controller => 'projects', :action => 'list_news', :id => @project }, :class => "menuItem" %> | |
91 | <%= link_to l(:label_change_log), {:controller => 'projects', :action => 'changelog', :id => @project }, :class => "menuItem" %> |
|
91 | <%= link_to l(:label_change_log), {:controller => 'projects', :action => 'changelog', :id => @project }, :class => "menuItem" %> | |
92 | <%= link_to l(:label_roadmap), {:controller => 'projects', :action => 'roadmap', :id => @project }, :class => "menuItem" %> |
|
92 | <%= link_to l(:label_roadmap), {:controller => 'projects', :action => 'roadmap', :id => @project }, :class => "menuItem" %> | |
93 | <%= link_to l(:label_document_plural), {:controller => 'projects', :action => 'list_documents', :id => @project }, :class => "menuItem" %> |
|
93 | <%= link_to l(:label_document_plural), {:controller => 'projects', :action => 'list_documents', :id => @project }, :class => "menuItem" %> | |
94 | <%= link_to l(:label_wiki), {:controller => 'wiki', :id => @project, :page => nil }, :class => "menuItem" if @project.wiki and !@project.wiki.new_record? %> |
|
94 | <%= link_to l(:label_wiki), {:controller => 'wiki', :id => @project, :page => nil }, :class => "menuItem" if @project.wiki and !@project.wiki.new_record? %> | |
95 | <%= link_to l(:label_member_plural), {:controller => 'projects', :action => 'list_members', :id => @project }, :class => "menuItem" %> |
|
|||
96 | <%= link_to l(:label_attachment_plural), {:controller => 'projects', :action => 'list_files', :id => @project }, :class => "menuItem" %> |
|
95 | <%= link_to l(:label_attachment_plural), {:controller => 'projects', :action => 'list_files', :id => @project }, :class => "menuItem" %> | |
97 | <%= link_to l(:label_search), {:controller => 'projects', :action => 'search', :id => @project }, :class => "menuItem" %> |
|
96 | <%= link_to l(:label_search), {:controller => 'projects', :action => 'search', :id => @project }, :class => "menuItem" %> | |
98 | <%= link_to l(:label_repository), {:controller => 'repositories', :action => 'show', :id => @project}, :class => "menuItem" if @project.repository and !@project.repository.new_record? %> |
|
97 | <%= link_to l(:label_repository), {:controller => 'repositories', :action => 'show', :id => @project}, :class => "menuItem" if @project.repository and !@project.repository.new_record? %> | |
99 | <%= link_to_if_authorized l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project }, :class => "menuItem" %> |
|
98 | <%= link_to_if_authorized l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project }, :class => "menuItem" %> | |
100 | </div> |
|
99 | </div> | |
101 | <% end %> |
|
100 | <% end %> | |
102 |
|
101 | |||
103 |
|
102 | |||
104 | <div id="subcontent"> |
|
103 | <div id="subcontent"> | |
105 |
|
104 | |||
106 | <% unless @project.nil? || @project.id.nil? %> |
|
105 | <% unless @project.nil? || @project.id.nil? %> | |
107 | <h2><%= @project.name %></h2> |
|
106 | <h2><%= @project.name %></h2> | |
108 | <ul class="menublock"> |
|
107 | <ul class="menublock"> | |
109 | <li><%= link_to l(:label_overview), :controller => 'projects', :action => 'show', :id => @project %></li> |
|
108 | <li><%= link_to l(:label_overview), :controller => 'projects', :action => 'show', :id => @project %></li> | |
110 | <li><%= link_to l(:label_calendar), :controller => 'projects', :action => 'calendar', :id => @project %></li> |
|
109 | <li><%= link_to l(:label_calendar), :controller => 'projects', :action => 'calendar', :id => @project %></li> | |
111 | <li><%= link_to l(:label_gantt), :controller => 'projects', :action => 'gantt', :id => @project %></li> |
|
110 | <li><%= link_to l(:label_gantt), :controller => 'projects', :action => 'gantt', :id => @project %></li> | |
112 | <li><%= link_to l(:label_issue_plural), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></li> |
|
111 | <li><%= link_to l(:label_issue_plural), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></li> | |
113 | <li><%= link_to l(:label_report_plural), :controller => 'reports', :action => 'issue_report', :id => @project %></li> |
|
112 | <li><%= link_to l(:label_report_plural), :controller => 'reports', :action => 'issue_report', :id => @project %></li> | |
114 | <li><%= link_to l(:label_activity), :controller => 'projects', :action => 'activity', :id => @project %></li> |
|
113 | <li><%= link_to l(:label_activity), :controller => 'projects', :action => 'activity', :id => @project %></li> | |
115 | <li><%= link_to l(:label_news_plural), :controller => 'projects', :action => 'list_news', :id => @project %></li> |
|
114 | <li><%= link_to l(:label_news_plural), :controller => 'projects', :action => 'list_news', :id => @project %></li> | |
116 | <li><%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %></li> |
|
115 | <li><%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %></li> | |
117 | <li><%= link_to l(:label_roadmap), :controller => 'projects', :action => 'roadmap', :id => @project %></li> |
|
116 | <li><%= link_to l(:label_roadmap), :controller => 'projects', :action => 'roadmap', :id => @project %></li> | |
118 | <li><%= link_to l(:label_document_plural), :controller => 'projects', :action => 'list_documents', :id => @project %></li> |
|
117 | <li><%= link_to l(:label_document_plural), :controller => 'projects', :action => 'list_documents', :id => @project %></li> | |
119 | <li><%= link_to l(:label_wiki), :controller => 'wiki', :id => @project, :page => nil if @project.wiki and !@project.wiki.new_record? %></li> |
|
118 | <li><%= link_to l(:label_wiki), :controller => 'wiki', :id => @project, :page => nil if @project.wiki and !@project.wiki.new_record? %></li> | |
120 | <li><%= link_to l(:label_member_plural), :controller => 'projects', :action => 'list_members', :id => @project %></li> |
|
|||
121 | <li><%= link_to l(:label_attachment_plural), :controller => 'projects', :action => 'list_files', :id => @project %></li> |
|
119 | <li><%= link_to l(:label_attachment_plural), :controller => 'projects', :action => 'list_files', :id => @project %></li> | |
122 | <li><%= link_to l(:label_search), :controller => 'projects', :action => 'search', :id => @project %></li> |
|
120 | <li><%= link_to l(:label_search), :controller => 'projects', :action => 'search', :id => @project %></li> | |
123 | <li><%= link_to l(:label_repository), :controller => 'repositories', :action => 'show', :id => @project if @project.repository and !@project.repository.new_record? %></li> |
|
121 | <li><%= link_to l(:label_repository), :controller => 'repositories', :action => 'show', :id => @project if @project.repository and !@project.repository.new_record? %></li> | |
124 | <li><%= link_to_if_authorized l(:label_settings), :controller => 'projects', :action => 'settings', :id => @project %></li> |
|
122 | <li><%= link_to_if_authorized l(:label_settings), :controller => 'projects', :action => 'settings', :id => @project %></li> | |
125 | </ul> |
|
123 | </ul> | |
126 | <% end %> |
|
124 | <% end %> | |
127 |
|
125 | |||
128 | <% if loggedin? and @logged_in_user.memberships.length > 0 %> |
|
126 | <% if loggedin? and @logged_in_user.memberships.length > 0 %> | |
129 | <h2><%=l(:label_my_projects) %></h2> |
|
127 | <h2><%=l(:label_my_projects) %></h2> | |
130 | <ul class="menublock"> |
|
128 | <ul class="menublock"> | |
131 | <% for membership in @logged_in_user.memberships %> |
|
129 | <% for membership in @logged_in_user.memberships %> | |
132 | <li><%= link_to membership.project.name, :controller => 'projects', :action => 'show', :id => membership.project %></li> |
|
130 | <li><%= link_to membership.project.name, :controller => 'projects', :action => 'show', :id => membership.project %></li> | |
133 | <% end %> |
|
131 | <% end %> | |
134 | </ul> |
|
132 | </ul> | |
135 | <% end %> |
|
133 | <% end %> | |
136 | </div> |
|
134 | </div> | |
137 |
|
135 | |||
138 | <div id="content"> |
|
136 | <div id="content"> | |
139 | <% if flash[:notice] %><p style="color: green"><%= flash[:notice] %></p><% end %> |
|
137 | <% if flash[:notice] %><p style="color: green"><%= flash[:notice] %></p><% end %> | |
140 | <%= @content_for_layout %> |
|
138 | <%= @content_for_layout %> | |
141 | </div> |
|
139 | </div> | |
142 |
|
140 | |||
143 | <div id="footer"> |
|
141 | <div id="footer"> | |
144 | <p><a href="http://redmine.rubyforge.org/">redMine</a> <small><%= Redmine::VERSION %> © 2006-2007 Jean-Philippe Lang</small></p> |
|
142 | <p><a href="http://redmine.rubyforge.org/">redMine</a> <small><%= Redmine::VERSION %> © 2006-2007 Jean-Philippe Lang</small></p> | |
145 | </div> |
|
143 | </div> | |
146 |
|
144 | |||
147 | </div> |
|
145 | </div> | |
148 | </body> |
|
146 | </body> | |
149 | </html> No newline at end of file |
|
147 | </html> |
General Comments 0
You need to be logged in to leave comments.
Login now