diff --git a/Gemfile b/Gemfile index c739e1085..2b12860f0 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem 'daemons' gem 'grape', '~> 0.9.0' gem 'grape-entity' gem 'seems_rateable', '~> 1.0.13' -gem "rails", "3.2.13" +gem "rails", "~> 3.2.13" gem "jquery-rails", "~> 2.0.2" gem "i18n", "~> 0.6.0" gem 'coderay', '~> 1.1.0' diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index f8ca1d0e2..c7aa42b9e 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -24,7 +24,7 @@ class AdminController < ApplicationController before_filter :require_admin helper :sort helper :Users - helper :Settings + helper :Settings,SchoolHelper include SortHelper def index @@ -65,7 +65,17 @@ class AdminController < ApplicationController #管理员界面课程资源列表 def course_resource_list - @resource = Attachment.where(:container_type => 'Course') + + if params[:sort] == 'file_size' + @resource = Attachment.where(:container_type => 'Course').order("filesize desc") + elsif params[:sort] == 'file_upload' + @resource = Attachment.where(:container_type => 'Course').order("created_on desc") + elsif params[:sort] == 'file_download_times' + @resource = Attachment.where(:container_type => 'Course').order("downloads desc") + else + @resource = Attachment.where(:container_type => 'Course').order("created_on desc") + end + @resource = paginateHelper @resource,30 @page = (params['page'] || 1).to_i - 1 @@ -76,7 +86,17 @@ class AdminController < ApplicationController #管理员界面項目资源列表 def project_resource_list - @pro_resource = Attachment.where(:container_type => 'Project') + + if params[:sort] == 'file_size' + @pro_resource = Attachment.where(:container_type => 'Project').order("filesize desc") + elsif params[:sort] == 'file_upload' + @pro_resource = Attachment.where(:container_type => 'Project').order("created_on desc") + elsif params[:sort] == 'file_download_times' + @pro_resource = Attachment.where(:container_type => 'Project').order("downloads desc") + else + @pro_resource = Attachment.where(:container_type => 'Project').order("created_on desc") + end + @pro_resource = paginateHelper @pro_resource,30 @page = (params['page'] || 1).to_i - 1 @@ -92,9 +112,9 @@ class AdminController < ApplicationController case params[:format] when 'xml', 'json' - @offset, @limit = api_offset_and_limit({:limit => 15}) + @offset, @limit = api_offset_and_limit({:limit => 50}) else - @limit = 15#per_page_option + @limit = 50 #per_page_option end @status = params[:status] || 1 @@ -374,7 +394,13 @@ class AdminController < ApplicationController #组织 def organization - @organizations = Organization.all + @organizations = Organization.find_by_sql("SELECT * FROM organizations ORDER BY created_at DESC") + #@organizations = Organization.all.order("created_at desc") + @organization_count = @organizations.count + @organization_pages = Paginator.new @organization_count, 30, params['page'] || 1 + @organizations = paginateHelper @organizations,30 + + @page = (params['page'] || 1).to_i - 1 respond_to do |format| format.html end @@ -382,17 +408,14 @@ class AdminController < ApplicationController #学校列表 def schools - @school_name = params[:school_name] - if @school_name && @school_name != '' - @schools = School.where("name like '%#{@school_name}%'") - elsif @school_name.nil? - @schools = [] - else @school_name && @school_name == ' ' - @schools = School.where('1=1') - end + + @schools = School.find_by_sql("SELECT * FROM schools ORDER BY created_at DESC") @school_count = @schools.count - @school_pages = Paginator.new @school_count, 100, params['page'] || 1 - @schools = paginateHelper @schools,100 + + @school_pages = Paginator.new @school_count, 30, params['page'] || 1 + @schools = paginateHelper @schools,30 + + @page = (params['page'] || 1).to_i - 1 respond_to do |format| format.html end diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index 456306c64..fe16385f4 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -8,6 +8,15 @@ class AtController < ApplicationController users = find_at_users(params[:type], params[:id]) @users = users @users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users + + #加上all + if @users.size > 0 + allUser = Struct.new(:id, :name).new + allUser.id = @users.map{|u| u.id}.join(",") + allUser.name = "all" + @users.insert(0, allUser) + end + @users end private diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 38f1ad152..d05867427 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -573,7 +573,7 @@ class UsersController < ApplicationController @r_sort = @b_sort == "desc" ? "asc" : "desc" @user = User.current search = params[:name].to_s.strip.downcase - type_ids = params[:property]=="" ? "(1, 2, 3)" : "(" + params[:property] + ")" + type_ids = params[:property]=="" || params[:property].nil? ? "(1, 2, 3)" : "(" + params[:property] + ")" if(params[:type].blank? || params[:type] == "1") #全部 visible_course = Course.where("is_public = 1 && is_delete = 0") visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" diff --git a/app/helpers/school_helper.rb b/app/helpers/school_helper.rb index 0528cb7ac..075d2b039 100644 --- a/app/helpers/school_helper.rb +++ b/app/helpers/school_helper.rb @@ -1,2 +1,15 @@ module SchoolHelper + def schoolMember_num school + count = student_num(school) + teacher_num(school) + count.to_s + end + + def student_num school + UserExtensions.find_by_sql("SELECT * FROM user_extensions WHERE occupation = '#{school.name}' AND identity = '1'").count + end + + def teacher_num school + UserExtensions.find_by_sql("SELECT * FROM user_extensions AS ue, schools AS s WHERE ue.school_id = s.id AND s.name = '#{school.name}' AND ue.identity = '0'").count + end + end diff --git a/app/models/issue.rb b/app/models/issue.rb index c82f6f0be..0d72407ba 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -84,7 +84,9 @@ class Issue < ActiveRecord::Base attr_reader :current_journal # fq - after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message, :add_issues_count + after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message, + act_as_at_message(:description, :author_id), :add_issues_count + after_update :be_user_score,:update_activity after_destroy :down_user_score, :decrease_issues_count # after_create :be_user_score @@ -165,12 +167,12 @@ class Issue < ActiveRecord::Base end # at 功能添加消息提醒 - def act_as_at_message - users = self.description.scan //m - users && users.flatten.uniq.each do |uid| - self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id) - end - end + # def act_as_at_message + # users = self.description.scan //m + # users && users.flatten.uniq.each do |uid| + # self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id) + # end + # end # 创建issue的时候,issues_count加1 def add_issues_count diff --git a/app/models/journal.rb b/app/models/journal.rb index c37b8d2c5..fd67e8a62 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -51,7 +51,7 @@ class Journal < ActiveRecord::Base before_create :split_private_notes, :add_journals_count # fq - after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message + after_save :act_as_activity,:be_user_score, :act_as_forge_message, act_as_at_message(:notes, :user_id) after_create :update_issue_time # end #after_destroy :down_user_score @@ -186,13 +186,6 @@ class Journal < ActiveRecord::Base end end - def act_as_at_message - users = self.notes.scan //m - users && users.flatten.uniq.each do |uid| - self.at_messages << AtMessage.new(user_id: uid, sender_id: self.user_id) - end - end - # 更新用户分数 -by zjc def be_user_score #新建了缺陷留言且留言不为空,不为空白 diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index dae779b65..fa5beb813 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -68,7 +68,9 @@ class JournalsForMessage < ActiveRecord::Base has_many :at_messages, as: :at_message, dependent: :destroy validates :notes, presence: true, if: :is_homework_jour? - after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score + after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, + act_as_at_message(:notes, :user_id), :act_as_user_feedback_message, + :act_as_principal_activity, :act_as_student_score after_create :reset_counters! #after_update :update_activity after_destroy :reset_counters! @@ -253,12 +255,7 @@ class JournalsForMessage < ActiveRecord::Base end end - def act_as_at_message - users = self.notes.scan //m - users && users.flatten.uniq.each do |uid| - self.at_messages << AtMessage.new(user_id: uid, sender_id: self.user_id) - end - end + # 用户留言消息通知 def act_as_user_feedback_message # 主留言 diff --git a/app/models/message.rb b/app/models/message.rb index 0ddc6f8e0..d697db236 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -81,7 +81,8 @@ class Message < ActiveRecord::Base after_update :update_messages_board, :update_activity after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count, :down_course_score - after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message + after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, + :act_as_system_message, :send_mail, :act_as_student_score, act_as_at_message(:content, :author_id) #before_save :be_user_score scope :visible, lambda {|*args| @@ -287,13 +288,6 @@ class Message < ActiveRecord::Base end end - def act_as_at_message - users = self.content.scan //m - users && users.flatten.uniq.each do |uid| - self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id) - end - end - #更新用户分数 -by zjc def be_user_score #新建message且无parent的为发帖 diff --git a/app/views/admin/course_resource_list.html.erb b/app/views/admin/course_resource_list.html.erb index 4316555f7..2e83a96aa 100644 --- a/app/views/admin/course_resource_list.html.erb +++ b/app/views/admin/course_resource_list.html.erb @@ -10,16 +10,16 @@ 资源名称 - 资源大小 + <%= link_to "资源大小",admin_course_resource_list_path(:sort => "file_size") %> 资源类型 - 上传时间 + <%= link_to "上传时间",admin_course_resource_list_path(:sort => "file_upload") %> - 下载次数 + <%= link_to "下载次数",admin_course_resource_list_path(:sort => "file_download_times") %> 上传者 @@ -61,4 +61,6 @@ \ No newline at end of file + + +<% html_title(l(:label_course_resource_list)) -%> \ No newline at end of file diff --git a/app/views/admin/excellent_courses.html.erb b/app/views/admin/excellent_courses.html.erb index e21ba32aa..59426455a 100644 --- a/app/views/admin/excellent_courses.html.erb +++ b/app/views/admin/excellent_courses.html.erb @@ -72,4 +72,6 @@ <% end %> - \ No newline at end of file + + +<% html_title(l(:label_excellent_courses_list)) -%> \ 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 05f20ba8d..c1889bce1 100644 --- a/app/views/admin/latest_login_teachers.html.erb +++ b/app/views/admin/latest_login_teachers.html.erb @@ -45,6 +45,9 @@ 用户身份 + + 用户单位 + @@ -59,7 +62,7 @@ <%=format_time(teacher.last_login_on) %> - <%=teacher.user_id %> + <%= teacher.user_id %> <%= teacher.login%><% else %><%=teacher.try(:realname) %><% end %>'> <% if teacher.try(:realname) == ' '%> @@ -69,11 +72,14 @@ <% end %> - <%=link_to(teacher.login, user_path(teacher.user_id)) %> + <%= link_to(teacher.login, user_path(teacher.user_id)) %> 老师 + + <%= teacher.school_id.nil? ? "" : (School.find teacher.school_id).try(:name) %> + <% end %> @@ -82,3 +88,5 @@ + +<% html_title(l(:label_latest_login_teacher_list)) -%> \ No newline at end of file diff --git a/app/views/admin/latest_login_users.html.erb b/app/views/admin/latest_login_users.html.erb index 17680a8c8..a9e8e2feb 100644 --- a/app/views/admin/latest_login_users.html.erb +++ b/app/views/admin/latest_login_users.html.erb @@ -46,6 +46,9 @@ 用户身份 + + 用户单位 + @@ -88,6 +91,17 @@ <% end %> <% end%> + + <% unless user.user_extensions.nil? %> + <% if user.user_extensions.identity.to_i == 0 %> + + <% occupation = user.user_extensions.school_id.nil? ? "" : (School.where("id =?", user.user_extensions.school_id)).first.try(:name) %> + <%= occupation.blank? ? user.user_extensions.occupation : occupation %> + <% else %> + <%= user.user_extensions.occupation %> + <% end %> + <% end %> + <% end %> diff --git a/app/views/admin/organization.html.erb b/app/views/admin/organization.html.erb index 582b8b44a..02b897f80 100644 --- a/app/views/admin/organization.html.erb +++ b/app/views/admin/organization.html.erb @@ -40,4 +40,8 @@ -<% html_title(l(:label_project_plural)) -%> +
    + <%= pagination_links_full @organization_pages, @organization_count ,:per_page_links => true, :remote => false, :flag => true %> +
+ + diff --git a/app/views/admin/project_resource_list.html.erb b/app/views/admin/project_resource_list.html.erb index c245f73b8..8e8bd8c92 100644 --- a/app/views/admin/project_resource_list.html.erb +++ b/app/views/admin/project_resource_list.html.erb @@ -10,16 +10,16 @@ 资源名称 - 资源大小 + <%= link_to "资源大小",admin_project_resource_list_path(:sort => "file_size") %> 资源类型 - 上传时间 + <%= link_to "上传时间",admin_project_resource_list_path(:sort => "file_upload") %> - 下载次数 + <%= link_to "下载次数",admin_project_resource_list_path(:sort => "file_download_times") %> 上传者 @@ -61,4 +61,6 @@ \ No newline at end of file + + +<% html_title(l(:label_project_resource_list)) -%> \ No newline at end of file diff --git a/app/views/admin/schools.html.erb b/app/views/admin/schools.html.erb index d19e9b3b9..f52d1f060 100644 --- a/app/views/admin/schools.html.erb +++ b/app/views/admin/schools.html.erb @@ -1,43 +1,64 @@

<%=l(:label_school_plural)%>

-<%= form_tag({:controller => 'admin', :action => 'schools' }, :method => :get,:id=>"search_course_form") do %> - <%= submit_tag "搜索",:style => "float: right;margin-right: 15px;"%> - -<% end %> + + + +
- - - - + + + - <% @schools.each do |school|%> + <% @count=@page * 30 %> + <% @schools.each do |school| %> "> - + + - + + @@ -50,4 +71,4 @@ <%= pagination_links_full @school_pages, @school_count ,:per_page_links => true, :remote => false, :flag => true %> -<% html_title(l(:label_project_plural)) -%> +<% html_title(l(:label_school_plural)) -%> diff --git a/app/views/admin/users.html.erb b/app/views/admin/users.html.erb index 12aa95a16..2a757fdee 100644 --- a/app/views/admin/users.html.erb +++ b/app/views/admin/users.html.erb @@ -40,7 +40,10 @@ <%= sort_header_tag('admin', :caption => l(:field_admin), :default_order => 'desc') %> <%= sort_header_tag('created_on', :caption => l(:field_created_on), :default_order => 'desc') %> <%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on), :default_order => 'desc') %> - + <%#= sort_header_tag('user_occupation', :caption => l(:field_occupation), :default_order => 'desc') %> + + + @@ -53,8 +56,11 @@ - + <% occupation = user.user_extensions.identity == 0 ? School.where("id=?",user.user_extensions.school_id).first.try(:name) : user.user_extensions.occupation %> + + + + <% end -%> diff --git a/app/views/at/show.json.erb b/app/views/at/show.json.erb index 5341f251e..6e2a244e4 100644 --- a/app/views/at/show.json.erb +++ b/app/views/at/show.json.erb @@ -1,6 +1,11 @@ [ <% @users && @users.each_with_index do |person,index| %> + <% if index == 0 %> + {"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "<%=person.name%>", "searchKey": "<%=person.name%>"} + <%= index != @users.size-1 ? ',' : '' %> + <% else %> {"id":<%=index%>, "userid": <%=person.id%>, "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"} <%= index != @users.size-1 ? ',' : '' %> <% end %> + <% end %> ] diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb index d92eb3cf4..a0c659493 100644 --- a/app/views/courses/_recommendation.html.erb +++ b/app/views/courses/_recommendation.html.erb @@ -8,8 +8,8 @@

<%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %>

- <% if visable_attachemnts(e_course.attachments).count > 0 %> - <%= l(:project_module_attachments) %>(<%= link_to visable_attachemnts(e_course.attachments).count, course_files_path(e_course), :class => "linkBlue2" %>) + <% if visable_attachemnts_incourse(e_course).count > 0 %> + <%= l(:project_module_attachments) %>(<%= link_to visable_attachemnts_incourse(e_course).count, course_files_path(e_course), :class => "linkBlue2" %>) <% end %> <% if e_course.homework_commons.where("publish_time <= '#{Date.today}'").count > 0 %> <%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.where("publish_time <= '#{Date.today}'").count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>) diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index cf771a700..67bb4d59d 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -9,7 +9,8 @@ $(function(){ $("#RSide").removeAttr("id"); $("#Container").css("width","1000px"); - if(true == <%= @is_edit %>) { + is_edit = <%= @is_edit.present? && @is_edit == true %> + if(is_edit) { issueEditShow(); } }); diff --git a/app/views/users/_homework_repository_list.html.erb b/app/views/users/_homework_repository_list.html.erb index 99e6d4e27..678bf65d7 100644 --- a/app/views/users/_homework_repository_list.html.erb +++ b/app/views/users/_homework_repository_list.html.erb @@ -25,9 +25,9 @@ <% end%>

  • - <%= link_to "发布时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "fl",:remote => true%> - <% if @order == "created_at"%> - <%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%> + <%= link_to "发布时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort),:class => "fl",:remote => true%> + <% if @order == "publish_time"%> + <%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%> <% end%>
  • diff --git a/config/initializers/30-redmine.rb b/config/initializers/30-redmine.rb index 5a5f7c55a..28167c014 100644 --- a/config/initializers/30-redmine.rb +++ b/config/initializers/30-redmine.rb @@ -1,8 +1,8 @@ I18n.default_locale = 'en' I18n.backend = Redmine::I18n::Backend.new -require 'redmine' require 'trustie' +require 'redmine' # Load the secret token from the Redmine configuration file secret = Redmine::Configuration['secret_token'] diff --git a/config/locales/en.yml b/config/locales/en.yml index 3da533eb7..033f12ad2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1523,6 +1523,9 @@ en: label_excellent_courses_list: excellent_courses label_course_resource_list: course_resource_list label_project_resource_list: project_resource_list + label_organization_list: organzation_list + label_latest_login_teacher_list: latest_login_teacher_list + label_latest_login_user_list: latest_login_teacher_list #api label_recently_updated_notification: Recently updated notification @@ -1535,3 +1538,12 @@ en: error_upload_avatar_to_large: "too big (%{max_size})" not_valid_image_file: not a valid image file + #resource + label_resource_name: Resource_name + label_resource_type: Rescource_type + label_resource_size: Rescource_size + label_resource_upload_date: Resource_upload_date + label_resource_download_times: Resource_download_times + label_resource_upload_author: Resource_upload_author + label_resource_belongs_course: Resource_belongs_course + label_resource_belongs_project: Resource_belongs_project diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 37d26dbd8..d36117556 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -563,6 +563,7 @@ zh: label_overall_activity: 活动概览 label_new: 新建 label_latest_login_user_list: 最近登录用户列表 + label_latest_login_teacher_list: 最近登录教师列表 label_logged_as: 登录为 label_environment: 环境 @@ -2111,4 +2112,14 @@ zh: # 课程推荐 label_homework_commont: 作业 - label_homework_recommendation: 课程推荐 \ No newline at end of file + label_homework_recommendation: 课程推荐 + + #资源 + label_resource_name: 资源名称 + label_resource_type: 资源类型 + label_resource_size: 资源大小 + label_resource_upload_date: 上传时间 + label_resource_download_times: 下载次数 + label_resource_upload_author: 上传者 + label_resource_belongs_course: 所属课程 + label_resource_belongs_project: 所属项目 \ No newline at end of file diff --git a/lib/trustie.rb b/lib/trustie.rb index 2010e2d43..b7bd97de9 100644 --- a/lib/trustie.rb +++ b/lib/trustie.rb @@ -2,3 +2,4 @@ require 'trustie/utils' require 'trustie/utils/image' require 'trustie/gitlab/api' require 'trustie/grack/grack' +require 'trustie/at/at' diff --git a/lib/trustie/at/at.rb b/lib/trustie/at/at.rb new file mode 100644 index 000000000..e010d4a4d --- /dev/null +++ b/lib/trustie/at/at.rb @@ -0,0 +1,23 @@ +#coding=utf-8 + +module Trustie + module At + extend ActiveSupport::Concern + + module ClassMethods + def act_as_at_message(content, send_id) + self.send :define_method, :act_as_at_message_func do + users = self[content].scan //m + users && users.flatten.uniq.each do |uids| + uids.split(",").each do |uid| + self.at_messages << AtMessage.new(user_id: uid, sender_id: self[send_id]) + end + end + end + end + + end + end +end + +ActiveRecord::Base.send(:include, Trustie::At) \ No newline at end of file diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index 7dd416dec..b478e2d9b 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -32,30 +32,34 @@ $(function(){ return; } - $.post( - '/student_work/program_test', - {homework: homework_id, student_work_id: student_work_id, src: src, title: title, is_test: is_test}, - function(data,status){ - tested = true; - console.log(data); - if(data.index <=0){ - data.index = $('.ProResultTop').length+1; - } + $.ajax({ + url: '/student_work/program_test', + type: 'POST', + timeout: 60*1000, + data: {homework: homework_id, student_work_id: student_work_id, src: src, title: title, is_test: is_test} + }).done(function(data){ + tested = true; + console.log(data); + if(data.index <=0){ + data.index = $('.ProResultTop').length+1; + } + if (typeof cb == 'function') {cb(data); return;} + var html=bt('t:result-list',data); + $('.ProResult').prepend(html); - if (typeof cb == 'function') {cb(data); return;} - - - var html=bt('t:result-list',data); - $('.ProResult').prepend(html); - - if (data.status==0 && is_test != 'true') { - var r=confirm("答题正确,是否立刻提交?"); - if (r) { - $(".HomeWorkCon form").submit(); - } + if (data.status==0 && is_test != 'true') { + var r=confirm("答题正确,是否立刻提交?"); + if (r) { + $(".HomeWorkCon form").submit(); } } - ); + }).fail(function(xhr, status){ + if(status == 'timeout'){ + alert("您的答案超时了, 请检查代码是否存在死循环的错误."); + } else { + alert("测试失败,服务器出错.") + } + }); }; $('#test-program-btn').on('click', test_program); diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 4275c4335..94e3fa85a 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1476,7 +1476,7 @@ a.choose-active {background-color:#269ac9; color:#ffffff;} .subject-list-search {border:1px solid #dddddd; height:32px; width:250px;} .subject-list-info {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;} .subject-list-wrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;} -.subject-content-wrapper {border:1px solid #dddddd; border-top:none; padding:10px; width:265px; height:430px; overflow-y:auto;} +.subject-content-wrapper {border:1px solid #dddddd; border-top:none; padding:10px; width:265px; height:985px; overflow-y:auto;} .subject-list-type {width:50px; text-align:center;} .subject-list-count {width:60px; text-align:center;} .subject-list-from {width:145px; text-align:center;} @@ -1486,4 +1486,4 @@ a.choose-active {background-color:#269ac9; color:#ffffff;} a.st_up{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 0 no-repeat; margin-top:5px; margin-left:3px;} a.st_down{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 -22px no-repeat; margin-top:5px; margin-left:3px;} a.st_img { display:block;width:32px; height:32px; border:1px solid #CCC; padding:1px;} -a:hover.st_img { border:1px solid #1c9ec7; } +a:hover.st_img { border:1px solid #1c9ec7; }
    + 序号 + LOGO + 学校名称 + 用户数 + + 创建时间 + + 编辑高校信息 +
    - <%= school.id %> + + + <% @count +=1 %> + + <%=@count %> <%= image_tag(school.logo_link,width:40,height:40) %> + - <%= link_to school.name,"http://#{Setting.host_course}/?school_id=#{school.id}" %> + <%= link_to school.name,"http://#{Setting.host_name}/?school_id=#{school.id}" %> + + <%= schoolMember_num(school) %> + + <%= format_time(school.created_at) %> + <%= link_to("修改", upload_logo_school_path(school.id,:school_name => @school_name), :class => 'icon icon-copy') %> <%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> 用户单位
    <%= checked_image user.admin? %> <%= format_time(user.created_on) %> <%= change_status_link(user) %> - <%= delete_link user_path(user, :back_url => admin_users_path(params)) unless User.current == user %> <%= truncate( occupation, :length => 12 ) %> <%= change_status_link(user) %> <%= delete_link user_path(user, :back_url => admin_users_path(params)) unless User.current == user %>