From 50011985a9d25ca27ef42b6fb6ea31e3bbf08d2f Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 4 Mar 2016 11:19:07 +0800
Subject: [PATCH 01/25] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?=
=?UTF-8?q?=E5=BA=93=E6=B7=BB=E5=8A=A0=E8=B5=84=E6=BA=90=E6=8F=8F=E8=BF=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/files_controller.rb | 1 +
app/controllers/users_controller.rb | 9 ++++++---
app/views/files/_resource_detail.html.erb | 4 ++++
app/views/files/_upload_course_files.erb | 8 ++++++++
app/views/files/index.html.erb | 1 -
5 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index ca37e445c..e615de002 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -529,6 +529,7 @@ class FilesController < ApplicationController
if attachment.publish_time > Date.today
attachment.is_publish = 0
end
+ attachment.description = params[:description]
attachment.save
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 3114ef5e0..671a6b446 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -2403,9 +2403,12 @@ class UsersController < ApplicationController
search = "%#{params[:search].strip.downcase}%"
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
if User.current.id.to_i == params[:id].to_i
- user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询
- @attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
- " or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))) and (filename like :p) ",:p=>search).order("created_on desc")
+ user_course_ids = User.current.courses.map { |c| c.id}
+ user_project_ids = User.current.projects.map {|p| p.id}
+ # user_org_ids = User.current.organizations.map {|o| o.id}
+ @attachments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
+ "or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)" ,:p => search).order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
@attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type in" +
diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb
index 6342e91f6..bac00a68d 100644
--- a/app/views/files/_resource_detail.html.erb
+++ b/app/views/files/_resource_detail.html.erb
@@ -27,6 +27,10 @@
文件大小:<%= number_to_human_size(file.filesize) %>
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+ <% unless file.description.blank? %>
+
+ 资源描述:<%= file.description %>
+ <% end %>
diff --git a/app/views/files/_upload_course_files.erb b/app/views/files/_upload_course_files.erb
index de43977cd..d728d7a2d 100644
--- a/app/views/files/_upload_course_files.erb
+++ b/app/views/files/_upload_course_files.erb
@@ -22,6 +22,14 @@
<%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
+
+
<% if User.current.allowed_to?(:as_teacher,course) %>
延迟发布:
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb
index d4d12232e..27e51f05c 100644
--- a/app/views/files/index.html.erb
+++ b/app/views/files/index.html.erb
@@ -13,7 +13,6 @@
<% end %>
-
-
- 公共资源
+ 公共资源
- 我的资源
+ 我的资源
@@ -84,19 +83,23 @@
- <%= link_to '全部' ,user_resource_user_path(:id => @user.id, :type => 1), :remote => true, :method => 'get', :class => 'resourcesTypeAll resourcesGrey' %>
+ 全部
- <%= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %>
+ 课程资源
+ <%#= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), id="resource_type_course", :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %>
- <%= link_to '项目资源' ,user_resource_user_path(:id => @user.id, :type => 3), :remote => true, :method => 'get', :class => 'homepagePostTypeQuiz postTypeGrey' %>
+ 项目资源
+ <%#= link_to '项目资源' ,user_resource_user_path(:id => @user.id, :type => 3), id="resource_type_project", :remote => true, :method => 'get', :class => 'homepagePostTypeQuiz postTypeGrey' %>
- <%= link_to '用户资源' ,user_resource_user_path(:id=>@user.id,:type=>5),:remote=>true,:method => 'get', :class=>'resourcesTypeUser resourcesGrey' %>
+ 用户资源
+ <%#= link_to '用户资源' ,user_resource_user_path(:id=>@user.id,:type=>5), id="resource_type_user", :remote=>true,:method => 'get', :class=>'resourcesTypeUser resourcesGrey' %>
- <%= link_to '附件' ,user_resource_user_path(:id=>@user.id,:type=>4),:remote=>true,:method => 'get',:class=>'resourcesTypeAtt resourcesGrey' %>
+ 附件
+ <%#= link_to '附件' ,user_resource_user_path(:id=>@user.id,:type=>4), id="resource_type_file", :remote=>true,:method => 'get',:class=>'resourcesTypeAtt resourcesGrey' %>
diff --git a/app/views/users/user_resource.js.erb b/app/views/users/user_resource.js.erb
index 725b91b80..a39fd4468 100644
--- a/app/views/users/user_resource.js.erb
+++ b/app/views/users/user_resource.js.erb
@@ -3,4 +3,13 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
-$("#res_all_count").html(<%= @atta_count%>);
\ No newline at end of file
+$("#res_all_count").html(<%= @atta_count %>);
+
+$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6', :status => @status) %>');
+$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1', :status => @status) %>');
+
+$("#resource_type_all").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 1) %>');
+$("#resource_type_course").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 2) %>');
+$("#resource_type_project").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 3) %>');
+$("#resource_type_user").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 5) %>');
+$("#resource_type_file").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 4) %>');
From 38fca021935c23a94f532eca82908b75a55add8f Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 4 Mar 2016 18:36:42 +0800
Subject: [PATCH 07/25] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/users/_import_resource_info.html.erb | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/views/users/_import_resource_info.html.erb b/app/views/users/_import_resource_info.html.erb
index 63fc15ef6..a8f9650a7 100644
--- a/app/views/users/_import_resource_info.html.erb
+++ b/app/views/users/_import_resource_info.html.erb
@@ -26,11 +26,11 @@
公共资源
我的资源
<% end %>
- <%= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id, :type => 1),
+ <%#= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id, :type => 1),
:remote => true , :method => 'get', :id => 'resource_search_form') do %>
-
- <%= hidden_field_tag(:type,type.nil? ? 1 : type) %>
- <% end %>
+
+ <%#= hidden_field_tag(:type,type.nil? ? 1 : type) %>
+ <%# end %>
From 782bbc775b66a1d2bfb69417b63b91ffefdd44ec Mon Sep 17 00:00:00 2001
From: cxt
Date: Fri, 4 Mar 2016 21:04:21 +0800
Subject: [PATCH 08/25] =?UTF-8?q?=E5=85=AC=E5=85=B1=E8=B5=84=E6=BA=90?=
=?UTF-8?q?=E5=BA=93=E7=9A=84=E7=BB=9F=E8=AE=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 62 +++-
app/views/users/_resources_list.html.erb | 347 ++++++++++++++++++++++
app/views/users/_upload_resource.html.erb | 4 +-
app/views/users/user_resource.html.erb | 345 ---------------------
4 files changed, 402 insertions(+), 356 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 34d40f177..da351a402 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1538,9 +1538,20 @@ class UsersController < ApplicationController
#@user.save_attachments(params[:attachments],User.current)
# Container_type为Principal
Attachment.attach_filesex(@user, params[:attachments], params[:attachment_type])
- if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
+ if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
- @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
+ if params[:status] == 2
+ @attachments = get_course_resources(params[:id], user_course_ids)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources(params[:id], user_project_ids)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources params[:id]
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources params[:id]
+ else
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
+ end
elsif params[:type] == "2" # 课程资源
@attachments = get_course_resources(params[:id], user_course_ids)
elsif params[:type] == "3" # 项目资源
@@ -1550,10 +1561,21 @@ class UsersController < ApplicationController
elsif params[:type] == "5" #用户资源
@attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
- # 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ if params[:status] == "2"
+ @attachments = get_course_resources_public( user_course_ids)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources_public(user_project_ids)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources_public
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources_public
+ else
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_public_resources(user_course_ids, user_project_ids)
+ end
end
- @type = params[:type] || 1
+ @status = params[:status]
+ @type = params[:type]
@limit = 25
@is_remote = true
@atta_count = @attachments.count
@@ -1578,9 +1600,20 @@ class UsersController < ApplicationController
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
- if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
+ if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
- @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
+ if params[:status] == 2
+ @attachments = get_course_resources(params[:id], user_course_ids)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources(params[:id], user_project_ids)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources params[:id]
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources params[:id]
+ else
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
+ end
elsif params[:type] == "2" # 课程资源
@attachments = get_course_resources(params[:id], user_course_ids)
elsif params[:type] == "3" # 项目资源
@@ -1590,9 +1623,20 @@ class UsersController < ApplicationController
elsif params[:type] == "5" #用户资源
@attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
- # 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ if params[:status] == "2"
+ @attachments = get_course_resources_public( user_course_ids)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources_public(user_project_ids)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources_public
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources_public
+ else
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_public_resources(user_course_ids, user_project_ids)
+ end
end
+ @status = params[:status]
@type = params[:type]
@limit = 25
@is_remote = true
diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb
index 4e429a640..7bd44ccf0 100644
--- a/app/views/users/_resources_list.html.erb
+++ b/app/views/users/_resources_list.html.erb
@@ -25,3 +25,350 @@
<% end %>
<% end %>
+
+
diff --git a/app/views/users/_upload_resource.html.erb b/app/views/users/_upload_resource.html.erb
index c973217f6..ae9114dfa 100644
--- a/app/views/users/_upload_resource.html.erb
+++ b/app/views/users/_upload_resource.html.erb
@@ -2,7 +2,7 @@
上传资源
- <%= form_tag(user_resource_create_user_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
+ <%= form_tag(user_resource_create_user_path(:type=>type,:status=>status), :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
<% if defined?(container) && container && container.saved_attachments %>
@@ -38,7 +38,7 @@
(未选择文件)
-
您可以上传小于50MB 的文件
+
diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb
index 6e01b90fb..f45eb11c2 100644
--- a/app/views/users/user_resource.html.erb
+++ b/app/views/users/user_resource.html.erb
@@ -21,16 +21,6 @@
$("#resource_search_form").submit();
}
- function show_upload(){
- $("#ajax-modal").html('<%= escape_javascript( render :partial => 'upload_resource' ,:locals => {:user=>@user})%>');
- showModal('ajax-modal', '452px');
- $('#ajax-modal').siblings().remove();
- $('#ajax-modal').before(" ");
- $('#ajax-modal').parent().css("top","50%").css("left","50%").css("position","absolute");
- $('#ajax-modal').parent().addClass("resourceUploadPopup");
- $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
- }
-
function show_public_resource(){
$("#resource_remote").html('<%= escape_javascript( render :partial => 'user_resource_info' ,:locals => { :tpye => 6}) %>');
}
@@ -115,340 +105,5 @@
-
From 6ce947667dfcd141403bfb86fc3c8095e35d77f1 Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 4 Mar 2016 21:10:45 +0800
Subject: [PATCH 09/25] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=8B=B1=E9=9B=84?=
=?UTF-8?q?=E6=A6=9C=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/base_courses.html.erb | 79 ++++++++++++++++++-------
1 file changed, 56 insertions(+), 23 deletions(-)
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index 1e0bf0c60..85c9c74b4 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -7,7 +7,7 @@
<% homework_num = @course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
<% end %>
-
+
@@ -142,32 +142,55 @@
<% unless contributor_course_scor(@course.id).count == 0 %>
- 课程活跃度
+
+
+
积分规则
+ 资源得分:资源数 x 5
+ 讨论得分:发帖数 x 2
+ 回复得分:回复数 x 1
+ 课程留言得分:留言数 x 1
+ 作业留言得分:留言数 x 1
+ 通知得分:通知数 x 1
+ 总得分为以上得分之和
+
+
<% contributor_course_scor(@course.id).each do |contributor_score| %>
<% unless contributor_score.total_score ==0 %>
<%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %>
<%=link_to contributor_score.user.show_name, user_path(contributor_score.user), :title => contributor_score.user.show_name %>
- <%= contributor_score.total_score.to_i %>
+
+ <%=total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 +
+ contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 +
+ + contributor_score.homework_journal_num * 1 + contributor_score.news_reply_num.to_i * 1 %>
- <% unless contributor_score.resource_num == 0 %>
- 课程资源:<%= contributor_score.resource_num %>
- <% end %>
- <% unless contributor_score.message_num == 0 %>
- 课程讨论:<%= contributor_score.message_num %>
- <% end %>
- <% unless contributor_score.message_reply_num == 0 %>
- 评论回复:<%= contributor_score.message_reply_num %>
- <% end %>
- <% unless contributor_score.journal_num == 0 %>
- 课程留言:<%= contributor_score.journal_num %>
- <% end %>
- <% unless contributor_score.homework_journal_num == 0 %>
- 作业留言:<%= contributor_score.homework_journal_num %>
- <% end %>
- <% unless contributor_score.news_reply_num == 0 %>
- 课程通知:<%= contributor_score.news_reply_num %>
- <% end %>
+
+
+
+
+
+
+
+
积分计算
+ <%# unless contributor_score.resource_num.to_i == 0 %>
+ 课程资源:资源数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %>
+ <%# end %>
+ <%# unless contributor_score.message_num.to_i == 0 %>
+ 课程讨论:发帖数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %>
+ <%# end %>
+ <%# unless contributor_score.message_reply_num.to_i == 0 %>
+ 评论回复:回复数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %>
+ <%# end %>
+ <%# unless contributor_score.journal_num.to_i == 0 %>
+ 课程留言:留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %>
+ <%# end %>
+ <%# unless contributor_score.homework_journal_num.to_i == 0 %>
+ 作业留言:留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %>
+ <%# end %>
+ <%# unless contributor_score.news_reply_num.to_i == 0 %>
+ 课程通知:通知数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %>
+ <%# end %>
+ 总得分:<%=total_score %>
<% end %>
@@ -179,12 +202,12 @@
<% hero_homework_scores = hero_homework_score(@course, "desc") %>
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
- 课程英雄榜
+
<% hero_homework_scores.each do |student_score| %>
<% if student_score.score.to_i != 0 %>
<%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %>
<%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %>
- "><%= student_score.score<0 ? 0 : student_score.score.to_i %>
+ <%= student_score.score<0 ? 0 : student_score.score.to_i %>
<% end %>
<% end %>
@@ -303,6 +326,16 @@
obj.parent().parent().next("div").hide();
}
+ function message_titile_show2(obj,e)
+ {
+ obj.parent().next("div").show();
+ obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute");
+ }
+ function message_titile_hide2(obj)
+ {
+ obj.parent().next("div").hide();
+ }
+
$("#expand_tools_expand").click(function(){
$("#navContentCourse").toggle();
});
From e4d669251fdf7ccaa23cd82a1e1da642151a8a0b Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 4 Mar 2016 21:13:24 +0800
Subject: [PATCH 10/25] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E6=A6=9C=E5=BE=97?=
=?UTF-8?q?=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/base_courses.html.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index 85c9c74b4..4940b60d6 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -146,8 +146,8 @@
积分规则
资源得分:资源数 x 5
- 讨论得分:发帖数 x 2
- 回复得分:回复数 x 1
+ 发帖得分:发帖数 x 2
+ 回帖得分:回复数 x 1
课程留言得分:留言数 x 1
作业留言得分:留言数 x 1
通知得分:通知数 x 1
From 814e766577ade4852a1de782d004c8c136075799 Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 4 Mar 2016 21:22:47 +0800
Subject: [PATCH 11/25] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=BF=87=E6=BB=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index da351a402..1d328c1e9 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -2384,7 +2384,7 @@ class UsersController < ApplicationController
# user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
- if params[:status] == 2
+ if params[:status] == "2"
@attachments = get_course_resources(params[:id], user_course_ids)
elsif params[:status] == "3"
@attachments = get_project_resources(params[:id], user_project_ids)
From f381784a3cb28176343cc68ab19ee886dc3cc1bd Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 5 Mar 2016 03:13:58 +0800
Subject: [PATCH 12/25] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/files_controller.rb | 18 ++++----
app/helpers/application_helper.rb | 12 +++++-
app/models/comment.rb | 4 +-
app/models/course_contributor_score.rb | 3 +-
app/models/journals_for_message.rb | 2 +-
app/models/message.rb | 16 +++----
...d_news_num_to_course_contributor_scores.rb | 5 +++
...304154643_update_contributor_for_course.rb | 43 +++++++++++++++++++
8 files changed, 79 insertions(+), 24 deletions(-)
create mode 100644 db/migrate/20160304154005_add_news_num_to_course_contributor_scores.rb
create mode 100644 db/migrate/20160304154643_update_contributor_for_course.rb
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index e615de002..a40b24fe2 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -629,16 +629,14 @@ class FilesController < ApplicationController
end
def update_contributor_score(course, file )
- unless file.author.allowed_to?(:as_teacher, course)
- course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course.id, file.author.id).first
- if course_contributor_score.nil?
- CourseContributorScore.create(:course_id => course.id, :user_id => file.author.id, :message_num => 0, :message_reply_num => 0,
- :news_reply_num => 0, :resource_num => 5, :journal_num => 0, :journal_reply_num => 0, :total_score => 5)
- else
- score = course_contributor_score.resource_num + 5
- total_score = course_contributor_score.total_score + 5
- course_contributor_score.update_attributes(:resource_num => score, :total_score => total_score)
- end
+ course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course.id, file.author.id).first
+ if course_contributor_score.nil?
+ CourseContributorScore.create(:course_id => course.id, :user_id => file.author.id, :message_num => 0, :message_reply_num => 0,
+ :news_reply_num => 0, :resource_num => 5, :journal_num => 0, :journal_reply_num => 0, :total_score => 5)
+ else
+ score = course_contributor_score.resource_num + 5
+ total_score = course_contributor_score.total_score + 5
+ course_contributor_score.update_attributes(:resource_num => score, :total_score => total_score)
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c37d3ad55..48ee42234 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -110,8 +110,7 @@ module ApplicationHelper
end
end
- # 更新课程英雄榜得分
- # user传过来必须是学生
+ # 更新课程活跃度得分
def course_member_score(course_id,user_id,type)
course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course_id, user_id).first
case type
@@ -160,6 +159,15 @@ module ApplicationHelper
total_score = course_contributor_score.total_score + 1
course_contributor_score.update_attributes(:news_reply_num => score, :total_score => total_score)
end
+ when "News"
+ if course_contributor_score.nil?
+ CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
+ :news_reply_num => 0, :news_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1)
+ else
+ score = course_contributor_score.news_num + 1
+ total_score = course_contributor_score.total_score + 1
+ course_contributor_score.update_attributes(:news_num => score, :total_score => news_num)
+ end
end
end
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 69753d81c..1125e168f 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -82,8 +82,10 @@ class Comment < ActiveRecord::Base
# 课程成员得分(英雄榜)
def act_as_student_score
if self.commented.course
- unless self.author.allowed_to?(:as_teacher, self.commented.course)
+ if self.author.allowed_to?(:as_teacher, self.commented.course)
course_member_score(self.commented.course.id, self.author_id, "NewReply")
+ else
+ course_member_score(self.commented.course.id, self.author_id, "News")
end
end
end
diff --git a/app/models/course_contributor_score.rb b/app/models/course_contributor_score.rb
index ca21ddb1c..4f3b3e187 100644
--- a/app/models/course_contributor_score.rb
+++ b/app/models/course_contributor_score.rb
@@ -1,5 +1,6 @@
class CourseContributorScore < ActiveRecord::Base
- attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num, :resource_num, :user_id, :total_score, :homework_journal_num
+ attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num,
+ :resource_num, :user_id, :total_score, :homework_journal_num, :news_num
belongs_to :course
belongs_to :user
end
diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb
index 1c7a05cb1..7990979e4 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -283,7 +283,7 @@ class JournalsForMessage < ActiveRecord::Base
end
end
- # 课程成员得分(英雄榜)
+ # 课程成员得分(活跃度)
def act_as_student_score
if self.jour_type == "Course"
course_member_score(self.jour_id, self.user_id, "JournalForMessage")
diff --git a/app/models/message.rb b/app/models/message.rb
index 24bda5610..44f2d2c80 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -341,17 +341,15 @@ class Message < ActiveRecord::Base
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE
end
- # 课程成员得分(英雄榜)
+ # 课程成员得分(活跃度)
def act_as_student_score
if self.course
- unless self.author.allowed_to?(:as_teacher, self.course)
- if self.parent_id.nil?
- # 发帖
- course_member_score(self.course.id, self.author_id, "Message")
- else
- # 回帖
- course_member_score(self.course.id, self.author_id, "MessageReply")
- end
+ if self.parent_id.nil?
+ # 发帖
+ course_member_score(self.course.id, self.author_id, "Message")
+ else
+ # 回帖
+ course_member_score(self.course.id, self.author_id, "MessageReply")
end
end
end
diff --git a/db/migrate/20160304154005_add_news_num_to_course_contributor_scores.rb b/db/migrate/20160304154005_add_news_num_to_course_contributor_scores.rb
new file mode 100644
index 000000000..4cb1679f5
--- /dev/null
+++ b/db/migrate/20160304154005_add_news_num_to_course_contributor_scores.rb
@@ -0,0 +1,5 @@
+class AddNewsNumToCourseContributorScores < ActiveRecord::Migration
+ def change
+ add_column :course_contributor_scores, :news_num, :integer , :default => 0
+ end
+end
diff --git a/db/migrate/20160304154643_update_contributor_for_course.rb b/db/migrate/20160304154643_update_contributor_for_course.rb
new file mode 100644
index 000000000..be9ed3126
--- /dev/null
+++ b/db/migrate/20160304154643_update_contributor_for_course.rb
@@ -0,0 +1,43 @@
+class UpdateContributorForCourse < ActiveRecord::Migration
+ def up
+ Course.all.each do |course|
+ if course.course_activities.count > 1
+ course.members.each do |s|
+ puts course.id
+ puts course.name
+ puts s.user_id
+ # board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2
+ # 发帖数
+ board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is null;").count * 2
+ # 回帖数
+ message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is not null").count * 1
+ # 新闻回复
+ if s.user.allowed_to?(:as_teacher, course)
+ common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.user_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
+ else
+ common_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.user_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
+ end
+ # attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5
+ # 附件数
+ attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.user_id} and container_type ='Course'").count * 5
+ # 课程留言数
+ journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "Course").count * 1
+ # 作业留言
+ journal_homework_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "HomeworkCommon").count * 1
+ # journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
+ # journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
+ total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count
+ if total !=0
+ CourseContributorScore.create(:course_id => course.id, :user_id => s.student_id, :message_num => board_count, :message_reply_num => message_reply_count,
+ :news_reply_num => common_reply_count, :news_num => common_count, :resource_num => attachment_count, :journal_num => journal_count,
+ :homework_journal_num => journal_homework_count, :journal_reply_num => 0, :total_score => total)
+ end
+
+ end
+ end
+ end
+ end
+
+ def down
+ end
+end
From 3f56fa34059a883f6aa4ac869064de673815d85a Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 5 Mar 2016 03:14:57 +0800
Subject: [PATCH 13/25] 0
---
app/helpers/exercise_helper.rb | 354 +++----
.../admin/latest_login_teachers.html.erb | 168 +--
app/views/exercise/_edit_single.html.erb | 116 +--
app/views/exercise/_new_single.html.erb | 98 +-
app/views/files/_org_subfield_list.html.erb | 156 +--
app/views/files/_project_list.html.erb | 122 +--
app/views/files/_resource_detail.html.erb | 160 +--
app/views/files/_subfield_files.html.erb | 170 ++--
app/views/files/_upload_course_files.erb | 182 ++--
app/views/files/index.html.erb | 958 +++++++++---------
app/views/layouts/_logined_header.html.erb | 284 +++---
app/views/layouts/static_base.html.erb | 112 +-
.../_org_course_homework.html.erb | 724 ++++++-------
.../_homework_detail_information.html.erb | 60 +-
app/views/users/_homework_repository.html.erb | 76 +-
.../_homework_repository_detail.html.erb | 64 +-
.../users/_homework_search_input.html.erb | 56 +-
.../users/_import_resource_info.html.erb | 150 +--
.../users/_send_homework_to_course.html.erb | 156 +--
app/views/users/_show_user_homeworks.html.erb | 106 +-
.../users/_user_homework_detail.html.erb | 732 ++++++-------
app/views/users/_user_homework_form.html.erb | 538 +++++-----
app/views/users/_user_homework_list.html.erb | 80 +-
app/views/users/_user_homeworks_old.html.erb | 94 +-
app/views/users/_user_resource_info.html.erb | 118 +--
app/views/users/choose_user_course.js.erb | 12 +-
app/views/users/import_resources.js.erb | 36 +-
.../users/import_resources_search.js.erb | 50 +-
app/views/users/show_homework_detail.js.erb | 8 +-
app/views/users/student_homeworks.html.erb | 94 +-
app/views/users/user_homework_type.js.erb | 22 +-
app/views/users/user_homeworks.html.erb | 190 ++--
app/views/users/user_homeworks.js.erb | 10 +-
app/views/users/user_resource.js.erb | 30 +-
app/views/users/user_search_homeworks.js.erb | 16 +-
db/schema.rb | 3 +-
36 files changed, 3153 insertions(+), 3152 deletions(-)
diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb
index 5792c6487..6dadf92b5 100644
--- a/app/helpers/exercise_helper.rb
+++ b/app/helpers/exercise_helper.rb
@@ -1,178 +1,178 @@
-# encoding: utf-8
-module ExerciseHelper
-
- # 单选
- def sigle_selection_standard_answer(params)
- size = params.ord - 96
- if size > 0 # 小写字母答案
- answer = params.ord - 96
- else
- answer = params.ord - 64
- end
- end
-
- # 多选
- def multiselect_standard_answer(params)
- size = params.ord - 96
- answer = []
- if size > 0 # 小写字母答案
- for i in 0..(params.length-1)
- answer << (params[i].ord - 96).to_s
- end
- else
- for i in 0..(params.length-1)
- answer << (params[i].ord - 64)
- end
- end
- answer = answer.sort
- answer.join("")
- end
-
- #
- def fill_standart_answer(params, standart_answer)
- params.each do |param|
- standart_answer.answer_text = param.value
- standart_answer.save
- end
- end
-
- # 获取多选的得分
- def get_mulscore(question, user)
- ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id)
- arr = []
- ecs.each do |ec|
- arr << ec.exercise_choice.choice_position
- end
- #arr = arr.sort
- str = arr.sort.join("")
- return str
- end
-
- # 判断用户是否已经提交了问卷
- # status 为0的时候是用户点击试卷。为1表示用户已经提交
- def has_commit_exercise?(exercise_id, user_id)
- pu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise_id, user_id, true)
- if pu.empty?
- false
- else
- true
- end
- end
-
- # 判断学生是否点击过问卷,点击则为他保存一个记录,记录start_at
- def has_click_exercise?(exercise_id, user_id)
- pu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise_id, user_id, false)
- if pu.empty?
- false
- else
- true
- end
- end
-
- def convert_to_char(str)
- result = ""
- length = str.length
- unless str.nil?
- if length === 1
- result += (str.to_i + 64).chr
- return result
- elsif length > 1
- for i in 0...length
- result += (str[i].to_i + 64).chr
- end
- return result
- end
- end
- return result
- end
-
- def convert_to_chi_num num
- result = ""
- case num.to_i
- when 1
- result = '一'
- when 2
- result = '二'
- when 3
- result = '三'
- when 4
- result = '四'
- when 5
- result = '五'
- when 6
- result = '六'
- when 7
- result = '七'
- when 8
- result = '八'
- when 9
- result = '九'
- end
- return result
- end
-
- def get_current_score exercise
- score = 0
- unless exercise.nil?
- exercise.exercise_questions.each do |exercise_question|
- unless exercise_question.question_score.nil?
- score += exercise_question.question_score
- end
- end
- return score
- end
- return score
- end
-
- def answer_be_selected?(answer,user)
- pv = answer.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id} ")
- if !pv.nil? && pv.count > 0
- true
- else
- false
- end
- end
-
- #获取未完成的题目
- def get_uncomplete_question exercise,user
- all_questions = exercise.exercise_questions
- uncomplete_question = []
- all_questions.each do |question|
- answers = get_user_answer(question, user)
- if answers.empty?
- uncomplete_question << question
- end
- end
- uncomplete_question
- end
-
- #获取文本题答案
- def get_anwser_vote_text(question_id,user_id)
- pv = ExerciseAnswer.find_by_exercise_question_id_and_user_id(question_id,user_id)
- if pv.nil?
- ''
- else
- pv.answer_text
- end
- end
-
- # 获取当前学生回答问题的答案
- def get_user_answer(question,user)
- user_answer = question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id}")
- user_answer
- end
-
- # 获取问题的标准答案
- def get_user_standard_answer(question,user)
- if question.question_type == 3
- standard_answer =[]
- question.exercise_standard_answers.each do |answer|
- standard_answer << answer.answer_text
- end
- else
- standard_answer = question.exercise_standard_answers
- end
- standard_answer
- end
-
+# encoding: utf-8
+module ExerciseHelper
+
+ # 单选
+ def sigle_selection_standard_answer(params)
+ size = params.ord - 96
+ if size > 0 # 小写字母答案
+ answer = params.ord - 96
+ else
+ answer = params.ord - 64
+ end
+ end
+
+ # 多选
+ def multiselect_standard_answer(params)
+ size = params.ord - 96
+ answer = []
+ if size > 0 # 小写字母答案
+ for i in 0..(params.length-1)
+ answer << (params[i].ord - 96).to_s
+ end
+ else
+ for i in 0..(params.length-1)
+ answer << (params[i].ord - 64)
+ end
+ end
+ answer = answer.sort
+ answer.join("")
+ end
+
+ #
+ def fill_standart_answer(params, standart_answer)
+ params.each do |param|
+ standart_answer.answer_text = param.value
+ standart_answer.save
+ end
+ end
+
+ # 获取多选的得分
+ def get_mulscore(question, user)
+ ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id)
+ arr = []
+ ecs.each do |ec|
+ arr << ec.exercise_choice.choice_position
+ end
+ #arr = arr.sort
+ str = arr.sort.join("")
+ return str
+ end
+
+ # 判断用户是否已经提交了问卷
+ # status 为0的时候是用户点击试卷。为1表示用户已经提交
+ def has_commit_exercise?(exercise_id, user_id)
+ pu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise_id, user_id, true)
+ if pu.empty?
+ false
+ else
+ true
+ end
+ end
+
+ # 判断学生是否点击过问卷,点击则为他保存一个记录,记录start_at
+ def has_click_exercise?(exercise_id, user_id)
+ pu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise_id, user_id, false)
+ if pu.empty?
+ false
+ else
+ true
+ end
+ end
+
+ def convert_to_char(str)
+ result = ""
+ length = str.length
+ unless str.nil?
+ if length === 1
+ result += (str.to_i + 64).chr
+ return result
+ elsif length > 1
+ for i in 0...length
+ result += (str[i].to_i + 64).chr
+ end
+ return result
+ end
+ end
+ return result
+ end
+
+ def convert_to_chi_num num
+ result = ""
+ case num.to_i
+ when 1
+ result = '一'
+ when 2
+ result = '二'
+ when 3
+ result = '三'
+ when 4
+ result = '四'
+ when 5
+ result = '五'
+ when 6
+ result = '六'
+ when 7
+ result = '七'
+ when 8
+ result = '八'
+ when 9
+ result = '九'
+ end
+ return result
+ end
+
+ def get_current_score exercise
+ score = 0
+ unless exercise.nil?
+ exercise.exercise_questions.each do |exercise_question|
+ unless exercise_question.question_score.nil?
+ score += exercise_question.question_score
+ end
+ end
+ return score
+ end
+ return score
+ end
+
+ def answer_be_selected?(answer,user)
+ pv = answer.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id} ")
+ if !pv.nil? && pv.count > 0
+ true
+ else
+ false
+ end
+ end
+
+ #获取未完成的题目
+ def get_uncomplete_question exercise,user
+ all_questions = exercise.exercise_questions
+ uncomplete_question = []
+ all_questions.each do |question|
+ answers = get_user_answer(question, user)
+ if answers.empty?
+ uncomplete_question << question
+ end
+ end
+ uncomplete_question
+ end
+
+ #获取文本题答案
+ def get_anwser_vote_text(question_id,user_id)
+ pv = ExerciseAnswer.find_by_exercise_question_id_and_user_id(question_id,user_id)
+ if pv.nil?
+ ''
+ else
+ pv.answer_text
+ end
+ end
+
+ # 获取当前学生回答问题的答案
+ def get_user_answer(question,user)
+ user_answer = question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id}")
+ user_answer
+ end
+
+ # 获取问题的标准答案
+ def get_user_standard_answer(question,user)
+ if question.question_type == 3
+ standard_answer =[]
+ question.exercise_standard_answers.each do |answer|
+ standard_answer << answer.answer_text
+ end
+ else
+ standard_answer = question.exercise_standard_answers
+ end
+ standard_answer
+ end
+
end
\ No newline at end of file
diff --git a/app/views/admin/latest_login_teachers.html.erb b/app/views/admin/latest_login_teachers.html.erb
index a42e84369..05f20ba8d 100644
--- a/app/views/admin/latest_login_teachers.html.erb
+++ b/app/views/admin/latest_login_teachers.html.erb
@@ -1,84 +1,84 @@
-<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
-
- <%=l(:label_latest_login_user_list)%>
-
-<%= render 'tab_users' %>
-
-
- 最近登录老师列表
-
-<%= form_tag({}, :method => :get) do %>
-
-
- <%= l(:label_filter_plural) %>
-
- 开始日期:
- <%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange=>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
- <%= calendar_for('startdate')%>
- 结束日期:
- <%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
- <%= calendar_for('enddate')%>
- <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
- <%= link_to l(:button_clear), {:controller => 'admin', :action => 'latest_login_teachers'}, :class => 'icon icon-reload' %>
-
-<% end %>
-
-
-
+<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
+
+ <%=l(:label_latest_login_user_list)%>
+
+<%= render 'tab_users' %>
+
+
+ 最近登录老师列表
+
+<%= form_tag({}, :method => :get) do %>
+
+
+ <%= l(:label_filter_plural) %>
+
+ 开始日期:
+ <%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange=>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
+ <%= calendar_for('startdate')%>
+ 结束日期:
+ <%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
+ <%= calendar_for('enddate')%>
+ <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
+ <%= link_to l(:button_clear), {:controller => 'admin', :action => 'latest_login_teachers'}, :class => 'icon icon-reload' %>
+
+<% end %>
+
+
+
diff --git a/app/views/exercise/_edit_single.html.erb b/app/views/exercise/_edit_single.html.erb
index 52e865ba4..42878454d 100644
--- a/app/views/exercise/_edit_single.html.erb
+++ b/app/views/exercise/_edit_single.html.erb
@@ -1,59 +1,59 @@
-<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
-
-
-
-
-
+<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
+
+
+
+
+
<% end%>
\ No newline at end of file
diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb
index 3a65c072d..6180dac8e 100644
--- a/app/views/exercise/_new_single.html.erb
+++ b/app/views/exercise/_new_single.html.erb
@@ -1,50 +1,50 @@
-<%= form_for(ExerciseQuestion.new,
- :html => { :multipart => true },
- :url=>create_exercise_question_exercise_path(exercise.id),
- :remote=>true ) do |f| %>
-
+<%= form_for(ExerciseQuestion.new,
+ :html => { :multipart => true },
+ :url=>create_exercise_question_exercise_path(exercise.id),
+ :remote=>true ) do |f| %>
+
<% end %>
\ No newline at end of file
diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb
index d249aede9..38ff40ed3 100644
--- a/app/views/files/_org_subfield_list.html.erb
+++ b/app/views/files/_org_subfield_list.html.erb
@@ -1,78 +1,78 @@
-<% delete_allowed = User.current.admin? %>
-
-<% org_subfield_attachments.each do |file| %>
-
-
-
- <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
-
-
-
- <%= link_to truncate(file.filename,length: 35, omission: '...'),
- download_named_attachment_path(file.id, file.filename),
- :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14 f_l" %>
- <%= file_preview_eye(file, class: 'preview') %>
-
- <% if file.is_public? == false%>
- 私有
- <%end %>
-
-
-
-
-
上传时间:<%= format_date(file.created_on)%>
- <% if file.tag_list.length > 0%>
-
上传类型:<%= file.tag_list[0] %>
- <% end %>
-
文件大小:<%= number_to_human_size(file.filesize) %>
-
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
-
-
-
- <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
- <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
-
-
-
-
- <% if User.current.logged? %>
- <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
-
- <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
- <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
-
-
- <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
-
-
-
- <%= link_to( '删除资源', attachment_path(file),
- :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %>
-
-
- <%else%>
-
- <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
-
- <% end %>
- <% end %>
-
-
-
-
-
-
-
-
-
-<% end %>
-
-<% if org_subfield_attachments.count == 10 %>
- <% if params[:action] == 'search_files_in_subfield' %>
- <%=link_to "点击展开更多", search_files_in_subfield_org_subfield_files_path(:org_subfield_id => org_subfield.id,:page => @page.to_i + 1, :name => params[:name],:insite => params[:insite]),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
- <% else %>
-
- <%=link_to "点击展开更多", org_subfield_files_path(:org_subfield_id => org_subfield.id, :page => @page.nil? ? 2 :(@page.to_i + 1)), :id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
- <%end%>
-<% end%>
-
+<% delete_allowed = User.current.admin? %>
+
+<% org_subfield_attachments.each do |file| %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
+
+
+
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14 f_l" %>
+ <%= file_preview_eye(file, class: 'preview') %>
+
+ <% if file.is_public? == false%>
+ 私有
+ <%end %>
+
+
+
+
+
上传时间:<%= format_date(file.created_on)%>
+ <% if file.tag_list.length > 0%>
+
上传类型:<%= file.tag_list[0] %>
+ <% end %>
+
文件大小:<%= number_to_human_size(file.filesize) %>
+
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+
+
+
+ <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
+ <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
+
+
+
+
+ <% if User.current.logged? %>
+ <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
+
+ <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+ <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
+
+
+ <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
+
+
+
+ <%= link_to( '删除资源', attachment_path(file),
+ :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %>
+
+
+ <%else%>
+
+ <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
+
+<% end %>
+
+<% if org_subfield_attachments.count == 10 %>
+ <% if params[:action] == 'search_files_in_subfield' %>
+ <%=link_to "点击展开更多", search_files_in_subfield_org_subfield_files_path(:org_subfield_id => org_subfield.id,:page => @page.to_i + 1, :name => params[:name],:insite => params[:insite]),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
+ <% else %>
+
+ <%=link_to "点击展开更多", org_subfield_files_path(:org_subfield_id => org_subfield.id, :page => @page.nil? ? 2 :(@page.to_i + 1)), :id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
+ <%end%>
+<% end%>
+
diff --git a/app/views/files/_project_list.html.erb b/app/views/files/_project_list.html.erb
index 81227529e..a2a1670d1 100644
--- a/app/views/files/_project_list.html.erb
+++ b/app/views/files/_project_list.html.erb
@@ -1,61 +1,61 @@
-<% delete_allowed = User.current.allowed_to?(:manage_files, project) %>
-<% project_attachments.each do |file| %>
- <% if file.is_public? || User.current.member_of?(project) || User.current.admin? %>
-
-
-
- <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
-
-
-
- <%= link_to truncate(file.filename,length: 35, omission: '...'),
- download_named_attachment_path(file.id, file.filename),
- :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
- <%= file_preview_eye(file, class: 'preview') %>
-
- <% if file.is_public? == false%>
- 私有
- <%end %>
-
-
-
-
上传时间:<%= format_time(file.created_on)%>
- <% if file.tag_list.length > 0%>
-
上传类型:<%= file.tag_list[0] %>
- <% end %>
-
文件大小:<%= number_to_human_size(file.filesize) %>
-
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
-
-
-
-
- <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
- <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
-
-
- <%= render :partial => 'files/tool_settings', :locals => {:project => @project, :delete_allowed => delete_allowed, :file => file} %>
-
-
-
-
-
-
- <% else %>
- <%= file.filename %>是私有资源
- <% end %>
-<% end %>
-
-<% if project_attachments.count == 10%>
- <% if params[:action] == 'search_project' %>
-
-
-
- <%=link_to "点击展开更多", search_project_project_files_path({:project_id => project.id, :page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
- <%else%>
-
- <%=link_to "点击展开更多", project_files_path(:project_id => project.id,:page => @page),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
- <%end%>
-<% end%>
-
-
-
+<% delete_allowed = User.current.allowed_to?(:manage_files, project) %>
+<% project_attachments.each do |file| %>
+ <% if file.is_public? || User.current.member_of?(project) || User.current.admin? %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
+
+
+
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
+ <%= file_preview_eye(file, class: 'preview') %>
+
+ <% if file.is_public? == false%>
+ 私有
+ <%end %>
+
+
+
+
上传时间:<%= format_time(file.created_on)%>
+ <% if file.tag_list.length > 0%>
+
上传类型:<%= file.tag_list[0] %>
+ <% end %>
+
文件大小:<%= number_to_human_size(file.filesize) %>
+
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+
+
+
+
+ <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+ <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+
+
+ <%= render :partial => 'files/tool_settings', :locals => {:project => @project, :delete_allowed => delete_allowed, :file => file} %>
+
+
+
+
+
+
+ <% else %>
+ <%= file.filename %>是私有资源
+ <% end %>
+<% end %>
+
+<% if project_attachments.count == 10%>
+ <% if params[:action] == 'search_project' %>
+
+
+
+ <%=link_to "点击展开更多", search_project_project_files_path({:project_id => project.id, :page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
+ <%else%>
+
+ <%=link_to "点击展开更多", project_files_path(:project_id => project.id,:page => @page),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
+ <%end%>
+<% end%>
+
+
+
diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb
index bac00a68d..317bb7dd8 100644
--- a/app/views/files/_resource_detail.html.erb
+++ b/app/views/files/_resource_detail.html.erb
@@ -1,81 +1,81 @@
-<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
-
-
-
- <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
-
-
-
- <%= link_to truncate(file.filename,length: 35, omission: '...'),
- download_named_attachment_path(file.id, file.filename),
- :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
- <%= file_preview_eye(file, class: 'preview') %>
-
- <% if file.is_public? == false%>
- 私有
- <%end %>
-
- <% if file.is_publish == 0 %>
- <%=file.publish_time %> 0点发布
- <% end %>
-
-
-
上传时间:<%= format_time(file.created_on)%>
- <% if file.tag_list.length > 0%>
-
上传类型:<%= file.tag_list[0] %>
- <% end %>
-
文件大小:<%= number_to_human_size(file.filesize) %>
-
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
-
- <% unless file.description.blank? %>
-
-
资源描述:<%= file.description %>
- <% end %>
-
-
-
- <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
- <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
-
-
-
-
-
- <% if User.current.logged? %>
-
- <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
- <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
-
-
- <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
- <%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %>
- <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
- <% if @course.is_public? %>
-
-
- <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
-
-
- <%end%>
-
- <%= link_to( '删除资源', attachment_path(file),
- :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
-
-
-
- <% end %>
- <%else%>
-
- <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
-
- <% end %>
- <% end %>
-
-
-
-
-
-
-
-
+<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
+
+
+
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
+ <%= file_preview_eye(file, class: 'preview') %>
+
+ <% if file.is_public? == false%>
+ 私有
+ <%end %>
+
+ <% if file.is_publish == 0 %>
+ <%=file.publish_time %> 0点发布
+ <% end %>
+
+
+
上传时间:<%= format_time(file.created_on)%>
+ <% if file.tag_list.length > 0%>
+
上传类型:<%= file.tag_list[0] %>
+ <% end %>
+
文件大小:<%= number_to_human_size(file.filesize) %>
+
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+
+ <% unless file.description.blank? %>
+
+
资源描述:<%= file.description %>
+ <% end %>
+
+
+
+ <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+ <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+
+
+
+
+
+ <% if User.current.logged? %>
+
+ <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
+ <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
+
+
+ <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+ <%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %>
+ <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
+ <% if @course.is_public? %>
+
+
+ <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
+
+
+ <%end%>
+
+ <%= link_to( '删除资源', attachment_path(file),
+ :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
+
+
+
+ <% end %>
+ <%else%>
+
+ <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb
index c58f690e3..6531aa96b 100644
--- a/app/views/files/_subfield_files.html.erb
+++ b/app/views/files/_subfield_files.html.erb
@@ -1,86 +1,86 @@
-<%= stylesheet_link_tag 'courses'%>
-
-
-
-<%# html_title(l(:label_attachment_plural)) -%>
-
+
+
+<%# html_title(l(:label_attachment_plural)) -%>
+
\ No newline at end of file
diff --git a/app/views/files/_upload_course_files.erb b/app/views/files/_upload_course_files.erb
index d728d7a2d..133b8b4d6 100644
--- a/app/views/files/_upload_course_files.erb
+++ b/app/views/files/_upload_course_files.erb
@@ -1,92 +1,92 @@
-
-
-
-
<%= l(:label_upload_files)%>
-
- <%= error_messages_for 'attachment' %>
-
<%= l(:label_file_upload_error_messages)%>
-
- <%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
-
-
-
- 课件 |
- 软件 |
- 媒体 |
- 代码 |
- 论文 |
- 其他
-
-
-
- <%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
-
-
-
-
- <% if User.current.allowed_to?(:as_teacher,course) %>
-
-
延迟发布:
-
-
- <%#= calendar_for('attachment_publish_time')%>
-
-
-
-
- <% end %>
-
<%= l(:button_cancel)%>
-
<%= l(:button_confirm)%>
- <%#= submit_tag '确定',:onclick=>'submit_course_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
- <% end %>
-
-
-
- <% content_for :header_tags do %>
- <%= javascript_include_tag 'attachments' %>
- <% end %>
-
-
-
+
+
+
<%= l(:label_upload_files)%>
+
+ <%= error_messages_for 'attachment' %>
+
<%= l(:label_file_upload_error_messages)%>
+
+ <%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
+
+
+
+ 课件 |
+ 软件 |
+ 媒体 |
+ 代码 |
+ 论文 |
+ 其他
+
+
+
+ <%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
+
+
+
+
+ <% if User.current.allowed_to?(:as_teacher,course) %>
+
+
延迟发布:
+
+
+ <%#= calendar_for('attachment_publish_time')%>
+
+
+
+
+ <% end %>
+
<%= l(:button_cancel)%>
+
<%= l(:button_confirm)%>
+ <%#= submit_tag '确定',:onclick=>'submit_course_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
+ <% end %>
+
+
+
+ <% content_for :header_tags do %>
+ <%= javascript_include_tag 'attachments' %>
+ <% end %>
+
+
+
\ No newline at end of file
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb
index 27e51f05c..528265c26 100644
--- a/app/views/files/index.html.erb
+++ b/app/views/files/index.html.erb
@@ -1,479 +1,479 @@
-
- <% if @container_type == 0 %>
-
- <%= render :partial => 'project_file', locals: {project: @project} %>
-
- <% elsif @container_type == 1 %>
-
- <%= render :partial => 'course_file', locals: {course: @course} %>
-
- <% elsif @container_type == 2 %>
-
- <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
-
- <% end %>
-
-
-
-
-
+
+ <% if @container_type == 0 %>
+
+ <%= render :partial => 'project_file', locals: {project: @project} %>
+
+ <% elsif @container_type == 1 %>
+
+ <%= render :partial => 'course_file', locals: {course: @course} %>
+
+ <% elsif @container_type == 2 %>
+
+ <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
+
+ <% end %>
+
+
+
+
+
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index f2de04ea1..20239262f 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -1,142 +1,142 @@
-
-
- <%=link_to image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3"), user_activities_path(User.current.id)%>
-
-
-
-
-
- <% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
-
- <% else %>
-
- <% end %>
-
-
-
-
-
-
-
-
-
- <%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target =>"_Blank", :title => "您的所有消息" %>
- <% if User.current.count_new_message >0 %>
-
<%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %>
- <% end %>
- <%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
-
-
-
-
+
+
+ <%=link_to image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3"), user_activities_path(User.current.id)%>
+
+
+
+
+
+ <% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
+
+ <% else %>
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+ <%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target =>"_Blank", :title => "您的所有消息" %>
+ <% if User.current.count_new_message >0 %>
+
<%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %>
+ <% end %>
+ <%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
+
+
+
+
diff --git a/app/views/layouts/static_base.html.erb b/app/views/layouts/static_base.html.erb
index 32436f23d..096b1699b 100644
--- a/app/views/layouts/static_base.html.erb
+++ b/app/views/layouts/static_base.html.erb
@@ -1,56 +1,56 @@
-
-
-
-
-
<%=h html_title %>
-
-
- <%= csrf_meta_tag %>
- <%= favicon %>
- <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
- <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
- <%= javascript_heads %>
- <%= javascript_include_tag "jquery.leanModal.min",'prettify' %>
- <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
- <%= heads_for_theme %>
- <%= call_hook :view_layouts_base_html_head %>
-
- <%= yield :header_tags -%>
- <%= stylesheet_link_tag 'base','header', :media => 'all'%>
-
-
-
-
-
-
-
-
- <% if User.current.logged? %>
- <%= render :partial => 'layouts/logined_header',:locals=>{:name=>@name,:type=>@type} %>
- <% else%>
- <%= render :partial => 'layouts/unlogin_header',:locals=>{:name=>@name,:type=>@type} %>
- <% end%>
-
-
-
-
-<%= render :partial => 'layouts/footer' %>
-
-
-
- <%= l(:label_loading) %>
-
-<%= call_hook :view_layouts_base_body_bottom %>
-
-
+
+
+
+
+
<%=h html_title %>
+
+
+ <%= csrf_meta_tag %>
+ <%= favicon %>
+ <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
+ <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
+ <%= javascript_heads %>
+ <%= javascript_include_tag "jquery.leanModal.min",'prettify' %>
+ <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
+ <%= heads_for_theme %>
+ <%= call_hook :view_layouts_base_html_head %>
+
+ <%= yield :header_tags -%>
+ <%= stylesheet_link_tag 'base','header', :media => 'all'%>
+
+
+
+
+
+
+
+
+ <% if User.current.logged? %>
+ <%= render :partial => 'layouts/logined_header',:locals=>{:name=>@name,:type=>@type} %>
+ <% else%>
+ <%= render :partial => 'layouts/unlogin_header',:locals=>{:name=>@name,:type=>@type} %>
+ <% end%>
+
+
+
+
+<%= render :partial => 'layouts/footer' %>
+
+
+
+ <%= l(:label_loading) %>
+
+<%= call_hook :view_layouts_base_body_bottom %>
+
+
diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb
index 4767e2ad2..33a1801a0 100644
--- a/app/views/organizations/_org_course_homework.html.erb
+++ b/app/views/organizations/_org_course_homework.html.erb
@@ -1,363 +1,363 @@
-<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
-
-
-
- <% if activity.try(:user).try(:realname) == ' ' %>
- <%= link_to activity.try(:user), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
- <% end %> TO
- <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
-
-
- <%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%>
-
- <% if activity.homework_detail_manual%>
- <% if activity.homework_detail_manual.comment_status == 1%>
- <% if activity.anonymous_comment == 0%>
-
未开启匿评
- <% else %>
-
匿评已禁用
- <% end %>
- <% if Time.parse(activity.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%>
-
作品提交中
- <% elsif Time.parse(activity.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %>
-
作品补交中
- <% end %>
- <% elsif activity.homework_detail_manual.comment_status == 2%>
- <% if activity.anonymous_comment == 0%>
-
匿评中
- <% else %>
-
匿评已禁用
- <% end %>
-
教师评阅中
- <% elsif activity.homework_detail_manual.comment_status == 3%>
- <% if activity.anonymous_comment == 0%>
-
匿评已结束
- <% else %>
-
匿评已禁用
- <% end %>
-
教师评阅中
- <% end%>
- <% end%>
-
- <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
-
系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
- <% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
-
系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!
- <% end %>
-
- <% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%>
- <% projects = cur_user_projects_for_homework activity %>
- <% works = cur_user_works_for_homework activity %>
- <% if works.nil? && projects.nil? %>
-
- <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
- <%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
-
- <% elsif works.nil? %>
-
- <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
-
- <% end %>
- <% end %>
-
- <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
- <%= user_for_homework_common activity,is_teacher %>
-
-
- <% if activity.homework_type == 2 && is_teacher%>
-
- <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
-
- <% end %>
- <% if activity.homework_type == 2%>
-
- 语言:
- <%= activity.language_name%>
-
- <% end %>
- <% if activity.homework_type == 3 && activity.homework_detail_group%>
-
- 分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人
-
- <% end %>
- <% if activity.homework_detail_manual && activity.homework_detail_manual.comment_status < 2 %>
-
提交截止时间:<%= activity.end_time.to_s %> 23:59
- <% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 && activity.anonymous_comment == 0%>
-
匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %> 23:59
- <% end %>
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
-
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
- 迟交扣分:<%= activity.late_penalty%>分
-
- <% if activity.anonymous_comment == 0%>
-
- 匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%> 00:00
-
- <% end %>
-
-
-
- <% if activity.anonymous_comment == 0%>
-
- 缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
-
- <% end %>
- <% if activity.anonymous_comment == 0%>
-
- 匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
-
- <% end %>
-
-
- <% if activity.student_works.count != 0 %>
- <% sw = activity.student_works.reorder("created_at desc").first %>
-
- # <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
-
- <% end %>
-
- <% if activity.student_works.count != 0 %>
- <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
- <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
- <%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
- <% unless student_work_scores.empty? %>
- <% last_score = student_work_scores.first %>
-
-
# <%=time_from_now last_score.created_at %>
- <%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
-
- <% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
- <% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
- <% student_works.each_with_index do |sw, i| %>
-
- <% if i == 4 %>
- <% break %>
- <% end %>
- <% end %>
- <% if student_works.count > 5 %>
- <%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
- <% end %>
-
-
- <% end %>
- <% end %>
-
- <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
- <% projects = activity.student_work_projects.where("is_leader = 1") %>
- <% unless projects.empty? %>
- <% sort_projects = project_sort_update projects %>
-
-
- # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
-
-
- <% sort_projects.each_with_index do |pro, i| %>
- <% project = Project.find pro.project_id %>
-
-
-
- <% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
- <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
- <% else %>
- <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
- <% end %>
- <% com_time = project.project_score.commit_time %>
- <% time=project.updated_on %>
- <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
-
<%=(User.find project.user_id).show_name %> (组长)
-
<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %> <%= project.project_score.changeset_num %>提交
-
- 项目名称:<%=project.name %>
- 创建者:<%=(User.find project.user_id).show_name %>(组长)
- 更新时间:<%=time_from_now time %>
-
-
- <% if i == 9 && projects.count > 10 %>
-
更多>>
- <% end %>
- <% if i > 9 && i == (projects.count - 1) %>
-
收回<<
- <% end %>
- <% end %>
-
- <% end %>
- <% end %>
-
- <% if is_teacher%>
- <% comment_status = activity.homework_detail_manual.comment_status %>
-
-
-
-
-
- <%= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity), :class => "postOptionLink"%>
-
-
- <%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
-
-
- <%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => 0),:class => "postOptionLink", :remote => true) %>
-
- <% if activity.anonymous_comment == 0 %>
-
- <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
-
-
- <%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
-
- <% end %>
- <% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
-
- <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
-
- <% end %>
- <% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
-
- <%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
-
- <% elsif activity.is_open == 1 %>
-
- <%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
-
- <% end %>
-
-
-
-
- <% end%>
-
-
-
-
- <% count=activity.journals_for_messages.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.user == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.journals_for_messages.reorder("created_on desc").each do |comment| %>
-
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:user).try(:realname) == ' ' %>
- <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%>
- <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
- <%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
-
+
+
+ <% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
+ <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
+ <% else %>
+ <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
+ <% end %>
+ <% com_time = project.project_score.commit_time %>
+ <% time=project.updated_on %>
+ <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
+
<%=(User.find project.user_id).show_name %> (组长)
+
<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %> <%= project.project_score.changeset_num %>提交
+
+ 项目名称:<%=project.name %>
+ 创建者:<%=(User.find project.user_id).show_name %>(组长)
+ 更新时间:<%=time_from_now time %>
+
+
+ <% if i == 9 && projects.count > 10 %>
+
更多>>
+ <% end %>
+ <% if i > 9 && i == (projects.count - 1) %>
+
收回<<
+ <% end %>
+ <% end %>
+
+ <% end %>
+ <% end %>
+
+ <% if is_teacher%>
+ <% comment_status = activity.homework_detail_manual.comment_status %>
+
+
+
+
+
+ <%= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity), :class => "postOptionLink"%>
+
+
+ <%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
+
+
+ <%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => 0),:class => "postOptionLink", :remote => true) %>
+
+ <% if activity.anonymous_comment == 0 %>
+
+ <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
+
+
+ <%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
+
+ <% end %>
+ <% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
+
+ <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
+
+ <% end %>
+ <% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
+
+ <%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
+
+ <% elsif activity.is_open == 1 %>
+
+ <%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
+
+ <% end %>
+
+
+
+
+ <% end%>
+
+
+
+
+ <% count=activity.journals_for_messages.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.user == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.journals_for_messages.reorder("created_on desc").each do |comment| %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:user).try(:realname) == ' ' %>
+ <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%>
+ <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
+ <%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/_homework_detail_information.html.erb b/app/views/users/_homework_detail_information.html.erb
index e43b5b6c7..07328e696 100644
--- a/app/views/users/_homework_detail_information.html.erb
+++ b/app/views/users/_homework_detail_information.html.erb
@@ -1,31 +1,31 @@
-题目信息
-
- <% if homework.nil? %>
-
请先在左侧选择作业
- <% else %>
-
标题:<%=homework.name %>
- 来源:<%=homework.course.name %>
- <% if homework.homework_type == 2 && homework.homework_detail_programing %>
- 编程语言:<%=homework.language_name %>
- <% end %>
- 贡献者:<%=homework.user.show_name %>
- <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %>
- ,<%=homework.user.user_extensions.occupation%>
- <% end %>
-
- 描述如下:
-
-
- <%=homework.description.html_safe %>
-
- <% if homework.homework_type == 2 %>
-
- 测试集:<%=homework.homework_tests.count %>组
-
- <% elsif homework.homework_type ==3 && homework.homework_detail_group %>
-
- 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人
-
- <% end %>
- <% end %>
+
题目信息
+
+ <% if homework.nil? %>
+
请先在左侧选择作业
+ <% else %>
+
标题:<%=homework.name %>
+ 来源:<%=homework.course.name %>
+ <% if homework.homework_type == 2 && homework.homework_detail_programing %>
+ 编程语言:<%=homework.language_name %>
+ <% end %>
+ 贡献者:<%=homework.user.show_name %>
+ <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %>
+ ,<%=homework.user.user_extensions.occupation%>
+ <% end %>
+
+ 描述如下:
+
+
+ <%=homework.description.html_safe %>
+
+ <% if homework.homework_type == 2 %>
+
+ 测试集:<%=homework.homework_tests.count %>组
+
+ <% elsif homework.homework_type ==3 && homework.homework_detail_group %>
+
+ 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人
+
+ <% end %>
+ <% end %>
\ No newline at end of file
diff --git a/app/views/users/_homework_repository.html.erb b/app/views/users/_homework_repository.html.erb
index d514f4b59..a30e21a3f 100644
--- a/app/views/users/_homework_repository.html.erb
+++ b/app/views/users/_homework_repository.html.erb
@@ -1,39 +1,39 @@
-
-
-
- <% homeworks.each do |homework| %>
-
- <% end %>
+
+
+
+ <% homeworks.each do |homework| %>
+
+ <% end %>
\ No newline at end of file
diff --git a/app/views/users/_homework_repository_detail.html.erb b/app/views/users/_homework_repository_detail.html.erb
index f9df9eee5..7cf74e11e 100644
--- a/app/views/users/_homework_repository_detail.html.erb
+++ b/app/views/users/_homework_repository_detail.html.erb
@@ -1,33 +1,33 @@
-
-
题目信息
-
- <% if homework.nil? %>
-
请先在左侧选择作业
- <% else %>
-
标题:<%=homework.name %>
- 来源:<%=homework.course.name %>
- <% if homework.homework_type == 2 && homework.homework_detail_programing %>
- 编程语言:<%=homework.language_name %>
- <% end %>
- 贡献者:<%=homework.user.show_name %>
- <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %>
- ,<%=homework.user.user_extensions.occupation%>
- <% end %>
-
- 描述如下:
-
-
- <%=homework.description.html_safe %>
-
- <% if homework.homework_type == 2 %>
-
- 测试集:<%=homework.homework_tests.count %>组
-
- <% elsif homework.homework_type ==3 && homework.homework_detail_group %>
-
- 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人
-
- <% end %>
- <% end %>
-
+
+
题目信息
+
+ <% if homework.nil? %>
+
请先在左侧选择作业
+ <% else %>
+
标题:<%=homework.name %>
+ 来源:<%=homework.course.name %>
+ <% if homework.homework_type == 2 && homework.homework_detail_programing %>
+ 编程语言:<%=homework.language_name %>
+ <% end %>
+ 贡献者:<%=homework.user.show_name %>
+ <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %>
+ ,<%=homework.user.user_extensions.occupation%>
+ <% end %>
+
+ 描述如下:
+
+
+ <%=homework.description.html_safe %>
+
+ <% if homework.homework_type == 2 %>
+
+ 测试集:<%=homework.homework_tests.count %>组
+
+ <% elsif homework.homework_type ==3 && homework.homework_detail_group %>
+
+ 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人
+
+ <% end %>
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/users/_homework_search_input.html.erb b/app/views/users/_homework_search_input.html.erb
index 21d1b9625..d3dabccd4 100644
--- a/app/views/users/_homework_search_input.html.erb
+++ b/app/views/users/_homework_search_input.html.erb
@@ -1,29 +1,29 @@
-
-
\ No newline at end of file
diff --git a/app/views/users/_import_resource_info.html.erb b/app/views/users/_import_resource_info.html.erb
index a8f9650a7..bc1152ce4 100644
--- a/app/views/users/_import_resource_info.html.erb
+++ b/app/views/users/_import_resource_info.html.erb
@@ -1,75 +1,75 @@
-
-
选用资源库中的资源
-
- <% if !params[:course_id].nil? %>
-
公共资源
-
我的资源
- <% elsif !params[:project_id].nil? %>
-
公共资源
-
我的资源
- <% elsif !params[:subfield_file_id].nil? %>
-
公共资源
-
我的资源
- <% end %>
- <%#= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id, :type => 1),
- :remote => true , :method => 'get', :id => 'resource_search_form') do %>
-
- <%#= hidden_field_tag(:type,type.nil? ? 1 : type) %>
- <%# end %>
-
-
-
-
-
- 资源名称
- 类别
- 大小
- 上传者
- 上传时间
-
- <%= form_tag( url_for({:controller => 'users', :action => 'import_into_container',
- :mul_id => params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id],
- :mul_type => params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"}),
- :method => 'post', :id => 'resource_import_container_form') do %>
- <% @attachments.each do |attach| %>
-
- <% end %>
- <% end %>
-
-
-
-
-
-
-
-
+
+
选用资源库中的资源
+
+ <% if !params[:course_id].nil? %>
+
公共资源
+
我的资源
+ <% elsif !params[:project_id].nil? %>
+
公共资源
+
我的资源
+ <% elsif !params[:subfield_file_id].nil? %>
+
公共资源
+
我的资源
+ <% end %>
+ <%#= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id, :type => 1),
+ :remote => true , :method => 'get', :id => 'resource_search_form') do %>
+
+ <%#= hidden_field_tag(:type,type.nil? ? 1 : type) %>
+ <%# end %>
+
+
+
+
+
+ 资源名称
+ 类别
+ 大小
+ 上传者
+ 上传时间
+
+ <%= form_tag( url_for({:controller => 'users', :action => 'import_into_container',
+ :mul_id => params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id],
+ :mul_type => params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"}),
+ :method => 'post', :id => 'resource_import_container_form') do %>
+ <% @attachments.each do |attach| %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
diff --git a/app/views/users/_send_homework_to_course.html.erb b/app/views/users/_send_homework_to_course.html.erb
index 902eebe22..b19fbd1a8 100644
--- a/app/views/users/_send_homework_to_course.html.erb
+++ b/app/views/users/_send_homework_to_course.html.erb
@@ -1,79 +1,79 @@
-
-
-
-
-
-
-
- <%= form_tag send_homework_to_course_user_path(user),:remote=>true,:id=>'choose_course_list_form' %>
-
- <%= hidden_field_tag(:send_id, send_id) %>
-
- <% if !courses.empty? %>
- <% courses.each do |course| %>
-
- <% end %>
-
-
-
-
-
-
- <% end %>
-
-
\ No newline at end of file
diff --git a/app/views/users/_show_user_homeworks.html.erb b/app/views/users/_show_user_homeworks.html.erb
index e78651032..13f9350fb 100644
--- a/app/views/users/_show_user_homeworks.html.erb
+++ b/app/views/users/_show_user_homeworks.html.erb
@@ -1,53 +1,53 @@
-
-
选用题库中的题目
-
-
公共题库
-
我的题库
-
- <%=render :partial=>'homework_search_input', :locals=>{:type => @type,:is_import => 1} %>
-
-
-
-
- 作业名称
- 来源
- 类别
- 贡献者
- 引用数
- 发布时间
-
-
- <%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %>
-
-
- <%= render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks}%>
-
- <% end %>
-
-
-
-
- <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
-
-
-
-
-
- <%=render :partial=>'homework_detail_information', :locals=>{:homework=>nil} %>
-
-
-
-
+
+
选用题库中的题目
+
+
公共题库
+
我的题库
+
+ <%=render :partial=>'homework_search_input', :locals=>{:type => @type,:is_import => 1} %>
+
+
+
+
+ 作业名称
+ 来源
+ 类别
+ 贡献者
+ 引用数
+ 发布时间
+
+
+ <%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %>
+
+
+ <%= render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks}%>
+
+ <% end %>
+
+
+
+
+ <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
+
+
+
+
+
+ <%=render :partial=>'homework_detail_information', :locals=>{:homework=>nil} %>
+
+
+
+
diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb
index bf4f4cde6..e2b893382 100644
--- a/app/views/users/_user_homework_detail.html.erb
+++ b/app/views/users/_user_homework_detail.html.erb
@@ -1,367 +1,367 @@
-<% is_teacher = User.current.allowed_to?(:as_teacher,homework_common.course) %>
-
-
-
- <%=link_to image_tag(url_to_avatar(homework_common.user),width:"50px", height: "50px"), user_activities_path(homework_common.user.id)%>
-
-
-
- <%= link_to homework_common.user.show_name, user_activities_path(homework_common.user_id), :class => "newsBlue mr15"%>
- TO
- <%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue ml15"%>
-
-
- <%= link_to homework_common.name,student_work_index_path(:homework => homework_common.id),:class => "postGrey"%>
-
-
- <% if homework_common.homework_detail_manual%>
- <% if homework_common.homework_detail_manual.comment_status == 0 && homework_common.publish_time.nil? %>
-
挂起
- <% elsif homework_common.homework_detail_manual.comment_status == 0 %>
-
未发布
- <% elsif homework_common.homework_detail_manual.comment_status == 1%>
- <% if homework_common.anonymous_comment == 0%>
-
未开启匿评
- <% else %>
-
匿评已禁用
- <% end %>
- <% if Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%>
-
作品提交中
- <% elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %>
-
作品补交中
- <% end %>
- <% elsif homework_common.homework_detail_manual.comment_status == 2%>
- <% if homework_common.anonymous_comment == 0%>
-
匿评中
- <% else %>
-
匿评已禁用
- <% end %>
-
教师评阅中
- <% elsif homework_common.homework_detail_manual.comment_status == 3%>
- <% if homework_common.anonymous_comment == 0%>
-
匿评已结束
- <% else %>
-
匿评已禁用
- <% end %>
-
教师评阅中
- <% end%>
- <% end%>
-
- <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1%>
-
系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
- <% elsif homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 0%>
-
系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!
- <% end %>
-
- <% if homework_common.homework_type == 3 && !is_teacher && homework_common.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(homework_common.course) %>
- <% projects = cur_user_projects_for_homework homework_common %>
- <% works = cur_user_works_for_homework homework_common %>
- <% if works.nil? && projects.nil? %>
-
- <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
- <%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
-
- <% elsif works.nil? %>
-
- <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
-
- <% end %>
- <% end %>
-
- <%= user_for_homework_common homework_common,is_teacher %>
-
- <% if homework_common.homework_type == 2 && is_teacher%>
-
- <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
-
- <% end %>
- <% if homework_common.homework_type == 2%>
-
- 语言:
- <%= homework_common.language_name%>
-
- <% end %>
- <% if homework_common.homework_type == 3 && homework_common.homework_detail_group%>
-
- 分组人数:<%=homework_common.homework_detail_group.min_num %>-<%=homework_common.homework_detail_group.max_num %> 人
-
- <% end %>
- <% if homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status < 2 && !homework_common.publish_time.nil? %>
-
提交截止时间:<%= homework_common.end_time.to_s %> 23:59
- <% elsif homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status >= 2 && !homework_common.publish_time.nil? && homework_common.anonymous_comment == 0 %>
-
匿评截止时间:<%= homework_common.homework_detail_manual.evaluation_end.to_s %> 23:59
- <% end %>
- <% if homework_common.homework_detail_manual.comment_status == 0 && !homework_common.publish_time.nil? %>
-
- <%= l(:label_publish_time)%>:<%= homework_common.publish_time%> 00:00
-
- <% end %>
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>homework_common.id, :content=>homework_common.description} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => homework_common} %>
-
-
-
- 迟交扣分:<%= homework_common.late_penalty%>分
-
- <% if homework_common.anonymous_comment == 0 && !homework_common.publish_time.nil?%>
-
- 匿评开启时间:<%= homework_common.homework_detail_manual.evaluation_start%> 00:00
-
- <% end %>
-
-
-
- <% if homework_common.anonymous_comment == 0 %>
-
- 缺评扣分:<%= homework_common.homework_detail_manual.absence_penalty%>分/作品
-
- <% end %>
- <% if homework_common.anonymous_comment == 0 && !homework_common.publish_time.nil?%>
-
- 匿评关闭时间:<%= homework_common.homework_detail_manual.evaluation_end%> 23:59
-
- <% end %>
-
-
- <% if homework_common.student_works.count != 0 %>
- <% sw = homework_common.student_works.reorder("created_at desc").first %>
-
- # <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
-
- <% end %>
-
- <% if homework_common.student_works.count != 0 %>
- <% sw_id = "("+homework_common.student_works.map{|sw| sw.id}.join(",")+")" %>
- <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
- <%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
- <% unless student_work_scores.empty? %>
- <% last_score = student_work_scores.first %>
-
-
# <%=time_from_now last_score.created_at %>
- <%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
-
- <% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
- <% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
- <% student_works.each_with_index do |sw, i| %>
-
- <% if i == 4 %>
- <% break %>
- <% end %>
- <% end %>
- <% if student_works.count > 5%>
- <%= link_to "更多>>", student_work_index_path(:homework => homework_common.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
- <% end %>
-
-
- <% end %>
- <% end %>
-
- <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>
- <% projects = homework_common.student_work_projects.where("is_leader = 1") %>
- <% unless projects.empty? %>
- <% sort_projects = project_sort_update projects %>
-
-
- # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
-
-
- <% sort_projects.each_with_index do |pro, i| %>
- <% project = Project.find pro.project_id %>
-
-
-
- <% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
- <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像" %>
- <% else %>
- <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %>
- <% end %>
- <% com_time = project.project_score.commit_time %>
- <% time=project.updated_on %>
- <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
-
<%=(User.find project.user_id).show_name %> (组长)
-
<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %> <%= project.project_score.changeset_num %>提交
-
- 项目名称:<%=project.name %>
- 创建者:<%=(User.find project.user_id).show_name %>(组长)
- 更新时间:<%=time_from_now time %>
-
-
- <% if i == 9 && projects.count > 10 %>
-
更多>>
- <% end %>
- <% if i > 9 && i == (projects.count - 1) %>
-
收回<<
- <% end %>
- <% end %>
-
- <% end %>
- <% end %>
-
- <% if is_teacher%>
- <% comment_status = homework_common.homework_detail_manual.comment_status%>
-
-
-
-
-
- <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1), :class => "postOptionLink"%>
-
-
- <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
-
-
- <%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true) %>
-
- <% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%>
-
- <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true)%>
-
- <% end %>
- <% if homework_common.anonymous_comment == 0%>
-
- <%= homework_anonymous_comment(homework_common, is_in_course) %>
-
- <% end %>
- <% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
-
- <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink", :remote => true)%>
-
- <% end %>
- <% if (homework_common.anonymous_comment == 1 && homework_common.is_open == 0) || (homework_common.anonymous_comment == 0 && comment_status == 3 && homework_common.is_open == 0) %>
-
- <%= link_to("公开作品", alert_open_student_works_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=> -1),:class => "postOptionLink", :remote => true)%>
-
- <% elsif homework_common.is_open == 1 %>
-
- <%= link_to("取消公开", alert_open_student_works_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=> -1),:class => "postOptionLink", :remote => true)%>
-
- <% end %>
-
-
-
-
- <% end%>
-
-
-
-
- <% count=homework_common.journals_for_messages.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if homework_common.user == User.current %>
- 赞 <%= get_praise_num(homework_common) > 0 ? "(#{get_praise_num(homework_common)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>homework_common, :user_activity_id=>homework_common.id,:type=>"activity"}%>
- <% end %>
-
-
-
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% homework_common.journals_for_messages.reorder("created_on desc").each do |comment| %>
-
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:user).try(:realname) == ' ' %>
- <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => homework_common.id},:method => "post", :remote => true) do |f|%>
- <%= hidden_field_tag 'homework_common_id',params[:homework_common_id],:value =>homework_common.id %>
- <%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %>
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
-
+
+
+ <% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
+ <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像" %>
+ <% else %>
+ <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %>
+ <% end %>
+ <% com_time = project.project_score.commit_time %>
+ <% time=project.updated_on %>
+ <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
+
<%=(User.find project.user_id).show_name %> (组长)
+
<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %> <%= project.project_score.changeset_num %>提交
+
+ 项目名称:<%=project.name %>
+ 创建者:<%=(User.find project.user_id).show_name %>(组长)
+ 更新时间:<%=time_from_now time %>
+
+
+ <% if i == 9 && projects.count > 10 %>
+
更多>>
+ <% end %>
+ <% if i > 9 && i == (projects.count - 1) %>
+
收回<<
+ <% end %>
+ <% end %>
+
+ <% end %>
+ <% end %>
+
+ <% if is_teacher%>
+ <% comment_status = homework_common.homework_detail_manual.comment_status%>
+
+
+
+
+
+ <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1), :class => "postOptionLink"%>
+
+
+ <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
+
+
+ <%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true) %>
+
+ <% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%>
+
+ <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true)%>
+
+ <% end %>
+ <% if homework_common.anonymous_comment == 0%>
+
+ <%= homework_anonymous_comment(homework_common, is_in_course) %>
+
+ <% end %>
+ <% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
+
+ <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink", :remote => true)%>
+
+ <% end %>
+ <% if (homework_common.anonymous_comment == 1 && homework_common.is_open == 0) || (homework_common.anonymous_comment == 0 && comment_status == 3 && homework_common.is_open == 0) %>
+
+ <%= link_to("公开作品", alert_open_student_works_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=> -1),:class => "postOptionLink", :remote => true)%>
+
+ <% elsif homework_common.is_open == 1 %>
+
+ <%= link_to("取消公开", alert_open_student_works_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=> -1),:class => "postOptionLink", :remote => true)%>
+
+ <% end %>
+
+
+
+
+ <% end%>
+
+
+
+
+ <% count=homework_common.journals_for_messages.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if homework_common.user == User.current %>
+ 赞 <%= get_praise_num(homework_common) > 0 ? "(#{get_praise_num(homework_common)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>homework_common, :user_activity_id=>homework_common.id,:type=>"activity"}%>
+ <% end %>
+
+
+
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% homework_common.journals_for_messages.reorder("created_on desc").each do |comment| %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:user).try(:realname) == ' ' %>
+ <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => homework_common.id},:method => "post", :remote => true) do |f|%>
+ <%= hidden_field_tag 'homework_common_id',params[:homework_common_id],:value =>homework_common.id %>
+ <%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %>
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb
index 88e81827e..910e799c8 100644
--- a/app/views/users/_user_homework_form.html.erb
+++ b/app/views/users/_user_homework_form.html.erb
@@ -1,270 +1,270 @@
-<% content_for :header_tags do %>
- <%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
-
- <%= javascript_include_tag 'homework','baiduTemplate' %>
-
-<% end %>
-
-
-
-
-
-
-
- <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
- <% unless edit_mode %>
-
- <% end %>
- <% if edit_mode %>
-
截止日期:
- <% end %>
-
-
- <% if homework.homework_detail_manual.comment_status.to_i < 3 %>
- <%= calendar_for('homework_end_time')%>
- <% end %>
-
- <% if edit_mode %>
-
发布日期(可选):
- <% end %>
-
-
- <% if homework.homework_detail_manual.comment_status.to_i == 0 %>
- <%= calendar_for('homework_publish_time')%>
- <% end %>
-
- <% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
-
-
- 禁用匿评
-
- <% end %>
-
-
-
-
-
-
- <% if edit_mode %>
-
- <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %>
- <% else %>
- <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
-
- <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %>
- <% end %>
-
-
-
-
- <%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
-
-
-
-
-
-
- <%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type != 2), :has_group=>(!(edit_mode && homework.homework_type != 3))&& homework.student_works.empty?,:show_member => true} %>
-
-
-
- <% if edit_mode %>
-
确定
-
或
- <%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
-
取消
- <% else %>
-
发送
-
或
-
取消
- <% end %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<% unless edit_mode %>
-
+<% content_for :header_tags do %>
+ <%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
+
+ <%= javascript_include_tag 'homework','baiduTemplate' %>
+
+<% end %>
+
+
+
+
+
+
+
+ <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
+ <% unless edit_mode %>
+
+ <% end %>
+ <% if edit_mode %>
+
截止日期:
+ <% end %>
+
+
+ <% if homework.homework_detail_manual.comment_status.to_i < 3 %>
+ <%= calendar_for('homework_end_time')%>
+ <% end %>
+
+ <% if edit_mode %>
+
发布日期(可选):
+ <% end %>
+
+
+ <% if homework.homework_detail_manual.comment_status.to_i == 0 %>
+ <%= calendar_for('homework_publish_time')%>
+ <% end %>
+
+ <% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
+
+
+ 禁用匿评
+
+ <% end %>
+
+
+
+
+
+
+ <% if edit_mode %>
+
+ <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %>
+ <% else %>
+ <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
+
+ <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %>
+ <% end %>
+
+
+
+
+ <%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
+
+
+
+
+
+
+ <%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type != 2), :has_group=>(!(edit_mode && homework.homework_type != 3))&& homework.student_works.empty?,:show_member => true} %>
+
+
+
+ <% if edit_mode %>
+
确定
+
或
+ <%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
+
取消
+ <% else %>
+
发送
+
或
+
取消
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<% unless edit_mode %>
+
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb
index ffd757390..e42c5d8b2 100644
--- a/app/views/users/_user_homework_list.html.erb
+++ b/app/views/users/_user_homework_list.html.erb
@@ -1,40 +1,40 @@
-<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
-<% end %>
-
-
-<% homework_commons.each do |homework_common|%>
-
- <%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %>
-<% end%>
-<% if homework_commons.count == 10%>
- <% if is_in_course == 1%>
-
- <%= link_to "点击展开更多",homework_common_index_path(:course => course_id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
- <% else%>
-
- <%= link_to "点击展开更多",student_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
- <% end%>
-<% end%>
-
+<%= content_for(:header_tags) do %>
+ <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
+<% end %>
+
+
+<% homework_commons.each do |homework_common|%>
+
+ <%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %>
+<% end%>
+<% if homework_commons.count == 10%>
+ <% if is_in_course == 1%>
+
+ <%= link_to "点击展开更多",homework_common_index_path(:course => course_id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
+ <% else%>
+
+ <%= link_to "点击展开更多",student_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
+ <% end%>
+<% end%>
+
diff --git a/app/views/users/_user_homeworks_old.html.erb b/app/views/users/_user_homeworks_old.html.erb
index fefea3e8c..59ec24ad3 100644
--- a/app/views/users/_user_homeworks_old.html.erb
+++ b/app/views/users/_user_homeworks_old.html.erb
@@ -1,47 +1,47 @@
-
-
-
-
-<% if @is_teacher%>
-
-
- <% homework = HomeworkCommon.new %>
- <% homework.homework_detail_manual = HomeworkDetailManual.new%>
- <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
-
- <%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
-
- <% end%>
-
-<% end%>
-
-<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0,:is_in_course => 0} %>
+
+
+
+
+<% if @is_teacher%>
+
+
+ <% homework = HomeworkCommon.new %>
+ <% homework.homework_detail_manual = HomeworkDetailManual.new%>
+ <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
+
+ <%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
+
+ <% end%>
+
+<% end%>
+
+<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0,:is_in_course => 0} %>
diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb
index 2d5415c4e..cafbf457f 100644
--- a/app/views/users/_user_resource_info.html.erb
+++ b/app/views/users/_user_resource_info.html.erb
@@ -1,60 +1,60 @@
-
-
-
- <%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %>
-
-
为您找到<%= @atta_count %> 个资源
-
-
-
-
- 资源名称
- 上传时间
- 引用数
- 下载数
- 大小
- 上传者
- 类别
- 来源
-
-
-
-
-
- <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
-
-
-
-
-
-
-
-
-
+
+
+
+ <%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %>
+
+
为您找到<%= @atta_count %> 个资源
+
+
+
+
+ 资源名称
+ 上传时间
+ 引用数
+ 下载数
+ 大小
+ 上传者
+ 类别
+ 来源
+
+
+
+
+
+ <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/choose_user_course.js.erb b/app/views/users/choose_user_course.js.erb
index 0be5990e9..508004816 100644
--- a/app/views/users/choose_user_course.js.erb
+++ b/app/views/users/choose_user_course.js.erb
@@ -1,7 +1,7 @@
-$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/send_homework_to_course', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>');
-showModal('ajax-modal', '452px');
-$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before(" ");
-$('#ajax-modal').parent().css("top","50%").css("left","50%");
-$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
+$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/send_homework_to_course', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>');
+showModal('ajax-modal', '452px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before(" ");
+$('#ajax-modal').parent().css("top","50%").css("left","50%");
+$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
\ No newline at end of file
diff --git a/app/views/users/import_resources.js.erb b/app/views/users/import_resources.js.erb
index 197f42ea7..6244e8e64 100644
--- a/app/views/users/import_resources.js.erb
+++ b/app/views/users/import_resources.js.erb
@@ -1,18 +1,18 @@
-<% if params[:project_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :project_id => params[:project_id]} ) %>');
-<% elsif params[:course_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :course_id => params[:course_id]} ) %>');
-<% elsif params[:subfield_file_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :subfield_file_id => params[:subfield_file_id]} ) %>');
-<% end %>
-showModal('ajax-modal', '615px');
-$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before(" ");
-<% if params[:project_id] %>
-$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9");
-<% else %>
-$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9");
-<% end %>
-$('#ajax-modal').parent().addClass("popbox_polls");
-
-
+<% if params[:project_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :project_id => params[:project_id]} ) %>');
+<% elsif params[:course_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :course_id => params[:course_id]} ) %>');
+<% elsif params[:subfield_file_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :subfield_file_id => params[:subfield_file_id]} ) %>');
+<% end %>
+showModal('ajax-modal', '615px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before(" ");
+<% if params[:project_id] %>
+$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9");
+<% else %>
+$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9");
+<% end %>
+$('#ajax-modal').parent().addClass("popbox_polls");
+
+
diff --git a/app/views/users/import_resources_search.js.erb b/app/views/users/import_resources_search.js.erb
index ff7cdb092..549cf6329 100644
--- a/app/views/users/import_resources_search.js.erb
+++ b/app/views/users/import_resources_search.js.erb
@@ -1,25 +1,25 @@
-//$("#resources_list").html('<%#= escape_javascript( render :partial => 'users/import_resource_info' ,:locals=>{ :attachments => @attachments, :type => @type})%>');
-//$("#pages").html('<%#= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-//$("#res_all_count").html(<%#= @atta_count%>);
-//$("#res_count").html(0);
-//$("#checkboxAll").attr('checked',false);
-
-
-<% if params[:project_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :project_id => params[:project_id]} ) %>');
-<% elsif params[:course_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :course_id => params[:course_id]} ) %>');
-<% elsif params[:subfield_file_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :subfield_file_id => params[:subfield_file_id]} ) %>');
-<% end %>
-showModal('ajax-modal', '615px');
-$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before(" ");
-<% if params[:project_id] %>
-$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9");
-<% else %>
-$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9");
-<% end %>
-$('#ajax-modal').parent().addClass("popbox_polls");
-
-
+//$("#resources_list").html('<%#= escape_javascript( render :partial => 'users/import_resource_info' ,:locals=>{ :attachments => @attachments, :type => @type})%>');
+//$("#pages").html('<%#= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+//$("#res_all_count").html(<%#= @atta_count%>);
+//$("#res_count").html(0);
+//$("#checkboxAll").attr('checked',false);
+
+
+<% if params[:project_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :project_id => params[:project_id]} ) %>');
+<% elsif params[:course_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :course_id => params[:course_id]} ) %>');
+<% elsif params[:subfield_file_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :subfield_file_id => params[:subfield_file_id]} ) %>');
+<% end %>
+showModal('ajax-modal', '615px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before(" ");
+<% if params[:project_id] %>
+$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9");
+<% else %>
+$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9");
+<% end %>
+$('#ajax-modal').parent().addClass("popbox_polls");
+
+
diff --git a/app/views/users/show_homework_detail.js.erb b/app/views/users/show_homework_detail.js.erb
index 6652e5344..a5dd82453 100644
--- a/app/views/users/show_homework_detail.js.erb
+++ b/app/views/users/show_homework_detail.js.erb
@@ -1,5 +1,5 @@
-<% if @is_import.to_i == 1 %>
- $("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>@homework}) %>");
-<% else %>
- $("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>@homework}) %>");
+<% if @is_import.to_i == 1 %>
+ $("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>@homework}) %>");
+<% else %>
+ $("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>@homework}) %>");
<% end %>
\ No newline at end of file
diff --git a/app/views/users/student_homeworks.html.erb b/app/views/users/student_homeworks.html.erb
index fefea3e8c..59ec24ad3 100644
--- a/app/views/users/student_homeworks.html.erb
+++ b/app/views/users/student_homeworks.html.erb
@@ -1,47 +1,47 @@
-
-
-
-
-<% if @is_teacher%>
-
-
- <% homework = HomeworkCommon.new %>
- <% homework.homework_detail_manual = HomeworkDetailManual.new%>
- <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
-
- <%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
-
- <% end%>
-
-<% end%>
-
-<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0,:is_in_course => 0} %>
+
+
+
+
+<% if @is_teacher%>
+
+
+ <% homework = HomeworkCommon.new %>
+ <% homework.homework_detail_manual = HomeworkDetailManual.new%>
+ <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
+
+ <%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
+
+ <% end%>
+
+<% end%>
+
+<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0,:is_in_course => 0} %>
diff --git a/app/views/users/user_homework_type.js.erb b/app/views/users/user_homework_type.js.erb
index 246a927b0..1204f1798 100644
--- a/app/views/users/user_homework_type.js.erb
+++ b/app/views/users/user_homework_type.js.erb
@@ -1,11 +1,11 @@
-<% if @is_import.to_i == 1 %>
-$("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>');
-$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
-$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type,:is_import=>@is_import}) %>");
-<% else %>
-$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
-$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
-$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type,:is_import=>@is_import}) %>");
-<% end %>
+<% if @is_import.to_i == 1 %>
+$("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>');
+$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
+$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type,:is_import=>@is_import}) %>");
+<% else %>
+$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
+$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
+$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type,:is_import=>@is_import}) %>");
+<% end %>
diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb
index e48d51ec7..3e0342af7 100644
--- a/app/views/users/user_homeworks.html.erb
+++ b/app/views/users/user_homeworks.html.erb
@@ -1,96 +1,96 @@
-<%= stylesheet_link_tag 'pleft','header','new_user','repository','org', 'public' %>
-
-
-
-
-
-
-
-
- <%=render :partial=>'homework_search_input', :locals=>{:type => @type,:is_import => 0} %>
-
-
-
-
-
- 作业名称
- 来源
- 类别
- 贡献者
- 引用数
- 发布时间
-
-
- <%=render :partial => 'homework_repository', :locals => {:homeworks => @homeworks} %>
-
-
-
- <%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %>
-
-
-
-
- <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
-
-
-
-
-
-
-
+<%= stylesheet_link_tag 'pleft','header','new_user','repository','org', 'public' %>
+
+
+
+
+
+
+
+
+ <%=render :partial=>'homework_search_input', :locals=>{:type => @type,:is_import => 0} %>
+
+
+
+
+
+ 作业名称
+ 来源
+ 类别
+ 贡献者
+ 引用数
+ 发布时间
+
+
+ <%=render :partial => 'homework_repository', :locals => {:homeworks => @homeworks} %>
+
+
+
+ <%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %>
+
+
+
+
+ <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/user_homeworks.js.erb b/app/views/users/user_homeworks.js.erb
index d5be28186..ec9b2e004 100644
--- a/app/views/users/user_homeworks.js.erb
+++ b/app/views/users/user_homeworks.js.erb
@@ -1,5 +1,5 @@
-$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
-$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
-/*$("#user_show_more_homework").replaceWith("<%#= escape_javascript( render :partial => 'users/user_homework_list',:locals => {:homework_commons => @homework_commons, :page => @page,:is_in_course => 0} )%>");*/
-
+$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
+$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
+/*$("#user_show_more_homework").replaceWith("<%#= escape_javascript( render :partial => 'users/user_homework_list',:locals => {:homework_commons => @homework_commons, :page => @page,:is_in_course => 0} )%>");*/
+
diff --git a/app/views/users/user_resource.js.erb b/app/views/users/user_resource.js.erb
index a39fd4468..4ba186579 100644
--- a/app/views/users/user_resource.js.erb
+++ b/app/views/users/user_resource.js.erb
@@ -1,15 +1,15 @@
-$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form', :locals => {:user => @user, :type => @type} ) %>');
-$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' , :locals => { :attachments => @attachments}) %>');
-$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#res_count").html(0);
-$("#checkboxAll").attr('checked',false);
-$("#res_all_count").html(<%= @atta_count %>);
-
-$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6', :status => @status) %>');
-$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1', :status => @status) %>');
-
-$("#resource_type_all").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 1) %>');
-$("#resource_type_course").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 2) %>');
-$("#resource_type_project").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 3) %>');
-$("#resource_type_user").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 5) %>');
-$("#resource_type_file").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 4) %>');
+$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form', :locals => {:user => @user, :type => @type} ) %>');
+$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' , :locals => { :attachments => @attachments}) %>');
+$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#res_count").html(0);
+$("#checkboxAll").attr('checked',false);
+$("#res_all_count").html(<%= @atta_count %>);
+
+$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6', :status => @status) %>');
+$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1', :status => @status) %>');
+
+$("#resource_type_all").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 1) %>');
+$("#resource_type_course").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 2) %>');
+$("#resource_type_project").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 3) %>');
+$("#resource_type_user").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 5) %>');
+$("#resource_type_file").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 4) %>');
diff --git a/app/views/users/user_search_homeworks.js.erb b/app/views/users/user_search_homeworks.js.erb
index d5955c43b..34d73b823 100644
--- a/app/views/users/user_search_homeworks.js.erb
+++ b/app/views/users/user_search_homeworks.js.erb
@@ -1,9 +1,9 @@
-<% if @is_import.to_i == 1 %>
-$("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>');
-$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
-<% else %>
-$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
-$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
+<% if @is_import.to_i == 1 %>
+$("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>');
+$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
+<% else %>
+$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
+$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
<% end %>
\ No newline at end of file
diff --git a/db/schema.rb b/db/schema.rb
index 2781c7614..c21580c90 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20160303103231) do
+ActiveRecord::Schema.define(:version => 20160304154643) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -436,6 +436,7 @@ ActiveRecord::Schema.define(:version => 20160303103231) do
t.datetime "updated_at", :null => false
t.integer "total_score"
t.integer "homework_journal_num", :default => 0
+ t.integer "news_num", :default => 0
end
create_table "course_groups", :force => true do |t|
From bafa151c0d90b53673bde870eea48d241611dd49 Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 5 Mar 2016 03:16:04 +0800
Subject: [PATCH 14/25] 0
---
app/helpers/exercise_helper.rb | 354 ++---
app/helpers/users_helper.rb | 1352 ++++++++---------
app/models/course_contributor_score.rb | 10 +-
.../admin/latest_login_teachers.html.erb | 168 +-
app/views/exercise/_edit_single.html.erb | 116 +-
app/views/exercise/_new_single.html.erb | 98 +-
app/views/files/_import_files.html.erb | 276 ++--
app/views/files/_org_subfield_list.html.erb | 156 +-
app/views/files/_project_list.html.erb | 122 +-
app/views/files/_resource_detail.html.erb | 160 +-
app/views/files/_subfield_files.html.erb | 170 +--
app/views/files/_upload_course_files.erb | 182 +--
app/views/files/index.html.erb | 958 ++++++------
app/views/layouts/_logined_header.html.erb | 284 ++--
app/views/layouts/static_base.html.erb | 112 +-
.../_org_course_homework.html.erb | 738 ++++-----
.../_org_course_message.html.erb | 318 ++--
app/views/projects/member.html.erb | 26 +-
app/views/projects/settings.html.erb | 252 +--
app/views/users/_course_message.html.erb | 388 ++---
.../_homework_detail_information.html.erb | 60 +-
.../users/_homework_post_notice.html.erb | 22 +-
app/views/users/_homework_repository.html.erb | 76 +-
.../_homework_repository_detail.html.erb | 64 +-
.../_homework_repository_search.html.erb | 56 +-
.../users/_homework_search_input.html.erb | 56 +-
.../users/_import_resource_info.html.erb | 150 +-
.../users/_resource_search_form.html.erb | 12 +-
app/views/users/_resources_list.html.erb | 748 ++++-----
.../users/_send_homework_to_course.html.erb | 156 +-
app/views/users/_show_user_homeworks.html.erb | 106 +-
app/views/users/_upload_resource.html.erb | 106 +-
.../users/_user_homework_detail.html.erb | 746 ++++-----
app/views/users/_user_homework_form.html.erb | 538 +++----
app/views/users/_user_homework_list.html.erb | 80 +-
app/views/users/_user_homeworks_old.html.erb | 94 +-
app/views/users/_user_resource_info.html.erb | 118 +-
app/views/users/choose_user_course.js.erb | 12 +-
app/views/users/import_into_container.js.erb | 4 +-
app/views/users/import_resources.js.erb | 36 +-
.../users/import_resources_search.js.erb | 50 +-
.../users/send_homework_to_course.js.erb | 16 +-
app/views/users/show_homework_detail.js.erb | 8 +-
app/views/users/student_homeworks.html.erb | 94 +-
app/views/users/user_homework_type.js.erb | 30 +-
app/views/users/user_homeworks.html.erb | 192 +--
app/views/users/user_homeworks.js.erb | 6 +-
app/views/users/user_resource.js.erb | 30 +-
app/views/users/user_search_homeworks.js.erb | 16 +-
...rk_journal_to_course_contributor_scores.rb | 10 +-
50 files changed, 4966 insertions(+), 4966 deletions(-)
diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb
index 5792c6487..6dadf92b5 100644
--- a/app/helpers/exercise_helper.rb
+++ b/app/helpers/exercise_helper.rb
@@ -1,178 +1,178 @@
-# encoding: utf-8
-module ExerciseHelper
-
- # 单选
- def sigle_selection_standard_answer(params)
- size = params.ord - 96
- if size > 0 # 小写字母答案
- answer = params.ord - 96
- else
- answer = params.ord - 64
- end
- end
-
- # 多选
- def multiselect_standard_answer(params)
- size = params.ord - 96
- answer = []
- if size > 0 # 小写字母答案
- for i in 0..(params.length-1)
- answer << (params[i].ord - 96).to_s
- end
- else
- for i in 0..(params.length-1)
- answer << (params[i].ord - 64)
- end
- end
- answer = answer.sort
- answer.join("")
- end
-
- #
- def fill_standart_answer(params, standart_answer)
- params.each do |param|
- standart_answer.answer_text = param.value
- standart_answer.save
- end
- end
-
- # 获取多选的得分
- def get_mulscore(question, user)
- ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id)
- arr = []
- ecs.each do |ec|
- arr << ec.exercise_choice.choice_position
- end
- #arr = arr.sort
- str = arr.sort.join("")
- return str
- end
-
- # 判断用户是否已经提交了问卷
- # status 为0的时候是用户点击试卷。为1表示用户已经提交
- def has_commit_exercise?(exercise_id, user_id)
- pu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise_id, user_id, true)
- if pu.empty?
- false
- else
- true
- end
- end
-
- # 判断学生是否点击过问卷,点击则为他保存一个记录,记录start_at
- def has_click_exercise?(exercise_id, user_id)
- pu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise_id, user_id, false)
- if pu.empty?
- false
- else
- true
- end
- end
-
- def convert_to_char(str)
- result = ""
- length = str.length
- unless str.nil?
- if length === 1
- result += (str.to_i + 64).chr
- return result
- elsif length > 1
- for i in 0...length
- result += (str[i].to_i + 64).chr
- end
- return result
- end
- end
- return result
- end
-
- def convert_to_chi_num num
- result = ""
- case num.to_i
- when 1
- result = '一'
- when 2
- result = '二'
- when 3
- result = '三'
- when 4
- result = '四'
- when 5
- result = '五'
- when 6
- result = '六'
- when 7
- result = '七'
- when 8
- result = '八'
- when 9
- result = '九'
- end
- return result
- end
-
- def get_current_score exercise
- score = 0
- unless exercise.nil?
- exercise.exercise_questions.each do |exercise_question|
- unless exercise_question.question_score.nil?
- score += exercise_question.question_score
- end
- end
- return score
- end
- return score
- end
-
- def answer_be_selected?(answer,user)
- pv = answer.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id} ")
- if !pv.nil? && pv.count > 0
- true
- else
- false
- end
- end
-
- #获取未完成的题目
- def get_uncomplete_question exercise,user
- all_questions = exercise.exercise_questions
- uncomplete_question = []
- all_questions.each do |question|
- answers = get_user_answer(question, user)
- if answers.empty?
- uncomplete_question << question
- end
- end
- uncomplete_question
- end
-
- #获取文本题答案
- def get_anwser_vote_text(question_id,user_id)
- pv = ExerciseAnswer.find_by_exercise_question_id_and_user_id(question_id,user_id)
- if pv.nil?
- ''
- else
- pv.answer_text
- end
- end
-
- # 获取当前学生回答问题的答案
- def get_user_answer(question,user)
- user_answer = question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id}")
- user_answer
- end
-
- # 获取问题的标准答案
- def get_user_standard_answer(question,user)
- if question.question_type == 3
- standard_answer =[]
- question.exercise_standard_answers.each do |answer|
- standard_answer << answer.answer_text
- end
- else
- standard_answer = question.exercise_standard_answers
- end
- standard_answer
- end
-
+# encoding: utf-8
+module ExerciseHelper
+
+ # 单选
+ def sigle_selection_standard_answer(params)
+ size = params.ord - 96
+ if size > 0 # 小写字母答案
+ answer = params.ord - 96
+ else
+ answer = params.ord - 64
+ end
+ end
+
+ # 多选
+ def multiselect_standard_answer(params)
+ size = params.ord - 96
+ answer = []
+ if size > 0 # 小写字母答案
+ for i in 0..(params.length-1)
+ answer << (params[i].ord - 96).to_s
+ end
+ else
+ for i in 0..(params.length-1)
+ answer << (params[i].ord - 64)
+ end
+ end
+ answer = answer.sort
+ answer.join("")
+ end
+
+ #
+ def fill_standart_answer(params, standart_answer)
+ params.each do |param|
+ standart_answer.answer_text = param.value
+ standart_answer.save
+ end
+ end
+
+ # 获取多选的得分
+ def get_mulscore(question, user)
+ ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id)
+ arr = []
+ ecs.each do |ec|
+ arr << ec.exercise_choice.choice_position
+ end
+ #arr = arr.sort
+ str = arr.sort.join("")
+ return str
+ end
+
+ # 判断用户是否已经提交了问卷
+ # status 为0的时候是用户点击试卷。为1表示用户已经提交
+ def has_commit_exercise?(exercise_id, user_id)
+ pu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise_id, user_id, true)
+ if pu.empty?
+ false
+ else
+ true
+ end
+ end
+
+ # 判断学生是否点击过问卷,点击则为他保存一个记录,记录start_at
+ def has_click_exercise?(exercise_id, user_id)
+ pu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise_id, user_id, false)
+ if pu.empty?
+ false
+ else
+ true
+ end
+ end
+
+ def convert_to_char(str)
+ result = ""
+ length = str.length
+ unless str.nil?
+ if length === 1
+ result += (str.to_i + 64).chr
+ return result
+ elsif length > 1
+ for i in 0...length
+ result += (str[i].to_i + 64).chr
+ end
+ return result
+ end
+ end
+ return result
+ end
+
+ def convert_to_chi_num num
+ result = ""
+ case num.to_i
+ when 1
+ result = '一'
+ when 2
+ result = '二'
+ when 3
+ result = '三'
+ when 4
+ result = '四'
+ when 5
+ result = '五'
+ when 6
+ result = '六'
+ when 7
+ result = '七'
+ when 8
+ result = '八'
+ when 9
+ result = '九'
+ end
+ return result
+ end
+
+ def get_current_score exercise
+ score = 0
+ unless exercise.nil?
+ exercise.exercise_questions.each do |exercise_question|
+ unless exercise_question.question_score.nil?
+ score += exercise_question.question_score
+ end
+ end
+ return score
+ end
+ return score
+ end
+
+ def answer_be_selected?(answer,user)
+ pv = answer.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id} ")
+ if !pv.nil? && pv.count > 0
+ true
+ else
+ false
+ end
+ end
+
+ #获取未完成的题目
+ def get_uncomplete_question exercise,user
+ all_questions = exercise.exercise_questions
+ uncomplete_question = []
+ all_questions.each do |question|
+ answers = get_user_answer(question, user)
+ if answers.empty?
+ uncomplete_question << question
+ end
+ end
+ uncomplete_question
+ end
+
+ #获取文本题答案
+ def get_anwser_vote_text(question_id,user_id)
+ pv = ExerciseAnswer.find_by_exercise_question_id_and_user_id(question_id,user_id)
+ if pv.nil?
+ ''
+ else
+ pv.answer_text
+ end
+ end
+
+ # 获取当前学生回答问题的答案
+ def get_user_answer(question,user)
+ user_answer = question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id}")
+ user_answer
+ end
+
+ # 获取问题的标准答案
+ def get_user_standard_answer(question,user)
+ if question.question_type == 3
+ standard_answer =[]
+ question.exercise_standard_answers.each do |answer|
+ standard_answer << answer.answer_text
+ end
+ else
+ standard_answer = question.exercise_standard_answers
+ end
+ standard_answer
+ end
+
end
\ No newline at end of file
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 8ff569e65..44b919121 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -1,676 +1,676 @@
-# encoding: utf-8
-#
-# Redmine - project management software
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-
-
-include AvatarHelper
-module UsersHelper
- def users_status_options_for_select(selected)
- user_count_by_status = User.count(:group => 'status').to_hash
- options_for_select([[l(:label_all), ''],
- ["#{l(:status_active)} (#{user_count_by_status[1].to_i})", '1'],
- ["#{l(:status_registered)} (#{user_count_by_status[2].to_i})", '2'],
- ["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", '3']], selected.to_s)
- end
-
- def get_resource_type type
- case type
- when 'Course'
- '课程资源'
- when 'Project'
- '项目资源'
- when 'Issue'
- '缺陷附件'
- when 'Message'
- '讨论区附件'
- when 'Document'
- '文档附件'
- when 'News'
- '通知附件'
- when 'HomewCommon'
- '作业附件'
- when 'StudentWorkScore'
- '批改附件'
- when 'Principal'
- '用户资源'
- when 'OrgSubfield'
- '组织资源'
- end
- end
-
- def get_resource_origin attach
- type = attach.container_type
- content = attach.container
- unless content.nil?
- case type
- when 'Course'
- result = current_time_and_term_resource content
- when 'Project'
- result = content.name
- when 'Issue'
- result = content.subject
- when 'Message'
- result = content.subject
- when 'News'
- result = content.title
- when 'HomewCommon'
- result = content.name
- when 'StudentWorkScore'
- result = content.name
- when 'Principal'
- result = content.name
- when 'OrgSubfield'
- result = content.name
- end
- end
- end
-
- def current_time_and_term_resource course
- str = ""
- term = cur_course_term_resource
- name = course.name
- if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
- str = name + "(" + course.time.to_s + course.term.to_s + ")"
- elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
- str = name + "(" + course.time.to_s + course.term.to_s + ")"
- elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
- str = name + "(" + course.end_time.to_s + course.end_term.to_s + ")"
- else
- str = name + "(" + Time.now.year.to_s + cur_course_term_resource.to_s + ")"
- end
- str
- end
-
- def cur_course_term_resource
- month = Time.now.month
- if month >= 9 || month < 2
- term = "秋"
- elsif (month >= 7 && Time.now.day >= 15) || month == 8
- term = "夏"
- else
- term = "春"
- end
- term
- end
-
- def title_for_message type
- case type
- when nil
- '消息'
- when 'unviewed'
- '未读消息'
- when 'apply'
- '用户申请'
- when 'system_messages'
- '系统消息'
- when 'homework'
- '作业消息'
- when 'course_message'
- '课程讨论'
- when 'course_news'
- '课程通知'
- when 'poll'
- '课程问卷'
- when 'issue'
- '项目任务'
- when 'forge_message'
- '项目讨论'
- when 'forge_news'
- '项目新闻'
- when 'forum'
- '贴吧帖子'
- when 'user_feedback'
- '用户留言'
- end
- end
-
- def link_to_user_version(version, options = {})
- return '' unless version && version.is_a?(Version)
- link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => "linkBlue"
- end
-
- # 统计未读消息数
- def unviewed_message(user)
- course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count
- forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count
- org_count = OrgMessage.where("user_id =? and viewed =?", user, 0).count
- user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count
- user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count
- at_count = user.at_messages.where(viewed: false).count
- messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count
- end
-
- def user_mail_notification_options(user)
- user.valid_notification_options.collect {|o| [l(o.last), o.first]}
- end
-
- def change_status_link(user)
- url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil}
-
- if user.locked?
- link_to l(:button_unlock), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :put, :class => 'icon icon-unlock'
- elsif user.registered?
- link_to l(:button_activate), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :put, :class => 'icon icon-unlock'
- elsif user != User.current
- link_to l(:button_lock), url.merge(:user => {:status => User::STATUS_LOCKED}), :method => :put, :class => 'icon icon-lock'
- end
- end
-
- def user_settings_tabs
- tabs = [{:name => 'general', :partial => 'users/general', :label => :label_general},
- {:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural}
- ]
- if Group.all.any?
- tabs.insert 1, {:name => 'groups', :partial => 'users/groups', :label => :label_group_plural}
- end
- tabs
- end
-
- # this method is used to get all projects that tagged one tag
- # added by william
- def get_users_by_tag(tag_name)
- User.tagged_with(tag_name).order('updated_on desc')
- end
-
- # added by fq
- #
-
- # TODO: 待删
- # def show_activity(state)
- # content = ''.html_safe
- # case state
- # when 0
- # s = content_tag('span', l(:label_user_all_activity), :class => "current-page")
- # content << content_tag('li', s)
- # content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1}))
- # content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2}))
- # when 1
- # s = content_tag('span', l(:label_user_activity_myself), :class => "current-page")
- # content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'}))
- # content << content_tag('li', s, :class => "current-page")
- # content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2}))
- # when 2
- # s = content_tag('span', l(:label_user_all_respond), :class => "current-page")
- # content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'}))
- # content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1}))
- # content << content_tag('li', s, :class => "current-page")
- # end
- # content_tag('div', content, :class => "pagination")
- # end
-
- #TODO: 待删
- def watch_projects(state)
- content = ''.html_safe
- case state
- when 0
- s = content_tag('span', l(:label_project_take), :class => "current-page")
- content << content_tag('li', s)
- content << content_tag('li', link_to(l(:label_has_watched_project), {:controller => 'users', :action => 'watch_projects', :type => 1}))
- when 1
- s = content_tag('span', l(:label_has_watched_project), :class => "current-page")
- content << content_tag('li', link_to(l(:label_project_take), {:controller => 'users', :action => 'user_projects'}))
- content << content_tag('li', s, :class => "current-page")
- end
- content_tag('div', content, :class => "pagination")
- end
-
- def user_course(state)
- content = ''.html_safe
- if @user != User.current
- if @user.user_extensions.identity == 0
- case state
- when 0
- s = content_tag('span', '他执教的课程', :class => "current-page")
- content << content_tag('li', s)
- content << content_tag('li', link_to('他发布的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
- content_tag('div', content, :class => "pagination")
- when 1
- s = content_tag('span', '他发布的作业', :class => "current-page")
- content << content_tag('li', link_to('他执教的课程', {:controller => 'users', :action => 'user_courses'}))
- content << content_tag('li', s, :class => "current-page")
- content_tag('div', content, :class => "pagination")
- end
- else
- case state
- when 0
- s = content_tag('span', '他的课程', :class => "current-page")
- content << content_tag('li', s)
- content << content_tag('li', link_to('他的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
- content_tag('div', content, :class => "pagination")
- when 1
- s = content_tag('span', '他的作业', :class => "current-page")
- content << content_tag('li', link_to('他的课程', {:controller => 'users', :action => 'user_courses', :type => 0}))
- content << content_tag('li', s, :class => "current-page")
- content_tag('div', content, :class => "pagination")
- end
- end
- else
- if @user.user_extensions.identity == 0
- case state
- when 0
- s = content_tag('span', l(:label_teaching_course), :class => "current-page")
- content << content_tag('li', s)
- content << content_tag('li', link_to(l(:label_release_homework), {:controller => 'users', :action => 'user_courses', :type => 1}))
- content_tag('div', content, :class => "pagination")
- when 1
- s = content_tag('span', l(:label_release_homework), :class => "current-page")
- content << content_tag('li', link_to(l(:label_teaching_course), {:controller => 'users', :action => 'user_courses'}))
- content << content_tag('li', s, :class => "current-page")
- content_tag('div', content, :class => "pagination")
- end
- else
- case state
- when 0
- s = content_tag('span', l(:label_my_course), :class => "current-page")
- content << content_tag('li', s)
- content << content_tag('li', link_to('我的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
- content_tag('div', content, :class => "pagination")
- when 1
- s = content_tag('span', '我的作业', :class => "current-page")
- content << content_tag('li', link_to(l(:label_my_course), {:controller => 'users', :action => 'user_courses', :type => 0}))
- content << content_tag('li', s, :class => "current-page")
- content_tag('div', content, :class => "pagination")
- end
- end
- end
- end
-
- # added by huang
- def sort_user(state, project_type)
- content = ''.html_safe
- case state
- when 0
- content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) )))
- content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) )))
- content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) ), :class=>"selected") )
- when 1
- content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) ), :class=>"selected") )
- content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) )))
- content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) )))
- when 2
- content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) )))
- content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) ), :class=>"selected") )
- content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) )))
- end
- content = content_tag('ul', content)
- content_tag('div', content, :class => "tabs")
- end
-
- def sort_user_enterprise(state, project_type)
- content = ''.html_safe
- case state
- when 0
- content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
- content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
- content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
- when 1
- content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
- content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
- content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
- when 2
- content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
- content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
- content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
- end
- content = content_tag('ul', content)
- content_tag('div', content, :class => "tabs_enterprise")
- end
-
- def gender_avatar_uri user
- img_uri = '/images/sidebar/female.png'
- return img_uri if user.user_extensions.blank?
- person_gender = user.user_extensions.gender
- img_uri = (person_gender == 1) ? '/images/sidebar/female.png' : '/images/sidebar/male.png'
- end
-
- include CoursesHelper
- def is_watching?(user)
- login_user = User.current# 登录者
-
- courses = user.projects.where('project_type=1')
- return true if ((login_user == user) or login_user.admin?)
- courses.each do |course|
- return true if login_user.member_of?(course)
- end
- ## 下面的代码只判断是否是老师或者助教,上面是成员都可以看到
- # people_ids = []
- # user.projects.where('project_type=1').each do |project|
- # tmp = searchTeacherAndAssistant(project)
- # people_ids += (members_to_user_ids(tmp)) unless tmp.nil?
- # end
- # people_ids.include?(login_user.id) or (login_user == user) or login_user.admin?
-
- false
- end
-
- # base user上面的navbar显示内容
- def show_item_on_navbar params
- displayed_item = %w|index|
- displayed_item.include?(params['action'])
- end
- # base user上面searchBar显示
- def show_search_bar params
- displayed_flag = %w|index|
- !displayed_flag.include?(params['action'])
- end
-
- #获取指定用户的未过期的课程列表
- def user_courses_list user
- result = []
- user.coursememberships.map(&:course).each do |course|
- if !course_endTime_timeout?(course)
- result << course
- end
- end
- return result
- end
-
- #获取用户参与的公开的课程列表
- def user_public_course_list user
- membership = user.coursememberships.all#@user.coursememberships.all(:conditions => Course.visible_condition(User.current))
- membership.sort! {|older, newer| newer.created_on <=> older.created_on }
- memberships = []
- membership.collect { |e|
- memberships.push(e)
- }
- ## 判断课程是否过期 [需封装]
- memberships_doing = []
- memberships_done = []
- memberships.map { |e|
- if course_endTime_timeout?(e.course)
- memberships_done.push e
- else
- memberships_doing.push e
- end
- }
- end
-
- #获取用户留言相关的连接
- def user_jour_feed_back_url active
- if active.act_type == "JournalsForMessage"
- jour = JournalsForMessage.find active.act_id
- if jour
- case jour.jour_type
- when "Principal"
- link_to(l(:label_goto), user_newfeedback_user_path(jour.jour_id))
- when "Project"
- link_to(l(:label_goto), project_feedback_path(jour.jour_id))
- when "Bid"
- link_to(l(:label_goto), course_for_bid_path(jour.jour_id))
- when "Course"
- link_to(l(:label_goto), course_feedback_path(jour.jour_id))
- when "Contest"
- link_to(l(:label_goto), show_contest_contest_path(jour.jour_id))
- when "Softapplication"
- link_to(l(:label_goto), softapplication_path(jour.jour_id))
- when "HomeworkAttach"
- link_to(l(:label_goto), course_for_bid_path(jour.jour_id))
- end
- end
- end
- end
-
- def get_watcher_users(obj)
- count = User.watched_by(obj.id).count
- if count == 0
- return [0,[]]
- end
- list = User.watched_by(obj.id).order("#{Watcher.table_name}.id desc").limit(10).all
- return [count,list];
- end
-
- def get_fans_users(obj)
- count = obj.watcher_users.count
- if count == 0
- return [0,[]]
- end
- list = obj.watcher_users.order("#{Watcher.table_name}.id desc").limit(10).all
- return [count,list];
- end
-
- def get_visitor_users(obj)
- query = Visitor.where("master_id=?",obj.id)
- count = query.count
- if count == 0
- return [0,[]]
- end
- list = query.order("updated_on desc").limit(10).all
- return [count,list]
- end
-
- def get_create_course_count(user)
- user.courses.visible.where("tea_id = ?",user.id).count
- end
-
- #获取加入课程数
- def get_join_course_count(user)
- user.courses.visible.count - get_create_course_count(user)
- end
-
- #发布作业数
- def get_homework_commons_count(user)
- HomeworkCommon.where("user_id = ?",user.id).count
- end
-
- #资源数
- def get_projectandcourse_attachment_count(user)
- Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count
- end
-
- #创建项目数
- def get_create_project_count(user)
- user.projects.visible.where("projects.user_id=#{user.id}").count
- end
-
- #加入项目数
- def get_join_project_count(user)
- user.projects.visible.count - get_create_project_count(user)
- end
-
- #创建缺陷数
- def get_create_issue_count(user)
- Issue.where("author_id = ?",user.id).count
- end
-
- #解决缺陷数
- def get_resolve_issue_count(user)
- Issue.where("assigned_to_id = ? and status_id=3",user.id).count
- end
-
- #参与匿评数
- def get_anonymous_evaluation_count(user)
- StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count
- end
-
- def query_activities(query)
- list = query.limit(13).all
- result = []
- for item in list
- container = get_activity_container(item)
- result << { :item=>item,:e=>container }
- end
- result
- end
-
- def get_activity_container activity
- return activity.activity_container
- end
-
- def get_activity_act_showname_htmlclear(activity)
- str = get_activity_act_showname(activity)
- str = str.gsub(/<.*>/,'')
- str = str.gsub(/\r/,'')
- str = str.gsub(/\n/,'')
- str = str.lstrip.rstrip
- if str == ''
- str = 'RE:'
- end
- return str.html_safe
- end
-
- # journal.details 记录每个动作的新旧值
- def get_issue_des_update(journal)
- no_html = "message"
- arr = details_to_strings(journal.details, no_html)
- unless journal.notes.blank?
- arr << journal.notes
- end
- str = ''
- arr.each { |item| str = str+item }
- return str
- end
-
- def get_activity_act_showname(activity)
- case activity.act_type
- when "HomeworkCommon"
- return activity.act.name
- when "Issue"
- return activity.act.subject
- when "Journal"
- arr = details_to_strings(activity.act.details,true)
- arr << activity.act.notes
- str = ''
- arr.each { |item| str = str+item }
- return str
- when "JournalsForMessage"
- return activity.act.notes
- when "Message"
- return activity.act.subject
- when "News"
- return activity.act.title
- when "Poll"
- return activity.act.polls_name
- when "Contest"
- return ''
- when "Contestnotification"
- return ''
- when "Principal"
- return ''
- else
- return activity.act_type
- end
- end
-
- def get_activity_act_createtime(activity)
- case activity.act_type
- when "HomeworkCommon"
- return activity.act.created_at
- when "Poll"
- return activity.act.created_at
- else
- return activity.act.created_on
- end
- end
-
- def get_activity_container_url e
- if !e.visible?
- return "javascript:;"
- end
-
- if e.class.to_s == 'Course'
- return url_for(:controller => 'courses', :action=>"show", :id=>e.id, :host=>Setting.host_course)
- end
- return url_for(:controller => 'projects', :action=>"show", :id=>e.id, :host=>Setting.host_name)
- end
-
- def get_activity_url(activity,e)
- if !e.visible?
- return "javascript:;"
- end
-
- case activity.act_type
- # when "Contest"
- # when "Contestnotification"
- # when "Principal"
- when "HomeworkCommon"
- return homework_common_index_path( :course=>e.id )
- when "Issue"
- return issue_path(activity.act.id)
- when "Journal"
- return issue_path( activity.act.journalized_id )
- when "JournalsForMessage"
- return e.class.to_s == 'Course' ? course_feedback_path(e) : project_feedback_path(e)
- when "Message"
- return e.class.to_s == 'Course' ? course_boards_path(e) : project_boards_path(e)
- when "News"
- return news_path(activity.act)
- #return e.class.to_s == 'Course' ? course_news_index_path(e) : project_news_index_path(e)
- when "Poll"
- return poll_index_path( :polls_group_id=>activity.act.polls_group_id, :polls_type=>e.class.to_s )
- else
- return 'javascript:;'
- end
- end
-
- def get_activity_opt(activity,e)
- case activity.act_type
- when "HomeworkCommon"
- return '创建了作业'
- when "News"
- return e.class.to_s == 'Course' ? '发布了通知' : '添加了新闻'
- when "Issue"
- return '发表了问题'
- when "Journal"
- return '更新了问题'
- when "JournalsForMessage"
- return e.class.to_s == 'Course' ? '发表了留言' : '提交了反馈'
- #return ( activity.act.reply_id == nil || activity.act.reply_id == 0 ) ? '' : ''
- when "Message"
- return ( activity.act.parent_id == nil || activity.act.parent_id == '' ) ? '发布了帖子' : '回复了帖子'
- when "Poll"
- return '创建了问卷'
- else
- return '有了新动态'
- end
- end
-
- #获取指定用户作为老师的课程
- def get_as_teacher_courses user
- type = []
- option = []
- option << "请选择发布作业的课程"
- option << -1
- type << option
- user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").select{|c| user.allowed_to?(:as_teacher,c)}.each do |course|
- option = []
- option << course.name+"("+course.time.to_s+course.term+")"
- option << course.id
- type << option
- end
- type
- end
-
- #根据姓名搜索用户
- def search_user_by_name user_ids, name
- result_ids = []
- user_ids.each do |user_id|
- user = User.find user_id
- username = user.lastname.to_s.downcase + user.firstname.to_s.downcase
- if username.include?(name)
- result_ids << user_id
- end
- end
- result_ids
- end
-end
+# encoding: utf-8
+#
+# Redmine - project management software
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+
+include AvatarHelper
+module UsersHelper
+ def users_status_options_for_select(selected)
+ user_count_by_status = User.count(:group => 'status').to_hash
+ options_for_select([[l(:label_all), ''],
+ ["#{l(:status_active)} (#{user_count_by_status[1].to_i})", '1'],
+ ["#{l(:status_registered)} (#{user_count_by_status[2].to_i})", '2'],
+ ["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", '3']], selected.to_s)
+ end
+
+ def get_resource_type type
+ case type
+ when 'Course'
+ '课程资源'
+ when 'Project'
+ '项目资源'
+ when 'Issue'
+ '缺陷附件'
+ when 'Message'
+ '讨论区附件'
+ when 'Document'
+ '文档附件'
+ when 'News'
+ '通知附件'
+ when 'HomewCommon'
+ '作业附件'
+ when 'StudentWorkScore'
+ '批改附件'
+ when 'Principal'
+ '用户资源'
+ when 'OrgSubfield'
+ '组织资源'
+ end
+ end
+
+ def get_resource_origin attach
+ type = attach.container_type
+ content = attach.container
+ unless content.nil?
+ case type
+ when 'Course'
+ result = current_time_and_term_resource content
+ when 'Project'
+ result = content.name
+ when 'Issue'
+ result = content.subject
+ when 'Message'
+ result = content.subject
+ when 'News'
+ result = content.title
+ when 'HomewCommon'
+ result = content.name
+ when 'StudentWorkScore'
+ result = content.name
+ when 'Principal'
+ result = content.name
+ when 'OrgSubfield'
+ result = content.name
+ end
+ end
+ end
+
+ def current_time_and_term_resource course
+ str = ""
+ term = cur_course_term_resource
+ name = course.name
+ if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
+ str = name + "(" + course.time.to_s + course.term.to_s + ")"
+ elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
+ str = name + "(" + course.time.to_s + course.term.to_s + ")"
+ elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
+ str = name + "(" + course.end_time.to_s + course.end_term.to_s + ")"
+ else
+ str = name + "(" + Time.now.year.to_s + cur_course_term_resource.to_s + ")"
+ end
+ str
+ end
+
+ def cur_course_term_resource
+ month = Time.now.month
+ if month >= 9 || month < 2
+ term = "秋"
+ elsif (month >= 7 && Time.now.day >= 15) || month == 8
+ term = "夏"
+ else
+ term = "春"
+ end
+ term
+ end
+
+ def title_for_message type
+ case type
+ when nil
+ '消息'
+ when 'unviewed'
+ '未读消息'
+ when 'apply'
+ '用户申请'
+ when 'system_messages'
+ '系统消息'
+ when 'homework'
+ '作业消息'
+ when 'course_message'
+ '课程讨论'
+ when 'course_news'
+ '课程通知'
+ when 'poll'
+ '课程问卷'
+ when 'issue'
+ '项目任务'
+ when 'forge_message'
+ '项目讨论'
+ when 'forge_news'
+ '项目新闻'
+ when 'forum'
+ '贴吧帖子'
+ when 'user_feedback'
+ '用户留言'
+ end
+ end
+
+ def link_to_user_version(version, options = {})
+ return '' unless version && version.is_a?(Version)
+ link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => "linkBlue"
+ end
+
+ # 统计未读消息数
+ def unviewed_message(user)
+ course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count
+ forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count
+ org_count = OrgMessage.where("user_id =? and viewed =?", user, 0).count
+ user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count
+ user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count
+ at_count = user.at_messages.where(viewed: false).count
+ messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count
+ end
+
+ def user_mail_notification_options(user)
+ user.valid_notification_options.collect {|o| [l(o.last), o.first]}
+ end
+
+ def change_status_link(user)
+ url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil}
+
+ if user.locked?
+ link_to l(:button_unlock), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :put, :class => 'icon icon-unlock'
+ elsif user.registered?
+ link_to l(:button_activate), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :put, :class => 'icon icon-unlock'
+ elsif user != User.current
+ link_to l(:button_lock), url.merge(:user => {:status => User::STATUS_LOCKED}), :method => :put, :class => 'icon icon-lock'
+ end
+ end
+
+ def user_settings_tabs
+ tabs = [{:name => 'general', :partial => 'users/general', :label => :label_general},
+ {:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural}
+ ]
+ if Group.all.any?
+ tabs.insert 1, {:name => 'groups', :partial => 'users/groups', :label => :label_group_plural}
+ end
+ tabs
+ end
+
+ # this method is used to get all projects that tagged one tag
+ # added by william
+ def get_users_by_tag(tag_name)
+ User.tagged_with(tag_name).order('updated_on desc')
+ end
+
+ # added by fq
+ #
+
+ # TODO: 待删
+ # def show_activity(state)
+ # content = ''.html_safe
+ # case state
+ # when 0
+ # s = content_tag('span', l(:label_user_all_activity), :class => "current-page")
+ # content << content_tag('li', s)
+ # content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1}))
+ # content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2}))
+ # when 1
+ # s = content_tag('span', l(:label_user_activity_myself), :class => "current-page")
+ # content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'}))
+ # content << content_tag('li', s, :class => "current-page")
+ # content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2}))
+ # when 2
+ # s = content_tag('span', l(:label_user_all_respond), :class => "current-page")
+ # content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'}))
+ # content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1}))
+ # content << content_tag('li', s, :class => "current-page")
+ # end
+ # content_tag('div', content, :class => "pagination")
+ # end
+
+ #TODO: 待删
+ def watch_projects(state)
+ content = ''.html_safe
+ case state
+ when 0
+ s = content_tag('span', l(:label_project_take), :class => "current-page")
+ content << content_tag('li', s)
+ content << content_tag('li', link_to(l(:label_has_watched_project), {:controller => 'users', :action => 'watch_projects', :type => 1}))
+ when 1
+ s = content_tag('span', l(:label_has_watched_project), :class => "current-page")
+ content << content_tag('li', link_to(l(:label_project_take), {:controller => 'users', :action => 'user_projects'}))
+ content << content_tag('li', s, :class => "current-page")
+ end
+ content_tag('div', content, :class => "pagination")
+ end
+
+ def user_course(state)
+ content = ''.html_safe
+ if @user != User.current
+ if @user.user_extensions.identity == 0
+ case state
+ when 0
+ s = content_tag('span', '他执教的课程', :class => "current-page")
+ content << content_tag('li', s)
+ content << content_tag('li', link_to('他发布的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
+ content_tag('div', content, :class => "pagination")
+ when 1
+ s = content_tag('span', '他发布的作业', :class => "current-page")
+ content << content_tag('li', link_to('他执教的课程', {:controller => 'users', :action => 'user_courses'}))
+ content << content_tag('li', s, :class => "current-page")
+ content_tag('div', content, :class => "pagination")
+ end
+ else
+ case state
+ when 0
+ s = content_tag('span', '他的课程', :class => "current-page")
+ content << content_tag('li', s)
+ content << content_tag('li', link_to('他的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
+ content_tag('div', content, :class => "pagination")
+ when 1
+ s = content_tag('span', '他的作业', :class => "current-page")
+ content << content_tag('li', link_to('他的课程', {:controller => 'users', :action => 'user_courses', :type => 0}))
+ content << content_tag('li', s, :class => "current-page")
+ content_tag('div', content, :class => "pagination")
+ end
+ end
+ else
+ if @user.user_extensions.identity == 0
+ case state
+ when 0
+ s = content_tag('span', l(:label_teaching_course), :class => "current-page")
+ content << content_tag('li', s)
+ content << content_tag('li', link_to(l(:label_release_homework), {:controller => 'users', :action => 'user_courses', :type => 1}))
+ content_tag('div', content, :class => "pagination")
+ when 1
+ s = content_tag('span', l(:label_release_homework), :class => "current-page")
+ content << content_tag('li', link_to(l(:label_teaching_course), {:controller => 'users', :action => 'user_courses'}))
+ content << content_tag('li', s, :class => "current-page")
+ content_tag('div', content, :class => "pagination")
+ end
+ else
+ case state
+ when 0
+ s = content_tag('span', l(:label_my_course), :class => "current-page")
+ content << content_tag('li', s)
+ content << content_tag('li', link_to('我的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
+ content_tag('div', content, :class => "pagination")
+ when 1
+ s = content_tag('span', '我的作业', :class => "current-page")
+ content << content_tag('li', link_to(l(:label_my_course), {:controller => 'users', :action => 'user_courses', :type => 0}))
+ content << content_tag('li', s, :class => "current-page")
+ content_tag('div', content, :class => "pagination")
+ end
+ end
+ end
+ end
+
+ # added by huang
+ def sort_user(state, project_type)
+ content = ''.html_safe
+ case state
+ when 0
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) )))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) )))
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) ), :class=>"selected") )
+ when 1
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) ), :class=>"selected") )
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) )))
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) )))
+ when 2
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) )))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) ), :class=>"selected") )
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) )))
+ end
+ content = content_tag('ul', content)
+ content_tag('div', content, :class => "tabs")
+ end
+
+ def sort_user_enterprise(state, project_type)
+ content = ''.html_safe
+ case state
+ when 0
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ when 1
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
+ when 2
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
+ end
+ content = content_tag('ul', content)
+ content_tag('div', content, :class => "tabs_enterprise")
+ end
+
+ def gender_avatar_uri user
+ img_uri = '/images/sidebar/female.png'
+ return img_uri if user.user_extensions.blank?
+ person_gender = user.user_extensions.gender
+ img_uri = (person_gender == 1) ? '/images/sidebar/female.png' : '/images/sidebar/male.png'
+ end
+
+ include CoursesHelper
+ def is_watching?(user)
+ login_user = User.current# 登录者
+
+ courses = user.projects.where('project_type=1')
+ return true if ((login_user == user) or login_user.admin?)
+ courses.each do |course|
+ return true if login_user.member_of?(course)
+ end
+ ## 下面的代码只判断是否是老师或者助教,上面是成员都可以看到
+ # people_ids = []
+ # user.projects.where('project_type=1').each do |project|
+ # tmp = searchTeacherAndAssistant(project)
+ # people_ids += (members_to_user_ids(tmp)) unless tmp.nil?
+ # end
+ # people_ids.include?(login_user.id) or (login_user == user) or login_user.admin?
+
+ false
+ end
+
+ # base user上面的navbar显示内容
+ def show_item_on_navbar params
+ displayed_item = %w|index|
+ displayed_item.include?(params['action'])
+ end
+ # base user上面searchBar显示
+ def show_search_bar params
+ displayed_flag = %w|index|
+ !displayed_flag.include?(params['action'])
+ end
+
+ #获取指定用户的未过期的课程列表
+ def user_courses_list user
+ result = []
+ user.coursememberships.map(&:course).each do |course|
+ if !course_endTime_timeout?(course)
+ result << course
+ end
+ end
+ return result
+ end
+
+ #获取用户参与的公开的课程列表
+ def user_public_course_list user
+ membership = user.coursememberships.all#@user.coursememberships.all(:conditions => Course.visible_condition(User.current))
+ membership.sort! {|older, newer| newer.created_on <=> older.created_on }
+ memberships = []
+ membership.collect { |e|
+ memberships.push(e)
+ }
+ ## 判断课程是否过期 [需封装]
+ memberships_doing = []
+ memberships_done = []
+ memberships.map { |e|
+ if course_endTime_timeout?(e.course)
+ memberships_done.push e
+ else
+ memberships_doing.push e
+ end
+ }
+ end
+
+ #获取用户留言相关的连接
+ def user_jour_feed_back_url active
+ if active.act_type == "JournalsForMessage"
+ jour = JournalsForMessage.find active.act_id
+ if jour
+ case jour.jour_type
+ when "Principal"
+ link_to(l(:label_goto), user_newfeedback_user_path(jour.jour_id))
+ when "Project"
+ link_to(l(:label_goto), project_feedback_path(jour.jour_id))
+ when "Bid"
+ link_to(l(:label_goto), course_for_bid_path(jour.jour_id))
+ when "Course"
+ link_to(l(:label_goto), course_feedback_path(jour.jour_id))
+ when "Contest"
+ link_to(l(:label_goto), show_contest_contest_path(jour.jour_id))
+ when "Softapplication"
+ link_to(l(:label_goto), softapplication_path(jour.jour_id))
+ when "HomeworkAttach"
+ link_to(l(:label_goto), course_for_bid_path(jour.jour_id))
+ end
+ end
+ end
+ end
+
+ def get_watcher_users(obj)
+ count = User.watched_by(obj.id).count
+ if count == 0
+ return [0,[]]
+ end
+ list = User.watched_by(obj.id).order("#{Watcher.table_name}.id desc").limit(10).all
+ return [count,list];
+ end
+
+ def get_fans_users(obj)
+ count = obj.watcher_users.count
+ if count == 0
+ return [0,[]]
+ end
+ list = obj.watcher_users.order("#{Watcher.table_name}.id desc").limit(10).all
+ return [count,list];
+ end
+
+ def get_visitor_users(obj)
+ query = Visitor.where("master_id=?",obj.id)
+ count = query.count
+ if count == 0
+ return [0,[]]
+ end
+ list = query.order("updated_on desc").limit(10).all
+ return [count,list]
+ end
+
+ def get_create_course_count(user)
+ user.courses.visible.where("tea_id = ?",user.id).count
+ end
+
+ #获取加入课程数
+ def get_join_course_count(user)
+ user.courses.visible.count - get_create_course_count(user)
+ end
+
+ #发布作业数
+ def get_homework_commons_count(user)
+ HomeworkCommon.where("user_id = ?",user.id).count
+ end
+
+ #资源数
+ def get_projectandcourse_attachment_count(user)
+ Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count
+ end
+
+ #创建项目数
+ def get_create_project_count(user)
+ user.projects.visible.where("projects.user_id=#{user.id}").count
+ end
+
+ #加入项目数
+ def get_join_project_count(user)
+ user.projects.visible.count - get_create_project_count(user)
+ end
+
+ #创建缺陷数
+ def get_create_issue_count(user)
+ Issue.where("author_id = ?",user.id).count
+ end
+
+ #解决缺陷数
+ def get_resolve_issue_count(user)
+ Issue.where("assigned_to_id = ? and status_id=3",user.id).count
+ end
+
+ #参与匿评数
+ def get_anonymous_evaluation_count(user)
+ StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count
+ end
+
+ def query_activities(query)
+ list = query.limit(13).all
+ result = []
+ for item in list
+ container = get_activity_container(item)
+ result << { :item=>item,:e=>container }
+ end
+ result
+ end
+
+ def get_activity_container activity
+ return activity.activity_container
+ end
+
+ def get_activity_act_showname_htmlclear(activity)
+ str = get_activity_act_showname(activity)
+ str = str.gsub(/<.*>/,'')
+ str = str.gsub(/\r/,'')
+ str = str.gsub(/\n/,'')
+ str = str.lstrip.rstrip
+ if str == ''
+ str = 'RE:'
+ end
+ return str.html_safe
+ end
+
+ # journal.details 记录每个动作的新旧值
+ def get_issue_des_update(journal)
+ no_html = "message"
+ arr = details_to_strings(journal.details, no_html)
+ unless journal.notes.blank?
+ arr << journal.notes
+ end
+ str = ''
+ arr.each { |item| str = str+item }
+ return str
+ end
+
+ def get_activity_act_showname(activity)
+ case activity.act_type
+ when "HomeworkCommon"
+ return activity.act.name
+ when "Issue"
+ return activity.act.subject
+ when "Journal"
+ arr = details_to_strings(activity.act.details,true)
+ arr << activity.act.notes
+ str = ''
+ arr.each { |item| str = str+item }
+ return str
+ when "JournalsForMessage"
+ return activity.act.notes
+ when "Message"
+ return activity.act.subject
+ when "News"
+ return activity.act.title
+ when "Poll"
+ return activity.act.polls_name
+ when "Contest"
+ return ''
+ when "Contestnotification"
+ return ''
+ when "Principal"
+ return ''
+ else
+ return activity.act_type
+ end
+ end
+
+ def get_activity_act_createtime(activity)
+ case activity.act_type
+ when "HomeworkCommon"
+ return activity.act.created_at
+ when "Poll"
+ return activity.act.created_at
+ else
+ return activity.act.created_on
+ end
+ end
+
+ def get_activity_container_url e
+ if !e.visible?
+ return "javascript:;"
+ end
+
+ if e.class.to_s == 'Course'
+ return url_for(:controller => 'courses', :action=>"show", :id=>e.id, :host=>Setting.host_course)
+ end
+ return url_for(:controller => 'projects', :action=>"show", :id=>e.id, :host=>Setting.host_name)
+ end
+
+ def get_activity_url(activity,e)
+ if !e.visible?
+ return "javascript:;"
+ end
+
+ case activity.act_type
+ # when "Contest"
+ # when "Contestnotification"
+ # when "Principal"
+ when "HomeworkCommon"
+ return homework_common_index_path( :course=>e.id )
+ when "Issue"
+ return issue_path(activity.act.id)
+ when "Journal"
+ return issue_path( activity.act.journalized_id )
+ when "JournalsForMessage"
+ return e.class.to_s == 'Course' ? course_feedback_path(e) : project_feedback_path(e)
+ when "Message"
+ return e.class.to_s == 'Course' ? course_boards_path(e) : project_boards_path(e)
+ when "News"
+ return news_path(activity.act)
+ #return e.class.to_s == 'Course' ? course_news_index_path(e) : project_news_index_path(e)
+ when "Poll"
+ return poll_index_path( :polls_group_id=>activity.act.polls_group_id, :polls_type=>e.class.to_s )
+ else
+ return 'javascript:;'
+ end
+ end
+
+ def get_activity_opt(activity,e)
+ case activity.act_type
+ when "HomeworkCommon"
+ return '创建了作业'
+ when "News"
+ return e.class.to_s == 'Course' ? '发布了通知' : '添加了新闻'
+ when "Issue"
+ return '发表了问题'
+ when "Journal"
+ return '更新了问题'
+ when "JournalsForMessage"
+ return e.class.to_s == 'Course' ? '发表了留言' : '提交了反馈'
+ #return ( activity.act.reply_id == nil || activity.act.reply_id == 0 ) ? '' : ''
+ when "Message"
+ return ( activity.act.parent_id == nil || activity.act.parent_id == '' ) ? '发布了帖子' : '回复了帖子'
+ when "Poll"
+ return '创建了问卷'
+ else
+ return '有了新动态'
+ end
+ end
+
+ #获取指定用户作为老师的课程
+ def get_as_teacher_courses user
+ type = []
+ option = []
+ option << "请选择发布作业的课程"
+ option << -1
+ type << option
+ user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").select{|c| user.allowed_to?(:as_teacher,c)}.each do |course|
+ option = []
+ option << course.name+"("+course.time.to_s+course.term+")"
+ option << course.id
+ type << option
+ end
+ type
+ end
+
+ #根据姓名搜索用户
+ def search_user_by_name user_ids, name
+ result_ids = []
+ user_ids.each do |user_id|
+ user = User.find user_id
+ username = user.lastname.to_s.downcase + user.firstname.to_s.downcase
+ if username.include?(name)
+ result_ids << user_id
+ end
+ end
+ result_ids
+ end
+end
diff --git a/app/models/course_contributor_score.rb b/app/models/course_contributor_score.rb
index ca21ddb1c..0b1ccf5d9 100644
--- a/app/models/course_contributor_score.rb
+++ b/app/models/course_contributor_score.rb
@@ -1,5 +1,5 @@
-class CourseContributorScore < ActiveRecord::Base
- attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num, :resource_num, :user_id, :total_score, :homework_journal_num
- belongs_to :course
- belongs_to :user
-end
+class CourseContributorScore < ActiveRecord::Base
+ attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num, :resource_num, :user_id, :total_score, :homework_journal_num
+ belongs_to :course
+ belongs_to :user
+end
diff --git a/app/views/admin/latest_login_teachers.html.erb b/app/views/admin/latest_login_teachers.html.erb
index a42e84369..05f20ba8d 100644
--- a/app/views/admin/latest_login_teachers.html.erb
+++ b/app/views/admin/latest_login_teachers.html.erb
@@ -1,84 +1,84 @@
-<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
-
- <%=l(:label_latest_login_user_list)%>
-
-<%= render 'tab_users' %>
-
-
- 最近登录老师列表
-
-<%= form_tag({}, :method => :get) do %>
-
-
- <%= l(:label_filter_plural) %>
-
- 开始日期:
- <%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange=>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
- <%= calendar_for('startdate')%>
- 结束日期:
- <%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
- <%= calendar_for('enddate')%>
- <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
- <%= link_to l(:button_clear), {:controller => 'admin', :action => 'latest_login_teachers'}, :class => 'icon icon-reload' %>
-
-<% end %>
-
-
-
+<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
+
+ <%=l(:label_latest_login_user_list)%>
+
+<%= render 'tab_users' %>
+
+
+ 最近登录老师列表
+
+<%= form_tag({}, :method => :get) do %>
+
+
+ <%= l(:label_filter_plural) %>
+
+ 开始日期:
+ <%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange=>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
+ <%= calendar_for('startdate')%>
+ 结束日期:
+ <%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
+ <%= calendar_for('enddate')%>
+ <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
+ <%= link_to l(:button_clear), {:controller => 'admin', :action => 'latest_login_teachers'}, :class => 'icon icon-reload' %>
+
+<% end %>
+
+
+
diff --git a/app/views/exercise/_edit_single.html.erb b/app/views/exercise/_edit_single.html.erb
index 52e865ba4..42878454d 100644
--- a/app/views/exercise/_edit_single.html.erb
+++ b/app/views/exercise/_edit_single.html.erb
@@ -1,59 +1,59 @@
-<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
-
-
-
-
-
+<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
+
+
+
+
+
<% end%>
\ No newline at end of file
diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb
index 3a65c072d..6180dac8e 100644
--- a/app/views/exercise/_new_single.html.erb
+++ b/app/views/exercise/_new_single.html.erb
@@ -1,50 +1,50 @@
-<%= form_for(ExerciseQuestion.new,
- :html => { :multipart => true },
- :url=>create_exercise_question_exercise_path(exercise.id),
- :remote=>true ) do |f| %>
-
+<%= form_for(ExerciseQuestion.new,
+ :html => { :multipart => true },
+ :url=>create_exercise_question_exercise_path(exercise.id),
+ :remote=>true ) do |f| %>
+
<% end %>
\ No newline at end of file
diff --git a/app/views/files/_import_files.html.erb b/app/views/files/_import_files.html.erb
index 168cea962..36fa96a0b 100644
--- a/app/views/files/_import_files.html.erb
+++ b/app/views/files/_import_files.html.erb
@@ -1,138 +1,138 @@
-<%#= render :partial => 'users/user_resource_info' %>
-选用资源库中的资源
- 公共资源 我的资源
-
-
-
-
- 资源名称
- 类别
- 大小
- 上传者
- 上传时间
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+<%#= render :partial => 'users/user_resource_info' %>
+选用资源库中的资源
+ 公共资源 我的资源
+
+
+
+
+ 资源名称
+ 类别
+ 大小
+ 上传者
+ 上传时间
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb
index d249aede9..38ff40ed3 100644
--- a/app/views/files/_org_subfield_list.html.erb
+++ b/app/views/files/_org_subfield_list.html.erb
@@ -1,78 +1,78 @@
-<% delete_allowed = User.current.admin? %>
-
-<% org_subfield_attachments.each do |file| %>
-
-
-
- <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
-
-
-
- <%= link_to truncate(file.filename,length: 35, omission: '...'),
- download_named_attachment_path(file.id, file.filename),
- :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14 f_l" %>
- <%= file_preview_eye(file, class: 'preview') %>
-
- <% if file.is_public? == false%>
- 私有
- <%end %>
-
-
-
-
-
上传时间:<%= format_date(file.created_on)%>
- <% if file.tag_list.length > 0%>
-
上传类型:<%= file.tag_list[0] %>
- <% end %>
-
文件大小:<%= number_to_human_size(file.filesize) %>
-
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
-
-
-
- <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
- <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
-
-
-
-
- <% if User.current.logged? %>
- <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
-
- <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
- <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
-
-
- <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
-
-
-
- <%= link_to( '删除资源', attachment_path(file),
- :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %>
-
-
- <%else%>
-
- <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
-
- <% end %>
- <% end %>
-
-
-
-
-
-
-
-
-
-<% end %>
-
-<% if org_subfield_attachments.count == 10 %>
- <% if params[:action] == 'search_files_in_subfield' %>
- <%=link_to "点击展开更多", search_files_in_subfield_org_subfield_files_path(:org_subfield_id => org_subfield.id,:page => @page.to_i + 1, :name => params[:name],:insite => params[:insite]),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
- <% else %>
-
- <%=link_to "点击展开更多", org_subfield_files_path(:org_subfield_id => org_subfield.id, :page => @page.nil? ? 2 :(@page.to_i + 1)), :id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
- <%end%>
-<% end%>
-
+<% delete_allowed = User.current.admin? %>
+
+<% org_subfield_attachments.each do |file| %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
+
+
+
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14 f_l" %>
+ <%= file_preview_eye(file, class: 'preview') %>
+
+ <% if file.is_public? == false%>
+ 私有
+ <%end %>
+
+
+
+
+
上传时间:<%= format_date(file.created_on)%>
+ <% if file.tag_list.length > 0%>
+
上传类型:<%= file.tag_list[0] %>
+ <% end %>
+
文件大小:<%= number_to_human_size(file.filesize) %>
+
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+
+
+
+ <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
+ <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
+
+
+
+
+ <% if User.current.logged? %>
+ <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
+
+ <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+ <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
+
+
+ <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
+
+
+
+ <%= link_to( '删除资源', attachment_path(file),
+ :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %>
+
+
+ <%else%>
+
+ <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
+
+<% end %>
+
+<% if org_subfield_attachments.count == 10 %>
+ <% if params[:action] == 'search_files_in_subfield' %>
+ <%=link_to "点击展开更多", search_files_in_subfield_org_subfield_files_path(:org_subfield_id => org_subfield.id,:page => @page.to_i + 1, :name => params[:name],:insite => params[:insite]),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
+ <% else %>
+
+ <%=link_to "点击展开更多", org_subfield_files_path(:org_subfield_id => org_subfield.id, :page => @page.nil? ? 2 :(@page.to_i + 1)), :id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
+ <%end%>
+<% end%>
+
diff --git a/app/views/files/_project_list.html.erb b/app/views/files/_project_list.html.erb
index 81227529e..a2a1670d1 100644
--- a/app/views/files/_project_list.html.erb
+++ b/app/views/files/_project_list.html.erb
@@ -1,61 +1,61 @@
-<% delete_allowed = User.current.allowed_to?(:manage_files, project) %>
-<% project_attachments.each do |file| %>
- <% if file.is_public? || User.current.member_of?(project) || User.current.admin? %>
-
-
-
- <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
-
-
-
- <%= link_to truncate(file.filename,length: 35, omission: '...'),
- download_named_attachment_path(file.id, file.filename),
- :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
- <%= file_preview_eye(file, class: 'preview') %>
-
- <% if file.is_public? == false%>
- 私有
- <%end %>
-
-
-
-
上传时间:<%= format_time(file.created_on)%>
- <% if file.tag_list.length > 0%>
-
上传类型:<%= file.tag_list[0] %>
- <% end %>
-
文件大小:<%= number_to_human_size(file.filesize) %>
-
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
-
-
-
-
- <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
- <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
-
-
- <%= render :partial => 'files/tool_settings', :locals => {:project => @project, :delete_allowed => delete_allowed, :file => file} %>
-
-
-
-
-
-
- <% else %>
- <%= file.filename %>是私有资源
- <% end %>
-<% end %>
-
-<% if project_attachments.count == 10%>
- <% if params[:action] == 'search_project' %>
-
-
-
- <%=link_to "点击展开更多", search_project_project_files_path({:project_id => project.id, :page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
- <%else%>
-
- <%=link_to "点击展开更多", project_files_path(:project_id => project.id,:page => @page),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
- <%end%>
-<% end%>
-
-
-
+<% delete_allowed = User.current.allowed_to?(:manage_files, project) %>
+<% project_attachments.each do |file| %>
+ <% if file.is_public? || User.current.member_of?(project) || User.current.admin? %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
+
+
+
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
+ <%= file_preview_eye(file, class: 'preview') %>
+
+ <% if file.is_public? == false%>
+ 私有
+ <%end %>
+
+
+
+
上传时间:<%= format_time(file.created_on)%>
+ <% if file.tag_list.length > 0%>
+
上传类型:<%= file.tag_list[0] %>
+ <% end %>
+
文件大小:<%= number_to_human_size(file.filesize) %>
+
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+
+
+
+
+ <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+ <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+
+
+ <%= render :partial => 'files/tool_settings', :locals => {:project => @project, :delete_allowed => delete_allowed, :file => file} %>
+
+
+
+
+
+
+ <% else %>
+ <%= file.filename %>是私有资源
+ <% end %>
+<% end %>
+
+<% if project_attachments.count == 10%>
+ <% if params[:action] == 'search_project' %>
+
+
+
+ <%=link_to "点击展开更多", search_project_project_files_path({:project_id => project.id, :page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
+ <%else%>
+
+ <%=link_to "点击展开更多", project_files_path(:project_id => project.id,:page => @page),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
+ <%end%>
+<% end%>
+
+
+
diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb
index bac00a68d..317bb7dd8 100644
--- a/app/views/files/_resource_detail.html.erb
+++ b/app/views/files/_resource_detail.html.erb
@@ -1,81 +1,81 @@
-<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
-
-
-
- <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
-
-
-
- <%= link_to truncate(file.filename,length: 35, omission: '...'),
- download_named_attachment_path(file.id, file.filename),
- :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
- <%= file_preview_eye(file, class: 'preview') %>
-
- <% if file.is_public? == false%>
- 私有
- <%end %>
-
- <% if file.is_publish == 0 %>
- <%=file.publish_time %> 0点发布
- <% end %>
-
-
-
上传时间:<%= format_time(file.created_on)%>
- <% if file.tag_list.length > 0%>
-
上传类型:<%= file.tag_list[0] %>
- <% end %>
-
文件大小:<%= number_to_human_size(file.filesize) %>
-
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
-
- <% unless file.description.blank? %>
-
-
资源描述:<%= file.description %>
- <% end %>
-
-
-
- <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
- <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
-
-
-
-
-
- <% if User.current.logged? %>
-
- <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
- <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
-
-
- <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
- <%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %>
- <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
- <% if @course.is_public? %>
-
-
- <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
-
-
- <%end%>
-
- <%= link_to( '删除资源', attachment_path(file),
- :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
-
-
-
- <% end %>
- <%else%>
-
- <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
-
- <% end %>
- <% end %>
-
-
-
-
-
-
-
-
+<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
+
+
+
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
+ <%= file_preview_eye(file, class: 'preview') %>
+
+ <% if file.is_public? == false%>
+ 私有
+ <%end %>
+
+ <% if file.is_publish == 0 %>
+ <%=file.publish_time %> 0点发布
+ <% end %>
+
+
+
上传时间:<%= format_time(file.created_on)%>
+ <% if file.tag_list.length > 0%>
+
上传类型:<%= file.tag_list[0] %>
+ <% end %>
+
文件大小:<%= number_to_human_size(file.filesize) %>
+
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+
+ <% unless file.description.blank? %>
+
+
资源描述:<%= file.description %>
+ <% end %>
+
+
+
+ <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+ <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+
+
+
+
+
+ <% if User.current.logged? %>
+
+ <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
+ <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
+
+
+ <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+ <%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %>
+ <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
+ <% if @course.is_public? %>
+
+
+ <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
+
+
+ <%end%>
+
+ <%= link_to( '删除资源', attachment_path(file),
+ :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
+
+
+
+ <% end %>
+ <%else%>
+
+ <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb
index c58f690e3..6531aa96b 100644
--- a/app/views/files/_subfield_files.html.erb
+++ b/app/views/files/_subfield_files.html.erb
@@ -1,86 +1,86 @@
-<%= stylesheet_link_tag 'courses'%>
-
-
-
-<%# html_title(l(:label_attachment_plural)) -%>
-
+
+
+<%# html_title(l(:label_attachment_plural)) -%>
+
\ No newline at end of file
diff --git a/app/views/files/_upload_course_files.erb b/app/views/files/_upload_course_files.erb
index d728d7a2d..133b8b4d6 100644
--- a/app/views/files/_upload_course_files.erb
+++ b/app/views/files/_upload_course_files.erb
@@ -1,92 +1,92 @@
-
-
-
-
<%= l(:label_upload_files)%>
-
- <%= error_messages_for 'attachment' %>
-
<%= l(:label_file_upload_error_messages)%>
-
- <%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
-
-
-
- 课件 |
- 软件 |
- 媒体 |
- 代码 |
- 论文 |
- 其他
-
-
-
- <%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
-
-
-
-
- <% if User.current.allowed_to?(:as_teacher,course) %>
-
-
延迟发布:
-
-
- <%#= calendar_for('attachment_publish_time')%>
-
-
-
-
- <% end %>
-
<%= l(:button_cancel)%>
-
<%= l(:button_confirm)%>
- <%#= submit_tag '确定',:onclick=>'submit_course_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
- <% end %>
-
-
-
- <% content_for :header_tags do %>
- <%= javascript_include_tag 'attachments' %>
- <% end %>
-
-
-
+
+
+
<%= l(:label_upload_files)%>
+
+ <%= error_messages_for 'attachment' %>
+
<%= l(:label_file_upload_error_messages)%>
+
+ <%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
+
+
+
+ 课件 |
+ 软件 |
+ 媒体 |
+ 代码 |
+ 论文 |
+ 其他
+
+
+
+ <%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
+
+
+
+
+ <% if User.current.allowed_to?(:as_teacher,course) %>
+
+
延迟发布:
+
+
+ <%#= calendar_for('attachment_publish_time')%>
+
+
+
+
+ <% end %>
+
<%= l(:button_cancel)%>
+
<%= l(:button_confirm)%>
+ <%#= submit_tag '确定',:onclick=>'submit_course_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
+ <% end %>
+
+
+
+ <% content_for :header_tags do %>
+ <%= javascript_include_tag 'attachments' %>
+ <% end %>
+
+
+
\ No newline at end of file
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb
index 27e51f05c..528265c26 100644
--- a/app/views/files/index.html.erb
+++ b/app/views/files/index.html.erb
@@ -1,479 +1,479 @@
-
- <% if @container_type == 0 %>
-
- <%= render :partial => 'project_file', locals: {project: @project} %>
-
- <% elsif @container_type == 1 %>
-
- <%= render :partial => 'course_file', locals: {course: @course} %>
-
- <% elsif @container_type == 2 %>
-
- <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
-
- <% end %>
-
-
-
-
-
+
+ <% if @container_type == 0 %>
+
+ <%= render :partial => 'project_file', locals: {project: @project} %>
+
+ <% elsif @container_type == 1 %>
+
+ <%= render :partial => 'course_file', locals: {course: @course} %>
+
+ <% elsif @container_type == 2 %>
+
+ <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
+
+ <% end %>
+
+
+
+
+
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index f2de04ea1..20239262f 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -1,142 +1,142 @@
-
-
- <%=link_to image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3"), user_activities_path(User.current.id)%>
-
-
-
-
-
- <% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
-
- <% else %>
-
- <% end %>
-
-
-
-
-
-
-
-
-
- <%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target =>"_Blank", :title => "您的所有消息" %>
- <% if User.current.count_new_message >0 %>
-
<%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %>
- <% end %>
- <%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
-
-
-
-
+
+
+ <%=link_to image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3"), user_activities_path(User.current.id)%>
+
+
+
+
+
+ <% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
+
+ <% else %>
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+ <%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target =>"_Blank", :title => "您的所有消息" %>
+ <% if User.current.count_new_message >0 %>
+
<%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %>
+ <% end %>
+ <%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
+
+
+
+
diff --git a/app/views/layouts/static_base.html.erb b/app/views/layouts/static_base.html.erb
index 32436f23d..096b1699b 100644
--- a/app/views/layouts/static_base.html.erb
+++ b/app/views/layouts/static_base.html.erb
@@ -1,56 +1,56 @@
-
-
-
-
-
<%=h html_title %>
-
-
- <%= csrf_meta_tag %>
- <%= favicon %>
- <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
- <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
- <%= javascript_heads %>
- <%= javascript_include_tag "jquery.leanModal.min",'prettify' %>
- <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
- <%= heads_for_theme %>
- <%= call_hook :view_layouts_base_html_head %>
-
- <%= yield :header_tags -%>
- <%= stylesheet_link_tag 'base','header', :media => 'all'%>
-
-
-
-
-
-
-
-
- <% if User.current.logged? %>
- <%= render :partial => 'layouts/logined_header',:locals=>{:name=>@name,:type=>@type} %>
- <% else%>
- <%= render :partial => 'layouts/unlogin_header',:locals=>{:name=>@name,:type=>@type} %>
- <% end%>
-
-
-
-
-<%= render :partial => 'layouts/footer' %>
-
-
-
- <%= l(:label_loading) %>
-
-<%= call_hook :view_layouts_base_body_bottom %>
-
-
+
+
+
+
+
<%=h html_title %>
+
+
+ <%= csrf_meta_tag %>
+ <%= favicon %>
+ <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
+ <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
+ <%= javascript_heads %>
+ <%= javascript_include_tag "jquery.leanModal.min",'prettify' %>
+ <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
+ <%= heads_for_theme %>
+ <%= call_hook :view_layouts_base_html_head %>
+
+ <%= yield :header_tags -%>
+ <%= stylesheet_link_tag 'base','header', :media => 'all'%>
+
+
+
+
+
+
+
+
+ <% if User.current.logged? %>
+ <%= render :partial => 'layouts/logined_header',:locals=>{:name=>@name,:type=>@type} %>
+ <% else%>
+ <%= render :partial => 'layouts/unlogin_header',:locals=>{:name=>@name,:type=>@type} %>
+ <% end%>
+
+
+
+
+<%= render :partial => 'layouts/footer' %>
+
+
+
+ <%= l(:label_loading) %>
+
+<%= call_hook :view_layouts_base_body_bottom %>
+
+
diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb
index 2e038f01f..51cede682 100644
--- a/app/views/organizations/_org_course_homework.html.erb
+++ b/app/views/organizations/_org_course_homework.html.erb
@@ -1,370 +1,370 @@
-<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
-
-
-
- <% if activity.try(:user).try(:realname) == ' ' %>
- <%= link_to activity.try(:user), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
- <% end %> TO
- <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
-
-
- <%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%>
-
- <% if activity.homework_detail_manual%>
- <% if activity.homework_detail_manual.comment_status == 1%>
- <% if activity.anonymous_comment == 0%>
-
未开启匿评
- <% else %>
-
匿评已禁用
- <% end %>
- <% if Time.parse(activity.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%>
-
作品提交中
- <% elsif Time.parse(activity.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %>
-
作品补交中
- <% end %>
- <% elsif activity.homework_detail_manual.comment_status == 2%>
- <% if activity.anonymous_comment == 0%>
-
匿评中
- <% else %>
-
匿评已禁用
- <% end %>
-
教师评阅中
- <% elsif activity.homework_detail_manual.comment_status == 3%>
- <% if activity.anonymous_comment == 0%>
-
匿评已结束
- <% else %>
-
匿评已禁用
- <% end %>
-
教师评阅中
- <% end%>
- <% end%>
-
- <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
-
系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
- <% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
-
系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!
- <% end %>
-
- <% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%>
- <% projects = cur_user_projects_for_homework activity %>
- <% works = cur_user_works_for_homework activity %>
- <% if works.nil? && projects.nil? %>
-
- <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
- <%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
-
- <% elsif works.nil? %>
-
- <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
-
- <% end %>
- <% end %>
-
- <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
- <%= user_for_homework_common activity,is_teacher %>
-
-
- <% if activity.homework_type == 2 && is_teacher%>
-
- <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
-
- <% end %>
- <% if activity.homework_type == 2%>
-
- 语言:
- <%= activity.language_name%>
-
- <% end %>
- <% if activity.homework_type == 3 && activity.homework_detail_group%>
-
- 分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人
-
- <% end %>
- <% if activity.homework_detail_manual && activity.homework_detail_manual.comment_status < 2 %>
-
提交截止时间:<%= activity.end_time.to_s %> 23:59
- <% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 && activity.anonymous_comment == 0%>
-
匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %> 23:59
- <% end %>
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
-
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
- 迟交扣分:<%= activity.late_penalty%>分
-
- <% if activity.anonymous_comment == 0%>
-
- 匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%> 00:00
-
- <% end %>
-
-
-
- <% if activity.anonymous_comment == 0%>
-
- 缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
-
- <% end %>
- <% if activity.anonymous_comment == 0%>
-
- 匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
-
- <% end %>
-
-
- <% if activity.student_works.count != 0 %>
- <% sw = activity.student_works.reorder("created_at desc").first %>
-
- # <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
-
- <% end %>
-
- <% if activity.student_works.count != 0 %>
- <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
- <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
- <%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
- <% unless student_work_scores.empty? %>
- <% last_score = student_work_scores.first %>
-
-
# <%=time_from_now last_score.created_at %>
- <%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
-
-
- <% end %>
-
- <% if activity.homework_type != 2 %>
- <% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
- <% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
- <% else %>
- <% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
- <% end %>
- <% student_works.each_with_index do |sw, i| %>
-
- <% if i == 4 %>
- <% break %>
- <% end %>
- <% end %>
- <% if student_works.count > 5 %>
- <%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
- <% end %>
-
-
- <% end %>
-
- <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
- <% projects = activity.student_work_projects.where("is_leader = 1") %>
- <% unless projects.empty? %>
- <% sort_projects = project_sort_update projects %>
-
-
- # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
-
-
- <% sort_projects.each_with_index do |pro, i| %>
- <% project = Project.find pro.project_id %>
-
-
-
- <% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
- <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
- <% else %>
- <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
- <% end %>
- <% com_time = project.project_score.commit_time %>
- <% time=project.updated_on %>
- <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
-
<%=(User.find project.user_id).show_name %> (组长)
-
<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %> <%= project.project_score.changeset_num %>提交
-
- 项目名称:<%=project.name %>
- 创建者:<%=(User.find project.user_id).show_name %>(组长)
- 更新时间:<%=time_from_now time %>
-
-
- <% if i == 9 && projects.count > 10 %>
-
更多>>
- <% end %>
- <% if i > 9 && i == (projects.count - 1) %>
-
收回<<
- <% end %>
- <% end %>
-
- <% end %>
- <% end %>
-
- <% if is_teacher%>
- <% comment_status = activity.homework_detail_manual.comment_status %>
-
-
-
-
-
- <%= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity), :class => "postOptionLink"%>
-
-
- <%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
-
-
- <%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => 0),:class => "postOptionLink", :remote => true) %>
-
- <% if activity.anonymous_comment == 0 %>
-
- <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
-
-
- <%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
-
- <% end %>
- <% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
-
- <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink",
- :title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品",:remote => true)%>
-
- <% end %>
- <% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
-
- <%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
-
- <% elsif activity.is_open == 1 %>
-
- <%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
-
- <% end %>
-
-
-
-
- <% end%>
-
-
-
-
- <% count=activity.journals_for_messages.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.user == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.journals_for_messages.reorder("created_on desc").each do |comment| %>
-
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:user).try(:realname) == ' ' %>
- <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%>
- <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
- <%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
-
+
+
+ <% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
+ <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
+ <% else %>
+ <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
+ <% end %>
+ <% com_time = project.project_score.commit_time %>
+ <% time=project.updated_on %>
+ <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
+
<%=(User.find project.user_id).show_name %> (组长)
+
<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %> <%= project.project_score.changeset_num %>提交
+
+ 项目名称:<%=project.name %>
+ 创建者:<%=(User.find project.user_id).show_name %>(组长)
+ 更新时间:<%=time_from_now time %>
+
+
+ <% if i == 9 && projects.count > 10 %>
+
更多>>
+ <% end %>
+ <% if i > 9 && i == (projects.count - 1) %>
+
收回<<
+ <% end %>
+ <% end %>
+
+ <% end %>
+ <% end %>
+
+ <% if is_teacher%>
+ <% comment_status = activity.homework_detail_manual.comment_status %>
+
+
+
+
+
+ <%= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity), :class => "postOptionLink"%>
+
+
+ <%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
+
+
+ <%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => 0),:class => "postOptionLink", :remote => true) %>
+
+ <% if activity.anonymous_comment == 0 %>
+
+ <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
+
+
+ <%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
+
+ <% end %>
+ <% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
+
+ <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink",
+ :title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品",:remote => true)%>
+
+ <% end %>
+ <% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
+
+ <%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
+
+ <% elsif activity.is_open == 1 %>
+
+ <%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
+
+ <% end %>
+
+
+
+
+ <% end%>
+
+
+
+
+ <% count=activity.journals_for_messages.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.user == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.journals_for_messages.reorder("created_on desc").each do |comment| %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:user).try(:realname) == ' ' %>
+ <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%>
+ <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
+ <%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb
index 8f18c10d8..7eee53d02 100644
--- a/app/views/organizations/_org_course_message.html.erb
+++ b/app/views/organizations/_org_course_message.html.erb
@@ -1,159 +1,159 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if activity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
- <% end %>
- TO
- <%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
-
-
- <% if activity.parent_id.nil? %>
- <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
- <% else %>
- <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%>
- <% end %>
-
- <% if activity.sticky == 1%>
-
置顶
- <% end%>
- <% if activity.locked%>
-
- <% end%>
-
-
- 发帖时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
-
-
- <% if activity.parent_id.nil? %>
- <% content = activity.content%>
- <% else %>
- <% content = activity.parent.content%>
- <% end %>
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
-
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
-
- <% count=0 %>
- <% if activity.parent %>
- <% count=activity.parent.children.count%>
- <% else %>
- <% count=activity.children.count%>
- <% end %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#=format_date(activity.updated_on)%>
- <%if count > 3 %>
-
- <% end %>
-
-
- <% activity= activity.parent ? activity.parent : activity%>
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.children.reorder("created_on desc").each do |reply|%>
-
- <% replies_all_i=replies_all_i+1 %>
-
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
-
-
-
- <% if reply.try(:author).try(:realname) == ' ' %>
- <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(reply.created_on) %>
-
- <% if reply.author == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
-
-
-
- <%= reply.content.html_safe %>
-
-
-
-
- <% end %>
-
-
- <% end %>
-
- <% if !activity.locked? && authorize_for_course('messages', 'reply') %>
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
-
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
- <% end %>
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
+ <% end %>
+ TO
+ <%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
+
+
+ <% if activity.parent_id.nil? %>
+ <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
+ <% else %>
+ <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%>
+ <% end %>
+
+ <% if activity.sticky == 1%>
+
置顶
+ <% end%>
+ <% if activity.locked%>
+
+ <% end%>
+
+
+ 发帖时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
+
+
+ <% if activity.parent_id.nil? %>
+ <% content = activity.content%>
+ <% else %>
+ <% content = activity.parent.content%>
+ <% end %>
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
+
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+
+ <% count=0 %>
+ <% if activity.parent %>
+ <% count=activity.parent.children.count%>
+ <% else %>
+ <% count=activity.children.count%>
+ <% end %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#=format_date(activity.updated_on)%>
+ <%if count > 3 %>
+
+ <% end %>
+
+
+ <% activity= activity.parent ? activity.parent : activity%>
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.children.reorder("created_on desc").each do |reply|%>
+
+ <% replies_all_i=replies_all_i+1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %>
+ <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(reply.created_on) %>
+
+ <% if reply.author == User.current %>
+ 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
+ <% end %>
+
+
+
+ <%= reply.content.html_safe %>
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+ <% if !activity.locked? && authorize_for_course('messages', 'reply') %>
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
+
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+ <% end %>
+
+
diff --git a/app/views/projects/member.html.erb b/app/views/projects/member.html.erb
index 21ce71b47..eb2dcacbc 100644
--- a/app/views/projects/member.html.erb
+++ b/app/views/projects/member.html.erb
@@ -1,13 +1,13 @@
-
-
<%= @subPage_title%>
- <% if is_project_manager?(User.current, @project) %>
-
- <%=link_to "成员管理", :controller => 'projects', :action => 'settings', :id => @project.id, :tab => 'members' %>
-
- <% end %>
-
-
- <%= error_messages_for 'member' %>
- <%= render :partial => @render_file, :locals => {:members => @members} %>
-
-
+
+
<%= @subPage_title%>
+ <% if is_project_manager?(User.current, @project) %>
+
+ <%=link_to "成员管理", :controller => 'projects', :action => 'settings', :id => @project.id, :tab => 'members' %>
+
+ <% end %>
+
+
+ <%= error_messages_for 'member' %>
+ <%= render :partial => @render_file, :locals => {:members => @members} %>
+
+
diff --git a/app/views/projects/settings.html.erb b/app/views/projects/settings.html.erb
index 9eae5d65b..fc9beae35 100644
--- a/app/views/projects/settings.html.erb
+++ b/app/views/projects/settings.html.erb
@@ -1,126 +1,126 @@
-
-
-
-
配置
-
-
-
-
-
-
- <% show_memu = show_project_memu User.current%>
- <% if User.current.allowed_to?(:edit_project, @project) %>
- 信息
- <% end %>
- <% if User.current.allowed_to?(:select_project_modules, @project) %>
- 模块
- <% end %>
- <% if User.current.allowed_to?(:manage_members, @project) %>
- 成员
- <% end %>
- 组织
- <% if User.current.allowed_to?(:manage_versions, @project) %>
- 版本
- <% end %>
-
- <% if User.current.allowed_to?(:manage_repository, @project) %>
- 版本库
- <% end %>
-
-
-
-
-
-
-
-
-
- <%= render :partial=>"projects/settings/new_edit" if User.current.allowed_to?(:edit_project, @project)%>
-
-
-
- <%= render :partial=>"projects/settings/new_modules" if User.current.allowed_to?(:select_project_modules, @project)%>
-
-
-
- <%= render :partial=>"projects/settings/new_members" if User.current.allowed_to?(:manage_members, @project)%>
-
-
-
-
- <%= render :partial=>"projects/settings/new_versions" if User.current.allowed_to?(:manage_versions, @project)%>
-
-
-
-
-
-
- <%= render :partial=>"projects/settings/join_org" %>
-
-
-
- <%= render :partial=>"projects/settings/new_repositories" if User.current.allowed_to?(:manage_repository, @project)%>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
配置
+
+
+
+
+
+
+ <% show_memu = show_project_memu User.current%>
+ <% if User.current.allowed_to?(:edit_project, @project) %>
+ 信息
+ <% end %>
+ <% if User.current.allowed_to?(:select_project_modules, @project) %>
+ 模块
+ <% end %>
+ <% if User.current.allowed_to?(:manage_members, @project) %>
+ 成员
+ <% end %>
+ 组织
+ <% if User.current.allowed_to?(:manage_versions, @project) %>
+ 版本
+ <% end %>
+
+ <% if User.current.allowed_to?(:manage_repository, @project) %>
+ 版本库
+ <% end %>
+
+
+
+
+
+
+
+
+
+ <%= render :partial=>"projects/settings/new_edit" if User.current.allowed_to?(:edit_project, @project)%>
+
+
+
+ <%= render :partial=>"projects/settings/new_modules" if User.current.allowed_to?(:select_project_modules, @project)%>
+
+
+
+ <%= render :partial=>"projects/settings/new_members" if User.current.allowed_to?(:manage_members, @project)%>
+
+
+
+
+ <%= render :partial=>"projects/settings/new_versions" if User.current.allowed_to?(:manage_versions, @project)%>
+
+
+
+
+
+
+ <%= render :partial=>"projects/settings/join_org" %>
+
+
+
+ <%= render :partial=>"projects/settings/new_repositories" if User.current.allowed_to?(:manage_repository, @project)%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb
index 47ad2d6d3..bb2a31dcc 100644
--- a/app/views/users/_course_message.html.erb
+++ b/app/views/users/_course_message.html.erb
@@ -1,194 +1,194 @@
-
-
-
- <% if activity.status == 1 %>
- <%= image_tag("/images/trustie_logo1.png", width: "50px", height: "50px") %>
- <% else %>
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
- <% end %>
-
-
-
- <% if activity.status == 1 %>
- 确实团队
- <% else %>
- <% if activity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
- <% end %>
- <% end %>
- TO
- <%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
-
-
- <% if activity.parent_id.nil? %>
- <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
- <% else %>
- <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%>
- <% end %>
-
- <% if activity.sticky == 1%>
-
置顶
- <% end%>
- <% if activity.locked%>
-
- <% end%>
-
-
- 发帖时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
-
-
- <% if activity.parent_id.nil? %>
- <% content = activity.content%>
- <% else %>
- <% content = activity.parent.content%>
- <% end %>
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
- <% if activity.status == 1 %>
-
<%= activity.created_on.year %>
-
年
-
<%= activity.created_on.month %>
-
月
-
<%= activity.created_on.day %>
-
日
- <% end %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
-
-
- <% if activity.author.id == User.current.id%>
-
- <%= link_to(
- l(:button_edit),
- edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
- :class => 'postOptionLink'
- ) if activity.course_editable_by?(User.current) %>
-
-
- <%= link_to(
- l(:button_delete),
- delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
- :method => :post,
- :data => {:confirm => l(:text_are_you_sure)},
- :class => 'postOptionLink'
- ) if activity.course_destroyable_by?(User.current) %>
-
- <% end %>
- <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
-
-
-
-
-
-
-
-
- <% count=0 %>
- <% if activity.parent %>
- <% count=activity.parent.children.count%>
- <% else %>
- <% count=activity.children.count%>
- <% end %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#=format_date(activity.updated_on)%>
- <%if count > 3 %>
-
- <% end %>
-
-
- <% activity= activity.parent ? activity.parent : activity%>
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.children.reorder("created_on desc").each do |reply|%>
-
- <% replies_all_i=replies_all_i+1 %>
-
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
-
-
-
- <% if reply.try(:author).try(:realname) == ' ' %>
- <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(reply.created_on) %>
-
- <% if reply.author == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
-
-
-
-
- <%= reply.content.html_safe %>
-
-
-
-
- <% end %>
-
-
- <% end %>
-
- <% if !activity.locked? && authorize_for_course('messages', 'reply') %>
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => is_board,is_course=>is_course},:method => "post", :remote => true) do |f|%>
-
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
- <% end %>
-
-
-
+
+
+
+ <% if activity.status == 1 %>
+ <%= image_tag("/images/trustie_logo1.png", width: "50px", height: "50px") %>
+ <% else %>
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+ <% end %>
+
+
+
+ <% if activity.status == 1 %>
+ 确实团队
+ <% else %>
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
+ <% end %>
+ <% end %>
+ TO
+ <%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
+
+
+ <% if activity.parent_id.nil? %>
+ <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
+ <% else %>
+ <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%>
+ <% end %>
+
+ <% if activity.sticky == 1%>
+
置顶
+ <% end%>
+ <% if activity.locked%>
+
+ <% end%>
+
+
+ 发帖时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
+
+
+ <% if activity.parent_id.nil? %>
+ <% content = activity.content%>
+ <% else %>
+ <% content = activity.parent.content%>
+ <% end %>
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
+ <% if activity.status == 1 %>
+
<%= activity.created_on.year %>
+
年
+
<%= activity.created_on.month %>
+
月
+
<%= activity.created_on.day %>
+
日
+ <% end %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+
+
+ <% if activity.author.id == User.current.id%>
+
+ <%= link_to(
+ l(:button_edit),
+ edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
+ :class => 'postOptionLink'
+ ) if activity.course_editable_by?(User.current) %>
+
+
+ <%= link_to(
+ l(:button_delete),
+ delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
+ :method => :post,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'postOptionLink'
+ ) if activity.course_destroyable_by?(User.current) %>
+
+ <% end %>
+ <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
+
+
+
+
+
+
+
+
+ <% count=0 %>
+ <% if activity.parent %>
+ <% count=activity.parent.children.count%>
+ <% else %>
+ <% count=activity.children.count%>
+ <% end %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#=format_date(activity.updated_on)%>
+ <%if count > 3 %>
+
+ <% end %>
+
+
+ <% activity= activity.parent ? activity.parent : activity%>
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.children.reorder("created_on desc").each do |reply|%>
+
+ <% replies_all_i=replies_all_i+1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %>
+ <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(reply.created_on) %>
+
+ <% if reply.author == User.current %>
+ 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
+ <% end %>
+
+
+
+
+ <%= reply.content.html_safe %>
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+ <% if !activity.locked? && authorize_for_course('messages', 'reply') %>
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => is_board,is_course=>is_course},:method => "post", :remote => true) do |f|%>
+
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+ <% end %>
+
+
+
diff --git a/app/views/users/_homework_detail_information.html.erb b/app/views/users/_homework_detail_information.html.erb
index e43b5b6c7..07328e696 100644
--- a/app/views/users/_homework_detail_information.html.erb
+++ b/app/views/users/_homework_detail_information.html.erb
@@ -1,31 +1,31 @@
-题目信息
-
- <% if homework.nil? %>
-
请先在左侧选择作业
- <% else %>
-
标题:<%=homework.name %>
- 来源:<%=homework.course.name %>
- <% if homework.homework_type == 2 && homework.homework_detail_programing %>
- 编程语言:<%=homework.language_name %>
- <% end %>
- 贡献者:<%=homework.user.show_name %>
- <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %>
- ,<%=homework.user.user_extensions.occupation%>
- <% end %>
-
- 描述如下:
-
-
- <%=homework.description.html_safe %>
-
- <% if homework.homework_type == 2 %>
-
- 测试集:<%=homework.homework_tests.count %>组
-
- <% elsif homework.homework_type ==3 && homework.homework_detail_group %>
-
- 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人
-
- <% end %>
- <% end %>
+
题目信息
+
+ <% if homework.nil? %>
+
请先在左侧选择作业
+ <% else %>
+
标题:<%=homework.name %>
+ 来源:<%=homework.course.name %>
+ <% if homework.homework_type == 2 && homework.homework_detail_programing %>
+ 编程语言:<%=homework.language_name %>
+ <% end %>
+ 贡献者:<%=homework.user.show_name %>
+ <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %>
+ ,<%=homework.user.user_extensions.occupation%>
+ <% end %>
+
+ 描述如下:
+
+
+ <%=homework.description.html_safe %>
+
+ <% if homework.homework_type == 2 %>
+
+ 测试集:<%=homework.homework_tests.count %>组
+
+ <% elsif homework.homework_type ==3 && homework.homework_detail_group %>
+
+ 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人
+
+ <% end %>
+ <% end %>
\ No newline at end of file
diff --git a/app/views/users/_homework_post_notice.html.erb b/app/views/users/_homework_post_notice.html.erb
index a9b153854..d67fa44ae 100644
--- a/app/views/users/_homework_post_notice.html.erb
+++ b/app/views/users/_homework_post_notice.html.erb
@@ -1,12 +1,12 @@
-
-
-
- 题目已发送到目标课程的作业列表,但需要您设置发布和截止时间,以激活相应作业,谢谢!
-
-
-
+
+
+
+ 题目已发送到目标课程的作业列表,但需要您设置发布和截止时间,以激活相应作业,谢谢!
+
+
+
\ No newline at end of file
diff --git a/app/views/users/_homework_repository.html.erb b/app/views/users/_homework_repository.html.erb
index d514f4b59..a30e21a3f 100644
--- a/app/views/users/_homework_repository.html.erb
+++ b/app/views/users/_homework_repository.html.erb
@@ -1,39 +1,39 @@
-
-
-
- <% homeworks.each do |homework| %>
-
- <% end %>
+
+
+
+ <% homeworks.each do |homework| %>
+
+ <% end %>
\ No newline at end of file
diff --git a/app/views/users/_homework_repository_detail.html.erb b/app/views/users/_homework_repository_detail.html.erb
index f9df9eee5..7cf74e11e 100644
--- a/app/views/users/_homework_repository_detail.html.erb
+++ b/app/views/users/_homework_repository_detail.html.erb
@@ -1,33 +1,33 @@
-
-
题目信息
-
- <% if homework.nil? %>
-
请先在左侧选择作业
- <% else %>
-
标题:<%=homework.name %>
- 来源:<%=homework.course.name %>
- <% if homework.homework_type == 2 && homework.homework_detail_programing %>
- 编程语言:<%=homework.language_name %>
- <% end %>
- 贡献者:<%=homework.user.show_name %>
- <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %>
- ,<%=homework.user.user_extensions.occupation%>
- <% end %>
-
- 描述如下:
-
-
- <%=homework.description.html_safe %>
-
- <% if homework.homework_type == 2 %>
-
- 测试集:<%=homework.homework_tests.count %>组
-
- <% elsif homework.homework_type ==3 && homework.homework_detail_group %>
-
- 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人
-
- <% end %>
- <% end %>
-
+
+
题目信息
+
+ <% if homework.nil? %>
+
请先在左侧选择作业
+ <% else %>
+
标题:<%=homework.name %>
+ 来源:<%=homework.course.name %>
+ <% if homework.homework_type == 2 && homework.homework_detail_programing %>
+ 编程语言:<%=homework.language_name %>
+ <% end %>
+ 贡献者:<%=homework.user.show_name %>
+ <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %>
+ ,<%=homework.user.user_extensions.occupation%>
+ <% end %>
+
+ 描述如下:
+
+
+ <%=homework.description.html_safe %>
+
+ <% if homework.homework_type == 2 %>
+
+ 测试集:<%=homework.homework_tests.count %>组
+
+ <% elsif homework.homework_type ==3 && homework.homework_detail_group %>
+
+ 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人
+
+ <% end %>
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/users/_homework_repository_search.html.erb b/app/views/users/_homework_repository_search.html.erb
index 028795ce7..dfbaacd05 100644
--- a/app/views/users/_homework_repository_search.html.erb
+++ b/app/views/users/_homework_repository_search.html.erb
@@ -1,29 +1,29 @@
-
-
\ No newline at end of file
diff --git a/app/views/users/_homework_search_input.html.erb b/app/views/users/_homework_search_input.html.erb
index a4b966bf2..31d7602d4 100644
--- a/app/views/users/_homework_search_input.html.erb
+++ b/app/views/users/_homework_search_input.html.erb
@@ -1,29 +1,29 @@
-
-
\ No newline at end of file
diff --git a/app/views/users/_import_resource_info.html.erb b/app/views/users/_import_resource_info.html.erb
index a8f9650a7..bc1152ce4 100644
--- a/app/views/users/_import_resource_info.html.erb
+++ b/app/views/users/_import_resource_info.html.erb
@@ -1,75 +1,75 @@
-
-
选用资源库中的资源
-
- <% if !params[:course_id].nil? %>
-
公共资源
-
我的资源
- <% elsif !params[:project_id].nil? %>
-
公共资源
-
我的资源
- <% elsif !params[:subfield_file_id].nil? %>
-
公共资源
-
我的资源
- <% end %>
- <%#= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id, :type => 1),
- :remote => true , :method => 'get', :id => 'resource_search_form') do %>
-
- <%#= hidden_field_tag(:type,type.nil? ? 1 : type) %>
- <%# end %>
-
-
-
-
-
- 资源名称
- 类别
- 大小
- 上传者
- 上传时间
-
- <%= form_tag( url_for({:controller => 'users', :action => 'import_into_container',
- :mul_id => params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id],
- :mul_type => params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"}),
- :method => 'post', :id => 'resource_import_container_form') do %>
- <% @attachments.each do |attach| %>
-
- <% end %>
- <% end %>
-
-
-
-
-
-
-
-
+
+
选用资源库中的资源
+
+ <% if !params[:course_id].nil? %>
+
公共资源
+
我的资源
+ <% elsif !params[:project_id].nil? %>
+
公共资源
+
我的资源
+ <% elsif !params[:subfield_file_id].nil? %>
+
公共资源
+
我的资源
+ <% end %>
+ <%#= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id, :type => 1),
+ :remote => true , :method => 'get', :id => 'resource_search_form') do %>
+
+ <%#= hidden_field_tag(:type,type.nil? ? 1 : type) %>
+ <%# end %>
+
+
+
+
+
+ 资源名称
+ 类别
+ 大小
+ 上传者
+ 上传时间
+
+ <%= form_tag( url_for({:controller => 'users', :action => 'import_into_container',
+ :mul_id => params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id],
+ :mul_type => params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"}),
+ :method => 'post', :id => 'resource_import_container_form') do %>
+ <% @attachments.each do |attach| %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
diff --git a/app/views/users/_resource_search_form.html.erb b/app/views/users/_resource_search_form.html.erb
index f52fbe4df..9e42f9c96 100644
--- a/app/views/users/_resource_search_form.html.erb
+++ b/app/views/users/_resource_search_form.html.erb
@@ -1,7 +1,7 @@
-<%= form_tag( url_for(:controller => 'users', :action => 'resource_search', :id => user.id),
- :remote => true , :method => 'get', :class => 'resourcesSearchloadBox mt10', :id => 'resource_search_form') do %>
-
- <%= hidden_field_tag(:type,type.nil? ? 1 : type) %>
- <%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :style => 'border-style:none' %>
-
+<%= form_tag( url_for(:controller => 'users', :action => 'resource_search', :id => user.id),
+ :remote => true , :method => 'get', :class => 'resourcesSearchloadBox mt10', :id => 'resource_search_form') do %>
+
+ <%= hidden_field_tag(:type,type.nil? ? 1 : type) %>
+ <%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :style => 'border-style:none' %>
+
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb
index 7bd44ccf0..f679f9c8c 100644
--- a/app/views/users/_resources_list.html.erb
+++ b/app/views/users/_resources_list.html.erb
@@ -1,374 +1,374 @@
-<% if attachments.nil? || attachments.empty? %>
-
-
-
-<% else %>
- <% attachments.each do |attach| %>
-
-
- <% end %>
-<% end %>
-
-
+<% if attachments.nil? || attachments.empty? %>
+
+
+
+<% else %>
+ <% attachments.each do |attach| %>
+
+
+ <% end %>
+<% end %>
+
+
diff --git a/app/views/users/_send_homework_to_course.html.erb b/app/views/users/_send_homework_to_course.html.erb
index 902eebe22..b19fbd1a8 100644
--- a/app/views/users/_send_homework_to_course.html.erb
+++ b/app/views/users/_send_homework_to_course.html.erb
@@ -1,79 +1,79 @@
-
-
-
-
-
-
-
- <%= form_tag send_homework_to_course_user_path(user),:remote=>true,:id=>'choose_course_list_form' %>
-
- <%= hidden_field_tag(:send_id, send_id) %>
-
- <% if !courses.empty? %>
- <% courses.each do |course| %>
-
- <% end %>
-
-
-
-
-
-
- <% end %>
-
-
\ No newline at end of file
diff --git a/app/views/users/_show_user_homeworks.html.erb b/app/views/users/_show_user_homeworks.html.erb
index c7710db63..b9bbf6934 100644
--- a/app/views/users/_show_user_homeworks.html.erb
+++ b/app/views/users/_show_user_homeworks.html.erb
@@ -1,53 +1,53 @@
-
-
选用题库中的题目
-
-
公共题库
-
我的题库
-
- <%=render :partial=>'homework_search_input', :locals=>{:type => @type,:is_import => 1} %>
-
-
-
-
- 作业名称
- 来源
- 类别
- 贡献者
- 引用数
- 发布时间
-
-
- <%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %>
-
-
- <%= render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks}%>
-
- <% end %>
-
-
-
-
- <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
-
-
-
-
-
- <%=render :partial=>'homework_detail_information', :locals=>{:homework=>nil} %>
-
-
-
-
+
+
选用题库中的题目
+
+
公共题库
+
我的题库
+
+ <%=render :partial=>'homework_search_input', :locals=>{:type => @type,:is_import => 1} %>
+
+
+
+
+ 作业名称
+ 来源
+ 类别
+ 贡献者
+ 引用数
+ 发布时间
+
+
+ <%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %>
+
+
+ <%= render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks}%>
+
+ <% end %>
+
+
+
+
+ <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
+
+
+
+
+
+ <%=render :partial=>'homework_detail_information', :locals=>{:homework=>nil} %>
+
+
+
+
diff --git a/app/views/users/_upload_resource.html.erb b/app/views/users/_upload_resource.html.erb
index ae9114dfa..b72ec880b 100644
--- a/app/views/users/_upload_resource.html.erb
+++ b/app/views/users/_upload_resource.html.erb
@@ -1,54 +1,54 @@
-
-
上传资源
-
-
- <%= form_tag(user_resource_create_user_path(:type=>type,:status=>status), :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
-
-
- <% if defined?(container) && container && container.saved_attachments %>
-
- <% container.attachments.each_with_index do |attachment, i| %>
-
- <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
- <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
- <%= l(:field_is_public)%>:
- <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'remove-upload')%>
- <%= if attachment.id.nil?
- #待补充代码
- else
- link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
- end
- %>
- <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
-
- <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
-
- <% end %>
- <% end %>
-
-
-
-
-
- <%= render :partial => 'attachment_list' %>
-
-
-
-
-
-
-
-
-
-
-
- <%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
-
-
-
- <% end %>
-
+
+
上传资源
+
+
+ <%= form_tag(user_resource_create_user_path(:type=>type,:status=>status), :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
+
+
+ <% if defined?(container) && container && container.saved_attachments %>
+
+ <% container.attachments.each_with_index do |attachment, i| %>
+
+ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
+ <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
+ <%= l(:field_is_public)%>:
+ <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'remove-upload')%>
+ <%= if attachment.id.nil?
+ #待补充代码
+ else
+ link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
+ end
+ %>
+ <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
+
+ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+ <%= render :partial => 'attachment_list' %>
+
+
+
+
+
+
+
+
+
+
+
+ <%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
+
+
+
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb
index 70624ce38..8329e8432 100644
--- a/app/views/users/_user_homework_detail.html.erb
+++ b/app/views/users/_user_homework_detail.html.erb
@@ -1,374 +1,374 @@
-<% is_teacher = User.current.allowed_to?(:as_teacher,homework_common.course) %>
-
-
-
- <%=link_to image_tag(url_to_avatar(homework_common.user),width:"50px", height: "50px"), user_activities_path(homework_common.user.id)%>
-
-
-
- <%= link_to homework_common.user.show_name, user_activities_path(homework_common.user_id), :class => "newsBlue mr15"%>
- TO
- <%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue ml15"%>
-
-
- <%= link_to homework_common.name,student_work_index_path(:homework => homework_common.id),:class => "postGrey"%>
-
-
- <% if homework_common.homework_detail_manual%>
- <% if homework_common.homework_detail_manual.comment_status == 0 && homework_common.publish_time.nil? %>
-
挂起
- <% elsif homework_common.homework_detail_manual.comment_status == 0 %>
-
未发布
- <% elsif homework_common.homework_detail_manual.comment_status == 1%>
- <% if homework_common.anonymous_comment == 0%>
-
未开启匿评
- <% else %>
-
匿评已禁用
- <% end %>
- <% if Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%>
-
作品提交中
- <% elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %>
-
作品补交中
- <% end %>
- <% elsif homework_common.homework_detail_manual.comment_status == 2%>
- <% if homework_common.anonymous_comment == 0%>
-
匿评中
- <% else %>
-
匿评已禁用
- <% end %>
-
教师评阅中
- <% elsif homework_common.homework_detail_manual.comment_status == 3%>
- <% if homework_common.anonymous_comment == 0%>
-
匿评已结束
- <% else %>
-
匿评已禁用
- <% end %>
-
教师评阅中
- <% end%>
- <% end%>
-
- <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1%>
-
系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
- <% elsif homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 0%>
-
系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!
- <% end %>
-
- <% if homework_common.homework_type == 3 && !is_teacher && homework_common.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(homework_common.course) %>
- <% projects = cur_user_projects_for_homework homework_common %>
- <% works = cur_user_works_for_homework homework_common %>
- <% if works.nil? && projects.nil? %>
-
- <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
- <%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
-
- <% elsif works.nil? %>
-
- <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
-
- <% end %>
- <% end %>
-
- <%= user_for_homework_common homework_common,is_teacher %>
-
- <% if homework_common.homework_type == 2 && is_teacher%>
-
- <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
-
- <% end %>
- <% if homework_common.homework_type == 2%>
-
- 语言:
- <%= homework_common.language_name%>
-
- <% end %>
- <% if homework_common.homework_type == 3 && homework_common.homework_detail_group%>
-
- 分组人数:<%=homework_common.homework_detail_group.min_num %>-<%=homework_common.homework_detail_group.max_num %> 人
-
- <% end %>
- <% if homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status < 2 && !homework_common.publish_time.nil? %>
-
提交截止时间:<%= homework_common.end_time.to_s %> 23:59
- <% elsif homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status >= 2 && !homework_common.publish_time.nil? && homework_common.anonymous_comment == 0 %>
-
匿评截止时间:<%= homework_common.homework_detail_manual.evaluation_end.to_s %> 23:59
- <% end %>
- <% if homework_common.homework_detail_manual.comment_status == 0 && !homework_common.publish_time.nil? %>
-
- <%= l(:label_publish_time)%>:<%= homework_common.publish_time%> 00:00
-
- <% end %>
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>homework_common.id, :content=>homework_common.description} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => homework_common} %>
-
-
-
- 迟交扣分:<%= homework_common.late_penalty%>分
-
- <% if homework_common.anonymous_comment == 0 && !homework_common.publish_time.nil?%>
-
- 匿评开启时间:<%= homework_common.homework_detail_manual.evaluation_start%> 00:00
-
- <% end %>
-
-
-
- <% if homework_common.anonymous_comment == 0 %>
-
- 缺评扣分:<%= homework_common.homework_detail_manual.absence_penalty%>分/作品
-
- <% end %>
- <% if homework_common.anonymous_comment == 0 && !homework_common.publish_time.nil?%>
-
- 匿评关闭时间:<%= homework_common.homework_detail_manual.evaluation_end%> 23:59
-
- <% end %>
-
-
- <% if homework_common.student_works.count != 0 %>
- <% sw = homework_common.student_works.reorder("created_at desc").first %>
-
- # <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
-
- <% end %>
-
- <% if homework_common.student_works.count != 0 %>
- <% sw_id = "("+homework_common.student_works.map{|sw| sw.id}.join(",")+")" %>
- <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
- <%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
- <% unless student_work_scores.empty? %>
- <% last_score = student_work_scores.first %>
-
-
# <%=time_from_now last_score.created_at %>
- <%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
-
-
- <% end %>
-
- <% if homework_common.homework_type != 2 %>
- <% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
- <% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
- <% else %>
- <% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
- <% end %>
- <% student_works.each_with_index do |sw, i| %>
-
- <% if i == 4 %>
- <% break %>
- <% end %>
- <% end %>
- <% if student_works.count > 5%>
- <%= link_to "更多>>", student_work_index_path(:homework => homework_common.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
- <% end %>
-
-
- <% end %>
-
- <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>
- <% projects = homework_common.student_work_projects.where("is_leader = 1") %>
- <% unless projects.empty? %>
- <% sort_projects = project_sort_update projects %>
-
-
- # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
-
-
- <% sort_projects.each_with_index do |pro, i| %>
- <% project = Project.find pro.project_id %>
-
-
-
- <% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
- <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像" %>
- <% else %>
- <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %>
- <% end %>
- <% com_time = project.project_score.commit_time %>
- <% time=project.updated_on %>
- <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
-
<%=(User.find project.user_id).show_name %> (组长)
-
<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %> <%= project.project_score.changeset_num %>提交
-
- 项目名称:<%=project.name %>
- 创建者:<%=(User.find project.user_id).show_name %>(组长)
- 更新时间:<%=time_from_now time %>
-
-
- <% if i == 9 && projects.count > 10 %>
-
更多>>
- <% end %>
- <% if i > 9 && i == (projects.count - 1) %>
-
收回<<
- <% end %>
- <% end %>
-
- <% end %>
- <% end %>
-
- <% if is_teacher%>
- <% comment_status = homework_common.homework_detail_manual.comment_status%>
-
-
-
-
-
- <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1), :class => "postOptionLink"%>
-
-
- <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
-
-
- <%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true) %>
-
- <% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%>
-
- <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true)%>
-
- <% end %>
- <% if homework_common.anonymous_comment == 0%>
-
- <%= homework_anonymous_comment(homework_common, is_in_course) %>
-
- <% end %>
- <% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
-
- <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink",
- :title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
-
- <% end %>
- <% if (homework_common.anonymous_comment == 1 && homework_common.is_open == 0) || (homework_common.anonymous_comment == 0 && comment_status == 3 && homework_common.is_open == 0) %>
-
- <%= link_to("公开作品", alert_open_student_works_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=> -1),:class => "postOptionLink", :remote => true)%>
-
- <% elsif homework_common.is_open == 1 %>
-
- <%= link_to("取消公开", alert_open_student_works_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=> -1),:class => "postOptionLink", :remote => true)%>
-
- <% end %>
-
-
-
-
- <% end%>
-
-
-
-
- <% count=homework_common.journals_for_messages.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if homework_common.user == User.current %>
- 赞 <%= get_praise_num(homework_common) > 0 ? "(#{get_praise_num(homework_common)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>homework_common, :user_activity_id=>homework_common.id,:type=>"activity"}%>
- <% end %>
-
-
-
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% homework_common.journals_for_messages.reorder("created_on desc").each do |comment| %>
-
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:user).try(:realname) == ' ' %>
- <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => homework_common.id},:method => "post", :remote => true) do |f|%>
- <%= hidden_field_tag 'homework_common_id',params[:homework_common_id],:value =>homework_common.id %>
- <%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %>
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
-
+
+
+ <% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
+ <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像" %>
+ <% else %>
+ <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %>
+ <% end %>
+ <% com_time = project.project_score.commit_time %>
+ <% time=project.updated_on %>
+ <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
+
<%=(User.find project.user_id).show_name %> (组长)
+
<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %> <%= project.project_score.changeset_num %>提交
+
+ 项目名称:<%=project.name %>
+ 创建者:<%=(User.find project.user_id).show_name %>(组长)
+ 更新时间:<%=time_from_now time %>
+
+
+ <% if i == 9 && projects.count > 10 %>
+
更多>>
+ <% end %>
+ <% if i > 9 && i == (projects.count - 1) %>
+
收回<<
+ <% end %>
+ <% end %>
+
+ <% end %>
+ <% end %>
+
+ <% if is_teacher%>
+ <% comment_status = homework_common.homework_detail_manual.comment_status%>
+
+
+
+
+
+ <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1), :class => "postOptionLink"%>
+
+
+ <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
+
+
+ <%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true) %>
+
+ <% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%>
+
+ <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true)%>
+
+ <% end %>
+ <% if homework_common.anonymous_comment == 0%>
+
+ <%= homework_anonymous_comment(homework_common, is_in_course) %>
+
+ <% end %>
+ <% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
+
+ <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink",
+ :title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
+
+ <% end %>
+ <% if (homework_common.anonymous_comment == 1 && homework_common.is_open == 0) || (homework_common.anonymous_comment == 0 && comment_status == 3 && homework_common.is_open == 0) %>
+
+ <%= link_to("公开作品", alert_open_student_works_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=> -1),:class => "postOptionLink", :remote => true)%>
+
+ <% elsif homework_common.is_open == 1 %>
+
+ <%= link_to("取消公开", alert_open_student_works_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=> -1),:class => "postOptionLink", :remote => true)%>
+
+ <% end %>
+
+
+
+
+ <% end%>
+
+
+
+
+ <% count=homework_common.journals_for_messages.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if homework_common.user == User.current %>
+ 赞 <%= get_praise_num(homework_common) > 0 ? "(#{get_praise_num(homework_common)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>homework_common, :user_activity_id=>homework_common.id,:type=>"activity"}%>
+ <% end %>
+
+
+
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% homework_common.journals_for_messages.reorder("created_on desc").each do |comment| %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:user).try(:realname) == ' ' %>
+ <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => homework_common.id},:method => "post", :remote => true) do |f|%>
+ <%= hidden_field_tag 'homework_common_id',params[:homework_common_id],:value =>homework_common.id %>
+ <%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %>
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb
index 1e6de50b3..8b72ec781 100644
--- a/app/views/users/_user_homework_form.html.erb
+++ b/app/views/users/_user_homework_form.html.erb
@@ -1,270 +1,270 @@
-<% content_for :header_tags do %>
- <%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
-
- <%= javascript_include_tag 'homework','baiduTemplate' %>
-
-<% end %>
-
-
-
-
-
-
-
- <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
- <% unless edit_mode %>
-
- <% end %>
- <% if edit_mode %>
-
截止日期:
- <% end %>
-
-
- <% if homework.homework_detail_manual.comment_status.to_i < 3 %>
- <%= calendar_for('homework_end_time')%>
- <% end %>
-
- <% if edit_mode %>
-
发布日期(可选):
- <% end %>
-
-
- <% if homework.homework_detail_manual.comment_status.to_i == 0 %>
- <%= calendar_for('homework_publish_time')%>
- <% end %>
-
- <% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
-
-
- 禁用匿评
-
- <% end %>
-
-
-
-
-
-
- <% if edit_mode %>
-
- <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %>
- <% else %>
- <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
-
- <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %>
- <% end %>
-
-
-
-
- <%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
-
-
-
-
-
-
- <%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type != 2), :has_group=>(!(edit_mode && homework.homework_type != 3))&& homework.student_works.empty?,:show_member => true} %>
-
-
-
- <% if edit_mode %>
-
确定
-
或
- <%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
-
取消
- <% else %>
-
发送
-
或
-
取消
- <% end %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<% unless edit_mode %>
-
+<% content_for :header_tags do %>
+ <%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
+
+ <%= javascript_include_tag 'homework','baiduTemplate' %>
+
+<% end %>
+
+
+
+
+
+
+
+ <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
+ <% unless edit_mode %>
+
+ <% end %>
+ <% if edit_mode %>
+
截止日期:
+ <% end %>
+
+
+ <% if homework.homework_detail_manual.comment_status.to_i < 3 %>
+ <%= calendar_for('homework_end_time')%>
+ <% end %>
+
+ <% if edit_mode %>
+
发布日期(可选):
+ <% end %>
+
+
+ <% if homework.homework_detail_manual.comment_status.to_i == 0 %>
+ <%= calendar_for('homework_publish_time')%>
+ <% end %>
+
+ <% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
+
+
+ 禁用匿评
+
+ <% end %>
+
+
+
+
+
+
+ <% if edit_mode %>
+
+ <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %>
+ <% else %>
+ <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
+
+ <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %>
+ <% end %>
+
+
+
+
+ <%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
+
+
+
+
+
+
+ <%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type != 2), :has_group=>(!(edit_mode && homework.homework_type != 3))&& homework.student_works.empty?,:show_member => true} %>
+
+
+
+ <% if edit_mode %>
+
确定
+
或
+ <%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
+
取消
+ <% else %>
+
发送
+
或
+
取消
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<% unless edit_mode %>
+
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb
index ffd757390..e42c5d8b2 100644
--- a/app/views/users/_user_homework_list.html.erb
+++ b/app/views/users/_user_homework_list.html.erb
@@ -1,40 +1,40 @@
-<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
-<% end %>
-
-
-<% homework_commons.each do |homework_common|%>
-
- <%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %>
-<% end%>
-<% if homework_commons.count == 10%>
- <% if is_in_course == 1%>
-
- <%= link_to "点击展开更多",homework_common_index_path(:course => course_id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
- <% else%>
-
- <%= link_to "点击展开更多",student_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
- <% end%>
-<% end%>
-
+<%= content_for(:header_tags) do %>
+ <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
+<% end %>
+
+
+<% homework_commons.each do |homework_common|%>
+
+ <%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %>
+<% end%>
+<% if homework_commons.count == 10%>
+ <% if is_in_course == 1%>
+
+ <%= link_to "点击展开更多",homework_common_index_path(:course => course_id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
+ <% else%>
+
+ <%= link_to "点击展开更多",student_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
+ <% end%>
+<% end%>
+
diff --git a/app/views/users/_user_homeworks_old.html.erb b/app/views/users/_user_homeworks_old.html.erb
index fefea3e8c..59ec24ad3 100644
--- a/app/views/users/_user_homeworks_old.html.erb
+++ b/app/views/users/_user_homeworks_old.html.erb
@@ -1,47 +1,47 @@
-
-
-
-
-<% if @is_teacher%>
-
-
- <% homework = HomeworkCommon.new %>
- <% homework.homework_detail_manual = HomeworkDetailManual.new%>
- <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
-
- <%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
-
- <% end%>
-
-<% end%>
-
-<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0,:is_in_course => 0} %>
+
+
+
+
+<% if @is_teacher%>
+
+
+ <% homework = HomeworkCommon.new %>
+ <% homework.homework_detail_manual = HomeworkDetailManual.new%>
+ <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
+
+ <%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
+
+ <% end%>
+
+<% end%>
+
+<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0,:is_in_course => 0} %>
diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb
index 2d5415c4e..cafbf457f 100644
--- a/app/views/users/_user_resource_info.html.erb
+++ b/app/views/users/_user_resource_info.html.erb
@@ -1,60 +1,60 @@
-
-
-
- <%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %>
-
-
为您找到<%= @atta_count %> 个资源
-
-
-
-
- 资源名称
- 上传时间
- 引用数
- 下载数
- 大小
- 上传者
- 类别
- 来源
-
-
-
-
-
- <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
-
-
-
-
-
-
-
-
-
+
+
+
+ <%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %>
+
+
为您找到<%= @atta_count %> 个资源
+
+
+
+
+ 资源名称
+ 上传时间
+ 引用数
+ 下载数
+ 大小
+ 上传者
+ 类别
+ 来源
+
+
+
+
+
+ <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/choose_user_course.js.erb b/app/views/users/choose_user_course.js.erb
index 0be5990e9..508004816 100644
--- a/app/views/users/choose_user_course.js.erb
+++ b/app/views/users/choose_user_course.js.erb
@@ -1,7 +1,7 @@
-$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/send_homework_to_course', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>');
-showModal('ajax-modal', '452px');
-$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before(" ");
-$('#ajax-modal').parent().css("top","50%").css("left","50%");
-$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
+$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/send_homework_to_course', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>');
+showModal('ajax-modal', '452px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before(" ");
+$('#ajax-modal').parent().css("top","50%").css("left","50%");
+$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
\ No newline at end of file
diff --git a/app/views/users/import_into_container.js.erb b/app/views/users/import_into_container.js.erb
index c977d99da..2a1ea3599 100644
--- a/app/views/users/import_into_container.js.erb
+++ b/app/views/users/import_into_container.js.erb
@@ -1,3 +1,3 @@
-<% if @flag == true%>
-alert("发送成功")
+<% if @flag == true%>
+alert("发送成功")
<% end %>
\ No newline at end of file
diff --git a/app/views/users/import_resources.js.erb b/app/views/users/import_resources.js.erb
index 197f42ea7..6244e8e64 100644
--- a/app/views/users/import_resources.js.erb
+++ b/app/views/users/import_resources.js.erb
@@ -1,18 +1,18 @@
-<% if params[:project_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :project_id => params[:project_id]} ) %>');
-<% elsif params[:course_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :course_id => params[:course_id]} ) %>');
-<% elsif params[:subfield_file_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :subfield_file_id => params[:subfield_file_id]} ) %>');
-<% end %>
-showModal('ajax-modal', '615px');
-$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before(" ");
-<% if params[:project_id] %>
-$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9");
-<% else %>
-$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9");
-<% end %>
-$('#ajax-modal').parent().addClass("popbox_polls");
-
-
+<% if params[:project_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :project_id => params[:project_id]} ) %>');
+<% elsif params[:course_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :course_id => params[:course_id]} ) %>');
+<% elsif params[:subfield_file_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :subfield_file_id => params[:subfield_file_id]} ) %>');
+<% end %>
+showModal('ajax-modal', '615px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before(" ");
+<% if params[:project_id] %>
+$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9");
+<% else %>
+$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9");
+<% end %>
+$('#ajax-modal').parent().addClass("popbox_polls");
+
+
diff --git a/app/views/users/import_resources_search.js.erb b/app/views/users/import_resources_search.js.erb
index ff7cdb092..549cf6329 100644
--- a/app/views/users/import_resources_search.js.erb
+++ b/app/views/users/import_resources_search.js.erb
@@ -1,25 +1,25 @@
-//$("#resources_list").html('<%#= escape_javascript( render :partial => 'users/import_resource_info' ,:locals=>{ :attachments => @attachments, :type => @type})%>');
-//$("#pages").html('<%#= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-//$("#res_all_count").html(<%#= @atta_count%>);
-//$("#res_count").html(0);
-//$("#checkboxAll").attr('checked',false);
-
-
-<% if params[:project_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :project_id => params[:project_id]} ) %>');
-<% elsif params[:course_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :course_id => params[:course_id]} ) %>');
-<% elsif params[:subfield_file_id] %>
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :subfield_file_id => params[:subfield_file_id]} ) %>');
-<% end %>
-showModal('ajax-modal', '615px');
-$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before(" ");
-<% if params[:project_id] %>
-$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9");
-<% else %>
-$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9");
-<% end %>
-$('#ajax-modal').parent().addClass("popbox_polls");
-
-
+//$("#resources_list").html('<%#= escape_javascript( render :partial => 'users/import_resource_info' ,:locals=>{ :attachments => @attachments, :type => @type})%>');
+//$("#pages").html('<%#= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+//$("#res_all_count").html(<%#= @atta_count%>);
+//$("#res_count").html(0);
+//$("#checkboxAll").attr('checked',false);
+
+
+<% if params[:project_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :project_id => params[:project_id]} ) %>');
+<% elsif params[:course_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :course_id => params[:course_id]} ) %>');
+<% elsif params[:subfield_file_id] %>
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :subfield_file_id => params[:subfield_file_id]} ) %>');
+<% end %>
+showModal('ajax-modal', '615px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before(" ");
+<% if params[:project_id] %>
+$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9");
+<% else %>
+$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9");
+<% end %>
+$('#ajax-modal').parent().addClass("popbox_polls");
+
+
diff --git a/app/views/users/send_homework_to_course.js.erb b/app/views/users/send_homework_to_course.js.erb
index e4e8e84ab..b06d8e434 100644
--- a/app/views/users/send_homework_to_course.js.erb
+++ b/app/views/users/send_homework_to_course.js.erb
@@ -1,9 +1,9 @@
-$("#subject_count_homework_<%=@homework.id %>").html(<%= @homework.quotes %>);
-$("#ajax-modal").html("<%=escape_javascript(render :partial => 'homework_post_notice') %>");
-showModal('ajax-modal', '500px');
-$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before("" +
- " ");
-$('#ajax-modal').parent().css("top","50%").css("left","50%");
-$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
+$("#subject_count_homework_<%=@homework.id %>").html(<%= @homework.quotes %>);
+$("#ajax-modal").html("<%=escape_javascript(render :partial => 'homework_post_notice') %>");
+showModal('ajax-modal', '500px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before("" +
+ " ");
+$('#ajax-modal').parent().css("top","50%").css("left","50%");
+$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
\ No newline at end of file
diff --git a/app/views/users/show_homework_detail.js.erb b/app/views/users/show_homework_detail.js.erb
index 6652e5344..a5dd82453 100644
--- a/app/views/users/show_homework_detail.js.erb
+++ b/app/views/users/show_homework_detail.js.erb
@@ -1,5 +1,5 @@
-<% if @is_import.to_i == 1 %>
- $("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>@homework}) %>");
-<% else %>
- $("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>@homework}) %>");
+<% if @is_import.to_i == 1 %>
+ $("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>@homework}) %>");
+<% else %>
+ $("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>@homework}) %>");
<% end %>
\ No newline at end of file
diff --git a/app/views/users/student_homeworks.html.erb b/app/views/users/student_homeworks.html.erb
index fefea3e8c..59ec24ad3 100644
--- a/app/views/users/student_homeworks.html.erb
+++ b/app/views/users/student_homeworks.html.erb
@@ -1,47 +1,47 @@
-
-
-
-
-<% if @is_teacher%>
-
-
- <% homework = HomeworkCommon.new %>
- <% homework.homework_detail_manual = HomeworkDetailManual.new%>
- <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
-
- <%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
-
- <% end%>
-
-<% end%>
-
-<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0,:is_in_course => 0} %>
+
+
+
+
+<% if @is_teacher%>
+
+
+ <% homework = HomeworkCommon.new %>
+ <% homework.homework_detail_manual = HomeworkDetailManual.new%>
+ <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
+
+ <%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
+
+ <% end%>
+
+<% end%>
+
+<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0,:is_in_course => 0} %>
diff --git a/app/views/users/user_homework_type.js.erb b/app/views/users/user_homework_type.js.erb
index 7bb29ceba..701cf45fa 100644
--- a/app/views/users/user_homework_type.js.erb
+++ b/app/views/users/user_homework_type.js.erb
@@ -1,15 +1,15 @@
-<% if @is_import.to_i == 1 %>
-$("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>');
-$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
-$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type,:is_import=>@is_import}) %>");
-<% else %>
-$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
-$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
-$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_repository_search', :locals=>{:type=>@type,:is_import=>@is_import,:property=>@property}) %>");
-$("#homework_type_all").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 0) %>');
-$("#homework_type_nor").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 1) %>');
-$("#homework_type_pro").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 2) %>');
-$("#homework_type_gro").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 3) %>');
-<% end %>
+<% if @is_import.to_i == 1 %>
+$("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>');
+$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
+$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type,:is_import=>@is_import}) %>");
+<% else %>
+$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
+$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
+$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_repository_search', :locals=>{:type=>@type,:is_import=>@is_import,:property=>@property}) %>");
+$("#homework_type_all").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 0) %>');
+$("#homework_type_nor").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 1) %>');
+$("#homework_type_pro").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 2) %>');
+$("#homework_type_gro").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 3) %>');
+<% end %>
diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb
index 7adaa4621..4e928ca78 100644
--- a/app/views/users/user_homeworks.html.erb
+++ b/app/views/users/user_homeworks.html.erb
@@ -1,97 +1,97 @@
-<%= stylesheet_link_tag 'pleft','header','new_user','repository','org', 'public' %>
-
-
-
-
-
-
-
-
- <%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => @property} %>
-
-
-
-
-
- 作业名称
- 来源
- 类别
- 贡献者
- 引用数
- 发布时间
-
-
- <%=render :partial => 'homework_repository', :locals => {:homeworks => @homeworks} %>
-
-
-
- <%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %>
-
-
-
-
- <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
-
-
-
-
-
-
-
+<%= stylesheet_link_tag 'pleft','header','new_user','repository','org', 'public' %>
+
+
+
+
+
+
+
+
+ <%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => @property} %>
+
+
+
+
+
+ 作业名称
+ 来源
+ 类别
+ 贡献者
+ 引用数
+ 发布时间
+
+
+ <%=render :partial => 'homework_repository', :locals => {:homeworks => @homeworks} %>
+
+
+
+ <%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %>
+
+
+
+
+ <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/user_homeworks.js.erb b/app/views/users/user_homeworks.js.erb
index 0de895708..a24b3d018 100644
--- a/app/views/users/user_homeworks.js.erb
+++ b/app/views/users/user_homeworks.js.erb
@@ -1,3 +1,3 @@
-$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
-$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
+$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
+$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
diff --git a/app/views/users/user_resource.js.erb b/app/views/users/user_resource.js.erb
index a39fd4468..4ba186579 100644
--- a/app/views/users/user_resource.js.erb
+++ b/app/views/users/user_resource.js.erb
@@ -1,15 +1,15 @@
-$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form', :locals => {:user => @user, :type => @type} ) %>');
-$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' , :locals => { :attachments => @attachments}) %>');
-$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#res_count").html(0);
-$("#checkboxAll").attr('checked',false);
-$("#res_all_count").html(<%= @atta_count %>);
-
-$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6', :status => @status) %>');
-$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1', :status => @status) %>');
-
-$("#resource_type_all").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 1) %>');
-$("#resource_type_course").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 2) %>');
-$("#resource_type_project").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 3) %>');
-$("#resource_type_user").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 5) %>');
-$("#resource_type_file").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 4) %>');
+$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form', :locals => {:user => @user, :type => @type} ) %>');
+$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' , :locals => { :attachments => @attachments}) %>');
+$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#res_count").html(0);
+$("#checkboxAll").attr('checked',false);
+$("#res_all_count").html(<%= @atta_count %>);
+
+$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6', :status => @status) %>');
+$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1', :status => @status) %>');
+
+$("#resource_type_all").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 1) %>');
+$("#resource_type_course").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 2) %>');
+$("#resource_type_project").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 3) %>');
+$("#resource_type_user").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 5) %>');
+$("#resource_type_file").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 4) %>');
diff --git a/app/views/users/user_search_homeworks.js.erb b/app/views/users/user_search_homeworks.js.erb
index d5955c43b..34d73b823 100644
--- a/app/views/users/user_search_homeworks.js.erb
+++ b/app/views/users/user_search_homeworks.js.erb
@@ -1,9 +1,9 @@
-<% if @is_import.to_i == 1 %>
-$("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>');
-$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
-<% else %>
-$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
-$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
+<% if @is_import.to_i == 1 %>
+$("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>');
+$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
+<% else %>
+$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
+$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
<% end %>
\ No newline at end of file
diff --git a/db/migrate/20160303103231_add_homework_journal_to_course_contributor_scores.rb b/db/migrate/20160303103231_add_homework_journal_to_course_contributor_scores.rb
index 505695fc0..e3d4310e6 100644
--- a/db/migrate/20160303103231_add_homework_journal_to_course_contributor_scores.rb
+++ b/db/migrate/20160303103231_add_homework_journal_to_course_contributor_scores.rb
@@ -1,5 +1,5 @@
-class AddHomeworkJournalToCourseContributorScores < ActiveRecord::Migration
- def change
- add_column :course_contributor_scores, :homework_journal_num, :integer, :default => 0
- end
-end
+class AddHomeworkJournalToCourseContributorScores < ActiveRecord::Migration
+ def change
+ add_column :course_contributor_scores, :homework_journal_num, :integer, :default => 0
+ end
+end
From d54609075b81a62d47cb97a627bc6de362004a31 Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 5 Mar 2016 04:01:10 +0800
Subject: [PATCH 15/25] =?UTF-8?q?=E5=8C=BA=E5=88=86=E6=96=B0=E9=97=BB?=
=?UTF-8?q?=E5=92=8C=E6=96=B0=E9=97=BB=E5=9B=9E=E5=A4=8D=E5=BE=97=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 2 +-
app/models/comment.rb | 6 +----
app/models/news.rb | 8 ++++++-
app/views/layouts/base_courses.html.erb | 9 +++++---
...304154643_update_contributor_for_course.rb | 22 +++++++++++++------
db/schema.rb | 4 ++--
6 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 48ee42234..22890fd9a 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -166,7 +166,7 @@ module ApplicationHelper
else
score = course_contributor_score.news_num + 1
total_score = course_contributor_score.total_score + 1
- course_contributor_score.update_attributes(:news_num => score, :total_score => news_num)
+ course_contributor_score.update_attributes(:news_num => score, :total_score => total_score)
end
end
end
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 1125e168f..4d7af1d73 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -82,11 +82,7 @@ class Comment < ActiveRecord::Base
# 课程成员得分(英雄榜)
def act_as_student_score
if self.commented.course
- if self.author.allowed_to?(:as_teacher, self.commented.course)
- course_member_score(self.commented.course.id, self.author_id, "NewReply")
- else
- course_member_score(self.commented.course.id, self.author_id, "News")
- end
+ course_member_score(self.commented.course.id, self.author_id, "NewReply")
end
end
diff --git a/app/models/news.rb b/app/models/news.rb
index f31c6bcef..028b6d737 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -59,7 +59,7 @@ class News < ActiveRecord::Base
:author_key => :author_id
acts_as_watchable
- after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count
+ after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score
after_update :update_activity
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities
@@ -195,4 +195,10 @@ class News < ActiveRecord::Base
OrgActivity.where("container_type='OrgSubfield' and org_act_type='News' and org_act_id=?", self.id).destroy_all
end
+ def act_as_student_score
+ if self.course
+ course_member_score(self.course.id, self.author_id, "News")
+ end
+ end
+
end
\ No newline at end of file
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index 4940b60d6..ceb526f44 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -148,9 +148,10 @@
资源得分:资源数 x 5
发帖得分:发帖数 x 2
回帖得分:回复数 x 1
+ 通知得分:通知数 x 1
课程留言得分:留言数 x 1
作业留言得分:留言数 x 1
- 通知得分:通知数 x 1
+ 通知回复得分:回复数 x 1
总得分为以上得分之和
@@ -162,7 +163,8 @@
<%=total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 +
contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 +
- + contributor_score.homework_journal_num * 1 + contributor_score.news_reply_num.to_i * 1 %>
+ + contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 +
+ contributor_score.news_num.to_i * 1 %>
@@ -188,7 +190,8 @@
作业留言:留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %>
<%# end %>
<%# unless contributor_score.news_reply_num.to_i == 0 %>
- 课程通知:通知数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %>
+ 发布通知:通知数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %>
+ 通知回复:通知数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %>
<%# end %>
总得分:<%=total_score %>
diff --git a/db/migrate/20160304154643_update_contributor_for_course.rb b/db/migrate/20160304154643_update_contributor_for_course.rb
index be9ed3126..47107dd55 100644
--- a/db/migrate/20160304154643_update_contributor_for_course.rb
+++ b/db/migrate/20160304154643_update_contributor_for_course.rb
@@ -12,11 +12,9 @@ class UpdateContributorForCourse < ActiveRecord::Migration
# 回帖数
message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is not null").count * 1
# 新闻回复
- if s.user.allowed_to?(:as_teacher, course)
- common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.user_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
- else
- common_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.user_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
- end
+ common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.user_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
+ # 通知
+ common_count = New.find_by_sql("select n.* from news n where n.author_id = #{s.user_id} and n.course_id = #{course.id} ").count * 1
# attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5
# 附件数
attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.user_id} and container_type ='Course'").count * 5
@@ -27,10 +25,20 @@ class UpdateContributorForCourse < ActiveRecord::Migration
# journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
# journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count
- if total !=0
- CourseContributorScore.create(:course_id => course.id, :user_id => s.student_id, :message_num => board_count, :message_reply_num => message_reply_count,
+ course_contributor = CourseContributorScore.where("course_id =? and user_id =?", course.id, s.user_id).first
+ if course_contributor.nil?
+ CourseContributorScore.create(:course_id => course.id, :user_id => s.user_id, :message_num => board_count, :message_reply_num => message_reply_count,
:news_reply_num => common_reply_count, :news_num => common_count, :resource_num => attachment_count, :journal_num => journal_count,
:homework_journal_num => journal_homework_count, :journal_reply_num => 0, :total_score => total)
+ else
+ course_contributor.message_num = board_count
+ course_contributor.message_reply_num = message_reply_count
+ course_contributor.news_reply_num = common_reply_count
+ course_contributor.news_num = common_count
+ course_contributor.resource_num = attachment_count
+ course_contributor.journal_num = journal_count
+ course_contributor.homework_journal_num = journal_homework_count
+ course_contributor.save
end
end
diff --git a/db/schema.rb b/db/schema.rb
index b7066c999..c21580c90 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -99,6 +99,8 @@ ActiveRecord::Schema.define(:version => 20160304154643) do
t.integer "quotes"
t.integer "version"
t.integer "attachment_id"
+ t.integer "is_publish", :default => 1
+ t.date "publish_time"
end
create_table "attachments", :force => true do |t|
@@ -1278,7 +1280,6 @@ ActiveRecord::Schema.define(:version => 20160304154643) do
t.text "description"
t.integer "creator_id"
t.integer "home_id"
- t.string "domain"
t.boolean "is_public"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
@@ -1386,7 +1387,6 @@ ActiveRecord::Schema.define(:version => 20160304154643) do
t.integer "changeset_num", :default => 0
t.integer "board_message_num", :default => 0
t.integer "board_num", :default => 0
- t.integer "act_num", :default => 0
t.integer "attach_num", :default => 0
t.datetime "commit_time"
end
From 094af07a2ff1bfa269fb3cc37e6d112f807c69b4 Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 5 Mar 2016 04:22:01 +0800
Subject: [PATCH 16/25] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...ourse.rb => 20160304200639_update_contributor.rb} | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
rename db/migrate/{20160304154643_update_contributor_for_course.rb => 20160304200639_update_contributor.rb} (83%)
diff --git a/db/migrate/20160304154643_update_contributor_for_course.rb b/db/migrate/20160304200639_update_contributor.rb
similarity index 83%
rename from db/migrate/20160304154643_update_contributor_for_course.rb
rename to db/migrate/20160304200639_update_contributor.rb
index 47107dd55..d90699b91 100644
--- a/db/migrate/20160304154643_update_contributor_for_course.rb
+++ b/db/migrate/20160304200639_update_contributor.rb
@@ -1,4 +1,4 @@
-class UpdateContributorForCourse < ActiveRecord::Migration
+class UpdateContributor < ActiveRecord::Migration
def up
Course.all.each do |course|
if course.course_activities.count > 1
@@ -8,16 +8,16 @@ class UpdateContributorForCourse < ActiveRecord::Migration
puts s.user_id
# board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2
# 发帖数
- board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is null;").count * 2
+ board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is null;").count
# 回帖数
message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is not null").count * 1
# 新闻回复
common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.user_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
# 通知
- common_count = New.find_by_sql("select n.* from news n where n.author_id = #{s.user_id} and n.course_id = #{course.id} ").count * 1
+ common_count = News.find_by_sql("select n.* from news n where n.author_id = #{s.user_id} and n.course_id = #{course.id} ").count * 1
# attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5
# 附件数
- attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.user_id} and container_type ='Course'").count * 5
+ attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.user_id} and container_type ='Course'").count
# 课程留言数
journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "Course").count * 1
# 作业留言
@@ -28,8 +28,8 @@ class UpdateContributorForCourse < ActiveRecord::Migration
course_contributor = CourseContributorScore.where("course_id =? and user_id =?", course.id, s.user_id).first
if course_contributor.nil?
CourseContributorScore.create(:course_id => course.id, :user_id => s.user_id, :message_num => board_count, :message_reply_num => message_reply_count,
- :news_reply_num => common_reply_count, :news_num => common_count, :resource_num => attachment_count, :journal_num => journal_count,
- :homework_journal_num => journal_homework_count, :journal_reply_num => 0, :total_score => total)
+ :news_reply_num => common_reply_count, :news_num => common_count, :resource_num => attachment_count, :journal_num => journal_count,
+ :homework_journal_num => journal_homework_count, :journal_reply_num => 0, :total_score => total)
else
course_contributor.message_num = board_count
course_contributor.message_reply_num = message_reply_count
From a079a61c8274a5b59ea0895ad00f0d4a08e75d36 Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 5 Mar 2016 04:29:10 +0800
Subject: [PATCH 17/25] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/base_courses.html.erb | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index ceb526f44..6ca56e8b2 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -156,15 +156,16 @@
<% contributor_course_scor(@course.id).each do |contributor_score| %>
- <% unless contributor_score.total_score ==0 %>
+ <% total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 +
+ contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 +
+ + contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 +
+ contributor_score.news_num.to_i * 1 %>
+ <% unless total_score ==0 %>
<%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %>
<%=link_to contributor_score.user.show_name, user_path(contributor_score.user), :title => contributor_score.user.show_name %>
- <%=total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 +
- contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 +
- + contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 +
- contributor_score.news_num.to_i * 1 %>
+ <%=total_score %>
@@ -191,7 +192,7 @@
<%# end %>
<%# unless contributor_score.news_reply_num.to_i == 0 %>
发布通知:通知数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %>
- 通知回复:通知数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %>
+ 通知回复:回复数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %>
<%# end %>
总得分:<%=total_score %>
From 0a18f365abde9c13f323579dda6c80a2252f8f4e Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 5 Mar 2016 08:00:56 +0800
Subject: [PATCH 18/25] =?UTF-8?q?=E6=96=B0=E7=9A=84=E8=BF=81=E7=A7=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...ibutor.rb => 20160304234903_uodapte_contributor_course.rb} | 4 ++--
db/schema.rb | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
rename db/migrate/{20160304200639_update_contributor.rb => 20160304234903_uodapte_contributor_course.rb} (91%)
diff --git a/db/migrate/20160304200639_update_contributor.rb b/db/migrate/20160304234903_uodapte_contributor_course.rb
similarity index 91%
rename from db/migrate/20160304200639_update_contributor.rb
rename to db/migrate/20160304234903_uodapte_contributor_course.rb
index d90699b91..e0f86550d 100644
--- a/db/migrate/20160304200639_update_contributor.rb
+++ b/db/migrate/20160304234903_uodapte_contributor_course.rb
@@ -1,4 +1,4 @@
-class UpdateContributor < ActiveRecord::Migration
+class UodapteContributorCourse < ActiveRecord::Migration
def up
Course.all.each do |course|
if course.course_activities.count > 1
@@ -21,7 +21,7 @@ class UpdateContributor < ActiveRecord::Migration
# 课程留言数
journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "Course").count * 1
# 作业留言
- journal_homework_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "HomeworkCommon").count * 1
+ journal_homework_count = JournalsForMessage.find_by_sql("SELECT jfm.* FROM `journals_for_messages` jfm, homework_commons hc where hc.id = jfm.jour_id and hc.course_id =#{course.id} and jfm.user_id =#{s.user_id} and jfm.jour_type ='HomeworkCommon';").count * 1
# journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
# journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count
diff --git a/db/schema.rb b/db/schema.rb
index c21580c90..0fc14740c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20160304154643) do
+ActiveRecord::Schema.define(:version => 20160304200639) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
From 4f2937e1a2531887c44ddcaf15528d148f2ce4aa Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 5 Mar 2016 10:38:21 +0800
Subject: [PATCH 19/25] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E6=A6=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/base_courses.html.erb | 42 +++++++++++++++----------
db/schema.rb | 2 +-
2 files changed, 26 insertions(+), 18 deletions(-)
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index 6ca56e8b2..ab47d2691 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -144,14 +144,14 @@
-
积分规则
- 资源得分:资源数 x 5
- 发帖得分:发帖数 x 2
- 回帖得分:回复数 x 1
- 通知得分:通知数 x 1
- 课程留言得分:留言数 x 1
- 作业留言得分:留言数 x 1
- 通知回复得分:回复数 x 1
+
积分规则
+ 资源发布:资源数 x 5
+ 问答发布:发帖数 x 2
+ 通知发布:通知数 x 1
+ 问答回复:回复数 x 1
+ 作业留言:留言数 x 1
+ 通知留言:留言数 x 1
+ 课程留言:留言数 x 1
总得分为以上得分之和
@@ -176,23 +176,26 @@
积分计算
<%# unless contributor_score.resource_num.to_i == 0 %>
- 课程资源:资源数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %>
+ 资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %>
<%# end %>
<%# unless contributor_score.message_num.to_i == 0 %>
- 课程讨论:发帖数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %>
+ 问答发布数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %>
+ 通知发布数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %>
<%# end %>
<%# unless contributor_score.message_reply_num.to_i == 0 %>
- 评论回复:回复数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %>
+ 问答回帖数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %>
+ 作业留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %>
+ 通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %>
<%# end %>
<%# unless contributor_score.journal_num.to_i == 0 %>
- 课程留言:留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %>
+ 课程留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %>
<%# end %>
<%# unless contributor_score.homework_journal_num.to_i == 0 %>
- 作业留言:留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %>
+
<%# end %>
<%# unless contributor_score.news_reply_num.to_i == 0 %>
- 发布通知:通知数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %>
- 通知回复:回复数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %>
+
+
<%# end %>
总得分:<%=total_score %>
@@ -206,12 +209,17 @@
<% hero_homework_scores = hero_homework_score(@course, "desc") %>
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
-
+
+
+
积分规则
+ 英雄榜的得分是每个同学作业的得分总和
+
<% hero_homework_scores.each do |student_score| %>
<% if student_score.score.to_i != 0 %>
<%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %>
<%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %>
- <%= student_score.score<0 ? 0 : student_score.score.to_i %>
+ <%= student_score.score<0 ? 0 : student_score.score.to_i %>
<% end %>
<% end %>
diff --git a/db/schema.rb b/db/schema.rb
index 0fc14740c..a7ffc23b1 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20160304200639) do
+ActiveRecord::Schema.define(:version => 20160304234903) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
From d30e73795d5199995e36e722304e9d72ae836d6d Mon Sep 17 00:00:00 2001
From: huang
Date: Sun, 6 Mar 2016 12:15:57 +0800
Subject: [PATCH 20/25] =?UTF-8?q?=E7=A7=AF=E5=88=86=E8=A7=84=E5=88=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/courses_helper.rb | 5 +-
app/views/layouts/base_courses.html.erb | 66 ++++++++++++-------------
public/stylesheets/courses.css | 5 ++
3 files changed, 41 insertions(+), 35 deletions(-)
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 6fb9380e7..521dcf189 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -856,7 +856,10 @@ module CoursesHelper
end
def contributor_course_scor(course_id)
- ccs = CourseContributorScore.where("course_id =?", course_id).order("total_score desc") .limit(9)
+ puts "########################################################{course_id}"
+ ccs = CourseContributorScore.find_by_sql("SELECT * FROM `course_contributor_scores` where course_id = #{course_id} order by
+ (message_num*2 + message_reply_num + news_reply_num + news_num +
+ resource_num*5 + journal_num + homework_journal_num ) desc limit 9;")
end
end
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index ab47d2691..14ed8a93b 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -142,9 +142,11 @@
<% unless contributor_course_scor(@course.id).count == 0 %>