From 634f707425d8f220d897134185700c520bb616fb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 2 Dec 2014 17:22:46 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=9A=84=E5=88=9B=E5=BB=BA=E8=80=85=E4=BC=9A=E9=9A=8F=E7=9D=80?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=98=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index c8ce6ec31..b8efab33e 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -868,7 +868,7 @@ class BidsController < ApplicationController @bid.reward_type = 3 @bid.deadline = params[:bid][:deadline] @bid.budget = 0 - @bid.author_id = User.current.id + #@bid.author_id = User.current.id @bid.commit = 0 @bid.homework_type = 1 @bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) From 19b61118ac94e4c568401fef8ad6255bf83a98f0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 2 Dec 2014 18:00:57 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=A4=B1=E8=B4=A5=E5=90=8E=E5=8F=98=E4=B8=BA?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/watchers_helper.rb | 7 +++---- app/views/courses/_set_join.js.erb | 2 +- config/locales/zh.yml | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 6d916f43e..b9d254143 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -100,13 +100,12 @@ module WatchersHelper 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) - url_f = try_join_path(:object_id => course.id) + url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' if joined - link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options + link_to text, url, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options else - link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options + link_to text, url, :remote => true, :method => method, :id => "#{course.id}", :class => []+options end end diff --git a/app/views/courses/_set_join.js.erb b/app/views/courses/_set_join.js.erb index 39e40d34e..f65d6e98b 100644 --- a/app/views/courses/_set_join.js.erb +++ b/app/views/courses/_set_join.js.erb @@ -1,5 +1,5 @@ <% if object_id%> - $("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_course_for_list(course, user) %>'); + $("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_course(course, user) %>'); <% end %> <% if @state %> <% if @state == 0 %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 5aedd93a7..23c9e8e06 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1899,7 +1899,7 @@ zh: other: 成员 label_bids_task_list: 作业列表 - label_join_course: 加入课程 + label_join_course: 加入 label_exit_course: 退出 label_new_join: 加入 label_new_course_password: 课程密码 From d71581d8342d74a6048d703d5e274cd6dd57602c Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 4 Dec 2014 09:41:31 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B5=84=E6=96=99=E6=97=B6=E6=8A=A5=E5=AF=86=E7=A0=81=E8=BF=87?= =?UTF-8?q?=E7=9F=AD=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 2 ++ app/models/user.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 686f70a11..ad6d568a5 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -138,6 +138,8 @@ class AccountController < ApplicationController @user.password,@user.password_confirmation = password,password_confirmation elsif !should_confirmation_password && !password.blank? @user.password = password + else + @user.password = "" end case Setting.self_registration when '1' diff --git a/app/models/user.rb b/app/models/user.rb index ef327f47f..29709519d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -930,7 +930,7 @@ class User < Principal def validate_password_length # Password length validation based on setting - if password.nil? || password.size < Setting.password_min_length.to_i + if !password.nil? && password.size < Setting.password_min_length.to_i errors.add(:password, :too_short, :count => Setting.password_min_length.to_i) end end From 307dacb31978a1109802c46d95343ef246a86455 Mon Sep 17 00:00:00 2001 From: zhuhao Date: Thu, 4 Dec 2014 11:07:26 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=8F=98=E4=BB=B7=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=90=8E=EF=BC=8C=E4=BF=9D=E5=AD=98=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E6=8C=89=E9=92=AE=E6=A0=B7=E5=BC=8F=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 6f13c28c7..00cbc17de 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -69,9 +69,9 @@ :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> <%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %> <%#= submit_tag l(:button_save) %> - <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'whiteButton m3p10' %> + <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'ButtonColor m3p10' %> <%#= preview_link preview_news_path(:course_id => @course, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> - <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'whiteButton m3p10' %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'ButtonColor m3p10' %> <% end %>
From 192a2f8549472d00180e468b883ac033d6223c57 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 4 Dec 2014 14:53:53 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=8E=92=E5=BA=8F=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 1ed40f691..41518e2f1 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -133,9 +133,9 @@ class FilesController < ApplicationController end if order_by.count == 1 - sort += "#{Attachment.table_name}.#{attribute} asc " + sort += "#{Attachment.table_name}.#{attribute} asc " if attribute elsif order_by.count == 2 - sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " + sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " if attribute && order_by[1] end if sort_type != params[:sort].split(",").last sort += "," @@ -176,13 +176,16 @@ class FilesController < ApplicationController end @sort = order_by[0] @order = order_by[1] - if order_by.count == 1 + if order_by.count == 1 && attribute sort += "#{Attachment.table_name}.#{attribute} asc " - elsif order_by.count == 2 + if sort_type != params[:sort].split(",").last + sort += "," + end + elsif order_by.count == 2 && order_by[1] sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " - end - if sort_type != params[:sort].split(",").last - sort += "," + if sort_type != params[:sort].split(",").last + sort += "," + end end end end From 64497b10e469115a2bbda996b55ea6c91b593037 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 4 Dec 2014 15:13:26 +0800 Subject: [PATCH 6/7] =?UTF-8?q?#1653=20=E4=BF=AE=E6=94=B9=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E5=8C=BF=E8=AF=84=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E4=BB=8D=E5=8F=AF=E4=BB=A5=E9=80=9A=E8=BF=87url?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=BD=9C=E4=B8=9A=E7=9A=84=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=92=8C=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 6088e2294..d07ee9448 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -305,7 +305,8 @@ class HomeworkAttachController < ApplicationController end def edit - if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first) + bid = @homework.bid + if (bid.comment_status == 0 || bid.open_anonymous_evaluation == 0) && (User.current.admin? || User.current.member_of_course?(bid.courses.first)) get_homework_member @homework else render_403 :message => :notice_not_authorized @@ -337,7 +338,8 @@ class HomeworkAttachController < ApplicationController end def destroy - if User.current.admin? || User.current == @homework.user + bid = @homework.bid + if (bid.comment_status == 0 || bid.open_anonymous_evaluation == 0) && (User.current.admin? || User.current == @homework.user) if @homework.destroy #respond_to do |format| # format.html { redirect_to course_for_bid_url @homework.bid } From 077476f39db6462636c5829a909c368dcf5a5ea9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 4 Dec 2014 15:24:19 +0800 Subject: [PATCH 7/7] =?UTF-8?q?#1659=20=E4=BF=AE=E6=94=B9=E5=8A=A9?= =?UTF-8?q?=E6=95=99=E7=82=B9=E5=87=BB=E7=BC=96=E8=BE=91=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=8A=A5403?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index b8efab33e..2997f4205 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -842,7 +842,7 @@ class BidsController < ApplicationController # 编辑作业 def edit @bid = Bid.find(params[:bid_id]) - if (User.current.admin?||User.current.id==@bid.author_id) + if (User.current.admin?||User.current.allowed_to?(:as_teacher,@bid.courses.first)) @course_id = params[:course_id] respond_to do |format| format.html { @@ -884,6 +884,7 @@ class BidsController < ApplicationController def new_submit_homework #render html to prepare create submit homework find_bid + find_bid render :layout => 'base_homework' end