From 73afb7e6c8e2834b2523cbf27d8db0b73df4bd3e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 22 Dec 2014 14:15:49 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E8=B0=83=E7=94=A8=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=97=B6=E9=A6=96=E5=85=88=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E8=AF=A5=E4=BD=9C=E4=B8=9A=E7=9A=84=E6=89=80=E5=B1=9E=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- db/schema.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 410818fdb..8183ed7ad 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -436,7 +436,7 @@ class UsersController < ApplicationController activity = activity.reject { |e| ((e.act_type=="Issue") && ( !e.act.visible?(User.current))) || ((e.act_type == "Journal") && (!e.act.project.visible?(User.current))) || - ((e.act_type == "Bid") && (e.act.homework_for_courses.count > 0 && + ((e.act_type == "Bid") && (e.act.courses.first && (!e.act.homework_for_courses.first.course.visible?(User.current) || !User.current.member_of_course?(e.act.homework_for_courses.first.course) || !User.current.admin?))) } diff --git a/db/schema.rb b/db/schema.rb index f12d6ad0a..a75c6eb29 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20141201085218) do +ActiveRecord::Schema.define(:version => 20141210070327) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From 053edb7934bd55827486e31ed6267a9a4447e72a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 22 Dec 2014 17:22:22 +0800 Subject: [PATCH 02/11] =?UTF-8?q?#1730=20=20=20=E4=BF=AE=E6=94=B9=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=BD=9C=E4=B8=9A=E4=B8=AD=EF=BC=8C=E5=BD=93=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=90=8D=E5=AD=97=E8=BF=87=E9=95=BF=E6=97=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E8=83=BD=E6=8D=A2=E8=A1=8C=EF=BC=8C=E8=B4=B4?= =?UTF-8?q?=E8=BF=91=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_bid_homework_show.html.erb | 8 +++++--- app/views/stores/index.html.erb | 12 +++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 7937912e4..a8296165f 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -45,7 +45,7 @@ - + diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index 7d25cb80b..404b3d604 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -37,37 +37,37 @@ From 3caf5c86570e00223b7ec43f5d25c20c1144428f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 23 Dec 2014 15:18:55 +0800 Subject: [PATCH 06/11] =?UTF-8?q?#1736=20=E7=8C=8E=E8=B1=B9=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E4=B8=AD=EF=BC=8C=E6=89=93=E5=BC=80=E6=9F=90?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=EF=BC=8C=E8=BF=9B=E5=85=A5=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E7=9C=8B=E5=88=B0=E5=8F=B3=E4=B8=8A=E6=96=B9?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=8C=89=E9=92=AE=E4=B8=8B=E7=A7=BB=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/contests/index.html.erb | 2 +- app/views/layouts/base_newcontest.html.erb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/contests/index.html.erb b/app/views/contests/index.html.erb index f49c91213..75b892461 100644 --- a/app/views/contests/index.html.erb +++ b/app/views/contests/index.html.erb @@ -43,7 +43,7 @@ if(regexName1()){$("#contests_serch").submit();} } - <%= text_field_tag 'name', params[:name], :size => 30, :onkeyup => 'regexName1();' %> + <%= text_field_tag 'name', params[:name], :size => 30, :onkeyup => 'regexName1();', :width => "125px" %> <%= hidden_field_tag 'project_type', params[:project_type] %> <%#= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %> diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index 404b3d604..494cc1f7a 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -61,13 +61,14 @@ From b512bc53e90196d522470a2780bbe1bbfe5d8e1f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 24 Dec 2014 09:08:42 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=97=A0=E6=B3=95=E7=B2=BE=E7=A1=AE=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=9A=84bUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/models/user.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8183ed7ad..56777fd22 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -377,7 +377,7 @@ class UsersController < ApplicationController } scope = User.logged.status(@status) @search_by = params[:search_by] ? params[:search_by][:id] : 0 - scope = scope.like(params[:name],@search_by) if params[:name].present? + scope = scope.like(params[:name],"0") if params[:name].present? @user_count = scope.count @user_pages = Paginator.new @user_count, @limit, params['page'] @user_base_tag = params[:id] ? 'base_users':'users_base' diff --git a/app/models/user.rb b/app/models/user.rb index cae5f1aa2..e966742f1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -206,11 +206,11 @@ class User < Principal pattern = "%#{arg.to_s.strip.downcase}%" #where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) if type == "0" - where(" LOWER(login) LIKE :p ", :p => pattern) + where(" LOWER(login) LIKE '#{pattern}' ") elsif type == "1" - where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) + where(" LOWER(concat(lastname, firstname)) LIKE '#{pattern}' ") else - where(" LOWER(mail) LIKE :p ", :p => pattern) + where(" LOWER(mail) LIKE '#{pattern}' ") end end } From e6aab5baf2d90ffa39bb2d65d92862e46c626683 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 24 Dec 2014 09:30:45 +0800 Subject: [PATCH 08/11] =?UTF-8?q?#1650=20=E8=80=81=E5=B8=88=E5=BA=94?= =?UTF-8?q?=E8=AF=A5=E5=8F=AF=E4=BB=A5=E5=88=A0=E9=99=A4=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84=E7=95=99=E8=A8=80=EF=BC=8C=E6=88=96?= =?UTF-8?q?=E5=B8=96=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_courses_jours.html.erb | 10 ++++++--- app/views/courses/_history.html.erb | 21 ++++++++++++++----- app/views/words/_journal_reply.html.erb | 3 ++- app/views/words/_journal_reply_items.html.erb | 3 ++- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index 68b92c00e..23c74ed4b 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -1,8 +1,10 @@
- <% reply_allow = JournalsForMessage.create_by_user? User.current %> + <%# reply_allow = JournalsForMessage.create_by_user? User.current %> -

<%= l(:label_user_response) %>

+

+ <%= l(:label_user_response) %> +

<% if !User.current.logged?%>
@@ -30,5 +32,7 @@
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %>
-
    <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
+
    + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> +
\ No newline at end of file diff --git a/app/views/courses/_history.html.erb b/app/views/courses/_history.html.erb index 19b5cef0d..555e94f6d 100644 --- a/app/views/courses/_history.html.erb +++ b/app/views/courses/_history.html.erb @@ -5,18 +5,29 @@ <% if journals.size > 0 %> <% for journal in journals %>
- +
- <%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%><%= format_time(journal.created_on) %> + + <%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%> + + + <%= format_time(journal.created_on) %> +
-

<%= textilizable journal.notes%>

+

+ <%= textilizable journal.notes%> +

<% ids = 'project_respond_form_'+ journal.id.to_s%> - <% if journal.user == User.current|| User.current.admin? %> + <% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %> <%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', @@ -43,7 +54,7 @@ <% end %>
- <%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true} %> + <%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true, :allow_delete => @course && User.current.allowed_to?(:as_teacher,@course)} %>
diff --git a/app/views/words/_journal_reply.html.erb b/app/views/words/_journal_reply.html.erb index 39321394c..5a6511999 100644 --- a/app/views/words/_journal_reply.html.erb +++ b/app/views/words/_journal_reply.html.erb @@ -1,7 +1,8 @@ <% id = "journal_reply_ul_" + journal.id.to_s%> +<% allow_delete ||= false%>
<% fetch_user_leaveWord_reply(journal).each do |reply|%> - <%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply,:show_name=> show_name} %> + <%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply,:show_name=> show_name, :allow_delete => allow_delete} %> <% end %>
diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index fa69176a8..24577c2ee 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -1,4 +1,5 @@ <% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %> +<% allow_delete ||= false %> <% if parent_jour%> <% reply_allow = JournalsForMessage.create_by_user? User.current %> <% ids_r = 'reply_respond_form_'+ reply.id.to_s %> @@ -30,7 +31,7 @@ <%= format_time reply.created_on %>
+ <%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author)) %> @@ -55,6 +55,8 @@ <%= link_to(bid.name, course_for_bid_path(bid), :class => 'bid_path') %> + <% if User.current.logged? && is_cur_course_student(@course) %> <% cur_user_homework = cur_user_homework_for_bid(bid) %> @@ -83,8 +85,8 @@ <%end%> <%= link_to( - l(:button_edit), - {:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id} + l(:button_edit), + {:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id} ) %> <%#= link_to( diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb index 6eca2b0bf..e6f795722 100644 --- a/app/views/stores/index.html.erb +++ b/app/views/stores/index.html.erb @@ -11,9 +11,15 @@
-
<%=l(:label_attachment)%>
-
<%=l(:field_downloads)%>
-
<%=l(:button_download)%>
+
+ <%=l(:label_attachment)%> +
+
+ <%=l(:field_downloads)%> +
+
+ <%=l(:button_download)%> +
From f68e62d1c13465ccd74a8e11771dad35e19dae65 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 23 Dec 2014 09:33:39 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9403=E3=80=81404?= =?UTF-8?q?=E7=9A=84html=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/common/403.html | 2 +- app/views/common/404.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/common/403.html b/app/views/common/403.html index f3696c4ea..a89be932d 100644 --- a/app/views/common/403.html +++ b/app/views/common/403.html @@ -7,7 +7,7 @@ body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;} div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;} div,img,tr,td{ border:0;} -table,tr,td{border:0 cellspacing:0; cellpadding:0;} +table,tr,td{border:0; cellspacing:0; cellpadding:0;} ul,li{ list-style-type:none} .cl{ clear:both; overflow:hidden; } a{ text-decoration:none; } diff --git a/app/views/common/404.html b/app/views/common/404.html index 8453e0a41..0d632c4c8 100644 --- a/app/views/common/404.html +++ b/app/views/common/404.html @@ -7,7 +7,7 @@ body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff;} div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;} div,img,tr,td{ border:0;} -table,tr,td{border:0 cellspacing:0; cellpadding:0;} +table,tr,td{border:0; cellspacing:0; cellpadding:0;} ul,li{ list-style-type:none} .cl{ clear:both; overflow:hidden; } a{ text-decoration:none; } From f834759d843d7aaef5b833554af792e5ac97038c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 23 Dec 2014 11:05:31 +0800 Subject: [PATCH 04/11] =?UTF-8?q?#1709=E6=B5=8B=E8=AF=95=E7=89=88--?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B--=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=EF=BC=9A=E6=88=90=E5=8A=9F=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=EF=BC=8C=E8=BF=98=E6=98=AF=E6=98=BE=E7=A4=BA=E4=B8=BA=E2=80=9C?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E2=80=9D=EF=BC=8C=E9=9C=80=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/watchers_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 935fb440e..842e1f1b7 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -98,7 +98,7 @@ module WatchersHelper # modify by nwb # 主讲教师不允许退出课程 return '' if user.id == course.tea_id - joined = user.member_of_course?(course) + joined = course.members.map{|m| m.user}.include? user text = joined ? l(:label_exit_course) : l(:label_new_join) url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' From 30d8d82f377800bb763aef3f27dc00b73a6979e1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 23 Dec 2014 15:13:16 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=20#1734=20=E6=9F=90=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E4=B8=AD=E5=BD=93=E6=90=9C=E7=B4=A2=E6=A1=86?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E7=82=B9=E5=87=BB=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=9A=84=E6=8F=90=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/contests/index.html.erb | 16 ++++++++-------- app/views/layouts/base_newcontest.html.erb | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/views/contests/index.html.erb b/app/views/contests/index.html.erb index 5867d7fcd..f49c91213 100644 --- a/app/views/contests/index.html.erb +++ b/app/views/contests/index.html.erb @@ -21,36 +21,36 @@