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/courses_controller.rb b/app/controllers/courses_controller.rb index e9b49b6fd..45a3f981b 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -379,6 +379,7 @@ class CoursesController < ApplicationController @no_group_count = @members_count - @course.members.where("course_group_id != 0").count @mem_pages = Paginator.new @members_count, @limit, @page @members = paginateHelper @all_members, @limit + @left_nav_type = 9 else render_403 return @@ -1202,7 +1203,7 @@ class CoursesController < ApplicationController #统计 def statistics_course - @left_nav_type = 9 + @left_nav_type = 10 respond_to do |format| format.html {render :layout => 'base_courses'} end @@ -1283,18 +1284,18 @@ class CoursesController < ApplicationController WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} AND student_works.user_id = members.user_id - ) AS score,(SELECT (message_num*2 + message_reply_num*1 + news_reply_num*1 + news_num*1 + + ) AS score,(SELECT max(message_num*2 + message_reply_num*1 + news_reply_num*1 + news_num*1 + resource_num*5 + journal_num*1 + homework_journal_num*1 ) FROM `course_contributor_scores` AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id ) AS act_score,(SELECT SUM(exercise_users.score) FROM exercise_users,exercises WHERE exercise_users.exercise_id = exercises.id AND exercises.course_id = #{@course.id} AND exercise_users.user_id = members.user_id) AS ex_score, - (SELECT student_id FROM user_extensions WHERE user_extensions.user_id = members.user_id) AS student_id, - (SELECT message_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_num, - (SELECT message_reply_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_reply_num, - (SELECT news_reply_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_reply_num, - (SELECT news_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_num, - (SELECT resource_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS resource_num, - (SELECT journal_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS journal_num, - (SELECT homework_journal_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS homework_journal_num, + (SELECT max(student_id) FROM user_extensions WHERE user_extensions.user_id = members.user_id) AS student_id, + (SELECT max(message_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_num, + (SELECT max(message_reply_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_reply_num, + (SELECT max(news_reply_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_reply_num, + (SELECT max(news_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_num, + (SELECT max(resource_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS resource_num, + (SELECT max(journal_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS journal_num, + (SELECT max(homework_journal_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS homework_journal_num, (SELECT COUNT(ss.id) FROM student_works AS ss ,homework_commons AS hc WHERE ss.homework_common_id = hc.id AND hc.course_id = #{@course.id} AND ss.work_status != 0 AND ss.user_id = members.user_id) AS homework_num, (SELECT COUNT(eu.id) FROM exercise_users AS eu,exercises WHERE eu.exercise_id = exercises.id AND exercises.course_id = #{@course.id} AND exercises.end_time >= eu.created_at AND eu.user_id = members.user_id) AS exercise_num FROM members @@ -1308,18 +1309,18 @@ class CoursesController < ApplicationController WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} AND student_works.user_id = members.user_id - ) AS score,(SELECT (message_num*2 + message_reply_num*1 + news_reply_num*1 + news_num*1 + + ) AS score,(SELECT max(message_num*2 + message_reply_num*1 + news_reply_num*1 + news_num*1 + resource_num*5 + journal_num*1 + homework_journal_num*1 ) FROM `course_contributor_scores` AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id ) AS act_score,(SELECT SUM(exercise_users.score) FROM exercise_users,exercises WHERE exercise_users.exercise_id = exercises.id AND exercises.course_id = #{@course.id} AND exercise_users.user_id = members.user_id) AS ex_score, - (SELECT student_id FROM user_extensions WHERE user_extensions.user_id = members.user_id) AS student_id, - (SELECT message_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_num, - (SELECT message_reply_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_reply_num, - (SELECT news_reply_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_reply_num, - (SELECT news_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_num, - (SELECT resource_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS resource_num, - (SELECT journal_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS journal_num, - (SELECT homework_journal_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS homework_journal_num, + (SELECT max(student_id) FROM user_extensions WHERE user_extensions.user_id = members.user_id) AS student_id, + (SELECT max(message_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_num, + (SELECT max(message_reply_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_reply_num, + (SELECT max(news_reply_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_reply_num, + (SELECT max(news_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_num, + (SELECT max(resource_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS resource_num, + (SELECT max(journal_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS journal_num, + (SELECT max(homework_journal_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS homework_journal_num, (SELECT COUNT(ss.id) FROM student_works AS ss ,homework_commons AS hc WHERE ss.homework_common_id = hc.id AND hc.course_id = #{@course.id} AND ss.work_status != 0 AND ss.user_id = members.user_id) AS homework_num, (SELECT COUNT(eu.id) FROM exercise_users AS eu,exercises WHERE eu.exercise_id = exercises.id AND exercises.course_id = #{@course.id} AND exercises.end_time >= eu.created_at AND eu.user_id = members.user_id) AS exercise_num FROM members @@ -1337,14 +1338,14 @@ class CoursesController < ApplicationController resource_num*5 + journal_num*1 + homework_journal_num*1 ) FROM `course_contributor_scores` AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id ) AS act_score,(SELECT SUM(exercise_users.score) FROM exercise_users,exercises WHERE exercise_users.exercise_id = exercises.id AND exercises.course_id = #{@course.id} AND exercise_users.user_id = members.user_id) AS ex_score, - (SELECT student_id FROM user_extensions WHERE user_extensions.user_id = members.user_id) AS student_id, - (SELECT message_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_num, - (SELECT message_reply_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_reply_num, - (SELECT news_reply_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_reply_num, - (SELECT news_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_num, - (SELECT resource_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS resource_num, - (SELECT journal_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS journal_num, - (SELECT homework_journal_num FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS homework_journal_num, + (SELECT max(student_id) FROM user_extensions WHERE user_extensions.user_id = members.user_id) AS student_id, + (SELECT max(message_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_num, + (SELECT max(message_reply_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS message_reply_num, + (SELECT max(news_reply_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_reply_num, + (SELECT max(news_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS news_num, + (SELECT max(resource_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS resource_num, + (SELECT max(journal_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS journal_num, + (SELECT max(homework_journal_num) FROM course_contributor_scores AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id) AS homework_journal_num, (SELECT COUNT(ss.id) FROM student_works AS ss ,homework_commons AS hc WHERE ss.homework_common_id = hc.id AND hc.course_id = #{@course.id} AND ss.work_status != 0 AND ss.user_id = members.user_id) AS homework_num, (SELECT COUNT(eu.id) FROM exercise_users AS eu,exercises WHERE eu.exercise_id = exercises.id AND exercises.course_id = #{@course.id} AND exercises.end_time >= eu.created_at AND eu.user_id = members.user_id) AS exercise_num FROM members @@ -1383,27 +1384,32 @@ class CoursesController < ApplicationController #sheet1.row(0).default_format = blue #sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)]) sheet1[0,0] = "课程编号" - sheet1[0,1] = course.id - sheet1[1,0] = "课程学期" - sheet1[1,1] = course.time.to_s+"年"+course.term - sheet1[2,0] = "课程名称" - sheet1[2,1] = course.name - sheet1[3,0] = "教师团队" - sheet1[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、') - sheet1[4,0] = "主讲教师" - sheet1[4,1] = course.teacher.show_name - sheet1[5,0] = "排名" - sheet1[5,1] = "学生姓名" - sheet1[5,2] = "昵称" - sheet1[5,3] = "学号" + sheet1[0,1] = course.syllabus.id + sheet1[1,0] = "课程名称" + sheet1[1,1] = course.syllabus.title + sheet1[2,0] = "班级编号" + sheet1[2,1] = course.id + sheet1[3,0] = "班级学期" + sheet1[3,1] = course.time.to_s+"年"+course.term + sheet1[4,0] = "班级名称" + sheet1[4,1] = course.name + sheet1[5,0] = "教师团队" + sheet1[5,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、') + sheet1[6,0] = "主讲教师" + sheet1[6,1] = course.teacher.show_name + sheet1[7,0] = "排名" + sheet1[7,1] = "学生姓名" + sheet1[7,2] = "昵称" + sheet1[7,3] = "学号" for i in 0 ... homeworks.count - sheet1[5,i+4] = "第"+(i+1).to_s+"次" - end - sheet1[5,homeworks.count+4] = "作业得分" - sheet1[5,homeworks.count+5] = "测评得分" - sheet1[5,homeworks.count+6] = "社区得分" - sheet1[5,homeworks.count+7] = "总得分" - count_row = 6 + sheet1[7,i+4] = "第"+(i+1).to_s+"次" + end + sheet1[7,homeworks.count+4] = "作业得分" + sheet1[7,homeworks.count+5] = "测评得分" + sheet1[7,homeworks.count+6] = "社区得分" + sheet1[7,homeworks.count+7] = "总得分" + sheet1[7,homeworks.count+8] = "分班" + count_row = 8 members.each_with_index do |member, i| sheet1[count_row,0]= i+1 sheet1[count_row,1] = member.user.lastname.to_s + member.user.firstname.to_s @@ -1427,34 +1433,39 @@ class CoursesController < ApplicationController sheet1[count_row,homeworks.count+5] = ex_score sheet1[count_row,homeworks.count+6] = act_score sheet1[count_row,homeworks.count+7] = sum.round(2) + sheet1[count_row,homeworks.count+8] = member.course_group_id == 0 ? "暂无" : member.course_group.name count_row += 1 end homeworks.each_with_index do |home, i| sheet = book.create_worksheet :name => "第#{i+1}次作业" sheet[0,0] = "课程编号" - sheet[0,1] = course.id - sheet[1,0] = "课程学期" - sheet[1,1] = course.time.to_s+"年"+course.term - sheet[2,0] = "课程名称" - sheet[2,1] = course.name - sheet[3,0] = "教师团队" - sheet[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、') - sheet[4,0] = "主讲教师" - sheet[4,1] = course.teacher.show_name - sheet[4,0] = "作业批次" - sheet[4,1] = "第#{i+1}次作业" - sheet[4,0] = "作业名称" - sheet[4,1] = home.name + sheet[0,1] = course.syllabus.id + sheet[1,0] = "课程名称" + sheet[1,1] = course.syllabus.title + sheet[2,0] = "班级编号" + sheet[2,1] = course.id + sheet[3,0] = "班级学期" + sheet[3,1] = course.time.to_s+"年"+course.term + sheet[4,0] = "班级名称" + sheet[4,1] = course.name + sheet[5,0] = "教师团队" + sheet[5,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、') + sheet[6,0] = "主讲教师" + sheet[6,1] = course.teacher.show_name + sheet[6,0] = "作业批次" + sheet[6,1] = "第#{i+1}次作业" + sheet[6,0] = "作业名称" + sheet[6,1] = home.name if home.homework_type == 1 #普通作业 if home.anonymous_comment ==0 - sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des), + sheet.row(7).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des), l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)]) else - sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des), + sheet.row(7).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des), l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)]) end - count_row = 6 + count_row = 8 items = home.student_works.order("work_score desc") items.each_with_index do |stu, j| sheet[count_row,0]= j + 1 @@ -1480,13 +1491,13 @@ class CoursesController < ApplicationController end elsif home.homework_type == 2 #编程作业 if home.anonymous_comment ==0 - sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des), + sheet.row(7).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des), l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)]) else - sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des), + sheet.row(7).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des), l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)]) end - count_row = 6 + count_row = 8 items = home.student_works.order("work_score desc") items.each_with_index do |stu, j| sheet[count_row,0]= j + 1 @@ -1513,13 +1524,13 @@ class CoursesController < ApplicationController end elsif home.homework_type == 3 #分组作业 if home.anonymous_comment ==0 - sheet.row(5).concat([l(:excel_rank),l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des), + sheet.row(7).concat([l(:excel_rank),l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des), l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)]) else - sheet.row(5).concat([l(:excel_rank),l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des), + sheet.row(7).concat([l(:excel_rank),l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des), l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)]) end - count_row = 6 + count_row = 8 items = home.student_works.order("work_score desc") items.each_with_index do |stu, j| sheet[count_row,0] = j + 1 diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 6fb2868bc..0940dbdf8 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -58,65 +58,104 @@ class IssuesController < ApplicationController include ApplicationHelper def index - retrieve_query - sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) - sort_update(@query.sortable_columns) - @query.sort_criteria = sort_criteria.to_a - - @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 + # 为了性能所有用了两种模式,issue的@query查询所有的没有优势 + # 但是对过滤条件很有有时 + if params[:set_filter] != "1" + @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base' + if User.current.member_of?(@project) + @issues_filter = Issue.where(:project_id => @project.id).order('updated_on desc') + else + @issues_filter = Issue.where(:project_id => @project.id, :is_private => 0).order('updated_on desc') end - @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] - @issue_count = @query.issue_count - @issue_pages = Paginator.new @issue_count, @limit, params['page'] - params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 + open_and_close_num(@project) + @issue_count = @issues_filter.count + @limit = 10 + @is_remote = true + @issue_pages = Paginator.new @issue_count, @limit, params['page'] || 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] - end - @issue_count_by_group = @query.issue_count_by_group + @issues = paginateHelper @issues_filter, @limit 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.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)) } - # 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') } end else - respond_to do |format| - format.html { render(:template => 'issues/index', :layout => @project_base_tag) }#by young - format.any(:atom, :csv, :pdf) { render(:nothing => true) } - format.api { render_validation_errors(@query) } - format.js + retrieve_query + sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) + sort_update(@query.sortable_columns) + @query.sort_criteria = sort_criteria.to_a + @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base' + if @query.valid? + @tracker_id = params[:tracker_id] + @assign_to_id = params[:assigned_to_id] + @author_id = params[:author_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 + @test = params[:test] + @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 + open_and_close_num(@project) + @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(: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 + 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.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| + format.html { render(:template => 'issues/index', :layout => @project_base_tag) }#by young + format.any(:atom, :csv, :pdf) { render(:nothing => true) } + format.api { render_validation_errors(@query) } + format.js + end end end rescue ActiveRecord::RecordNotFound render_404 end + # 获取issue的开启统计数 + def open_and_close_num project + if User.current.member_of?(project) + @issue_open_count = Issue.where("project_id=#{project.id} and status_id in (1,2,3,4,6)").count + @issue_close_count = Issue.where(:project_id => project.id, :status_id => 5 ).count + else + @issue_open_count = Issue.where("project_id=#{project.id} and status_id in (1,2,3,4,6) and is_private = 0").count + @issue_close_count = Issue.where(:project_id => project.id, :status_id => 5, :is_private => 0).count + end + end + def show # 打开编辑内容 @is_edit = true unless params[:edit].nil? diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index a79890870..d4042abf5 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_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/student_work_controller.rb b/app/controllers/student_work_controller.rb index a0d981b22..27b6ed272 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -106,13 +106,13 @@ class StudentWorkController < ApplicationController rescue Timeout::Error tEndtime = Time.now tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.debug "program_test_ex user wait time = #{tUsedtime} 毫秒" + logger.info "program_test_ex user wait time = #{tUsedtime} 毫秒" #status 0:答案正确 -5program_test_ex 函数出错 -4judge代码出错 -3http超时 -2:编译错误 -1:答案错误 2:程序运行超时 resultObj[:status] = -3 CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>-3,:wait_time=>tUsedtime,:student_work_id=>student_work.id) rescue => e #-4 judge代码 出错 - logger.debug "program_test_error #{e}" + logger.info "program_test_error #{e}" resultObj[:status] = -4 tmpstatus = -4 CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>0,:wait_time=>0,:student_work_id=>student_work.id) @@ -217,7 +217,7 @@ class StudentWorkController < ApplicationController end rescue #-5 program_test_ex 函数出错 - logger.debug "program_test_error 2" + logger.info "program_test_error 2" resultObj[:status] = -5 tmpstatus = -5 CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>0,:wait_time=>0,:student_work_id=>student_work.id) diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index defc36868..7e9d63e58 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,11 @@ 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 c3e0bee54..ef606c0cb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -63,6 +63,69 @@ module ApplicationHelper result end + # 项目版本库导出Excel功能 + def export_rep_xls(gpid, options = {}) + g = Gitlab.client + cycle = params[:cycle] + rev = params[:rev] + if cycle == "week" + statics = g.rep_stats_week(gpid, :rev => rev) + elsif cycle == "month" + statics = g.rep_stats_month(gpid, :rev => rev) + end + 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_changeset),l(:rep_code_add),l(:rep_code_delete),l(:rep_code_modified),l(:rep_sode_time),l(:rep_sode_cycle),l(:rep_author_mail)]) + 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.commits_num + sheet1[count_row,3] = static.add + sheet1[count_row,4] = static.del + sheet1[count_row,5] = static.changes + sheet1[count_row,6] = Time.now.strftime('%Y-%m-%d %H:%M:%S') + sheet1[count_row,7] = cycle == "week" ? "最近1周" : "最近一月" + sheet1[count_row,8] = static.email + 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(:milestone),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.gsub(/<\/?.*?>/,"")).html_safe + 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.nil? ? issue.created_on : issue.created_on.strftime('%Y-%m-%d %H:%M:%S') + sheet1[count_row,9] = issue.fixed_version.try(:name) + sheet1[count_row,10] = issue.start_date.nil? ? issue.start_date : issue.start_date.strftime('%Y-%m-%d') + sheet1[count_row,11] = issue.due_date.nil? ? issue.due_date : issue.due_date.strftime('%Y-%m-%d') + 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 +1862,11 @@ 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 + + def link_to_function_none(name, function, html_options={}) + content_tag(:a, name, {:href => '#', :onclick => "#{function}; return false;"}.merge(:style => "display:inline-block; height:20px; line-height:20px;")) end # Helper to render JSON in views @@ -1821,8 +1888,8 @@ module ApplicationHelper end def check_all_links(form_name) - link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") + "  ".html_safe + " | "+ "  ".html_safe + - link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") + link_to_function_none(l(:button_check_all), "checkAll('#{form_name}', true)") + "  ".html_safe + " | "+ "  ".html_safe + + link_to_function_none(l(:button_uncheck_all), "checkAll('#{form_name}', false)") end # 本次修改,修改为只显示关闭的所占%比 diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 5a124849f..7aec64718 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..05ce3bcac 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -1,16 +1,10 @@ -
+

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

<%= form_tag({:controller => 'calendars', :action => 'show', :project_id => @project}, :method => :get, :id => 'query_form') do %> <%= hidden_field_tag 'set_filter', '1' %> -
"> - <%= l(:label_filter_plural) %> -
"> - <%= render :partial => 'queries/filters', :locals => {:query => @query} %> -
-

<%= link_to_previous_month(@year, @month) %> | <%= link_to_next_month(@year, @month) %>

@@ -40,3 +34,7 @@ <% end %> <% html_title(l(:label_calendar)) -%> + + diff --git a/app/views/common/_calendar.html.erb b/app/views/common/_calendar.html.erb index e4ce4da2c..2f4c61a77 100644 --- a/app/views/common/_calendar.html.erb +++ b/app/views/common/_calendar.html.erb @@ -1,4 +1,4 @@ - +
@@ -20,13 +20,13 @@
<%= h("#{i.project} -") unless @project && @project == i.project %> <%= link_to_issue i, :truncate => 30 %> + (<%= states_done_ratio i %>) <%= render_issue_tooltip i %>
<% else %> - - <%= h("#{i.project} -") unless @project && @project == i.project %> - <%= link_to_version i%> - + + <%= h("#{i.project} -") unless @project && @project == i.project %> + <%= link_to_version i%> <% end %> <% end %> diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index 0aefb0d18..05691db9e 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -7,9 +7,9 @@ span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} div.ke-toolbar .ke-outline{border:none;} - div.respond-form .reply_btn{margin-left:565px;margin-top:5px;} + div.respond-form .reply_btn{margin-left:625px;margin-top:5px;} div.recall_con{width:570px;} - div.recall_con .reply_btn{margin-left:525px;margin-top:5px;} + div.recall_con .reply_btn{margin-left:585px;margin-top:5px;} /*.ke-container{height: 80px !important;}*/ <%= content_for(:header_tags) do %> @@ -19,7 +19,7 @@ -
+

<%= l(:label_leave_message) %>

<% if !User.current.logged?%> diff --git a/app/views/courses/_history.html.erb b/app/views/courses/_history.html.erb index 35e0726a8..eb7ecff7a 100644 --- a/app/views/courses/_history.html.erb +++ b/app/views/courses/_history.html.erb @@ -5,7 +5,7 @@
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
-
+
diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index e3e75e7cc..681838599 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -118,8 +118,8 @@ <% else %> <%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id,:user_id => member.user_id},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
- <%=member.course_group_id == 0 ? "暂无" : member.course_group.name %> - + +
<%= select( :name,:group_id, course_group_option(@course), { :include_blank => false,:selected => member.course_group_id}, @@ -178,14 +178,14 @@ $(id).submit(); } - $(".sum_score_tip").each(function(){ + $(".sy_new_table tr").each(function(){ $(this).mouseenter(function(){ $(".sy_tips_box_inner").hide(); - $(this).next().stop(); - $(this).next().show(); + $(this).children().eq(6).children().eq(1).stop(); + $(this).children().eq(6).children().eq(1).show(); }); $(this).mouseleave(function(){ - $(this).next().delay(500).hide(0); + $(this).children().eq(6).children().eq(1).delay(500).hide(0); }); }); diff --git a/app/views/courses/_tool_expand.html.erb b/app/views/courses/_tool_expand.html.erb index 8f9530e35..e5fcd8314 100644 --- a/app/views/courses/_tool_expand.html.erb +++ b/app/views/courses/_tool_expand.html.erb @@ -45,7 +45,8 @@ <%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %> <% end %> -<% if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) || User.current.admin? %> +<% group_count = @course.course_groups.count %> +<% if show_nav?(group_count) && ((User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) || User.current.admin?) %>
  • <%=link_to "分班", course_member_path(@course, :role => 2) %>
  • diff --git a/app/views/courses/feedback.html.erb b/app/views/courses/feedback.html.erb index 5eae03656..3b2d3030c 100644 --- a/app/views/courses/feedback.html.erb +++ b/app/views/courses/feedback.html.erb @@ -2,7 +2,7 @@
    -
    +

    <%= l(:label_contest_userresponse) %>

    diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index 36e991f41..2d2eecab1 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,4 +1,4 @@ -<% if @role == 1 %> +<% if @role.to_i == 1 %>

    <%= @subPage_title%>

    diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 2808a99cc..759f8c232 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -1,321 +1,323 @@ -
    -

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

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

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

    - -

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

    -<% 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;' - %> - <%= 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)) %> -
    - -<% other_formats_links do |f| %> - <%= f.link_to 'PDF', :url => params.merge(@gantt.params) %> - <%= f.link_to('PNG', :url => params.merge(@gantt.params)) if @gantt.respond_to?('to_image') %> -<% end %> -<% end # query.valid? %> - -<% content_for :sidebar do %> - <%= render :partial => 'issues/sidebar' %> -<% end %> - -<% html_title(l(:label_gantt)) -%> - -<% content_for :header_tags do %> - <%= javascript_include_tag 'raphael' %> - <%= javascript_include_tag 'gantt' %> -<% end %> - -<%= javascript_tag do %> - var issue_relation_type = <%= raw Redmine::Helpers::Gantt::DRAW_TYPES.to_json %>; - $(document).ready(drawGanttHandler); - $(window).resize(drawGanttHandler); - $(function() { - $("#draw_rels").change(drawGanttHandler); - $("#draw_progress_line").change(drawGanttHandler); - }); -<% end %> +
    +

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

    +
    + +<%= form_tag({:controller => 'gantts', :action => 'show', + :project_id => @project, :month => params[:month], + :year => params[:year], :months => params[:months]}, + :method => :get, :id => 'query_form') do %> +<%= hidden_field_tag 'set_filter', '1' %> + + + + + + + + + + + + + +

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

    +<% 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 %> + +<%# 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)) %> +
    + + +<% end # query.valid? %> + +<% content_for :sidebar do %> + <%= render :partial => 'issues/sidebar' %> +<% end %> + +<% html_title(l(:label_gantt)) -%> + +<% content_for :header_tags do %> + <%= javascript_include_tag 'raphael' %> + <%= javascript_include_tag 'gantt' %> +<% end %> + +<%= javascript_tag do %> + var issue_relation_type = <%= raw Redmine::Helpers::Gantt::DRAW_TYPES.to_json %>; + $(document).ready(drawGanttHandler); + $(window).resize(drawGanttHandler); + $(function() { + $("#draw_rels").change(drawGanttHandler); + $("#draw_progress_line").change(drawGanttHandler); + }); +<% end %> + + diff --git a/app/views/issues/_all_list.html.erb b/app/views/issues/_all_list.html.erb new file mode 100644 index 000000000..afd630b2c --- /dev/null +++ b/app/views/issues/_all_list.html.erb @@ -0,0 +1,16 @@ +<% issue_list(issues) do |issue, level| -%> + + <%= render :partial => 'issues/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %> +<% end %> +
    +
    + +
    +
    +
    diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 9dba6a6c8..f7d7b4d50 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -25,6 +25,14 @@
  • + + +
  • +
  • <% if @issue.safe_attribute? 'assigned_to_id' %> @@ -36,7 +44,7 @@
  • <% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %> - + <%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), {:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true}, :class => "w150" %> @@ -74,7 +82,13 @@ <% if @issue.safe_attribute? 'estimated_hours' %> <%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('estimated_hours') %> - <%= l(:field_hours) %> + <% end %> +
  • +
    +
  • + + <% if @issue.safe_attribute? 'estimated_hours' %> + <%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true %> <% end %>
  • diff --git a/app/views/issues/_attributes_show.html.erb b/app/views/issues/_attributes_show.html.erb index 15160facb..7ff59fd9d 100644 --- a/app/views/issues/_attributes_show.html.erb +++ b/app/views/issues/_attributes_show.html.erb @@ -40,7 +40,7 @@ <% end %>
    <% unless @issue.disabled_core_fields.include?('fixed_version_id') %> -
  •  目标版本  : 

    <%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %> +
  •  <%=l(:milestone)%>  : 

    <%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %>
  • <% end %>
    diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index 1be21cbc1..5a0820092 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -18,6 +18,10 @@ <% end %> + + + +
    diff --git a/app/views/issues/_issue_filter.html.erb b/app/views/issues/_issue_filter.html.erb new file mode 100644 index 000000000..07ebb047f --- /dev/null +++ b/app/views/issues/_issue_filter.html.erb @@ -0,0 +1 @@ +<%= @issues_filter_assign_count %> \ No newline at end of file diff --git a/app/views/issues/_issue_filter_all.html.erb b/app/views/issues/_issue_filter_all.html.erb new file mode 100644 index 000000000..64242df9b --- /dev/null +++ b/app/views/issues/_issue_filter_all.html.erb @@ -0,0 +1 @@ +<%= @issue_count %> \ No newline at end of file diff --git a/app/views/issues/_issue_filter_author.html.erb b/app/views/issues/_issue_filter_author.html.erb new file mode 100644 index 000000000..8b9bed9f9 --- /dev/null +++ b/app/views/issues/_issue_filter_author.html.erb @@ -0,0 +1 @@ +<%= @issues_filter_author_count %><%#= @project.issues.where(:author_id => User.current.id ).visible.all.count %> \ No newline at end of file diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 0eb3b4a0c..4fee89d6a 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -6,6 +6,11 @@ <%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %> <% end %> - <% if issues.count == 10%> - <%= link_to "点击展开更多",project_issues_path({:project_id => project.id}.merge(params)),:id => "show_more_issues",:remote => "true",:class => "loadMore mt10 f_grey"%> - <% end%> +
    +
    + +
    +
    +
    diff --git a/app/views/issues/_new_issue_list.html.erb b/app/views/issues/_new_issue_list.html.erb new file mode 100644 index 000000000..494ea48ed --- /dev/null +++ b/app/views/issues/_new_issue_list.html.erb @@ -0,0 +1,93 @@ +
    +
    + 新 增 + + 导出EXCEL +
    + <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> + <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'true', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %> + <%= hidden_field_tag 'set_filter', '1' %> +
    + + 清除 +
    + + + <%= calendar_for('issue_create_date_end_show')%> +
    +
    + + + <%= calendar_for('issue_create_date_start_show')%> +
    + + + + +
    + +
    + +
    +
    + <%= select(:issue, :tracker_id, [["缺陷",1],["功能",2],["支持",3],["任务",4],["周报",5]].unshift(["类型",0]), + {:include_blank => false, :selected => @tracker_id ? @tracker_id : 0}, + {:onchange => "remote_function();", :id => "tracker_id", :name => "tracker_id", :class => "fl issues_filter_select_min"}) %> + <%= select( :issue, :user_id, principals_options_for_isuue_list(@project), + { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0}, + {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"fl"}) + %> + + <%= select(:issue, :fixed_version_id, options_for_version_isuue_list(@project), + {:include_blank => false, :selected => @fixed_version_id ? @fixed_version_id : 0}, + {:onchange => "remote_function();", :id => "fixed_version_id", :name => "fixed_version_id", :class => "f1"}) %> + + <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), + { :include_blank => false,:selected=>@status_id ? @status_id : 0 + }, + {:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"fl issues_filter_select_min"} + ) %> + + <%= select(:issue, :done_ratio, [["10%",1],["20%",2],["30%",3],["40%",4],["50%",5],["60%",6],["70%",7],["80%",8],["90%",9],["10%",10]].unshift(["完成度",0]), + {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0 }, + {:onchange => "remote_function();", :id => "done_ratio", :name => "done_ratio", :class => "f1"}) %> + + <%= select(:issue, :test, [["最早创建",1],["最早更新",2]].unshift(["排序",0]), + {:include_blank => false, :selected => @order ? @order : 0 }, + {:onchange => "remote_function();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %> +
    +
    +
    + <% if @issues.empty? %> +

    <%= l(:label_no_data) %>

    + <% else %> +
    + <%= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> +
    + <% end %> + <%#= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> +
    + + <% end %> + <% end %> +
    diff --git a/app/views/issues/_project_issue.html.erb b/app/views/issues/_project_issue.html.erb new file mode 100644 index 000000000..25b7a6954 --- /dev/null +++ b/app/views/issues/_project_issue.html.erb @@ -0,0 +1,99 @@ +<% unless activity.author.nil? %> +
    +
    + <% if activity.status_id.to_i == 5 %> + + <% else %> + + <% end %> +
    +
    + +
    + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "fl issues_list_name" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "fl issues_list_name" %> + <% end %> +

    <%=format_time(activity.created_on) %>发布

    +
    +
    + +
    +<% end %> + + + diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index e4557b787..655f0714a 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -2,7 +2,20 @@ <%= import_ke(enable_at: true,init_activity: true) %> <% end %> - -
    -
    -
    <%= l(:label_issue_tracking) %>
    -
    -
    - <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> - <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'true', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %> - <%= hidden_field_tag 'set_filter', '1' %> - - <%#= link_to '新建问题', new_project_issue_path(@project) , :class => "green_u_btn fr ml10" %> -

    <%= 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 %> -

    - -
    -
    - - <%= select( :issue, :user_id, principals_options_for_isuue_list(@project), - { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0 - }, - {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"w90 mr18"} - ) - %> - <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), - { :include_blank => false,:selected=>@priority_id ? @priority_id : 0 - }, - {:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"w90 mr18"} - ) - %> - <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), - { :include_blank => false,:selected=>@status_id ? @status_id : 0 - }, - {:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"w90 mr18"} - ) - %> - <%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]), - { :include_blank => false,:selected=>@author_id ? @author_id : 0 - }, - {:onchange=>"remote_function();",:id=>"author_id",:name=>"author_id",:class=>"w90 mr18"} - ) - %> -
    -
    -
     
    -
    - - <%= text_field_tag 'issue_create_date_start_show', '创建日期起始',:readonly=>true, :size=>13, :nhname=>'date_show',:style=>'float:left;'%> - <%= calendar_for('issue_create_date_start_show') %> + +
    +
    + + <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> + <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'xls', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %> + <%= hidden_field_tag 'set_filter', '1' %> + <%= hidden_field_tag 'export_issue_hidden', '0' %> + +
    + + 清除 + +
    + + + <%= calendar_for('issue_create_date_end_show')%>
    -
     - 
    -
    - - <%= text_field_tag 'issue_create_date_end_show', '创建日期结束',:readonly=>true, :size=>13, :nhname=>'date_show',:style=>'float:left;'%> - <%= calendar_for('issue_create_date_end_show') %> +
    + + + <%= calendar_for('issue_create_date_start_show')%>
    -
    -
    - <% end %> + + +
    -
    - <% end %> -
    +
    +
      +
    • + 所有 + <%= render :partial => "issues/issue_filter_all" %> +
    • + +
      -
      - <% if !@query.new_record? && @query.editable_by?(User.current) %> - <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> - <%= delete_link query_path(@query) %> - <% end %> -
      - <% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> -
      -
      +
    - <%= error_messages_for 'query' %> - <% if @query.valid? %> - <% if @issues.empty? %> -

    - <%= l(:label_no_data) %> -

    - <% else %> -
    - <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> -
    +
    +
    + <%= select(:issue, :tracker, [["缺陷",1],["功能",2],["支持",3],["任务",4],["周报",5]].unshift(["类型",0]), + {:include_blank => false, :selected => @tracker_id ? @tracker_id : 0}, + {:onchange => "remote_function();", :id => "tracker_id", :name => "tracker_id", :class => "fl issues_filter_select_min"}) %> - <% end %> + <%#= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]), + { :include_blank => false,:selected=>@author_id ? @author_id : 0}, + {:onchange=>"remote_function();",:id=>"author_id",:name=>"author_id",:class=>"fl "} + ) + %> + + <%= select( :issue, :user_id, principals_options_for_isuue_list(@project), + { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0 + }, + {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"fl"} + ) + %> + <%= select(:issue, :fixed_version, options_for_version_isuue_list(@project), + {:include_blank => false, :selected => @fixed_version_id ? @fixed_version_id : 0}, + {:onchange => "remote_function();", :id => "fixed_version_id", :name => "fixed_version_id", :class => "fl"}) %> + + <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), + { :include_blank => false,:selected=>@status_id ? @status_id : 0 + }, + {:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"fl issues_filter_select_min"} + ) + %> + <%#= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), + { :include_blank => false,:selected=>@priority_id ? @priority_id : 0 + }, + {:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"fl"} + ) + %> + + <%#= select(:issue, :done_ratio, [["10%",1],["20%",2],["30%",3],["40%",4],["50%",5],["60%",6],["70%",7],["80%",8],["90%",9],["100%",10]].unshift(["完成度",0]), + {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0 }, + {:onchange => "remote_function();", :id => "done_ratio", :name => "done_ratio", :class => "f1"}) %> + <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }).unshift(["完成度",-1]), + {:include_blank => false, :selected => @done_ratio ? @done_ratio : -1}, + {:onchange=>"remote_function();",:id=>"done_ratio",:name=>"done_ratio",:class=>"fl"}) %> + + + <%#= select(:issue, :test, [["最新创建",1],["最早创建",2],["最近更新",3],["最早更新", 4]].unshift(["排序",0]), + {:include_blank => false, :selected => @order ? @order : 0 }, + {:onchange => "remote_function();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %> + + <%= select(:issue, :test, [["最新创建",1],["最早创建",2],["最近更新",3],["最早更新", 4]].unshift(["排序",0]), + {:include_blank => false, :selected => @test ? @test : 0 }, + {:onchange => "remote_function();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %> + + <%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]), + { :include_blank => false,:selected=>@author_id ? @author_id : 0}, + {:onchange=>"remote_function();",:id=>"author_id",:name=>"author_id",:style=>"display:none;"} + ) + %> - - - - - - - - - - <% end %> - <%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> - <% content_for :sidebar do %> - <%= render :partial => 'issues/sidebar' %> - <% end %> - <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, - {:query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_issue_plural)) %> - <%= auto_discovery_link_tag(:atom, - {:controller => 'journals', :action => 'index', - :query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_changes_details)) %> + + + + + <%#= select(:issue, :tracker_id, [["缺陷",1],["功能",2],["支持",3],["任务",4],["周报",5]].unshift(["类型",0]), + {:include_blank => false, :selected => @tracker_id ? @tracker_id : 0}, + {:onchange => "remote_function();", :id => "tracker_id", :name => "tracker_id", :class => "fl issues_filter_select_min"}) %> + <%#= select( :issue, :user_id, principals_options_for_isuue_list(@project), + { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0}, + {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"fl"}) + %> + + <%#= select(:issue, :fixed_version_id, options_for_version_isuue_list(@project), + {:include_blank => false, :selected => @fixed_version_id ? @fixed_version_id : 0}, + {:onchange => "remote_function();", :id => "fixed_version_id", :name => "fixed_version_id", :class => "f1"}) %> + + <%#= select( :issue, :status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), + { :include_blank => false,:selected=>@status_id ? @status_id : 0 + }, + {:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"fl issues_filter_select_min"} + ) %> + + <%#= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), + {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0}, + {:onchange=>"remote_function();",:id=>"done_ratio",:name=>"done_ratio",:class=>"fl"}) %> + + <%#= select(:issue, :done_ratio, [["10%",1],["20%",2],["30%",3],["40%",4],["50%",5],["60%",6],["70%",7],["80%",8],["90%",9],["10%",10]].unshift(["完成度",0]), + {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0 }, + {:onchange => "remote_function();", :id => "done_ratio", :name => "done_ratio", :class => "f1"}) %> + + <%#= select(:issue, :test, [["最早创建",1],["最早更新",2]].unshift(["排序",0]), + {:include_blank => false, :selected => @order ? @order : 0 }, + {:onchange => "remote_function();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %> +
    +
    +
    + <% end %> <% end %> + <% if @issues.empty? %> +

    <%= l(:label_no_data) %>

    + <% else %> +
    + <%= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> +
    + <% end %> + <%#= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> +
    - <%= context_menu issues_context_menu_path %> -
    \ No newline at end of file +
    +
    diff --git a/app/views/issues/index.js.erb b/app/views/issues/index.js.erb index 399c6a977..f792cf70f 100644 --- a/app/views/issues/index.js.erb +++ b/app/views/issues/index.js.erb @@ -1,6 +1,7 @@ //$("#issue_list").html("<%#= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>"); -<% if @set_filter && @issue_pages.page == 1%> //只有搜索的第一页才需要替换整个issue_list,其余的都是替换show_more_issues - $("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project})%>"); -<%else%> - $("#show_more_issues").replaceWith("<%= escape_javascript( render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project} )%>"); -<%end%> +//$("#issue_assigned_count").html("<%#= escape_javascript(render :partial => 'issues/issue_filter') %>"); +$("#issue_filter_all").html("<%= escape_javascript(render :partial => 'issues/issue_filter_all') %>"); +//$("#issue_author_count").html("<%#= escape_javascript(render :partial => 'issues/issue_filter_author') %>"); +$("#issue_list").html("<%= escape_javascript(render :partial => 'issues/all_list',:locals => {:issues => @issues, :query => @query, :issue_pages=> @issue_pages, :issue_count => @issue_count, :project=> @project})%>"); +$("#issue_list_pagination").html('<%= pagination_links_full @issue_pages, @issue_count, :issues => @issues, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>'); + diff --git a/app/views/layouts/_base_project_top.html.erb b/app/views/layouts/_base_project_top.html.erb new file mode 100644 index 000000000..2610b585b --- /dev/null +++ b/app/views/layouts/_base_project_top.html.erb @@ -0,0 +1,46 @@ +
    + + <%# 更新访问数,刷新的时候更新访问次数 %> + <% update_visiti_count @project %> +

    <%= l(:label_project_ivite_code)%>
    <%= (User.current.member_of?(@project) || User.current.admin?) ? @project.invite_code : "******" %>

    +
    +
    +

    + <%= @project.creater %>/ + <%= @project.name %> +

    + <%= @project.is_public? ? l(:label_public) : l(:label_private) %> +
    +

    + 项目评分: + <% 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 %> + 关注:<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'sy_corange' %> + 成员:<%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'sy_corange', :id => 'project_members_number' %> +

    +
    + <%= render 'layouts/join_exit_project' %> +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb index 7d2f1b4d2..4166256ab 100644 --- a/app/views/layouts/_join_exit_project.html.erb +++ b/app/views/layouts/_join_exit_project.html.erb @@ -1,19 +1,18 @@ -
    + -
    - <%= render :partial => "projects/applied_status" %> -
    + <%= render :partial => "projects/applied_status" %> + <% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %> - <%= link_to "#{l(:button_configure)}".html_safe, settings_project_path(@project), :class => "pr_join_a" %> + <%= link_to "#{l(:button_configure)}", settings_project_path(@project), :class => "sy_btn_blue mr5" %> <% end %> - <% if (User.current.login? && User.current.member_of?(@project) && Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager")) || User.current.admin? %> - <%= link_to "#{text}".html_safe,"javascript:void(0)" ,:onClick => "show_window();", :class => "pr_join_a",:id => "setting_project_type"%> - <% end %> + + + <% if (User.current.member_of? @project) && User.current.login? && !User.current.admin && !Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %> <%= exit_project_link(@project) %> <% end %> -
    + diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 57d1ceda6..f80977927 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -18,7 +18,7 @@ <% end %> diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index bc21ff8d2..18d56fc72 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -8,7 +8,7 @@
    diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 84aa054e0..fe400bfbc 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -110,9 +110,16 @@ <%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %> <% end %> + <% group_count = @course.course_groups.count %> + <% if !show_nav?(group_count) && ((User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) || User.current.admin?) %> +
  • + 分班<%=group_count %> + +
  • + <% end %> <% statistics_count = 0 %> <% unless show_nav?(statistics_count) %> -
  • +
  • 统计
  • diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index d3e72cc5a..b0de79d7c 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -12,7 +12,7 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','prettify','repository' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','prettify','repository','css/gantt', 'css/calendar' %> <%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %> <%= call_hook :view_layouts_base_html_head %> @@ -47,88 +47,17 @@
    + <%= render :partial => 'layouts/base_project_top' %>
    -
    - -
    - <%= l(:label_project_ivite_code)%> - <%= (User.current.member_of?(@project) || User.current.admin?) ? @project.invite_code : "******" %> -
    - -
    - <% text = @project.project_new_type == 1 ? l(:label_development_team) : (@project.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%> - <% typeclass = @project.project_new_type == 1 ? "pr_kafa" : (@project.project_new_type == 2 ? "pr_keyan" : "pr_friend")%> - <%= render 'layouts/join_exit_project',{:text => text, :typeclass => typeclass} %> -
    - -
    -
    - <%= link_to "#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %> - <% if @project.is_public? %> - <%= l(:label_public)%> - <% else %> - <%= l(:label_private)%> - <% end %> -
    -
    - <%# 更新访问数,刷新的时候更新访问次数 %> - <% update_visiti_count @project %> - <%# over %> -
    - <% if @project.project_type == 0 %> - <% unless static_project_score(@project.project_score) == 0 %> - <%= l(:label_project_score)%> : - <%= link_to(format("%.2f" ,static_project_score(@project.project_score)).to_i, - {:controller => 'projects', - :action => 'show_projects_score', - :remote => true, - :id => @project.id}, :class => "c_orange f14" ) %> - <% end %> - <% end %> -
    - - -
    - <%= l(:label_member) %>(<%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue', :id => 'project_members_number' %>) - - <%= l(:label_user_watcher) %>(<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>) - <% unless @project.enabled_modules.where("name = 'files'").empty? %> - - <%= l(:project_module_attachments) %>( - <% @project.project_score.attach_num %> - <%= link_to "#{@project.project_score.attach_num }", project_files_path(@project), :class => 'info_foot_num c_blue', :id=>'project_files_count_info' %>) - <% end %> -
    -
    -
    - +
    -
    @@ -155,7 +84,6 @@
    -
    访问计数 <%= @project.visits.to_i %> (自2016年5月)
    diff --git a/app/views/my/save_user_avatar.js.erb b/app/views/my/save_user_avatar.js.erb index 9e8a58e51..7bc4ab632 100644 --- a/app/views/my/save_user_avatar.js.erb +++ b/app/views/my/save_user_avatar.js.erb @@ -7,7 +7,7 @@ if($("#course_avatar_form").length > 0) { window.location.href = "<%=settings_course_path(@course) %>"; } <% elsif @project %> -$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@project), :id=>'nh_source_tx',:style=>"width:60px;height:60px;overflow:hidden",:alt=>"项目logo") %>'); +$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@project), :id=>'nh_source_tx',:style=>"width:110px;height:110px;overflow:hidden",:alt=>"项目logo") %>'); if($("#project_avatar_form").length > 0) { window.location.href = "<%=settings_project_path(@project) %>"; } diff --git a/app/views/projects/_applied_status.html.erb b/app/views/projects/_applied_status.html.erb index d29819c03..7e8a22f8e 100644 --- a/app/views/projects/_applied_status.html.erb +++ b/app/views/projects/_applied_status.html.erb @@ -4,6 +4,7 @@ <% if AppliedProject.where(:user_id => User.current, :project_id => @project_id).first.nil? %> <%= join_in_project_link(@project, User.current) %> <% else %> - 等待审批 + 等待审批 <% end %> -<% end %> \ No newline at end of file +<% end %> + diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index ad8d9a35a..1ddd9acac 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -1,4 +1,5 @@ <% project_file_num = Attachment.where(:container_type => "Project", :container_id => @project.id).count %> +<% project_issue_count =Issue.where(:project_id => @project.id).count%>