diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index a8a351eb1..145a73178 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -7,6 +7,7 @@ class BidsController < ApplicationController menu_item :project, :only => [:show_project,:show_results, :new_submit_homework] menu_item :homework_respond, :only => :homework_respond menu_item :homework_statistics, :only => :homework_statistics + menu_item :edit, :only => :edit before_filter :can_show_course,only: [] before_filter :can_show_contest,only: [] diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index ee1ca0230..5381e8757 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -8,7 +8,7 @@ class CoursesController < ApplicationController menu_item :overview menu_item :feedback, :only => :feedback menu_item :homework, :only => :homework - menu_item :new_homework + menu_item :new_homework, :only => :new_homework menu_item l(:label_sort_by_time), :only => :index menu_item l(:label_sort_by_active), :only => :index @@ -271,8 +271,7 @@ class CoursesController < ApplicationController @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all - if User.current.user_extensions.identity == 0 - if @course.save + if @course.save #unless User.current.admin? 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]) @@ -298,15 +297,13 @@ class CoursesController < ApplicationController } format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) } end - else + else #@course.destroy respond_to do |format| format.html { render :action => 'new', :layout => 'base' } #Added by young format.api { render_validation_errors(@course) } end - end - end - + end end def course diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 2cf2e7895..61760f462 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -106,7 +106,7 @@ class HomeworkAttachController < ApplicationController (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id}) AS m_score FROM homework_attaches INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id - WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC") + WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY m_score DESC") @cur_page = params[:page] || 1 @cur_type = 4 @homework_list = paginateHelper all_homework_list,10 diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index efa171d52..d7f9fa0ac 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -72,7 +72,7 @@ class ZipdownController < ApplicationController homeattach.attachments.each do |attach| homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1) end - zipping("#{Time.now.to_i.to_s}_#{homeattach.user.name}_#{homeattach.user.user_extensions.student_id}.zip", homeworks_attach_path, OUTPUT_FOLDER, true) + zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{homeattach.user.user_extensions.student_id}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true) end diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 298331c69..6d916f43e 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -97,7 +97,7 @@ module WatchersHelper return '' unless user && user.logged? # modify by nwb # 主讲教师不允许退出课程 - return '' if user.id == course.tea_id || course.is_public == 0 + return '' if user.id == course.tea_id joined = user.member_of_course?(course) text = joined ? l(:label_exit_course) : l(:label_new_join) url_t = join_path(:object_id => course.id) diff --git a/app/views/courses/_course_ad.html.erb b/app/views/courses/_course_ad.html.erb new file mode 100644 index 000000000..f8b4781f8 --- /dev/null +++ b/app/views/courses/_course_ad.html.erb @@ -0,0 +1,55 @@ + +
+ + + + + + + + + + + + + + + + +
+ <%= l(:label_contact_us) %> +

<%= l(:label_course_ad_description) %>

+ <%= l(:label_course_adcolick) %>黄井泉
+
+ Tel:15388083362
+
+ <%= l(:label_course_adcolick) %>王林春
+
+ Tel:13467631747
+
+
+ + \ No newline at end of file diff --git a/app/views/courses/homework.html.erb b/app/views/courses/homework.html.erb index 95e26abd0..68ec0dc2e 100644 --- a/app/views/courses/homework.html.erb +++ b/app/views/courses/homework.html.erb @@ -5,11 +5,12 @@ <%= javascript_include_tag 'attachments' %> -
- <% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles&Role.where(id: [3, 4, 7, 9] )).size >0))%> - <%= link_to(l(:label_course_homework_new), {:controller => 'courses', :action => 'new_homework'}, :class => 'icon icon-add') %> - <% end %> + <% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles&Role.where(id: [3, 4, 7, 9] )).size >0))%> + <%= link_to(l(:label_course_homework_new), {:controller => 'courses', :action => 'new_homework'}, :class => 'icon icon-add') %> + <% else %> + <%= l(:label_coursejoin_tip) %> + <% end %>
<%= render :partial => 'bids/bid_homework_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %> diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index ee7d995e7..629cac072 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -1,3 +1,4 @@ + <% if @events_by_day != nil && @events_by_day.size >0 %>

@@ -98,8 +99,6 @@

<% end %> - -
<%else%>
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index c48900426..46a954746 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -13,7 +13,37 @@ <%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %> <%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %>

- + + +
diff --git a/app/views/files/_course_new.html.erb b/app/views/files/_course_new.html.erb index f864f8629..2eaa70cb6 100644 --- a/app/views/files/_course_new.html.erb +++ b/app/views/files/_course_new.html.erb @@ -20,28 +20,6 @@ <% end %>
- -
- <%=l(:label_attachment_new)%> - <% attachmenttypes = course.attachmenttypes %> - <%= error_messages_for 'attachment' %> - <%= form_tag(course_files_path(course), :multipart => true,:remote => true,:method => :post,:name=>"upload_form", :class => "tabular") do %> - -

- <% if attachmenttypes.any? %> - <%= l(:attachment_type) %> - <%= select_tag "attachment_type", - options_from_collection_for_select(attachmenttypes, "id", - "typeName", 2), {style: 'width:100px'} %> - <% end %> -

- -

<%=l(:label_attachment_plural)%><%= render :partial => 'attachments/form' %>

- - <%= submit_tag l(:button_add) %> - <% end %> -
- - - -
-<% end %> - diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 9418e07cf..6f87d4171 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -74,13 +74,13 @@