Mercurial > hg > soundsoftware-site
comparison .svn/pristine/d6/d66e175c15ed6eac30ec3dcf7b51f04bd3ad7599.svn-base @ 1295:622f24f53b42 redmine-2.3
Update to Redmine SVN revision 11972 on 2.3-stable branch
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:02:21 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1294:3e4c3460b6ca | 1295:622f24f53b42 |
---|---|
1 <% @gantt.view = self %> | |
2 <h2><%= @query.new_record? ? l(:label_gantt) : h(@query.name) %></h2> | |
3 | |
4 <%= form_tag({:controller => 'gantts', :action => 'show', | |
5 :project_id => @project, :month => params[:month], | |
6 :year => params[:year], :months => params[:months]}, | |
7 :method => :get, :id => 'query_form') do %> | |
8 <%= hidden_field_tag 'set_filter', '1' %> | |
9 <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>"> | |
10 <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> | |
11 <div style="<%= @query.new_record? ? "" : "display: none;" %>"> | |
12 <%= render :partial => 'queries/filters', :locals => {:query => @query} %> | |
13 </div> | |
14 </fieldset> | |
15 <fieldset class="collapsible collapsed"> | |
16 <legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend> | |
17 <div style="display: none;"> | |
18 <table> | |
19 <tr> | |
20 <td> | |
21 <fieldset> | |
22 <legend><%= l(:label_related_issues) %></legend> | |
23 <label> | |
24 <%= check_box_tag "draw_rels", params["draw_rels"], params[:set_filter].blank? || params[:draw_rels] %> | |
25 <% rels = [IssueRelation::TYPE_BLOCKS, IssueRelation::TYPE_PRECEDES] %> | |
26 <% rels.each do |rel| %> | |
27 <% color = Redmine::Helpers::Gantt::DRAW_TYPES[rel][:color] %> | |
28 <%= content_tag(:span, ' '.html_safe, | |
29 :style => "background-color: #{color}") %> | |
30 <%= l(IssueRelation::TYPES[rel][:name]) %> | |
31 <% end %> | |
32 </label> | |
33 </fieldset> | |
34 </td> | |
35 <td> | |
36 <fieldset> | |
37 <legend><%= l(:label_gantt_progress_line) %></legend> | |
38 <label> | |
39 <%= check_box_tag "draw_progress_line", params[:draw_progress_line], params[:draw_progress_line] %> | |
40 <%= l(:label_display) %> | |
41 </label> | |
42 </fieldset> | |
43 </td> | |
44 </tr> | |
45 </table> | |
46 </div> | |
47 </fieldset> | |
48 | |
49 <p class="contextual"> | |
50 <%= gantt_zoom_link(@gantt, :in) %> | |
51 <%= gantt_zoom_link(@gantt, :out) %> | |
52 </p> | |
53 | |
54 <p class="buttons"> | |
55 <%= text_field_tag 'months', @gantt.months, :size => 2 %> | |
56 <%= l(:label_months_from) %> | |
57 <%= select_month(@gantt.month_from, :prefix => "month", :discard_type => true) %> | |
58 <%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %> | |
59 <%= hidden_field_tag 'zoom', @gantt.zoom %> | |
60 | |
61 <%= link_to_function l(:button_apply), '$("#query_form").submit()', | |
62 :class => 'icon icon-checked' %> | |
63 <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 }, | |
64 :class => 'icon icon-reload' %> | |
65 </p> | |
66 <% end %> | |
67 | |
68 <%= error_messages_for 'query' %> | |
69 <% if @query.valid? %> | |
70 <% | |
71 zoom = 1 | |
72 @gantt.zoom.times { zoom = zoom * 2 } | |
73 | |
74 subject_width = 330 | |
75 header_height = 18 | |
76 | |
77 headers_height = header_height | |
78 show_weeks = false | |
79 show_days = false | |
80 | |
81 if @gantt.zoom > 1 | |
82 show_weeks = true | |
83 headers_height = 2 * header_height | |
84 if @gantt.zoom > 2 | |
85 show_days = true | |
86 headers_height = 3 * header_height | |
87 end | |
88 end | |
89 | |
90 # Width of the entire chart | |
91 g_width = ((@gantt.date_to - @gantt.date_from + 1) * zoom).to_i | |
92 @gantt.render(:top => headers_height + 8, | |
93 :zoom => zoom, | |
94 :g_width => g_width, | |
95 :subject_width => subject_width) | |
96 g_height = [(20 * (@gantt.number_of_rows + 6)) + 150, 206].max | |
97 t_height = g_height + headers_height | |
98 %> | |
99 | |
100 <% if @gantt.truncated %> | |
101 <p class="warning"><%= l(:notice_gantt_chart_truncated, :max => @gantt.max_rows) %></p> | |
102 <% end %> | |
103 | |
104 <table style="width:100%; border:0; border-collapse: collapse;"> | |
105 <tr> | |
106 <td style="width:<%= subject_width %>px; padding:0px;"> | |
107 <% | |
108 style = "" | |
109 style += "position:relative;" | |
110 style += "height: #{t_height + 24}px;" | |
111 style += "width: #{subject_width + 1}px;" | |
112 %> | |
113 <%= content_tag(:div, :style => style) do %> | |
114 <% | |
115 style = "" | |
116 style += "right:-2px;" | |
117 style += "width: #{subject_width}px;" | |
118 style += "height: #{headers_height}px;" | |
119 style += 'background: #eee;' | |
120 %> | |
121 <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> | |
122 <% | |
123 style = "" | |
124 style += "right:-2px;" | |
125 style += "width: #{subject_width}px;" | |
126 style += "height: #{t_height}px;" | |
127 style += 'border-left: 1px solid #c0c0c0;' | |
128 style += 'overflow: hidden;' | |
129 %> | |
130 <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> | |
131 <%= content_tag(:div, :class => "gantt_subjects") do %> | |
132 <%= @gantt.subjects.html_safe %> | |
133 <% end %> | |
134 <% end %> | |
135 </td> | |
136 | |
137 <td> | |
138 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;" id="gantt_area"> | |
139 <% | |
140 style = "" | |
141 style += "width: #{g_width - 1}px;" | |
142 style += "height: #{headers_height}px;" | |
143 style += 'background: #eee;' | |
144 %> | |
145 <%= content_tag(:div, ' '.html_safe, :style => style, :class => "gantt_hdr") %> | |
146 | |
147 <% ###### Months headers ###### %> | |
148 <% | |
149 month_f = @gantt.date_from | |
150 left = 0 | |
151 height = (show_weeks ? header_height : header_height + g_height) | |
152 %> | |
153 <% @gantt.months.times do %> | |
154 <% | |
155 width = (((month_f >> 1) - month_f) * zoom - 1).to_i | |
156 style = "" | |
157 style += "left: #{left}px;" | |
158 style += "width: #{width}px;" | |
159 style += "height: #{height}px;" | |
160 %> | |
161 <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %> | |
162 <%= link_to h("#{month_f.year}-#{month_f.month}"), | |
163 @gantt.params.merge(:year => month_f.year, :month => month_f.month), | |
164 :title => "#{month_name(month_f.month)} #{month_f.year}" %> | |
165 <% end %> | |
166 <% | |
167 left = left + width + 1 | |
168 month_f = month_f >> 1 | |
169 %> | |
170 <% end %> | |
171 | |
172 <% ###### Weeks headers ###### %> | |
173 <% if show_weeks %> | |
174 <% | |
175 left = 0 | |
176 height = (show_days ? header_height - 1 : header_height - 1 + g_height) | |
177 %> | |
178 <% if @gantt.date_from.cwday == 1 %> | |
179 <% | |
180 # @date_from is monday | |
181 week_f = @gantt.date_from | |
182 %> | |
183 <% else %> | |
184 <% | |
185 # find next monday after @date_from | |
186 week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1) | |
187 width = (7 - @gantt.date_from.cwday + 1) * zoom - 1 | |
188 style = "" | |
189 style += "left: #{left}px;" | |
190 style += "top: 19px;" | |
191 style += "width: #{width}px;" | |
192 style += "height: #{height}px;" | |
193 %> | |
194 <%= content_tag(:div, ' '.html_safe, | |
195 :style => style, :class => "gantt_hdr") %> | |
196 <% left = left + width + 1 %> | |
197 <% end %> | |
198 <% while week_f <= @gantt.date_to %> | |
199 <% | |
200 width = ((week_f + 6 <= @gantt.date_to) ? | |
201 7 * zoom - 1 : | |
202 (@gantt.date_to - week_f + 1) * zoom - 1).to_i | |
203 style = "" | |
204 style += "left: #{left}px;" | |
205 style += "top: 19px;" | |
206 style += "width: #{width}px;" | |
207 style += "height: #{height}px;" | |
208 %> | |
209 <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %> | |
210 <%= content_tag(:small) do %> | |
211 <%= week_f.cweek if width >= 16 %> | |
212 <% end %> | |
213 <% end %> | |
214 <% | |
215 left = left + width + 1 | |
216 week_f = week_f + 7 | |
217 %> | |
218 <% end %> | |
219 <% end %> | |
220 | |
221 <% ###### Days headers ####### %> | |
222 <% if show_days %> | |
223 <% | |
224 left = 0 | |
225 height = g_height + header_height - 1 | |
226 wday = @gantt.date_from.cwday | |
227 %> | |
228 <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %> | |
229 <% | |
230 width = zoom - 1 | |
231 style = "" | |
232 style += "left: #{left}px;" | |
233 style += "top:37px;" | |
234 style += "width: #{width}px;" | |
235 style += "height: #{height}px;" | |
236 style += "font-size:0.7em;" | |
237 clss = "gantt_hdr" | |
238 clss << " nwday" if @gantt.non_working_week_days.include?(wday) | |
239 %> | |
240 <%= content_tag(:div, :style => style, :class => clss) do %> | |
241 <%= day_letter(wday) %> | |
242 <% end %> | |
243 <% | |
244 left = left + width + 1 | |
245 wday = wday + 1 | |
246 wday = 1 if wday > 7 | |
247 %> | |
248 <% end %> | |
249 <% end %> | |
250 | |
251 <%= @gantt.lines.html_safe %> | |
252 | |
253 <% ###### Today red line (excluded from cache) ###### %> | |
254 <% if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %> | |
255 <% | |
256 today_left = (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i | |
257 style = "" | |
258 style += "position: absolute;" | |
259 style += "height: #{g_height}px;" | |
260 style += "top: #{headers_height + 1}px;" | |
261 style += "left: #{today_left}px;" | |
262 style += "width:10px;" | |
263 style += "border-left: 1px dashed red;" | |
264 %> | |
265 <%= content_tag(:div, ' '.html_safe, :style => style, :id => 'today_line') %> | |
266 <% end %> | |
267 <% | |
268 style = "" | |
269 style += "position: absolute;" | |
270 style += "height: #{g_height}px;" | |
271 style += "top: #{headers_height + 1}px;" | |
272 style += "left: 0px;" | |
273 style += "width: #{g_width - 1}px;" | |
274 %> | |
275 <%= content_tag(:div, '', :style => style, :id => "gantt_draw_area") %> | |
276 </div> | |
277 </td> | |
278 </tr> | |
279 </table> | |
280 | |
281 <table style="width:100%"> | |
282 <tr> | |
283 <td align="left"> | |
284 <%= link_to_content_update("\xc2\xab " + l(:label_previous), | |
285 params.merge(@gantt.params_previous)) %> | |
286 </td> | |
287 <td align="right"> | |
288 <%= link_to_content_update(l(:label_next) + " \xc2\xbb", | |
289 params.merge(@gantt.params_next)) %> | |
290 </td> | |
291 </tr> | |
292 </table> | |
293 | |
294 <% other_formats_links do |f| %> | |
295 <%= f.link_to 'PDF', :url => params.merge(@gantt.params) %> | |
296 <%= f.link_to('PNG', :url => params.merge(@gantt.params)) if @gantt.respond_to?('to_image') %> | |
297 <% end %> | |
298 <% end # query.valid? %> | |
299 | |
300 <% content_for :sidebar do %> | |
301 <%= render :partial => 'issues/sidebar' %> | |
302 <% end %> | |
303 | |
304 <% html_title(l(:label_gantt)) -%> | |
305 | |
306 <% content_for :header_tags do %> | |
307 <%= javascript_include_tag 'raphael' %> | |
308 <%= javascript_include_tag 'gantt' %> | |
309 <% end %> | |
310 | |
311 <%= javascript_tag do %> | |
312 var issue_relation_type = <%= raw Redmine::Helpers::Gantt::DRAW_TYPES.to_json %>; | |
313 $(document).ready(drawGanttHandler); | |
314 $(window).resize(drawGanttHandler); | |
315 $(function() { | |
316 $("#draw_rels").change(drawGanttHandler); | |
317 $("#draw_progress_line").change(drawGanttHandler); | |
318 }); | |
319 <% end %> |