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 %> - -
+ <% end %> + <% end %> +
+ <% if is_teacher%> + <% comment_status = activity.homework_detail_manual.comment_status %> +
+ +
+ <% end%> + +
+ + + <% count=activity.journals_for_messages.count %> +
+
+
回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.user == User.current %> + + <% 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) %> + + <% if comment.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + + +
    +
    + <%= comment.notes.html_safe %>
    +
    +
    +
  • + <% 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| %> -
    - - -
  • - <% case homework.homework_type %> - <% when 1 %> - 普通 - <% when 2 %> - 编程 - <% when 3 %> - 分组 - <% end %> -
  • - -
  • <%= homework.quotes %>
  • -
  • <%=format_date homework.publish_time %>
  • -
- <% end %> + + +
+ <% homeworks.each do |homework| %> +
    + + +
  • + <% case homework.homework_type %> + <% when 1 %> + 普通 + <% when 2 %> + 编程 + <% when 3 %> + 分组 + <% end %> +
  • + +
  • <%= homework.quotes %>
  • +
  • <%=format_date homework.publish_time %>
  • +
+ <% 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| %> -
    - -
  • <%= get_resource_type(attach.container_type)%>
  • - -
  • <%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %>
  • -
  • <%= format_date(attach.created_on) %>
  • -
- <% end %> - <% end %> -
- - - - -
-
    - <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %> -
-
-
-
+ +
选用资源库中的资源
+
+ <% 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| %> +
    + +
  • <%= get_resource_type(attach.container_type)%>
  • + +
  • <%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %>
  • +
  • <%= format_date(attach.created_on) %>
  • +
+ <% end %> + <% end %> +
+ + + + +
+
    + <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %> +
+
+
+
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| %> -
    -
  • - -
  • -
  • <%= truncate(course.name,:lendght=>25) + '['+current_time_and_term(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"%> -
- - - <% 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 %> - - <% 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) %> - <% if comment.user == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> - <% end %> - - -
    -
    - <%= comment.notes.html_safe %>
    -
    -
    -
  • - <% 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 %> + + <% 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) %> + <% if comment.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + + +
    +
    + <%= comment.notes.html_safe %>
    +
    +
    +
  • + <% 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 %>个资源
-
-
- -
-
-
- <%= render :partial => 'users/resources_list' , :locals => { :attachments => @attachments} %> -
-
- - -
-
- -
- 全选 删除
-
-
-
- 发送至 -
-
选择 0 个资源
-
- -
-
- -
- -
- - - -