@@ -1,691 +1,691 | |||||
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 "#{Project.table_name}.name", "asc" |
|
42 | sort_init "#{Project.table_name}.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 => ["#{Project.table_name}.is_public=?", true], |
|
49 | :conditions => ["#{Project.table_name}.is_public=?", true], | |
50 | :include => :parent, |
|
50 | :include => :parent, | |
51 | :limit => @project_pages.items_per_page, |
|
51 | :limit => @project_pages.items_per_page, | |
52 | :offset => @project_pages.current.offset |
|
52 | :offset => @project_pages.current.offset | |
53 |
|
53 | |||
54 | render :action => "list", :layout => false if request.xhr? |
|
54 | render :action => "list", :layout => false if request.xhr? | |
55 | end |
|
55 | end | |
56 |
|
56 | |||
57 | # Add a new project |
|
57 | # Add a new project | |
58 | def add |
|
58 | def add | |
59 | @custom_fields = IssueCustomField.find(:all) |
|
59 | @custom_fields = IssueCustomField.find(:all) | |
60 | @root_projects = Project.find(:all, :conditions => "parent_id is null") |
|
60 | @root_projects = Project.find(:all, :conditions => "parent_id is null") | |
61 | @project = Project.new(params[:project]) |
|
61 | @project = Project.new(params[:project]) | |
62 | if request.get? |
|
62 | if request.get? | |
63 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) } |
|
63 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) } | |
64 | else |
|
64 | else | |
65 | @project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] |
|
65 | @project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] | |
66 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } |
|
66 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } | |
67 | @project.custom_values = @custom_values |
|
67 | @project.custom_values = @custom_values | |
68 | if params[:repository_enabled] && params[:repository_enabled] == "1" |
|
68 | if params[:repository_enabled] && params[:repository_enabled] == "1" | |
69 | @project.repository = Repository.new |
|
69 | @project.repository = Repository.new | |
70 | @project.repository.attributes = params[:repository] |
|
70 | @project.repository.attributes = params[:repository] | |
71 | end |
|
71 | end | |
72 | if "1" == params[:wiki_enabled] |
|
72 | if "1" == params[:wiki_enabled] | |
73 | @project.wiki = Wiki.new |
|
73 | @project.wiki = Wiki.new | |
74 | @project.wiki.attributes = params[:wiki] |
|
74 | @project.wiki.attributes = params[:wiki] | |
75 | end |
|
75 | end | |
76 | if @project.save |
|
76 | if @project.save | |
77 | flash[:notice] = l(:notice_successful_create) |
|
77 | flash[:notice] = l(:notice_successful_create) | |
78 | redirect_to :controller => 'admin', :action => 'projects' |
|
78 | redirect_to :controller => 'admin', :action => 'projects' | |
79 | end |
|
79 | end | |
80 | end |
|
80 | end | |
81 | end |
|
81 | end | |
82 |
|
82 | |||
83 | # Show @project |
|
83 | # Show @project | |
84 | def show |
|
84 | def show | |
85 | @custom_values = @project.custom_values.find(:all, :include => :custom_field) |
|
85 | @custom_values = @project.custom_values.find(:all, :include => :custom_field) | |
86 | @members = @project.members.find(:all, :include => [:user, :role], :order => 'position') |
|
86 | @members = @project.members.find(:all, :include => [:user, :role], :order => 'position') | |
87 | @subprojects = @project.children if @project.children.size > 0 |
|
87 | @subprojects = @project.children if @project.children.size > 0 | |
88 | @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") |
|
88 | @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") | |
89 | @trackers = Tracker.find(:all, :order => 'position') |
|
89 | @trackers = Tracker.find(:all, :order => 'position') | |
90 | @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 | @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]) | |
91 | @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id]) |
|
91 | @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id]) | |
92 | end |
|
92 | end | |
93 |
|
93 | |||
94 | def settings |
|
94 | def settings | |
95 | @root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id]) |
|
95 | @root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id]) | |
96 | @custom_fields = IssueCustomField.find(:all) |
|
96 | @custom_fields = IssueCustomField.find(:all) | |
97 | @issue_category ||= IssueCategory.new |
|
97 | @issue_category ||= IssueCategory.new | |
98 | @member ||= @project.members.new |
|
98 | @member ||= @project.members.new | |
99 | @roles = Role.find(:all, :order => 'position') |
|
99 | @roles = Role.find(:all, :order => 'position') | |
100 | @users = User.find_active(:all) - @project.users |
|
100 | @users = User.find_active(:all) - @project.users | |
101 | @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) } |
|
101 | @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) } | |
102 | end |
|
102 | end | |
103 |
|
103 | |||
104 | # Edit @project |
|
104 | # Edit @project | |
105 | def edit |
|
105 | def edit | |
106 | if request.post? |
|
106 | if request.post? | |
107 | @project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] |
|
107 | @project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] | |
108 | if params[:custom_fields] |
|
108 | if params[:custom_fields] | |
109 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } |
|
109 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } | |
110 | @project.custom_values = @custom_values |
|
110 | @project.custom_values = @custom_values | |
111 | end |
|
111 | end | |
112 | if params[:repository_enabled] |
|
112 | if params[:repository_enabled] | |
113 | case params[:repository_enabled] |
|
113 | case params[:repository_enabled] | |
114 | when "0" |
|
114 | when "0" | |
115 | @project.repository = nil |
|
115 | @project.repository = nil | |
116 | when "1" |
|
116 | when "1" | |
117 | @project.repository ||= Repository.new |
|
117 | @project.repository ||= Repository.new | |
118 | @project.repository.update_attributes params[:repository] |
|
118 | @project.repository.update_attributes params[:repository] | |
119 | end |
|
119 | end | |
120 | end |
|
120 | end | |
121 | if params[:wiki_enabled] |
|
121 | if params[:wiki_enabled] | |
122 | case params[:wiki_enabled] |
|
122 | case params[:wiki_enabled] | |
123 | when "0" |
|
123 | when "0" | |
124 | @project.wiki.destroy if @project.wiki |
|
124 | @project.wiki.destroy if @project.wiki | |
125 | when "1" |
|
125 | when "1" | |
126 | @project.wiki ||= Wiki.new |
|
126 | @project.wiki ||= Wiki.new | |
127 | @project.wiki.update_attributes params[:wiki] |
|
127 | @project.wiki.update_attributes params[:wiki] | |
128 | end |
|
128 | end | |
129 | end |
|
129 | end | |
130 | @project.attributes = params[:project] |
|
130 | @project.attributes = params[:project] | |
131 | if @project.save |
|
131 | if @project.save | |
132 | flash[:notice] = l(:notice_successful_update) |
|
132 | flash[:notice] = l(:notice_successful_update) | |
133 | redirect_to :action => 'settings', :id => @project |
|
133 | redirect_to :action => 'settings', :id => @project | |
134 | else |
|
134 | else | |
135 | settings |
|
135 | settings | |
136 | render :action => 'settings' |
|
136 | render :action => 'settings' | |
137 | end |
|
137 | end | |
138 | end |
|
138 | end | |
139 | end |
|
139 | end | |
140 |
|
140 | |||
141 | # Delete @project |
|
141 | # Delete @project | |
142 | def destroy |
|
142 | def destroy | |
143 | if request.post? and params[:confirm] |
|
143 | if request.post? and params[:confirm] | |
144 | @project.destroy |
|
144 | @project.destroy | |
145 | redirect_to :controller => 'admin', :action => 'projects' |
|
145 | redirect_to :controller => 'admin', :action => 'projects' | |
146 | end |
|
146 | end | |
147 | end |
|
147 | end | |
148 |
|
148 | |||
149 | # Add a new issue category to @project |
|
149 | # Add a new issue category to @project | |
150 | def add_issue_category |
|
150 | def add_issue_category | |
151 | if request.post? |
|
151 | if request.post? | |
152 | @issue_category = @project.issue_categories.build(params[:issue_category]) |
|
152 | @issue_category = @project.issue_categories.build(params[:issue_category]) | |
153 | if @issue_category.save |
|
153 | if @issue_category.save | |
154 | flash[:notice] = l(:notice_successful_create) |
|
154 | flash[:notice] = l(:notice_successful_create) | |
155 | redirect_to :action => 'settings', :tab => 'categories', :id => @project |
|
155 | redirect_to :action => 'settings', :tab => 'categories', :id => @project | |
156 | else |
|
156 | else | |
157 | settings |
|
157 | settings | |
158 | render :action => 'settings' |
|
158 | render :action => 'settings' | |
159 | end |
|
159 | end | |
160 | end |
|
160 | end | |
161 | end |
|
161 | end | |
162 |
|
162 | |||
163 | # Add a new version to @project |
|
163 | # Add a new version to @project | |
164 | def add_version |
|
164 | def add_version | |
165 | @version = @project.versions.build(params[:version]) |
|
165 | @version = @project.versions.build(params[:version]) | |
166 | if request.post? and @version.save |
|
166 | if request.post? and @version.save | |
167 | flash[:notice] = l(:notice_successful_create) |
|
167 | flash[:notice] = l(:notice_successful_create) | |
168 | redirect_to :action => 'settings', :tab => 'versions', :id => @project |
|
168 | redirect_to :action => 'settings', :tab => 'versions', :id => @project | |
169 | end |
|
169 | end | |
170 | end |
|
170 | end | |
171 |
|
171 | |||
172 | # Add a new member to @project |
|
172 | # Add a new member to @project | |
173 | def add_member |
|
173 | def add_member | |
174 | @member = @project.members.build(params[:member]) |
|
174 | @member = @project.members.build(params[:member]) | |
175 | if request.post? |
|
175 | if request.post? | |
176 | if @member.save |
|
176 | if @member.save | |
177 | flash[:notice] = l(:notice_successful_create) |
|
177 | flash[:notice] = l(:notice_successful_create) | |
178 | redirect_to :action => 'settings', :tab => 'members', :id => @project |
|
178 | redirect_to :action => 'settings', :tab => 'members', :id => @project | |
179 | else |
|
179 | else | |
180 | settings |
|
180 | settings | |
181 | render :action => 'settings' |
|
181 | render :action => 'settings' | |
182 | end |
|
182 | end | |
183 | end |
|
183 | end | |
184 | end |
|
184 | end | |
185 |
|
185 | |||
186 | # Show members list of @project |
|
186 | # Show members list of @project | |
187 | def list_members |
|
187 | def list_members | |
188 | @members = @project.members.find(:all) |
|
188 | @members = @project.members.find(:all) | |
189 | end |
|
189 | end | |
190 |
|
190 | |||
191 | # Add a new document to @project |
|
191 | # Add a new document to @project | |
192 | def add_document |
|
192 | def add_document | |
193 | @categories = Enumeration::get_values('DCAT') |
|
193 | @categories = Enumeration::get_values('DCAT') | |
194 | @document = @project.documents.build(params[:document]) |
|
194 | @document = @project.documents.build(params[:document]) | |
195 | if request.post? and @document.save |
|
195 | if request.post? and @document.save | |
196 | # Save the attachments |
|
196 | # Save the attachments | |
197 | params[:attachments].each { |a| |
|
197 | params[:attachments].each { |a| | |
198 | Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0 |
|
198 | Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0 | |
199 | } if params[:attachments] and params[:attachments].is_a? Array |
|
199 | } if params[:attachments] and params[:attachments].is_a? Array | |
200 | flash[:notice] = l(:notice_successful_create) |
|
200 | flash[:notice] = l(:notice_successful_create) | |
201 | Mailer.deliver_document_add(@document) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? |
|
201 | Mailer.deliver_document_add(@document) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? | |
202 | redirect_to :action => 'list_documents', :id => @project |
|
202 | redirect_to :action => 'list_documents', :id => @project | |
203 | end |
|
203 | end | |
204 | end |
|
204 | end | |
205 |
|
205 | |||
206 | # Show documents list of @project |
|
206 | # Show documents list of @project | |
207 | def list_documents |
|
207 | def list_documents | |
208 | @documents = @project.documents.find :all, :include => :category |
|
208 | @documents = @project.documents.find :all, :include => :category | |
209 | end |
|
209 | end | |
210 |
|
210 | |||
211 | # Add a new issue to @project |
|
211 | # Add a new issue to @project | |
212 | def add_issue |
|
212 | def add_issue | |
213 | @tracker = Tracker.find(params[:tracker_id]) |
|
213 | @tracker = Tracker.find(params[:tracker_id]) | |
214 | @priorities = Enumeration::get_values('IPRI') |
|
214 | @priorities = Enumeration::get_values('IPRI') | |
215 |
|
215 | |||
216 | default_status = IssueStatus.default |
|
216 | default_status = IssueStatus.default | |
217 | @issue = Issue.new(:project => @project, :tracker => @tracker) |
|
217 | @issue = Issue.new(:project => @project, :tracker => @tracker) | |
218 | @issue.status = default_status |
|
218 | @issue.status = default_status | |
219 | @allowed_statuses = default_status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker) if logged_in_user |
|
219 | @allowed_statuses = default_status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker) if logged_in_user | |
220 | if request.get? |
|
220 | if request.get? | |
221 | @issue.start_date = Date.today |
|
221 | @issue.start_date = Date.today | |
222 | @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) } |
|
222 | @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) } | |
223 | else |
|
223 | else | |
224 | @issue.attributes = params[:issue] |
|
224 | @issue.attributes = params[:issue] | |
225 |
|
225 | |||
226 | requested_status = IssueStatus.find_by_id(params[:issue][:status_id]) |
|
226 | requested_status = IssueStatus.find_by_id(params[:issue][:status_id]) | |
227 | @issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status |
|
227 | @issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status | |
228 |
|
228 | |||
229 | @issue.author_id = self.logged_in_user.id if self.logged_in_user |
|
229 | @issue.author_id = self.logged_in_user.id if self.logged_in_user | |
230 | # Multiple file upload |
|
230 | # Multiple file upload | |
231 | @attachments = [] |
|
231 | @attachments = [] | |
232 | params[:attachments].each { |a| |
|
232 | params[:attachments].each { |a| | |
233 | @attachments << Attachment.new(:container => @issue, :file => a, :author => logged_in_user) unless a.size == 0 |
|
233 | @attachments << Attachment.new(:container => @issue, :file => a, :author => logged_in_user) unless a.size == 0 | |
234 | } if params[:attachments] and params[:attachments].is_a? Array |
|
234 | } if params[:attachments] and params[:attachments].is_a? Array | |
235 | @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]) } |
|
235 | @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]) } | |
236 | @issue.custom_values = @custom_values |
|
236 | @issue.custom_values = @custom_values | |
237 | if @issue.save |
|
237 | if @issue.save | |
238 | @attachments.each(&:save) |
|
238 | @attachments.each(&:save) | |
239 | flash[:notice] = l(:notice_successful_create) |
|
239 | flash[:notice] = l(:notice_successful_create) | |
240 | Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? |
|
240 | Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? | |
241 | redirect_to :action => 'list_issues', :id => @project |
|
241 | redirect_to :action => 'list_issues', :id => @project | |
242 | end |
|
242 | end | |
243 | end |
|
243 | end | |
244 | end |
|
244 | end | |
245 |
|
245 | |||
246 | # Show filtered/sorted issues list of @project |
|
246 | # Show filtered/sorted issues list of @project | |
247 | def list_issues |
|
247 | def list_issues | |
248 | sort_init "#{Issue.table_name}.id", "desc" |
|
248 | sort_init "#{Issue.table_name}.id", "desc" | |
249 | sort_update |
|
249 | sort_update | |
250 |
|
250 | |||
251 | retrieve_query |
|
251 | retrieve_query | |
252 |
|
252 | |||
253 | @results_per_page_options = [ 15, 25, 50, 100 ] |
|
253 | @results_per_page_options = [ 15, 25, 50, 100 ] | |
254 | if params[:per_page] and @results_per_page_options.include? params[:per_page].to_i |
|
254 | if params[:per_page] and @results_per_page_options.include? params[:per_page].to_i | |
255 | @results_per_page = params[:per_page].to_i |
|
255 | @results_per_page = params[:per_page].to_i | |
256 | session[:results_per_page] = @results_per_page |
|
256 | session[:results_per_page] = @results_per_page | |
257 | else |
|
257 | else | |
258 | @results_per_page = session[:results_per_page] || 25 |
|
258 | @results_per_page = session[:results_per_page] || 25 | |
259 | end |
|
259 | end | |
260 |
|
260 | |||
261 | if @query.valid? |
|
261 | if @query.valid? | |
262 | @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement) |
|
262 | @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement) | |
263 | @issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page'] |
|
263 | @issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page'] | |
264 | @issues = Issue.find :all, :order => sort_clause, |
|
264 | @issues = Issue.find :all, :order => sort_clause, | |
265 | :include => [ :assigned_to, :status, :tracker, :project, :priority ], |
|
265 | :include => [ :assigned_to, :status, :tracker, :project, :priority ], | |
266 | :conditions => @query.statement, |
|
266 | :conditions => @query.statement, | |
267 | :limit => @issue_pages.items_per_page, |
|
267 | :limit => @issue_pages.items_per_page, | |
268 | :offset => @issue_pages.current.offset |
|
268 | :offset => @issue_pages.current.offset | |
269 | end |
|
269 | end | |
270 | @trackers = Tracker.find :all, :order => 'position' |
|
270 | @trackers = Tracker.find :all, :order => 'position' | |
271 | render :layout => false if request.xhr? |
|
271 | render :layout => false if request.xhr? | |
272 | end |
|
272 | end | |
273 |
|
273 | |||
274 | # Export filtered/sorted issues list to CSV |
|
274 | # Export filtered/sorted issues list to CSV | |
275 | def export_issues_csv |
|
275 | def export_issues_csv | |
276 | sort_init "#{Issue.table_name}.id", "desc" |
|
276 | sort_init "#{Issue.table_name}.id", "desc" | |
277 | sort_update |
|
277 | sort_update | |
278 |
|
278 | |||
279 | retrieve_query |
|
279 | retrieve_query | |
280 | render :action => 'list_issues' and return unless @query.valid? |
|
280 | render :action => 'list_issues' and return unless @query.valid? | |
281 |
|
281 | |||
282 | @issues = Issue.find :all, :order => sort_clause, |
|
282 | @issues = Issue.find :all, :order => sort_clause, | |
283 | :include => [ :assigned_to, :author, :status, :tracker, :priority, {:custom_values => :custom_field} ], |
|
283 | :include => [ :assigned_to, :author, :status, :tracker, :priority, {:custom_values => :custom_field} ], | |
284 | :conditions => @query.statement, |
|
284 | :conditions => @query.statement, | |
285 | :limit => Setting.issues_export_limit |
|
285 | :limit => Setting.issues_export_limit | |
286 |
|
286 | |||
287 | ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') |
|
287 | ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') | |
288 | export = StringIO.new |
|
288 | export = StringIO.new | |
289 | CSV::Writer.generate(export, l(:general_csv_separator)) do |csv| |
|
289 | CSV::Writer.generate(export, l(:general_csv_separator)) do |csv| | |
290 | # csv header fields |
|
290 | # csv header fields | |
291 | headers = [ "#", l(:field_status), |
|
291 | headers = [ "#", l(:field_status), | |
292 | l(:field_tracker), |
|
292 | l(:field_tracker), | |
293 | l(:field_priority), |
|
293 | l(:field_priority), | |
294 | l(:field_subject), |
|
294 | l(:field_subject), | |
295 | l(:field_assigned_to), |
|
295 | l(:field_assigned_to), | |
296 | l(:field_author), |
|
296 | l(:field_author), | |
297 | l(:field_start_date), |
|
297 | l(:field_start_date), | |
298 | l(:field_due_date), |
|
298 | l(:field_due_date), | |
299 | l(:field_done_ratio), |
|
299 | l(:field_done_ratio), | |
300 | l(:field_created_on), |
|
300 | l(:field_created_on), | |
301 | l(:field_updated_on) |
|
301 | l(:field_updated_on) | |
302 | ] |
|
302 | ] | |
303 | for custom_field in @project.all_custom_fields |
|
303 | for custom_field in @project.all_custom_fields | |
304 | headers << custom_field.name |
|
304 | headers << custom_field.name | |
305 | end |
|
305 | end | |
306 | csv << headers.collect {|c| ic.iconv(c) } |
|
306 | csv << headers.collect {|c| ic.iconv(c) } | |
307 | # csv lines |
|
307 | # csv lines | |
308 | @issues.each do |issue| |
|
308 | @issues.each do |issue| | |
309 | fields = [issue.id, issue.status.name, |
|
309 | fields = [issue.id, issue.status.name, | |
310 | issue.tracker.name, |
|
310 | issue.tracker.name, | |
311 | issue.priority.name, |
|
311 | issue.priority.name, | |
312 | issue.subject, |
|
312 | issue.subject, | |
313 | (issue.assigned_to ? issue.assigned_to.name : ""), |
|
313 | (issue.assigned_to ? issue.assigned_to.name : ""), | |
314 | issue.author.name, |
|
314 | issue.author.name, | |
315 | issue.start_date ? l_date(issue.start_date) : nil, |
|
315 | issue.start_date ? l_date(issue.start_date) : nil, | |
316 | issue.due_date ? l_date(issue.due_date) : nil, |
|
316 | issue.due_date ? l_date(issue.due_date) : nil, | |
317 | issue.done_ratio, |
|
317 | issue.done_ratio, | |
318 | l_datetime(issue.created_on), |
|
318 | l_datetime(issue.created_on), | |
319 | l_datetime(issue.updated_on) |
|
319 | l_datetime(issue.updated_on) | |
320 | ] |
|
320 | ] | |
321 | for custom_field in @project.all_custom_fields |
|
321 | for custom_field in @project.all_custom_fields | |
322 | fields << (show_value issue.custom_value_for(custom_field)) |
|
322 | fields << (show_value issue.custom_value_for(custom_field)) | |
323 | end |
|
323 | end | |
324 | csv << fields.collect {|c| ic.iconv(c.to_s) } |
|
324 | csv << fields.collect {|c| ic.iconv(c.to_s) } | |
325 | end |
|
325 | end | |
326 | end |
|
326 | end | |
327 | export.rewind |
|
327 | export.rewind | |
328 | send_data(export.read, :type => 'text/csv; header=present', :filename => 'export.csv') |
|
328 | send_data(export.read, :type => 'text/csv; header=present', :filename => 'export.csv') | |
329 | end |
|
329 | end | |
330 |
|
330 | |||
331 | # Export filtered/sorted issues to PDF |
|
331 | # Export filtered/sorted issues to PDF | |
332 | def export_issues_pdf |
|
332 | def export_issues_pdf | |
333 | sort_init "#{Issue.table_name}.id", "desc" |
|
333 | sort_init "#{Issue.table_name}.id", "desc" | |
334 | sort_update |
|
334 | sort_update | |
335 |
|
335 | |||
336 | retrieve_query |
|
336 | retrieve_query | |
337 | render :action => 'list_issues' and return unless @query.valid? |
|
337 | render :action => 'list_issues' and return unless @query.valid? | |
338 |
|
338 | |||
339 | @issues = Issue.find :all, :order => sort_clause, |
|
339 | @issues = Issue.find :all, :order => sort_clause, | |
340 | :include => [ :author, :status, :tracker, :priority ], |
|
340 | :include => [ :author, :status, :tracker, :priority ], | |
341 | :conditions => @query.statement, |
|
341 | :conditions => @query.statement, | |
342 | :limit => Setting.issues_export_limit |
|
342 | :limit => Setting.issues_export_limit | |
343 |
|
343 | |||
344 | @options_for_rfpdf ||= {} |
|
344 | @options_for_rfpdf ||= {} | |
345 | @options_for_rfpdf[:file_name] = "export.pdf" |
|
345 | @options_for_rfpdf[:file_name] = "export.pdf" | |
346 | render :layout => false |
|
346 | render :layout => false | |
347 | end |
|
347 | end | |
348 |
|
348 | |||
349 | def move_issues |
|
349 | def move_issues | |
350 | @issues = @project.issues.find(params[:issue_ids]) if params[:issue_ids] |
|
350 | @issues = @project.issues.find(params[:issue_ids]) if params[:issue_ids] | |
351 | redirect_to :action => 'list_issues', :id => @project and return unless @issues |
|
351 | redirect_to :action => 'list_issues', :id => @project and return unless @issues | |
352 | @projects = [] |
|
352 | @projects = [] | |
353 | # find projects to which the user is allowed to move the issue |
|
353 | # find projects to which the user is allowed to move the issue | |
354 | @logged_in_user.memberships.each {|m| @projects << m.project if Permission.allowed_to_role("projects/move_issues", m.role)} |
|
354 | @logged_in_user.memberships.each {|m| @projects << m.project if Permission.allowed_to_role("projects/move_issues", m.role)} | |
355 | # issue can be moved to any tracker |
|
355 | # issue can be moved to any tracker | |
356 | @trackers = Tracker.find(:all) |
|
356 | @trackers = Tracker.find(:all) | |
357 | if request.post? and params[:new_project_id] and params[:new_tracker_id] |
|
357 | if request.post? and params[:new_project_id] and params[:new_tracker_id] | |
358 | new_project = Project.find(params[:new_project_id]) |
|
358 | new_project = Project.find(params[:new_project_id]) | |
359 | new_tracker = Tracker.find(params[:new_tracker_id]) |
|
359 | new_tracker = Tracker.find(params[:new_tracker_id]) | |
360 | @issues.each { |i| |
|
360 | @issues.each { |i| | |
361 | # project dependent properties |
|
361 | # project dependent properties | |
362 | unless i.project_id == new_project.id |
|
362 | unless i.project_id == new_project.id | |
363 | i.category = nil |
|
363 | i.category = nil | |
364 | i.fixed_version = nil |
|
364 | i.fixed_version = nil | |
365 | end |
|
365 | end | |
366 | # move the issue |
|
366 | # move the issue | |
367 | i.project = new_project |
|
367 | i.project = new_project | |
368 | i.tracker = new_tracker |
|
368 | i.tracker = new_tracker | |
369 | i.save |
|
369 | i.save | |
370 | } |
|
370 | } | |
371 | flash[:notice] = l(:notice_successful_update) |
|
371 | flash[:notice] = l(:notice_successful_update) | |
372 | redirect_to :action => 'list_issues', :id => @project |
|
372 | redirect_to :action => 'list_issues', :id => @project | |
373 | end |
|
373 | end | |
374 | end |
|
374 | end | |
375 |
|
375 | |||
376 | def add_query |
|
376 | def add_query | |
377 | @query = Query.new(params[:query]) |
|
377 | @query = Query.new(params[:query]) | |
378 | @query.project = @project |
|
378 | @query.project = @project | |
379 | @query.user = logged_in_user |
|
379 | @query.user = logged_in_user | |
380 |
|
380 | |||
381 | params[:fields].each do |field| |
|
381 | params[:fields].each do |field| | |
382 | @query.add_filter(field, params[:operators][field], params[:values][field]) |
|
382 | @query.add_filter(field, params[:operators][field], params[:values][field]) | |
383 | end if params[:fields] |
|
383 | end if params[:fields] | |
384 |
|
384 | |||
385 | if request.post? and @query.save |
|
385 | if request.post? and @query.save | |
386 | flash[:notice] = l(:notice_successful_create) |
|
386 | flash[:notice] = l(:notice_successful_create) | |
387 | redirect_to :controller => 'reports', :action => 'issue_report', :id => @project |
|
387 | redirect_to :controller => 'reports', :action => 'issue_report', :id => @project | |
388 | end |
|
388 | end | |
389 | render :layout => false if request.xhr? |
|
389 | render :layout => false if request.xhr? | |
390 | end |
|
390 | end | |
391 |
|
391 | |||
392 | # Add a news to @project |
|
392 | # Add a news to @project | |
393 | def add_news |
|
393 | def add_news | |
394 | @news = News.new(:project => @project) |
|
394 | @news = News.new(:project => @project) | |
395 | if request.post? |
|
395 | if request.post? | |
396 | @news.attributes = params[:news] |
|
396 | @news.attributes = params[:news] | |
397 | @news.author_id = self.logged_in_user.id if self.logged_in_user |
|
397 | @news.author_id = self.logged_in_user.id if self.logged_in_user | |
398 | if @news.save |
|
398 | if @news.save | |
399 | flash[:notice] = l(:notice_successful_create) |
|
399 | flash[:notice] = l(:notice_successful_create) | |
400 | redirect_to :action => 'list_news', :id => @project |
|
400 | redirect_to :action => 'list_news', :id => @project | |
401 | end |
|
401 | end | |
402 | end |
|
402 | end | |
403 | end |
|
403 | end | |
404 |
|
404 | |||
405 | # Show news list of @project |
|
405 | # Show news list of @project | |
406 | def list_news |
|
406 | def list_news | |
407 | @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "#{News.table_name}.created_on DESC" |
|
407 | @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "#{News.table_name}.created_on DESC" | |
408 | render :action => "list_news", :layout => false if request.xhr? |
|
408 | render :action => "list_news", :layout => false if request.xhr? | |
409 | end |
|
409 | end | |
410 |
|
410 | |||
411 | def add_file |
|
411 | def add_file | |
412 | if request.post? |
|
412 | if request.post? | |
413 | @version = @project.versions.find_by_id(params[:version_id]) |
|
413 | @version = @project.versions.find_by_id(params[:version_id]) | |
414 | # Save the attachments |
|
414 | # Save the attachments | |
415 | @attachments = [] |
|
415 | @attachments = [] | |
416 | params[:attachments].each { |file| |
|
416 | params[:attachments].each { |file| | |
417 | next unless file.size > 0 |
|
417 | next unless file.size > 0 | |
418 | a = Attachment.create(:container => @version, :file => file, :author => logged_in_user) |
|
418 | a = Attachment.create(:container => @version, :file => file, :author => logged_in_user) | |
419 | @attachments << a unless a.new_record? |
|
419 | @attachments << a unless a.new_record? | |
420 | } if params[:attachments] and params[:attachments].is_a? Array |
|
420 | } if params[:attachments] and params[:attachments].is_a? Array | |
421 | Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? |
|
421 | Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? | |
422 | redirect_to :controller => 'projects', :action => 'list_files', :id => @project |
|
422 | redirect_to :controller => 'projects', :action => 'list_files', :id => @project | |
423 | end |
|
423 | end | |
424 | @versions = @project.versions |
|
424 | @versions = @project.versions | |
425 | end |
|
425 | end | |
426 |
|
426 | |||
427 | def list_files |
|
427 | def list_files | |
428 | @versions = @project.versions |
|
428 | @versions = @project.versions | |
429 | end |
|
429 | end | |
430 |
|
430 | |||
431 | # Show changelog for @project |
|
431 | # Show changelog for @project | |
432 | def changelog |
|
432 | def changelog | |
433 | @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position') |
|
433 | @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position') | |
434 | retrieve_selected_tracker_ids(@trackers) |
|
434 | retrieve_selected_tracker_ids(@trackers) | |
435 |
|
435 | |||
436 | @fixed_issues = @project.issues.find(:all, |
|
436 | @fixed_issues = @project.issues.find(:all, | |
437 | :include => [ :fixed_version, :status, :tracker ], |
|
437 | :include => [ :fixed_version, :status, :tracker ], | |
438 | :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], |
|
438 | :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], | |
439 | :order => "#{Version.table_name}.effective_date DESC, #{Issue.table_name}.id DESC" |
|
439 | :order => "#{Version.table_name}.effective_date DESC, #{Issue.table_name}.id DESC" | |
440 | ) unless @selected_tracker_ids.empty? |
|
440 | ) unless @selected_tracker_ids.empty? | |
441 | @fixed_issues ||= [] |
|
441 | @fixed_issues ||= [] | |
442 | end |
|
442 | end | |
443 |
|
443 | |||
444 | def roadmap |
|
444 | def roadmap | |
445 | @trackers = Tracker.find(:all, :conditions => ["is_in_roadmap=?", true], :order => 'position') |
|
445 | @trackers = Tracker.find(:all, :conditions => ["is_in_roadmap=?", true], :order => 'position') | |
446 | retrieve_selected_tracker_ids(@trackers) |
|
446 | retrieve_selected_tracker_ids(@trackers) | |
447 |
|
447 | |||
448 | @versions = @project.versions.find(:all, |
|
448 | @versions = @project.versions.find(:all, | |
449 | :conditions => [ "#{Version.table_name}.effective_date>?", Date.today], |
|
449 | :conditions => [ "#{Version.table_name}.effective_date>?", Date.today], | |
450 | :order => "#{Version.table_name}.effective_date ASC" |
|
450 | :order => "#{Version.table_name}.effective_date ASC" | |
451 | ) |
|
451 | ) | |
452 | end |
|
452 | end | |
453 |
|
453 | |||
454 | def activity |
|
454 | def activity | |
455 | if params[:year] and params[:year].to_i > 1900 |
|
455 | if params[:year] and params[:year].to_i > 1900 | |
456 | @year = params[:year].to_i |
|
456 | @year = params[:year].to_i | |
457 | if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 |
|
457 | if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 | |
458 | @month = params[:month].to_i |
|
458 | @month = params[:month].to_i | |
459 | end |
|
459 | end | |
460 | end |
|
460 | end | |
461 | @year ||= Date.today.year |
|
461 | @year ||= Date.today.year | |
462 | @month ||= Date.today.month |
|
462 | @month ||= Date.today.month | |
463 |
|
463 | |||
464 | @date_from = Date.civil(@year, @month, 1) |
|
464 | @date_from = Date.civil(@year, @month, 1) | |
465 | @date_to = (@date_from >> 1)-1 |
|
465 | @date_to = (@date_from >> 1)-1 | |
466 |
|
466 | |||
467 | @events_by_day = {} |
|
467 | @events_by_day = {} | |
468 |
|
468 | |||
469 | unless params[:show_issues] == "0" |
|
469 | unless params[:show_issues] == "0" | |
470 |
@project.issues.find(:all, :include => [:author |
|
470 | @project.issues.find(:all, :include => [:author], :conditions => ["#{Issue.table_name}.created_on>=? and #{Issue.table_name}.created_on<=?", @date_from, @date_to] ).each { |i| | |
471 | @events_by_day[i.created_on.to_date] ||= [] |
|
471 | @events_by_day[i.created_on.to_date] ||= [] | |
472 | @events_by_day[i.created_on.to_date] << i |
|
472 | @events_by_day[i.created_on.to_date] << i | |
473 | } |
|
473 | } | |
474 | @show_issues = 1 |
|
474 | @show_issues = 1 | |
475 | end |
|
475 | end | |
476 |
|
476 | |||
477 | unless params[:show_news] == "0" |
|
477 | unless params[:show_news] == "0" | |
478 | @project.news.find(:all, :conditions => ["#{News.table_name}.created_on>=? and #{News.table_name}.created_on<=?", @date_from, @date_to], :include => :author ).each { |i| |
|
478 | @project.news.find(:all, :conditions => ["#{News.table_name}.created_on>=? and #{News.table_name}.created_on<=?", @date_from, @date_to], :include => :author ).each { |i| | |
479 | @events_by_day[i.created_on.to_date] ||= [] |
|
479 | @events_by_day[i.created_on.to_date] ||= [] | |
480 | @events_by_day[i.created_on.to_date] << i |
|
480 | @events_by_day[i.created_on.to_date] << i | |
481 | } |
|
481 | } | |
482 | @show_news = 1 |
|
482 | @show_news = 1 | |
483 | end |
|
483 | end | |
484 |
|
484 | |||
485 | unless params[:show_files] == "0" |
|
485 | unless params[:show_files] == "0" | |
486 | 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| |
|
486 | 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| | |
487 | @events_by_day[i.created_on.to_date] ||= [] |
|
487 | @events_by_day[i.created_on.to_date] ||= [] | |
488 | @events_by_day[i.created_on.to_date] << i |
|
488 | @events_by_day[i.created_on.to_date] << i | |
489 | } |
|
489 | } | |
490 | @show_files = 1 |
|
490 | @show_files = 1 | |
491 | end |
|
491 | end | |
492 |
|
492 | |||
493 | unless params[:show_documents] == "0" |
|
493 | unless params[:show_documents] == "0" | |
494 | @project.documents.find(:all, :conditions => ["#{Document.table_name}.created_on>=? and #{Document.table_name}.created_on<=?", @date_from, @date_to] ).each { |i| |
|
494 | @project.documents.find(:all, :conditions => ["#{Document.table_name}.created_on>=? and #{Document.table_name}.created_on<=?", @date_from, @date_to] ).each { |i| | |
495 | @events_by_day[i.created_on.to_date] ||= [] |
|
495 | @events_by_day[i.created_on.to_date] ||= [] | |
496 | @events_by_day[i.created_on.to_date] << i |
|
496 | @events_by_day[i.created_on.to_date] << i | |
497 | } |
|
497 | } | |
498 | 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| |
|
498 | 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| | |
499 | @events_by_day[i.created_on.to_date] ||= [] |
|
499 | @events_by_day[i.created_on.to_date] ||= [] | |
500 | @events_by_day[i.created_on.to_date] << i |
|
500 | @events_by_day[i.created_on.to_date] << i | |
501 | } |
|
501 | } | |
502 | @show_documents = 1 |
|
502 | @show_documents = 1 | |
503 | end |
|
503 | end | |
504 |
|
504 | |||
505 | unless params[:show_wiki_edits] == "0" |
|
505 | unless params[:show_wiki_edits] == "0" | |
506 | select = "#{WikiContent.versioned_table_name}.updated_on, #{WikiContent.versioned_table_name}.comment, " + |
|
506 | select = "#{WikiContent.versioned_table_name}.updated_on, #{WikiContent.versioned_table_name}.comment, " + | |
507 | "#{WikiContent.versioned_table_name}.#{WikiContent.version_column}, #{WikiPage.table_name}.title" |
|
507 | "#{WikiContent.versioned_table_name}.#{WikiContent.version_column}, #{WikiPage.table_name}.title" | |
508 | joins = "LEFT JOIN #{WikiPage.table_name} ON #{WikiPage.table_name}.id = #{WikiContent.versioned_table_name}.page_id " + |
|
508 | joins = "LEFT JOIN #{WikiPage.table_name} ON #{WikiPage.table_name}.id = #{WikiContent.versioned_table_name}.page_id " + | |
509 | "LEFT JOIN #{Wiki.table_name} ON #{Wiki.table_name}.id = #{WikiPage.table_name}.wiki_id " |
|
509 | "LEFT JOIN #{Wiki.table_name} ON #{Wiki.table_name}.id = #{WikiPage.table_name}.wiki_id " | |
510 | conditions = ["#{Wiki.table_name}.project_id = ? AND #{WikiContent.versioned_table_name}.updated_on BETWEEN ? AND ?", |
|
510 | conditions = ["#{Wiki.table_name}.project_id = ? AND #{WikiContent.versioned_table_name}.updated_on BETWEEN ? AND ?", | |
511 | @project.id, @date_from, @date_to] |
|
511 | @project.id, @date_from, @date_to] | |
512 |
|
512 | |||
513 | WikiContent.versioned_class.find(:all, :select => select, :joins => joins, :conditions => conditions).each { |i| |
|
513 | WikiContent.versioned_class.find(:all, :select => select, :joins => joins, :conditions => conditions).each { |i| | |
514 | # We provide this alias so all events can be treated in the same manner |
|
514 | # We provide this alias so all events can be treated in the same manner | |
515 | def i.created_on |
|
515 | def i.created_on | |
516 | self.updated_on |
|
516 | self.updated_on | |
517 | end |
|
517 | end | |
518 |
|
518 | |||
519 | @events_by_day[i.created_on.to_date] ||= [] |
|
519 | @events_by_day[i.created_on.to_date] ||= [] | |
520 | @events_by_day[i.created_on.to_date] << i |
|
520 | @events_by_day[i.created_on.to_date] << i | |
521 | } |
|
521 | } | |
522 | @show_wiki_edits = 1 |
|
522 | @show_wiki_edits = 1 | |
523 | end |
|
523 | end | |
524 |
|
524 | |||
525 | unless @project.repository.nil? || params[:show_changesets] == "0" |
|
525 | unless @project.repository.nil? || params[:show_changesets] == "0" | |
526 | @project.repository.changesets.find(:all, :conditions => ["#{Changeset.table_name}.committed_on BETWEEN ? AND ?", @date_from, @date_to]).each { |i| |
|
526 | @project.repository.changesets.find(:all, :conditions => ["#{Changeset.table_name}.committed_on BETWEEN ? AND ?", @date_from, @date_to]).each { |i| | |
527 | def i.created_on |
|
527 | def i.created_on | |
528 | self.committed_on |
|
528 | self.committed_on | |
529 | end |
|
529 | end | |
530 | @events_by_day[i.created_on.to_date] ||= [] |
|
530 | @events_by_day[i.created_on.to_date] ||= [] | |
531 | @events_by_day[i.created_on.to_date] << i |
|
531 | @events_by_day[i.created_on.to_date] << i | |
532 | } |
|
532 | } | |
533 | @show_changesets = 1 |
|
533 | @show_changesets = 1 | |
534 | end |
|
534 | end | |
535 |
|
535 | |||
536 | render :layout => false if request.xhr? |
|
536 | render :layout => false if request.xhr? | |
537 | end |
|
537 | end | |
538 |
|
538 | |||
539 | def calendar |
|
539 | def calendar | |
540 | @trackers = Tracker.find(:all, :order => 'position') |
|
540 | @trackers = Tracker.find(:all, :order => 'position') | |
541 | retrieve_selected_tracker_ids(@trackers) |
|
541 | retrieve_selected_tracker_ids(@trackers) | |
542 |
|
542 | |||
543 | if params[:year] and params[:year].to_i > 1900 |
|
543 | if params[:year] and params[:year].to_i > 1900 | |
544 | @year = params[:year].to_i |
|
544 | @year = params[:year].to_i | |
545 | if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 |
|
545 | if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 | |
546 | @month = params[:month].to_i |
|
546 | @month = params[:month].to_i | |
547 | end |
|
547 | end | |
548 | end |
|
548 | end | |
549 | @year ||= Date.today.year |
|
549 | @year ||= Date.today.year | |
550 | @month ||= Date.today.month |
|
550 | @month ||= Date.today.month | |
551 |
|
551 | |||
552 | @date_from = Date.civil(@year, @month, 1) |
|
552 | @date_from = Date.civil(@year, @month, 1) | |
553 | @date_to = (@date_from >> 1)-1 |
|
553 | @date_to = (@date_from >> 1)-1 | |
554 | # start on monday |
|
554 | # start on monday | |
555 | @date_from = @date_from - (@date_from.cwday-1) |
|
555 | @date_from = @date_from - (@date_from.cwday-1) | |
556 | # finish on sunday |
|
556 | # finish on sunday | |
557 | @date_to = @date_to + (7-@date_to.cwday) |
|
557 | @date_to = @date_to + (7-@date_to.cwday) | |
558 |
|
558 | |||
559 | @events = [] |
|
559 | @events = [] | |
560 | @project.issues_with_subprojects(params[:with_subprojects]) do |
|
560 | @project.issues_with_subprojects(params[:with_subprojects]) do | |
561 | @events += Issue.find(:all, |
|
561 | @events += Issue.find(:all, | |
562 | :include => [:tracker, :status, :assigned_to, :priority], |
|
562 | :include => [:tracker, :status, :assigned_to, :priority], | |
563 | :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)) and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')})", @date_from, @date_to, @date_from, @date_to] |
|
563 | :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)) and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')})", @date_from, @date_to, @date_from, @date_to] | |
564 | ) unless @selected_tracker_ids.empty? |
|
564 | ) unless @selected_tracker_ids.empty? | |
565 | end |
|
565 | end | |
566 | @events += @project.versions.find(:all, :conditions => ["effective_date BETWEEN ? AND ?", @date_from, @date_to]) |
|
566 | @events += @project.versions.find(:all, :conditions => ["effective_date BETWEEN ? AND ?", @date_from, @date_to]) | |
567 |
|
567 | |||
568 | @ending_events_by_days = @events.group_by {|event| event.due_date} |
|
568 | @ending_events_by_days = @events.group_by {|event| event.due_date} | |
569 | @starting_events_by_days = @events.group_by {|event| event.start_date} |
|
569 | @starting_events_by_days = @events.group_by {|event| event.start_date} | |
570 |
|
570 | |||
571 | render :layout => false if request.xhr? |
|
571 | render :layout => false if request.xhr? | |
572 | end |
|
572 | end | |
573 |
|
573 | |||
574 | def gantt |
|
574 | def gantt | |
575 | @trackers = Tracker.find(:all, :order => 'position') |
|
575 | @trackers = Tracker.find(:all, :order => 'position') | |
576 | retrieve_selected_tracker_ids(@trackers) |
|
576 | retrieve_selected_tracker_ids(@trackers) | |
577 |
|
577 | |||
578 | if params[:year] and params[:year].to_i >0 |
|
578 | if params[:year] and params[:year].to_i >0 | |
579 | @year_from = params[:year].to_i |
|
579 | @year_from = params[:year].to_i | |
580 | if params[:month] and params[:month].to_i >=1 and params[:month].to_i <= 12 |
|
580 | if params[:month] and params[:month].to_i >=1 and params[:month].to_i <= 12 | |
581 | @month_from = params[:month].to_i |
|
581 | @month_from = params[:month].to_i | |
582 | else |
|
582 | else | |
583 | @month_from = 1 |
|
583 | @month_from = 1 | |
584 | end |
|
584 | end | |
585 | else |
|
585 | else | |
586 | @month_from ||= (Date.today << 1).month |
|
586 | @month_from ||= (Date.today << 1).month | |
587 | @year_from ||= (Date.today << 1).year |
|
587 | @year_from ||= (Date.today << 1).year | |
588 | end |
|
588 | end | |
589 |
|
589 | |||
590 | @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2 |
|
590 | @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2 | |
591 | @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6 |
|
591 | @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6 | |
592 |
|
592 | |||
593 | @date_from = Date.civil(@year_from, @month_from, 1) |
|
593 | @date_from = Date.civil(@year_from, @month_from, 1) | |
594 | @date_to = (@date_from >> @months) - 1 |
|
594 | @date_to = (@date_from >> @months) - 1 | |
595 |
|
595 | |||
596 | @events = [] |
|
596 | @events = [] | |
597 | @project.issues_with_subprojects(params[:with_subprojects]) do |
|
597 | @project.issues_with_subprojects(params[:with_subprojects]) do | |
598 | @events += Issue.find(:all, |
|
598 | @events += Issue.find(:all, | |
599 | :order => "start_date, due_date", |
|
599 | :order => "start_date, due_date", | |
600 | :include => [:tracker, :status, :assigned_to, :priority], |
|
600 | :include => [:tracker, :status, :assigned_to, :priority], | |
601 | :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 and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to] |
|
601 | :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 and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to] | |
602 | ) unless @selected_tracker_ids.empty? |
|
602 | ) unless @selected_tracker_ids.empty? | |
603 | end |
|
603 | end | |
604 | @events += @project.versions.find(:all, :conditions => ["effective_date BETWEEN ? AND ?", @date_from, @date_to]) |
|
604 | @events += @project.versions.find(:all, :conditions => ["effective_date BETWEEN ? AND ?", @date_from, @date_to]) | |
605 | @events.sort! {|x,y| x.start_date <=> y.start_date } |
|
605 | @events.sort! {|x,y| x.start_date <=> y.start_date } | |
606 |
|
606 | |||
607 | if params[:output]=='pdf' |
|
607 | if params[:output]=='pdf' | |
608 | @options_for_rfpdf ||= {} |
|
608 | @options_for_rfpdf ||= {} | |
609 | @options_for_rfpdf[:file_name] = "gantt.pdf" |
|
609 | @options_for_rfpdf[:file_name] = "gantt.pdf" | |
610 | render :template => "projects/gantt.rfpdf", :layout => false |
|
610 | render :template => "projects/gantt.rfpdf", :layout => false | |
611 | else |
|
611 | else | |
612 | render :template => "projects/gantt.rhtml" |
|
612 | render :template => "projects/gantt.rhtml" | |
613 | end |
|
613 | end | |
614 | end |
|
614 | end | |
615 |
|
615 | |||
616 | def search |
|
616 | def search | |
617 | @question = params[:q] || "" |
|
617 | @question = params[:q] || "" | |
618 | @question.strip! |
|
618 | @question.strip! | |
619 | @all_words = params[:all_words] || (params[:submit] ? false : true) |
|
619 | @all_words = params[:all_words] || (params[:submit] ? false : true) | |
620 | @scope = params[:scope] || (params[:submit] ? [] : %w(issues changesets news documents wiki) ) |
|
620 | @scope = params[:scope] || (params[:submit] ? [] : %w(issues changesets news documents wiki) ) | |
621 | # tokens must be at least 3 character long |
|
621 | # tokens must be at least 3 character long | |
622 | @tokens = @question.split.uniq.select {|w| w.length > 2 } |
|
622 | @tokens = @question.split.uniq.select {|w| w.length > 2 } | |
623 | if !@tokens.empty? |
|
623 | if !@tokens.empty? | |
624 | # no more than 5 tokens to search for |
|
624 | # no more than 5 tokens to search for | |
625 | @tokens.slice! 5..-1 if @tokens.size > 5 |
|
625 | @tokens.slice! 5..-1 if @tokens.size > 5 | |
626 | # strings used in sql like statement |
|
626 | # strings used in sql like statement | |
627 | like_tokens = @tokens.collect {|w| "%#{w}%"} |
|
627 | like_tokens = @tokens.collect {|w| "%#{w}%"} | |
628 | operator = @all_words ? " AND " : " OR " |
|
628 | operator = @all_words ? " AND " : " OR " | |
629 | limit = 10 |
|
629 | limit = 10 | |
630 | @results = [] |
|
630 | @results = [] | |
631 | @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' |
|
631 | @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' | |
632 | @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' |
|
632 | @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' | |
633 | @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' |
|
633 | @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' | |
634 | @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') |
|
634 | @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') | |
635 | @results += @project.repository.changesets.find(:all, :limit => limit, :conditions => [ (["(LOWER(comment) like ?)"] * like_tokens.size).join(operator), * (like_tokens).sort] ) if @project.repository && @scope.include?('changesets') |
|
635 | @results += @project.repository.changesets.find(:all, :limit => limit, :conditions => [ (["(LOWER(comment) like ?)"] * like_tokens.size).join(operator), * (like_tokens).sort] ) if @project.repository && @scope.include?('changesets') | |
636 | @question = @tokens.join(" ") |
|
636 | @question = @tokens.join(" ") | |
637 | else |
|
637 | else | |
638 | @question = "" |
|
638 | @question = "" | |
639 | end |
|
639 | end | |
640 | end |
|
640 | end | |
641 |
|
641 | |||
642 | def feeds |
|
642 | def feeds | |
643 | @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)] |
|
643 | @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)] | |
644 | @key = logged_in_user.get_or_create_rss_key.value if logged_in_user |
|
644 | @key = logged_in_user.get_or_create_rss_key.value if logged_in_user | |
645 | end |
|
645 | end | |
646 |
|
646 | |||
647 | private |
|
647 | private | |
648 | # Find project of id params[:id] |
|
648 | # Find project of id params[:id] | |
649 | # if not found, redirect to project list |
|
649 | # if not found, redirect to project list | |
650 | # Used as a before_filter |
|
650 | # Used as a before_filter | |
651 | def find_project |
|
651 | def find_project | |
652 | @project = Project.find(params[:id]) |
|
652 | @project = Project.find(params[:id]) | |
653 | @html_title = @project.name |
|
653 | @html_title = @project.name | |
654 | rescue ActiveRecord::RecordNotFound |
|
654 | rescue ActiveRecord::RecordNotFound | |
655 | render_404 |
|
655 | render_404 | |
656 | end |
|
656 | end | |
657 |
|
657 | |||
658 | def retrieve_selected_tracker_ids(selectable_trackers) |
|
658 | def retrieve_selected_tracker_ids(selectable_trackers) | |
659 | if ids = params[:tracker_ids] |
|
659 | if ids = params[:tracker_ids] | |
660 | @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s } |
|
660 | @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s } | |
661 | else |
|
661 | else | |
662 | @selected_tracker_ids = selectable_trackers.collect {|t| t.id.to_s } |
|
662 | @selected_tracker_ids = selectable_trackers.collect {|t| t.id.to_s } | |
663 | end |
|
663 | end | |
664 | end |
|
664 | end | |
665 |
|
665 | |||
666 | # Retrieve query from session or build a new query |
|
666 | # Retrieve query from session or build a new query | |
667 | def retrieve_query |
|
667 | def retrieve_query | |
668 | if params[:query_id] |
|
668 | if params[:query_id] | |
669 | @query = @project.queries.find(params[:query_id]) |
|
669 | @query = @project.queries.find(params[:query_id]) | |
670 | session[:query] = @query |
|
670 | session[:query] = @query | |
671 | else |
|
671 | else | |
672 | if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id |
|
672 | if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id | |
673 | # Give it a name, required to be valid |
|
673 | # Give it a name, required to be valid | |
674 | @query = Query.new(:name => "_") |
|
674 | @query = Query.new(:name => "_") | |
675 | @query.project = @project |
|
675 | @query.project = @project | |
676 | if params[:fields] and params[:fields].is_a? Array |
|
676 | if params[:fields] and params[:fields].is_a? Array | |
677 | params[:fields].each do |field| |
|
677 | params[:fields].each do |field| | |
678 | @query.add_filter(field, params[:operators][field], params[:values][field]) |
|
678 | @query.add_filter(field, params[:operators][field], params[:values][field]) | |
679 | end |
|
679 | end | |
680 | else |
|
680 | else | |
681 | @query.available_filters.keys.each do |field| |
|
681 | @query.available_filters.keys.each do |field| | |
682 | @query.add_short_filter(field, params[field]) if params[field] |
|
682 | @query.add_short_filter(field, params[field]) if params[field] | |
683 | end |
|
683 | end | |
684 | end |
|
684 | end | |
685 | session[:query] = @query |
|
685 | session[:query] = @query | |
686 | else |
|
686 | else | |
687 | @query = session[:query] |
|
687 | @query = session[:query] | |
688 | end |
|
688 | end | |
689 | end |
|
689 | end | |
690 | end |
|
690 | end | |
691 | end |
|
691 | end |
@@ -1,230 +1,234 | |||||
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 | module ApplicationHelper |
|
18 | module ApplicationHelper | |
19 |
|
19 | |||
20 | # Return current logged in user or nil |
|
20 | # Return current logged in user or nil | |
21 | def loggedin? |
|
21 | def loggedin? | |
22 | @logged_in_user |
|
22 | @logged_in_user | |
23 | end |
|
23 | end | |
24 |
|
24 | |||
25 | # Return true if user is logged in and is admin, otherwise false |
|
25 | # Return true if user is logged in and is admin, otherwise false | |
26 | def admin_loggedin? |
|
26 | def admin_loggedin? | |
27 | @logged_in_user and @logged_in_user.admin? |
|
27 | @logged_in_user and @logged_in_user.admin? | |
28 | end |
|
28 | end | |
29 |
|
29 | |||
30 | # Return true if user is authorized for controller/action, otherwise false |
|
30 | # Return true if user is authorized for controller/action, otherwise false | |
31 | def authorize_for(controller, action) |
|
31 | def authorize_for(controller, action) | |
32 | # check if action is allowed on public projects |
|
32 | # check if action is allowed on public projects | |
33 | if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ controller, action ] |
|
33 | if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ controller, action ] | |
34 | return true |
|
34 | return true | |
35 | end |
|
35 | end | |
36 | # check if user is authorized |
|
36 | # check if user is authorized | |
37 | if @logged_in_user and (@logged_in_user.admin? or Permission.allowed_to_role( "%s/%s" % [ controller, action ], @logged_in_user.role_for_project(@project) ) ) |
|
37 | if @logged_in_user and (@logged_in_user.admin? or Permission.allowed_to_role( "%s/%s" % [ controller, action ], @logged_in_user.role_for_project(@project) ) ) | |
38 | return true |
|
38 | return true | |
39 | end |
|
39 | end | |
40 | return false |
|
40 | return false | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
43 | # Display a link if user is authorized |
|
43 | # Display a link if user is authorized | |
44 | def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference) |
|
44 | def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference) | |
45 | link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action]) |
|
45 | link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action]) | |
46 | end |
|
46 | end | |
47 |
|
47 | |||
48 | # Display a link to user's account page |
|
48 | # Display a link to user's account page | |
49 | def link_to_user(user) |
|
49 | def link_to_user(user) | |
50 | link_to user.display_name, :controller => 'account', :action => 'show', :id => user |
|
50 | link_to user.display_name, :controller => 'account', :action => 'show', :id => user | |
51 | end |
|
51 | end | |
52 |
|
52 | |||
|
53 | def link_to_issue(issue) | |||
|
54 | link_to "#{issue.tracker.name} ##{issue.id}", :controller => "issues", :action => "show", :id => issue | |||
|
55 | end | |||
|
56 | ||||
53 | def image_to_function(name, function, html_options = {}) |
|
57 | def image_to_function(name, function, html_options = {}) | |
54 | html_options.symbolize_keys! |
|
58 | html_options.symbolize_keys! | |
55 | tag(:input, html_options.merge({ |
|
59 | tag(:input, html_options.merge({ | |
56 | :type => "image", :src => image_path(name), |
|
60 | :type => "image", :src => image_path(name), | |
57 | :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};" |
|
61 | :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};" | |
58 | })) |
|
62 | })) | |
59 | end |
|
63 | end | |
60 |
|
64 | |||
61 | def format_date(date) |
|
65 | def format_date(date) | |
62 | l_date(date) if date |
|
66 | l_date(date) if date | |
63 | end |
|
67 | end | |
64 |
|
68 | |||
65 | def format_time(time) |
|
69 | def format_time(time) | |
66 | l_datetime((time.is_a? String) ? time.to_time : time) if time |
|
70 | l_datetime((time.is_a? String) ? time.to_time : time) if time | |
67 | end |
|
71 | end | |
68 |
|
72 | |||
69 | def day_name(day) |
|
73 | def day_name(day) | |
70 | l(:general_day_names).split(',')[day-1] |
|
74 | l(:general_day_names).split(',')[day-1] | |
71 | end |
|
75 | end | |
72 |
|
76 | |||
73 | def month_name(month) |
|
77 | def month_name(month) | |
74 | l(:actionview_datehelper_select_month_names).split(',')[month-1] |
|
78 | l(:actionview_datehelper_select_month_names).split(',')[month-1] | |
75 | end |
|
79 | end | |
76 |
|
80 | |||
77 | def pagination_links_full(paginator, options={}, html_options={}) |
|
81 | def pagination_links_full(paginator, options={}, html_options={}) | |
78 | html = '' |
|
82 | html = '' | |
79 | html << link_to_remote(('« ' + l(:label_previous)), |
|
83 | html << link_to_remote(('« ' + l(:label_previous)), | |
80 | {:update => "content", :url => options.merge(:page => paginator.current.previous)}, |
|
84 | {:update => "content", :url => options.merge(:page => paginator.current.previous)}, | |
81 | {:href => url_for(:params => options.merge(:page => paginator.current.previous))}) + ' ' if paginator.current.previous |
|
85 | {:href => url_for(:params => options.merge(:page => paginator.current.previous))}) + ' ' if paginator.current.previous | |
82 |
|
86 | |||
83 | html << (pagination_links_each(paginator, options) do |n| |
|
87 | html << (pagination_links_each(paginator, options) do |n| | |
84 | link_to_remote(n.to_s, |
|
88 | link_to_remote(n.to_s, | |
85 | {:url => {:action => 'list', :params => options.merge(:page => n)}, :update => 'content'}, |
|
89 | {:url => {:action => 'list', :params => options.merge(:page => n)}, :update => 'content'}, | |
86 | {:href => url_for(:params => options.merge(:page => n))}) |
|
90 | {:href => url_for(:params => options.merge(:page => n))}) | |
87 | end || '') |
|
91 | end || '') | |
88 |
|
92 | |||
89 | html << ' ' + link_to_remote((l(:label_next) + ' »'), |
|
93 | html << ' ' + link_to_remote((l(:label_next) + ' »'), | |
90 | {:update => "content", :url => options.merge(:page => paginator.current.next)}, |
|
94 | {:update => "content", :url => options.merge(:page => paginator.current.next)}, | |
91 | {:href => url_for(:params => options.merge(:page => paginator.current.next))}) if paginator.current.next |
|
95 | {:href => url_for(:params => options.merge(:page => paginator.current.next))}) if paginator.current.next | |
92 | html |
|
96 | html | |
93 | end |
|
97 | end | |
94 |
|
98 | |||
95 | # textilize text according to system settings and RedCloth availability |
|
99 | # textilize text according to system settings and RedCloth availability | |
96 | def textilizable(text, options = {}) |
|
100 | def textilizable(text, options = {}) | |
97 | # different methods for formatting wiki links |
|
101 | # different methods for formatting wiki links | |
98 | case options[:wiki_links] |
|
102 | case options[:wiki_links] | |
99 | when :local |
|
103 | when :local | |
100 | # used for local links to html files |
|
104 | # used for local links to html files | |
101 | format_wiki_link = Proc.new {|title| "#{title}.html" } |
|
105 | format_wiki_link = Proc.new {|title| "#{title}.html" } | |
102 | when :anchor |
|
106 | when :anchor | |
103 | # used for single-file wiki export |
|
107 | # used for single-file wiki export | |
104 | format_wiki_link = Proc.new {|title| "##{title}" } |
|
108 | format_wiki_link = Proc.new {|title| "##{title}" } | |
105 | else |
|
109 | else | |
106 | if @project |
|
110 | if @project | |
107 | format_wiki_link = Proc.new {|title| url_for :controller => 'wiki', :action => 'index', :id => @project, :page => title } |
|
111 | format_wiki_link = Proc.new {|title| url_for :controller => 'wiki', :action => 'index', :id => @project, :page => title } | |
108 | else |
|
112 | else | |
109 | format_wiki_link = Proc.new {|title| title } |
|
113 | format_wiki_link = Proc.new {|title| title } | |
110 | end |
|
114 | end | |
111 | end |
|
115 | end | |
112 |
|
116 | |||
113 | # turn wiki links into textile links: |
|
117 | # turn wiki links into textile links: | |
114 | # example: |
|
118 | # example: | |
115 | # [[link]] -> "link":link |
|
119 | # [[link]] -> "link":link | |
116 | # [[link|title]] -> "title":link |
|
120 | # [[link|title]] -> "title":link | |
117 | text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":" + format_wiki_link.call(Wiki.titleize($1)) } |
|
121 | text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":" + format_wiki_link.call(Wiki.titleize($1)) } | |
118 |
|
122 | |||
119 | # turn issue ids to textile links |
|
123 | # turn issue ids to textile links | |
120 | # example: |
|
124 | # example: | |
121 | # #52 -> "#52":/issues/show/52 |
|
125 | # #52 -> "#52":/issues/show/52 | |
122 | text = text.gsub(/#(\d+)(?=\b)/) {|m| "\"##{$1}\":" + url_for(:controller => 'issues', :action => 'show', :id => $1) } |
|
126 | text = text.gsub(/#(\d+)(?=\b)/) {|m| "\"##{$1}\":" + url_for(:controller => 'issues', :action => 'show', :id => $1) } | |
123 |
|
127 | |||
124 | # turn revision ids to textile links (@project needed) |
|
128 | # turn revision ids to textile links (@project needed) | |
125 | # example: |
|
129 | # example: | |
126 | # r52 -> "r52":/repositories/revision/6?rev=52 (@project.id is 6) |
|
130 | # r52 -> "r52":/repositories/revision/6?rev=52 (@project.id is 6) | |
127 | text = text.gsub(/r(\d+)(?=\b)/) {|m| "\"r#{$1}\":" + url_for(:controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1) } if @project |
|
131 | text = text.gsub(/r(\d+)(?=\b)/) {|m| "\"r#{$1}\":" + url_for(:controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1) } if @project | |
128 |
|
132 | |||
129 | # finally textilize text |
|
133 | # finally textilize text | |
130 | @do_textilize ||= (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize") |
|
134 | @do_textilize ||= (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize") | |
131 | text = @do_textilize ? auto_link(RedCloth.new(text).to_html) : simple_format(auto_link(h(text))) |
|
135 | text = @do_textilize ? auto_link(RedCloth.new(text).to_html) : simple_format(auto_link(h(text))) | |
132 | end |
|
136 | end | |
133 |
|
137 | |||
134 | def error_messages_for(object_name, options = {}) |
|
138 | def error_messages_for(object_name, options = {}) | |
135 | options = options.symbolize_keys |
|
139 | options = options.symbolize_keys | |
136 | object = instance_variable_get("@#{object_name}") |
|
140 | object = instance_variable_get("@#{object_name}") | |
137 | if object && !object.errors.empty? |
|
141 | if object && !object.errors.empty? | |
138 | # build full_messages here with controller current language |
|
142 | # build full_messages here with controller current language | |
139 | full_messages = [] |
|
143 | full_messages = [] | |
140 | object.errors.each do |attr, msg| |
|
144 | object.errors.each do |attr, msg| | |
141 | next if msg.nil? |
|
145 | next if msg.nil? | |
142 | msg = msg.first if msg.is_a? Array |
|
146 | msg = msg.first if msg.is_a? Array | |
143 | if attr == "base" |
|
147 | if attr == "base" | |
144 | full_messages << l(msg) |
|
148 | full_messages << l(msg) | |
145 | else |
|
149 | else | |
146 | full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values" |
|
150 | full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values" | |
147 | end |
|
151 | end | |
148 | end |
|
152 | end | |
149 | # retrieve custom values error messages |
|
153 | # retrieve custom values error messages | |
150 | if object.errors[:custom_values] |
|
154 | if object.errors[:custom_values] | |
151 | object.custom_values.each do |v| |
|
155 | object.custom_values.each do |v| | |
152 | v.errors.each do |attr, msg| |
|
156 | v.errors.each do |attr, msg| | |
153 | next if msg.nil? |
|
157 | next if msg.nil? | |
154 | msg = msg.first if msg.is_a? Array |
|
158 | msg = msg.first if msg.is_a? Array | |
155 | full_messages << "« " + v.custom_field.name + " » " + l(msg) |
|
159 | full_messages << "« " + v.custom_field.name + " » " + l(msg) | |
156 | end |
|
160 | end | |
157 | end |
|
161 | end | |
158 | end |
|
162 | end | |
159 | content_tag("div", |
|
163 | content_tag("div", | |
160 | content_tag( |
|
164 | content_tag( | |
161 | options[:header_tag] || "h2", lwr(:gui_validation_error, full_messages.length) + " :" |
|
165 | options[:header_tag] || "h2", lwr(:gui_validation_error, full_messages.length) + " :" | |
162 | ) + |
|
166 | ) + | |
163 | content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }), |
|
167 | content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }), | |
164 | "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation" |
|
168 | "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation" | |
165 | ) |
|
169 | ) | |
166 | else |
|
170 | else | |
167 | "" |
|
171 | "" | |
168 | end |
|
172 | end | |
169 | end |
|
173 | end | |
170 |
|
174 | |||
171 | def lang_options_for_select(blank=true) |
|
175 | def lang_options_for_select(blank=true) | |
172 | (blank ? [["(auto)", ""]] : []) + |
|
176 | (blank ? [["(auto)", ""]] : []) + | |
173 | (GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }).collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]} |
|
177 | (GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }).collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]} | |
174 | end |
|
178 | end | |
175 |
|
179 | |||
176 | def label_tag_for(name, option_tags = nil, options = {}) |
|
180 | def label_tag_for(name, option_tags = nil, options = {}) | |
177 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") |
|
181 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") | |
178 | content_tag("label", label_text) |
|
182 | content_tag("label", label_text) | |
179 | end |
|
183 | end | |
180 |
|
184 | |||
181 | def labelled_tabular_form_for(name, object, options, &proc) |
|
185 | def labelled_tabular_form_for(name, object, options, &proc) | |
182 | options[:html] ||= {} |
|
186 | options[:html] ||= {} | |
183 | options[:html].store :class, "tabular" |
|
187 | options[:html].store :class, "tabular" | |
184 | form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc) |
|
188 | form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc) | |
185 | end |
|
189 | end | |
186 |
|
190 | |||
187 | def check_all_links(form_name) |
|
191 | def check_all_links(form_name) | |
188 | link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") + |
|
192 | link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") + | |
189 | " | " + |
|
193 | " | " + | |
190 | link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") |
|
194 | link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") | |
191 | end |
|
195 | end | |
192 |
|
196 | |||
193 | def calendar_for(field_id) |
|
197 | def calendar_for(field_id) | |
194 | image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) + |
|
198 | image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) + | |
195 | javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });") |
|
199 | javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });") | |
196 | end |
|
200 | end | |
197 | end |
|
201 | end | |
198 |
|
202 | |||
199 | class TabularFormBuilder < ActionView::Helpers::FormBuilder |
|
203 | class TabularFormBuilder < ActionView::Helpers::FormBuilder | |
200 | include GLoc |
|
204 | include GLoc | |
201 |
|
205 | |||
202 | def initialize(object_name, object, template, options, proc) |
|
206 | def initialize(object_name, object, template, options, proc) | |
203 | set_language_if_valid options.delete(:lang) |
|
207 | set_language_if_valid options.delete(:lang) | |
204 | @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc |
|
208 | @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc | |
205 | end |
|
209 | end | |
206 |
|
210 | |||
207 | (field_helpers - %w(radio_button hidden_field) + %w(date_select)).each do |selector| |
|
211 | (field_helpers - %w(radio_button hidden_field) + %w(date_select)).each do |selector| | |
208 | src = <<-END_SRC |
|
212 | src = <<-END_SRC | |
209 | def #{selector}(field, options = {}) |
|
213 | def #{selector}(field, options = {}) | |
210 | return super if options.delete :no_label |
|
214 | return super if options.delete :no_label | |
211 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") |
|
215 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") | |
212 | label = @template.content_tag("label", label_text, |
|
216 | label = @template.content_tag("label", label_text, | |
213 | :class => (@object && @object.errors[field] ? "error" : nil), |
|
217 | :class => (@object && @object.errors[field] ? "error" : nil), | |
214 | :for => (@object_name.to_s + "_" + field.to_s)) |
|
218 | :for => (@object_name.to_s + "_" + field.to_s)) | |
215 | label + super |
|
219 | label + super | |
216 | end |
|
220 | end | |
217 | END_SRC |
|
221 | END_SRC | |
218 | class_eval src, __FILE__, __LINE__ |
|
222 | class_eval src, __FILE__, __LINE__ | |
219 | end |
|
223 | end | |
220 |
|
224 | |||
221 | def select(field, choices, options = {}, html_options = {}) |
|
225 | def select(field, choices, options = {}, html_options = {}) | |
222 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") |
|
226 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") | |
223 | label = @template.content_tag("label", label_text, |
|
227 | label = @template.content_tag("label", label_text, | |
224 | :class => (@object && @object.errors[field] ? "error" : nil), |
|
228 | :class => (@object && @object.errors[field] ? "error" : nil), | |
225 | :for => (@object_name.to_s + "_" + field.to_s)) |
|
229 | :for => (@object_name.to_s + "_" + field.to_s)) | |
226 | label + super |
|
230 | label + super | |
227 | end |
|
231 | end | |
228 |
|
232 | |||
229 | end |
|
233 | end | |
230 |
|
234 |
@@ -1,6 +1,6 | |||||
1 | <%= link_to "#{issue.tracker.name} ##{issue.id}", { :controller => 'issues', :action => 'show', :id => issue } %></strong>: <%=h issue.subject %><br /> |
|
1 | <%= link_to_issue issue %></strong>: <%=h issue.subject %><br /> | |
2 | <br /> |
|
2 | <br /> | |
3 | <strong><%= l(:field_start_date) %></strong>: <%= format_date(issue.start_date) %><br /> |
|
3 | <strong><%= l(:field_start_date) %></strong>: <%= format_date(issue.start_date) %><br /> | |
4 | <strong><%= l(:field_due_date) %></strong>: <%= format_date(issue.due_date) %><br /> |
|
4 | <strong><%= l(:field_due_date) %></strong>: <%= format_date(issue.due_date) %><br /> | |
5 | <strong><%= l(:field_assigned_to) %></strong>: <%= issue.assigned_to ? issue.assigned_to.name : "-" %><br /> |
|
5 | <strong><%= l(:field_assigned_to) %></strong>: <%= issue.assigned_to ? issue.assigned_to.name : "-" %><br /> | |
6 | <strong><%= l(:field_priority) %></strong>: <%= issue.priority.name %> |
|
6 | <strong><%= l(:field_priority) %></strong>: <%= issue.priority.name %> |
@@ -1,47 +1,47 | |||||
1 | <h3><%= l(:label_calendar) %></h3> |
|
1 | <h3><%= l(:label_calendar) %></h3> | |
2 |
|
2 | |||
3 | <% |
|
3 | <% | |
4 | @date_from = Date.today - (Date.today.cwday-1) |
|
4 | @date_from = Date.today - (Date.today.cwday-1) | |
5 | @date_to = Date.today + (7-Date.today.cwday) |
|
5 | @date_to = Date.today + (7-Date.today.cwday) | |
6 | @issues = Issue.find :all, |
|
6 | @issues = Issue.find :all, | |
7 | :conditions => ["#{Issue.table_name}.project_id in (#{@user.projects.collect{|m| m.id}.join(',')}) AND ((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to], |
|
7 | :conditions => ["#{Issue.table_name}.project_id in (#{@user.projects.collect{|m| m.id}.join(',')}) AND ((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to], | |
8 | :include => [:project, :tracker] unless @user.projects.empty? |
|
8 | :include => [:project, :tracker] unless @user.projects.empty? | |
9 | @issues ||= [] |
|
9 | @issues ||= [] | |
10 | %> |
|
10 | %> | |
11 |
|
11 | |||
12 | <table class="list with-cells"> |
|
12 | <table class="list with-cells"> | |
13 | <thead><tr> |
|
13 | <thead><tr> | |
14 | <th></th> |
|
14 | <th></th> | |
15 | <% 1.upto(7) do |d| %> |
|
15 | <% 1.upto(7) do |d| %> | |
16 | <th align="center" width="14%"><%= day_name(d) %></th> |
|
16 | <th align="center" width="14%"><%= day_name(d) %></th> | |
17 | <% end %> |
|
17 | <% end %> | |
18 | </tr></thead> |
|
18 | </tr></thead> | |
19 | <tbdoy> |
|
19 | <tbdoy> | |
20 | <tr height="100"> |
|
20 | <tr height="100"> | |
21 | <% day = @date_from |
|
21 | <% day = @date_from | |
22 | while day <= @date_to |
|
22 | while day <= @date_to | |
23 | if day.cwday == 1 %> |
|
23 | if day.cwday == 1 %> | |
24 | <th valign="middle"><%= day.cweek %></th> |
|
24 | <th valign="middle"><%= day.cweek %></th> | |
25 | <% end %> |
|
25 | <% end %> | |
26 | <td valign="top" width="14%" class="<%= day.month==@month ? "even" : "odd" %>"> |
|
26 | <td valign="top" width="14%" class="<%= day.month==@month ? "even" : "odd" %>"> | |
27 | <p align="right"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p> |
|
27 | <p align="right"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p> | |
28 | <% day_issues = [] |
|
28 | <% day_issues = [] | |
29 | @issues.each { |i| day_issues << i if i.start_date == day or i.due_date == day } |
|
29 | @issues.each { |i| day_issues << i if i.start_date == day or i.due_date == day } | |
30 | day_issues.each do |i| %> |
|
30 | day_issues.each do |i| %> | |
31 | <%= if day == i.start_date and day == i.due_date |
|
31 | <%= if day == i.start_date and day == i.due_date | |
32 | image_tag('arrow_bw.png') |
|
32 | image_tag('arrow_bw.png') | |
33 | elsif day == i.start_date |
|
33 | elsif day == i.start_date | |
34 | image_tag('arrow_from.png') |
|
34 | image_tag('arrow_from.png') | |
35 | elsif day == i.due_date |
|
35 | elsif day == i.due_date | |
36 | image_tag('arrow_to.png') |
|
36 | image_tag('arrow_to.png') | |
37 | end %> |
|
37 | end %> | |
38 |
<small><%= link_to |
|
38 | <small><%= link_to_issue i %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small><br /> | |
39 | <% end %> |
|
39 | <% end %> | |
40 | </td> |
|
40 | </td> | |
41 | <%= '</tr><tr height="100">' if day.cwday >= 7 and day!=@date_to %> |
|
41 | <%= '</tr><tr height="100">' if day.cwday >= 7 and day!=@date_to %> | |
42 | <% |
|
42 | <% | |
43 | day = day + 1 |
|
43 | day = day + 1 | |
44 | end %> |
|
44 | end %> | |
45 | </tr> |
|
45 | </tr> | |
46 | </tbody> |
|
46 | </tbody> | |
47 | </table> No newline at end of file |
|
47 | </table> |
@@ -1,67 +1,67 | |||||
1 | <h2><%=l(:label_activity)%>: <%= "#{month_name(@month).downcase} #{@year}" %></h2> |
|
1 | <h2><%=l(:label_activity)%>: <%= "#{month_name(@month).downcase} #{@year}" %></h2> | |
2 |
|
2 | |||
3 | <div> |
|
3 | <div> | |
4 | <div class="rightbox"> |
|
4 | <div class="rightbox"> | |
5 | <% form_tag do %> |
|
5 | <% form_tag do %> | |
6 | <p><%= select_month(@month, :prefix => "month", :discard_type => true) %> |
|
6 | <p><%= select_month(@month, :prefix => "month", :discard_type => true) %> | |
7 | <%= select_year(@year, :prefix => "year", :discard_type => true) %></p> |
|
7 | <%= select_year(@year, :prefix => "year", :discard_type => true) %></p> | |
8 | <p> |
|
8 | <p> | |
9 | <%= check_box_tag 'show_issues', 1, @show_issues %><%= hidden_field_tag 'show_issues', 0, :id => nil %> <%=l(:label_issue_plural)%><br /> |
|
9 | <%= check_box_tag 'show_issues', 1, @show_issues %><%= hidden_field_tag 'show_issues', 0, :id => nil %> <%=l(:label_issue_plural)%><br /> | |
10 | <% if @project.repository %><%= check_box_tag 'show_changesets', 1, @show_changesets %><%= hidden_field_tag 'show_changesets', 0, :id => nil %> <%=l(:label_revision_plural)%><br /><% end %> |
|
10 | <% if @project.repository %><%= check_box_tag 'show_changesets', 1, @show_changesets %><%= hidden_field_tag 'show_changesets', 0, :id => nil %> <%=l(:label_revision_plural)%><br /><% end %> | |
11 | <%= check_box_tag 'show_news', 1, @show_news %><%= hidden_field_tag 'show_news', 0, :id => nil %> <%=l(:label_news_plural)%><br /> |
|
11 | <%= check_box_tag 'show_news', 1, @show_news %><%= hidden_field_tag 'show_news', 0, :id => nil %> <%=l(:label_news_plural)%><br /> | |
12 | <%= check_box_tag 'show_files', 1, @show_files %><%= hidden_field_tag 'show_files', 0, :id => nil %> <%=l(:label_attachment_plural)%><br /> |
|
12 | <%= check_box_tag 'show_files', 1, @show_files %><%= hidden_field_tag 'show_files', 0, :id => nil %> <%=l(:label_attachment_plural)%><br /> | |
13 | <%= check_box_tag 'show_documents', 1, @show_documents %><%= hidden_field_tag 'show_documents', 0, :id => nil %> <%=l(:label_document_plural)%><br /> |
|
13 | <%= check_box_tag 'show_documents', 1, @show_documents %><%= hidden_field_tag 'show_documents', 0, :id => nil %> <%=l(:label_document_plural)%><br /> | |
14 | <%= check_box_tag 'show_wiki_edits', 1, @show_wiki_edits %><%= hidden_field_tag 'show_wiki_edits', 0, :id => nil %> <%=l(:label_wiki_edit_plural)%> |
|
14 | <%= check_box_tag 'show_wiki_edits', 1, @show_wiki_edits %><%= hidden_field_tag 'show_wiki_edits', 0, :id => nil %> <%=l(:label_wiki_edit_plural)%> | |
15 | </p> |
|
15 | </p> | |
16 | <p class="textcenter"><%= submit_tag l(:button_apply), :class => 'button-small' %></p> |
|
16 | <p class="textcenter"><%= submit_tag l(:button_apply), :class => 'button-small' %></p> | |
17 | <% end %> |
|
17 | <% end %> | |
18 | </div> |
|
18 | </div> | |
19 |
|
19 | |||
20 | <% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %> |
|
20 | <% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %> | |
21 | <h3><%= day_name(day.cwday) %> <%= day.day %></h3> |
|
21 | <h3><%= day_name(day.cwday) %> <%= day.day %></h3> | |
22 | <ul> |
|
22 | <ul> | |
23 | <% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %> |
|
23 | <% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %> | |
24 | <li><p> |
|
24 | <li><p> | |
25 | <% if e.is_a? Issue %> |
|
25 | <% if e.is_a? Issue %> | |
26 |
<%= e.created_on.strftime("%H:%M") %> <%= link_to |
|
26 | <%= e.created_on.strftime("%H:%M") %> <%= link_to_issue e %>: <%=h e.subject %><br /> | |
27 | <i><%= e.author.name %></i> |
|
27 | <i><%= e.author.name %></i> | |
28 | <% elsif e.is_a? News %> |
|
28 | <% elsif e.is_a? News %> | |
29 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_news)%>: <%= link_to h(e.title), :controller => 'news', :action => 'show', :id => e %><br /> |
|
29 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_news)%>: <%= link_to h(e.title), :controller => 'news', :action => 'show', :id => e %><br /> | |
30 | <% unless e.summary.empty? %><%=h e.summary %><br /><% end %> |
|
30 | <% unless e.summary.empty? %><%=h e.summary %><br /><% end %> | |
31 | <i><%= e.author.name %></i> |
|
31 | <i><%= e.author.name %></i> | |
32 | <% elsif (e.is_a? Attachment) and (e.container.is_a? Version) %> |
|
32 | <% elsif (e.is_a? Attachment) and (e.container.is_a? Version) %> | |
33 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_attachment)%> (<%=h e.container.name %>): <%= link_to e.filename, :controller => 'projects', :action => 'list_files', :id => @project %><br /> |
|
33 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_attachment)%> (<%=h e.container.name %>): <%= link_to e.filename, :controller => 'projects', :action => 'list_files', :id => @project %><br /> | |
34 | <i><%= e.author.name %></i> |
|
34 | <i><%= e.author.name %></i> | |
35 | <% elsif (e.is_a? Attachment) and (e.container.is_a? Document) %> |
|
35 | <% elsif (e.is_a? Attachment) and (e.container.is_a? Document) %> | |
36 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_attachment)%>: <%= e.filename %> (<%= link_to h(e.container.title), :controller => 'documents', :action => 'show', :id => e.container %>)<br /> |
|
36 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_attachment)%>: <%= e.filename %> (<%= link_to h(e.container.title), :controller => 'documents', :action => 'show', :id => e.container %>)<br /> | |
37 | <i><%= e.author.name %></i> |
|
37 | <i><%= e.author.name %></i> | |
38 | <% elsif e.is_a? Document %> |
|
38 | <% elsif e.is_a? Document %> | |
39 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_document)%>: <%= link_to h(e.title), :controller => 'documents', :action => 'show', :id => e %><br /> |
|
39 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_document)%>: <%= link_to h(e.title), :controller => 'documents', :action => 'show', :id => e %><br /> | |
40 | <% elsif e.is_a? WikiContent.versioned_class %> |
|
40 | <% elsif e.is_a? WikiContent.versioned_class %> | |
41 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_wiki_edit)%>: <%= link_to h(WikiPage.pretty_title(e.title)), :controller => 'wiki', :page => e.title %> (<%= link_to '#' + e.version.to_s, :controller => 'wiki', :page => e.title, :version => e.version %>)<br /> |
|
41 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_wiki_edit)%>: <%= link_to h(WikiPage.pretty_title(e.title)), :controller => 'wiki', :page => e.title %> (<%= link_to '#' + e.version.to_s, :controller => 'wiki', :page => e.title, :version => e.version %>)<br /> | |
42 | <% unless e.comment.blank? %><em><%=h e.comment %></em><% end %> |
|
42 | <% unless e.comment.blank? %><em><%=h e.comment %></em><% end %> | |
43 | <% elsif e.is_a? Changeset %> |
|
43 | <% elsif e.is_a? Changeset %> | |
44 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_revision)%> <%= link_to h(e.revision), :controller => 'repositories', :action => 'revision', :id => @project, :rev => e.revision %><br /> |
|
44 | <%= e.created_on.strftime("%H:%M") %> <%=l(:label_revision)%> <%= link_to h(e.revision), :controller => 'repositories', :action => 'revision', :id => @project, :rev => e.revision %><br /> | |
45 | <em><%=h e.committer.blank? ? "anonymous" : e.committer %><%= h(": #{e.comment}") unless e.comment.blank? %></em> |
|
45 | <em><%=h e.committer.blank? ? "anonymous" : e.committer %><%= h(": #{e.comment}") unless e.comment.blank? %></em> | |
46 | <% end %> |
|
46 | <% end %> | |
47 | </p></li> |
|
47 | </p></li> | |
48 |
|
48 | |||
49 | <% end %> |
|
49 | <% end %> | |
50 | </ul> |
|
50 | </ul> | |
51 | <% end %> |
|
51 | <% end %> | |
52 | <% if @events_by_day.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %> |
|
52 | <% if @events_by_day.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %> | |
53 |
|
53 | |||
54 | <div style="float:left;"> |
|
54 | <div style="float:left;"> | |
55 | <%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), |
|
55 | <%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), | |
56 | {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }}, |
|
56 | {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }}, | |
57 | {:href => url_for(:action => 'activity', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))} |
|
57 | {:href => url_for(:action => 'activity', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))} | |
58 | %> |
|
58 | %> | |
59 | </div> |
|
59 | </div> | |
60 | <div style="float:right;"> |
|
60 | <div style="float:right;"> | |
61 | <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'), |
|
61 | <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'), | |
62 | {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }}, |
|
62 | {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }}, | |
63 | {:href => url_for(:action => 'activity', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))} |
|
63 | {:href => url_for(:action => 'activity', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))} | |
64 | %> |
|
64 | %> | |
65 | </div> |
|
65 | </div> | |
66 | <br /> |
|
66 | <br /> | |
67 | </div> |
|
67 | </div> |
@@ -1,90 +1,90 | |||||
1 | <h2><%= l(:label_calendar) %></h2> |
|
1 | <h2><%= l(:label_calendar) %></h2> | |
2 |
|
2 | |||
3 | <% form_tag do %> |
|
3 | <% form_tag do %> | |
4 | <table width="100%"> |
|
4 | <table width="100%"> | |
5 | <tr> |
|
5 | <tr> | |
6 | <td align="left" style="width:15%"> |
|
6 | <td align="left" style="width:15%"> | |
7 | <%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), |
|
7 | <%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), | |
8 | {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }}, |
|
8 | {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }}, | |
9 | {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects])} |
|
9 | {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects])} | |
10 | %> |
|
10 | %> | |
11 | </td> |
|
11 | </td> | |
12 | <td align="center" style="width:55%"> |
|
12 | <td align="center" style="width:55%"> | |
13 | <%= select_month(@month, :prefix => "month", :discard_type => true) %> |
|
13 | <%= select_month(@month, :prefix => "month", :discard_type => true) %> | |
14 | <%= select_year(@year, :prefix => "year", :discard_type => true) %> |
|
14 | <%= select_year(@year, :prefix => "year", :discard_type => true) %> | |
15 | <%= submit_tag l(:button_submit), :class => "button-small" %> |
|
15 | <%= submit_tag l(:button_submit), :class => "button-small" %> | |
16 | </td> |
|
16 | </td> | |
17 | <td align="left" style="width:15%"> |
|
17 | <td align="left" style="width:15%"> | |
18 | <a href="#" onclick="Element.toggle('trackerselect')"><%= l(:label_options) %></a> |
|
18 | <a href="#" onclick="Element.toggle('trackerselect')"><%= l(:label_options) %></a> | |
19 | <div id="trackerselect" class="rightbox overlay" style="width:140px; display:none;"> |
|
19 | <div id="trackerselect" class="rightbox overlay" style="width:140px; display:none;"> | |
20 | <p><strong><%=l(:label_tracker_plural)%></strong></p> |
|
20 | <p><strong><%=l(:label_tracker_plural)%></strong></p> | |
21 | <% @trackers.each do |tracker| %> |
|
21 | <% @trackers.each do |tracker| %> | |
22 | <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> |
|
22 | <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> | |
23 | <%= tracker.name %><br /> |
|
23 | <%= tracker.name %><br /> | |
24 | <% end %> |
|
24 | <% end %> | |
25 | <% if @project.children.any? %> |
|
25 | <% if @project.children.any? %> | |
26 | <p><strong><%=l(:label_subproject_plural)%></strong></p> |
|
26 | <p><strong><%=l(:label_subproject_plural)%></strong></p> | |
27 | <%= check_box_tag "with_subprojects", 1, params[:with_subprojects] %> <%= l(:general_text_Yes) %> |
|
27 | <%= check_box_tag "with_subprojects", 1, params[:with_subprojects] %> <%= l(:general_text_Yes) %> | |
28 | <% end %> |
|
28 | <% end %> | |
29 | <p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p> |
|
29 | <p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p> | |
30 | </div> |
|
30 | </div> | |
31 | </td> |
|
31 | </td> | |
32 | <td align="right" style="width:15%"> |
|
32 | <td align="right" style="width:15%"> | |
33 | <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'), |
|
33 | <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'), | |
34 | {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }}, |
|
34 | {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }}, | |
35 | {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects])} |
|
35 | {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects])} | |
36 | %> |
|
36 | %> | |
37 | </td> |
|
37 | </td> | |
38 | </tr> |
|
38 | </tr> | |
39 | </table> |
|
39 | </table> | |
40 | <% end %> |
|
40 | <% end %> | |
41 |
|
41 | |||
42 | <table class="list with-cells"> |
|
42 | <table class="list with-cells"> | |
43 | <thead> |
|
43 | <thead> | |
44 | <tr> |
|
44 | <tr> | |
45 | <th></th> |
|
45 | <th></th> | |
46 | <% 1.upto(7) do |d| %> |
|
46 | <% 1.upto(7) do |d| %> | |
47 | <th style="width:14%"><%= day_name(d) %></th> |
|
47 | <th style="width:14%"><%= day_name(d) %></th> | |
48 | <% end %> |
|
48 | <% end %> | |
49 | </tr> |
|
49 | </tr> | |
50 | </thead> |
|
50 | </thead> | |
51 | <tbody> |
|
51 | <tbody> | |
52 | <tr style="height:100px"> |
|
52 | <tr style="height:100px"> | |
53 | <% day = @date_from |
|
53 | <% day = @date_from | |
54 | while day <= @date_to |
|
54 | while day <= @date_to | |
55 | if day.cwday == 1 %> |
|
55 | if day.cwday == 1 %> | |
56 | <th><%= day.cweek %></th> |
|
56 | <th><%= day.cweek %></th> | |
57 | <% end %> |
|
57 | <% end %> | |
58 | <td valign="top" class="<%= day.month==@month ? "even" : "odd" %>" style="width:14%; <%= Date.today == day ? 'background:#FDFED0;' : '' %>"> |
|
58 | <td valign="top" class="<%= day.month==@month ? "even" : "odd" %>" style="width:14%; <%= Date.today == day ? 'background:#FDFED0;' : '' %>"> | |
59 | <p class="textright"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p> |
|
59 | <p class="textright"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p> | |
60 | <% ((@ending_events_by_days[day] || []) + (@starting_events_by_days[day] || [])).uniq.each do |i| %> |
|
60 | <% ((@ending_events_by_days[day] || []) + (@starting_events_by_days[day] || [])).uniq.each do |i| %> | |
61 | <% if i.is_a? Issue %> |
|
61 | <% if i.is_a? Issue %> | |
62 | <div class="tooltip"> |
|
62 | <div class="tooltip"> | |
63 | <%= if day == i.start_date and day == i.due_date |
|
63 | <%= if day == i.start_date and day == i.due_date | |
64 | image_tag('arrow_bw.png') |
|
64 | image_tag('arrow_bw.png') | |
65 | elsif day == i.start_date |
|
65 | elsif day == i.start_date | |
66 | image_tag('arrow_from.png') |
|
66 | image_tag('arrow_from.png') | |
67 | elsif day == i.due_date |
|
67 | elsif day == i.due_date | |
68 | image_tag('arrow_to.png') |
|
68 | image_tag('arrow_to.png') | |
69 | end %> |
|
69 | end %> | |
70 |
<small><%= link_to |
|
70 | <small><%= link_to_issue i %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small> | |
71 | <span class="tip"> |
|
71 | <span class="tip"> | |
72 | <%= render :partial => "issues/tooltip", :locals => { :issue => i }%> |
|
72 | <%= render :partial => "issues/tooltip", :locals => { :issue => i }%> | |
73 | </span> |
|
73 | </span> | |
74 | </div> |
|
74 | </div> | |
75 | <% else %> |
|
75 | <% else %> | |
76 | <%= image_tag('milestone.png') %> <small><%= "#{l(:label_version)}: #{i.name}" %></small> |
|
76 | <%= image_tag('milestone.png') %> <small><%= "#{l(:label_version)}: #{i.name}" %></small> | |
77 | <% end %> |
|
77 | <% end %> | |
78 | <% end %> |
|
78 | <% end %> | |
79 | </td> |
|
79 | </td> | |
80 | <%= '</tr><tr style="height:100px">' if day.cwday >= 7 and day!=@date_to %> |
|
80 | <%= '</tr><tr style="height:100px">' if day.cwday >= 7 and day!=@date_to %> | |
81 | <% |
|
81 | <% | |
82 | day = day + 1 |
|
82 | day = day + 1 | |
83 | end %> |
|
83 | end %> | |
84 | </tr> |
|
84 | </tr> | |
85 | </tbody> |
|
85 | </tbody> | |
86 | </table> |
|
86 | </table> | |
87 |
|
87 | |||
88 | <%= image_tag 'arrow_from.png' %> <%= l(:text_tip_task_begin_day) %><br /> |
|
88 | <%= image_tag 'arrow_from.png' %> <%= l(:text_tip_task_begin_day) %><br /> | |
89 | <%= image_tag 'arrow_to.png' %> <%= l(:text_tip_task_end_day) %><br /> |
|
89 | <%= image_tag 'arrow_to.png' %> <%= l(:text_tip_task_end_day) %><br /> | |
90 | <%= image_tag 'arrow_bw.png' %> <%= l(:text_tip_task_begin_end_day) %><br /> No newline at end of file |
|
90 | <%= image_tag 'arrow_bw.png' %> <%= l(:text_tip_task_begin_end_day) %><br /> |
@@ -1,30 +1,30 | |||||
1 | <h2><%=l(:label_change_log)%></h2> |
|
1 | <h2><%=l(:label_change_log)%></h2> | |
2 |
|
2 | |||
3 | <div> |
|
3 | <div> | |
4 |
|
4 | |||
5 | <div class="rightbox" style="width:140px;"> |
|
5 | <div class="rightbox" style="width:140px;"> | |
6 | <% form_tag do %> |
|
6 | <% form_tag do %> | |
7 | <p><strong><%=l(:label_tracker_plural)%></strong></p> |
|
7 | <p><strong><%=l(:label_tracker_plural)%></strong></p> | |
8 | <% @trackers.each do |tracker| %> |
|
8 | <% @trackers.each do |tracker| %> | |
9 | <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> |
|
9 | <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> | |
10 | <%= tracker.name %><br /> |
|
10 | <%= tracker.name %><br /> | |
11 | <% end %> |
|
11 | <% end %> | |
12 | <p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p> |
|
12 | <p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p> | |
13 | <% end %> |
|
13 | <% end %> | |
14 | </div> |
|
14 | </div> | |
15 |
|
15 | |||
16 | <% if @fixed_issues.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %> |
|
16 | <% if @fixed_issues.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %> | |
17 |
|
17 | |||
18 | <% ver_id = nil |
|
18 | <% ver_id = nil | |
19 | @fixed_issues.each do |issue| %> |
|
19 | @fixed_issues.each do |issue| %> | |
20 | <% unless ver_id == issue.fixed_version_id %> |
|
20 | <% unless ver_id == issue.fixed_version_id %> | |
21 | <% if ver_id %></ul><% end %> |
|
21 | <% if ver_id %></ul><% end %> | |
22 | <h3 class="icon22 icon22-package"><%= issue.fixed_version.name %></h3> |
|
22 | <h3 class="icon22 icon22-package"><%= issue.fixed_version.name %></h3> | |
23 | <p><%= format_date(issue.fixed_version.effective_date) %><br /> |
|
23 | <p><%= format_date(issue.fixed_version.effective_date) %><br /> | |
24 | <%=h issue.fixed_version.description %></p> |
|
24 | <%=h issue.fixed_version.description %></p> | |
25 | <ul> |
|
25 | <ul> | |
26 | <% ver_id = issue.fixed_version_id |
|
26 | <% ver_id = issue.fixed_version_id | |
27 | end %> |
|
27 | end %> | |
28 | <li><%= link_to "#{issue.tracker.name} #{issue.id}", :controller => 'issues', :action => 'show', :id => issue %>: <%=h issue.subject %></li> |
|
28 | <li><%= link_to_issue issue %>: <%=h issue.subject %></li> | |
29 | <% end %> |
|
29 | <% end %> | |
30 | </div> No newline at end of file |
|
30 | </div> |
@@ -1,239 +1,239 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <%= l(:label_export_to) %> |
|
2 | <%= l(:label_export_to) %> | |
3 | <%= link_to 'PDF', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects], :output => 'pdf'}, :class => 'icon icon-pdf' %> |
|
3 | <%= link_to 'PDF', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects], :output => 'pdf'}, :class => 'icon icon-pdf' %> | |
4 | </div> |
|
4 | </div> | |
5 |
|
5 | |||
6 | <h2><%= l(:label_gantt) %></h2> |
|
6 | <h2><%= l(:label_gantt) %></h2> | |
7 |
|
7 | |||
8 | <% form_tag do %> |
|
8 | <% form_tag do %> | |
9 | <table width="100%"> |
|
9 | <table width="100%"> | |
10 | <tr> |
|
10 | <tr> | |
11 | <td align="left"> |
|
11 | <td align="left"> | |
12 | <input type="text" name="months" size="2" value="<%= @months %>" /> |
|
12 | <input type="text" name="months" size="2" value="<%= @months %>" /> | |
13 | <%= l(:label_months_from) %> |
|
13 | <%= l(:label_months_from) %> | |
14 | <%= select_month(@month_from, :prefix => "month", :discard_type => true) %> |
|
14 | <%= select_month(@month_from, :prefix => "month", :discard_type => true) %> | |
15 | <%= select_year(@year_from, :prefix => "year", :discard_type => true) %> |
|
15 | <%= select_year(@year_from, :prefix => "year", :discard_type => true) %> | |
16 | <%= hidden_field_tag 'zoom', @zoom %> |
|
16 | <%= hidden_field_tag 'zoom', @zoom %> | |
17 | <%= submit_tag l(:button_submit), :class => "button-small" %> |
|
17 | <%= submit_tag l(:button_submit), :class => "button-small" %> | |
18 | </td> |
|
18 | </td> | |
19 | <td> |
|
19 | <td> | |
20 | <a href="#" onclick="Element.toggle('trackerselect')"><%= l(:label_options) %></a> |
|
20 | <a href="#" onclick="Element.toggle('trackerselect')"><%= l(:label_options) %></a> | |
21 | <div id="trackerselect" class="rightbox overlay" style="width:140px; display: none;"> |
|
21 | <div id="trackerselect" class="rightbox overlay" style="width:140px; display: none;"> | |
22 | <p><strong><%=l(:label_tracker_plural)%></strong></p> |
|
22 | <p><strong><%=l(:label_tracker_plural)%></strong></p> | |
23 | <% @trackers.each do |tracker| %> |
|
23 | <% @trackers.each do |tracker| %> | |
24 | <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> |
|
24 | <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> | |
25 | <%= tracker.name %><br /> |
|
25 | <%= tracker.name %><br /> | |
26 | <% end %> |
|
26 | <% end %> | |
27 | <% if @project.children.any? %> |
|
27 | <% if @project.children.any? %> | |
28 | <p><strong><%=l(:label_subproject_plural)%></strong></p> |
|
28 | <p><strong><%=l(:label_subproject_plural)%></strong></p> | |
29 | <%= check_box_tag "with_subprojects", 1, params[:with_subprojects] %> <%= l(:general_text_Yes) %> |
|
29 | <%= check_box_tag "with_subprojects", 1, params[:with_subprojects] %> <%= l(:general_text_Yes) %> | |
30 | <% end %> |
|
30 | <% end %> | |
31 | <p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p> |
|
31 | <p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p> | |
32 | </div> |
|
32 | </div> | |
33 | </td> |
|
33 | </td> | |
34 | <td align="right"> |
|
34 | <td align="right"> | |
35 | <%= if @zoom < 4 |
|
35 | <%= if @zoom < 4 | |
36 | link_to image_tag('zoom_in.png'), {:zoom => (@zoom+1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects]} |
|
36 | link_to image_tag('zoom_in.png'), {:zoom => (@zoom+1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects]} | |
37 | else |
|
37 | else | |
38 | image_tag 'zoom_in_g.png' |
|
38 | image_tag 'zoom_in_g.png' | |
39 | end %> |
|
39 | end %> | |
40 | <%= if @zoom > 1 |
|
40 | <%= if @zoom > 1 | |
41 | link_to image_tag('zoom_out.png'),{:zoom => (@zoom-1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects]} |
|
41 | link_to image_tag('zoom_out.png'),{:zoom => (@zoom-1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects]} | |
42 | else |
|
42 | else | |
43 | image_tag 'zoom_out_g.png' |
|
43 | image_tag 'zoom_out_g.png' | |
44 | end %> |
|
44 | end %> | |
45 | </td> |
|
45 | </td> | |
46 | </tr> |
|
46 | </tr> | |
47 | </table> |
|
47 | </table> | |
48 | <% end %> |
|
48 | <% end %> | |
49 |
|
49 | |||
50 | <% zoom = 1 |
|
50 | <% zoom = 1 | |
51 | @zoom.times { zoom = zoom * 2 } |
|
51 | @zoom.times { zoom = zoom * 2 } | |
52 |
|
52 | |||
53 | subject_width = 260 |
|
53 | subject_width = 260 | |
54 | header_heigth = 18 |
|
54 | header_heigth = 18 | |
55 |
|
55 | |||
56 | headers_height = header_heigth |
|
56 | headers_height = header_heigth | |
57 | show_weeks = false |
|
57 | show_weeks = false | |
58 | show_days = false |
|
58 | show_days = false | |
59 |
|
59 | |||
60 | if @zoom >1 |
|
60 | if @zoom >1 | |
61 | show_weeks = true |
|
61 | show_weeks = true | |
62 | headers_height = 2*header_heigth |
|
62 | headers_height = 2*header_heigth | |
63 | if @zoom > 2 |
|
63 | if @zoom > 2 | |
64 | show_days = true |
|
64 | show_days = true | |
65 | headers_height = 3*header_heigth |
|
65 | headers_height = 3*header_heigth | |
66 | end |
|
66 | end | |
67 | end |
|
67 | end | |
68 |
|
68 | |||
69 | g_width = (@date_to - @date_from + 1)*zoom |
|
69 | g_width = (@date_to - @date_from + 1)*zoom | |
70 | g_height = [(20 * @events.length + 6)+150, 206].max |
|
70 | g_height = [(20 * @events.length + 6)+150, 206].max | |
71 | t_height = g_height + headers_height |
|
71 | t_height = g_height + headers_height | |
72 | %> |
|
72 | %> | |
73 |
|
73 | |||
74 | <table width="100%" style="border:0; border-collapse: collapse;"> |
|
74 | <table width="100%" style="border:0; border-collapse: collapse;"> | |
75 | <tr> |
|
75 | <tr> | |
76 | <td style="width:260px;"> |
|
76 | <td style="width:260px;"> | |
77 |
|
77 | |||
78 | <div style="position:relative;height:<%= t_height + 24 %>px;width:<%= subject_width + 1 %>px;"> |
|
78 | <div style="position:relative;height:<%= t_height + 24 %>px;width:<%= subject_width + 1 %>px;"> | |
79 | <div style="right:-2px;width:<%= subject_width %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"></div> |
|
79 | <div style="right:-2px;width:<%= subject_width %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"></div> | |
80 | <div style="right:-2px;width:<%= subject_width %>px;height:<%= t_height %>px;border-left: 1px solid #c0c0c0;overflow:hidden;" class="gantt_hdr"></div> |
|
80 | <div style="right:-2px;width:<%= subject_width %>px;height:<%= t_height %>px;border-left: 1px solid #c0c0c0;overflow:hidden;" class="gantt_hdr"></div> | |
81 | <% |
|
81 | <% | |
82 | # |
|
82 | # | |
83 | # Tasks subjects |
|
83 | # Tasks subjects | |
84 | # |
|
84 | # | |
85 | top = headers_height + 8 |
|
85 | top = headers_height + 8 | |
86 | @events.each do |i| %> |
|
86 | @events.each do |i| %> | |
87 | <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small> |
|
87 | <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small> | |
88 | <% if i.is_a? Issue %> |
|
88 | <% if i.is_a? Issue %> | |
89 | <%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i }, :title => "#{i.subject}" %>: |
|
89 | <%= link_to_issue i %>: | |
90 | <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %> |
|
90 | <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %> | |
91 | <% else %> |
|
91 | <% else %> | |
92 | <strong><%= "#{l(:label_version)}: #{i.name}" %></strong> |
|
92 | <strong><%= "#{l(:label_version)}: #{i.name}" %></strong> | |
93 | <% end %> |
|
93 | <% end %> | |
94 | </small></div> |
|
94 | </small></div> | |
95 | <% top = top + 20 |
|
95 | <% top = top + 20 | |
96 | end %> |
|
96 | end %> | |
97 | </div> |
|
97 | </div> | |
98 | </td> |
|
98 | </td> | |
99 | <td> |
|
99 | <td> | |
100 |
|
100 | |||
101 | <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;"> |
|
101 | <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;"> | |
102 | <div style="width:<%= g_width-1 %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"> </div> |
|
102 | <div style="width:<%= g_width-1 %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"> </div> | |
103 | <% |
|
103 | <% | |
104 | # |
|
104 | # | |
105 | # Months headers |
|
105 | # Months headers | |
106 | # |
|
106 | # | |
107 | month_f = @date_from |
|
107 | month_f = @date_from | |
108 | left = 0 |
|
108 | left = 0 | |
109 | height = (show_weeks ? header_heigth : header_heigth + g_height) |
|
109 | height = (show_weeks ? header_heigth : header_heigth + g_height) | |
110 | @months.times do |
|
110 | @months.times do | |
111 | width = ((month_f >> 1) - month_f) * zoom - 1 |
|
111 | width = ((month_f >> 1) - month_f) * zoom - 1 | |
112 | %> |
|
112 | %> | |
113 | <div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> |
|
113 | <div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> | |
114 | <%= link_to "#{month_f.year}-#{month_f.month}", { :year => month_f.year, :month => month_f.month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }, :title => "#{month_name(month_f.month)} #{month_f.year}"%> |
|
114 | <%= link_to "#{month_f.year}-#{month_f.month}", { :year => month_f.year, :month => month_f.month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }, :title => "#{month_name(month_f.month)} #{month_f.year}"%> | |
115 | </div> |
|
115 | </div> | |
116 | <% |
|
116 | <% | |
117 | left = left + width + 1 |
|
117 | left = left + width + 1 | |
118 | month_f = month_f >> 1 |
|
118 | month_f = month_f >> 1 | |
119 | end %> |
|
119 | end %> | |
120 |
|
120 | |||
121 | <% |
|
121 | <% | |
122 | # |
|
122 | # | |
123 | # Weeks headers |
|
123 | # Weeks headers | |
124 | # |
|
124 | # | |
125 | if show_weeks |
|
125 | if show_weeks | |
126 | left = 0 |
|
126 | left = 0 | |
127 | height = (show_days ? header_heigth-1 : header_heigth-1 + g_height) |
|
127 | height = (show_days ? header_heigth-1 : header_heigth-1 + g_height) | |
128 | if @date_from.cwday == 1 |
|
128 | if @date_from.cwday == 1 | |
129 | # @date_from is monday |
|
129 | # @date_from is monday | |
130 | week_f = @date_from |
|
130 | week_f = @date_from | |
131 | else |
|
131 | else | |
132 | # find next monday after @date_from |
|
132 | # find next monday after @date_from | |
133 | week_f = @date_from + (7 - @date_from.cwday + 1) |
|
133 | week_f = @date_from + (7 - @date_from.cwday + 1) | |
134 | width = (7 - @date_from.cwday + 1) * zoom-1 |
|
134 | width = (7 - @date_from.cwday + 1) * zoom-1 | |
135 | %> |
|
135 | %> | |
136 | <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> </div> |
|
136 | <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> </div> | |
137 | <% |
|
137 | <% | |
138 | left = left + width+1 |
|
138 | left = left + width+1 | |
139 | end %> |
|
139 | end %> | |
140 | <% |
|
140 | <% | |
141 | while week_f <= @date_to |
|
141 | while week_f <= @date_to | |
142 | width = (week_f + 6 <= @date_to) ? 7 * zoom -1 : (@date_to - week_f + 1) * zoom-1 |
|
142 | width = (week_f + 6 <= @date_to) ? 7 * zoom -1 : (@date_to - week_f + 1) * zoom-1 | |
143 | %> |
|
143 | %> | |
144 | <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> |
|
144 | <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> | |
145 | <small><%= week_f.cweek if width >= 16 %></small> |
|
145 | <small><%= week_f.cweek if width >= 16 %></small> | |
146 | </div> |
|
146 | </div> | |
147 | <% |
|
147 | <% | |
148 | left = left + width+1 |
|
148 | left = left + width+1 | |
149 | week_f = week_f+7 |
|
149 | week_f = week_f+7 | |
150 | end |
|
150 | end | |
151 | end %> |
|
151 | end %> | |
152 |
|
152 | |||
153 | <% |
|
153 | <% | |
154 | # |
|
154 | # | |
155 | # Days headers |
|
155 | # Days headers | |
156 | # |
|
156 | # | |
157 | if show_days |
|
157 | if show_days | |
158 | left = 0 |
|
158 | left = 0 | |
159 | height = g_height + header_heigth - 1 |
|
159 | height = g_height + header_heigth - 1 | |
160 | wday = @date_from.cwday |
|
160 | wday = @date_from.cwday | |
161 | (@date_to - @date_from + 1).to_i.times do |
|
161 | (@date_to - @date_from + 1).to_i.times do | |
162 | width = zoom - 1 |
|
162 | width = zoom - 1 | |
163 | %> |
|
163 | %> | |
164 | <div style="left:<%= left %>px;top:37px;width:<%= width %>px;height:<%= height %>px;font-size:0.7em;<%= "background:#f1f1f1;" if wday > 5 %>" class="gantt_hdr"> |
|
164 | <div style="left:<%= left %>px;top:37px;width:<%= width %>px;height:<%= height %>px;font-size:0.7em;<%= "background:#f1f1f1;" if wday > 5 %>" class="gantt_hdr"> | |
165 | <%= day_name(wday)[0,1] %> |
|
165 | <%= day_name(wday)[0,1] %> | |
166 | </div> |
|
166 | </div> | |
167 | <% |
|
167 | <% | |
168 | left = left + width+1 |
|
168 | left = left + width+1 | |
169 | wday = wday + 1 |
|
169 | wday = wday + 1 | |
170 | wday = 1 if wday > 7 |
|
170 | wday = 1 if wday > 7 | |
171 | end |
|
171 | end | |
172 | end %> |
|
172 | end %> | |
173 |
|
173 | |||
174 | <% |
|
174 | <% | |
175 | # |
|
175 | # | |
176 | # Today red line |
|
176 | # Today red line | |
177 | # |
|
177 | # | |
178 | if Date.today >= @date_from and Date.today <= @date_to %> |
|
178 | if Date.today >= @date_from and Date.today <= @date_to %> | |
179 | <div style="position: absolute;height:<%= g_height %>px;top:<%= headers_height + 1 %>px;left:<%= ((Date.today-@date_from+1)*zoom).floor()-1 %>px;width:10px;border-left: 1px dashed red;"> </div> |
|
179 | <div style="position: absolute;height:<%= g_height %>px;top:<%= headers_height + 1 %>px;left:<%= ((Date.today-@date_from+1)*zoom).floor()-1 %>px;width:10px;border-left: 1px dashed red;"> </div> | |
180 | <% end %> |
|
180 | <% end %> | |
181 |
|
181 | |||
182 | <% |
|
182 | <% | |
183 | # |
|
183 | # | |
184 | # Tasks |
|
184 | # Tasks | |
185 | # |
|
185 | # | |
186 | top = headers_height + 10 |
|
186 | top = headers_height + 10 | |
187 | @events.each do |i| |
|
187 | @events.each do |i| | |
188 | if i.is_a? Issue |
|
188 | if i.is_a? Issue | |
189 | i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from ) |
|
189 | i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from ) | |
190 | i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to ) |
|
190 | i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to ) | |
191 |
|
191 | |||
192 | i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor |
|
192 | i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor | |
193 | i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date ) |
|
193 | i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date ) | |
194 | i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date ) |
|
194 | i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date ) | |
195 |
|
195 | |||
196 | i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today |
|
196 | i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today | |
197 |
|
197 | |||
198 | i_left = ((i_start_date - @date_from)*zoom).floor |
|
198 | i_left = ((i_start_date - @date_from)*zoom).floor | |
199 | i_width = ((i_end_date - i_start_date + 1)*zoom).floor - 2 # total width of the issue (- 2 for left and right borders) |
|
199 | i_width = ((i_end_date - i_start_date + 1)*zoom).floor - 2 # total width of the issue (- 2 for left and right borders) | |
200 | d_width = ((i_done_date - i_start_date)*zoom).floor - 2 # done width |
|
200 | d_width = ((i_done_date - i_start_date)*zoom).floor - 2 # done width | |
201 | l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor - 2 : 0 # delay width |
|
201 | l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor - 2 : 0 # delay width | |
202 | %> |
|
202 | %> | |
203 | <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;" class="task task_todo"> </div> |
|
203 | <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;" class="task task_todo"> </div> | |
204 | <% if l_width > 0 %> |
|
204 | <% if l_width > 0 %> | |
205 | <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= l_width %>px;" class="task task_late"> </div> |
|
205 | <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= l_width %>px;" class="task task_late"> </div> | |
206 | <% end %> |
|
206 | <% end %> | |
207 | <% if d_width > 0 %> |
|
207 | <% if d_width > 0 %> | |
208 | <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= d_width %>px;" class="task task_done"> </div> |
|
208 | <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= d_width %>px;" class="task task_done"> </div> | |
209 | <% end %> |
|
209 | <% end %> | |
210 | <div style="top:<%= top %>px;left:<%= i_left + i_width + 5 %>px;background:#fff;" class="task"> |
|
210 | <div style="top:<%= top %>px;left:<%= i_left + i_width + 5 %>px;background:#fff;" class="task"> | |
211 | <%= i.status.name %> |
|
211 | <%= i.status.name %> | |
212 | <%= (i.done_ratio).to_i %>% |
|
212 | <%= (i.done_ratio).to_i %>% | |
213 | </div> |
|
213 | </div> | |
214 | <% # === tooltip === %> |
|
214 | <% # === tooltip === %> | |
215 | <div class="tooltip" style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;"> |
|
215 | <div class="tooltip" style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;"> | |
216 | <span class="tip"> |
|
216 | <span class="tip"> | |
217 | <%= render :partial => "issues/tooltip", :locals => { :issue => i }%> |
|
217 | <%= render :partial => "issues/tooltip", :locals => { :issue => i }%> | |
218 | </span></div> |
|
218 | </span></div> | |
219 | <% else |
|
219 | <% else | |
220 | i_left = ((i.start_date - @date_from)*zoom).floor |
|
220 | i_left = ((i.start_date - @date_from)*zoom).floor | |
221 | %> |
|
221 | %> | |
222 | <div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone"> </div> |
|
222 | <div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone"> </div> | |
223 | <div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task"> |
|
223 | <div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task"> | |
224 | <strong><%= i.name %></strong> |
|
224 | <strong><%= i.name %></strong> | |
225 | </div> |
|
225 | </div> | |
226 | <% end %> |
|
226 | <% end %> | |
227 | <% top = top + 20 |
|
227 | <% top = top + 20 | |
228 | end %> |
|
228 | end %> | |
229 | </div> |
|
229 | </div> | |
230 | </td> |
|
230 | </td> | |
231 | </tr> |
|
231 | </tr> | |
232 | </table> |
|
232 | </table> | |
233 |
|
233 | |||
234 | <table width="100%"> |
|
234 | <table width="100%"> | |
235 | <tr> |
|
235 | <tr> | |
236 | <td align="left"><%= link_to ('« ' + l(:label_previous)), :year => (@date_from << @months).year, :month => (@date_from << @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td> |
|
236 | <td align="left"><%= link_to ('« ' + l(:label_previous)), :year => (@date_from << @months).year, :month => (@date_from << @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td> | |
237 | <td align="right"><%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td> |
|
237 | <td align="right"><%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td> | |
238 | </tr> |
|
238 | </tr> | |
239 | </table> No newline at end of file |
|
239 | </table> |
@@ -1,60 +1,59 | |||||
1 | <h2><%=l(:label_roadmap)%></h2> |
|
1 | <h2><%=l(:label_roadmap)%></h2> | |
2 |
|
2 | |||
3 | <div> |
|
3 | <div> | |
4 |
|
4 | |||
5 | <div class="rightbox" style="width:140px;"> |
|
5 | <div class="rightbox" style="width:140px;"> | |
6 | <% form_tag do %> |
|
6 | <% form_tag do %> | |
7 | <p><strong><%=l(:label_tracker_plural)%></strong></p> |
|
7 | <p><strong><%=l(:label_tracker_plural)%></strong></p> | |
8 | <% @trackers.each do |tracker| %> |
|
8 | <% @trackers.each do |tracker| %> | |
9 | <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> |
|
9 | <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> | |
10 | <%= tracker.name %><br /> |
|
10 | <%= tracker.name %><br /> | |
11 | <% end %> |
|
11 | <% end %> | |
12 | <p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p> |
|
12 | <p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p> | |
13 | <% end %> |
|
13 | <% end %> | |
14 | </div> |
|
14 | </div> | |
15 |
|
15 | |||
16 | <% if @versions.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %> |
|
16 | <% if @versions.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %> | |
17 |
|
17 | |||
18 | <% @versions.each do |version| %> |
|
18 | <% @versions.each do |version| %> | |
19 | <h3 class="icon22 icon22-package"><%= version.name %></h3> |
|
19 | <h3 class="icon22 icon22-package"><%= version.name %></h3> | |
20 | <p><%=h version.description %></p> |
|
20 | <p><%=h version.description %></p> | |
21 | <p><strong><%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)</strong></p> |
|
21 | <p><strong><%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)</strong></p> | |
22 | <% issues = version.fixed_issues.find(:all, |
|
22 | <% issues = version.fixed_issues.find(:all, | |
23 | :include => :status, |
|
23 | :include => :status, | |
24 | :conditions => ["tracker_id in (#{@selected_tracker_ids.join(',')})"], |
|
24 | :conditions => ["tracker_id in (#{@selected_tracker_ids.join(',')})"], | |
25 | :order => "position") |
|
25 | :order => "position") | |
26 |
|
26 | |||
27 | total = issues.size |
|
27 | total = issues.size | |
28 | complete = issues.inject(0) {|c,i| i.status.is_closed? ? c + 1 : c } |
|
28 | complete = issues.inject(0) {|c,i| i.status.is_closed? ? c + 1 : c } | |
29 | percentComplete = total == 0 ? 100 : (100 / total * complete).floor |
|
29 | percentComplete = total == 0 ? 100 : (100 / total * complete).floor | |
30 | percentIncomplete = 100 - percentComplete |
|
30 | percentIncomplete = 100 - percentComplete | |
31 | %> |
|
31 | %> | |
32 | <table class="progress"> |
|
32 | <table class="progress"> | |
33 | <tr> |
|
33 | <tr> | |
34 | <% if percentComplete > 0 %> |
|
34 | <% if percentComplete > 0 %> | |
35 | <td class="closed" style="width: <%= percentComplete %>%"></td> |
|
35 | <td class="closed" style="width: <%= percentComplete %>%"></td> | |
36 | <% end; if percentIncomplete > 0 %> |
|
36 | <% end; if percentIncomplete > 0 %> | |
37 | <td class="open" style="width: <%= percentIncomplete %>%"></td> |
|
37 | <td class="open" style="width: <%= percentIncomplete %>%"></td> | |
38 | <% end %> |
|
38 | <% end %> | |
39 | </tr> |
|
39 | </tr> | |
40 | </table> |
|
40 | </table> | |
41 | <em><%= link_to(complete, :controller => 'projects', :action => 'list_issues', :id => @project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1) %> <%= lwr(:label_closed_issues, complete) %> (<%= percentComplete %>%)   |
|
41 | <em><%= link_to(complete, :controller => 'projects', :action => 'list_issues', :id => @project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1) %> <%= lwr(:label_closed_issues, complete) %> (<%= percentComplete %>%)   | |
42 | <%= link_to((total - complete), :controller => 'projects', :action => 'list_issues', :id => @project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1) %> <%= lwr(:label_open_issues, total - complete)%> (<%= percentIncomplete %>%)</em> |
|
42 | <%= link_to((total - complete), :controller => 'projects', :action => 'list_issues', :id => @project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1) %> <%= lwr(:label_open_issues, total - complete)%> (<%= percentIncomplete %>%)</em> | |
43 | <br /> |
|
43 | <br /> | |
44 | <br /> |
|
44 | <br /> | |
45 | <ul> |
|
45 | <ul> | |
46 | <% if total == 0 %> |
|
46 | <% if total == 0 %> | |
47 | <li><%=l(:label_roadmap_no_issues)%></li> |
|
47 | <li><%=l(:label_roadmap_no_issues)%></li> | |
48 | <% else %> |
|
48 | <% else %> | |
49 | <% issues.each do |issue| %> |
|
49 | <% issues.each do |issue| %> | |
50 | <li> |
|
50 | <li> | |
51 | <%= link = link_to("#{issue.tracker.name} ##{issue.id}", :controller => 'issues', :action => 'show', :id => issue) |
|
51 | <%= link = link_to_issue(issue) | |
52 |
|
|
52 | issue.status.is_closed? ? content_tag("del", link) : link %>: <%=h issue.subject %> | |
53 | : <%=h issue.subject %> |
|
|||
54 | <%= content_tag "em", "(#{l(:label_closed_issues)})" if issue.status.is_closed? %> |
|
53 | <%= content_tag "em", "(#{l(:label_closed_issues)})" if issue.status.is_closed? %> | |
55 | </li> |
|
54 | </li> | |
56 | <% end %> |
|
55 | <% end %> | |
57 | <% end %> |
|
56 | <% end %> | |
58 | </ul> |
|
57 | </ul> | |
59 | <% end %> |
|
58 | <% end %> | |
60 | </div> |
|
59 | </div> |
@@ -1,50 +1,50 | |||||
1 | <h2><%= l(:label_search) %></h2> |
|
1 | <h2><%= l(:label_search) %></h2> | |
2 |
|
2 | |||
3 | <div class="box"> |
|
3 | <div class="box"> | |
4 | <% form_tag({:action => 'search', :id => @project}, :method => :get) do %> |
|
4 | <% form_tag({:action => 'search', :id => @project}, :method => :get) do %> | |
5 | <p><%= text_field_tag 'q', @question, :size => 30 %> |
|
5 | <p><%= text_field_tag 'q', @question, :size => 30 %> | |
6 | <%= check_box_tag 'scope[]', 'issues', (@scope.include? 'issues') %> <label><%= l(:label_issue_plural) %></label> |
|
6 | <%= check_box_tag 'scope[]', 'issues', (@scope.include? 'issues') %> <label><%= l(:label_issue_plural) %></label> | |
7 | <% if @project.repository %> |
|
7 | <% if @project.repository %> | |
8 | <%= check_box_tag 'scope[]', 'changesets', (@scope.include? 'changesets') %> <label><%= l(:label_revision_plural) %></label> |
|
8 | <%= check_box_tag 'scope[]', 'changesets', (@scope.include? 'changesets') %> <label><%= l(:label_revision_plural) %></label> | |
9 | <% end %> |
|
9 | <% end %> | |
10 | <%= check_box_tag 'scope[]', 'news', (@scope.include? 'news') %> <label><%= l(:label_news_plural) %></label> |
|
10 | <%= check_box_tag 'scope[]', 'news', (@scope.include? 'news') %> <label><%= l(:label_news_plural) %></label> | |
11 | <%= check_box_tag 'scope[]', 'documents', (@scope.include? 'documents') %> <label><%= l(:label_document_plural) %></label> |
|
11 | <%= check_box_tag 'scope[]', 'documents', (@scope.include? 'documents') %> <label><%= l(:label_document_plural) %></label> | |
12 | <% if @project.wiki %> |
|
12 | <% if @project.wiki %> | |
13 | <%= check_box_tag 'scope[]', 'wiki', (@scope.include? 'wiki') %> <label><%= l(:label_wiki) %></label> |
|
13 | <%= check_box_tag 'scope[]', 'wiki', (@scope.include? 'wiki') %> <label><%= l(:label_wiki) %></label> | |
14 | <% end %> |
|
14 | <% end %> | |
15 | <br /> |
|
15 | <br /> | |
16 | <%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></p> |
|
16 | <%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></p> | |
17 | <%= submit_tag l(:button_submit), :name => 'submit' %> |
|
17 | <%= submit_tag l(:button_submit), :name => 'submit' %> | |
18 | <% end %> |
|
18 | <% end %> | |
19 | </div> |
|
19 | </div> | |
20 |
|
20 | |||
21 | <% if @results %> |
|
21 | <% if @results %> | |
22 | <h3><%= lwr(:label_result, @results.length) %></h3> |
|
22 | <h3><%= lwr(:label_result, @results.length) %></h3> | |
23 | <ul> |
|
23 | <ul> | |
24 | <% @results.each do |e| %> |
|
24 | <% @results.each do |e| %> | |
25 | <li><p> |
|
25 | <li><p> | |
26 | <% if e.is_a? Issue %> |
|
26 | <% if e.is_a? Issue %> | |
27 |
<%= link_to |
|
27 | <%= link_to_issue e %>: <%= highlight_tokens(h(e.subject), @tokens) %><br /> | |
28 | <%= highlight_tokens(e.description, @tokens) %><br /> |
|
28 | <%= highlight_tokens(e.description, @tokens) %><br /> | |
29 | <i><%= e.author.name %>, <%= format_time(e.created_on) %></i> |
|
29 | <i><%= e.author.name %>, <%= format_time(e.created_on) %></i> | |
30 | <% elsif e.is_a? News %> |
|
30 | <% elsif e.is_a? News %> | |
31 | <%=l(:label_news)%>: <%= link_to highlight_tokens(h(e.title), @tokens), :controller => 'news', :action => 'show', :id => e %><br /> |
|
31 | <%=l(:label_news)%>: <%= link_to highlight_tokens(h(e.title), @tokens), :controller => 'news', :action => 'show', :id => e %><br /> | |
32 | <%= highlight_tokens(e.description, @tokens) %><br /> |
|
32 | <%= highlight_tokens(e.description, @tokens) %><br /> | |
33 | <i><%= e.author.name %>, <%= format_time(e.created_on) %></i> |
|
33 | <i><%= e.author.name %>, <%= format_time(e.created_on) %></i> | |
34 | <% elsif e.is_a? Document %> |
|
34 | <% elsif e.is_a? Document %> | |
35 | <%=l(:label_document)%>: <%= link_to highlight_tokens(h(e.title), @tokens), :controller => 'documents', :action => 'show', :id => e %><br /> |
|
35 | <%=l(:label_document)%>: <%= link_to highlight_tokens(h(e.title), @tokens), :controller => 'documents', :action => 'show', :id => e %><br /> | |
36 | <%= highlight_tokens(e.description, @tokens) %><br /> |
|
36 | <%= highlight_tokens(e.description, @tokens) %><br /> | |
37 | <i><%= format_time(e.created_on) %></i> |
|
37 | <i><%= format_time(e.created_on) %></i> | |
38 | <% elsif e.is_a? WikiPage %> |
|
38 | <% elsif e.is_a? WikiPage %> | |
39 | <%=l(:label_wiki)%>: <%= link_to highlight_tokens(h(e.pretty_title), @tokens), :controller => 'wiki', :action => 'index', :id => @project, :page => e.title %><br /> |
|
39 | <%=l(:label_wiki)%>: <%= link_to highlight_tokens(h(e.pretty_title), @tokens), :controller => 'wiki', :action => 'index', :id => @project, :page => e.title %><br /> | |
40 | <%= highlight_tokens(e.content.text, @tokens) %><br /> |
|
40 | <%= highlight_tokens(e.content.text, @tokens) %><br /> | |
41 | <i><%= e.content.author ? e.content.author.name : "Anonymous" %>, <%= format_time(e.content.updated_on) %></i> |
|
41 | <i><%= e.content.author ? e.content.author.name : "Anonymous" %>, <%= format_time(e.content.updated_on) %></i> | |
42 | <% elsif e.is_a? Changeset %> |
|
42 | <% elsif e.is_a? Changeset %> | |
43 | <%=l(:label_revision)%> <%= link_to h(e.revision), :controller => 'repositories', :action => 'revision', :id => @project, :rev => e.revision %><br /> |
|
43 | <%=l(:label_revision)%> <%= link_to h(e.revision), :controller => 'repositories', :action => 'revision', :id => @project, :rev => e.revision %><br /> | |
44 | <%= highlight_tokens(e.comment, @tokens) %><br /> |
|
44 | <%= highlight_tokens(e.comment, @tokens) %><br /> | |
45 | <em><%= e.committer.blank? ? e.committer : "Anonymous" %>, <%= format_time(e.committed_on) %></em> |
|
45 | <em><%= e.committer.blank? ? e.committer : "Anonymous" %>, <%= format_time(e.committed_on) %></em> | |
46 | <% end %> |
|
46 | <% end %> | |
47 | </p></li> |
|
47 | </p></li> | |
48 | <% end %> |
|
48 | <% end %> | |
49 | </ul> |
|
49 | </ul> | |
50 | <% end %> No newline at end of file |
|
50 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now