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

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

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

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

Chris@1464: Chris@1464:

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

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

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

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