Chris@1295: <% @gantt.view = self %> Chris@1295:

<%= @query.new_record? ? l(:label_gantt) : h(@query.name) %>

Chris@1295: Chris@1295: <%= form_tag({:controller => 'gantts', :action => 'show', Chris@1295: :project_id => @project, :month => params[:month], Chris@1295: :year => params[:year], :months => params[:months]}, Chris@1295: :method => :get, :id => 'query_form') do %> Chris@1295: <%= hidden_field_tag 'set_filter', '1' %> Chris@1295:
"> Chris@1295: <%= l(:label_filter_plural) %> Chris@1295:
"> Chris@1295: <%= render :partial => 'queries/filters', :locals => {:query => @query} %> Chris@1295:
Chris@1295:
Chris@1295: Chris@1295: Chris@1295:

Chris@1295: <%= gantt_zoom_link(@gantt, :in) %> Chris@1295: <%= gantt_zoom_link(@gantt, :out) %> Chris@1295:

Chris@1295: Chris@1295:

Chris@1295: <%= text_field_tag 'months', @gantt.months, :size => 2 %> Chris@1295: <%= l(:label_months_from) %> Chris@1295: <%= select_month(@gantt.month_from, :prefix => "month", :discard_type => true) %> Chris@1295: <%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %> Chris@1295: <%= hidden_field_tag 'zoom', @gantt.zoom %> Chris@1295: Chris@1295: <%= link_to_function l(:button_apply), '$("#query_form").submit()', Chris@1295: :class => 'icon icon-checked' %> Chris@1295: <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 }, Chris@1295: :class => 'icon icon-reload' %> Chris@1295:

Chris@1295: <% end %> Chris@1295: Chris@1295: <%= error_messages_for 'query' %> Chris@1295: <% if @query.valid? %> Chris@1295: <% Chris@1295: zoom = 1 Chris@1295: @gantt.zoom.times { zoom = zoom * 2 } Chris@1295: Chris@1295: subject_width = 330 Chris@1295: header_height = 18 Chris@1295: Chris@1295: headers_height = header_height Chris@1295: show_weeks = false Chris@1295: show_days = false Chris@1295: Chris@1295: if @gantt.zoom > 1 Chris@1295: show_weeks = true Chris@1295: headers_height = 2 * header_height Chris@1295: if @gantt.zoom > 2 Chris@1295: show_days = true Chris@1295: headers_height = 3 * header_height Chris@1295: end Chris@1295: end Chris@1295: Chris@1295: # Width of the entire chart Chris@1295: g_width = ((@gantt.date_to - @gantt.date_from + 1) * zoom).to_i Chris@1295: @gantt.render(:top => headers_height + 8, Chris@1295: :zoom => zoom, Chris@1295: :g_width => g_width, Chris@1295: :subject_width => subject_width) Chris@1295: g_height = [(20 * (@gantt.number_of_rows + 6)) + 150, 206].max Chris@1295: t_height = g_height + headers_height Chris@1295: %> Chris@1295: Chris@1295: <% if @gantt.truncated %> Chris@1295:

<%= l(:notice_gantt_chart_truncated, :max => @gantt.max_rows) %>

Chris@1295: <% end %> Chris@1295: Chris@1295: Chris@1295: Chris@1295: Chris@1295: Chris@1295: Chris@1295: Chris@1295:
Chris@1295: <% Chris@1295: style = "" Chris@1295: style += "position:relative;" Chris@1295: style += "height: #{t_height + 24}px;" Chris@1295: style += "width: #{subject_width + 1}px;" Chris@1295: %> Chris@1295: <%= content_tag(:div, :style => style) do %> Chris@1295: <% Chris@1295: style = "" Chris@1295: style += "right:-2px;" Chris@1295: style += "width: #{subject_width}px;" Chris@1295: style += "height: #{headers_height}px;" Chris@1295: style += 'background: #eee;' Chris@1295: %> Chris@1295: <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> Chris@1295: <% Chris@1295: style = "" Chris@1295: style += "right:-2px;" Chris@1295: style += "width: #{subject_width}px;" Chris@1295: style += "height: #{t_height}px;" Chris@1295: style += 'border-left: 1px solid #c0c0c0;' Chris@1295: style += 'overflow: hidden;' Chris@1295: %> Chris@1295: <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> Chris@1295: <%= content_tag(:div, :class => "gantt_subjects") do %> Chris@1295: <%= @gantt.subjects.html_safe %> Chris@1295: <% end %> Chris@1295: <% end %> Chris@1295: Chris@1295:
Chris@1295: <% Chris@1295: style = "" Chris@1295: style += "width: #{g_width - 1}px;" Chris@1295: style += "height: #{headers_height}px;" Chris@1295: style += 'background: #eee;' Chris@1295: %> Chris@1295: <%= content_tag(:div, ' '.html_safe, :style => style, :class => "gantt_hdr") %> Chris@1295: Chris@1295: <% ###### Months headers ###### %> Chris@1295: <% Chris@1295: month_f = @gantt.date_from Chris@1295: left = 0 Chris@1295: height = (show_weeks ? header_height : header_height + g_height) Chris@1295: %> Chris@1295: <% @gantt.months.times do %> Chris@1295: <% Chris@1295: width = (((month_f >> 1) - month_f) * zoom - 1).to_i Chris@1295: style = "" Chris@1295: style += "left: #{left}px;" Chris@1295: style += "width: #{width}px;" Chris@1295: style += "height: #{height}px;" Chris@1295: %> Chris@1295: <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %> Chris@1295: <%= link_to h("#{month_f.year}-#{month_f.month}"), Chris@1295: @gantt.params.merge(:year => month_f.year, :month => month_f.month), Chris@1295: :title => "#{month_name(month_f.month)} #{month_f.year}" %> Chris@1295: <% end %> Chris@1295: <% Chris@1295: left = left + width + 1 Chris@1295: month_f = month_f >> 1 Chris@1295: %> Chris@1295: <% end %> Chris@1295: Chris@1295: <% ###### Weeks headers ###### %> Chris@1295: <% if show_weeks %> Chris@1295: <% Chris@1295: left = 0 Chris@1295: height = (show_days ? header_height - 1 : header_height - 1 + g_height) Chris@1295: %> Chris@1295: <% if @gantt.date_from.cwday == 1 %> Chris@1295: <% Chris@1295: # @date_from is monday Chris@1295: week_f = @gantt.date_from Chris@1295: %> Chris@1295: <% else %> Chris@1295: <% Chris@1295: # find next monday after @date_from Chris@1295: week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1) Chris@1295: width = (7 - @gantt.date_from.cwday + 1) * zoom - 1 Chris@1295: style = "" Chris@1295: style += "left: #{left}px;" Chris@1295: style += "top: 19px;" Chris@1295: style += "width: #{width}px;" Chris@1295: style += "height: #{height}px;" Chris@1295: %> Chris@1295: <%= content_tag(:div, ' '.html_safe, Chris@1295: :style => style, :class => "gantt_hdr") %> Chris@1295: <% left = left + width + 1 %> Chris@1295: <% end %> Chris@1295: <% while week_f <= @gantt.date_to %> Chris@1295: <% Chris@1295: width = ((week_f + 6 <= @gantt.date_to) ? Chris@1295: 7 * zoom - 1 : Chris@1295: (@gantt.date_to - week_f + 1) * zoom - 1).to_i Chris@1295: style = "" Chris@1295: style += "left: #{left}px;" Chris@1295: style += "top: 19px;" Chris@1295: style += "width: #{width}px;" Chris@1295: style += "height: #{height}px;" Chris@1295: %> Chris@1295: <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %> Chris@1295: <%= content_tag(:small) do %> Chris@1295: <%= week_f.cweek if width >= 16 %> Chris@1295: <% end %> Chris@1295: <% end %> Chris@1295: <% Chris@1295: left = left + width + 1 Chris@1295: week_f = week_f + 7 Chris@1295: %> Chris@1295: <% end %> Chris@1295: <% end %> Chris@1295: Chris@1295: <% ###### Days headers ####### %> Chris@1295: <% if show_days %> Chris@1295: <% Chris@1295: left = 0 Chris@1295: height = g_height + header_height - 1 Chris@1295: wday = @gantt.date_from.cwday Chris@1295: %> Chris@1295: <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %> Chris@1295: <% Chris@1295: width = zoom - 1 Chris@1295: style = "" Chris@1295: style += "left: #{left}px;" Chris@1295: style += "top:37px;" Chris@1295: style += "width: #{width}px;" Chris@1295: style += "height: #{height}px;" Chris@1295: style += "font-size:0.7em;" Chris@1295: clss = "gantt_hdr" Chris@1295: clss << " nwday" if @gantt.non_working_week_days.include?(wday) Chris@1295: %> Chris@1295: <%= content_tag(:div, :style => style, :class => clss) do %> Chris@1295: <%= day_letter(wday) %> Chris@1295: <% end %> Chris@1295: <% Chris@1295: left = left + width + 1 Chris@1295: wday = wday + 1 Chris@1295: wday = 1 if wday > 7 Chris@1295: %> Chris@1295: <% end %> Chris@1295: <% end %> Chris@1295: Chris@1295: <%= @gantt.lines.html_safe %> Chris@1295: Chris@1295: <% ###### Today red line (excluded from cache) ###### %> Chris@1295: <% if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %> Chris@1295: <% Chris@1295: today_left = (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i Chris@1295: style = "" Chris@1295: style += "position: absolute;" Chris@1295: style += "height: #{g_height}px;" Chris@1295: style += "top: #{headers_height + 1}px;" Chris@1295: style += "left: #{today_left}px;" Chris@1295: style += "width:10px;" Chris@1295: style += "border-left: 1px dashed red;" Chris@1295: %> Chris@1295: <%= content_tag(:div, ' '.html_safe, :style => style, :id => 'today_line') %> Chris@1295: <% end %> Chris@1295: <% Chris@1295: style = "" Chris@1295: style += "position: absolute;" Chris@1295: style += "height: #{g_height}px;" Chris@1295: style += "top: #{headers_height + 1}px;" Chris@1295: style += "left: 0px;" Chris@1295: style += "width: #{g_width - 1}px;" Chris@1295: %> Chris@1295: <%= content_tag(:div, '', :style => style, :id => "gantt_draw_area") %> Chris@1295:
Chris@1295:
Chris@1295: Chris@1295: Chris@1295: Chris@1295: Chris@1295: Chris@1295: Chris@1295:
Chris@1295: <%= link_to_content_update("\xc2\xab " + l(:label_previous), Chris@1295: params.merge(@gantt.params_previous)) %> Chris@1295: Chris@1295: <%= link_to_content_update(l(:label_next) + " \xc2\xbb", Chris@1295: params.merge(@gantt.params_next)) %> Chris@1295:
Chris@1295: Chris@1295: <% other_formats_links do |f| %> Chris@1295: <%= f.link_to 'PDF', :url => params.merge(@gantt.params) %> Chris@1295: <%= f.link_to('PNG', :url => params.merge(@gantt.params)) if @gantt.respond_to?('to_image') %> Chris@1295: <% end %> Chris@1295: <% end # query.valid? %> Chris@1295: Chris@1295: <% content_for :sidebar do %> Chris@1295: <%= render :partial => 'issues/sidebar' %> Chris@1295: <% end %> Chris@1295: Chris@1295: <% html_title(l(:label_gantt)) -%> Chris@1295: Chris@1295: <% content_for :header_tags do %> Chris@1295: <%= javascript_include_tag 'raphael' %> Chris@1295: <%= javascript_include_tag 'gantt' %> Chris@1295: <% end %> Chris@1295: Chris@1295: <%= javascript_tag do %> Chris@1295: var issue_relation_type = <%= raw Redmine::Helpers::Gantt::DRAW_TYPES.to_json %>; Chris@1295: $(document).ready(drawGanttHandler); Chris@1295: $(window).resize(drawGanttHandler); Chris@1295: $(function() { Chris@1295: $("#draw_rels").change(drawGanttHandler); Chris@1295: $("#draw_progress_line").change(drawGanttHandler); Chris@1295: }); Chris@1295: <% end %>