diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 60f12fb38..1e4b01df0 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -79,7 +79,7 @@ class AccountController < ApplicationController return end end - render :template => "account/password_recovery" + render :layout => 'static_base', :template => "account/password_recovery" return else if request.post? @@ -87,6 +87,7 @@ class AccountController < ApplicationController # user not found or not active unless user && user.active? flash.now[:error] = l(:notice_account_unknown_email) + render :layout => 'static_base' return end # user cannot change its password @@ -99,10 +100,11 @@ class AccountController < ApplicationController if token.save Mailer.run.lost_password(token) flash[:notice] = l(:notice_account_lost_email_sent) - redirect_to signin_url + redirect_to lost_password_path return end end + render :layout => 'static_base' end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6b7545fe8..a3f9f02ce 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -45,7 +45,7 @@ class UsersController < ApplicationController :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index, :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist, :user_resource,:user_resource_create,:user_resource_delete,:rename_resource,:search_user_course,:add_exist_file_to_course, - :search_user_project,:resource_preview,:resource_search,:add_exist_file_to_project,:user_messages, :edit_brief_introduction] + :search_user_project,:resource_preview,:resource_search,:add_exist_file_to_project,:user_messages,:edit_brief_introduction,:user_new_homework] #edit has been deleted by huang, 2013-9-23 before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, @@ -335,6 +335,38 @@ class UsersController < ApplicationController end end + def user_new_homework + if params[:homework_common] + homework = HomeworkCommon.new + homework.name = params[:homework_common][:name] + homework.description = params[:homework_common][:description] + homework.end_time = params[:homework_common][:end_time] + homework.publish_time = Time.now + homework.homework_type = 1 + homework.late_penalty = 0 + homework.user_id = User.current.id + homework.course_id = params[:course_id] + + homework.save_attachments(params[:attachments]) + render_attachment_warning_if_needed(homework) + + #匿评作业相关属性 + homework_detail_manual = HomeworkDetailManual.new + homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 + homework_detail_manual.comment_status = 1 + homework_detail_manual.evaluation_start = Time.now + homework_detail_manual.evaluation_end = Time.now + homework_detail_manual.evaluation_num = params[:evaluation_num] || 3 + homework_detail_manual.absence_penalty = 0 + homework.homework_detail_manual = homework_detail_manual + + if homework.save + homework_detail_manual.save if homework_detail_manual + redirect_to user_homeworks_user_path(User.current.id) + end + end + end + include CoursesHelper def user_courses diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 342ee70be..ebfd9f881 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -537,4 +537,16 @@ module UsersHelper end end + #获取指定用户作为老师的课程 + def get_as_teacher_courses user + type = [] + user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| + option = [] + option << course.name + option << course.id + type << option + end + type + end + end diff --git a/app/views/account/agreement.html.erb b/app/views/account/agreement.html.erb index f18731348..95befbfd4 100644 --- a/app/views/account/agreement.html.erb +++ b/app/views/account/agreement.html.erb @@ -1,5 +1,5 @@ <%= stylesheet_link_tag 'new_user'%> -