diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index d9980e286..71715035e 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -124,47 +124,47 @@ class CoursesController < ApplicationController @course_pages = Paginator.new @course_count, per_page_option, params['page'] # 课程的动态数 - @course_activity_count=Hash.new - @courses_all.each do |course| - @course_activity_count[course.id]=0 - end - - case params[:course_sort_type] - when '0' - @courses = @courses_all.order("created_at desc") - @s_type = 0 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - when '1' - @courses = @courses_all.order("course_ac_para desc") - @s_type = 1 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - when '2' - @courses = @courses_all.order("watchers_count desc") - @s_type = 2 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - when '3' - @course_activity_count=get_course_activity @courses_all,@course_activity_count_array - @courses=handle_course @courses_all,@course_activity_count - @s_type = 3 - @courses = @courses[@course_pages.offset, @course_pages.per_page] - - else - @s_type = 0 - @courses = @courses_all.order("created_at desc") - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - end + # @course_activity_count=Hash.new + # @courses_all.each do |course| + # @course_activity_count[course.id]=0 + # end + # + # case params[:course_sort_type] + # when '0' + # @courses = @courses_all.order("created_at desc") + # @s_type = 0 + # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + # + # @course_activity_count=get_course_activity @courses,@course_activity_count + # + # when '1' + # @courses = @courses_all.order("course_ac_para desc") + # @s_type = 1 + # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + # + # @course_activity_count=get_course_activity @courses,@course_activity_count + # + # when '2' + # @courses = @courses_all.order("watchers_count desc") + # @s_type = 2 + # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + # + # @course_activity_count=get_course_activity @courses,@course_activity_count + # + # when '3' + # @course_activity_count=get_course_activity @courses_all,@course_activity_count_array + # @courses=handle_course @courses_all,@course_activity_count + # @s_type = 3 + # @courses = @courses[@course_pages.offset, @course_pages.per_page] + # + # else + # @s_type = 0 + # @courses = @courses_all.order("created_at desc") + # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + # + # @course_activity_count=get_course_activity @courses,@course_activity_count + # + # end end respond_to do |format| @@ -663,92 +663,9 @@ class CoursesController < ApplicationController end def show - if params[:jump] && redirect_to_course_menu_item(@course, params[:jump]) - return - end - @users_by_role = @course.users_by_role - if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id))) - @user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id) - end - @key = User.current.rss_key - #新增内容 - @days = Setting.activity_days_default.to_i - if params[:from] - begin; @date_to = params[:from].to_date + 1; rescue; end - end - has = { - "show_course_files" => true, - "show_course_news" => true, - "show_course_messages" => true, - #"show_course_journals_for_messages" => true, - # "show_bids" => true, - # "show_homeworks" => true, - "show_polls" => true - } - @date_to ||= Date.today + 1 - @date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date - @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) - if @author.nil? - # 显示老师和助教的活动 - # @authors = searchTeacherAndAssistant(@course) - @authors = course_all_member(@course) - events = [] - key = "course_events_#{@course.id}".to_sym - if Rails.env.production? && Setting.course_cahce_enabled? - events = Rails.cache.read(key) || [] - end - if events.empty? - @authors.each do |author| - @activity = Redmine::Activity::Fetcher.new(User.current, :course => @course, - :with_subprojects => false, - :author => author.user) - - @activity.scope_select {|t| has["show_#{t}"]} - # modify by nwb - # 添加私密性判断 - if User.current.member_of_course?(@course)|| User.current.admin? - events += @activity.events(@days, @course.created_at) - else - events += @activity.events(@days, @course.created_at, :is_public => 1) - end - end - Rails.cache.write(key, events) if Rails.env.production? && Setting.course_cahce_enabled? - end - else - # @author = @course.teacher - @activity = Redmine::Activity::Fetcher.new(User.current, :course => @course, - :with_subprojects => false, - :author => @author) - - @activity.scope_select {|t| has["show_#{t}"]} - # modify by nwb - # 添加私密性判断 - if User.current.member_of_course?(@course)|| User.current.admin? - events = @activity.events(@days, @course.created_at) - else - events = @activity.events(@days, @course.created_at, :is_public => 1) - end - end - - # 无新动态时,显示老动态 - if events.count == 0 - if User.current.member_of_course?(@course)|| User.current.admin? - events = @activity.events - else - events = @activity.events(:is_public => 1) - end - end - @sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category' - if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id))) - @user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id) - end - - sorted_events = sort_activity_events_course(events) - events = paginateHelper sorted_events,10 - @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} - # documents - - + course_activities = @course.course_activities.order("created_at desc") + @canShowRealName = User.current.member_of_course? @course + @course_activities = paginateHelper course_activities,10 respond_to do |format| format.html{render :layout => 'base_courses'} format.api diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3dfae3432..f042bba50 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -86,8 +86,14 @@ class ProjectsController < ApplicationController @project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10) else @project_pages = Project.project_entities.visible.page(params[:page] ).per(10) + @project_pages = Project.project_entities.visible.page(params[:page] ).per(10) end @projects = @project_pages.order("created_on desc") + @limit = 10#per_page_option + + @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count + @project_pages = Paginator.new @project_count, @limit, params['page'] + respond_to do |format| format.html { render :layout => 'base' diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 39a467d53..410bd44e1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -118,7 +118,7 @@ class UsersController < ApplicationController return end end - projects = @user.projects.visible.order("updated_on desc") + projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc") if(params[:status] == '1') projects = projects.where("projects.user_id = ?",@user.id) elsif(params[:status] == '2') @@ -248,7 +248,7 @@ class UsersController < ApplicationController return end end - courses = @user.courses.visible.order("created_at desc") + courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc") if(params[:status] == '1') courses = courses.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now) elsif(params[:status] == '2') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6ac3c234a..9b9bf5f76 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1812,7 +1812,7 @@ module ApplicationHelper #获取用户未过期的课程 def get_user_course user courses_doing = [] - user.courses.each do |course| + user.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| if !course_endTime_timeout?(course) courses_doing.push course end @@ -2379,17 +2379,18 @@ module ApplicationHelper notice.html_safe end - def stantard_code - "// 这是一个C语言的样例程序 -// 功能:输入两个整数,输出两者之和 -// 测试:老师可以给出以下测试集: -// 输入1和2,输出3 -// 输入3和4,输出7 -// 那么下面这段代码将得到满分 + #老师C语言的标准代码 + def c_stantard_code_teacher + "// 老师您好!这是一个C语言的样例程序 +// 程序功能:输入两个整数,输出两者之和 +// 测试集合:老师可以给出多组测试集,例如: +// 输入1和2,输出3 +// 输入3和4,输出7 +// ... ... +// 系统将根据您给出的测试集对学生代码进行自动评分 -// 注意:编程作业采用命令行传参方式 -// 程序的所有输入都通过argv传入 -// 否则您的程序将被判错 +// 特别提醒:程序采用命令行传参方式,输入通过argv传入 +// 否则您的作业标准代码将不能通过测试 #include //引用必须头文件 int main(int argc, char** argv) { @@ -2398,6 +2399,77 @@ int main(int argc, char** argv) { printf(\"%d\",a+b); //输出a+b return 0; +}".html_safe + end + + #老师C++语言的标准代码 + def c_stantard_code_teacher_ + "// 老师您好!这是一个C++语言的样例程序 +// 程序功能:输入两个整数,输出两者之和 +// 测试集合:老师可以给出多组测试集,例如: +// 输入1和2,输出3 +// 输入3和4,输出7 +// ... ... +// 系统将根据您给出的测试集对学生代码进行自动评分 + +// 特别提醒:程序采用命令行传参方式,输入通过argv传入 +// 否则您的作业标准代码将不能通过测试 + +#include //引用必须头文件 +#include +using namespace std; +int main(int argc, char** argv){ + int a = atoi(argv[1]); //将第一个输入转成整型 + int b = atoi(argv[2]); //将第二个输入转换为整型 + cout< //引用必须头文件 +int main(int argc, char** argv) { + int a = atoi(argv[1]); //将第一个输入转成整型 + int b = atoi(argv[2]); //将第二个输入转换为整型 + + printf(\"%d\",a+b); //输出a+b + return 0; +}".html_safe + end + + #学生C++语言的标准代码 + def c_stantard_code_student_ + "// 同学好!这是一个C++语言的样例程序 +// 程序功能:输入两个整数,输出两者之和 +// 测试集合:老师可以给出多组测试集,例如: +// 输入1和2,输出3 +// 输入3和4,输出7 +// ... ... +// 系统将根据您给出的测试集对学生代码进行自动评分 + +// 特别提醒:程序采用命令行传参方式,输入通过argv传入 +// 否则您的作业标准代码将不能通过测试 + +#include //引用必须头文件 +#include +using namespace std; +int main(int argc, char** argv){ + int a = atoi(argv[1]); //将第一个输入转成整型 + int b = atoi(argv[2]); //将第二个输入转换为整型 + cout< activity.course_act.id) + when "News" + title = "通知公告 " + activity.course_act.title + url = course_news_index_path(activity.course) + when "Attachment" + title = "课件 " + activity.course_act.filename + url = course_files_path(activity.course) + when "Message" + title = "课程讨论区 " + activity.course_act.subject + url = course_boards_path(activity.course,:parent_id => activity.course_act.parent_id ? activity.course_act.parent_id : activity.course_act.id, :topic_id => activity.course_act.id) + when "JournalsForMessage" + title = "留言 " + activity.course_act.notes + url = course_feedback_path(activity.course) + when "Poll" + title = "问卷 " + activity.course_act.polls_name + url = poll_index_path(:polls_type => "Course", :polls_group_id => activity.course_id) + end + end + link_to title.gsub(/<(?!img)[^>]*>/,'').html_safe, url, :class => "problem_tit c_dblue fl fb" + end + + #课程动态的描述 + def course_activity_desc activity + desc = "" + if activity.course_act + case activity.course_act_type + when "Course" + desc = "" + when "HomeworkCommon" + desc = activity.course_act.description + when "News" + desc = activity.course_act.description + when "Attachment" + desc = "" + when "Message" + desc = activity.course_act.content + when "JournalsForMessage" + desc = "" + when "Poll" + desc = activity.course_act.polls_description + end + end + desc.html_safe + end end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index f999e27d6..f7fb9b1aa 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -27,6 +27,8 @@ class Attachment < ActiveRecord::Base belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" # 被ForgeActivity虚拟关联 has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # end include UserScoreHelper @@ -71,8 +73,8 @@ class Attachment < ActiveRecord::Base cattr_accessor :thumbnails_storage_path @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") - before_save :files_to_final_location - after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score + before_save :files_to_final_location,:act_as_course_activity + after_create :office_conver, :be_user_score,:act_as_forge_activity after_update :office_conver, :be_user_score after_destroy :delete_from_disk,:down_user_score @@ -552,4 +554,10 @@ class Attachment < ActiveRecord::Base end end + #课程动态公共表记录 + def act_as_course_activity + if self.container_type == "Course" && self.course_acts.empty? + self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.container_id) + end + end end diff --git a/app/models/course.rb b/app/models/course.rb index 6d71ad967..89990dd48 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -33,6 +33,10 @@ class Course < ActiveRecord::Base has_many :student_works, :through => :homework_commons, :dependent => :destroy has_many :course_groups, :dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy + + has_many :course_activities acts_as_taggable acts_as_nested_set :order => 'name', :dependent => :destroy @@ -44,7 +48,7 @@ class Course < ActiveRecord::Base validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/ validates_length_of :description, :maximum => 10000 before_save :self_validate - after_create :create_board_sync + after_create :create_board_sync, :act_as_course_activity before_destroy :delete_all_members safe_attributes 'extra', @@ -310,6 +314,11 @@ class Course < ActiveRecord::Base end end + #课程动态公共表记录 + def act_as_course_activity + self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id) + end + #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题 #def name # read_attribute('name') || Project.find_by_identifier(self.extra).try(:name) diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb new file mode 100644 index 000000000..02b6dacf1 --- /dev/null +++ b/app/models/course_activity.rb @@ -0,0 +1,7 @@ +class CourseActivity < ActiveRecord::Base + attr_accessible :user_id, :course_act_id,:course_act_type,:course_id + # 虚拟关联 + belongs_to :course_act ,:polymorphic => true + belongs_to :course + belongs_to :user +end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 291c14563..5fe01db96 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -13,17 +13,27 @@ class HomeworkCommon < ActiveRecord::Base has_many :student_works, :dependent => :destroy has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动 + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy acts_as_attachable acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" }, :description => :description, :author => :author, :url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}} - after_create :act_as_activity, :send_mail + after_create :act_as_activity, :send_mail, :act_as_course_activity after_destroy :delete_kindeditor_assets def act_as_activity self.acts << Activity.new(:user_id => self.user_id) end + + #课程动态公共表记录 + def act_as_course_activity + if self.course + self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.course_id) + end + end + #删除对应的图片 def delete_kindeditor_assets delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index b15c9b2d1..bcae58174 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -56,9 +56,11 @@ class JournalsForMessage < ActiveRecord::Base acts_as_attachable has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy validates :notes, presence: true, if: :is_homework_jour? - after_create :act_as_activity #huang + after_create :act_as_activity, :act_as_course_activity after_create :reset_counters! after_destroy :reset_counters! after_save :be_user_score @@ -177,4 +179,11 @@ class JournalsForMessage < ActiveRecord::Base def delete_kindeditor_assets delete_kindeditor_assets_from_disk self.id,7 end + + #课程动态公共表记录 + def act_as_course_activity + if self.jour_type == 'Course' + self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.jour_id) + end + end end diff --git a/app/models/message.rb b/app/models/message.rb index 15d358789..de5cc3f9b 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -32,6 +32,8 @@ class Message < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy # 被ForgeActivity虚拟关联 has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # end has_many :ActivityNotifies,:as => :activity, :dependent => :destroy @@ -68,7 +70,7 @@ class Message < ActiveRecord::Base after_update :update_messages_board after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets - after_create :act_as_activity,:be_user_score,:act_as_forge_activity, :send_mail + after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :send_mail #before_save :be_user_score scope :visible, lambda {|*args| @@ -185,6 +187,13 @@ class Message < ActiveRecord::Base :project_id => self.board.project.id) end end + + #课程动态公共表记录 + def act_as_course_activity + if self.course + self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.board.course_id) + end + end #更新用户分数 -by zjc def be_user_score diff --git a/app/models/news.rb b/app/models/news.rb index 7d33d760e..e5c1d192a 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -28,6 +28,8 @@ class News < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy # 被ForgeActivity虚拟关联 has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # end has_many :ActivityNotifies,:as => :activity, :dependent => :destroy @@ -49,7 +51,7 @@ class News < ActiveRecord::Base :author_key => :author_id acts_as_watchable - after_create :act_as_activity,:act_as_forge_activity,:add_author_as_watcher, :send_mail + after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:add_author_as_watcher, :send_mail after_destroy :delete_kindeditor_assets @@ -121,6 +123,13 @@ class News < ActiveRecord::Base end end + #课程动态公共表记录 + def act_as_course_activity + if self.course + self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.course_id) + end + end + # Time 2015-03-31 13:50:54 # Author lizanle # Description 删除news后删除对应的资源 diff --git a/app/models/poll.rb b/app/models/poll.rb index 64e9df79a..34a381246 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -8,7 +8,9 @@ class Poll < ActiveRecord::Base has_many :users, :through => :poll_users #该文件被哪些用户提交答案过 # 添加课程的poll动态 has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy - after_create :act_as_activity + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy + after_create :act_as_activity, :act_as_course_activity acts_as_event :title => Proc.new {|o| "#{l(:label_course_poll)}: #{o.polls_name}" }, :description => :polls_description, @@ -27,4 +29,10 @@ class Poll < ActiveRecord::Base self.acts << Activity.new(:user_id => self.user_id) end + #课程动态公共表记录 + def act_as_course_activity + if self.polls_type == "Course" + self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.polls_group_id) + end + end end diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb index 0b879f905..889319d5e 100644 --- a/app/views/courses/_course.html.erb +++ b/app/views/courses/_course.html.erb @@ -61,8 +61,8 @@

- <%= content_tag('span', link_to("#{course_activity_count @course}", course_path(@course)), :class => "info") %> - <%= content_tag('span', l(:label_x_activity, :count => @course_activity_count[@course.id])) %> + <%= content_tag('span', link_to("#{@course.course_activities.count}", course_path(@course)), :class => "info") %> + <%= content_tag('span', l(:label_x_activity, :count => @course.course_activities.count)) %>

diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 654c25a42..7159c3c83 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -1,83 +1,37 @@
-<% if @controller_name=='ActivityNotifys' %> - <%= l(:label_activity)%> -

与我相关 - -

- -<% else %>

<%= l(:label_activity)%>

- <% if User.current.logged? %> - 与我相关 - - - <% end %> -<% end %>
-<% if @events_by_day != nil && @events_by_day.size >0 %> - <% @events_by_day.keys.sort.reverse.each do |day| %> - <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%> -
- - <%= image_tag(url_to_avatar(e.event_author), :width => "42", :height => "42") %> - -
- <%= link_to_user_header(e.event_author,false,:class => 'problem_name c_orange fl') if e.respond_to?(:event_author) %> - <%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %> -   - <%= l(:label_new_activity) %>: - <% - link = (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : - (e.event_type.eql?("bid") ? homework_course_path(@course) : - (e.event_type.eql?("message") || e.event_type.eql?("reply") ? - course_boards_path(@course,:topic_id => e.id,:parent_id=>(e.parent_id ? e.parent_id : e.id)) : e.event_url)) - %> - <%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link, - :class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type, - 'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link", - 'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%> - <%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%> - - <%end%> -
-

<%= e.event_description.html_safe %> -
-

- <%= l :label_activity_time %> : <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %> -

- <%= link_to_attachments_course(e) if e.class.to_s == "News" %> -
-
-
- <% end%> - <% end%> -<% elsif @controller_name=='ActivityNotifys' %> -

<%= l(:label_no_data) %>

-<% end%> -<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %> -
- - <%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %> - -
- <%= link_to_user_header(@user,false,:class => 'problem_name c_orange fl') %> - <%= link_to_user_header("(#{@user})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName %> - <%= l(:label_user_create_project) %>: - <%= link_to @course.name,course_path(@course),:class => "problem_tit c_dblue fl fb"%> -
-

-
- <%= l :label_create_time %> : <%= format_time(@course.created_at) %> -

-
-
-
+<%@course_activities.each do |activity|%> +
+ + <%= image_tag(url_to_avatar(activity.user), :width => "42", :height => "42") %> + +
+ <%= link_to_user_header(activity.user,false,:class => 'problem_name c_orange fl') %> +   + <%= activity.course_act_type == "Course" ? "创建了课程" : l(:label_new_activity) %>: + <%#= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link, + :class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type, + 'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link", + 'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%> + <%#if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%> + + <%#end%> + <%= link_to course_activity_link activity%> +
+

+ <%= course_activity_desc activity%> +
+

+ <%= l :label_activity_time %> : <%= format_time(activity.created_at) %> +

+ <%= link_to_attachments_course(activity.course_act) if activity.course_act_type.to_s == "News" %> +
+
+
<% end%> +
    <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index b60b31d8b..8c589c040 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -56,7 +56,7 @@
  • - <%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70"} %> + <%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70",:onchange => "homework_language_change($(this));"} %>
  • @@ -78,7 +78,7 @@
  • - +
  • @@ -173,4 +173,20 @@ $(this).next("input").val(""); }); } + + function homework_language_change(obj) + { + if(obj.val() == "1") + { +// alert(1); + $("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher%>"); + + } + else if(obj.val() == "2") + { +// alert(2); + $("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher_%>"); + + } + } \ No newline at end of file diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 49c8b5499..c6ba7cf10 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -18,7 +18,7 @@