|  |  | @ -6,8 +6,8 @@ class HomeworkCommonController < ApplicationController | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   include StudentWorkHelper |  |  |  |   include StudentWorkHelper | 
			
		
	
		
		
			
				
					
					|  |  |  |   before_filter :find_course, :only => [:index,:new,:create] |  |  |  |   before_filter :find_course, :only => [:index,:new,:create] | 
			
		
	
		
		
			
				
					
					|  |  |  |   before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set] |  |  |  |   before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment] | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set] |  |  |  |   before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment] | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   before_filter :member_of_course, :only => [:index] |  |  |  |   before_filter :member_of_course, :only => [:index] | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   def index |  |  |  |   def index | 
			
		
	
	
		
		
			
				
					|  |  | @ -38,6 +38,7 @@ class HomeworkCommonController < ApplicationController | 
			
		
	
		
		
			
				
					
					|  |  |  |   def edit |  |  |  |   def edit | 
			
		
	
		
		
			
				
					
					|  |  |  |     @user = User.current |  |  |  |     @user = User.current | 
			
		
	
		
		
			
				
					
					|  |  |  |     @is_in_course = params[:is_in_course].to_i |  |  |  |     @is_in_course = params[:is_in_course].to_i | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @course_activity = params[:course_activity].to_i | 
			
		
	
		
		
			
				
					
					|  |  |  |     respond_to do |format| |  |  |  |     respond_to do |format| | 
			
		
	
		
		
			
				
					
					|  |  |  |       format.html{render :layout => 'new_base_user'} |  |  |  |       format.html{render :layout => 'new_base_user'} | 
			
		
	
		
		
			
				
					
					|  |  |  |     end |  |  |  |     end | 
			
		
	
	
		
		
			
				
					|  |  | @ -88,8 +89,12 @@ class HomeworkCommonController < ApplicationController | 
			
		
	
		
		
			
				
					
					|  |  |  |         @homework_detail_programing.save if @homework_detail_programing |  |  |  |         @homework_detail_programing.save if @homework_detail_programing | 
			
		
	
		
		
			
				
					
					|  |  |  |         if params[:is_in_course] == "1" |  |  |  |         if params[:is_in_course] == "1" | 
			
		
	
		
		
			
				
					
					|  |  |  |           redirect_to homework_common_index_path(:course => @course.id) |  |  |  |           redirect_to homework_common_index_path(:course => @course.id) | 
			
		
	
		
		
			
				
					
					|  |  |  |         else |  |  |  |         elsif params[:is_in_course] == "0" | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |           redirect_to user_homeworks_user_path(User.current.id) |  |  |  |           redirect_to user_homeworks_user_path(User.current.id) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         elsif params[:is_in_course] == "-1" && params[:course_activity] == "0" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           redirect_to user_path(User.current.id) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         elsif params[:is_in_course] == "-1" && params[:course_activity] == "1" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           redirect_to course_path(@course.id) | 
			
		
	
		
		
			
				
					
					|  |  |  |         end |  |  |  |         end | 
			
		
	
		
		
			
				
					
					|  |  |  |       end |  |  |  |       end | 
			
		
	
		
		
			
				
					
					|  |  |  |     end |  |  |  |     end | 
			
		
	
	
		
		
			
				
					|  |  | @ -101,8 +106,12 @@ class HomeworkCommonController < ApplicationController | 
			
		
	
		
		
			
				
					
					|  |  |  |         format.html { |  |  |  |         format.html { | 
			
		
	
		
		
			
				
					
					|  |  |  |           if params[:is_in_course] == "1" |  |  |  |           if params[:is_in_course] == "1" | 
			
		
	
		
		
			
				
					
					|  |  |  |             redirect_to homework_common_index_path(:course => @course.id) |  |  |  |             redirect_to homework_common_index_path(:course => @course.id) | 
			
		
	
		
		
			
				
					
					|  |  |  |           else |  |  |  |           elsif params[:is_in_course] == "0" | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             redirect_to user_homeworks_user_path(User.current.id) |  |  |  |             redirect_to user_homeworks_user_path(User.current.id) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           elsif params[:is_in_course] == "-1" && params[:course_activity] == "0" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             redirect_to user_path(User.current.id) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           elsif params[:is_in_course] == "-1" && params[:course_activity] == "1" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             redirect_to course_path(@course.id) | 
			
		
	
		
		
			
				
					
					|  |  |  |           end |  |  |  |           end | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |       end |  |  |  |       end | 
			
		
	
	
		
		
			
				
					|  |  | @ -184,6 +193,19 @@ class HomeworkCommonController < ApplicationController | 
			
		
	
		
		
			
				
					
					|  |  |  |     end |  |  |  |     end | 
			
		
	
		
		
			
				
					
					|  |  |  |   end |  |  |  |   end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   def alert_forbidden_anonymous_comment | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if params[:user_activity_id] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       @user_activity_id = params[:user_activity_id] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       @user_activity_id = -1 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @is_in_course = params[:is_in_course] if params[:is_in_course] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @course_activity = params[:course_activity] if params[:course_Activity] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     respond_to do |format| | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       format.js | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   def programing_test |  |  |  |   def programing_test | 
			
		
	
		
		
			
				
					
					|  |  |  |     test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]} |  |  |  |     test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]} | 
			
		
	
		
		
			
				
					
					|  |  |  |     @index = params[:index] |  |  |  |     @index = params[:index] | 
			
		
	
	
		
		
			
				
					|  |  | 
 |