diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 43918ed10..36a48f2a3 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -103,11 +103,10 @@ class StudentWorkController < ApplicationController if result["status"].to_i != -2 #result["results"].first['output'] = result["results"].first['output'].gsub(" ","□") #result["results"].first['result'] = result["results"].first['result'].gsub(" ","□") + space_replace_1(result["results"].first['output']) + space_replace_1(result["results"].first['result']) end - space_replace_1(result["results"].first['output']) - space_replace_1(result["results"].first['result']) - logger.debug result #-1 默认值 0全部正确并结束 2 超时 -2 编译错误 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index efe968d3b..2d1402ed5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1820,9 +1820,38 @@ class UsersController < ApplicationController else @flag = false end + @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" + @score = @b_sort == "desc" ? "asc" : "desc" + user_project_ids = User.current.projects.map {|p| p.id} 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(',')}))").order("created_on desc") + if(params[:type].blank? || params[:type] == "1") # 我的资源 + # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 + if params[:status] == "2" + @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources(params[:id], @order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources(params[:id], @order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + end + elsif params[:type] == "6" # 公共资源 + if params[:status] == "2" + @attachments = get_course_resources_public( user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources_public(user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources_public(@order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources_public(@order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) + end + end @type = params[:type] @limit = 25 @path = user_resource_user_path(User.current, :type => @type) @@ -1932,9 +1961,39 @@ class UsersController < ApplicationController else @flag=true end + @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" + @score = @b_sort == "desc" ? "asc" : "desc" + user_project_ids = User.current.projects.map {|p| p.id} 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(',')}))").order("created_on desc") + if(params[:type].blank? || params[:type] == "1") # 我的资源 + # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 + if params[:status] == "2" + @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources(params[:id], @order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources(params[:id], @order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + end + elsif params[:type] == "6" # 公共资源 + if params[:status] == "2" + @attachments = get_course_resources_public( user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources_public(user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources_public(@order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources_public(@order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) + end + end + @status = params[:status] @type = params[:type] @limit = 25 @path = user_resource_user_path(User.current, :type => @type) @@ -2031,9 +2090,38 @@ class UsersController < ApplicationController else @flag=true end + @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" + @score = @b_sort == "desc" ? "asc" : "desc" + user_project_ids = User.current.projects.map {|p| p.id} 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(',')}))").order("created_on desc") + if(params[:type].blank? || params[:type] == "1") # 我的资源 + # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 + if params[:status] == "2" + @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources(params[:id], @order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources(params[:id], @order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + end + elsif params[:type] == "6" # 公共资源 + if params[:status] == "2" + @attachments = get_course_resources_public( user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources_public(user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources_public(@order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources_public(@order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) + end + end @type = params[:type] @limit = 25 @path = user_resource_user_path(User.current, :type => @type) diff --git a/app/views/users/_course_file_form.html.erb b/app/views/users/_course_file_form.html.erb index a1317c1f8..1c10cdbeb 100644 --- a/app/views/users/_course_file_form.html.erb +++ b/app/views/users/_course_file_form.html.erb @@ -1,4 +1,5 @@ -<%= form_tag add_exist_file_to_course_user_path(user, :type => defined? type ? "6" : type ),:remote=>true,:id=>'course_list_form' do %> + +<%= form_tag add_exist_file_to_course_user_path(user, :type => defined?(type) ? type : "6" ),:remote=>true,:id=>'course_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %> <%= hidden_field_tag(:send_ids, send_ids) %> @@ -15,6 +16,7 @@ <% end %>
+
diff --git a/app/views/users/_course_message_form.html.erb b/app/views/users/_course_message_form.html.erb index 94e0f65ec..1ef69ea8f 100644 --- a/app/views/users/_course_message_form.html.erb +++ b/app/views/users/_course_message_form.html.erb @@ -15,6 +15,7 @@ <% end %>
+
diff --git a/app/views/users/_course_news_form.html.erb b/app/views/users/_course_news_form.html.erb index a244b8678..736802244 100644 --- a/app/views/users/_course_news_form.html.erb +++ b/app/views/users/_course_news_form.html.erb @@ -15,6 +15,7 @@ <% end %>
+
diff --git a/app/views/users/_org_file_form.html.erb b/app/views/users/_org_file_form.html.erb index a69e71384..348a68c00 100644 --- a/app/views/users/_org_file_form.html.erb +++ b/app/views/users/_org_file_form.html.erb @@ -1,4 +1,4 @@ -<%= form_tag add_exist_file_to_org_user_path(user, :type => defined? type ? "6" : type),:remote=>true,:id=>'orgs_list_form' do %> +<%= form_tag add_exist_file_to_org_user_path(user, :type => defined?(type) ? type : "6" ),:remote=>true,:id=>'orgs_list_form' do %> <%= hidden_field_tag(:send_id, send_id) %> <%= hidden_field_tag(:send_ids, send_ids) %>
diff --git a/app/views/users/_project_file_form.html.erb b/app/views/users/_project_file_form.html.erb index 134d837a6..74e8fecc2 100644 --- a/app/views/users/_project_file_form.html.erb +++ b/app/views/users/_project_file_form.html.erb @@ -1,4 +1,4 @@ -<%= form_tag add_exist_file_to_project_user_path(user, :type => defined? type ? "6" : type), :remote => true, :id => 'projects_list_form' %> +<%= form_tag add_exist_file_to_project_user_path(user, :type => defined?(type) ? type : "6" ), :remote => true, :id => 'projects_list_form' %>
<%= hidden_field_tag(:send_id, send_id) %> <%= hidden_field_tag(:send_ids, send_ids) %> @@ -15,6 +15,7 @@ <% end %>
+
diff --git a/app/views/users/_project_message_form.html.erb b/app/views/users/_project_message_form.html.erb index 1084142f9..635a4964e 100644 --- a/app/views/users/_project_message_form.html.erb +++ b/app/views/users/_project_message_form.html.erb @@ -1,25 +1,27 @@ -<%= form_tag share_message_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %> +<%= form_tag share_message_to_project_user_path(user), :remote => true, :id => 'projects_list_form' %>
<%= hidden_field_tag(:send_id, send_id) %> <%= hidden_field_tag(:send_ids, send_ids) %>
- <% if !projects.empty? %> + <% if !projects.empty? %> <% projects.each do |project| %>
  • -
  • <%= project.name%>
  • +
  • <%= project.name %>
<% end %> -
-
-
-
- - <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> -
- -
-
- <% end %> \ No newline at end of file + <% end %> +
+
+
+
+
+ + <%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %> +
+ +
+
\ No newline at end of file diff --git a/app/views/users/_project_news_form.html.erb b/app/views/users/_project_news_form.html.erb index 2293f942a..38e65bdfc 100644 --- a/app/views/users/_project_news_form.html.erb +++ b/app/views/users/_project_news_form.html.erb @@ -15,6 +15,7 @@ <% end %>
+
diff --git a/app/views/users/_send_homework_to_course.html.erb b/app/views/users/_send_homework_to_course.html.erb index b19fbd1a8..67fd36c3c 100644 --- a/app/views/users/_send_homework_to_course.html.erb +++ b/app/views/users/_send_homework_to_course.html.erb @@ -1,4 +1,4 @@ -
+
发送到
@@ -8,33 +8,9 @@
- <%= 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 %> -
+
+ <%= render :partial => "users/send_homework_to_course_form", :locals => {:user => user, :courses => courses, :send_id => send_id} %>
-
- -
-
- 确定 -
-
- 取消 -
-
-
- <% end %>