diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ad0fab173..14d5961cd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 # Redmine - project management software # Copyright (C) 2006-2013 Jean-Philippe Lang # @@ -685,6 +686,61 @@ class ApplicationController < ActionController::Base :content_type => 'application/atom+xml' end + def issue_ratio_change done_ratio, status_id + if done_ratio == 100 || status_id == 3 + "已完成" + else + done_ratio.to_s + "%" + end + end + + def issue_priority_change priority_id + case priority_id + when 1 + "低" + when 2 + "正常" + when 3 + "高" + when 4 + "紧急" + when 5 + "立即" + end + end + + def issue_status_change status_id + case status_id + when 1 + "新增" + when 2 + "正在解决" + when 3 + "已解决" + when 4 + "反馈" + when 5 + "关闭" + when 6 + "拒绝" + end + end + + def issue_tracker_change tracker_id + case tracker_id + when 1 + "缺陷" + when 2 + "功能" + when 3 + "支持" + when 4 + "任务" + when 5 + "周报" + end + end + def self.accept_rss_auth(*actions) if actions.any? self.accept_rss_auth_actions = actions diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 6fb2868bc..38cc93fe3 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -66,44 +66,64 @@ class IssuesController < ApplicationController @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base' if @query.valid? - case params[:format] - when 'csv', 'pdf' - @limit = 10#Setting.issues_export_limit.to_i - when 'atom' - @limit = 10#Setting.feeds_limit.to_i - when 'xml', 'json' - @offset, @limit = api_offset_and_limit({:limit => 10}) - else - @limit = 10#per_page_option - end + # case params[:format] + # when 'csv', 'pdf' + # @limit = 10#Setting.issues_export_limit.to_i + # when 'atom' + # @limit = 10#Setting.feeds_limit.to_i + # when 'xml', 'json' + # @offset, @limit = api_offset_and_limit({:limit => 10}) + # else + # @limit = 10#per_page_option + # end + @tracker_id = params[:tracker_id] @assign_to_id = params[:assigned_to_id] @author_id = params[:author_id] - @priority_id = params[:priority_id] @status_id = params[:status_id] @subject = params[:subject] @done_ratio = params[:done_ratio] + @fixed_version_id = params[:fixed_version_id] @issue_count = @query.issue_count - @issue_pages = Paginator.new @issue_count, @limit, params['page'] - params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 - @offset ||= @issue_pages.offset - @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], - :order => 'issues.updated_on desc', - :offset => @offset, - :limit => @limit) - if params[:set_filter] - @set_filter = params[:set_filter] + @test = params[:test] + # @issue_pages = Paginator.new @issue_count, @limit, params['page'] + # params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 + # @offset ||= @issue_pages.offset + @project_sort = 'issues.updated_on desc' + if params[:test] != "0" + case @test + when "1" + @project_sort = 'issues.created_on desc' + when "2" + @project_sort = 'issues.created_on asc' + when "3" + @project_sort = 'issues.updated_on desc' + when "4" + @project_sort = 'issues.updated_on asc' + end end - @issue_count_by_group = @query.issue_count_by_group + @issues_filter_assign_count = @query.issues.select{|issue| issue.assigned_to_id == User.current.id }.count + @issues_filter_author_count = @query.issues.select{|issue| issue.author_id == User.current.id }.count + @issues_filter = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], :order => @project_sort) + @limit = 10 + @is_remote = true + @issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1 + @offset ||= @issue_pages.offset + @issues = paginateHelper @issues_filter, @limit + # if params[:set_filter] + # @set_filter = params[:set_filter] + # end + # @issue_count_by_group = @query.issue_count_by_group respond_to do |format| format.js format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young - format.api { - Issue.load_visible_relations(@issues) if include_in_api_response?('relations') - } + format.api {Issue.load_visible_relations(@issues) if include_in_api_response?('relations')} # format.json { render :json => @issues.map { |issue| issue.to_json}} #:json => @issues.map { |issue| issue.to_json} format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } format.csv { send_data(query_to_csv(@issues, @query, params), :type => 'text/csv; header=present', :filename => 'issues.csv') } format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'issues.pdf') } + format.xls {filename = "#{@project.name.to_s}_#{l(:label_issue_list_xls)}.xls" + send_data(issue_list_xls(@issues_filter), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + } end else respond_to do |format| diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index a79890870..5d9528f87 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -34,7 +34,7 @@ class RepositoriesController < ApplicationController before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats, :quality_analysis] before_filter :find_repository, :only => [:edit, :update, :destroy, :committers] - before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :project_archive] + before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :project_archive, :export_rep_static] before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue] before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analysis] # 链接gitlab @@ -69,6 +69,20 @@ class RepositoriesController < ApplicationController end + def export_rep_static + @project = Project.find(params[:id]) + gpid = @project.gpid + rev = params[:rev] + cycle = params[:cycle] + respond_to do |format| + format.html + format.xls{ + filename = "#{@project.name.to_s}_#{l(:label_issue_list_xls)}_#{@rev}_#{l(:label_rep_xls)}.xls" + send_data(export_rep_xls(gpid, :rev => rev, :cycle => "1"), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + } + end + end + def forked @project = Project.find(params[:id]) @repository = Repository.where("project_id =? and type =?", @project.id, "Repository::Gitlab") diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index defc36868..2dce0f37f 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -53,7 +53,6 @@ class VersionsController < ApplicationController @offset ||= @versions_pages.offset @versions = @versions.slice(@offset, @limit) #end by young - @issues_by_version = {} if @selected_tracker_ids.any? && @versions.any? @@ -81,6 +80,14 @@ class VersionsController < ApplicationController all } format.api + format.xls { + @issues = @version.fixed_issues.visible. + includes(:status, :tracker, :priority). + reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id"). + all + filename = "#{@version.name.to_s}_#{l(:label_issue_list_xls)}.xls" + send_data(issue_list_xls(@issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + } end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d3b28fb20..a204ac524 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -63,6 +63,67 @@ module ApplicationHelper result end + # 项目版本库导出Excel功能 + def export_rep_xls(gpid, options = {}) + g = Gitlab.client + cycle = params[:cycle] + rev = params[:rev] + # branch = g.branche(gpid, rev) + statics = g.rep_stats(gpid, :rev => rev) + + xls_report = StringIO.new + book = Spreadsheet::Workbook.new + sheet1 = book.create_worksheet :name => "版本库" + blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 + sheet1.row(0).default_format = blue + sheet1.row(0).concat([l(:rep_branch),l(:rep_author),l(:rep_author_mail),l(:rep_code_add),l(:rep_code_delete),l(:rep_code_modified),l(:rep_sode_time),l(:rep_sode_cycle)]) + count_row = 1 + statics.each do |static| + user = User.where(:mail => static.email).first + sheet1[count_row,0] = rev + sheet1[count_row,1] = user.nil? ? static.uname : user.show_name + sheet1[count_row,2] = static.email + sheet1[count_row,3] = static.add + sheet1[count_row,4] = static.del + sheet1[count_row,5] = static.changes + sheet1[count_row,6] = Time.now + sheet1[count_row,7] = "1周" + count_row += 1 + end + + book.write xls_report + xls_report.string + end + + # 项目issue列表导出Excel功能 + def issue_list_xls issues + xls_report = StringIO.new + book = Spreadsheet::Workbook.new + sheet1 = book.create_worksheet :name => "issues" + blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 + sheet1.row(0).default_format = blue + sheet1.row(0).concat([l(:issue_xls_id),l(:issue_xls_tracker_id),l(:issue_xls_title),l(:issue_xls_description),l(:issue_xls_status),l(:issue_xls_assign),l(:issue_xls_priority),l(:issue_xls_author),l(:issue_xls_created_at),l(:issue_xls_version),l(:issue_xls_start),l(:issue_xls_due),l(:issue_xls_ratio)]) + count_row = 1 + issues.each do |issue| + sheet1[count_row,0] = issue.id + sheet1[count_row,1] = issue_tracker_change(issue.tracker_id) + sheet1[count_row,2] = issue.subject + sheet1[count_row,3] = issue.description + sheet1[count_row,4] = issue_status_change(issue.status_id) + sheet1[count_row,5] = issue.assigned_to.try(:show_name) + sheet1[count_row,6] = issue_priority_change(issue.priority_id) + sheet1[count_row,7] = issue.author.show_name + sheet1[count_row,8] = issue.created_on + sheet1[count_row,9] = issue.fixed_version.try(:name) + sheet1[count_row,10] = issue.start_date + sheet1[count_row,11] = issue.due_date + sheet1[count_row,12] = issue_ratio_change(issue.done_ratio, issue.status_id) + count_row += 1 + end + book.write xls_report + xls_report.string + end + # 获取用户单位 # 优先获取高校信息,如果改信息不存在则获取occupation def get_occupation_from_user user @@ -1799,7 +1860,7 @@ module ApplicationHelper end def link_to_function(name, function, html_options={}) - content_tag(:a, name, {:href => '#', :onclick => "#{function}; return false;"}.merge(:class => " c_purple")) + content_tag(:a, name, {:href => '#', :onclick => "#{function}; return false;"}.merge(:class => "BlueCirBtnMini ml10",:style => "display:inline-block; height:20px; line-height:20px;")) end # Helper to render JSON in views diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 5a124849f..0ab09802f 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -57,6 +57,15 @@ module IssuesHelper "#{@cached_label_priority}: #{h(issue.priority.name)}".html_safe end + def states_done_ratio(issue) + done_ratio = issue.done_ratio + if done_ratio == 100 + "#{l(:label_done_ratio_endding)}".html_safe + else + "#{l(:label_done_ratio_doing)}".html_safe + end + end + def issue_heading(issue) #h("#{issue.tracker} ##{issue.id}") # h("#{issue.tracker} #{issue.source_from}") @@ -117,6 +126,11 @@ module IssuesHelper end end + def options_for_version_isuue_list(project) + versions = Version.where(:project_id => project, :status => "open").map{|version| [version.name, version.id]}.unshift(["里程碑", 0]) + end + + def render_issue_subject_with_tree(issue) s = '' ancestors = issue.root? ? [] : issue.ancestors.visible.all diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index 43d01a5dd..5cc72a82d 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -255,16 +255,20 @@ module QueriesHelper # Give it a name, required to be valid @query = IssueQuery.new(:name => "_") @query.project = @project - params[:f] = %w(subject status_id priority_id author_id assigned_to_id created_on) unless params[:status_id].nil? + params[:f] = %w(subject tracker_id status_id done_ratio author_id assigned_to_id fixed_version_id created_on) unless params[:status_id].nil? params[:op] = {'subject' => "~" , 'status_id' => ( params[:status_id] == '0' ? "!":"=" ), - 'priority_id' => ( params[:priority_id] == '0' ? "!":"=" ), - 'author_id' => ( params[:author_id] == '0' ? "!":"=" ), + 'author_id' =>(params[:author_id] == '0' ? "!":"=" ), + 'done_ratio' => ( params[:done_ratio]== '-1' ? "!":"="), + 'tracker_id' => ( params[:tracker_id] == '0' ? "!":"=" ), + 'fixed_version_id' => ( params[:fixed_version_id] == '0' ? "!":"=" ), 'assigned_to_id' => ( params[:assigned_to_id] == '0' ? "!":"=" )} unless params[:status_id].nil? params[:v] = {'subject' => [params[:subject]], 'status_id' => [params[:status_id]], - 'priority_id' => [params[:priority_id]], 'author_id' => [params[:author_id]], + 'done_ratio' => [params[:done_ratio]], + 'tracker_id' => [params[:tracker_id]], + 'fixed_version_id' => [params[:fixed_version_id]], 'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil? if(params[:status_id] != nil) if( params[:issue_create_date_start]!=nil && params[:issue_create_date_start]!='' && diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index d846071b5..7f027009a 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -344,7 +344,7 @@ module WatchersHelper def exit_project_link(project) link_to(l(:label_exit_project),exit_cur_project_path(project.id), :remote => true, :confirm => l(:lable_sure_exit_project), - :class => "pr_join_a_quit" ) + :class => "sy_btn_grey mr5" ) end #项目关注、取消关注 @@ -361,8 +361,8 @@ module WatchersHelper :object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)) method = watched ? 'delete' : 'post' link_to text, url, :remote => true, :method => method, - :class => "pr_join_a" ,:id=>id - end + :class => "sy_btn_pink mr5" ,:id=>id + end # 申请加入项目 def join_in_project_link(project, user, options=[]) @@ -372,9 +372,9 @@ module WatchersHelper method = 'post' @applied_flag = project.instance_of?(Project) if applied - link = "#{text}" + link = "#{text}" else - link = link_to(text, url, :remote => true, :method => method, :id => "#{project.id}", :class => "pr_join_a") + link = link_to(text, url, :remote => true, :method => method, :id => "#{project.id}", :class => "sy_btn_pink mr5") end link.html_safe # if applied diff --git a/app/models/project.rb b/app/models/project.rb index e80306036..0ac10fb2b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -305,6 +305,11 @@ class Project < ActiveRecord::Base errors[:identifier].blank? && !(new_record? || identifier.blank?) end + # returns project's creater + def creater + User.find(self.user_id).try(:show_name) + end + # returns latest created projects # non public projects will be returned only if user is a member of those def self.latest(user=nil, count=5) diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index 39cab4a53..26ad8501c 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -1,4 +1,4 @@ -
@@ -20,6 +20,7 @@ |
---|
- <% - style = "" - style += "position:relative;" - style += "height: #{t_height + 24}px;" - style += "width: #{subject_width + 1}px;" - %> - <%= content_tag(:div, :style => style) do %> - <% - style = "" - style += "right:-2px;" - style += "width: #{subject_width}px;" - style += "height: #{headers_height}px;" - style += 'background: #eee;' - %> - <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> - <% - style = "" - style += "right:-2px;" - style += "width: #{subject_width}px;" - style += "height: #{t_height}px;" - style += 'border-left: 1px solid #c0c0c0;' - style += 'overflow: hidden;' - %> - <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> - <%= content_tag(:div, :class => "gantt_subjects") do %> - <%= @gantt.subjects.html_safe %> - <% end %> - <% end %> - | - -
-
-<%
- style = ""
- style += "width: #{g_width - 1}px;"
- style += "height: #{headers_height}px;"
- style += 'background: #eee;'
-%>
-<%= content_tag(:div, ' '.html_safe, :style => style, :class => "gantt_hdr") %>
-
-<% ###### Months headers ###### %>
-<%
- month_f = @gantt.date_from
- left = 0
- height = (show_weeks ? header_height : header_height + g_height)
-%>
-<% @gantt.months.times do %>
- <%
- width = (((month_f >> 1) - month_f) * zoom - 1).to_i
- style = ""
- style += "left: #{left}px;"
- style += "width: #{width}px;"
- style += "height: #{height}px;"
- %>
- <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %>
- <%= link_to h("#{month_f.year}-#{month_f.month}"),
- @gantt.params.merge(:year => month_f.year, :month => month_f.month),
- :title => "#{month_name(month_f.month)} #{month_f.year}" %>
- <% end %>
- <%
- left = left + width + 1
- month_f = month_f >> 1
- %>
-<% end %>
-
-<% ###### Weeks headers ###### %>
-<% if show_weeks %>
- <%
- left = 0
- height = (show_days ? header_height - 1 : header_height - 1 + g_height)
- %>
- <% if @gantt.date_from.cwday == 1 %>
- <%
- # @date_from is monday
- week_f = @gantt.date_from
- %>
- <% else %>
- <%
- # find next monday after @date_from
- week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1)
- width = (7 - @gantt.date_from.cwday + 1) * zoom - 1
- style = ""
- style += "left: #{left}px;"
- style += "top: 19px;"
- style += "width: #{width}px;"
- style += "height: #{height}px;"
- %>
- <%= content_tag(:div, ' '.html_safe,
- :style => style, :class => "gantt_hdr") %>
- <% left = left + width + 1 %>
- <% end %>
- <% while week_f <= @gantt.date_to %>
- <%
- width = ((week_f + 6 <= @gantt.date_to) ?
- 7 * zoom - 1 :
- (@gantt.date_to - week_f + 1) * zoom - 1).to_i
- style = ""
- style += "left: #{left}px;"
- style += "top: 19px;"
- style += "width: #{width}px;"
- style += "height: #{height}px;"
- %>
- <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %>
- <%= content_tag(:small) do %>
- <%= week_f.cweek if width >= 16 %>
- <% end %>
- <% end %>
- <%
- left = left + width + 1
- week_f = week_f + 7
- %>
- <% end %>
-<% end %>
-
-<% ###### Days headers ####### %>
-<% if show_days %>
- <%
- left = 0
- height = g_height + header_height - 1
- wday = @gantt.date_from.cwday
- %>
- <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
- <%
- width = zoom - 1
- style = ""
- style += "left: #{left}px;"
- style += "top:37px;"
- style += "width: #{width}px;"
- style += "height: #{height}px;"
- style += "font-size:0.7em;"
- clss = "gantt_hdr"
- clss << " nwday" if @gantt.non_working_week_days.include?(wday)
- %>
- <%= content_tag(:div, :style => style, :class => clss) do %>
- <%= day_letter(wday) %>
- <% end %>
- <%
- left = left + width + 1
- wday = wday + 1
- wday = 1 if wday > 7
- %>
- <% end %>
-<% end %>
-
-<%= @gantt.lines.html_safe %>
-
-<% ###### Today red line (excluded from cache) ###### %>
-<% if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
- <%
- today_left = (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i
- style = ""
- style += "position: absolute;"
- style += "height: #{g_height}px;"
- style += "top: #{headers_height + 1}px;"
- style += "left: #{today_left}px;"
- style += "width:10px;"
- style += "border-left: 1px dashed red;"
- %>
- <%= content_tag(:div, ' '.html_safe, :style => style, :id => 'today_line') %>
-<% end %>
-<%
- style = ""
- style += "position: absolute;"
- style += "height: #{g_height}px;"
- style += "top: #{headers_height + 1}px;"
- style += "left: 0px;"
- style += "width: #{g_width - 1}px;"
-%>
-<%= content_tag(:div, '', :style => style, :id => "gantt_draw_area") %>
-
- |
-
- <%= link_to_content_update("\xc2\xab " + l(:label_previous), - params.merge(@gantt.params_previous)) %> - | -- <%= link_to_content_update(l(:label_next) + " \xc2\xbb", - params.merge(@gantt.params_next)) %> - | -
+ <%= gantt_zoom_link(@gantt, :in) %> + <%= gantt_zoom_link(@gantt, :out) %> +
+ + +<% end %> + +<%= error_messages_for 'query' %> +<% if @query.valid? %> +<% + zoom = 1 + @gantt.zoom.times { zoom = zoom * 2 } + + subject_width = 330 + header_height = 18 + + headers_height = header_height + show_weeks = false + show_days = false + + if @gantt.zoom > 1 + show_weeks = true + headers_height = 2 * header_height + if @gantt.zoom > 2 + show_days = true + headers_height = 3 * header_height + end + end + + # Width of the entire chart + g_width = ((@gantt.date_to - @gantt.date_from + 1) * zoom).to_i + @gantt.render(:top => headers_height + 8, + :zoom => zoom, + :g_width => g_width, + :subject_width => subject_width) + g_height = [(20 * (@gantt.number_of_rows + 6)) + 150, 206].max + t_height = g_height + headers_height +%> + +<% if @gantt.truncated %> +<%= l(:notice_gantt_chart_truncated, :max => @gantt.max_rows) %>
+<% end %> + ++ <% + style = "" + style += "position:relative;" + style += "height: #{t_height + 24}px;" + style += "width: #{subject_width + 1}px;" + %> + <%= content_tag(:div, :style => style) do %> + <% + style = "" + style += "right:-2px;" + style += "width: #{subject_width}px;" + style += "height: #{headers_height}px;" + style += 'background: #eee;' + style += 'z-index: 1;' + %> + <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> + <% + style = "" + style += "right:-2px;" + style += "width: #{subject_width}px;" + style += "height: #{t_height}px;" + style += 'border-left: 1px solid #c0c0c0;' + style += 'overflow: hidden;' + %> + <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> + <%= content_tag(:div, :class => "gantt_subjects") do %> + <%= @gantt.subjects.html_safe %> + <% end %> + <% end %> + | + +
+
+<%
+ style = ""
+ style += "width: #{g_width - 1}px;"
+ style += "height: #{headers_height}px;"
+ style += 'background: #eee;'
+%>
+<%= content_tag(:div, ' '.html_safe, :style => style, :class => "gantt_hdr") %>
+
+<% ###### Months headers ###### %>
+<%
+ month_f = @gantt.date_from
+ left = 0
+ height = (show_weeks ? header_height : header_height + g_height)
+%>
+<% @gantt.months.times do %>
+ <%
+ width = (((month_f >> 1) - month_f) * zoom - 1).to_i
+ style = ""
+ style += "left: #{left}px;"
+ style += "width: #{width}px;"
+ style += "height: #{height}px;"
+ %>
+ <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %>
+ <%= link_to h("#{month_f.year}-#{month_f.month}"),
+ @gantt.params.merge(:year => month_f.year, :month => month_f.month),
+ :title => "#{month_name(month_f.month)} #{month_f.year}" %>
+ <% end %>
+ <%
+ left = left + width + 1
+ month_f = month_f >> 1
+ %>
+<% end %>
+
+<% ###### Weeks headers ###### %>
+<% if show_weeks %>
+ <%
+ left = 0
+ height = (show_days ? header_height - 1 : header_height - 1 + g_height)
+ %>
+ <% if @gantt.date_from.cwday == 1 %>
+ <%
+ # @date_from is monday
+ week_f = @gantt.date_from
+ %>
+ <% else %>
+ <%
+ # find next monday after @date_from
+ week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1)
+ width = (7 - @gantt.date_from.cwday + 1) * zoom - 1
+ style = ""
+ style += "left: #{left}px;"
+ style += "top: 19px;"
+ style += "width: #{width}px;"
+ style += "height: #{height}px;"
+ %>
+ <%= content_tag(:div, ' '.html_safe,
+ :style => style, :class => "gantt_hdr") %>
+ <% left = left + width + 1 %>
+ <% end %>
+ <% while week_f <= @gantt.date_to %>
+ <%
+ width = ((week_f + 6 <= @gantt.date_to) ?
+ 7 * zoom - 1 :
+ (@gantt.date_to - week_f + 1) * zoom - 1).to_i
+ style = ""
+ style += "left: #{left}px;"
+ style += "top: 19px;"
+ style += "width: #{width}px;"
+ style += "height: #{height}px;"
+ %>
+ <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %>
+ <%= content_tag(:small) do %>
+ <%= week_f.cweek if width >= 16 %>
+ <% end %>
+ <% end %>
+ <%
+ left = left + width + 1
+ week_f = week_f + 7
+ %>
+ <% end %>
+<% end %>
+
+<% ###### Days headers ####### %>
+<% if show_days %>
+ <%
+ left = 0
+ height = g_height + header_height - 1
+ wday = @gantt.date_from.cwday
+ %>
+ <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
+ <%
+ width = zoom - 1
+ style = ""
+ style += "left: #{left}px;"
+ style += "top:37px;"
+ style += "width: #{width}px;"
+ style += "height: #{height}px;"
+ style += "font-size:0.7em;"
+ clss = "gantt_hdr"
+ clss << " nwday" if @gantt.non_working_week_days.include?(wday)
+ %>
+ <%= content_tag(:div, :style => style, :class => clss) do %>
+ <%= day_letter(wday) %>
+ <% end %>
+ <%
+ left = left + width + 1
+ wday = wday + 1
+ wday = 1 if wday > 7
+ %>
+ <% end %>
+<% end %>
+
+<%= @gantt.lines.html_safe %>
+
+<% ###### Today red line (excluded from cache) ###### %>
+<% if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
+ <%
+ today_left = (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i
+ style = ""
+ style += "position: absolute;"
+ style += "height: #{g_height}px;"
+ style += "top: #{headers_height + 1}px;"
+ style += "left: #{today_left}px;"
+ style += "width:10px;"
+ style += "border-left: 1px dashed red;"
+ %>
+ <%= content_tag(:div, ' '.html_safe, :style => style, :id => 'today_line') %>
+<% end %>
+<%
+ style = ""
+ style += "position: absolute;"
+ style += "height: #{g_height}px;"
+ style += "top: #{headers_height + 1}px;"
+ style += "left: 0px;"
+ style += "width: #{g_width - 1}px;"
+%>
+<%= content_tag(:div, '', :style => style, :id => "gantt_draw_area") %>
+
+ |
+
+ <%= link_to_content_update("\xc2\xab " + l(:label_previous), + params.merge(@gantt.params_previous)) %> + | ++ <%= link_to_content_update(l(:label_next) + " \xc2\xbb", + params.merge(@gantt.params_next)) %> + | +
<%= l(:label_no_data) %>
+ <% else %> +<%=format_time(activity.created_on) %>发布
+<%= l(:label_issues_sum) %>:<%= @project.project_score.issue_num %> - <%= l(:lable_issues_undo) %>:<%= @project.issues.where('status_id in (1,2,4,6)').visible.all.count %> -
- -- <%= l(:label_no_data) %> -
- <% else %> -<%= l(:label_project_ivite_code)%>
<%= (User.current.member_of?(@project) || User.current.admin?) ? @project.invite_code : "******" %>
+ 项目评分: + <% if @project.project_type == 0 %> + <% unless static_project_score(@project.project_score) == 0 %> + <%= link_to(format("%.2f" ,static_project_score(@project.project_score)).to_i, + {:controller => 'projects', + :action => 'show_projects_score', + :remote => true, + :id => @project.id}, :class => "sy_cblue" ) %> + <% end %> + <% end %> + + 浏览:<%= @project.visits.to_i %> + <%= l(:label_user_watcher) %>: <%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'sy_corange' %> + <%= l(:label_member) %>: <%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'sy_corange', :id => 'project_members_number' %> +
+