diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 61944ca2c..19f9c0fa2 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -955,10 +955,34 @@ class CoursesController < ApplicationController else render_403 end - end - + #根据已有课程复制课程 + #param id:已有课程ID + def copy_course + if @course + @new_course = Course.new @course.attributes + @new_course.tea_id = User.current.id + @new_course.created_at = DateTime.now + @new_course.updated_at = DateTime.now + @new_course.endup_time = nil + if @new_course.save + r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first + m = Member.new(:user => User.current, :roles => [r]) + m.project_id = -1 + course = CourseInfos.new(:user_id => User.current.id, :course_id => @new_course.id) + #user_grades = UserGrade.create(:user_id => User.current.id, :course_id => @course.id) + if @new_course.is_public == 1 + course_status = CourseStatus.create(:course_id => @new_course.id, :watchers_count => 0, :changesets_count => 0, :grade => 0, :course_type => 1) + end + @new_course.members << m + @new_course.course_infos << course + redirect_to settings_course_url @new_course + end + else + render_404 + end + end private diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb index 0b98283ff..72d381b28 100644 --- a/app/helpers/homework_attach_helper.rb +++ b/app/helpers/homework_attach_helper.rb @@ -140,8 +140,6 @@ module HomeworkAttachHelper ####################################################### def get_student_not_batch_homework_list bid,user HomeworkAttach.find_by_sql("SELECT * FROM(SELECT homework_attaches.*, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1) AS t_score, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score, (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{user.id} AND is_teacher_score = 0) AS m_score FROM homework_attaches INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index d101fd36c..eba3c0b3c 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -314,28 +314,28 @@ module WelcomeHelper str = ' '.html_safe case event.event_type when 'news' - str << content_tag("span", l(:field_user_active_published)) << + str << content_tag("span", l('user.active.published')) << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(strip_tags(event.event_description).gsub(/ /,''), event.event_url, {:title => event.event_description}) when 'issue', 'message' , 'bid' , 'wiki-page' , 'document' - str << content_tag("span", l(:field_user_active_published)) << + str << content_tag("span", l('user.active.published')) << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(event.event_title, event.event_url, {:title => event.event_title}) when 'reply' ,'Reply', 'Memo' - str << content_tag("span", l(:field_user_active_published)) << + str << content_tag("span", l('user.active.published')) << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(strip_tags(event.event_description).gsub(/ /,''), event.event_url, {:title => event.event_description}) when 'attachment' - str << content_tag('span', l(:field_user_active_uploaded)) << + str << content_tag('span', l('user.active.uploaded')) << content_tag('span', find_all_event_type(event)) << ': '.html_safe << link_to(event.event_title, event.event_url, {:title => event.event_title}) << link_to((' ['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container.project), :class => "attachments_list_color") else - str << content_tag("span", l(:field_user_active_updated)) << + str << content_tag("span", l('user.active.updated')) << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(event.event_title, event.event_url, {:title => event.event_title}) end diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 3b2bd8dfe..a7ed0aa25 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -68,7 +68,7 @@ - <%=link_to "主页", home_path %> > + <%=link_to l(:field_homepage), home_path %> > <%=link_to @user.name, user_path %> @@ -343,7 +343,7 @@ <% if @user.user_extensions.identity == 2 %> <%= render_menu :user_enterprise_menu %> <% else %> - <%= render_menu :user_menu,@user %> + <%= render_menu :user_menu, @user %> <% end %> diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 47cfb4221..554f50633 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -151,9 +151,9 @@ <% if !User.current.user_extensions.nil? && !User.current.user_extensions.student_id.nil? %> - <%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => "请输入学号" %> + <%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => l(:label_account_identity_studentID) %> <% else %> - <%= text_field_tag :no, nil, :placeholder => "请输入学号" %> + <%= text_field_tag :no, nil, :placeholder => l(:label_account_identity_studentID) %> <% end %> @@ -217,18 +217,18 @@   <% if User.current.user_extensions.nil? %> - + readonly> <% else %> <% if User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %> - + readonly> <% elsif User.current.user_extensions.school.nil? %> - + readonly> <% else %> diff --git a/app/views/projects/_join_project.html.erb b/app/views/projects/_join_project.html.erb index fdc60904d..98ab5dcd2 100644 --- a/app/views/projects/_join_project.html.erb +++ b/app/views/projects/_join_project.html.erb @@ -1,7 +1,7 @@ - 快速进入项目通道 + <%= l('project.join.title')%>