Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-07-27 10:03:55 +08:00
commit ebfa2f6749
22 changed files with 269 additions and 135 deletions

View File

@ -604,7 +604,7 @@ class CoursesController < ApplicationController
def toggleCourse
@course_prefs = Course.find_by_extra(@course.extra)
unless (@course_prefs.student != User.current || User.current.admin?)
unless (User.current.allowed_to?(:as_teacher,@course_prefs) || User.current.admin?)
render_403
end
end

View File

@ -18,31 +18,31 @@ class HomeworkCommonController < ApplicationController
end
def new
# @homework_type = "1"
#
# @homework = HomeworkCommon.new
# @homework.safe_attributes = params[:homework_common]
# @homework.late_penalty = 0
# @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
# @homework.publish_time = Time.now.strftime('%Y-%m-%d')
#
# if @homework_type == "1"
# #匿评作业相关属性
# @homework_detail_manual = HomeworkDetailManual.new
# @homework_detail_manual.ta_proportion = 0.6
# @homework_detail_manual.absence_penalty = 0
# @homework_detail_manual.evaluation_num = 3
# @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
# @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
# @homework.homework_detail_manual = @homework_detail_manual
# elsif @homework_type == "2"
# #编程作业相关属性
# @homework_detail_programing = HomeworkDetailPrograming.new
# @homework.homework_detail_programing = @homework_detail_programing
# end
# respond_to do |format|
# format.html
# end
@homework_type = "1"
@homework = HomeworkCommon.new
@homework.safe_attributes = params[:homework_common]
@homework.late_penalty = 0
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@homework.publish_time = Time.now.strftime('%Y-%m-%d')
if @homework_type == "1"
#匿评作业相关属性
@homework_detail_manual = HomeworkDetailManual.new
@homework_detail_manual.ta_proportion = 0.6
@homework_detail_manual.absence_penalty = 0
@homework_detail_manual.evaluation_num = 3
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@homework.homework_detail_manual = @homework_detail_manual
elsif @homework_type == "2"
#编程作业相关属性
@homework_detail_programing = HomeworkDetailPrograming.new
@homework.homework_detail_programing = @homework_detail_programing
end
respond_to do |format|
format.html
end
end
#新建作业下一步
@ -144,6 +144,8 @@ class HomeworkCommonController < ApplicationController
end
if homework.save
homework_detail_programing.save if homework_detail_programing
homework_detail_manual.save if homework_detail_manual
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_create)
@ -254,7 +256,6 @@ class HomeworkCommonController < ApplicationController
client.request(request)
end
result = JSON.parse(res.body)
homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0
end
@homework.save_attachments(params[:attachments])

View File

@ -71,8 +71,7 @@ class NewsController < ApplicationController
scope = @course ? @course.news.course_visible : News.course_visible
@news_count = scope.count
#@news_pages = Paginator.new @news_count, @limit, params['page']
#@offset ||= scope_page.offset
@q = params[:subject]
if params[:subject].nil?
scope_order = scope.all(:include => [:author, :course],
:order => "#{News.table_name}.created_on DESC")

View File

@ -463,8 +463,8 @@ update
data = graph_author_commits_per_month(@repository)
when "author_commits_six_month"
data = author_commits_six_month(@repository)
when "author_qoc_per_author"
data = graph_author_qoc_per_author(@repository)
when "author_code_six_months"
data = author_code_six_month(@repository)
end
if data
headers["Content-Type"] = "image/svg+xml"
@ -624,14 +624,14 @@ update
graph.burn
end
# 用户每月提交次数
# 用户最近一年的提交次数
def graph_author_commits_per_month(repository)
@date_to = Date.today
@date_from = @date_to << 1
@date_from = @date_to << 12
@date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day)
commits_by_author = Changeset.count(:all, :group => :committer,
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40)
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25)
fields = commits_by_author.collect {|r| r.first}
commits_data = commits_by_author.collect {|r| r.last}
@ -650,12 +650,13 @@ update
:scale_integers => true,
:show_data_values => true,
:rotate_y_labels => false,
:graph_title => l(:label_author_commits_per_month),
:show_graph_title => true
:graph_title => l(:label_author_commits_year),
:show_graph_title => true,
:no_css => true
)
graph.add_data(
:data => commits_data,
:title => l(:label_revision_plural)
:title => l(:label_revision_commit_count)
)
graph.burn
end
@ -667,7 +668,7 @@ update
@date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day)
commits_by_author = Changeset.count(:all, :group => :committer,
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40)
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25)
fields = commits_by_author.collect {|r| r.first}
commits_data = commits_by_author.collect {|r| r.last}
@ -691,7 +692,49 @@ update
)
graph.add_data(
:data => commits_data,
:title => l(:label_revision_plural)
:title => l(:label_revision_commit_count)
)
graph.burn
end
# 最近六个月代码量统计
def author_code_six_month(repository)
@date_to = Date.today
@date_from = @date_to << 6
@date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day)
commits_by_author = Changeset.count(:group => :committer, :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40)
all_author = []
commits_by_author.each do |cba|
all_author << cba.first
end
# all_author = all_author.collect {|c| c.gsub(%r{/ /<.+@.+>}, '') }
all_author = all_author.collect {|c| c.split.first }
commits_by_author = repository.commits(all_author, "#{@date_from}", "#{@date_to}", repository.id == 150 ? "szzh" : 'master')
fields = commits_by_author.collect {|r| r.first}
commits_data = commits_by_author.collect {|r| r.last}
fields = fields + [""]*(10 - fields.length) if fields.length<10
commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10
# Remove email adress in usernames
fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') }
graph = SVG::Graph::BarHorizontal.new(
:height => 400,
:width => 600,
:fields => fields,
:stack => :side,
:scale_integers => true,
:show_data_values => true,
:rotate_y_labels => false,
:graph_title => l(:label_author_code_six_month),
:show_graph_title => true
)
graph.add_data(
:data => commits_data,
:title => l(:lable_revision_code_count)
)
graph.burn
end

View File

@ -236,13 +236,14 @@ module RepositoriesHelper
# 判断项目是否有主版本库
def judge_main_repository(pro)
if pro.repositories.blank?
return false
status = false
else
pro.repositories.sort.each do |rep|
rep.is_default?
return true
pro.repositories.each do |rep|
status = true and break if rep.is_default?
status = false
end
end
status
end
# def cvs_field_tags(form, repository)
# content_tag('p', form.text_field(

View File

@ -38,6 +38,12 @@ class Repository::Git < Repository
'Git'
end
def commits(authors, start_date, end_date, branch='master')
scm.commits(authors, start_date, end_date,branch).map {|commit|
[commit[:author], commit[:num]]
}
end
def report_last_commit
extra_report_last_commit
end

View File

@ -43,7 +43,7 @@
<div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div>
</div>
</span>
<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %>
<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %>
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
<span><%= l(:button_upload_photo) %></span>
</a>

View File

@ -31,7 +31,7 @@
<% if @canShowCode%>
<%= form_tag(updategroupname_course_path(@course,:group_id => group.id), method: 'get', remote:true, :id => 'update_group_'+group.id.to_s) do %>
<span id="edit_group_<%= group.id %>" style="display:none; vertical-align: middle;" class=" f_l">
<input type="text" id="group_name_<%= group.id%>" name="group_name" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="text" id="group_name_<%= group.id%>" name="group_name" size="20" class="isTxt w90 f_l" maxlength="20" />
<input type="button" class="submit f_l" onclick="edit_group('group_name_<%= group.id%>','<%= valid_ajax_course_path%>','<%= @course.id%>','<%= group.id%>');"/>
</span>
<% end %>
@ -47,7 +47,7 @@
<li >
<span id="new_group_name" style="display:none; vertical-align: middle;" class="ml10 f_l">
<%= form_tag( addgroups_course_path(@course), method: 'get',:remote=>true,:id => 'add_group_name') do %>
<input type="text" id="group_name" name="group_name" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="text" id="group_name" name="group_name" size="20" class="isTxt w90 f_l" maxlength="20" />
<input type="button" class="submit f_l" onclick="add_group('<%= valid_ajax_course_path%>','<%= @course.id%>');"/>
<% end %>
</span>

View File

@ -71,18 +71,30 @@
<% end%>
</tbody>
</table>
<% end%>
<div class="cl"></div>
<div class="cl"></div>
<div class="mt5">
<% unless homework.attachments.empty?%>
<div class="mt5">
<span class="tit_fb" style="width: auto;"> 开发语言:</span>
<div class="fl">
<% if homework.homework_detail_programing.language.to_i == 1%>
C
<% elsif homework.homework_detail_programing.language.to_i == 2%>
C++
<% end%>
</div>
</div>
<div class="cl"></div>
<% end%>
<% unless homework.attachments.empty?%>
<div class="mt5">
<span class="tit_fb" style="width: auto;"> 附件:</span>
<div class="fl mb5">
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework.attachments} %>
</div>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% end%>
<div class="mt5">
<span class="tit_fb" style="width: auto;"> 扣分标准:</span>

View File

@ -1,27 +1,17 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= error_messages_for 'homework_common' %>
<div class="project_r_h">
<h2 class="project_h2">
<%= l(:label_course_homework_new)%>
</h2>
</div>
<div class="hwork_new" id="hwork_new">
<%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%>
<input type="hidden" name="course" value="<%= @course.id%>">
<h3 class="c_blue f16 mb10">
请选择将要发布的作业类型
</h3>
<input type="radio" class="mb10 fl" name="homework_common_type" value="1" id="homework_detail_manual_radio" checked/>
<span class="ml5 fl">
人工评分的作业(支持匿名互评、灵活设置评分比例)
</span>
<div class="cl"></div>
<input type="radio" class="mb20 fl" name="homework_common_type" value="2" id="homework_detail_programing_radio"/>
<span class="ml5 fl">
自动评测的编程作业支持C/C++程序的自动评分)
</span>
<div class="cl"></div>
<a href="javascript:void(0);" class=" orange_btn" onclick="$(this).parent().submit();">
下一步
</a>
<div class="hwork_new">
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
<%= hidden_field_tag "course",@course.id%>
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
<%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
</div><!--hwork_new end-->
<div class="cl"></div>

View File

@ -34,7 +34,7 @@
</li>
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;">
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')',
{ :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user },
{:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user},
{:class => 'my-message'} if User.current.logged?%>
</li>
</ul>

View File

@ -80,11 +80,13 @@
<div class="cl"></div>
<div>
<% if @project.project_type == 0 %>
<span class="fb f14 "><%= l(:label_project_score)%> :</span>
<%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects',
:action => 'show_projects_score',
:remote => true,
:id => @project.id}, :class => "c_orange f14" ) %>
<% unless project_scores(@project) == 0 %>
<span class="fb f14 "><%= l(:label_project_score)%> :</span>
<%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects',
:action => 'show_projects_score',
:remote => true,
:id => @project.id}, :class => "c_orange f14" ) %>
<% end %>
<% end %>
</div>

View File

@ -149,29 +149,65 @@
<div class="leftbox mt10">
<ul class="leftbox_ul_left">
<% if !@user.user_extensions.nil? && @user.user_extensions.identity == 0 %>
<li>创建课程&nbsp;:</li>
<li>发布作业&nbsp;:</li>
<% if(get_create_course_count(@user)) == 0 %>
<li>创建课程&nbsp;:</li>
<% end %>
<% if(get_homework_commons_count(@user)) == 0 %>
<li>发布作业&nbsp;:</li>
<% end %>
<% end %>
<% if (get_join_course_count(@user) != 0) %>
<li>加入课程&nbsp;:</li>
<% end %>
<% if @user.user_extensions.identity == 0 %>
<li>参加匿评&nbsp;:</li>
<% end %>
<% if (get_projectandcourse_attachment_count(@user) != 0) %>
<li>发布资源&nbsp;:</li>
<% end %>
<% if (get_create_project_count(@user) != 0) %>
<li>创建项目&nbsp;:</li>
<% end %>
<% if (get_join_project_count(@user) != 0) %>
<li>加入项目&nbsp;:</li>
<% end %>
<% if (get_create_issue_count(@user) != 0) %>
<li>发布缺陷&nbsp;:</li>
<% end %>
<% if (get_resolve_issue_count(@user) != 0) %>
<li>解决缺陷&nbsp;:</li>
<% end %>
<li>加入课程&nbsp;:</li>
<li>参加匿评&nbsp;:</li>
<li>发布资源&nbsp;:</li>
<li>创建项目&nbsp;:</li>
<li>加入项目&nbsp;:</li>
<li>发布缺陷&nbsp;:</li>
<li>解决缺陷&nbsp;:</li>
</ul>
<ul class="leftbox_ul_right c_dgrey">
<% if !@user.user_extensions.nil? && @user.user_extensions.identity == 0 %>
<li><%= get_create_course_count(@user) %></li>
<li><%= get_homework_commons_count(@user) %></li>
<% if(get_create_course_count(@user)) == 0 %>
<li><%= get_create_course_count(@user) %></li>
<% end %>
<% if(get_homework_commons_count(@user)) == 0 %>
<li><%= get_homework_commons_count(@user) %></li>
<% end %>
<% end %>
<% if (get_join_course_count(@user) != 0) %>
<li><%= get_join_course_count(@user) %></li>
<% end %>
<% if @user.user_extensions.identity == 0 %>
<li><%= get_anonymous_evaluation_count(@user) %></li>
<% end %>
<% if (get_projectandcourse_attachment_count(@user) != 0) %>
<li><%= get_projectandcourse_attachment_count(@user) %></li>
<% end %>
<% if (get_create_project_count(@user) != 0) %>
<li><%= get_create_project_count(@user) %></li>
<% end %>
<% if (get_join_project_count(@user) != 0) %>
<li><%= get_join_project_count(@user) %></li>
<% end %>
<% if (get_create_issue_count(@user) != 0) %>
<li><%= get_create_issue_count(@user) %></li>
<% end %>
<% if (get_resolve_issue_count(@user) != 0) %>
<li><%= get_resolve_issue_count(@user) %></li>
<% end %>
<li><%= get_join_course_count(@user) %></li>
<li><%= get_anonymous_evaluation_count(@user) %></li>
<li><%= get_projectandcourse_attachment_count(@user) %></li>
<li><%= get_create_project_count(@user) %></li>
<li><%= get_join_project_count(@user) %></li>
<li><%= get_create_issue_count(@user) %></li>
<li><%= get_resolve_issue_count(@user) %></li>
</ul>
<div class="cl"></div>
</div>

View File

@ -24,8 +24,8 @@
<% end %>
</div>
<div class="problem_search fr" >
<%= form_tag({:controller => 'news', :action => 'index', :course_id => @course },:remote=>'true', :method => :get,:id=>"news_query_form", :class => 'query_form') do %>
<input class="problem_search_input fl" id="v_subject" placeholder="通知主题" type="text" name="subject" value="" onkeypress="" onkeydown="">
<%= form_tag({:controller => 'news', :action => 'index', :course_id => @course }, :method => :get,:id=>"news_query_form", :class => 'query_form') do %>
<input class="problem_search_input fl" id="v_subject" placeholder="通知主题" type="text" name="subject" value="<%= @q%>" onkeypress="" onkeydown="">
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_search();" >搜索</a>
<% end %>
</div><!--problem_search end-->
@ -34,7 +34,7 @@
<div id="news_list">
<%= render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count} %>
<div>
</div>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<%= stylesheet_link_tag 'scm' %>

View File

@ -13,17 +13,13 @@
<p style="padding-top: 50px;">
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户每月提交代码量 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_qoc_per_author")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户最近六个月的提交次数 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户最近一年的提交次数 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_qoc_per_author")) %>
<%# 用户最近六个月的代码量 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %>
</p>
<p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
<% html_title(l(:label_repository), l(:label_statistics)) -%>

View File

@ -59,14 +59,6 @@
<div class="cl"></div>
</li>
<li ><span class="tit_fb ">测试结果:</span>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
</tbody>
</table>
<div class="cl"></div>
</li>
<% if @is_teacher%>
<!-- 编程作业老师才可以评分 -->
<div id="add_student_score_<%= @work.id%>" class="mt10 evaluation">

View File

@ -55,21 +55,23 @@
<% end%>
<% if @is_teacher%>
<div class="fr">
<% if @homework.student_works.empty?%>
<%= link_to "附件", "javascript:void(0)", class: "down_btn fr zip_download_alert", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
<% else%>
<%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %>
<% unless @homework.homework_type == 2%>
<% if @homework.student_works.empty?%>
<%= link_to "附件", "javascript:void(0)", class: "down_btn fr zip_download_alert", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
<% else%>
<%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %>
<% end%>
<div class="info_ni_download" style="<%= @homework.homework_type == 1 ? '' : 'margin-left: 130px;'%>">
使用
<span class="c_red">winzip</span>
工具进行解压可能会导致
<span class="c_red">下载文件乱码</span>
,建议您使用
<span class="c_red">winrar</span>
工具进行解压
</div>
<% end%>
<div class="info_ni_download" style="<%= @homework.homework_type == 1 ? '' : 'margin-left: 130px;'%>">
使用
<span class="c_red">winzip</span>
工具进行解压可能会导致
<span class="c_red">下载文件乱码</span>
,建议您使用
<span class="c_red">winrar</span>
工具进行解压
</div>
<%= link_to("匿评", evaluation_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%>
<%= link_to("缺评", absence_penalty_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%>
<%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%>
@ -137,6 +139,14 @@
<% if @homework.homework_type == 2 && @homework.homework_detail_programing%>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit">
输入
</td>
<td class="td_tit">
输出
</td>
</tr>
<% @homework.homework_tests.each do |test|%>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit">
@ -149,8 +159,20 @@
<% end%>
</tbody>
</table>
<div class="cl"></div>
<div class="mt5">
<span class="tit_fb" style="width: auto;"> 开发语言:</span>
<div class="fl">
<% if @homework.homework_detail_programing.language.to_i == 1%>
C
<% elsif @homework.homework_detail_programing.language.to_i == 2%>
C++
<% end%>
</div>
</div>
<div class="cl"></div>
<% end%>
<div class="cl"></div>
<div class="mt5">
<% unless @homework.attachments.empty?%>

View File

@ -45,10 +45,10 @@
<% if @organization.nil? %>
<% unless @first_page.nil? %>
<!-- 改为国际化后无法通过后台配置
<%= @first_page.description.html_safe %>
<%#= @first_page.description.html_safe %>
-->
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie_project)%></span>,&nbsp;
<span class="font_welcome_tdescription"><span class="font_welcome_tdescription"><%= l(:label_welcome_trustie_project_description)%></span></span>
<!--<span class="font_welcome_trustie"><%#= @first_page.title.html_safe %></span>,&nbsp;-->
<span class="font_welcome_tdescription"><span class="font_welcome_tdescription"><%= @first_page.description.html_safe %></span></span>
<% end %>
<% else %>
<span class="font_welcome_school" style="color: #E8770D">

View File

@ -350,7 +350,7 @@ zh:
label_input_email: 请输入邮箱地址
label_invite_trustie_user: "邀请Trustie注册用户"
label_invite_trustie_user_tips: "输入姓名、邮箱、昵称"
label_invite_trustie_user_tips: "支持姓名、邮箱、昵称搜索!"
label_user_role_null: 用户和角色不能留空!
label_invite_project: 邀请您加入项目
label_mail_invite_success: 您已成功加入项目!

View File

@ -669,6 +669,8 @@ zh:
label_tag: 标签
label_revision: 修订
label_revision_plural: 修订
lable_revision_code_count: 代码量
label_revision_commit_count: 提交次数
label_revision_id: 修订 %{value}
label_associated_revisions: 相关修订版本
label_added: 已添加
@ -716,8 +718,10 @@ zh:
label_commits_per_month: 每月提交次数
label_commits_per_author: 每用户提交次数
label_author_commits_per_month: 用户最近一月的提交次数
label_author_commits_six_month: 用户最近六个月提交次数
label_author_commits_six_month: 用户最近六个月提交次数
label_author_commits_year: 最近一年的提交次数
label_author_code_six_month: 用户最近六个月代码量
label_author_code_year: 用户最近一年代码量
label_view_diff: 查看差别
label_diff_inline: 直列
label_diff_side_by_side: 并排

View File

@ -380,6 +380,36 @@ module Redmine
nil
end
def parse_commit(commits)
sum = {file: 0, insertion: 0, deletion: 0}
commits.split("\n").each do |commit|
if /(\d+)\s+?file/ =~ commit
sum[:file] += $1 .to_i
end
if /(\d+)\s+?insertion/ =~ commit
sum[:insertion] += $1.to_i
end
if /(\d+)\s+?deletion/ =~ commit
sum[:deletion] += $1.to_i
end
end
sum[:insertion] + sum[:deletion]
end
def commits(authors, start_date, end_date, branch='master')
rs = []
authors.each do |author|
cmd_args = %W|log #{branch} --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}|
commits = ''
git_cmd(cmd_args) do |io|
commits = io.read
end
logger.info "git log output for #{author} #{commits}"
rs << {author: author, num: parse_commit(commits)}
end
rs
end
class Revision < Redmine::Scm::Adapters::Revision
# Returns the readable identifier
def format_identifier

View File

@ -5104,8 +5104,8 @@ KEditor.prototype = {
}
}
});
statusbar.removeClass('statusbar').addClass('ke-statusbar')
.append('<span class="ke-inline-block ke-statusbar-center-icon"></span>');
//statusbar.removeClass('statusbar').addClass('ke-statusbar')
// .append('<span class="ke-inline-block ke-statusbar-center-icon"></span>');
if (self._fullscreenResizeHandler) {
K(window).unbind('resize', self._fullscreenResizeHandler);
self._fullscreenResizeHandler = null;